@argusoft/medplat-core 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/AccessRights-DUgY6ewy.js +1031 -0
  2. package/dist/AccessRights-DUgY6ewy.js.map +1 -0
  3. package/dist/AddEditQueryBuilder-D-iQiVIe.js +365 -0
  4. package/dist/AddEditQueryBuilder-D-iQiVIe.js.map +1 -0
  5. package/dist/{AddFeatures-v3TmGQee.js → AddFeatures-D1sU8RjY.js} +2 -2
  6. package/dist/{AddFeatures-v3TmGQee.js.map → AddFeatures-D1sU8RjY.js.map} +1 -1
  7. package/dist/AddLabelModal-Bq-wRqv9.js +631 -0
  8. package/dist/AddLabelModal-Bq-wRqv9.js.map +1 -0
  9. package/dist/AddMenuConfiguration-c6ZKiN0i.js +8898 -0
  10. package/dist/AddMenuConfiguration-c6ZKiN0i.js.map +1 -0
  11. package/dist/AppModal-CCtrQ5Tr.js +394 -0
  12. package/dist/AppModal-CCtrQ5Tr.js.map +1 -0
  13. package/dist/BrandsPage-DMw2vT0u-BVhvhc6J.js +387 -0
  14. package/dist/BrandsPage-DMw2vT0u-BVhvhc6J.js.map +1 -0
  15. package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js +398 -0
  16. package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js.map +1 -0
  17. package/dist/{ChangePasswordModalCore-DutQAZOx.js → ChangePasswordModalCore-lQ9GamH1.js} +1605 -1610
  18. package/dist/ChangePasswordModalCore-lQ9GamH1.js.map +1 -0
  19. package/dist/ConditionConfig-BQBmBHaM.js +408 -0
  20. package/dist/ConditionConfig-BQBmBHaM.js.map +1 -0
  21. package/dist/DashboardPage-asr2XDRu-uOOlX9Vq.js +435 -0
  22. package/dist/DashboardPage-asr2XDRu-uOOlX9Vq.js.map +1 -0
  23. package/dist/EventConfig-BY2cgGyx.js +27 -0
  24. package/dist/EventConfig-BY2cgGyx.js.map +1 -0
  25. package/dist/EventConfigurations-CUPEN5BV.js +544 -0
  26. package/dist/EventConfigurations-CUPEN5BV.js.map +1 -0
  27. package/dist/EventConfigurations.css +1 -1
  28. package/dist/EventsExceptionModal-BX-ArkBE.js +188 -0
  29. package/dist/EventsExceptionModal-BX-ArkBE.js.map +1 -0
  30. package/dist/EventsUi-D6O9S7BK.js +258 -0
  31. package/dist/EventsUi-D6O9S7BK.js.map +1 -0
  32. package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js +79 -0
  33. package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js.map +1 -0
  34. package/dist/FeatureMenu-CHsBbw3W.js +525 -0
  35. package/dist/FeatureMenu-CHsBbw3W.js.map +1 -0
  36. package/dist/{FhirServerList-Dkq7Kbes.js → FhirServerList-iXBPkRVF.js} +22 -22
  37. package/dist/{FhirServerList-Dkq7Kbes.js.map → FhirServerList-iXBPkRVF.js.map} +1 -1
  38. package/dist/{FhirServerWizard-Db6Hm4bQ.js → FhirServerWizard-DZI8Olku.js} +15 -15
  39. package/dist/{FhirServerWizard-Db6Hm4bQ.js.map → FhirServerWizard-DZI8Olku.js.map} +1 -1
  40. package/dist/FlywayQuery-CQygj51V.js +179 -0
  41. package/dist/FlywayQuery-CQygj51V.js.map +1 -0
  42. package/dist/GrantPermissionModal-D7iNZd0M.js +239 -0
  43. package/dist/GrantPermissionModal-D7iNZd0M.js.map +1 -0
  44. package/dist/ImmunizationConfigurationBase-aUtx0JEe.js +8019 -0
  45. package/dist/ImmunizationConfigurationBase-aUtx0JEe.js.map +1 -0
  46. package/dist/ImmunizationConfigurationBase.css +1 -1
  47. package/dist/ImmunizationConfigurationsList-TZcLDEci.js +369 -0
  48. package/dist/ImmunizationConfigurationsList-TZcLDEci.js.map +1 -0
  49. package/dist/InventoryPage-DOotGZrj-CoPjOJEI.js +665 -0
  50. package/dist/InventoryPage-DOotGZrj-CoPjOJEI.js.map +1 -0
  51. package/dist/LanguagesModal-B3NTebYT.js +352 -0
  52. package/dist/LanguagesModal-B3NTebYT.js.map +1 -0
  53. package/dist/ManageDynamicFeature-BU0I45dd.js +4475 -0
  54. package/dist/ManageDynamicFeature-BU0I45dd.js.map +1 -0
  55. package/dist/ManageEventConfiguration-DqW3krT6.js +1216 -0
  56. package/dist/ManageEventConfiguration-DqW3krT6.js.map +1 -0
  57. package/dist/ManageEventConfiguration.css +1 -1
  58. package/dist/{ManageNotification-CfhHlfxA.js → ManageNotification-C5MhV77Q.js} +2 -2
  59. package/dist/{ManageNotification-CfhHlfxA.js.map → ManageNotification-C5MhV77Q.js.map} +1 -1
  60. package/dist/{ManageRole-4Y2PP4dQ.js → ManageRole-CNZBRKGU.js} +2 -2
  61. package/dist/{ManageRole-4Y2PP4dQ.js.map → ManageRole-CNZBRKGU.js.map} +1 -1
  62. package/dist/ManageTranslation-vRiptUAP.js +833 -0
  63. package/dist/ManageTranslation-vRiptUAP.js.map +1 -0
  64. package/dist/ManageTranslation.css +1 -1
  65. package/dist/{ManageUser-DDzyd9jm.js → ManageUser-DZltBina.js} +224 -224
  66. package/dist/{ManageUser-DDzyd9jm.js.map → ManageUser-DZltBina.js.map} +1 -1
  67. package/dist/MemberProfileCard-D5CgkTdJ-D2NgDJl3.js +272 -0
  68. package/dist/MemberProfileCard-D5CgkTdJ-D2NgDJl3.js.map +1 -0
  69. package/dist/MobileAnalytics-BLOionG_.js +17301 -0
  70. package/dist/MobileAnalytics-BLOionG_.js.map +1 -0
  71. package/dist/MobileMenuManagement-68Wijb0X.js +220 -0
  72. package/dist/MobileMenuManagement-68Wijb0X.js.map +1 -0
  73. package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js +752 -0
  74. package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js.map +1 -0
  75. package/dist/NotificationFlywayQuery-BAHVjf6N.js +247 -0
  76. package/dist/NotificationFlywayQuery-BAHVjf6N.js.map +1 -0
  77. package/dist/{NotificationList-BMFpNUJG.js → NotificationList-DEyRZEuM.js} +2 -2
  78. package/dist/{NotificationList-BMFpNUJG.js.map → NotificationList-DEyRZEuM.js.map} +1 -1
  79. package/dist/OtherTypeEventConfigModal-stNmuSv_.js +1812 -0
  80. package/dist/OtherTypeEventConfigModal-stNmuSv_.js.map +1 -0
  81. package/dist/PaymentCreatePage-DfvSZ-kB-CckogYoe.js +482 -0
  82. package/dist/PaymentCreatePage-DfvSZ-kB-CckogYoe.js.map +1 -0
  83. package/dist/PaymentsPage-DMNjYWAJ-ChO9IXmk.js +157 -0
  84. package/dist/PaymentsPage-DMNjYWAJ-ChO9IXmk.js.map +1 -0
  85. package/dist/PermissionsModal-CCYkcKlC.js +151 -0
  86. package/dist/PermissionsModal-CCYkcKlC.js.map +1 -0
  87. package/dist/PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js +119 -0
  88. package/dist/PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js.map +1 -0
  89. package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js +783 -0
  90. package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js.map +1 -0
  91. package/dist/PickupsPage-D7zyioJB-bHKnARYw.js +818 -0
  92. package/dist/PickupsPage-D7zyioJB-bHKnARYw.js.map +1 -0
  93. package/dist/PmGuard-BZE-y4In-D_pUm5MP.js +599 -0
  94. package/dist/PmGuard-BZE-y4In-D_pUm5MP.js.map +1 -0
  95. package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js +1305 -0
  96. package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map +1 -0
  97. package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js +253 -0
  98. package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js.map +1 -0
  99. package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js +675 -0
  100. package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map +1 -0
  101. package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js +1577 -0
  102. package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js.map +1 -0
  103. package/dist/PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js +279 -0
  104. package/dist/PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js.map +1 -0
  105. package/dist/PurchasesPage-DgL5T6BY-DePUuE9l.js +293 -0
  106. package/dist/PurchasesPage-DgL5T6BY-DePUuE9l.js.map +1 -0
  107. package/dist/QueryBuilder-CXaBe6sr.js +478 -0
  108. package/dist/QueryBuilder-CXaBe6sr.js.map +1 -0
  109. package/dist/{RoleManagement-DEiBNfT8.js → RoleManagement-s8iNx2Mu.js} +145 -155
  110. package/dist/RoleManagement-s8iNx2Mu.js.map +1 -0
  111. package/dist/Roles-BIyiic67.js +14 -0
  112. package/dist/Roles-BIyiic67.js.map +1 -0
  113. package/dist/SaleCreatePage-CZnIOydv-DKBw-qp7.js +544 -0
  114. package/dist/SaleCreatePage-CZnIOydv-DKBw-qp7.js.map +1 -0
  115. package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js +315 -0
  116. package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js.map +1 -0
  117. package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js +676 -0
  118. package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js.map +1 -0
  119. package/dist/ShowFlywayQuery-D10Olk5Z.js +154 -0
  120. package/dist/ShowFlywayQuery-D10Olk5Z.js.map +1 -0
  121. package/dist/{ShowFlywayQuery-DVRCd384.js → ShowFlywayQuery-DIOUdYfG.js} +170 -123
  122. package/dist/ShowFlywayQuery-DIOUdYfG.js.map +1 -0
  123. package/dist/ShowQueryHistory-DRBKYDKk.js +313 -0
  124. package/dist/ShowQueryHistory-DRBKYDKk.js.map +1 -0
  125. package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js +728 -0
  126. package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js.map +1 -0
  127. package/dist/SubMenu-BdMTYtC1.js +319 -0
  128. package/dist/SubMenu-BdMTYtC1.js.map +1 -0
  129. package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js +746 -0
  130. package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js.map +1 -0
  131. package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js +315 -0
  132. package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js.map +1 -0
  133. package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js +476 -0
  134. package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js.map +1 -0
  135. package/dist/TypeConfiguration-JbRCN6GR.js +114 -0
  136. package/dist/TypeConfiguration-JbRCN6GR.js.map +1 -0
  137. package/dist/{UserList-Bc8gYxRL.js → UserList-L41Xw0Q6.js} +253 -236
  138. package/dist/{UserList-Bc8gYxRL.js.map → UserList-L41Xw0Q6.js.map} +1 -1
  139. package/dist/Users-CsJ08Kjm.js.map +1 -1
  140. package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js +321 -0
  141. package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js.map +1 -0
  142. package/dist/constants-DpXnLsAB-D6lN5cjK.js +445 -0
  143. package/dist/constants-DpXnLsAB-D6lN5cjK.js.map +1 -0
  144. package/dist/{dashboardLayoutUtils-D1xCAxp3.js → dashboardLayoutUtils-CJivzaU1.js} +95 -92
  145. package/dist/dashboardLayoutUtils-CJivzaU1.js.map +1 -0
  146. package/dist/format-UOyOu75i-D0GyylyQ.js +63 -0
  147. package/dist/format-UOyOu75i-D0GyylyQ.js.map +1 -0
  148. package/dist/index.css +1 -1
  149. package/dist/index.js +1 -1
  150. package/dist/index.lib-ETRQOzvE.js +894 -0
  151. package/dist/index.lib-ETRQOzvE.js.map +1 -0
  152. package/dist/listValueStore-BFQtDYIR-Bj0yX145.js +36 -0
  153. package/dist/listValueStore-BFQtDYIR-Bj0yX145.js.map +1 -0
  154. package/dist/useFieldErrors-hDG8ox_x-DbSAzrGo.js +28 -0
  155. package/dist/useFieldErrors-hDG8ox_x-DbSAzrGo.js.map +1 -0
  156. package/dist/validation-BzlHnL-r-CCJm2utQ.js +125 -0
  157. package/dist/validation-BzlHnL-r-CCJm2utQ.js.map +1 -0
  158. package/package.json +4 -3
  159. package/dist/AccessRights-Zm8Obm4N.js +0 -1284
  160. package/dist/AccessRights-Zm8Obm4N.js.map +0 -1
  161. package/dist/AddEditQueryBuilder-Brdnm6rQ.js +0 -313
  162. package/dist/AddEditQueryBuilder-Brdnm6rQ.js.map +0 -1
  163. package/dist/AddLabelModal-DFllBVcd.js +0 -734
  164. package/dist/AddLabelModal-DFllBVcd.js.map +0 -1
  165. package/dist/AddMenuConfiguration-Ce91MhnU.js +0 -8547
  166. package/dist/AddMenuConfiguration-Ce91MhnU.js.map +0 -1
  167. package/dist/AppModal-CtG2GjD_.js +0 -428
  168. package/dist/AppModal-CtG2GjD_.js.map +0 -1
  169. package/dist/ChangePasswordModalCore-DutQAZOx.js.map +0 -1
  170. package/dist/ConditionConfig-B4Ffpgj3.js +0 -395
  171. package/dist/ConditionConfig-B4Ffpgj3.js.map +0 -1
  172. package/dist/ConditionConfig.css +0 -1
  173. package/dist/EventConfigurations-BJcURufo.js +0 -449
  174. package/dist/EventConfigurations-BJcURufo.js.map +0 -1
  175. package/dist/EventsExceptionModal-BlZtBQoR.js +0 -200
  176. package/dist/EventsExceptionModal-BlZtBQoR.js.map +0 -1
  177. package/dist/EventsSkeleton-DK6JDKAK.js +0 -83
  178. package/dist/EventsSkeleton-DK6JDKAK.js.map +0 -1
  179. package/dist/FeatureMenu-C3503UIX.js +0 -265
  180. package/dist/FeatureMenu-C3503UIX.js.map +0 -1
  181. package/dist/FlywayQuery-Cx2sly6g.js +0 -169
  182. package/dist/FlywayQuery-Cx2sly6g.js.map +0 -1
  183. package/dist/ImmunizationConfigurationBase-DLQVSNnt.js +0 -5895
  184. package/dist/ImmunizationConfigurationBase-DLQVSNnt.js.map +0 -1
  185. package/dist/ImmunizationConfigurationsList-DdSZicTP.js +0 -344
  186. package/dist/ImmunizationConfigurationsList-DdSZicTP.js.map +0 -1
  187. package/dist/LanguagesModal-D6VfaGrl.js +0 -394
  188. package/dist/LanguagesModal-D6VfaGrl.js.map +0 -1
  189. package/dist/ManageDynamicFeature-dt096fyj.js +0 -4189
  190. package/dist/ManageDynamicFeature-dt096fyj.js.map +0 -1
  191. package/dist/ManageEventConfiguration-BpSJszSX.js +0 -1017
  192. package/dist/ManageEventConfiguration-BpSJszSX.js.map +0 -1
  193. package/dist/ManageTranslation-B4C9-lWD.js +0 -625
  194. package/dist/ManageTranslation-B4C9-lWD.js.map +0 -1
  195. package/dist/MobileMenuManagement-Cf8IZlla.js +0 -108
  196. package/dist/MobileMenuManagement-Cf8IZlla.js.map +0 -1
  197. package/dist/MobileTypeEventConfigModal-DUkUYACe.js +0 -783
  198. package/dist/MobileTypeEventConfigModal-DUkUYACe.js.map +0 -1
  199. package/dist/NotificationFlywayQuery-BY8Zzml_.js +0 -244
  200. package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +0 -1
  201. package/dist/OtherTypeEventConfigModal-CYBfr2XE.js +0 -2046
  202. package/dist/OtherTypeEventConfigModal-CYBfr2XE.js.map +0 -1
  203. package/dist/QueryBuilder-z7eqfd7D.js +0 -383
  204. package/dist/QueryBuilder-z7eqfd7D.js.map +0 -1
  205. package/dist/RoleManagement-DEiBNfT8.js.map +0 -1
  206. package/dist/ShowFlywayQuery-DVRCd384.js.map +0 -1
  207. package/dist/ShowFlywayQuery-tj42YQAS.js +0 -130
  208. package/dist/ShowFlywayQuery-tj42YQAS.js.map +0 -1
  209. package/dist/ShowQueryHistory-BDN0tzHg.js +0 -190
  210. package/dist/ShowQueryHistory-BDN0tzHg.js.map +0 -1
  211. package/dist/SubMenu-B072oEGb.js +0 -191
  212. package/dist/SubMenu-B072oEGb.js.map +0 -1
  213. package/dist/TypeConfiguration-C3xoP2Nb.js +0 -117
  214. package/dist/TypeConfiguration-C3xoP2Nb.js.map +0 -1
  215. package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +0 -1
  216. package/dist/index.lib-C3fwoM3y.js +0 -820
  217. package/dist/index.lib-C3fwoM3y.js.map +0 -1
