@argusoft/medplat-core 1.0.30 → 1.0.31

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