@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.
- package/dist/{AccessRights-xrday-L1.js → AccessRights-DUgY6ewy.js} +151 -143
- package/dist/AccessRights-DUgY6ewy.js.map +1 -0
- package/dist/AddMenuConfiguration-c6ZKiN0i.js +8898 -0
- package/dist/AddMenuConfiguration-c6ZKiN0i.js.map +1 -0
- package/dist/{BrandsPage-DmRW5bhm-Bk1szrjI.js → BrandsPage-DMw2vT0u-BVhvhc6J.js} +14 -14
- package/dist/{BrandsPage-DmRW5bhm-Bk1szrjI.js.map → BrandsPage-DMw2vT0u-BVhvhc6J.js.map} +1 -1
- package/dist/{CategoriesPage-BsS5IQh3-B03lWRY5.js → CategoriesPage-D3ihx9Gi-CT58g0ry.js} +112 -105
- package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js.map +1 -0
- package/dist/{ChangePasswordModalCore-BPsJquTS.js → ChangePasswordModalCore-lQ9GamH1.js} +3 -3
- package/dist/{ChangePasswordModalCore-BPsJquTS.js.map → ChangePasswordModalCore-lQ9GamH1.js.map} +1 -1
- package/dist/ConditionConfig-BQBmBHaM.js +408 -0
- package/dist/ConditionConfig-BQBmBHaM.js.map +1 -0
- package/dist/{DashboardPage-C3bKc5na-sBd9Yqbi.js → DashboardPage-asr2XDRu-uOOlX9Vq.js} +29 -29
- package/dist/{DashboardPage-C3bKc5na-sBd9Yqbi.js.map → DashboardPage-asr2XDRu-uOOlX9Vq.js.map} +1 -1
- package/dist/EventConfig-BY2cgGyx.js +27 -0
- package/dist/{EventConfig-BmLemzX3.js.map → EventConfig-BY2cgGyx.js.map} +1 -1
- package/dist/EventConfigurations-CUPEN5BV.js +544 -0
- package/dist/EventConfigurations-CUPEN5BV.js.map +1 -0
- package/dist/EventConfigurations.css +1 -1
- package/dist/EventsExceptionModal-BX-ArkBE.js +188 -0
- package/dist/EventsExceptionModal-BX-ArkBE.js.map +1 -0
- package/dist/EventsUi-D6O9S7BK.js +258 -0
- package/dist/EventsUi-D6O9S7BK.js.map +1 -0
- package/dist/{FacilityPicker-BiZeupmP-CyPHmj6b.js → FacilityPicker-DYl_PDyt-Cbwo2tAY.js} +10 -10
- package/dist/{FacilityPicker-BiZeupmP-CyPHmj6b.js.map → FacilityPicker-DYl_PDyt-Cbwo2tAY.js.map} +1 -1
- package/dist/{FeatureMenu-DYJmDt7q.js → FeatureMenu-CHsBbw3W.js} +9 -5
- package/dist/FeatureMenu-CHsBbw3W.js.map +1 -0
- package/dist/{FhirServerList-DuTwnngN.js → FhirServerList-iXBPkRVF.js} +11 -11
- package/dist/{FhirServerList-DuTwnngN.js.map → FhirServerList-iXBPkRVF.js.map} +1 -1
- package/dist/{GrantPermissionModal-BDN66Atn.js → GrantPermissionModal-D7iNZd0M.js} +54 -51
- package/dist/GrantPermissionModal-D7iNZd0M.js.map +1 -0
- package/dist/{ImmunizationConfigurationBase-Di1KO3oW.js → ImmunizationConfigurationBase-aUtx0JEe.js} +3440 -3060
- package/dist/ImmunizationConfigurationBase-aUtx0JEe.js.map +1 -0
- package/dist/{InventoryPage-C_AxSy7A-QLvlL4rE.js → InventoryPage-DOotGZrj-CoPjOJEI.js} +10 -10
- package/dist/{InventoryPage-C_AxSy7A-QLvlL4rE.js.map → InventoryPage-DOotGZrj-CoPjOJEI.js.map} +1 -1
- package/dist/ManageEventConfiguration-DqW3krT6.js +1216 -0
- package/dist/ManageEventConfiguration-DqW3krT6.js.map +1 -0
- package/dist/ManageEventConfiguration.css +1 -1
- package/dist/{ManageUser-DCFkUMV9.js → ManageUser-DZltBina.js} +134 -134
- package/dist/{ManageUser-DCFkUMV9.js.map → ManageUser-DZltBina.js.map} +1 -1
- package/dist/{MemberProfileCard-BdUNgHRB-VywqQdFF.js → MemberProfileCard-D5CgkTdJ-D2NgDJl3.js} +25 -25
- package/dist/{MemberProfileCard-BdUNgHRB-VywqQdFF.js.map → MemberProfileCard-D5CgkTdJ-D2NgDJl3.js.map} +1 -1
- package/dist/MobileAnalytics-BLOionG_.js +17301 -0
- package/dist/MobileAnalytics-BLOionG_.js.map +1 -0
- package/dist/MobileMenuManagement-68Wijb0X.js +220 -0
- package/dist/MobileMenuManagement-68Wijb0X.js.map +1 -0
- package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js +752 -0
- package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js.map +1 -0
- package/dist/OtherTypeEventConfigModal-stNmuSv_.js +1812 -0
- package/dist/OtherTypeEventConfigModal-stNmuSv_.js.map +1 -0
- package/dist/{PaymentCreatePage-CIVe0P0p-25BQVpOX.js → PaymentCreatePage-DfvSZ-kB-CckogYoe.js} +14 -14
- package/dist/{PaymentCreatePage-CIVe0P0p-25BQVpOX.js.map → PaymentCreatePage-DfvSZ-kB-CckogYoe.js.map} +1 -1
- package/dist/{PaymentsPage-BvPe5Q9F-D2gfziwW.js → PaymentsPage-DMNjYWAJ-ChO9IXmk.js} +24 -24
- package/dist/{PaymentsPage-BvPe5Q9F-D2gfziwW.js.map → PaymentsPage-DMNjYWAJ-ChO9IXmk.js.map} +1 -1
- package/dist/{PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js → PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js} +2 -2
- package/dist/{PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js.map → PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js.map} +1 -1
- package/dist/{PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js → PickupCreatePage-B4O_-vE5-DoOo9nJO.js} +64 -64
- package/dist/{PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js.map → PickupCreatePage-B4O_-vE5-DoOo9nJO.js.map} +1 -1
- package/dist/{PickupsPage-Ctpghavs-CUp4uIZq.js → PickupsPage-D7zyioJB-bHKnARYw.js} +29 -29
- package/dist/PickupsPage-D7zyioJB-bHKnARYw.js.map +1 -0
- package/dist/{PmGuard-b10TGXEi-G3N0G_Wg.js → PmGuard-BZE-y4In-D_pUm5MP.js} +25 -25
- package/dist/{PmGuard-b10TGXEi-G3N0G_Wg.js.map → PmGuard-BZE-y4In-D_pUm5MP.js.map} +1 -1
- package/dist/{ProductEditPage-C1thoKHu-URQaZ6st.js → ProductEditPage-BVlVUCtD-BR-tJ5Wb.js} +475 -472
- package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map +1 -0
- package/dist/{ProductsPage-CupVmOD4-D45a_hf-.js → ProductsPage-DvNHIeZt-BoOOJJtk.js} +36 -35
- package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js.map +1 -0
- package/dist/{PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js → PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js} +214 -187
- package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map +1 -0
- package/dist/{PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js → PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js} +80 -80
- package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js.map +1 -0
- package/dist/{PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js → PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js} +29 -29
- package/dist/{PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js.map → PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js.map} +1 -1
- package/dist/{PurchasesPage-It1GHiXl-eH4IsF_U.js → PurchasesPage-DgL5T6BY-DePUuE9l.js} +31 -31
- package/dist/{PurchasesPage-It1GHiXl-eH4IsF_U.js.map → PurchasesPage-DgL5T6BY-DePUuE9l.js.map} +1 -1
- package/dist/{SaleCreatePage-C9kFmTvm-B3Y0o4CX.js → SaleCreatePage-CZnIOydv-DKBw-qp7.js} +15 -15
- package/dist/{SaleCreatePage-C9kFmTvm-B3Y0o4CX.js.map → SaleCreatePage-CZnIOydv-DKBw-qp7.js.map} +1 -1
- package/dist/{SalesPage-D18DCseD-BxktGDRQ.js → SalesPage-DPIRrC_O-M8rqnK7z.js} +62 -62
- package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js.map +1 -0
- package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js +676 -0
- package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js.map +1 -0
- package/dist/{ShowFlywayQuery-D1y_4A1u.js → ShowFlywayQuery-DIOUdYfG.js} +26 -19
- package/dist/{ShowFlywayQuery-D1y_4A1u.js.map → ShowFlywayQuery-DIOUdYfG.js.map} +1 -1
- package/dist/{StorageUnitsPage-7EqwuMOI-BwUso1Th.js → StorageUnitsPage-BDRkdCjW-UF64rf7q.js} +195 -188
- package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js.map +1 -0
- package/dist/{SubMenu-eEDhZUvh.js → SubMenu-BdMTYtC1.js} +5 -3
- package/dist/SubMenu-BdMTYtC1.js.map +1 -0
- package/dist/{TransactionsPage-DrH53pVS-BkhIGB6C.js → TransactionsPage-CqWTMNU8-Df6eGFDW.js} +48 -48
- package/dist/{TransactionsPage-DrH53pVS-BkhIGB6C.js.map → TransactionsPage-CqWTMNU8-Df6eGFDW.js.map} +1 -1
- package/dist/{TransferCreatePage-CuvoMrYH-DTTfHjz-.js → TransferCreatePage-DF7FZaTJ-CL79V3aR.js} +8 -8
- package/dist/{TransferCreatePage-CuvoMrYH-DTTfHjz-.js.map → TransferCreatePage-DF7FZaTJ-CL79V3aR.js.map} +1 -1
- package/dist/{TransfersPage-Cf701t8s-BBbN7cBf.js → TransfersPage-CGrRFaBF-cTwBUv0o.js} +69 -69
- package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js.map +1 -0
- package/dist/TypeConfiguration-JbRCN6GR.js +114 -0
- package/dist/TypeConfiguration-JbRCN6GR.js.map +1 -0
- package/dist/{UserList-DgPxsnj2.js → UserList-L41Xw0Q6.js} +2 -2
- package/dist/{UserList-DgPxsnj2.js.map → UserList-L41Xw0Q6.js.map} +1 -1
- package/dist/Users-CsJ08Kjm.js +40 -0
- package/dist/{Users-Bpc4Sazd.js.map → Users-CsJ08Kjm.js.map} +1 -1
- package/dist/{VialsPage-8oAc1yFv-Cl3FUXBJ.js → VialsPage-rvvXjgZG-Oqo1v6kQ.js} +35 -35
- package/dist/{VialsPage-8oAc1yFv-Cl3FUXBJ.js.map → VialsPage-rvvXjgZG-Oqo1v6kQ.js.map} +1 -1
- package/dist/{constants-ClZJY2x1-MkSWn6TZ.js → constants-DpXnLsAB-D6lN5cjK.js} +58 -47
- package/dist/constants-DpXnLsAB-D6lN5cjK.js.map +1 -0
- package/dist/{dashboardLayoutUtils-D1xCAxp3.js → dashboardLayoutUtils-CJivzaU1.js} +95 -92
- package/dist/dashboardLayoutUtils-CJivzaU1.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.lib-ETRQOzvE.js +894 -0
- package/dist/index.lib-ETRQOzvE.js.map +1 -0
- package/dist/listValueStore-BFQtDYIR-Bj0yX145.js +36 -0
- package/dist/listValueStore-BFQtDYIR-Bj0yX145.js.map +1 -0
- package/package.json +1 -1
- package/dist/AccessRights-xrday-L1.js.map +0 -1
- package/dist/AddMenuConfiguration-e5BVXhmw.js +0 -8547
- package/dist/AddMenuConfiguration-e5BVXhmw.js.map +0 -1
- package/dist/CategoriesPage-BsS5IQh3-B03lWRY5.js.map +0 -1
- package/dist/ConditionConfig-Ddz9halE.js +0 -395
- package/dist/ConditionConfig-Ddz9halE.js.map +0 -1
- package/dist/ConditionConfig.css +0 -1
- package/dist/EventConfig-BmLemzX3.js +0 -26
- package/dist/EventConfigurations-Bzh1qWXU.js +0 -450
- package/dist/EventConfigurations-Bzh1qWXU.js.map +0 -1
- package/dist/EventsExceptionModal-B2SRrnB1.js +0 -200
- package/dist/EventsExceptionModal-B2SRrnB1.js.map +0 -1
- package/dist/EventsSkeleton-BIcPks4T.js +0 -61
- package/dist/EventsSkeleton-BIcPks4T.js.map +0 -1
- package/dist/FeatureMenu-DYJmDt7q.js.map +0 -1
- package/dist/GrantPermissionModal-BDN66Atn.js.map +0 -1
- package/dist/ImmunizationConfigurationBase-Di1KO3oW.js.map +0 -1
- package/dist/ManageEventConfiguration-CoYcpjR9.js +0 -1085
- package/dist/ManageEventConfiguration-CoYcpjR9.js.map +0 -1
- package/dist/MobileAnalytics-pQoE8cG1.js +0 -16888
- package/dist/MobileAnalytics-pQoE8cG1.js.map +0 -1
- package/dist/MobileMenuManagement-Cf8IZlla.js +0 -108
- package/dist/MobileMenuManagement-Cf8IZlla.js.map +0 -1
- package/dist/MobileTypeEventConfigModal-BeveaX0C.js +0 -783
- package/dist/MobileTypeEventConfigModal-BeveaX0C.js.map +0 -1
- package/dist/OtherTypeEventConfigModal-CM6VkdmY.js +0 -2046
- package/dist/OtherTypeEventConfigModal-CM6VkdmY.js.map +0 -1
- package/dist/PickupsPage-Ctpghavs-CUp4uIZq.js.map +0 -1
- package/dist/ProductEditPage-C1thoKHu-URQaZ6st.js.map +0 -1
- package/dist/ProductsPage-CupVmOD4-D45a_hf-.js.map +0 -1
- package/dist/PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js.map +0 -1
- package/dist/PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js.map +0 -1
- package/dist/SalesPage-D18DCseD-BxktGDRQ.js.map +0 -1
- package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js +0 -747
- package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js.map +0 -1
- package/dist/StorageUnitsPage-7EqwuMOI-BwUso1Th.js.map +0 -1
- package/dist/SubMenu-eEDhZUvh.js.map +0 -1
- package/dist/TransfersPage-Cf701t8s-BBbN7cBf.js.map +0 -1
- package/dist/TypeConfiguration-3O6ABrK-.js +0 -117
- package/dist/TypeConfiguration-3O6ABrK-.js.map +0 -1
- package/dist/Users-Bpc4Sazd.js +0 -41
- package/dist/constants-ClZJY2x1-MkSWn6TZ.js.map +0 -1
- package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +0 -1
- package/dist/index.lib-Dn8PMkeD.js +0 -862
- package/dist/index.lib-Dn8PMkeD.js.map +0 -1
package/dist/{PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js → PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js}
RENAMED
|
@@ -1,151 +1,160 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { o as
|
|
4
|
-
import { r as P, b as
|
|
5
|
-
import { n as
|
|
6
|
-
import { Y as
|
|
7
|
-
import { d as
|
|
8
|
-
import { useMemo as
|
|
9
|
-
import { jsxs as
|
|
10
|
-
import { Box as
|
|
11
|
-
import { v4 as
|
|
12
|
-
import
|
|
13
|
-
import { useNavigate as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
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
|
|
24
|
+
}], H = () => L().split("-")[0].toUpperCase();
|
|
25
|
+
function ae(C = !1) {
|
|
25
26
|
return {
|
|
26
|
-
key:
|
|
27
|
-
batchId:
|
|
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
|
|
39
|
-
let
|
|
40
|
-
id:
|
|
41
|
-
ownerType:
|
|
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:
|
|
44
|
+
purchaseDate: O,
|
|
44
45
|
paymentMode: "CASH",
|
|
45
46
|
notes: "",
|
|
46
|
-
items: [
|
|
47
|
+
items: [ae()]
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
-
!
|
|
49
|
+
ee(() => {
|
|
50
|
+
!S && a.ownerType === "USER" ? b((e) => ({
|
|
50
51
|
...e,
|
|
51
52
|
ownerType: "FACILITY",
|
|
52
53
|
ownerId: ""
|
|
53
|
-
})) : !
|
|
54
|
+
})) : !A && a.ownerType === "FACILITY" && b((e) => ({
|
|
54
55
|
...e,
|
|
55
56
|
ownerType: "USER",
|
|
56
57
|
ownerId: ""
|
|
57
58
|
}));
|
|
58
59
|
}, [
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
S,
|
|
61
|
+
A,
|
|
61
62
|
a.ownerType
|
|
62
|
-
]),
|
|
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,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
let [i, u, h] = await Promise.all([
|
|
76
|
+
Ie(),
|
|
77
|
+
we({ activeOnly: !0 }),
|
|
78
|
+
Pe().catch(() => [])
|
|
70
79
|
]);
|
|
71
|
-
|
|
80
|
+
le(i), se(u), ue(h);
|
|
72
81
|
} catch (i) {
|
|
73
|
-
|
|
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
|
|
79
|
-
|
|
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
|
-
]),
|
|
83
|
-
|
|
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
|
|
88
|
-
|
|
89
|
-
let
|
|
90
|
-
return
|
|
91
|
-
...
|
|
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:
|
|
104
|
+
items: u
|
|
96
105
|
};
|
|
97
106
|
});
|
|
98
107
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
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
|
|
106
|
-
|
|
114
|
+
function me() {
|
|
115
|
+
b((e) => ({
|
|
107
116
|
...e,
|
|
108
|
-
items: [...e.items,
|
|
117
|
+
items: [...e.items, ae(v)]
|
|
109
118
|
}));
|
|
110
119
|
}
|
|
111
|
-
let
|
|
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),
|
|
117
|
-
return Number.isNaN(i) || Number.isNaN(
|
|
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]),
|
|
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
|
-
},
|
|
126
|
-
let r =
|
|
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
|
|
129
|
-
if (
|
|
130
|
-
let
|
|
131
|
-
(
|
|
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
|
|
135
|
-
return
|
|
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:
|
|
138
|
-
buyPrice: y ? P(e.buyPrice, "Buy price") ||
|
|
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") ||
|
|
141
|
-
manufactureDate:
|
|
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
|
-
}),
|
|
145
|
-
async function
|
|
153
|
+
}), Z = _(I) && K.every(_) && a.items.length > 0;
|
|
154
|
+
async function pe() {
|
|
146
155
|
var r, n;
|
|
147
|
-
if (!
|
|
148
|
-
l.markAllTouched(),
|
|
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 &&
|
|
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 (!
|
|
166
|
-
let
|
|
167
|
-
return !
|
|
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
|
|
178
|
-
|
|
186
|
+
let i = await ge(e);
|
|
187
|
+
J({
|
|
179
188
|
message: "Purchase request submitted for approval.",
|
|
180
189
|
type: "success"
|
|
181
|
-
}),
|
|
182
|
-
} else await
|
|
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
|
-
}),
|
|
194
|
+
}), C("/ui/medplat/manage/pm/purchases");
|
|
186
195
|
} catch (i) {
|
|
187
|
-
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
205
|
+
actions: /* @__PURE__ */ d(F, {
|
|
197
206
|
direction: "row",
|
|
198
207
|
spacing: 1,
|
|
199
|
-
children: [/* @__PURE__ */ t(
|
|
208
|
+
children: [/* @__PURE__ */ t(j, {
|
|
200
209
|
variant: "outlined",
|
|
201
|
-
onClick: () =>
|
|
210
|
+
onClick: () => C(m ? "/ui/medplat/manage/pm/purchase-requests" : "/ui/medplat/manage/pm/purchases"),
|
|
202
211
|
children: "Cancel"
|
|
203
|
-
}), /* @__PURE__ */ t(
|
|
212
|
+
}), /* @__PURE__ */ t(j, {
|
|
204
213
|
variant: "contained",
|
|
205
|
-
startIcon: /* @__PURE__ */ t(
|
|
206
|
-
disabled: !
|
|
207
|
-
onClick: () => void
|
|
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
|
-
|
|
221
|
+
Q ? /* @__PURE__ */ t(ke, {
|
|
213
222
|
severity: "error",
|
|
214
223
|
sx: { mb: 2 },
|
|
215
|
-
children:
|
|
224
|
+
children: Q
|
|
216
225
|
}) : null,
|
|
217
|
-
/* @__PURE__ */ t(
|
|
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__ */
|
|
234
|
+
children: /* @__PURE__ */ d(B, {
|
|
226
235
|
sx: { p: 2.5 },
|
|
227
|
-
children: [/* @__PURE__ */ t(
|
|
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__ */
|
|
241
|
+
}), /* @__PURE__ */ d(c, {
|
|
233
242
|
container: !0,
|
|
234
243
|
spacing: 2,
|
|
235
|
-
children: [/* @__PURE__ */ t(
|
|
244
|
+
children: [/* @__PURE__ */ t(c, {
|
|
236
245
|
item: !0,
|
|
237
246
|
xs: 12,
|
|
238
247
|
md: 4,
|
|
239
|
-
children: /* @__PURE__ */ t(
|
|
248
|
+
children: /* @__PURE__ */ t(U, {
|
|
240
249
|
label: "Purchase Type",
|
|
241
250
|
required: !0,
|
|
242
251
|
value: a.ownerType,
|
|
243
|
-
onChange: (e) =>
|
|
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") && !!
|
|
250
|
-
options:
|
|
251
|
-
helperText: l.show("ownerType") &&
|
|
258
|
+
error: l.show("ownerType") && !!I.ownerType,
|
|
259
|
+
options: ne,
|
|
260
|
+
helperText: l.show("ownerType") && I.ownerType ? I.ownerType : "Personal stock vs. facility stock"
|
|
252
261
|
})
|
|
253
|
-
}), a.ownerType === "FACILITY" ? /* @__PURE__ */ t(
|
|
262
|
+
}), a.ownerType === "FACILITY" ? /* @__PURE__ */ t(c, {
|
|
254
263
|
item: !0,
|
|
255
264
|
xs: 12,
|
|
256
265
|
md: 4,
|
|
257
|
-
children: /* @__PURE__ */ t(
|
|
266
|
+
children: /* @__PURE__ */ t(Be, {
|
|
258
267
|
required: !0,
|
|
259
268
|
value: a.ownerId,
|
|
260
|
-
onChange: (e) =>
|
|
269
|
+
onChange: (e) => b({
|
|
261
270
|
...a,
|
|
262
271
|
ownerId: e
|
|
263
272
|
}),
|
|
264
273
|
onBlur: l.onBlur("ownerId"),
|
|
265
|
-
error: l.show("ownerId") && !!
|
|
266
|
-
helperText: l.show("ownerId") &&
|
|
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(
|
|
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__ */
|
|
289
|
+
children: /* @__PURE__ */ d(B, {
|
|
281
290
|
sx: { p: 2.5 },
|
|
282
|
-
children: [/* @__PURE__ */ t(
|
|
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
|
-
}),
|
|
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(
|
|
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__ */
|
|
308
|
+
}) : /* @__PURE__ */ d(Ye, {
|
|
300
309
|
size: "small",
|
|
301
|
-
children: [/* @__PURE__ */ t(
|
|
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(
|
|
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 ?
|
|
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(
|
|
342
|
+
/* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(Oe, {
|
|
334
343
|
size: "small",
|
|
335
|
-
label:
|
|
336
|
-
color:
|
|
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(
|
|
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__ */
|
|
359
|
+
children: /* @__PURE__ */ d(B, {
|
|
351
360
|
sx: { p: 2.5 },
|
|
352
361
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
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(
|
|
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(
|
|
371
|
+
}), /* @__PURE__ */ t(j, {
|
|
363
372
|
variant: "outlined",
|
|
364
|
-
startIcon: /* @__PURE__ */ t(
|
|
365
|
-
onClick:
|
|
373
|
+
startIcon: /* @__PURE__ */ t(je, {}),
|
|
374
|
+
onClick: me,
|
|
366
375
|
children: "Add Line"
|
|
367
376
|
})]
|
|
368
377
|
}),
|
|
369
|
-
/* @__PURE__ */ t(
|
|
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 =
|
|
374
|
-
return /* @__PURE__ */ t(
|
|
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__ */
|
|
389
|
+
children: /* @__PURE__ */ d(c, {
|
|
381
390
|
container: !0,
|
|
382
391
|
spacing: 2,
|
|
383
392
|
children: [
|
|
384
|
-
/* @__PURE__ */ t(
|
|
393
|
+
/* @__PURE__ */ t(c, {
|
|
385
394
|
item: !0,
|
|
386
395
|
xs: 12,
|
|
387
396
|
md: 3,
|
|
388
|
-
children: /* @__PURE__ */ t(
|
|
397
|
+
children: /* @__PURE__ */ t(U, {
|
|
389
398
|
label: "Product",
|
|
390
399
|
required: !0,
|
|
391
400
|
value: e.productId,
|
|
392
|
-
onChange: (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:
|
|
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(
|
|
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) =>
|
|
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(
|
|
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) =>
|
|
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
|
-
|
|
442
|
-
let o = (i == null ? void 0 : i.salePriceMode) || "FREE",
|
|
443
|
-
return /* @__PURE__ */ t(
|
|
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:
|
|
457
|
-
value:
|
|
458
|
-
onChange: (
|
|
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:
|
|
470
|
+
helperText: ye
|
|
462
471
|
})
|
|
463
472
|
});
|
|
464
473
|
})() : null,
|
|
465
|
-
m ? null : /* @__PURE__ */ t(
|
|
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:
|
|
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:
|
|
485
|
+
inputProps: { min: O },
|
|
477
486
|
value: e.expiryDate,
|
|
478
|
-
onChange: (o) =>
|
|
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 :
|
|
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(
|
|
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:
|
|
503
|
+
inputProps: { max: O },
|
|
495
504
|
value: e.manufactureDate,
|
|
496
|
-
onChange: (o) =>
|
|
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(
|
|
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) =>
|
|
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(
|
|
541
|
+
/* @__PURE__ */ t(c, {
|
|
515
542
|
item: !0,
|
|
516
543
|
xs: 10,
|
|
517
544
|
md: 1,
|
|
518
|
-
children: /* @__PURE__ */ t(
|
|
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) =>
|
|
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:
|
|
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(
|
|
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(
|
|
565
|
+
children: /* @__PURE__ */ t(ie, {
|
|
539
566
|
color: "error",
|
|
540
|
-
onClick: () =>
|
|
567
|
+
onClick: () => ce(r),
|
|
541
568
|
disabled: a.items.length === 1,
|
|
542
|
-
children: /* @__PURE__ */ t(
|
|
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(
|
|
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__ */
|
|
588
|
+
children: /* @__PURE__ */ d(B, {
|
|
562
589
|
sx: { p: 2.5 },
|
|
563
590
|
children: [
|
|
564
|
-
/* @__PURE__ */ t(
|
|
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__ */
|
|
597
|
+
/* @__PURE__ */ d(c, {
|
|
571
598
|
container: !0,
|
|
572
599
|
spacing: 2,
|
|
573
|
-
children: [y ? /* @__PURE__ */ t(
|
|
600
|
+
children: [y ? /* @__PURE__ */ t(c, {
|
|
574
601
|
item: !0,
|
|
575
602
|
xs: 12,
|
|
576
603
|
md: 6,
|
|
577
|
-
children: /* @__PURE__ */ t(
|
|
604
|
+
children: /* @__PURE__ */ t(U, {
|
|
578
605
|
label: "Payment Mode",
|
|
579
606
|
value: a.paymentMode || "",
|
|
580
|
-
onChange: (e) =>
|
|
607
|
+
onChange: (e) => b({
|
|
581
608
|
...a,
|
|
582
609
|
paymentMode: e
|
|
583
610
|
}),
|
|
584
|
-
options:
|
|
611
|
+
options: Se
|
|
585
612
|
})
|
|
586
|
-
}) : null, /* @__PURE__ */ t(
|
|
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) =>
|
|
622
|
+
onChange: (e) => b({
|
|
596
623
|
...a,
|
|
597
624
|
notes: e.target.value
|
|
598
625
|
})
|
|
599
626
|
})
|
|
600
627
|
})]
|
|
601
628
|
}),
|
|
602
|
-
y ? /* @__PURE__ */
|
|
603
|
-
/* @__PURE__ */ t(
|
|
604
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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(
|
|
646
|
+
}), /* @__PURE__ */ t(M, {
|
|
620
647
|
variant: "h4",
|
|
621
648
|
sx: {
|
|
622
649
|
fontWeight: 800,
|
|
623
650
|
fontVariantNumeric: "tabular-nums"
|
|
624
651
|
},
|
|
625
|
-
children:
|
|
652
|
+
children: D.priced ? X(D.sum) : "—"
|
|
626
653
|
})]
|
|
627
654
|
}),
|
|
628
|
-
|
|
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
|
-
|
|
673
|
+
br as default
|
|
647
674
|
};
|
|
648
|
-
//# sourceMappingURL=PurchaseCreatePage-
|
|
675
|
+
//# sourceMappingURL=PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map
|