@@ -0,0 +1,675 @@
1
+ import { S as xe, K as R, G as U, t as ge, k as J, P as fe, d as Ie, g as we, E as Pe } from "./ImmunizationConfigurationBase-aUtx0JEe.js";
2
+ import { O as Te, v as Ce, m as Se } from "./constants-DpXnLsAB-D6lN5cjK.js";
3
+ import { o as X, t as ve, s as De } from "./format-UOyOu75i-D0GyylyQ.js";
4
+ import { r as P, b as G, S as $e, x as qe, y as Fe, C as _ } from "./validation-BzlHnL-r-CCJm2utQ.js";
5
+ import { n as Ae } from "./useFieldErrors-hDG8ox_x-DbSAzrGo.js";
6
+ import { Y as Ee, Z as Re, Q as Ue, q as Ne } from "./PmGuard-BZE-y4In-D_pUm5MP.js";
7
+ import { d as Be } from "./FacilityPicker-DYl_PDyt-Cbwo2tAY.js";
8
+ import { useMemo as N, useState as $, useEffect as ee } from "react";
9
+ import { jsxs as d, jsx as t, Fragment as Me } from "react/jsx-runtime";
10
+ import { Box as Le, Alert as ke, Card as q, CardContent as B, Grid as c, Stack as F, Typography as M, Table as Ye, TableHead as ze, TableRow as re, TableCell as p, TableBody as We, Chip as Oe, Button as j, Divider as te, TextField as T, InputAdornment as Xe, Tooltip as Ge, IconButton as ie } from "@mui/material";
11
+ import { v4 as L } from "uuid";
12
+ import je from "@mui/icons-material/AddRounded";
13
+ import { useNavigate as He } from "react-router-dom";
14
+ import Qe from "@mui/icons-material/Inventory2Rounded";
15
+ import Ve from "@mui/icons-material/SaveRounded";
16
+ import Ke from "@mui/icons-material/DeleteOutlineRounded";
17
+ import Ze from "@mui/icons-material/AutorenewRounded";
18
+ var Je = [{
19
+ value: "USER",
20
+ label: "Personal Use"
21
+ }, {
22
+ value: "FACILITY",
23
+ label: "Facility Use"
24
+ }], H = () => L().split("-")[0].toUpperCase();
25
+ function ae(C = !1) {
26
+ return {
27
+ key: L(),
28
+ batchId: L(),
29
+ productId: "",
30
+ quantity: 1,
31
+ buyPrice: "",
32
+ expectedSalePrice: "",
33
+ expiryDate: "",
34
+ lotNumber: C ? H() : "",
35
+ manufactureDate: "",
36
+ storageUnitId: ""
37
+ };
38
+ }
39
+ function br() {
40
+ let C = He(), s = xe(), y = (s == null ? void 0 : s.managePurchaseAmounts) !== !1, k = (s == null ? void 0 : s.manageSales) !== !1, S = (s == null ? void 0 : s.allowPersonalPurchase) !== !1, A = (s == null ? void 0 : s.allowFacilityPurchase) !== !1, m = (s == null ? void 0 : s.requirePurchaseConfirmation) === !0, v = !m && (s == null ? void 0 : s.autoGenerateLotNumber) === !0, ne = N(() => Je.filter((e) => (e.value !== "USER" || S) && (e.value !== "FACILITY" || A)), [S, A]), oe = S ? "USER" : "FACILITY", [E, le] = $([]), [Y, se] = $([]), [z, ue] = $([]), [Q, W] = $(""), l = Ae(), O = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10), [a, b] = $({
41
+ id: L(),
42
+ ownerType: oe,
43
+ ownerId: "",
44
+ purchaseDate: O,
45
+ paymentMode: "CASH",
46
+ notes: "",
47
+ items: [ae()]
48
+ });
49
+ ee(() => {
50
+ !S && a.ownerType === "USER" ? b((e) => ({
51
+ ...e,
52
+ ownerType: "FACILITY",
53
+ ownerId: ""
54
+ })) : !A && a.ownerType === "FACILITY" && b((e) => ({
55
+ ...e,
56
+ ownerType: "USER",
57
+ ownerId: ""
58
+ }));
59
+ }, [
60
+ S,
61
+ A,
62
+ a.ownerType
63
+ ]), ee(() => {
64
+ v && b((e) => e.items.some((r) => !r.lotNumber) ? {
65
+ ...e,
66
+ items: e.items.map((r) => r.lotNumber ? r : {
67
+ ...r,
68
+ lotNumber: H()
69
+ })
70
+ } : e);
71
+ }, [v]), Ee("update.manage.productManagement.purchase", () => {
72
+ async function e() {
73
+ var r, n;
74
+ try {
75
+ let [i, u, h] = await Promise.all([
76
+ Ie(),
77
+ we({ activeOnly: !0 }),
78
+ Pe().catch(() => [])
79
+ ]);
80
+ le(i), se(u), ue(h);
81
+ } catch (i) {
82
+ W(((n = (r = i == null ? void 0 : i.response) == null ? void 0 : r.data) == null ? void 0 : n.message) ?? (i == null ? void 0 : i.message) ?? "Failed to load reference data");
83
+ }
84
+ }
85
+ e();
86
+ }, []);
87
+ let V = N(() => a.ownerType === "USER" ? z.filter((e) => e.ownerType === "USER" && Number(e.qtyRemaining ?? 0) > 0 && e.status !== "EXPIRED" && e.status !== "EXHAUSTED") : a.ownerType === "FACILITY" && a.ownerId ? z.filter((e) => e.ownerType === "FACILITY" && e.ownerId === a.ownerId && Number(e.qtyRemaining ?? 0) > 0 && e.status !== "EXPIRED" && e.status !== "EXHAUSTED") : [], [
88
+ z,
89
+ a.ownerType,
90
+ a.ownerId
91
+ ]), de = N(() => a.ownerType !== "FACILITY" || !a.ownerId ? [] : Y.filter((e) => e.ownerId === a.ownerId), [
92
+ Y,
93
+ a.ownerType,
94
+ a.ownerId
95
+ ]);
96
+ function f(e, r, n) {
97
+ b((i) => {
98
+ let u = i.items.slice();
99
+ return u[e] = {
100
+ ...u[e],
101
+ [r]: n
102
+ }, {
103
+ ...i,
104
+ items: u
105
+ };
106
+ });
107
+ }
108
+ function ce(e) {
109
+ b((r) => ({
110
+ ...r,
111
+ items: r.items.filter((n, i) => i !== e)
112
+ }));
113
+ }
114
+ function me() {
115
+ b((e) => ({
116
+ ...e,
117
+ items: [...e.items, ae(v)]
118
+ }));
119
+ }
120
+ let D = N(() => {
121
+ let e = !1;
122
+ return {
123
+ sum: a.items.reduce((r, n) => {
124
+ if (n.buyPrice === "" || n.quantity === "" || n.quantity == null) return r;
125
+ let i = Number(n.quantity), u = Number(n.buyPrice);
126
+ return Number.isNaN(i) || Number.isNaN(u) ? r : (e = !0, r + i * u);
127
+ }, 0),
128
+ priced: e
129
+ };
130
+ }, [a.items]), I = {
131
+ ownerType: P(a.ownerType, "Purchase type"),
132
+ ownerId: a.ownerType === "FACILITY" ? P(a.ownerId, "Facility") : "",
133
+ purchaseDate: P(a.purchaseDate, "Purchase date")
134
+ }, K = a.items.map((e) => {
135
+ let r = E.find((x) => x.id === e.productId), n = (r == null ? void 0 : r.hasExpiry) === !0, i = (r == null ? void 0 : r.needsStorageUnit) === !0 && a.ownerType === "FACILITY" ? P(e.storageUnitId, "Storage unit") : "";
136
+ if (!i && e.storageUnitId && (r != null && r.vaccineConfig)) {
137
+ let x = r.vaccineConfig, o = Y.find((g) => g.id === e.storageUnitId);
138
+ if (x.storageTempMinCelsius != null && x.storageTempMaxCelsius != null && o) {
139
+ let g = o.operatingTempMinCelsius, w = o.operatingTempMaxCelsius;
140
+ (g == null || w == null || Number(g) > Number(x.storageTempMinCelsius) || Number(w) < Number(x.storageTempMaxCelsius)) && (i = `Unit operates ${g ?? "?"}°C → ${w ?? "?"}°C, which cannot cover this product's required ${x.storageTempMinCelsius}°C → ${x.storageTempMaxCelsius}°C.`);
141
+ }
142
+ }
143
+ let u = (r == null ? void 0 : r.salePriceMode) || "FREE", h = "";
144
+ return k && r && !r.notForSale && u !== "FIXED" && e.expectedSalePrice !== "" && e.expectedSalePrice != null && (h = G(e.expectedSalePrice), !h && u === "CAPPED" && r.salePrice != null && Number(e.expectedSalePrice) > Number(r.salePrice) && (h = `Cannot exceed the MRP (${X(r.salePrice)}).`)), {
145
+ productId: P(e.productId, "Product"),
146
+ quantity: Fe(e.quantity),
147
+ buyPrice: y ? P(e.buyPrice, "Buy price") || G(e.buyPrice) || (Number(e.buyPrice) > 0 ? "" : "Buy price must be greater than 0.") : G(e.buyPrice),
148
+ expectedSalePrice: h,
149
+ expiryDate: m ? "" : n && P(e.expiryDate, "Expiry date") || qe(e.expiryDate, { label: "Expiry" }),
150
+ manufactureDate: $e(e.manufactureDate, { label: "Manufacture date" }),
151
+ storageUnitId: i
152
+ };
153
+ }), Z = _(I) && K.every(_) && a.items.length > 0;
154
+ async function pe() {
155
+ var r, n;
156
+ if (!Z) {
157
+ l.markAllTouched(), W("Please fix the highlighted fields and try again.");
158
+ return;
159
+ }
160
+ let e = {
161
+ id: a.id,
162
+ ownerType: a.ownerType,
163
+ ownerId: a.ownerType === "FACILITY" ? a.ownerId : null,
164
+ purchaseDate: a.purchaseDate,
165
+ paymentMode: y && a.paymentMode || null,
166
+ totalAmount: y && D.priced ? Number(D.sum.toFixed(2)) : null,
167
+ notes: a.notes || null,
168
+ items: a.items.map((i) => ({
169
+ batchId: i.batchId,
170
+ productId: i.productId,
171
+ quantity: Number(i.quantity),
172
+ buyPrice: y && i.buyPrice !== "" ? Number(i.buyPrice) : null,
173
+ expectedSalePrice: (() => {
174
+ if (!k) return null;
175
+ let u = E.find((h) => h.id === i.productId);
176
+ return !u || u.notForSale || u.salePriceMode === "FIXED" || i.expectedSalePrice === "" ? null : Number(i.expectedSalePrice);
177
+ })(),
178
+ expiryDate: i.expiryDate || null,
179
+ lotNumber: i.lotNumber || null,
180
+ manufactureDate: i.manufactureDate || null,
181
+ storageUnitId: i.storageUnitId || null
182
+ }))
183
+ };
184
+ try {
185
+ if (m) {
186
+ let i = await ge(e);
187
+ J({
188
+ message: "Purchase request submitted for approval.",
189
+ type: "success"
190
+ }), C(`/ui/medplat/manage/pm/purchase-requests/${(i == null ? void 0 : i.id) ?? a.id}`);
191
+ } else await fe(e), J({
192
+ message: "Purchase recorded.",
193
+ type: "success"
194
+ }), C("/ui/medplat/manage/pm/purchases");
195
+ } catch (i) {
196
+ W(((n = (r = i == null ? void 0 : i.response) == null ? void 0 : r.data) == null ? void 0 : n.message) ?? (i == null ? void 0 : i.message) ?? (m ? "Failed to submit purchase request" : "Failed to record purchase"));
197
+ }
198
+ }
199
+ return /* @__PURE__ */ d(Le, { children: [/* @__PURE__ */ t(Re, {}), /* @__PURE__ */ t(Ue, {
200
+ perm: "update.manage.productManagement.purchase",
201
+ title: m ? "You don’t have permission to submit purchase requests" : "You don’t have permission to record purchases",
202
+ children: /* @__PURE__ */ d(Ne, {
203
+ title: m ? "Submit Purchase Request" : "Record Purchase",
204
+ subtitle: m ? "Purchases need approval before stock is added. Submit the request and wait for a manager to confirm." : "Each item creates a batch that you can track and a record in your ledger.",
205
+ actions: /* @__PURE__ */ d(F, {
206
+ direction: "row",
207
+ spacing: 1,
208
+ children: [/* @__PURE__ */ t(j, {
209
+ variant: "outlined",
210
+ onClick: () => C(m ? "/ui/medplat/manage/pm/purchase-requests" : "/ui/medplat/manage/pm/purchases"),
211
+ children: "Cancel"
212
+ }), /* @__PURE__ */ t(j, {
213
+ variant: "contained",
214
+ startIcon: /* @__PURE__ */ t(Ve, {}),
215
+ disabled: !Z,
216
+ onClick: () => void pe(),
217
+ children: m ? "Submit Request" : "Save"
218
+ })]
219
+ }),
220
+ children: [
221
+ Q ? /* @__PURE__ */ t(ke, {
222
+ severity: "error",
223
+ sx: { mb: 2 },
224
+ children: Q
225
+ }) : null,
226
+ /* @__PURE__ */ t(q, {
227
+ sx: {
228
+ borderRadius: 1.5,
229
+ mb: 2,
230
+ border: "1px solid",
231
+ borderColor: "divider",
232
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
233
+ },
234
+ children: /* @__PURE__ */ d(B, {
235
+ sx: { p: 2.5 },
236
+ children: [/* @__PURE__ */ t(R, {
237
+ eyebrow: "Step 1",
238
+ title: "Purchase for",
239
+ hint: "Choose who will own this stock: yourself or a facility.",
240
+ sx: { mb: 2 }
241
+ }), /* @__PURE__ */ d(c, {
242
+ container: !0,
243
+ spacing: 2,
244
+ children: [/* @__PURE__ */ t(c, {
245
+ item: !0,
246
+ xs: 12,
247
+ md: 4,
248
+ children: /* @__PURE__ */ t(U, {
249
+ label: "Purchase Type",
250
+ required: !0,
251
+ value: a.ownerType,
252
+ onChange: (e) => b({
253
+ ...a,
254
+ ownerType: e,
255
+ ownerId: ""
256
+ }),
257
+ onBlur: l.onBlur("ownerType"),
258
+ error: l.show("ownerType") && !!I.ownerType,
259
+ options: ne,
260
+ helperText: l.show("ownerType") && I.ownerType ? I.ownerType : "Personal stock vs. facility stock"
261
+ })
262
+ }), a.ownerType === "FACILITY" ? /* @__PURE__ */ t(c, {
263
+ item: !0,
264
+ xs: 12,
265
+ md: 4,
266
+ children: /* @__PURE__ */ t(Be, {
267
+ required: !0,
268
+ value: a.ownerId,
269
+ onChange: (e) => b({
270
+ ...a,
271
+ ownerId: e
272
+ }),
273
+ onBlur: l.onBlur("ownerId"),
274
+ error: l.show("ownerId") && !!I.ownerId,
275
+ helperText: l.show("ownerId") && I.ownerId ? I.ownerId : "Search for the facility."
276
+ })
277
+ }) : null]
278
+ })]
279
+ })
280
+ }),
281
+ a.ownerType === "USER" || a.ownerType === "FACILITY" && a.ownerId ? /* @__PURE__ */ t(q, {
282
+ sx: {
283
+ borderRadius: 1.5,
284
+ mb: 2,
285
+ border: "1px solid",
286
+ borderColor: "divider",
287
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
288
+ },
289
+ children: /* @__PURE__ */ d(B, {
290
+ sx: { p: 2.5 },
291
+ children: [/* @__PURE__ */ t(R, {
292
+ eyebrow: "Context",
293
+ title: "Existing inventory",
294
+ hint: a.ownerType === "USER" ? "Your current stock." : "What this facility already has, including where it is stored.",
295
+ sx: { mb: 1.5 }
296
+ }), V.length === 0 ? /* @__PURE__ */ d(F, {
297
+ direction: "row",
298
+ spacing: 1.25,
299
+ alignItems: "center",
300
+ sx: {
301
+ py: 1.5,
302
+ color: "text.secondary"
303
+ },
304
+ children: [/* @__PURE__ */ t(Qe, { fontSize: "small" }), /* @__PURE__ */ t(M, {
305
+ variant: "body2",
306
+ children: "No active stock yet for this owner."
307
+ })]
308
+ }) : /* @__PURE__ */ d(Ye, {
309
+ size: "small",
310
+ children: [/* @__PURE__ */ t(ze, { children: /* @__PURE__ */ d(re, { children: [
311
+ /* @__PURE__ */ t(p, { children: "Product" }),
312
+ /* @__PURE__ */ t(p, { children: "Lot" }),
313
+ /* @__PURE__ */ t(p, {
314
+ align: "right",
315
+ children: "Remaining"
316
+ }),
317
+ /* @__PURE__ */ t(p, { children: "Expiry" }),
318
+ a.ownerType === "FACILITY" ? /* @__PURE__ */ t(p, { children: "Storage" }) : null,
319
+ /* @__PURE__ */ t(p, { children: "Status" })
320
+ ] }) }), /* @__PURE__ */ t(We, { children: V.map((e) => /* @__PURE__ */ d(re, { children: [
321
+ /* @__PURE__ */ t(p, {
322
+ sx: { fontWeight: 700 },
323
+ children: e.productName
324
+ }),
325
+ /* @__PURE__ */ t(p, {
326
+ sx: {
327
+ fontFamily: "monospace",
328
+ fontSize: "0.78rem"
329
+ },
330
+ children: e.lotNumber || "—"
331
+ }),
332
+ /* @__PURE__ */ t(p, {
333
+ align: "right",
334
+ sx: {
335
+ fontVariantNumeric: "tabular-nums",
336
+ fontWeight: 700
337
+ },
338
+ children: e.qtyRemaining
339
+ }),
340
+ /* @__PURE__ */ t(p, { children: e.expiryDate ? ve(e.expiryDate) : "—" }),
341
+ a.ownerType === "FACILITY" ? /* @__PURE__ */ t(p, { children: e.storageUnitName || "—" }) : null,
342
+ /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(Oe, {
343
+ size: "small",
344
+ label: Te(Ce, e.status),
345
+ color: De(e.status)
346
+ }) })
347
+ ] }, e.id)) })]
348
+ })]
349
+ })
350
+ }) : null,
351
+ /* @__PURE__ */ t(q, {
352
+ sx: {
353
+ borderRadius: 1.5,
354
+ mb: 2,
355
+ border: "1px solid",
356
+ borderColor: "divider",
357
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
358
+ },
359
+ children: /* @__PURE__ */ d(B, {
360
+ sx: { p: 2.5 },
361
+ children: [
362
+ /* @__PURE__ */ d(F, {
363
+ direction: "row",
364
+ justifyContent: "space-between",
365
+ alignItems: "flex-start",
366
+ sx: { mb: 2 },
367
+ children: [/* @__PURE__ */ t(R, {
368
+ eyebrow: "Step 2",
369
+ title: "Line items",
370
+ hint: "Each item creates one batch in your inventory and a receipt record."
371
+ }), /* @__PURE__ */ t(j, {
372
+ variant: "outlined",
373
+ startIcon: /* @__PURE__ */ t(je, {}),
374
+ onClick: me,
375
+ children: "Add Line"
376
+ })]
377
+ }),
378
+ /* @__PURE__ */ t(te, { sx: { mb: 2 } }),
379
+ /* @__PURE__ */ t(F, {
380
+ spacing: 2,
381
+ children: a.items.map((e, r) => {
382
+ let n = K[r] || {}, i = E.find((o) => o.id === e.productId), u = (i == null ? void 0 : i.hasExpiry) === !0, h = (i == null ? void 0 : i.needsStorageUnit) === !0 && a.ownerType === "FACILITY", x = new Set(a.items.filter((o, g) => g !== r).map((o) => o.productId).filter(Boolean));
383
+ return /* @__PURE__ */ t(q, {
384
+ variant: "outlined",
385
+ sx: {
386
+ p: 2,
387
+ borderRadius: 1.5
388
+ },
389
+ children: /* @__PURE__ */ d(c, {
390
+ container: !0,
391
+ spacing: 2,
392
+ children: [
393
+ /* @__PURE__ */ t(c, {
394
+ item: !0,
395
+ xs: 12,
396
+ md: 3,
397
+ children: /* @__PURE__ */ t(U, {
398
+ label: "Product",
399
+ required: !0,
400
+ value: e.productId,
401
+ onChange: (o) => f(r, "productId", o),
402
+ onBlur: l.onBlur(`items.${r}.productId`),
403
+ error: l.show(`items.${r}.productId`) && !!n.productId,
404
+ helperText: l.show(`items.${r}.productId`) ? n.productId : "",
405
+ options: E.filter((o) => o.id === e.productId || !x.has(o.id)).map((o) => ({
406
+ value: o.id,
407
+ label: o.name
408
+ }))
409
+ })
410
+ }),
411
+ /* @__PURE__ */ t(c, {
412
+ item: !0,
413
+ xs: 6,
414
+ md: 1,
415
+ children: /* @__PURE__ */ t(T, {
416
+ required: !0,
417
+ fullWidth: !0,
418
+ size: "small",
419
+ type: "number",
420
+ label: "Qty",
421
+ inputProps: { min: 1 },
422
+ value: e.quantity,
423
+ onChange: (o) => f(r, "quantity", o.target.value),
424
+ onBlur: l.onBlur(`items.${r}.quantity`),
425
+ error: l.show(`items.${r}.quantity`) && !!n.quantity,
426
+ helperText: l.show(`items.${r}.quantity`) ? n.quantity : ""
427
+ })
428
+ }),
429
+ y ? /* @__PURE__ */ t(c, {
430
+ item: !0,
431
+ xs: 6,
432
+ md: 2,
433
+ children: /* @__PURE__ */ t(T, {
434
+ required: !0,
435
+ fullWidth: !0,
436
+ size: "small",
437
+ type: "number",
438
+ inputProps: {
439
+ step: "0.01",
440
+ min: 0
441
+ },
442
+ label: "Buy Price",
443
+ value: e.buyPrice,
444
+ onChange: (o) => f(r, "buyPrice", o.target.value),
445
+ onBlur: l.onBlur(`items.${r}.buyPrice`),
446
+ error: l.show(`items.${r}.buyPrice`) && !!n.buyPrice,
447
+ helperText: l.show(`items.${r}.buyPrice`) ? n.buyPrice : ""
448
+ })
449
+ }) : null,
450
+ k ? (() => {
451
+ let o = (i == null ? void 0 : i.salePriceMode) || "FREE", g = !!(i != null && i.notForSale), w = o === "FIXED", he = !i || g || w, ye = l.show(`items.${r}.expectedSalePrice`) && n.expectedSalePrice ? n.expectedSalePrice : i ? g ? "Not for sale" : w ? "Fixed price" : o === "CAPPED" && i.salePrice != null ? `Max (MRP) ${X(i.salePrice)}` : "Optional estimate" : "Pick a product first";
452
+ return /* @__PURE__ */ t(c, {
453
+ item: !0,
454
+ xs: 6,
455
+ md: 2,
456
+ children: /* @__PURE__ */ t(T, {
457
+ fullWidth: !0,
458
+ size: "small",
459
+ type: "number",
460
+ inputProps: {
461
+ step: "0.01",
462
+ min: 0
463
+ },
464
+ label: "Approx. Sale Price",
465
+ disabled: he,
466
+ value: w ? (i == null ? void 0 : i.salePrice) ?? "" : e.expectedSalePrice,
467
+ onChange: (be) => f(r, "expectedSalePrice", be.target.value),
468
+ onBlur: l.onBlur(`items.${r}.expectedSalePrice`),
469
+ error: l.show(`items.${r}.expectedSalePrice`) && !!n.expectedSalePrice,
470
+ helperText: ye
471
+ })
472
+ });
473
+ })() : null,
474
+ m ? null : /* @__PURE__ */ t(c, {
475
+ item: !0,
476
+ xs: 6,
477
+ md: 2,
478
+ children: /* @__PURE__ */ t(T, {
479
+ required: u,
480
+ fullWidth: !0,
481
+ size: "small",
482
+ type: "date",
483
+ label: "Expiry",
484
+ InputLabelProps: { shrink: !0 },
485
+ inputProps: { min: O },
486
+ value: e.expiryDate,
487
+ onChange: (o) => f(r, "expiryDate", o.target.value),
488
+ onBlur: l.onBlur(`items.${r}.expiryDate`),
489
+ error: l.show(`items.${r}.expiryDate`) && !!n.expiryDate,
490
+ helperText: l.show(`items.${r}.expiryDate`) && n.expiryDate ? n.expiryDate : u ? "Required for this product" : ""
491
+ })
492
+ }),
493
+ m ? null : /* @__PURE__ */ t(c, {
494
+ item: !0,
495
+ xs: 6,
496
+ md: 2,
497
+ children: /* @__PURE__ */ t(T, {
498
+ fullWidth: !0,
499
+ size: "small",
500
+ type: "date",
501
+ label: "Manufactured",
502
+ InputLabelProps: { shrink: !0 },
503
+ inputProps: { max: O },
504
+ value: e.manufactureDate,
505
+ onChange: (o) => f(r, "manufactureDate", o.target.value),
506
+ onBlur: l.onBlur(`items.${r}.manufactureDate`),
507
+ error: l.show(`items.${r}.manufactureDate`) && !!n.manufactureDate,
508
+ helperText: l.show(`items.${r}.manufactureDate`) && n.manufactureDate ? n.manufactureDate : "Optional"
509
+ })
510
+ }),
511
+ m ? null : /* @__PURE__ */ t(c, {
512
+ item: !0,
513
+ xs: 6,
514
+ md: 2,
515
+ children: /* @__PURE__ */ t(T, {
516
+ fullWidth: !0,
517
+ size: "small",
518
+ label: "Lot #",
519
+ value: e.lotNumber,
520
+ onChange: (o) => f(r, "lotNumber", o.target.value),
521
+ helperText: v ? "Generated automatically." : "",
522
+ InputProps: v ? {
523
+ readOnly: !0,
524
+ sx: { fontFamily: "monospace" },
525
+ endAdornment: /* @__PURE__ */ t(Xe, {
526
+ position: "end",
527
+ children: /* @__PURE__ */ t(Ge, {
528
+ title: "Generate a different lot number",
529
+ children: /* @__PURE__ */ t(ie, {
530
+ size: "small",
531
+ edge: "end",
532
+ "aria-label": "Generate a different lot number",
533
+ onClick: () => f(r, "lotNumber", H()),
534
+ children: /* @__PURE__ */ t(Ze, { fontSize: "small" })
535
+ })
536
+ })
537
+ })
538
+ } : void 0
539
+ })
540
+ }),
541
+ /* @__PURE__ */ t(c, {
542
+ item: !0,
543
+ xs: 10,
544
+ md: 1,
545
+ children: /* @__PURE__ */ t(U, {
546
+ label: "Storage",
547
+ required: h,
548
+ disabled: a.ownerType !== "FACILITY" || !a.ownerId,
549
+ value: e.storageUnitId || "",
550
+ onChange: (o) => f(r, "storageUnitId", o),
551
+ onBlur: l.onBlur(`items.${r}.storageUnitId`),
552
+ error: l.show(`items.${r}.storageUnitId`) && !!n.storageUnitId,
553
+ options: de.map((o) => ({
554
+ value: o.id,
555
+ label: o.unitName
556
+ })),
557
+ helperText: l.show(`items.${r}.storageUnitId`) && n.storageUnitId ? n.storageUnitId : h ? "Required for this product" : ""
558
+ })
559
+ }),
560
+ /* @__PURE__ */ t(c, {
561
+ item: !0,
562
+ xs: 2,
563
+ md: 1,
564
+ sx: { textAlign: "right" },
565
+ children: /* @__PURE__ */ t(ie, {
566
+ color: "error",
567
+ onClick: () => ce(r),
568
+ disabled: a.items.length === 1,
569
+ children: /* @__PURE__ */ t(Ke, {})
570
+ })
571
+ })
572
+ ]
573
+ })
574
+ }, e.key);
575
+ })
576
+ })
577
+ ]
578
+ })
579
+ }),
580
+ /* @__PURE__ */ t(q, {
581
+ sx: {
582
+ borderRadius: 1.5,
583
+ bgcolor: "grey.50",
584
+ border: "1px solid",
585
+ borderColor: "divider",
586
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
587
+ },
588
+ children: /* @__PURE__ */ d(B, {
589
+ sx: { p: 2.5 },
590
+ children: [
591
+ /* @__PURE__ */ t(R, {
592
+ eyebrow: "Step 3",
593
+ title: y ? "Bill summary" : "Receipt details",
594
+ hint: y ? "The total is calculated from items. Add payment mode and notes. The date is set automatically." : "Add notes about this receipt. The date is set automatically.",
595
+ sx: { mb: 2 }
596
+ }),
597
+ /* @__PURE__ */ d(c, {
598
+ container: !0,
599
+ spacing: 2,
600
+ children: [y ? /* @__PURE__ */ t(c, {
601
+ item: !0,
602
+ xs: 12,
603
+ md: 6,
604
+ children: /* @__PURE__ */ t(U, {
605
+ label: "Payment Mode",
606
+ value: a.paymentMode || "",
607
+ onChange: (e) => b({
608
+ ...a,
609
+ paymentMode: e
610
+ }),
611
+ options: Se
612
+ })
613
+ }) : null, /* @__PURE__ */ t(c, {
614
+ item: !0,
615
+ xs: 12,
616
+ md: y ? 6 : 12,
617
+ children: /* @__PURE__ */ t(T, {
618
+ fullWidth: !0,
619
+ size: "small",
620
+ label: "Notes",
621
+ value: a.notes,
622
+ onChange: (e) => b({
623
+ ...a,
624
+ notes: e.target.value
625
+ })
626
+ })
627
+ })]
628
+ }),
629
+ y ? /* @__PURE__ */ d(Me, { children: [
630
+ /* @__PURE__ */ t(te, { sx: { my: 2 } }),
631
+ /* @__PURE__ */ d(F, {
632
+ direction: "row",
633
+ justifyContent: "flex-end",
634
+ alignItems: "baseline",
635
+ spacing: 2,
636
+ children: [/* @__PURE__ */ d(M, {
637
+ variant: "body2",
638
+ color: "text.secondary",
639
+ children: [
640
+ "Total (",
641
+ a.items.length,
642
+ " ",
643
+ a.items.length === 1 ? "line" : "lines",
644
+ ")"
645
+ ]
646
+ }), /* @__PURE__ */ t(M, {
647
+ variant: "h4",
648
+ sx: {
649
+ fontWeight: 800,
650
+ fontVariantNumeric: "tabular-nums"
651
+ },
652
+ children: D.priced ? X(D.sum) : "—"
653
+ })]
654
+ }),
655
+ D.priced ? null : /* @__PURE__ */ t(M, {
656
+ variant: "caption",
657
+ color: "text.secondary",
658
+ sx: {
659
+ display: "block",
660
+ textAlign: "right"
661
+ },
662
+ children: "Add a Buy Price on at least one line to compute the total."
663
+ })
664
+ ] }) : null
665
+ ]
666
+ })
667
+ })
668
+ ]
669
+ })
670
+ })] });
671
+ }
672
+ export {
673
+ br as default
674
+ };
675
+ //# sourceMappingURL=PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map