@argusoft/medplat-core 1.0.31 → 1.0.32

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 (199) hide show
  1. package/dist/{AccessRights-DUgY6ewy.js → AccessRights-DBjTQA1-.js} +421 -424
  2. package/dist/AccessRights-DBjTQA1-.js.map +1 -0
  3. package/dist/{AddFeatures-D1sU8RjY.js → AddFeatures-COj4ZTIM.js} +2 -2
  4. package/dist/{AddFeatures-D1sU8RjY.js.map → AddFeatures-COj4ZTIM.js.map} +1 -1
  5. package/dist/AddMenuConfiguration-Creeib5X.js +11223 -0
  6. package/dist/AddMenuConfiguration-Creeib5X.js.map +1 -0
  7. package/dist/AddMenuConfiguration.css +1 -1
  8. package/dist/{BrandsPage-DMw2vT0u-BVhvhc6J.js → BrandsPage-CdcAvaml-ZtVTX6vX.js} +45 -45
  9. package/dist/{BrandsPage-DMw2vT0u-BVhvhc6J.js.map → BrandsPage-CdcAvaml-ZtVTX6vX.js.map} +1 -1
  10. package/dist/{CategoriesPage-D3ihx9Gi-CT58g0ry.js → CategoriesPage-BprQEYJw-CclreTv1.js} +43 -43
  11. package/dist/{CategoriesPage-D3ihx9Gi-CT58g0ry.js.map → CategoriesPage-BprQEYJw-CclreTv1.js.map} +1 -1
  12. package/dist/{ChangePasswordModalCore-lQ9GamH1.js → ChangePasswordModalCore-DZGOkbRY.js} +3 -3
  13. package/dist/{ChangePasswordModalCore-lQ9GamH1.js.map → ChangePasswordModalCore-DZGOkbRY.js.map} +1 -1
  14. package/dist/{ConditionConfig-BQBmBHaM.js → ConditionConfig-Bpm6OoV5.js} +3 -3
  15. package/dist/{ConditionConfig-BQBmBHaM.js.map → ConditionConfig-Bpm6OoV5.js.map} +1 -1
  16. package/dist/{DashboardPage-asr2XDRu-uOOlX9Vq.js → DashboardPage-CTiGSx71-CsYohJ5e.js} +29 -29
  17. package/dist/{DashboardPage-asr2XDRu-uOOlX9Vq.js.map → DashboardPage-CTiGSx71-CsYohJ5e.js.map} +1 -1
  18. package/dist/EntityManagement-BGwJGl9k.js +62 -0
  19. package/dist/EntityManagement-BGwJGl9k.js.map +1 -0
  20. package/dist/{EventConfigurations-CUPEN5BV.js → EventConfigurations-B-z7xHh_.js} +3 -3
  21. package/dist/{EventConfigurations-CUPEN5BV.js.map → EventConfigurations-B-z7xHh_.js.map} +1 -1
  22. package/dist/{EventsExceptionModal-BX-ArkBE.js → EventsExceptionModal-DafomIv6.js} +2 -2
  23. package/dist/{EventsExceptionModal-BX-ArkBE.js.map → EventsExceptionModal-DafomIv6.js.map} +1 -1
  24. package/dist/{EventsUi-D6O9S7BK.js → EventsUi-Dl_yckSA.js} +37 -32
  25. package/dist/EventsUi-Dl_yckSA.js.map +1 -0
  26. package/dist/FacilityPicker-BXa2VF7i-Dab_Jwa5.js +112 -0
  27. package/dist/FacilityPicker-BXa2VF7i-Dab_Jwa5.js.map +1 -0
  28. package/dist/{FeatureMenu-CHsBbw3W.js → FeatureMenu-Kc73yPHH.js} +2 -2
  29. package/dist/{FeatureMenu-CHsBbw3W.js.map → FeatureMenu-Kc73yPHH.js.map} +1 -1
  30. package/dist/{FhirServerList-iXBPkRVF.js → FhirServerList-CrIHMAxz.js} +19 -19
  31. package/dist/{FhirServerList-iXBPkRVF.js.map → FhirServerList-CrIHMAxz.js.map} +1 -1
  32. package/dist/{FhirServerProfile-CUOwC6Wb.js → FhirServerProfile-D3aYcpwY.js} +8 -8
  33. package/dist/{FhirServerProfile-CUOwC6Wb.js.map → FhirServerProfile-D3aYcpwY.js.map} +1 -1
  34. package/dist/{FhirServerWizard-DZI8Olku.js → FhirServerWizard-Db6Hm4bQ.js} +15 -15
  35. package/dist/{FhirServerWizard-DZI8Olku.js.map → FhirServerWizard-Db6Hm4bQ.js.map} +1 -1
  36. package/dist/{ImmunizationConfigurationBase-aUtx0JEe.js → ImmunizationConfigurationBase-lKsJZMak.js} +1342 -1301
  37. package/dist/ImmunizationConfigurationBase-lKsJZMak.js.map +1 -0
  38. package/dist/InventoryPage-JadYMCzU-CzJQfQ2A.js +1017 -0
  39. package/dist/InventoryPage-JadYMCzU-CzJQfQ2A.js.map +1 -0
  40. package/dist/LocationWiseExpectedTargetPage-CjKk1aTF.js +1344 -0
  41. package/dist/LocationWiseExpectedTargetPage-CjKk1aTF.js.map +1 -0
  42. package/dist/{ManageDynamicFeature-BU0I45dd.js → ManageDynamicFeature-CuyYfx_P.js} +104 -97
  43. package/dist/ManageDynamicFeature-CuyYfx_P.js.map +1 -0
  44. package/dist/{ManageEventConfiguration-DqW3krT6.js → ManageEventConfiguration-DqPbn3Oi.js} +5 -5
  45. package/dist/{ManageEventConfiguration-DqW3krT6.js.map → ManageEventConfiguration-DqPbn3Oi.js.map} +1 -1
  46. package/dist/ManageRole-CyfpySt9.js +981 -0
  47. package/dist/ManageRole-CyfpySt9.js.map +1 -0
  48. package/dist/{ManageUser-DZltBina.js → ManageUser-Dm0l833u.js} +172 -172
  49. package/dist/{ManageUser-DZltBina.js.map → ManageUser-Dm0l833u.js.map} +1 -1
  50. package/dist/{MemberProfileCard-D5CgkTdJ-D2NgDJl3.js → MemberProfileCard-01d_jz3w-DYHtbgMX.js} +37 -37
  51. package/dist/{MemberProfileCard-D5CgkTdJ-D2NgDJl3.js.map → MemberProfileCard-01d_jz3w-DYHtbgMX.js.map} +1 -1
  52. package/dist/MobileAnalytics-C9oc2yAo.js +18399 -0
  53. package/dist/MobileAnalytics-C9oc2yAo.js.map +1 -0
  54. package/dist/MobileMenuManagement-BmzTPXy7.js +231 -0
  55. package/dist/MobileMenuManagement-BmzTPXy7.js.map +1 -0
  56. package/dist/{MobileTypeEventConfigModal-CMcj7Ozp.js → MobileTypeEventConfigModal-DodU3beR.js} +3 -3
  57. package/dist/{MobileTypeEventConfigModal-CMcj7Ozp.js.map → MobileTypeEventConfigModal-DodU3beR.js.map} +1 -1
  58. package/dist/{NewServerManagement-Cxe0dV0O.js → NewServerManagement-BdayO78D.js} +368 -352
  59. package/dist/NewServerManagement-BdayO78D.js.map +1 -0
  60. package/dist/OtherTypeEventConfigModal-D_9S50aI.js +1414 -0
  61. package/dist/OtherTypeEventConfigModal-D_9S50aI.js.map +1 -0
  62. package/dist/{PaymentCreatePage-DfvSZ-kB-CckogYoe.js → PaymentCreatePage-D6NZBUC3-DxXf2kvH.js} +56 -56
  63. package/dist/{PaymentCreatePage-DfvSZ-kB-CckogYoe.js.map → PaymentCreatePage-D6NZBUC3-DxXf2kvH.js.map} +1 -1
  64. package/dist/{PaymentsPage-DMNjYWAJ-ChO9IXmk.js → PaymentsPage-CHieGNrn-BnYCtqHd.js} +38 -38
  65. package/dist/{PaymentsPage-DMNjYWAJ-ChO9IXmk.js.map → PaymentsPage-CHieGNrn-BnYCtqHd.js.map} +1 -1
  66. package/dist/{PermissionsModal-CCYkcKlC.js → PermissionsModal-Dxbkkrqe.js} +18 -18
  67. package/dist/PermissionsModal-Dxbkkrqe.js.map +1 -0
  68. package/dist/{PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js → PickupBatchLinesEditor-QPaqFtUO-CY7BShYh.js} +2 -2
  69. package/dist/{PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js.map → PickupBatchLinesEditor-QPaqFtUO-CY7BShYh.js.map} +1 -1
  70. package/dist/PickupCreatePage-C7_67u_u-OId8-e2a.js +801 -0
  71. package/dist/PickupCreatePage-C7_67u_u-OId8-e2a.js.map +1 -0
  72. package/dist/{PickupsPage-D7zyioJB-bHKnARYw.js → PickupsPage-BWblMlic-CWkgeBw0.js} +122 -122
  73. package/dist/PickupsPage-BWblMlic-CWkgeBw0.js.map +1 -0
  74. package/dist/PmGuard-BvUUbU80-BpYNaDzl.js +641 -0
  75. package/dist/PmGuard-BvUUbU80-BpYNaDzl.js.map +1 -0
  76. package/dist/ProductEditPage-Dbq4vUAA-BoBmTPPL.js +1523 -0
  77. package/dist/ProductEditPage-Dbq4vUAA-BoBmTPPL.js.map +1 -0
  78. package/dist/{ProductsPage-DvNHIeZt-BoOOJJtk.js → ProductsPage-BI22nPb4-CQBjnc-n.js} +29 -29
  79. package/dist/{ProductsPage-DvNHIeZt-BoOOJJtk.js.map → ProductsPage-BI22nPb4-CQBjnc-n.js.map} +1 -1
  80. package/dist/PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js +724 -0
  81. package/dist/PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js.map +1 -0
  82. package/dist/{PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js → PurchaseRequestDetailPage-DhBuOGHZ-CWZPqzt9.js} +446 -436
  83. package/dist/PurchaseRequestDetailPage-DhBuOGHZ-CWZPqzt9.js.map +1 -0
  84. package/dist/{PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js → PurchaseRequestsPage-Bj9HUMxb-B7-AxT8m.js} +55 -55
  85. package/dist/{PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js.map → PurchaseRequestsPage-Bj9HUMxb-B7-AxT8m.js.map} +1 -1
  86. package/dist/{PurchasesPage-DgL5T6BY-DePUuE9l.js → PurchasesPage-Djl1AqD_-DXeYFMrX.js} +61 -61
  87. package/dist/{PurchasesPage-DgL5T6BY-DePUuE9l.js.map → PurchasesPage-Djl1AqD_-DXeYFMrX.js.map} +1 -1
  88. package/dist/{RoleManagement-s8iNx2Mu.js → RoleManagement-DVYufwy-.js} +3 -3
  89. package/dist/{RoleManagement-s8iNx2Mu.js.map → RoleManagement-DVYufwy-.js.map} +1 -1
  90. package/dist/Roles-BoNGJhtR.js +19 -0
  91. package/dist/Roles-BoNGJhtR.js.map +1 -0
  92. package/dist/{SaleCreatePage-CZnIOydv-DKBw-qp7.js → SaleCreatePage-DHBLmlBr-BlgjVsq6.js} +33 -33
  93. package/dist/{SaleCreatePage-CZnIOydv-DKBw-qp7.js.map → SaleCreatePage-DHBLmlBr-BlgjVsq6.js.map} +1 -1
  94. package/dist/{SalesPage-DPIRrC_O-M8rqnK7z.js → SalesPage-eF9Yr42z-BQ9FlXC3.js} +34 -34
  95. package/dist/SalesPage-eF9Yr42z-BQ9FlXC3.js.map +1 -0
  96. package/dist/SettingsPage-Cre-UE3r-9ntnLYsQ.js +741 -0
  97. package/dist/SettingsPage-Cre-UE3r-9ntnLYsQ.js.map +1 -0
  98. package/dist/{StorageUnitsPage-BDRkdCjW-UF64rf7q.js → StorageUnitsPage-CTEVuemZ-B4osG74N.js} +213 -190
  99. package/dist/StorageUnitsPage-CTEVuemZ-B4osG74N.js.map +1 -0
  100. package/dist/{SubMenu-BdMTYtC1.js → SubMenu-OO2zhKiu.js} +2 -2
  101. package/dist/{SubMenu-BdMTYtC1.js.map → SubMenu-OO2zhKiu.js.map} +1 -1
  102. package/dist/{TableDetails-BtafRxXb.js → TableDetails-Cc40dEUs.js} +272 -267
  103. package/dist/TableDetails-Cc40dEUs.js.map +1 -0
  104. package/dist/{TableList-Dpo6dO7S.js → TableList-B5tX4wII.js} +316 -312
  105. package/dist/TableList-B5tX4wII.js.map +1 -0
  106. package/dist/{TransactionsPage-CqWTMNU8-Df6eGFDW.js → TransactionsPage-Zuu7sjID-B-ACzvd1.js} +185 -170
  107. package/dist/TransactionsPage-Zuu7sjID-B-ACzvd1.js.map +1 -0
  108. package/dist/TransferCreatePage-DlT0nCDj-B2SdPgYB.js +635 -0
  109. package/dist/TransferCreatePage-DlT0nCDj-B2SdPgYB.js.map +1 -0
  110. package/dist/TransfersPage-DqaSvHda-G2tFa5Jq.js +600 -0
  111. package/dist/TransfersPage-DqaSvHda-G2tFa5Jq.js.map +1 -0
  112. package/dist/{TypeConfiguration-JbRCN6GR.js → TypeConfiguration-EaFiOzRE.js} +3 -3
  113. package/dist/{TypeConfiguration-JbRCN6GR.js.map → TypeConfiguration-EaFiOzRE.js.map} +1 -1
  114. package/dist/UserList-Cf5B-o_1.js +1904 -0
  115. package/dist/UserList-Cf5B-o_1.js.map +1 -0
  116. package/dist/Users-MC7txo1V.js +43 -0
  117. package/dist/{Users-CsJ08Kjm.js.map → Users-MC7txo1V.js.map} +1 -1
  118. package/dist/VaccineEducation-T_UE57Ef.js +231 -0
  119. package/dist/VaccineEducation-T_UE57Ef.js.map +1 -0
  120. package/dist/VaccineEducation.css +1 -0
  121. package/dist/VaccineEducationConfigurator-CWc20_rv.js +50948 -0
  122. package/dist/VaccineEducationConfigurator-CWc20_rv.js.map +1 -0
  123. package/dist/VaccineEducationConfigurator.css +4 -0
  124. package/dist/VaccineEducationList-Ok7_5EFb.js +334 -0
  125. package/dist/VaccineEducationList-Ok7_5EFb.js.map +1 -0
  126. package/dist/VialsPage-LoDaUqVv-DmMXbK8j.js +457 -0
  127. package/dist/VialsPage-LoDaUqVv-DmMXbK8j.js.map +1 -0
  128. package/dist/{constants-DpXnLsAB-D6lN5cjK.js → constants-BTpJFQe_-CYPZIqQF.js} +160 -61
  129. package/dist/constants-BTpJFQe_-CYPZIqQF.js.map +1 -0
  130. package/dist/dashboardLayoutUtils--xUnoKPa.js +615 -0
  131. package/dist/dashboardLayoutUtils--xUnoKPa.js.map +1 -0
  132. package/dist/index-mfoqII2U.js +524 -0
  133. package/dist/index-mfoqII2U.js.map +1 -0
  134. package/dist/{index-D9YNFPn9.js → index-o8Pyt1Bt.js} +445 -439
  135. package/dist/index-o8Pyt1Bt.js.map +1 -0
  136. package/dist/index.css +1 -1
  137. package/dist/index.js +1 -1
  138. package/dist/{index.lib-ETRQOzvE.js → index.lib-BySa9-Z-.js} +302 -260
  139. package/dist/index.lib-BySa9-Z-.js.map +1 -0
  140. package/dist/listValueStore-5d4vNGQM-WclZ5nBG.js +43 -0
  141. package/dist/listValueStore-5d4vNGQM-WclZ5nBG.js.map +1 -0
  142. package/package.json +5 -1
  143. package/dist/AccessRights-DUgY6ewy.js.map +0 -1
  144. package/dist/AddMenuConfiguration-c6ZKiN0i.js +0 -8898
  145. package/dist/AddMenuConfiguration-c6ZKiN0i.js.map +0 -1
  146. package/dist/EntityManagement-CPQL6qBj.js +0 -50
  147. package/dist/EntityManagement-CPQL6qBj.js.map +0 -1
  148. package/dist/EventsUi-D6O9S7BK.js.map +0 -1
  149. package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js +0 -79
  150. package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js.map +0 -1
  151. package/dist/ImmunizationConfigurationBase-aUtx0JEe.js.map +0 -1
  152. package/dist/InventoryPage-DOotGZrj-CoPjOJEI.js +0 -665
  153. package/dist/InventoryPage-DOotGZrj-CoPjOJEI.js.map +0 -1
  154. package/dist/ManageDynamicFeature-BU0I45dd.js.map +0 -1
  155. package/dist/ManageRole-CNZBRKGU.js +0 -776
  156. package/dist/ManageRole-CNZBRKGU.js.map +0 -1
  157. package/dist/MobileAnalytics-BLOionG_.js +0 -17301
  158. package/dist/MobileAnalytics-BLOionG_.js.map +0 -1
  159. package/dist/MobileMenuManagement-68Wijb0X.js +0 -220
  160. package/dist/MobileMenuManagement-68Wijb0X.js.map +0 -1
  161. package/dist/NewServerManagement-Cxe0dV0O.js.map +0 -1
  162. package/dist/OtherTypeEventConfigModal-stNmuSv_.js +0 -1812
  163. package/dist/OtherTypeEventConfigModal-stNmuSv_.js.map +0 -1
  164. package/dist/PermissionsModal-CCYkcKlC.js.map +0 -1
  165. package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js +0 -783
  166. package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js.map +0 -1
  167. package/dist/PickupsPage-D7zyioJB-bHKnARYw.js.map +0 -1
  168. package/dist/PmGuard-BZE-y4In-D_pUm5MP.js +0 -599
  169. package/dist/PmGuard-BZE-y4In-D_pUm5MP.js.map +0 -1
  170. package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js +0 -1305
  171. package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map +0 -1
  172. package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js +0 -675
  173. package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map +0 -1
  174. package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js.map +0 -1
  175. package/dist/Roles-BIyiic67.js +0 -14
  176. package/dist/Roles-BIyiic67.js.map +0 -1
  177. package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js.map +0 -1
  178. package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js +0 -676
  179. package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js.map +0 -1
  180. package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js.map +0 -1
  181. package/dist/TableDetails-BtafRxXb.js.map +0 -1
  182. package/dist/TableList-Dpo6dO7S.js.map +0 -1
  183. package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js.map +0 -1
  184. package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js +0 -315
  185. package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js.map +0 -1
  186. package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js +0 -476
  187. package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js.map +0 -1
  188. package/dist/UserList-L41Xw0Q6.js +0 -1129
  189. package/dist/UserList-L41Xw0Q6.js.map +0 -1
  190. package/dist/Users-CsJ08Kjm.js +0 -40
  191. package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js +0 -321
  192. package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js.map +0 -1
  193. package/dist/constants-DpXnLsAB-D6lN5cjK.js.map +0 -1
  194. package/dist/dashboardLayoutUtils-CJivzaU1.js +0 -408
  195. package/dist/dashboardLayoutUtils-CJivzaU1.js.map +0 -1
  196. package/dist/index-D9YNFPn9.js.map +0 -1
  197. package/dist/index.lib-ETRQOzvE.js.map +0 -1
  198. package/dist/listValueStore-BFQtDYIR-Bj0yX145.js +0 -36
  199. package/dist/listValueStore-BFQtDYIR-Bj0yX145.js.map +0 -1
