@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,1523 @@
1
+ import { A as Le, W as Se, G as T, g as Ge, m as _e, a as Z, h as Xe, c as Ke, u as Ze, s as Je, p as ei } from "./ImmunizationConfigurationBase-lKsJZMak.js";
2
+ import { O as ii, H as ti, l as ri, x as ni, S as ai, w as oi, b as li, p as si, m as Be, y as ui, h as Oe } from "./constants-BTpJFQe_-CYPZIqQF.js";
3
+ import { r as k, v as ci, d as di, u as mi, l as pi, f as hi, C as gi } from "./validation-BzlHnL-r-CCJm2utQ.js";
4
+ import { n as vi } from "./useFieldErrors-hDG8ox_x-DbSAzrGo.js";
5
+ import { Z as fi, $ as xi, e as yi, Y as bi } from "./PmGuard-BvUUbU80-BpYNaDzl.js";
6
+ import { y as Ci } from "./listValueStore-5d4vNGQM-WclZ5nBG.js";
7
+ import { useState as H, useMemo as ke, useEffect as de, useRef as Fe } from "react";
8
+ import { jsxs as u, jsx as e, Fragment as j } from "react/jsx-runtime";
9
+ import se from "prop-types";
10
+ import { Box as N, Alert as He, Card as ue, CardContent as ce, Typography as p, Grid as n, TextField as y, FormControlLabel as D, Checkbox as W, Stack as q, Divider as Pi, Button as ie, CircularProgress as Ne, IconButton as Qe } from "@mui/material";
11
+ import { v4 as me } from "uuid";
12
+ import Mi from "@mui/icons-material/AddRounded";
13
+ import { useParams as Vi, useNavigate as Ii } from "react-router-dom";
14
+ import Ai from "@mui/icons-material/SaveRounded";
15
+ import Ti from "@mui/icons-material/DeleteOutlineRounded";
16
+ import Ui from "@mui/icons-material/AddPhotoAlternateRounded";
17
+ import Ei from "@mui/icons-material/CloseRounded";
18
+ var te = 5, Ri = 5 * 1024 * 1024, F = {
19
+ display: "block",
20
+ fontWeight: 800,
21
+ letterSpacing: 0.6,
22
+ color: "text.secondary"
23
+ };
24
+ function re() {
25
+ return {
26
+ key: me(),
27
+ profileType: "AGE_BASED",
28
+ fromAge: "",
29
+ fromUnit: "YEARS",
30
+ toAge: "",
31
+ toUnit: "YEARS",
32
+ doseAmount: ""
33
+ };
34
+ }
35
+ var X = {
36
+ vaccineCode: "",
37
+ vialVolumeMl: "",
38
+ singleDose: !1,
39
+ profiles: [re()],
40
+ openVialValidityHours: 6,
41
+ openVialValidityUnit: "HOURS",
42
+ maxConcurrentOpenVials: 2,
43
+ requiresReconstitution: !1,
44
+ reconstitutedValidityHours: "",
45
+ reconstitutedValidityUnit: "HOURS",
46
+ route: "",
47
+ storageTempMinCelsius: "",
48
+ storageTempMaxCelsius: "",
49
+ comments: ""
50
+ };
51
+ function wi(h, z) {
52
+ var S;
53
+ let M = !z && !!h.singleDose, U = (b) => b === "" || b == null ? null : Number(b);
54
+ return {
55
+ vaccineCode: (S = h.vaccineCode) == null ? void 0 : S.trim().toUpperCase(),
56
+ vialVolumeMl: Number(h.vialVolumeMl),
57
+ singleDose: M,
58
+ profiles: (M ? (h.profiles ?? []).slice(0, 1) : h.profiles ?? []).map((b) => {
59
+ let Q = U(b.toAge);
60
+ return {
61
+ profileType: b.profileType || "AGE_BASED",
62
+ fromAge: U(b.fromAge),
63
+ fromUnit: b.fromUnit || "YEARS",
64
+ toAge: Q,
65
+ toUnit: Q == null ? null : b.toUnit || "YEARS",
66
+ doseAmount: M ? null : U(b.doseAmount)
67
+ };
68
+ }),
69
+ openVialValidityHours: Number(h.openVialValidityHours ?? 6),
70
+ openVialValidityUnit: h.openVialValidityUnit || "HOURS",
71
+ maxConcurrentOpenVials: M ? null : Number(h.maxConcurrentOpenVials ?? 2),
72
+ requiresReconstitution: !!h.requiresReconstitution,
73
+ reconstitutedValidityHours: U(h.reconstitutedValidityHours),
74
+ reconstitutedValidityUnit: h.reconstitutedValidityUnit || "HOURS",
75
+ route: h.route || null,
76
+ storageTempMinCelsius: U(h.storageTempMinCelsius),
77
+ storageTempMaxCelsius: U(h.storageTempMaxCelsius),
78
+ comments: h.comments || null
79
+ };
80
+ }
81
+ function _i() {
82
+ var he, ge, ve, fe, xe, ye, be, Ce, Pe, Me, Ve, Ie, Ae, Te, Ue, Ee, Re, we;
83
+ let { productId: h } = Vi(), z = Ii(), [M, U] = H(!0), [S, b] = H(""), [Q, J] = H(!1), [Y, ee] = H([]), [ne, ae] = H([]), [oe, d] = H([]), r = vi(), v = Le(), { productUnits: L } = Ci(), E = (v == null ? void 0 : v.manageSales) !== !1, B = (v == null ? void 0 : v.managePurchaseAmounts) !== !1, [t, w] = H({
84
+ id: h,
85
+ name: "",
86
+ categoryId: "",
87
+ brandId: "",
88
+ description: "",
89
+ unit: "",
90
+ unitOther: "",
91
+ hasExpiry: !0,
92
+ hasManufactureDate: !1,
93
+ expiryMode: "FREE",
94
+ expiryInterval: "",
95
+ expiryIntervalUnit: "MONTHS",
96
+ needsStorageUnit: !1,
97
+ notForSale: !1,
98
+ canBeQuarantined: !0,
99
+ salePriceMode: "FREE",
100
+ salePrice: "",
101
+ basePriceMode: "FREE",
102
+ basePrice: "",
103
+ maxInventoryQuantity: "",
104
+ maxPurchaseQuantity: "",
105
+ isActive: !0,
106
+ imageUuids: [],
107
+ vaccineConfig: null
108
+ }), f = ke(() => Y.find((i) => i.id === t.categoryId), [Y, t.categoryId]), V = ((he = f == null ? void 0 : f.code) == null ? void 0 : he.toUpperCase()) === ii, De = t.unit && !L.some((i) => i.value === t.unit) ? [...L, {
109
+ value: t.unit,
110
+ label: ti(t.unit)
111
+ }] : L, I = V && t.unit === "DROPS", G = t.expiryMode === "FROM_MANUFACTURE";
112
+ fi("update.manage.productManagement.product", () => {
113
+ async function i() {
114
+ var l, c;
115
+ U(!0);
116
+ try {
117
+ let [s, C, O] = await Promise.all([
118
+ Ke(),
119
+ Ze(),
120
+ Je().catch(() => [])
121
+ ]);
122
+ ee(s), ae(C), d(O);
123
+ try {
124
+ let o = await ei(h);
125
+ J(!1), w({
126
+ id: o.id,
127
+ name: o.name ?? "",
128
+ categoryId: o.categoryId ?? "",
129
+ brandId: o.brandId ?? "",
130
+ description: o.description ?? "",
131
+ unit: o.unit ?? "",
132
+ unitOther: o.unitOther ?? "",
133
+ hasExpiry: o.hasExpiry ?? !1,
134
+ hasManufactureDate: o.hasManufactureDate ?? !1,
135
+ expiryMode: o.expiryMode ?? "FREE",
136
+ expiryInterval: o.expiryInterval ?? "",
137
+ expiryIntervalUnit: o.expiryIntervalUnit ?? "MONTHS",
138
+ needsStorageUnit: o.needsStorageUnit ?? !1,
139
+ notForSale: o.notForSale ?? !1,
140
+ canBeQuarantined: o.canBeQuarantined ?? !0,
141
+ salePriceMode: o.salePriceMode ?? "FREE",
142
+ salePrice: o.salePrice ?? "",
143
+ basePriceMode: o.basePriceMode ?? "FREE",
144
+ basePrice: o.basePrice ?? "",
145
+ maxInventoryQuantity: o.maxInventoryQuantity ?? "",
146
+ maxPurchaseQuantity: o.maxPurchaseQuantity ?? "",
147
+ isActive: o.isActive ?? !0,
148
+ imageUuids: o.imageUuids ?? [],
149
+ vaccineConfig: o.vaccineConfig ? {
150
+ vaccineCode: o.vaccineConfig.vaccineCode ?? "",
151
+ vialVolumeMl: o.vaccineConfig.vialVolumeMl ?? "",
152
+ singleDose: o.vaccineConfig.singleDose ?? !1,
153
+ profiles: (o.vaccineConfig.profiles ?? []).length > 0 ? o.vaccineConfig.profiles.map((x) => ({
154
+ key: me(),
155
+ profileType: x.profileType ?? "AGE_BASED",
156
+ fromAge: x.fromAge ?? "",
157
+ fromUnit: x.fromUnit ?? "YEARS",
158
+ toAge: x.toAge ?? "",
159
+ toUnit: x.toUnit ?? "YEARS",
160
+ doseAmount: x.doseAmount ?? ""
161
+ })) : [re()],
162
+ openVialValidityHours: o.vaccineConfig.openVialValidityHours ?? 6,
163
+ openVialValidityUnit: o.vaccineConfig.openVialValidityUnit ?? "HOURS",
164
+ maxConcurrentOpenVials: o.vaccineConfig.maxConcurrentOpenVials ?? 2,
165
+ requiresReconstitution: o.vaccineConfig.requiresReconstitution ?? !1,
166
+ reconstitutedValidityHours: o.vaccineConfig.reconstitutedValidityHours ?? "",
167
+ reconstitutedValidityUnit: o.vaccineConfig.reconstitutedValidityUnit ?? "HOURS",
168
+ route: o.vaccineConfig.route ?? "",
169
+ storageTempMinCelsius: o.vaccineConfig.storageTempMinCelsius ?? "",
170
+ storageTempMaxCelsius: o.vaccineConfig.storageTempMaxCelsius ?? "",
171
+ comments: o.vaccineConfig.comments ?? ""
172
+ } : null
173
+ });
174
+ } catch {
175
+ J(!0);
176
+ }
177
+ } catch (s) {
178
+ b(((c = (l = s == null ? void 0 : s.response) == null ? void 0 : l.data) == null ? void 0 : c.message) ?? (s == null ? void 0 : s.message) ?? "Failed to load product");
179
+ } finally {
180
+ U(!1);
181
+ }
182
+ }
183
+ i();
184
+ }, [h]), de(() => {
185
+ w(V ? (i) => ({
186
+ ...i,
187
+ unit: i.unit === "VIAL" || i.unit === "DROPS" ? i.unit : ri,
188
+ needsStorageUnit: !0,
189
+ vaccineConfig: i.vaccineConfig ?? { ...X }
190
+ }) : (i) => i.vaccineConfig ? {
191
+ ...i,
192
+ vaccineConfig: null
193
+ } : i);
194
+ }, [V]);
195
+ function m(i, l) {
196
+ w((c) => ({
197
+ ...c,
198
+ [i]: l
199
+ }));
200
+ }
201
+ function R(i, l) {
202
+ w((c) => ({
203
+ ...c,
204
+ vaccineConfig: {
205
+ ...c.vaccineConfig ?? X,
206
+ [i]: l
207
+ }
208
+ }));
209
+ }
210
+ function K(i, l, c) {
211
+ w((s) => {
212
+ let C = s.vaccineConfig ?? X, O = (C.profiles ?? []).slice();
213
+ return O[i] = {
214
+ ...O[i],
215
+ [l]: c
216
+ }, {
217
+ ...s,
218
+ vaccineConfig: {
219
+ ...C,
220
+ profiles: O
221
+ }
222
+ };
223
+ });
224
+ }
225
+ function We() {
226
+ w((i) => {
227
+ let l = i.vaccineConfig ?? X;
228
+ return {
229
+ ...i,
230
+ vaccineConfig: {
231
+ ...l,
232
+ profiles: [...l.profiles ?? [], re()]
233
+ }
234
+ };
235
+ });
236
+ }
237
+ function qe(i) {
238
+ w((l) => {
239
+ let c = l.vaccineConfig ?? X;
240
+ return {
241
+ ...l,
242
+ vaccineConfig: {
243
+ ...c,
244
+ profiles: (c.profiles ?? []).filter((s, C) => C !== i)
245
+ }
246
+ };
247
+ });
248
+ }
249
+ function ze(i) {
250
+ w((l) => {
251
+ var C;
252
+ let c = l.vaccineConfig ?? X, s = (C = c.profiles) != null && C.length ? c.profiles : [re()];
253
+ return {
254
+ ...l,
255
+ vaccineConfig: {
256
+ ...c,
257
+ singleDose: i,
258
+ profiles: i ? s.slice(0, 1) : s
259
+ }
260
+ };
261
+ });
262
+ }
263
+ function Ye(i) {
264
+ let l = t.vaccineConfig ?? {}, c = l.profiles ?? [], s = I ? "drops" : "ml", C = I ? {
265
+ min: 0,
266
+ step: 1
267
+ } : {
268
+ step: "0.01",
269
+ min: 0
270
+ }, O = l.vialVolumeMl === "" || l.vialVolumeMl == null ? "—" : l.vialVolumeMl;
271
+ return /* @__PURE__ */ u(N, { children: [
272
+ /* @__PURE__ */ u(q, {
273
+ direction: "row",
274
+ justifyContent: "space-between",
275
+ alignItems: "center",
276
+ sx: { mb: 0.5 },
277
+ children: [/* @__PURE__ */ e(p, {
278
+ variant: "body2",
279
+ sx: { fontWeight: 700 },
280
+ children: i ? "Applicable age range" : "Dose profiles"
281
+ }), i ? null : /* @__PURE__ */ e(ie, {
282
+ size: "small",
283
+ variant: "outlined",
284
+ startIcon: /* @__PURE__ */ e(Mi, {}),
285
+ onClick: We,
286
+ children: "Add profile"
287
+ })]
288
+ }),
289
+ /* @__PURE__ */ u(p, {
290
+ variant: "caption",
291
+ color: "text.secondary",
292
+ sx: {
293
+ display: "block",
294
+ mb: 1.5
295
+ },
296
+ children: [
297
+ i ? /* @__PURE__ */ u(j, { children: [
298
+ "Each vial is one dose of ",
299
+ O,
300
+ " ",
301
+ s,
302
+ ", so there is nothing to choose. Set the ages this product applies to, and a patient outside that range is blocked from receiving it."
303
+ ] }) : /* @__PURE__ */ e(j, { children: "Each band sets one dose. It is measured from the patient's reference date, so the right dose is chosen automatically when giving the vaccine." }),
304
+ /* @__PURE__ */ e("br", {}),
305
+ /* @__PURE__ */ e("strong", { children: "From" }),
306
+ " is included and ",
307
+ /* @__PURE__ */ e("strong", { children: "To" }),
308
+ " is not — a patient exactly at a To value falls into the next band. Leave To blank for no upper limit."
309
+ ]
310
+ }),
311
+ /* @__PURE__ */ e(q, {
312
+ spacing: 1.5,
313
+ children: c.map((o, x) => {
314
+ let $ = `profiles.${x}.fromAge`, g = `profiles.${x}.toAge`, P = `profiles.${x}.doseAmount`, _ = o.toAge !== "" && o.toAge != null;
315
+ return /* @__PURE__ */ e(N, {
316
+ sx: {
317
+ p: 1.5,
318
+ border: "1px solid",
319
+ borderColor: "divider",
320
+ borderRadius: 1.5
321
+ },
322
+ children: /* @__PURE__ */ u(n, {
323
+ container: !0,
324
+ spacing: 1.5,
325
+ alignItems: "flex-start",
326
+ children: [
327
+ /* @__PURE__ */ e(n, {
328
+ item: !0,
329
+ xs: 6,
330
+ md: 2,
331
+ children: /* @__PURE__ */ e(y, {
332
+ required: !0,
333
+ fullWidth: !0,
334
+ size: "small",
335
+ type: "number",
336
+ inputProps: {
337
+ min: 0,
338
+ step: 1
339
+ },
340
+ label: "From",
341
+ value: o.fromAge ?? "",
342
+ onChange: (A) => K(x, "fromAge", A.target.value),
343
+ onBlur: r.onBlur($),
344
+ error: r.show($) && !!a[$],
345
+ helperText: r.show($) ? a[$] : ""
346
+ })
347
+ }),
348
+ /* @__PURE__ */ e(n, {
349
+ item: !0,
350
+ xs: 6,
351
+ md: 2,
352
+ children: /* @__PURE__ */ e(T, {
353
+ label: "From unit",
354
+ value: o.fromUnit || "YEARS",
355
+ onChange: (A) => K(x, "fromUnit", A),
356
+ options: Oe
357
+ })
358
+ }),
359
+ /* @__PURE__ */ e(n, {
360
+ item: !0,
361
+ xs: 6,
362
+ md: 2,
363
+ children: /* @__PURE__ */ e(y, {
364
+ fullWidth: !0,
365
+ size: "small",
366
+ type: "number",
367
+ inputProps: {
368
+ min: 0,
369
+ step: 1
370
+ },
371
+ label: "To",
372
+ value: o.toAge ?? "",
373
+ onChange: (A) => K(x, "toAge", A.target.value),
374
+ onBlur: r.onBlur(g),
375
+ error: r.show(g) && !!a[g],
376
+ helperText: r.show(g) && a[g] ? a[g] : "Blank = no limit"
377
+ })
378
+ }),
379
+ /* @__PURE__ */ e(n, {
380
+ item: !0,
381
+ xs: 6,
382
+ md: 2,
383
+ children: /* @__PURE__ */ e(T, {
384
+ label: "To unit",
385
+ disabled: !_,
386
+ value: _ ? o.toUnit || "YEARS" : "",
387
+ onChange: (A) => K(x, "toUnit", A),
388
+ options: Oe
389
+ })
390
+ }),
391
+ i ? null : /* @__PURE__ */ u(j, { children: [/* @__PURE__ */ e(n, {
392
+ item: !0,
393
+ xs: 8,
394
+ md: 3,
395
+ children: /* @__PURE__ */ e(y, {
396
+ required: !0,
397
+ fullWidth: !0,
398
+ size: "small",
399
+ type: "number",
400
+ inputProps: C,
401
+ label: `Dose (${s})`,
402
+ value: o.doseAmount ?? "",
403
+ onChange: (A) => K(x, "doseAmount", A.target.value),
404
+ onBlur: r.onBlur(P),
405
+ error: r.show(P) && !!a[P],
406
+ helperText: r.show(P) ? a[P] : ""
407
+ })
408
+ }), /* @__PURE__ */ e(n, {
409
+ item: !0,
410
+ xs: 4,
411
+ md: 1,
412
+ sx: { textAlign: "right" },
413
+ children: /* @__PURE__ */ e(Qe, {
414
+ color: "error",
415
+ onClick: () => qe(x),
416
+ disabled: c.length === 1,
417
+ children: /* @__PURE__ */ e(Ti, {})
418
+ })
419
+ })] })
420
+ ]
421
+ })
422
+ }, o.key);
423
+ })
424
+ }),
425
+ r.show("profiles") && a.profiles ? /* @__PURE__ */ e(p, {
426
+ variant: "caption",
427
+ color: "error",
428
+ sx: {
429
+ display: "block",
430
+ mt: 1
431
+ },
432
+ children: a.profiles
433
+ }) : null
434
+ ] });
435
+ }
436
+ let a = ke(() => {
437
+ let i = {
438
+ name: k(t.name, "Product name"),
439
+ categoryId: k(t.categoryId, "Category"),
440
+ brandId: k(t.brandId, "Brand"),
441
+ unit: k(t.unit, "Unit"),
442
+ unitOther: t.unit === "OTHER" ? k(t.unitOther, "Custom unit") : "",
443
+ salePrice: E && !t.notForSale && t.salePriceMode !== "FREE" ? k(t.salePrice, "Sale price") || (Number(t.salePrice) > 0 ? "" : "Sale price must be greater than 0.") : "",
444
+ expiryInterval: t.expiryMode === "FROM_MANUFACTURE" ? k(t.expiryInterval, "Shelf life") || (Number.isInteger(Number(t.expiryInterval)) && Number(t.expiryInterval) > 0 ? "" : "Enter a whole number greater than 0.") : "",
445
+ basePrice: B && t.basePriceMode !== "FREE" ? k(t.basePrice, "Purchase price") || (Number(t.basePrice) > 0 ? "" : "Purchase price must be greater than 0.") : "",
446
+ maxInventoryQuantity: t.maxInventoryQuantity === "" || Number.isInteger(Number(t.maxInventoryQuantity)) && Number(t.maxInventoryQuantity) > 0 ? "" : "Enter a whole number greater than 0, or leave it blank for no limit.",
447
+ maxPurchaseQuantity: t.maxPurchaseQuantity === "" ? "" : !Number.isInteger(Number(t.maxPurchaseQuantity)) || Number(t.maxPurchaseQuantity) <= 0 ? "Enter a whole number greater than 0, or leave it blank for no limit." : t.maxInventoryQuantity !== "" && Number(t.maxPurchaseQuantity) > Number(t.maxInventoryQuantity) ? "Cannot be more than the maximum stock on hand." : ""
448
+ };
449
+ if (V && t.vaccineConfig) {
450
+ let l = t.vaccineConfig, c = !I && l.singleDose, s = ci(l.storageTempMinCelsius, l.storageTempMaxCelsius);
451
+ Object.assign(i, {
452
+ vaccineCode: k(l.vaccineCode, "Vaccine"),
453
+ vialVolumeMl: pi(l.vialVolumeMl),
454
+ openVialValidityHours: c ? "" : mi(l.openVialValidityHours),
455
+ reconstitutedValidityHours: di(l.reconstitutedValidityHours, l.requiresReconstitution),
456
+ storageTempMinCelsius: s.min,
457
+ storageTempMaxCelsius: s.max
458
+ });
459
+ let C = Number(l.vialVolumeMl), O = I ? "drops" : "ml", o = l.profiles ?? [];
460
+ o.length === 0 && (i.profiles = c ? "Add the age range this product applies to." : "Add at least one administration profile.");
461
+ let x = {
462
+ DAYS: 1,
463
+ WEEKS: 7,
464
+ MONTHS: 30,
465
+ YEARS: 365
466
+ }, $ = (g, P) => Number(g) * (x[P] || 1);
467
+ o.forEach((g, P) => {
468
+ let _ = Number(g.fromAge);
469
+ if (g.fromAge === "" || g.fromAge == null ? i[`profiles.${P}.fromAge`] = "Required" : (!Number.isInteger(_) || _ < 0) && (i[`profiles.${P}.fromAge`] = "Whole number, 0 or more"), g.toAge !== "" && g.toAge != null) {
470
+ let le = Number(g.toAge);
471
+ !Number.isInteger(le) || le < 0 ? i[`profiles.${P}.toAge`] = "Whole number, 0 or more" : $(le, g.toUnit) <= $(_, g.fromUnit) && (i[`profiles.${P}.toAge`] = "Must be greater than From");
472
+ }
473
+ if (c) return;
474
+ let A = Number(g.doseAmount);
475
+ g.doseAmount === "" || g.doseAmount == null ? i[`profiles.${P}.doseAmount`] = "Required" : !Number.isFinite(A) || A <= 0 ? i[`profiles.${P}.doseAmount`] = "Must be greater than 0" : I && !Number.isInteger(A) ? i[`profiles.${P}.doseAmount`] = "Whole number" : Number.isFinite(C) && C > 0 && A > C && (i[`profiles.${P}.doseAmount`] = `At most ${C} ${O}`);
476
+ }), c || (i.maxConcurrentOpenVials = hi(l.maxConcurrentOpenVials));
477
+ }
478
+ return i;
479
+ }, [
480
+ t,
481
+ V,
482
+ I,
483
+ E
484
+ ]), pe = gi(a);
485
+ async function je() {
486
+ var i, l, c;
487
+ if (!pe) {
488
+ r.markAllTouched(), b("Please fix the highlighted fields and try again.");
489
+ return;
490
+ }
491
+ try {
492
+ await _e({
493
+ id: t.id,
494
+ name: t.name.trim(),
495
+ categoryId: t.categoryId,
496
+ brandId: t.brandId,
497
+ description: t.description || null,
498
+ unit: t.unit,
499
+ unitOther: t.unit === "OTHER" && ((i = t.unitOther) == null ? void 0 : i.trim()) || null,
500
+ hasExpiry: G ? !0 : !!t.hasExpiry,
501
+ hasManufactureDate: G ? !0 : !!t.hasManufactureDate,
502
+ expiryMode: t.expiryMode,
503
+ expiryInterval: G && t.expiryInterval !== "" ? Number(t.expiryInterval) : null,
504
+ expiryIntervalUnit: G ? t.expiryIntervalUnit : null,
505
+ needsStorageUnit: !!t.needsStorageUnit,
506
+ notForSale: E ? !!t.notForSale : !1,
507
+ canBeQuarantined: !!t.canBeQuarantined,
508
+ salePriceMode: E && !t.notForSale ? t.salePriceMode : "FREE",
509
+ salePrice: E && !t.notForSale && t.salePriceMode !== "FREE" && t.salePrice !== "" ? Number(t.salePrice) : null,
510
+ basePriceMode: B ? t.basePriceMode : "FREE",
511
+ basePrice: B && t.basePriceMode !== "FREE" && t.basePrice !== "" ? Number(t.basePrice) : null,
512
+ maxInventoryQuantity: t.maxInventoryQuantity === "" ? null : Number(t.maxInventoryQuantity),
513
+ maxPurchaseQuantity: t.maxPurchaseQuantity === "" ? null : Number(t.maxPurchaseQuantity),
514
+ isActive: !!t.isActive,
515
+ imageUuids: t.imageUuids ?? [],
516
+ vaccineConfig: t.vaccineConfig ? wi(t.vaccineConfig, I) : null
517
+ }), Z({
518
+ message: "Product saved.",
519
+ type: "success"
520
+ }), z("/ui/medplat/manage/pm/products");
521
+ } catch (s) {
522
+ b(((c = (l = s == null ? void 0 : s.response) == null ? void 0 : l.data) == null ? void 0 : c.message) ?? (s == null ? void 0 : s.message) ?? "Failed to save product");
523
+ }
524
+ }
525
+ return /* @__PURE__ */ u(N, { children: [/* @__PURE__ */ e(xi, {}), /* @__PURE__ */ e(yi, {
526
+ perm: "update.manage.productManagement.product",
527
+ title: "You don’t have permission to create or edit products",
528
+ children: /* @__PURE__ */ u(bi, {
529
+ title: Q ? "Add Product" : "Edit Product",
530
+ subtitle: `Category: ${(f == null ? void 0 : f.code) ?? "—"}`,
531
+ actions: /* @__PURE__ */ u(q, {
532
+ direction: "row",
533
+ spacing: 1,
534
+ children: [/* @__PURE__ */ e(ie, {
535
+ variant: "outlined",
536
+ onClick: () => z("/ui/medplat/manage/pm/products"),
537
+ children: "Cancel"
538
+ }), /* @__PURE__ */ e(ie, {
539
+ variant: "contained",
540
+ startIcon: /* @__PURE__ */ e(Ai, {}),
541
+ disabled: !pe,
542
+ onClick: () => void je(),
543
+ children: "Save"
544
+ })]
545
+ }),
546
+ children: [
547
+ M ? /* @__PURE__ */ e(He, {
548
+ severity: "info",
549
+ children: "Loading…"
550
+ }) : null,
551
+ S ? /* @__PURE__ */ e(He, {
552
+ severity: "error",
553
+ sx: { mb: 2 },
554
+ children: S
555
+ }) : null,
556
+ /* @__PURE__ */ e(ue, {
557
+ sx: {
558
+ borderRadius: 1.5,
559
+ mb: 2
560
+ },
561
+ children: /* @__PURE__ */ u(ce, { children: [/* @__PURE__ */ e(p, {
562
+ variant: "h6",
563
+ sx: {
564
+ fontWeight: 800,
565
+ mb: 2
566
+ },
567
+ children: "Basic Details"
568
+ }), /* @__PURE__ */ u(n, {
569
+ container: !0,
570
+ spacing: 2,
571
+ children: [
572
+ /* @__PURE__ */ e(n, {
573
+ item: !0,
574
+ xs: 12,
575
+ md: 6,
576
+ children: /* @__PURE__ */ e(y, {
577
+ required: !0,
578
+ fullWidth: !0,
579
+ size: "small",
580
+ label: "Product Name",
581
+ value: t.name,
582
+ inputProps: { maxLength: 255 },
583
+ onChange: (i) => m("name", i.target.value),
584
+ onBlur: r.onBlur("name"),
585
+ error: r.show("name") && !!a.name,
586
+ FormHelperTextProps: { component: "div" },
587
+ helperText: /* @__PURE__ */ e(Se, {
588
+ message: r.show("name") ? a.name : "",
589
+ value: t.name,
590
+ max: 255
591
+ })
592
+ })
593
+ }),
594
+ /* @__PURE__ */ e(n, {
595
+ item: !0,
596
+ xs: 12,
597
+ md: 3,
598
+ children: /* @__PURE__ */ e(T, {
599
+ label: "Category",
600
+ required: !0,
601
+ value: t.categoryId,
602
+ onChange: (i) => m("categoryId", i),
603
+ onBlur: r.onBlur("categoryId"),
604
+ error: r.show("categoryId") && !!a.categoryId,
605
+ helperText: r.show("categoryId") ? a.categoryId : "",
606
+ options: Y.map((i) => ({
607
+ value: i.id,
608
+ label: `${i.name} (${i.code})`
609
+ }))
610
+ })
611
+ }),
612
+ /* @__PURE__ */ e(n, {
613
+ item: !0,
614
+ xs: 12,
615
+ md: 3,
616
+ children: /* @__PURE__ */ e(T, {
617
+ label: "Brand",
618
+ required: !0,
619
+ value: t.brandId,
620
+ onChange: (i) => m("brandId", i),
621
+ onBlur: r.onBlur("brandId"),
622
+ error: r.show("brandId") && !!a.brandId,
623
+ helperText: r.show("brandId") ? a.brandId : "",
624
+ options: ne.map((i) => ({
625
+ value: i.id,
626
+ label: i.name
627
+ }))
628
+ })
629
+ }),
630
+ V ? null : /* @__PURE__ */ e(n, {
631
+ item: !0,
632
+ xs: 12,
633
+ md: 3,
634
+ children: /* @__PURE__ */ e(T, {
635
+ label: "Unit",
636
+ required: !0,
637
+ value: t.unit,
638
+ onChange: (i) => m("unit", i),
639
+ onBlur: r.onBlur("unit"),
640
+ error: r.show("unit") && !!a.unit,
641
+ helperText: r.show("unit") && a.unit ? a.unit : "",
642
+ options: De
643
+ })
644
+ }),
645
+ !V && t.unit === "OTHER" ? /* @__PURE__ */ e(n, {
646
+ item: !0,
647
+ xs: 12,
648
+ md: 3,
649
+ children: /* @__PURE__ */ e(y, {
650
+ required: !0,
651
+ fullWidth: !0,
652
+ size: "small",
653
+ label: "Custom unit name",
654
+ value: t.unitOther,
655
+ inputProps: { maxLength: 50 },
656
+ onChange: (i) => m("unitOther", i.target.value),
657
+ onBlur: r.onBlur("unitOther"),
658
+ error: r.show("unitOther") && !!a.unitOther,
659
+ FormHelperTextProps: { component: "div" },
660
+ helperText: /* @__PURE__ */ e(Se, {
661
+ message: r.show("unitOther") && a.unitOther ? a.unitOther : "e.g. Strip, Ampoule, Sachet",
662
+ value: t.unitOther,
663
+ max: 50
664
+ })
665
+ })
666
+ }) : null,
667
+ /* @__PURE__ */ e(n, {
668
+ item: !0,
669
+ xs: 12,
670
+ children: /* @__PURE__ */ e(y, {
671
+ fullWidth: !0,
672
+ size: "small",
673
+ multiline: !0,
674
+ minRows: 2,
675
+ label: "Description",
676
+ value: t.description,
677
+ onChange: (i) => m("description", i.target.value)
678
+ })
679
+ }),
680
+ /* @__PURE__ */ e(n, {
681
+ item: !0,
682
+ xs: 12,
683
+ children: /* @__PURE__ */ e(p, {
684
+ variant: "overline",
685
+ sx: {
686
+ ...F,
687
+ mt: 1
688
+ },
689
+ children: "Expiry"
690
+ })
691
+ }),
692
+ /* @__PURE__ */ e(n, {
693
+ item: !0,
694
+ xs: 12,
695
+ md: 4,
696
+ children: /* @__PURE__ */ e(T, {
697
+ label: "Expiry date",
698
+ value: t.expiryMode,
699
+ onChange: (i) => m("expiryMode", i),
700
+ options: ni,
701
+ helperText: G ? "Worked out for the person buying. They never type it." : "The person buying reads it off the pack and types it."
702
+ })
703
+ }),
704
+ G ? /* @__PURE__ */ u(j, { children: [
705
+ /* @__PURE__ */ e(n, {
706
+ item: !0,
707
+ xs: 6,
708
+ md: 2,
709
+ children: /* @__PURE__ */ e(y, {
710
+ required: !0,
711
+ fullWidth: !0,
712
+ size: "small",
713
+ type: "number",
714
+ inputProps: {
715
+ min: 1,
716
+ step: 1
717
+ },
718
+ label: "Shelf life",
719
+ value: t.expiryInterval,
720
+ onChange: (i) => m("expiryInterval", i.target.value),
721
+ onBlur: r.onBlur("expiryInterval"),
722
+ error: r.show("expiryInterval") && !!a.expiryInterval,
723
+ helperText: r.show("expiryInterval") ? a.expiryInterval : ""
724
+ })
725
+ }),
726
+ /* @__PURE__ */ e(n, {
727
+ item: !0,
728
+ xs: 6,
729
+ md: 2,
730
+ children: /* @__PURE__ */ e(T, {
731
+ label: "Counted in",
732
+ value: t.expiryIntervalUnit,
733
+ onChange: (i) => m("expiryIntervalUnit", i),
734
+ options: ai
735
+ })
736
+ }),
737
+ /* @__PURE__ */ e(n, {
738
+ item: !0,
739
+ xs: 12,
740
+ md: 4,
741
+ children: /* @__PURE__ */ e(p, {
742
+ variant: "caption",
743
+ color: "text.secondary",
744
+ sx: {
745
+ display: "block",
746
+ pt: 1
747
+ },
748
+ children: "This product carries an expiry and a manufacture date."
749
+ })
750
+ })
751
+ ] }) : /* @__PURE__ */ u(j, { children: [/* @__PURE__ */ e(n, {
752
+ item: !0,
753
+ xs: 6,
754
+ md: 4,
755
+ children: /* @__PURE__ */ e(D, {
756
+ control: /* @__PURE__ */ e(W, {
757
+ checked: !!t.hasExpiry,
758
+ disabled: V,
759
+ onChange: (i) => m("hasExpiry", i.target.checked)
760
+ }),
761
+ label: V ? "Has expiry (vaccine)" : "Has expiry"
762
+ })
763
+ }), /* @__PURE__ */ e(n, {
764
+ item: !0,
765
+ xs: 6,
766
+ md: 4,
767
+ children: /* @__PURE__ */ e(D, {
768
+ control: /* @__PURE__ */ e(W, {
769
+ checked: !!t.hasManufactureDate,
770
+ onChange: (i) => m("hasManufactureDate", i.target.checked)
771
+ }),
772
+ label: "Has manufacture date"
773
+ })
774
+ })] }),
775
+ /* @__PURE__ */ e(n, {
776
+ item: !0,
777
+ xs: 12,
778
+ children: /* @__PURE__ */ e(p, {
779
+ variant: "overline",
780
+ sx: {
781
+ ...F,
782
+ mt: 1
783
+ },
784
+ children: "Stock"
785
+ })
786
+ }),
787
+ /* @__PURE__ */ e(n, {
788
+ item: !0,
789
+ xs: 12,
790
+ md: 4,
791
+ children: /* @__PURE__ */ e(y, {
792
+ fullWidth: !0,
793
+ size: "small",
794
+ type: "number",
795
+ inputProps: {
796
+ min: 1,
797
+ step: 1
798
+ },
799
+ label: "Maximum stock on hand",
800
+ value: t.maxInventoryQuantity,
801
+ onChange: (i) => m("maxInventoryQuantity", i.target.value),
802
+ onBlur: r.onBlur("maxInventoryQuantity"),
803
+ error: r.show("maxInventoryQuantity") && !!a.maxInventoryQuantity,
804
+ helperText: r.show("maxInventoryQuantity") && a.maxInventoryQuantity ? a.maxInventoryQuantity : "Most one place can hold. Blank for no limit."
805
+ })
806
+ }),
807
+ /* @__PURE__ */ e(n, {
808
+ item: !0,
809
+ xs: 12,
810
+ md: 4,
811
+ children: /* @__PURE__ */ e(y, {
812
+ fullWidth: !0,
813
+ size: "small",
814
+ type: "number",
815
+ inputProps: {
816
+ min: 1,
817
+ step: 1
818
+ },
819
+ label: "Maximum quantity per purchase",
820
+ value: t.maxPurchaseQuantity,
821
+ onChange: (i) => m("maxPurchaseQuantity", i.target.value),
822
+ onBlur: r.onBlur("maxPurchaseQuantity"),
823
+ error: r.show("maxPurchaseQuantity") && !!a.maxPurchaseQuantity,
824
+ helperText: r.show("maxPurchaseQuantity") && a.maxPurchaseQuantity ? a.maxPurchaseQuantity : "Most that can be bought at once. Blank for no limit."
825
+ })
826
+ }),
827
+ /* @__PURE__ */ e(n, {
828
+ item: !0,
829
+ xs: 12,
830
+ md: 4,
831
+ children: /* @__PURE__ */ e(D, {
832
+ control: /* @__PURE__ */ e(W, {
833
+ checked: !!t.needsStorageUnit,
834
+ disabled: V,
835
+ onChange: (i) => m("needsStorageUnit", i.target.checked)
836
+ }),
837
+ label: V ? "Needs storage unit (vaccine)" : "Needs storage unit"
838
+ })
839
+ }),
840
+ B || E ? /* @__PURE__ */ e(n, {
841
+ item: !0,
842
+ xs: 12,
843
+ children: /* @__PURE__ */ e(p, {
844
+ variant: "overline",
845
+ sx: {
846
+ ...F,
847
+ mt: 1
848
+ },
849
+ children: "Pricing"
850
+ })
851
+ }) : null,
852
+ E ? /* @__PURE__ */ e(n, {
853
+ item: !0,
854
+ xs: 12,
855
+ md: 4,
856
+ children: /* @__PURE__ */ e(D, {
857
+ control: /* @__PURE__ */ e(W, {
858
+ checked: !!t.notForSale,
859
+ onChange: (i) => m("notForSale", i.target.checked)
860
+ }),
861
+ label: "Not for sale"
862
+ })
863
+ }) : null,
864
+ B ? /* @__PURE__ */ u(j, { children: [/* @__PURE__ */ e(n, {
865
+ item: !0,
866
+ xs: 12,
867
+ md: 4,
868
+ children: /* @__PURE__ */ e(T, {
869
+ label: "Purchase price mode",
870
+ value: t.basePriceMode,
871
+ onChange: (i) => m("basePriceMode", i),
872
+ options: oi,
873
+ helperText: "Fixed locks the price when buying; a cap limits it."
874
+ })
875
+ }), t.basePriceMode === "FREE" ? null : /* @__PURE__ */ e(n, {
876
+ item: !0,
877
+ xs: 12,
878
+ md: 4,
879
+ children: /* @__PURE__ */ e(y, {
880
+ required: !0,
881
+ fullWidth: !0,
882
+ size: "small",
883
+ type: "number",
884
+ inputProps: {
885
+ step: "0.01",
886
+ min: 0
887
+ },
888
+ label: t.basePriceMode === "FIXED" ? "Fixed purchase price" : "Purchase price cap",
889
+ value: t.basePrice,
890
+ onChange: (i) => m("basePrice", i.target.value),
891
+ onBlur: r.onBlur("basePrice"),
892
+ error: r.show("basePrice") && !!a.basePrice,
893
+ helperText: r.show("basePrice") ? a.basePrice : ""
894
+ })
895
+ })] }) : null,
896
+ E && !t.notForSale ? /* @__PURE__ */ u(j, { children: [/* @__PURE__ */ e(n, {
897
+ item: !0,
898
+ xs: 12,
899
+ md: 4,
900
+ children: /* @__PURE__ */ e(T, {
901
+ label: "Sale price mode",
902
+ value: t.salePriceMode,
903
+ onChange: (i) => m("salePriceMode", i),
904
+ options: li,
905
+ helperText: "Fixed locks the price at sale time; MRP caps it."
906
+ })
907
+ }), t.salePriceMode === "FREE" ? null : /* @__PURE__ */ e(n, {
908
+ item: !0,
909
+ xs: 12,
910
+ md: 4,
911
+ children: /* @__PURE__ */ e(y, {
912
+ required: !0,
913
+ fullWidth: !0,
914
+ size: "small",
915
+ type: "number",
916
+ inputProps: {
917
+ step: "0.01",
918
+ min: 0
919
+ },
920
+ label: t.salePriceMode === "FIXED" ? "Fixed sale price" : "Price cap (MRP)",
921
+ value: t.salePrice,
922
+ onChange: (i) => m("salePrice", i.target.value),
923
+ onBlur: r.onBlur("salePrice"),
924
+ error: r.show("salePrice") && !!a.salePrice,
925
+ helperText: r.show("salePrice") ? a.salePrice : ""
926
+ })
927
+ })] }) : null,
928
+ /* @__PURE__ */ e(n, {
929
+ item: !0,
930
+ xs: 12,
931
+ children: /* @__PURE__ */ e(p, {
932
+ variant: "overline",
933
+ sx: {
934
+ ...F,
935
+ mt: 1
936
+ },
937
+ children: "Availability"
938
+ })
939
+ }),
940
+ /* @__PURE__ */ e(n, {
941
+ item: !0,
942
+ xs: 6,
943
+ md: 4,
944
+ children: /* @__PURE__ */ e(D, {
945
+ control: /* @__PURE__ */ e(W, {
946
+ checked: !!t.canBeQuarantined,
947
+ onChange: (i) => m("canBeQuarantined", i.target.checked)
948
+ }),
949
+ label: "Can be quarantined"
950
+ })
951
+ }),
952
+ /* @__PURE__ */ e(n, {
953
+ item: !0,
954
+ xs: 6,
955
+ md: 4,
956
+ children: /* @__PURE__ */ e(D, {
957
+ control: /* @__PURE__ */ e(W, {
958
+ checked: !!t.isActive,
959
+ onChange: (i) => m("isActive", i.target.checked)
960
+ }),
961
+ label: "Active"
962
+ })
963
+ })
964
+ ]
965
+ })] })
966
+ }),
967
+ /* @__PURE__ */ e(ue, {
968
+ sx: {
969
+ borderRadius: 1.5,
970
+ mb: 2
971
+ },
972
+ children: /* @__PURE__ */ u(ce, { children: [
973
+ /* @__PURE__ */ u(q, {
974
+ direction: "row",
975
+ justifyContent: "space-between",
976
+ alignItems: "center",
977
+ sx: { mb: 0.5 },
978
+ children: [/* @__PURE__ */ e(p, {
979
+ variant: "h6",
980
+ sx: { fontWeight: 800 },
981
+ children: "Product Images"
982
+ }), /* @__PURE__ */ u(p, {
983
+ variant: "caption",
984
+ color: "text.secondary",
985
+ children: [
986
+ "Optional · up to ",
987
+ te,
988
+ " images"
989
+ ]
990
+ })]
991
+ }),
992
+ /* @__PURE__ */ e(p, {
993
+ variant: "caption",
994
+ color: "text.secondary",
995
+ sx: {
996
+ display: "block",
997
+ mb: 2
998
+ },
999
+ children: "Add photos of the product or its packaging. The first image is used as the main picture."
1000
+ }),
1001
+ /* @__PURE__ */ e($e, {
1002
+ value: t.imageUuids,
1003
+ onChange: (i) => m("imageUuids", i)
1004
+ })
1005
+ ] })
1006
+ }),
1007
+ V ? /* @__PURE__ */ e(ue, {
1008
+ sx: { borderRadius: 1.5 },
1009
+ children: /* @__PURE__ */ u(ce, { children: [
1010
+ /* @__PURE__ */ u(q, {
1011
+ direction: "row",
1012
+ justifyContent: "space-between",
1013
+ alignItems: "center",
1014
+ sx: { mb: 2 },
1015
+ children: [/* @__PURE__ */ e(p, {
1016
+ variant: "h6",
1017
+ sx: { fontWeight: 800 },
1018
+ children: "Vaccine Configuration"
1019
+ }), /* @__PURE__ */ e(p, {
1020
+ variant: "caption",
1021
+ color: "text.secondary",
1022
+ children: "Required for vaccine products. Controls vial size, dosing, and shelf life rules."
1023
+ })]
1024
+ }),
1025
+ /* @__PURE__ */ e(Pi, { sx: { mb: 2 } }),
1026
+ /* @__PURE__ */ u(n, {
1027
+ container: !0,
1028
+ spacing: 2,
1029
+ children: [
1030
+ /* @__PURE__ */ e(n, {
1031
+ item: !0,
1032
+ xs: 12,
1033
+ children: /* @__PURE__ */ e(p, {
1034
+ variant: "overline",
1035
+ sx: F,
1036
+ children: "Vaccine & measure"
1037
+ })
1038
+ }),
1039
+ /* @__PURE__ */ e(n, {
1040
+ item: !0,
1041
+ xs: 12,
1042
+ md: 4,
1043
+ children: /* @__PURE__ */ e(T, {
1044
+ label: "Vaccine",
1045
+ required: !0,
1046
+ value: ((ge = t.vaccineConfig) == null ? void 0 : ge.vaccineCode) || "",
1047
+ onChange: (i) => R("vaccineCode", i),
1048
+ onBlur: r.onBlur("vaccineCode"),
1049
+ error: r.show("vaccineCode") && !!a.vaccineCode,
1050
+ helperText: r.show("vaccineCode") && a.vaccineCode ? a.vaccineCode : "",
1051
+ noOptionsText: "No vaccines configured in immunization master",
1052
+ options: oe.map((i) => ({
1053
+ value: i.vaccineCode,
1054
+ label: `${i.vaccineName} (${i.vaccineCode})`
1055
+ }))
1056
+ })
1057
+ }),
1058
+ /* @__PURE__ */ e(n, {
1059
+ item: !0,
1060
+ xs: 12,
1061
+ md: 4,
1062
+ children: /* @__PURE__ */ e(T, {
1063
+ label: "Measured in",
1064
+ value: t.unit,
1065
+ onChange: (i) => m("unit", i),
1066
+ options: si,
1067
+ helperText: "Vials are dosed in millilitres; drops are counted."
1068
+ })
1069
+ }),
1070
+ /* @__PURE__ */ e(n, {
1071
+ item: !0,
1072
+ xs: 12,
1073
+ md: 4,
1074
+ children: /* @__PURE__ */ e(y, {
1075
+ required: !0,
1076
+ fullWidth: !0,
1077
+ size: "small",
1078
+ type: "number",
1079
+ inputProps: I ? {
1080
+ min: 1,
1081
+ step: 1
1082
+ } : {
1083
+ step: "0.01",
1084
+ min: 0
1085
+ },
1086
+ label: I ? "Drops per vial" : "Vial volume (ml)",
1087
+ value: ((ve = t.vaccineConfig) == null ? void 0 : ve.vialVolumeMl) ?? "",
1088
+ onChange: (i) => R("vialVolumeMl", i.target.value),
1089
+ onBlur: r.onBlur("vialVolumeMl"),
1090
+ error: r.show("vialVolumeMl") && !!a.vialVolumeMl,
1091
+ helperText: r.show("vialVolumeMl") ? a.vialVolumeMl : I ? "Total drops in a fresh vial" : ""
1092
+ })
1093
+ }),
1094
+ /* @__PURE__ */ e(n, {
1095
+ item: !0,
1096
+ xs: 12,
1097
+ children: /* @__PURE__ */ e(p, {
1098
+ variant: "overline",
1099
+ sx: {
1100
+ ...F,
1101
+ mt: 1
1102
+ },
1103
+ children: "Dosing"
1104
+ })
1105
+ }),
1106
+ I ? null : /* @__PURE__ */ u(n, {
1107
+ item: !0,
1108
+ xs: 12,
1109
+ children: [/* @__PURE__ */ e(D, {
1110
+ control: /* @__PURE__ */ e(W, {
1111
+ checked: !!((fe = t.vaccineConfig) != null && fe.singleDose),
1112
+ onChange: (i) => ze(i.target.checked)
1113
+ }),
1114
+ label: "Single dose vial"
1115
+ }), /* @__PURE__ */ e(p, {
1116
+ variant: "caption",
1117
+ color: "text.secondary",
1118
+ sx: {
1119
+ display: "block",
1120
+ ml: 4,
1121
+ mt: -0.5
1122
+ },
1123
+ children: "One dose per vial — used up the moment it's opened, so there's no limit on how many can be open at once."
1124
+ })]
1125
+ }),
1126
+ /* @__PURE__ */ e(n, {
1127
+ item: !0,
1128
+ xs: 12,
1129
+ children: Ye(!I && !!((xe = t.vaccineConfig) != null && xe.singleDose))
1130
+ }),
1131
+ /* @__PURE__ */ e(n, {
1132
+ item: !0,
1133
+ xs: 12,
1134
+ children: /* @__PURE__ */ e(p, {
1135
+ variant: "overline",
1136
+ sx: {
1137
+ ...F,
1138
+ mt: 1
1139
+ },
1140
+ children: "Open vial & reconstitution"
1141
+ })
1142
+ }),
1143
+ !I && ((ye = t.vaccineConfig) != null && ye.singleDose) ? null : /* @__PURE__ */ e(n, {
1144
+ item: !0,
1145
+ xs: 12,
1146
+ md: 4,
1147
+ children: /* @__PURE__ */ u(q, {
1148
+ direction: "row",
1149
+ spacing: 1,
1150
+ children: [/* @__PURE__ */ e(y, {
1151
+ required: !0,
1152
+ fullWidth: !0,
1153
+ size: "small",
1154
+ type: "number",
1155
+ inputProps: { min: 1 },
1156
+ label: "Open vial validity",
1157
+ value: ((be = t.vaccineConfig) == null ? void 0 : be.openVialValidityHours) ?? "",
1158
+ onChange: (i) => R("openVialValidityHours", i.target.value),
1159
+ onBlur: r.onBlur("openVialValidityHours"),
1160
+ error: r.show("openVialValidityHours") && !!a.openVialValidityHours,
1161
+ helperText: r.show("openVialValidityHours") ? a.openVialValidityHours : "How long the vial stays usable once opened"
1162
+ }), /* @__PURE__ */ e(N, {
1163
+ sx: {
1164
+ minWidth: 132,
1165
+ flexShrink: 0
1166
+ },
1167
+ children: /* @__PURE__ */ e(T, {
1168
+ label: "Unit",
1169
+ value: ((Ce = t.vaccineConfig) == null ? void 0 : Ce.openVialValidityUnit) || "HOURS",
1170
+ onChange: (i) => R("openVialValidityUnit", i),
1171
+ options: Be
1172
+ })
1173
+ })]
1174
+ })
1175
+ }),
1176
+ !I && ((Pe = t.vaccineConfig) != null && Pe.singleDose) ? null : /* @__PURE__ */ e(n, {
1177
+ item: !0,
1178
+ xs: 12,
1179
+ md: 4,
1180
+ children: /* @__PURE__ */ e(y, {
1181
+ required: !0,
1182
+ fullWidth: !0,
1183
+ size: "small",
1184
+ type: "number",
1185
+ inputProps: {
1186
+ min: 1,
1187
+ max: 20
1188
+ },
1189
+ label: "Max concurrent open vials",
1190
+ value: ((Me = t.vaccineConfig) == null ? void 0 : Me.maxConcurrentOpenVials) ?? "",
1191
+ onChange: (i) => R("maxConcurrentOpenVials", i.target.value),
1192
+ onBlur: r.onBlur("maxConcurrentOpenVials"),
1193
+ error: r.show("maxConcurrentOpenVials") && !!a.maxConcurrentOpenVials,
1194
+ helperText: r.show("maxConcurrentOpenVials") ? a.maxConcurrentOpenVials : ""
1195
+ })
1196
+ }),
1197
+ /* @__PURE__ */ e(n, {
1198
+ item: !0,
1199
+ xs: 12,
1200
+ children: /* @__PURE__ */ e(D, {
1201
+ control: /* @__PURE__ */ e(W, {
1202
+ checked: !!((Ve = t.vaccineConfig) != null && Ve.requiresReconstitution),
1203
+ onChange: (i) => R("requiresReconstitution", i.target.checked)
1204
+ }),
1205
+ label: "Requires reconstitution"
1206
+ })
1207
+ }),
1208
+ (Ie = t.vaccineConfig) != null && Ie.requiresReconstitution ? /* @__PURE__ */ e(n, {
1209
+ item: !0,
1210
+ xs: 12,
1211
+ md: 4,
1212
+ children: /* @__PURE__ */ u(q, {
1213
+ direction: "row",
1214
+ spacing: 1,
1215
+ children: [/* @__PURE__ */ e(y, {
1216
+ fullWidth: !0,
1217
+ size: "small",
1218
+ type: "number",
1219
+ inputProps: { min: 1 },
1220
+ required: !0,
1221
+ label: "Reconstituted validity",
1222
+ value: ((Ae = t.vaccineConfig) == null ? void 0 : Ae.reconstitutedValidityHours) ?? "",
1223
+ onChange: (i) => R("reconstitutedValidityHours", i.target.value),
1224
+ onBlur: r.onBlur("reconstitutedValidityHours"),
1225
+ error: r.show("reconstitutedValidityHours") && !!a.reconstitutedValidityHours,
1226
+ helperText: r.show("reconstitutedValidityHours") ? a.reconstitutedValidityHours : ""
1227
+ }), /* @__PURE__ */ e(N, {
1228
+ sx: {
1229
+ minWidth: 132,
1230
+ flexShrink: 0
1231
+ },
1232
+ children: /* @__PURE__ */ e(T, {
1233
+ label: "Unit",
1234
+ value: ((Te = t.vaccineConfig) == null ? void 0 : Te.reconstitutedValidityUnit) || "HOURS",
1235
+ onChange: (i) => R("reconstitutedValidityUnit", i),
1236
+ options: Be
1237
+ })
1238
+ })]
1239
+ })
1240
+ }) : null,
1241
+ /* @__PURE__ */ e(n, {
1242
+ item: !0,
1243
+ xs: 12,
1244
+ children: /* @__PURE__ */ e(p, {
1245
+ variant: "overline",
1246
+ sx: {
1247
+ ...F,
1248
+ mt: 1
1249
+ },
1250
+ children: "Storage & route"
1251
+ })
1252
+ }),
1253
+ /* @__PURE__ */ e(n, {
1254
+ item: !0,
1255
+ xs: 12,
1256
+ md: 4,
1257
+ children: /* @__PURE__ */ e(T, {
1258
+ label: "Route of administration",
1259
+ value: ((Ue = t.vaccineConfig) == null ? void 0 : Ue.route) || "",
1260
+ onChange: (i) => R("route", i),
1261
+ options: ui
1262
+ })
1263
+ }),
1264
+ /* @__PURE__ */ e(n, {
1265
+ item: !0,
1266
+ xs: 6,
1267
+ md: 4,
1268
+ children: /* @__PURE__ */ e(y, {
1269
+ fullWidth: !0,
1270
+ size: "small",
1271
+ type: "number",
1272
+ inputProps: {
1273
+ step: "0.1",
1274
+ min: -90,
1275
+ max: 30
1276
+ },
1277
+ label: "Storage temp min (°C)",
1278
+ value: ((Ee = t.vaccineConfig) == null ? void 0 : Ee.storageTempMinCelsius) ?? "",
1279
+ onChange: (i) => R("storageTempMinCelsius", i.target.value),
1280
+ onBlur: r.onBlur("storageTempMinCelsius"),
1281
+ error: r.show("storageTempMinCelsius") && !!a.storageTempMinCelsius,
1282
+ helperText: r.show("storageTempMinCelsius") && a.storageTempMinCelsius ? a.storageTempMinCelsius : "−90°C to +30°C"
1283
+ })
1284
+ }),
1285
+ /* @__PURE__ */ e(n, {
1286
+ item: !0,
1287
+ xs: 6,
1288
+ md: 4,
1289
+ children: /* @__PURE__ */ e(y, {
1290
+ fullWidth: !0,
1291
+ size: "small",
1292
+ type: "number",
1293
+ inputProps: {
1294
+ step: "0.1",
1295
+ min: -90,
1296
+ max: 30
1297
+ },
1298
+ label: "Storage temp max (°C)",
1299
+ value: ((Re = t.vaccineConfig) == null ? void 0 : Re.storageTempMaxCelsius) ?? "",
1300
+ onChange: (i) => R("storageTempMaxCelsius", i.target.value),
1301
+ onBlur: r.onBlur("storageTempMaxCelsius"),
1302
+ error: r.show("storageTempMaxCelsius") && !!a.storageTempMaxCelsius,
1303
+ helperText: r.show("storageTempMaxCelsius") && a.storageTempMaxCelsius ? a.storageTempMaxCelsius : "−90°C to +30°C"
1304
+ })
1305
+ }),
1306
+ /* @__PURE__ */ e(n, {
1307
+ item: !0,
1308
+ xs: 12,
1309
+ children: /* @__PURE__ */ e(p, {
1310
+ variant: "overline",
1311
+ sx: {
1312
+ ...F,
1313
+ mt: 1
1314
+ },
1315
+ children: "Notes"
1316
+ })
1317
+ }),
1318
+ /* @__PURE__ */ e(n, {
1319
+ item: !0,
1320
+ xs: 12,
1321
+ children: /* @__PURE__ */ e(y, {
1322
+ fullWidth: !0,
1323
+ size: "small",
1324
+ multiline: !0,
1325
+ minRows: 2,
1326
+ label: "Comments",
1327
+ value: ((we = t.vaccineConfig) == null ? void 0 : we.comments) || "",
1328
+ onChange: (i) => R("comments", i.target.value)
1329
+ })
1330
+ })
1331
+ ]
1332
+ })
1333
+ ] })
1334
+ }) : null
1335
+ ]
1336
+ })
1337
+ })] });
1338
+ }
1339
+ function $e({ value: h, onChange: z }) {
1340
+ let M = h ?? [], U = Fe(null), [S, b] = H(!1), [Q, J] = H({}), Y = Fe({});
1341
+ Y.current = Q;
1342
+ function ee(d, r) {
1343
+ J((v) => v[d] ? v : {
1344
+ ...v,
1345
+ [d]: r
1346
+ });
1347
+ }
1348
+ de(() => {
1349
+ let d = !1;
1350
+ return M.forEach((r) => {
1351
+ Y.current[r] || Ge(r).then((v) => {
1352
+ d || ee(r, URL.createObjectURL(v));
1353
+ }).catch(() => {
1354
+ });
1355
+ }), () => {
1356
+ d = !0;
1357
+ };
1358
+ }, [M]), de(() => () => {
1359
+ Object.values(Y.current).forEach((d) => {
1360
+ try {
1361
+ URL.revokeObjectURL(d);
1362
+ } catch {
1363
+ }
1364
+ });
1365
+ }, []);
1366
+ async function ne(d) {
1367
+ var t, w;
1368
+ let r = Array.from(d || []);
1369
+ if (r.length === 0) return;
1370
+ let v = te - M.length;
1371
+ if (v <= 0) {
1372
+ Z({
1373
+ message: `You can add at most ${te} images.`,
1374
+ type: "warning"
1375
+ });
1376
+ return;
1377
+ }
1378
+ let L = r.find((f) => !f.type.startsWith("image/") || f.size > Ri);
1379
+ if (L) {
1380
+ Z({
1381
+ message: L.type.startsWith("image/") ? "Each image must be 5 MB or smaller." : "Only image files can be uploaded.",
1382
+ type: "error"
1383
+ });
1384
+ return;
1385
+ }
1386
+ let E = r.slice(0, v);
1387
+ r.length > v && Z({
1388
+ message: `Only ${v} more image${v === 1 ? "" : "s"} can be added.`,
1389
+ type: "warning"
1390
+ });
1391
+ let B = E.map(() => me());
1392
+ b(!0);
1393
+ try {
1394
+ await Xe(E, B), E.forEach((f, V) => ee(B[V], URL.createObjectURL(f))), z([...M, ...B]);
1395
+ } catch (f) {
1396
+ Z({
1397
+ message: ((w = (t = f == null ? void 0 : f.response) == null ? void 0 : t.data) == null ? void 0 : w.message) ?? (f == null ? void 0 : f.message) ?? "Failed to upload images",
1398
+ type: "error"
1399
+ });
1400
+ } finally {
1401
+ b(!1);
1402
+ }
1403
+ }
1404
+ function ae(d) {
1405
+ z(M.filter((r) => r !== d));
1406
+ }
1407
+ let oe = M.length >= te;
1408
+ return /* @__PURE__ */ u(N, { children: [
1409
+ /* @__PURE__ */ e("input", {
1410
+ ref: U,
1411
+ type: "file",
1412
+ accept: "image/*",
1413
+ multiple: !0,
1414
+ hidden: !0,
1415
+ onChange: (d) => {
1416
+ ne(d.target.files), d.target.value = "";
1417
+ }
1418
+ }),
1419
+ /* @__PURE__ */ u(q, {
1420
+ direction: "row",
1421
+ spacing: 1.5,
1422
+ sx: {
1423
+ flexWrap: "wrap",
1424
+ gap: 1.5
1425
+ },
1426
+ children: [M.map((d, r) => /* @__PURE__ */ u(N, {
1427
+ sx: {
1428
+ position: "relative",
1429
+ width: 104,
1430
+ height: 104,
1431
+ borderRadius: 1.5,
1432
+ border: "1px solid",
1433
+ borderColor: "divider",
1434
+ overflow: "hidden",
1435
+ bgcolor: "grey.50",
1436
+ display: "flex",
1437
+ alignItems: "center",
1438
+ justifyContent: "center"
1439
+ },
1440
+ children: [
1441
+ Q[d] ? /* @__PURE__ */ e(N, {
1442
+ component: "img",
1443
+ src: Q[d],
1444
+ alt: `Product image ${r + 1}`,
1445
+ sx: {
1446
+ width: "100%",
1447
+ height: "100%",
1448
+ objectFit: "cover"
1449
+ }
1450
+ }) : /* @__PURE__ */ e(Ne, { size: 20 }),
1451
+ r === 0 ? /* @__PURE__ */ e(N, {
1452
+ sx: {
1453
+ position: "absolute",
1454
+ left: 0,
1455
+ bottom: 0,
1456
+ right: 0,
1457
+ bgcolor: "rgba(0,0,0,0.55)",
1458
+ color: "#fff",
1459
+ fontSize: "0.6rem",
1460
+ fontWeight: 800,
1461
+ letterSpacing: 0.5,
1462
+ textAlign: "center",
1463
+ py: 0.25
1464
+ },
1465
+ children: "MAIN"
1466
+ }) : null,
1467
+ /* @__PURE__ */ e(Qe, {
1468
+ size: "small",
1469
+ onClick: () => ae(d),
1470
+ sx: {
1471
+ position: "absolute",
1472
+ top: 2,
1473
+ right: 2,
1474
+ p: 0.25,
1475
+ bgcolor: "rgba(0,0,0,0.5)",
1476
+ color: "#fff",
1477
+ "&:hover": { bgcolor: "rgba(0,0,0,0.7)" }
1478
+ },
1479
+ "aria-label": "Remove image",
1480
+ children: /* @__PURE__ */ e(Ei, { sx: { fontSize: 16 } })
1481
+ })
1482
+ ]
1483
+ }, d)), oe ? null : /* @__PURE__ */ u(ie, {
1484
+ variant: "outlined",
1485
+ onClick: () => {
1486
+ var d;
1487
+ return (d = U.current) == null ? void 0 : d.click();
1488
+ },
1489
+ disabled: S,
1490
+ sx: {
1491
+ width: 104,
1492
+ height: 104,
1493
+ borderStyle: "dashed",
1494
+ flexDirection: "column",
1495
+ gap: 0.5,
1496
+ color: "text.secondary"
1497
+ },
1498
+ children: [S ? /* @__PURE__ */ e(Ne, { size: 22 }) : /* @__PURE__ */ e(Ui, {}), /* @__PURE__ */ e(p, {
1499
+ variant: "caption",
1500
+ sx: { fontWeight: 700 },
1501
+ children: S ? "Uploading…" : "Add"
1502
+ })]
1503
+ })]
1504
+ }),
1505
+ M.length === 0 && !S ? /* @__PURE__ */ e(p, {
1506
+ variant: "caption",
1507
+ color: "text.disabled",
1508
+ sx: {
1509
+ display: "block",
1510
+ mt: 1
1511
+ },
1512
+ children: "No images added yet."
1513
+ }) : null
1514
+ ] });
1515
+ }
1516
+ $e.propTypes = {
1517
+ value: se.arrayOf(se.string),
1518
+ onChange: se.func.isRequired
1519
+ };
1520
+ export {
1521
+ _i as default
1522
+ };
1523
+ //# sourceMappingURL=ProductEditPage-Dbq4vUAA-BoBmTPPL.js.map