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