@@ -0,0 +1,724 @@
1
+ import { A as Se, K as W, G as Q, n as $e, a as le, I as De, f as Ne, _ as Ee, O as Ae } from "./ImmunizationConfigurationBase-lKsJZMak.js";
2
+ import { a as ee, C as Re, V as Me, k as qe, T as Ue } from "./constants-BTpJFQe_-CYPZIqQF.js";
3
+ import { o as F, t as Fe, s as Be } from "./format-UOyOu75i-D0GyylyQ.js";
4
+ import { r as g, b as Z, y as Le, S as ue, x as ke, C as se } from "./validation-BzlHnL-r-CCJm2utQ.js";
5
+ import { n as Ye } from "./useFieldErrors-hDG8ox_x-DbSAzrGo.js";
6
+ import { Z as ze, $ as We, e as Qe, Y as Oe } from "./PmGuard-BvUUbU80-BpYNaDzl.js";
7
+ import { f as Xe } from "./FacilityPicker-BXa2VF7i-Dab_Jwa5.js";
8
+ import { useMemo as B, useState as L, useEffect as de, useCallback as ce } from "react";
9
+ import { jsxs as d, jsx as a, Fragment as Ge } from "react/jsx-runtime";
10
+ import { Box as He, Alert as je, Card as k, CardContent as O, Grid as m, Stack as Y, Typography as X, Table as Ve, TableHead as _e, TableRow as me, TableCell as b, TableBody as Ke, Chip as Ze, Button as J, Divider as pe, TextField as E, InputAdornment as Je, Tooltip as er, IconButton as he } from "@mui/material";
11
+ import { v4 as re } from "uuid";
12
+ import rr from "@mui/icons-material/AddRounded";
13
+ import { useNavigate as tr } from "react-router-dom";
14
+ import ar from "@mui/icons-material/Inventory2Rounded";
15
+ import ir from "@mui/icons-material/SaveRounded";
16
+ import nr from "@mui/icons-material/DeleteOutlineRounded";
17
+ import or from "@mui/icons-material/AutorenewRounded";
18
+ var lr = [{
19
+ value: "USER",
20
+ label: "Personal Use"
21
+ }, {
22
+ value: "FACILITY",
23
+ label: "Facility Use"
24
+ }];
25
+ function ye(A = !1) {
26
+ return {
27
+ key: re(),
28
+ batchId: re(),
29
+ productId: "",
30
+ quantity: 1,
31
+ buyPrice: "",
32
+ expectedSalePrice: "",
33
+ expiryDate: "",
34
+ lotNumber: A ? ee() : "",
35
+ manufactureDate: "",
36
+ storageUnitId: ""
37
+ };
38
+ }
39
+ function vr() {
40
+ let A = tr(), s = Se(), x = (s == null ? void 0 : s.managePurchaseAmounts) !== !1, G = (s == null ? void 0 : s.manageSales) !== !1, R = (s == null ? void 0 : s.allowPersonalPurchase) !== !1, z = (s == null ? void 0 : s.allowFacilityPurchase) !== !1, p = (s == null ? void 0 : s.requirePurchaseConfirmation) === !0, T = !p && (s == null ? void 0 : s.autoGenerateLotNumber) === !0, be = B(() => lr.filter((r) => (r.value !== "USER" || R) && (r.value !== "FACILITY" || z)), [R, z]), xe = R ? "USER" : "FACILITY", [w, fe] = L([]), [H, Ie] = L([]), [M, ge] = L([]), [te, j] = L(""), l = Ye(), V = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10), [i, f] = L({
41
+ id: re(),
42
+ ownerType: xe,
43
+ ownerId: "",
44
+ purchaseDate: V,
45
+ paymentMode: "CASH",
46
+ notes: "",
47
+ items: [ye()]
48
+ });
49
+ de(() => {
50
+ !R && i.ownerType === "USER" ? f((r) => ({
51
+ ...r,
52
+ ownerType: "FACILITY",
53
+ ownerId: ""
54
+ })) : !z && i.ownerType === "FACILITY" && f((r) => ({
55
+ ...r,
56
+ ownerType: "USER",
57
+ ownerId: ""
58
+ }));
59
+ }, [
60
+ R,
61
+ z,
62
+ i.ownerType
63
+ ]), de(() => {
64
+ T && f((r) => r.items.some((e) => !e.lotNumber) ? {
65
+ ...r,
66
+ items: r.items.map((e) => e.lotNumber ? e : {
67
+ ...e,
68
+ lotNumber: ee()
69
+ })
70
+ } : r);
71
+ }, [T]), ze("update.manage.productManagement.purchase", () => {
72
+ async function r() {
73
+ var e, n;
74
+ try {
75
+ let [t, u, h] = await Promise.all([
76
+ Ne(),
77
+ Ee({ activeOnly: !0 }),
78
+ Ae().catch(() => [])
79
+ ]);
80
+ fe(t), Ie(u), ge(h);
81
+ } catch (t) {
82
+ j(((n = (e = t == null ? void 0 : t.response) == null ? void 0 : e.data) == null ? void 0 : n.message) ?? (t == null ? void 0 : t.message) ?? "Failed to load reference data");
83
+ }
84
+ }
85
+ r();
86
+ }, []);
87
+ let ae = B(() => i.ownerType === "USER" ? M.filter((r) => r.ownerType === "USER" && Number(r.qtyRemaining ?? 0) > 0 && r.status !== "EXPIRED" && r.status !== "EXHAUSTED") : i.ownerType === "FACILITY" && i.ownerId ? M.filter((r) => r.ownerType === "FACILITY" && r.ownerId === i.ownerId && Number(r.qtyRemaining ?? 0) > 0 && r.status !== "EXPIRED" && r.status !== "EXHAUSTED") : [], [
88
+ M,
89
+ i.ownerType,
90
+ i.ownerId
91
+ ]), we = B(() => M.filter((r) => r.isQuarantined ? !1 : i.ownerType === "USER" ? r.ownerType === "USER" : r.ownerType === "FACILITY" && r.ownerId === i.ownerId).reduce((r, e) => (r[e.productId] = (r[e.productId] ?? 0) + Number(e.qtyRemaining ?? 0), r), {}), [
92
+ M,
93
+ i.ownerType,
94
+ i.ownerId
95
+ ]), Pe = B(() => i.ownerType !== "FACILITY" || !i.ownerId ? [] : H.filter((r) => r.ownerId === i.ownerId), [
96
+ H,
97
+ i.ownerType,
98
+ i.ownerId
99
+ ]);
100
+ function I(r, e, n) {
101
+ f((t) => {
102
+ let u = t.items.slice();
103
+ return u[r] = {
104
+ ...u[r],
105
+ [e]: n
106
+ }, {
107
+ ...t,
108
+ items: u
109
+ };
110
+ });
111
+ }
112
+ function Te(r) {
113
+ f((e) => ({
114
+ ...e,
115
+ items: e.items.filter((n, t) => t !== r)
116
+ }));
117
+ }
118
+ function Ce() {
119
+ f((r) => ({
120
+ ...r,
121
+ items: [...r.items, ye(T)]
122
+ }));
123
+ }
124
+ let _ = ce((r) => {
125
+ let e = w.find((n) => n.id === r.productId);
126
+ return (e == null ? void 0 : e.basePriceMode) === "FIXED" ? e.basePrice ?? "" : r.buyPrice;
127
+ }, [w]), ie = ce((r) => {
128
+ let e = w.find((n) => n.id === r.productId);
129
+ return (e == null ? void 0 : e.expiryMode) === "FROM_MANUFACTURE" ? Re(r.manufactureDate, e.expiryInterval, e.expiryIntervalUnit) : "";
130
+ }, [w]), q = B(() => {
131
+ let r = !1;
132
+ return {
133
+ sum: i.items.reduce((e, n) => {
134
+ let t = _(n);
135
+ if (t === "" || t == null || n.quantity === "" || n.quantity == null) return e;
136
+ let u = Number(n.quantity), h = Number(t);
137
+ return Number.isNaN(u) || Number.isNaN(h) ? e : (r = !0, e + u * h);
138
+ }, 0),
139
+ priced: r
140
+ };
141
+ }, [i.items, _]), C = {
142
+ ownerType: g(i.ownerType, "Purchase type"),
143
+ ownerId: i.ownerType === "FACILITY" ? g(i.ownerId, "Facility") : "",
144
+ purchaseDate: g(i.purchaseDate, "Purchase date")
145
+ }, ne = i.items.map((r) => {
146
+ var P;
147
+ let e = w.find((c) => c.id === r.productId), n = (e == null ? void 0 : e.hasExpiry) === !0, t = (e == null ? void 0 : e.hasManufactureDate) === !0, u = (e == null ? void 0 : e.expiryMode) === "FROM_MANUFACTURE", h = (e == null ? void 0 : e.needsStorageUnit) === !0 && i.ownerType === "FACILITY" ? g(r.storageUnitId, "Storage unit") : "";
148
+ if (!h && r.storageUnitId && (e != null && e.vaccineConfig)) {
149
+ let c = e.vaccineConfig, D = H.find((N) => N.id === r.storageUnitId);
150
+ if (c.storageTempMinCelsius != null && c.storageTempMaxCelsius != null && D) {
151
+ let N = D.operatingTempMinCelsius, K = D.operatingTempMaxCelsius;
152
+ (N == null || K == null || Number(N) > Number(c.storageTempMinCelsius) || Number(K) < Number(c.storageTempMaxCelsius)) && (h = `Unit operates ${N ?? "?"}°C → ${K ?? "?"}°C, which cannot cover this product's required ${c.storageTempMinCelsius}°C → ${c.storageTempMaxCelsius}°C.`);
153
+ }
154
+ }
155
+ let v = (e == null ? void 0 : e.salePriceMode) || "FREE", S = "";
156
+ G && e && !e.notForSale && v !== "FIXED" && r.expectedSalePrice !== "" && r.expectedSalePrice != null && (S = Z(r.expectedSalePrice), !S && v === "CAPPED" && e.salePrice != null && Number(r.expectedSalePrice) > Number(e.salePrice) && (S = `Cannot exceed the MRP (${F(e.salePrice)}).`));
157
+ let U = (e == null ? void 0 : e.basePriceMode) || "FREE", $;
158
+ U === "FIXED" ? $ = "" : ($ = x ? g(r.buyPrice, "Buy price") || Z(r.buyPrice) || (Number(r.buyPrice) > 0 ? "" : "Buy price must be greater than 0.") : Z(r.buyPrice), !$ && U === "CAPPED" && (e == null ? void 0 : e.basePrice) != null && r.buyPrice !== "" && r.buyPrice != null && Number(r.buyPrice) > Number(e.basePrice) && ($ = `Cannot exceed ${F(e.basePrice)}.`));
159
+ let o = Le(r.quantity), y = Number(r.quantity);
160
+ if (!o && e && Number.isFinite(y)) {
161
+ if (e.maxPurchaseQuantity != null && y > e.maxPurchaseQuantity) o = `At most ${e.maxPurchaseQuantity} can be bought at a time.`;
162
+ else if (e.maxInventoryQuantity != null) {
163
+ let c = we[e.id] ?? 0;
164
+ if (c + y > e.maxInventoryQuantity) {
165
+ let D = Math.max(0, e.maxInventoryQuantity - c);
166
+ o = `Limited to ${e.maxInventoryQuantity} in stock. ${c} on hand, so at most ${D} more can be taken in.`;
167
+ }
168
+ }
169
+ }
170
+ return {
171
+ productId: g(r.productId, "Product"),
172
+ quantity: o,
173
+ buyPrice: $,
174
+ expectedSalePrice: S,
175
+ expiryDate: p || u ? "" : n && g(r.expiryDate, "Expiry date") || ke(r.expiryDate, { label: "Expiry" }),
176
+ manufactureDate: p ? ue(r.manufactureDate, { label: "Manufacture date" }) : t && g(r.manufactureDate, "Manufacture date") || ue(r.manufactureDate, { label: "Manufacture date" }),
177
+ storageUnitId: h,
178
+ lotNumber: !p && !T ? g((P = r.lotNumber) == null ? void 0 : P.trim(), "Lot number") : ""
179
+ };
180
+ }), oe = se(C) && ne.every(se) && i.items.length > 0;
181
+ async function ve() {
182
+ var e, n;
183
+ if (!oe) {
184
+ l.markAllTouched(), j("Please fix the highlighted fields and try again.");
185
+ return;
186
+ }
187
+ let r = {
188
+ id: i.id,
189
+ ownerType: i.ownerType,
190
+ ownerId: i.ownerType === "FACILITY" ? i.ownerId : null,
191
+ purchaseDate: i.purchaseDate,
192
+ paymentMode: x && i.paymentMode || null,
193
+ totalAmount: x && q.priced ? Number(q.sum.toFixed(2)) : null,
194
+ notes: i.notes || null,
195
+ items: i.items.map((t) => ({
196
+ batchId: t.batchId,
197
+ productId: t.productId,
198
+ quantity: Number(t.quantity),
199
+ buyPrice: (() => {
200
+ if (!x) return null;
201
+ let u = _(t);
202
+ return u !== "" && u != null ? Number(u) : null;
203
+ })(),
204
+ expectedSalePrice: (() => {
205
+ if (!G) return null;
206
+ let u = w.find((h) => h.id === t.productId);
207
+ return !u || u.notForSale || u.salePriceMode === "FIXED" || t.expectedSalePrice === "" ? null : Number(t.expectedSalePrice);
208
+ })(),
209
+ expiryDate: ie(t) || t.expiryDate || null,
210
+ lotNumber: t.lotNumber || null,
211
+ manufactureDate: t.manufactureDate || null,
212
+ storageUnitId: t.storageUnitId || null
213
+ }))
214
+ };
215
+ try {
216
+ if (p) {
217
+ let t = await $e(r);
218
+ le({
219
+ message: "Purchase request submitted for approval.",
220
+ type: "success"
221
+ }), A(`/ui/medplat/manage/pm/purchase-requests/${(t == null ? void 0 : t.id) ?? i.id}`);
222
+ } else await De(r), le({
223
+ message: "Purchase recorded.",
224
+ type: "success"
225
+ }), A("/ui/medplat/manage/pm/purchases");
226
+ } catch (t) {
227
+ j(((n = (e = t == null ? void 0 : t.response) == null ? void 0 : e.data) == null ? void 0 : n.message) ?? (t == null ? void 0 : t.message) ?? (p ? "Failed to submit purchase request" : "Failed to record purchase"));
228
+ }
229
+ }
230
+ return /* @__PURE__ */ d(He, { children: [/* @__PURE__ */ a(We, {}), /* @__PURE__ */ a(Qe, {
231
+ perm: "update.manage.productManagement.purchase",
232
+ title: p ? "You don’t have permission to submit purchase requests" : "You don’t have permission to record purchases",
233
+ children: /* @__PURE__ */ d(Oe, {
234
+ title: p ? "Submit Purchase Request" : "Record Purchase",
235
+ subtitle: p ? "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.",
236
+ actions: /* @__PURE__ */ d(Y, {
237
+ direction: "row",
238
+ spacing: 1,
239
+ children: [/* @__PURE__ */ a(J, {
240
+ variant: "outlined",
241
+ onClick: () => A(p ? "/ui/medplat/manage/pm/purchase-requests" : "/ui/medplat/manage/pm/purchases"),
242
+ children: "Cancel"
243
+ }), /* @__PURE__ */ a(J, {
244
+ variant: "contained",
245
+ startIcon: /* @__PURE__ */ a(ir, {}),
246
+ disabled: !oe,
247
+ onClick: () => void ve(),
248
+ children: p ? "Submit Request" : "Save"
249
+ })]
250
+ }),
251
+ children: [
252
+ te ? /* @__PURE__ */ a(je, {
253
+ severity: "error",
254
+ sx: { mb: 2 },
255
+ children: te
256
+ }) : null,
257
+ /* @__PURE__ */ a(k, {
258
+ sx: {
259
+ borderRadius: 1.5,
260
+ mb: 2,
261
+ border: "1px solid",
262
+ borderColor: "divider",
263
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
264
+ },
265
+ children: /* @__PURE__ */ d(O, {
266
+ sx: { p: 2.5 },
267
+ children: [/* @__PURE__ */ a(W, {
268
+ eyebrow: "Step 1",
269
+ title: "Purchase for",
270
+ hint: "Choose who will own this stock: yourself or a facility.",
271
+ sx: { mb: 2 }
272
+ }), /* @__PURE__ */ d(m, {
273
+ container: !0,
274
+ spacing: 2,
275
+ children: [/* @__PURE__ */ a(m, {
276
+ item: !0,
277
+ xs: 12,
278
+ md: 4,
279
+ children: /* @__PURE__ */ a(Q, {
280
+ label: "Purchase Type",
281
+ required: !0,
282
+ value: i.ownerType,
283
+ onChange: (r) => f({
284
+ ...i,
285
+ ownerType: r,
286
+ ownerId: ""
287
+ }),
288
+ onBlur: l.onBlur("ownerType"),
289
+ error: l.show("ownerType") && !!C.ownerType,
290
+ options: be,
291
+ helperText: l.show("ownerType") && C.ownerType ? C.ownerType : "Personal stock vs. facility stock"
292
+ })
293
+ }), i.ownerType === "FACILITY" ? /* @__PURE__ */ a(m, {
294
+ item: !0,
295
+ xs: 12,
296
+ md: 4,
297
+ children: /* @__PURE__ */ a(Xe, {
298
+ required: !0,
299
+ value: i.ownerId,
300
+ onChange: (r) => f({
301
+ ...i,
302
+ ownerId: r
303
+ }),
304
+ onBlur: l.onBlur("ownerId"),
305
+ error: l.show("ownerId") && !!C.ownerId,
306
+ helperText: l.show("ownerId") && C.ownerId ? C.ownerId : "Search for the facility."
307
+ })
308
+ }) : null]
309
+ })]
310
+ })
311
+ }),
312
+ i.ownerType === "USER" || i.ownerType === "FACILITY" && i.ownerId ? /* @__PURE__ */ a(k, {
313
+ sx: {
314
+ borderRadius: 1.5,
315
+ mb: 2,
316
+ border: "1px solid",
317
+ borderColor: "divider",
318
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
319
+ },
320
+ children: /* @__PURE__ */ d(O, {
321
+ sx: { p: 2.5 },
322
+ children: [/* @__PURE__ */ a(W, {
323
+ eyebrow: "Context",
324
+ title: "Existing inventory",
325
+ hint: i.ownerType === "USER" ? "Your current stock." : "What this facility already has, including where it is stored.",
326
+ sx: { mb: 1.5 }
327
+ }), ae.length === 0 ? /* @__PURE__ */ d(Y, {
328
+ direction: "row",
329
+ spacing: 1.25,
330
+ alignItems: "center",
331
+ sx: {
332
+ py: 1.5,
333
+ color: "text.secondary"
334
+ },
335
+ children: [/* @__PURE__ */ a(ar, { fontSize: "small" }), /* @__PURE__ */ a(X, {
336
+ variant: "body2",
337
+ children: "No active stock yet for this owner."
338
+ })]
339
+ }) : /* @__PURE__ */ d(Ve, {
340
+ size: "small",
341
+ children: [/* @__PURE__ */ a(_e, { children: /* @__PURE__ */ d(me, { children: [
342
+ /* @__PURE__ */ a(b, { children: "Product" }),
343
+ /* @__PURE__ */ a(b, { children: "Lot" }),
344
+ /* @__PURE__ */ a(b, {
345
+ align: "right",
346
+ children: "Remaining"
347
+ }),
348
+ /* @__PURE__ */ a(b, { children: "Expiry" }),
349
+ i.ownerType === "FACILITY" ? /* @__PURE__ */ a(b, { children: "Storage" }) : null,
350
+ /* @__PURE__ */ a(b, { children: "Status" })
351
+ ] }) }), /* @__PURE__ */ a(Ke, { children: ae.map((r) => /* @__PURE__ */ d(me, { children: [
352
+ /* @__PURE__ */ a(b, {
353
+ sx: { fontWeight: 700 },
354
+ children: r.productName
355
+ }),
356
+ /* @__PURE__ */ a(b, {
357
+ sx: {
358
+ fontFamily: "monospace",
359
+ fontSize: "0.78rem"
360
+ },
361
+ children: r.lotNumber || "—"
362
+ }),
363
+ /* @__PURE__ */ a(b, {
364
+ align: "right",
365
+ sx: {
366
+ fontVariantNumeric: "tabular-nums",
367
+ fontWeight: 700
368
+ },
369
+ children: r.qtyRemaining
370
+ }),
371
+ /* @__PURE__ */ a(b, { children: r.expiryDate ? Fe(r.expiryDate) : "—" }),
372
+ i.ownerType === "FACILITY" ? /* @__PURE__ */ a(b, { children: r.storageUnitName || "—" }) : null,
373
+ /* @__PURE__ */ a(b, { children: /* @__PURE__ */ a(Ze, {
374
+ size: "small",
375
+ label: Me(qe, r.status),
376
+ color: Be(r.status)
377
+ }) })
378
+ ] }, r.id)) })]
379
+ })]
380
+ })
381
+ }) : null,
382
+ /* @__PURE__ */ a(k, {
383
+ sx: {
384
+ borderRadius: 1.5,
385
+ mb: 2,
386
+ border: "1px solid",
387
+ borderColor: "divider",
388
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
389
+ },
390
+ children: /* @__PURE__ */ d(O, {
391
+ sx: { p: 2.5 },
392
+ children: [
393
+ /* @__PURE__ */ d(Y, {
394
+ direction: "row",
395
+ justifyContent: "space-between",
396
+ alignItems: "flex-start",
397
+ sx: { mb: 2 },
398
+ children: [/* @__PURE__ */ a(W, {
399
+ eyebrow: "Step 2",
400
+ title: "Line items",
401
+ hint: "Each item creates one batch in your inventory and a receipt record."
402
+ }), /* @__PURE__ */ a(J, {
403
+ variant: "outlined",
404
+ startIcon: /* @__PURE__ */ a(rr, {}),
405
+ onClick: Ce,
406
+ children: "Add Line"
407
+ })]
408
+ }),
409
+ /* @__PURE__ */ a(pe, { sx: { mb: 2 } }),
410
+ /* @__PURE__ */ a(Y, {
411
+ spacing: 2,
412
+ children: i.items.map((r, e) => {
413
+ let n = ne[e] || {}, t = w.find((o) => o.id === r.productId), u = (t == null ? void 0 : t.hasExpiry) === !0, h = (t == null ? void 0 : t.hasManufactureDate) === !0, v = (t == null ? void 0 : t.expiryMode) === "FROM_MANUFACTURE", S = ie(r), U = (t == null ? void 0 : t.needsStorageUnit) === !0 && i.ownerType === "FACILITY", $ = new Set(i.items.filter((o, y) => y !== e).map((o) => o.productId).filter(Boolean));
414
+ return /* @__PURE__ */ a(k, {
415
+ variant: "outlined",
416
+ sx: {
417
+ p: 2,
418
+ borderRadius: 1.5
419
+ },
420
+ children: /* @__PURE__ */ d(m, {
421
+ container: !0,
422
+ spacing: 2,
423
+ children: [
424
+ /* @__PURE__ */ a(m, {
425
+ item: !0,
426
+ xs: 12,
427
+ md: 3,
428
+ children: /* @__PURE__ */ a(Q, {
429
+ label: "Product",
430
+ required: !0,
431
+ value: r.productId,
432
+ onChange: (o) => I(e, "productId", o),
433
+ onBlur: l.onBlur(`items.${e}.productId`),
434
+ error: l.show(`items.${e}.productId`) && !!n.productId,
435
+ helperText: l.show(`items.${e}.productId`) ? n.productId : "",
436
+ options: w.filter((o) => o.id === r.productId || !$.has(o.id)).map((o) => ({
437
+ value: o.id,
438
+ label: o.name
439
+ }))
440
+ })
441
+ }),
442
+ /* @__PURE__ */ a(m, {
443
+ item: !0,
444
+ xs: 6,
445
+ md: 1,
446
+ children: /* @__PURE__ */ a(E, {
447
+ required: !0,
448
+ fullWidth: !0,
449
+ size: "small",
450
+ type: "number",
451
+ label: "Qty",
452
+ inputProps: {
453
+ min: 1,
454
+ max: (t == null ? void 0 : t.maxPurchaseQuantity) ?? void 0
455
+ },
456
+ value: r.quantity,
457
+ onChange: (o) => I(e, "quantity", o.target.value),
458
+ onBlur: l.onBlur(`items.${e}.quantity`),
459
+ error: l.show(`items.${e}.quantity`) && !!n.quantity,
460
+ helperText: l.show(`items.${e}.quantity`) && n.quantity ? n.quantity : (t == null ? void 0 : t.maxPurchaseQuantity) == null ? "" : `Max ${t.maxPurchaseQuantity}`
461
+ })
462
+ }),
463
+ x ? (() => {
464
+ let o = (t == null ? void 0 : t.basePriceMode) || "FREE", y = o === "FIXED", P = l.show(`items.${e}.buyPrice`) && n.buyPrice ? n.buyPrice : y ? "Fixed price" : o === "CAPPED" && (t == null ? void 0 : t.basePrice) != null ? `Max ${F(t.basePrice)}` : "";
465
+ return /* @__PURE__ */ a(m, {
466
+ item: !0,
467
+ xs: 6,
468
+ md: 2,
469
+ children: /* @__PURE__ */ a(E, {
470
+ required: !y,
471
+ fullWidth: !0,
472
+ size: "small",
473
+ type: "number",
474
+ inputProps: {
475
+ step: "0.01",
476
+ min: 0
477
+ },
478
+ label: "Buy Price",
479
+ disabled: y,
480
+ value: y ? (t == null ? void 0 : t.basePrice) ?? "" : r.buyPrice,
481
+ onChange: (c) => I(e, "buyPrice", c.target.value),
482
+ onBlur: l.onBlur(`items.${e}.buyPrice`),
483
+ error: l.show(`items.${e}.buyPrice`) && !!n.buyPrice,
484
+ helperText: P
485
+ })
486
+ });
487
+ })() : null,
488
+ G ? (() => {
489
+ let o = (t == null ? void 0 : t.salePriceMode) || "FREE", y = !!(t != null && t.notForSale), P = o === "FIXED", c = !t || y || P, D = l.show(`items.${e}.expectedSalePrice`) && n.expectedSalePrice ? n.expectedSalePrice : t ? y ? "Not for sale" : P ? "Fixed price" : o === "CAPPED" && t.salePrice != null ? `Max (MRP) ${F(t.salePrice)}` : "Optional estimate" : "Pick a product first";
490
+ return /* @__PURE__ */ a(m, {
491
+ item: !0,
492
+ xs: 6,
493
+ md: 2,
494
+ children: /* @__PURE__ */ a(E, {
495
+ fullWidth: !0,
496
+ size: "small",
497
+ type: "number",
498
+ inputProps: {
499
+ step: "0.01",
500
+ min: 0
501
+ },
502
+ label: "Approx. Sale Price",
503
+ disabled: c,
504
+ value: P ? (t == null ? void 0 : t.salePrice) ?? "" : r.expectedSalePrice,
505
+ onChange: (N) => I(e, "expectedSalePrice", N.target.value),
506
+ onBlur: l.onBlur(`items.${e}.expectedSalePrice`),
507
+ error: l.show(`items.${e}.expectedSalePrice`) && !!n.expectedSalePrice,
508
+ helperText: D
509
+ })
510
+ });
511
+ })() : null,
512
+ p ? null : /* @__PURE__ */ a(m, {
513
+ item: !0,
514
+ xs: 6,
515
+ md: 2,
516
+ children: /* @__PURE__ */ a(E, {
517
+ required: u && !v,
518
+ fullWidth: !0,
519
+ size: "small",
520
+ type: "date",
521
+ label: "Expiry",
522
+ InputLabelProps: { shrink: !0 },
523
+ inputProps: v ? { readOnly: !0 } : { min: V },
524
+ value: v ? S : r.expiryDate,
525
+ onChange: (o) => I(e, "expiryDate", o.target.value),
526
+ onBlur: l.onBlur(`items.${e}.expiryDate`),
527
+ error: l.show(`items.${e}.expiryDate`) && !!n.expiryDate,
528
+ helperText: v ? S ? `${t.expiryInterval} ${String(t.expiryIntervalUnit ?? "").toLowerCase()} after manufacture` : "Fill in the manufacture date" : l.show(`items.${e}.expiryDate`) && n.expiryDate ? n.expiryDate : u ? "Required for this product" : ""
529
+ })
530
+ }),
531
+ p ? null : /* @__PURE__ */ a(m, {
532
+ item: !0,
533
+ xs: 6,
534
+ md: 2,
535
+ children: /* @__PURE__ */ a(E, {
536
+ required: h,
537
+ fullWidth: !0,
538
+ size: "small",
539
+ type: "date",
540
+ label: "Manufactured",
541
+ InputLabelProps: { shrink: !0 },
542
+ inputProps: { max: V },
543
+ value: r.manufactureDate,
544
+ onChange: (o) => I(e, "manufactureDate", o.target.value),
545
+ onBlur: l.onBlur(`items.${e}.manufactureDate`),
546
+ error: l.show(`items.${e}.manufactureDate`) && !!n.manufactureDate,
547
+ helperText: l.show(`items.${e}.manufactureDate`) && n.manufactureDate ? n.manufactureDate : h ? "Required for this product" : "Optional"
548
+ })
549
+ }),
550
+ p ? null : /* @__PURE__ */ a(m, {
551
+ item: !0,
552
+ xs: 6,
553
+ md: 2,
554
+ children: /* @__PURE__ */ a(E, {
555
+ fullWidth: !0,
556
+ size: "small",
557
+ label: "Lot #",
558
+ required: !T,
559
+ value: r.lotNumber,
560
+ onChange: (o) => I(e, "lotNumber", o.target.value),
561
+ onBlur: l.onBlur(`items.${e}.lotNumber`),
562
+ error: l.show(`items.${e}.lotNumber`) && !!n.lotNumber,
563
+ helperText: T ? "Generated automatically." : l.show(`items.${e}.lotNumber`) ? n.lotNumber : "",
564
+ InputProps: T ? {
565
+ readOnly: !0,
566
+ sx: { fontFamily: "monospace" },
567
+ endAdornment: /* @__PURE__ */ a(Je, {
568
+ position: "end",
569
+ children: /* @__PURE__ */ a(er, {
570
+ title: "Generate a different lot number",
571
+ children: /* @__PURE__ */ a(he, {
572
+ size: "small",
573
+ edge: "end",
574
+ "aria-label": "Generate a different lot number",
575
+ onClick: () => I(e, "lotNumber", ee()),
576
+ children: /* @__PURE__ */ a(or, { fontSize: "small" })
577
+ })
578
+ })
579
+ })
580
+ } : void 0
581
+ })
582
+ }),
583
+ /* @__PURE__ */ a(m, {
584
+ item: !0,
585
+ xs: 10,
586
+ md: 2,
587
+ children: /* @__PURE__ */ a(Q, {
588
+ label: "Storage",
589
+ required: U,
590
+ disabled: i.ownerType !== "FACILITY" || !i.ownerId,
591
+ value: r.storageUnitId || "",
592
+ onChange: (o) => I(e, "storageUnitId", o),
593
+ onBlur: l.onBlur(`items.${e}.storageUnitId`),
594
+ error: l.show(`items.${e}.storageUnitId`) && !!n.storageUnitId,
595
+ options: Pe.map((o) => ({
596
+ value: o.id,
597
+ label: o.unitName
598
+ })),
599
+ slotProps: { popper: { style: {
600
+ width: "auto",
601
+ minWidth: 240
602
+ } } },
603
+ helperText: l.show(`items.${e}.storageUnitId`) && n.storageUnitId ? n.storageUnitId : U ? "Required for this product" : ""
604
+ })
605
+ }),
606
+ /* @__PURE__ */ a(m, {
607
+ item: !0,
608
+ xs: 2,
609
+ md: 1,
610
+ sx: {
611
+ textAlign: "right",
612
+ ml: "auto"
613
+ },
614
+ children: /* @__PURE__ */ a(he, {
615
+ color: "error",
616
+ onClick: () => Te(e),
617
+ disabled: i.items.length === 1,
618
+ children: /* @__PURE__ */ a(nr, {})
619
+ })
620
+ })
621
+ ]
622
+ })
623
+ }, r.key);
624
+ })
625
+ })
626
+ ]
627
+ })
628
+ }),
629
+ /* @__PURE__ */ a(k, {
630
+ sx: {
631
+ borderRadius: 1.5,
632
+ bgcolor: "grey.50",
633
+ border: "1px solid",
634
+ borderColor: "divider",
635
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
636
+ },
637
+ children: /* @__PURE__ */ d(O, {
638
+ sx: { p: 2.5 },
639
+ children: [
640
+ /* @__PURE__ */ a(W, {
641
+ eyebrow: "Step 3",
642
+ title: x ? "Bill summary" : "Receipt details",
643
+ hint: x ? "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.",
644
+ sx: { mb: 2 }
645
+ }),
646
+ /* @__PURE__ */ d(m, {
647
+ container: !0,
648
+ spacing: 2,
649
+ children: [x ? /* @__PURE__ */ a(m, {
650
+ item: !0,
651
+ xs: 12,
652
+ md: 6,
653
+ children: /* @__PURE__ */ a(Q, {
654
+ label: "Payment Mode",
655
+ value: i.paymentMode || "",
656
+ onChange: (r) => f({
657
+ ...i,
658
+ paymentMode: r
659
+ }),
660
+ options: Ue
661
+ })
662
+ }) : null, /* @__PURE__ */ a(m, {
663
+ item: !0,
664
+ xs: 12,
665
+ md: x ? 6 : 12,
666
+ children: /* @__PURE__ */ a(E, {
667
+ fullWidth: !0,
668
+ size: "small",
669
+ label: "Notes",
670
+ value: i.notes,
671
+ onChange: (r) => f({
672
+ ...i,
673
+ notes: r.target.value
674
+ })
675
+ })
676
+ })]
677
+ }),
678
+ x ? /* @__PURE__ */ d(Ge, { children: [
679
+ /* @__PURE__ */ a(pe, { sx: { my: 2 } }),
680
+ /* @__PURE__ */ d(Y, {
681
+ direction: "row",
682
+ justifyContent: "flex-end",
683
+ alignItems: "baseline",
684
+ spacing: 2,
685
+ children: [/* @__PURE__ */ d(X, {
686
+ variant: "body2",
687
+ color: "text.secondary",
688
+ children: [
689
+ "Total (",
690
+ i.items.length,
691
+ " ",
692
+ i.items.length === 1 ? "line" : "lines",
693
+ ")"
694
+ ]
695
+ }), /* @__PURE__ */ a(X, {
696
+ variant: "h4",
697
+ sx: {
698
+ fontWeight: 800,
699
+ fontVariantNumeric: "tabular-nums"
700
+ },
701
+ children: q.priced ? F(q.sum) : "—"
702
+ })]
703
+ }),
704
+ q.priced ? null : /* @__PURE__ */ a(X, {
705
+ variant: "caption",
706
+ color: "text.secondary",
707
+ sx: {
708
+ display: "block",
709
+ textAlign: "right"
710
+ },
711
+ children: "Add a Buy Price on at least one line to compute the total."
712
+ })
713
+ ] }) : null
714
+ ]
715
+ })
716
+ })
717
+ ]
718
+ })
719
+ })] });
720
+ }
721
+ export {
722
+ vr as default
723
+ };
724
+ //# sourceMappingURL=PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js.map