@argusoft/medplat-product-management 1.0.2 → 1.0.4
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/{BrandsPage-CSA3meke.js → BrandsPage-BE3kn-8b.js} +77 -75
- package/dist/BrandsPage-BE3kn-8b.js.map +1 -0
- package/dist/{CategoriesPage-BrspzkJL.js → CategoriesPage-COqi3pMi.js} +71 -70
- package/dist/{CategoriesPage-BrspzkJL.js.map → CategoriesPage-COqi3pMi.js.map} +1 -1
- package/dist/{DashboardPage-CqaquOs2.js → DashboardPage-C_H1Jrey.js} +90 -89
- package/dist/DashboardPage-C_H1Jrey.js.map +1 -0
- package/dist/{FacilityPicker-Dv_H95WW.js → FacilityPicker-Diq2hnYg.js} +2 -2
- package/dist/{FacilityPicker-Dv_H95WW.js.map → FacilityPicker-Diq2hnYg.js.map} +1 -1
- package/dist/{InventoryPage-CPbzfDMR.js → InventoryPage-Bjpw6vTz.js} +106 -115
- package/dist/InventoryPage-Bjpw6vTz.js.map +1 -0
- package/dist/{MemberProfileCard-0vjO3Gzd.js → MemberProfileCard-BLUVRILO.js} +10 -9
- package/dist/MemberProfileCard-BLUVRILO.js.map +1 -0
- package/dist/{PaymentCreatePage-BYmDZAIB.js → PaymentCreatePage-B5VOgTx9.js} +173 -177
- package/dist/PaymentCreatePage-B5VOgTx9.js.map +1 -0
- package/dist/{PaymentsPage-BXPvKon-.js → PaymentsPage-DY6BclkN.js} +24 -23
- package/dist/{PaymentsPage-BXPvKon-.js.map → PaymentsPage-DY6BclkN.js.map} +1 -1
- package/dist/PickupCreatePage-CCSiyFQF.js +706 -0
- package/dist/PickupCreatePage-CCSiyFQF.js.map +1 -0
- package/dist/{PickupsPage-D66_Wta4.js → PickupsPage-DGi6T5Of.js} +83 -90
- package/dist/PickupsPage-DGi6T5Of.js.map +1 -0
- package/dist/PmGuard-C90yhpsN.js +592 -0
- package/dist/PmGuard-C90yhpsN.js.map +1 -0
- package/dist/{PmTable-B9970kPY.js → PmTable-BkK65bJQ.js} +98 -98
- package/dist/PmTable-BkK65bJQ.js.map +1 -0
- package/dist/{ProductEditPage-B8qFTCW9.js → ProductEditPage-CQj9egzW.js} +138 -137
- package/dist/ProductEditPage-CQj9egzW.js.map +1 -0
- package/dist/{ProductsPage-C7_r9cKn.js → ProductsPage-i8QVw_Jm.js} +65 -64
- package/dist/{ProductsPage-C7_r9cKn.js.map → ProductsPage-i8QVw_Jm.js.map} +1 -1
- package/dist/PurchaseCreatePage-Bp6bl9n8.js +591 -0
- package/dist/PurchaseCreatePage-Bp6bl9n8.js.map +1 -0
- package/dist/{PurchaseRequestDetailPage-C7aAwEqw.js → PurchaseRequestDetailPage-CNAqIFef.js} +216 -215
- package/dist/PurchaseRequestDetailPage-CNAqIFef.js.map +1 -0
- package/dist/{PurchaseRequestsPage-BwCkbpaX.js → PurchaseRequestsPage-BJqDlNrc.js} +57 -56
- package/dist/{PurchaseRequestsPage-BwCkbpaX.js.map → PurchaseRequestsPage-BJqDlNrc.js.map} +1 -1
- package/dist/{PurchasesPage-CvaZouVy.js → PurchasesPage-BQEToymQ.js} +76 -75
- package/dist/{PurchasesPage-CvaZouVy.js.map → PurchasesPage-BQEToymQ.js.map} +1 -1
- package/dist/{SaleCreatePage-DP1Qmltu.js → SaleCreatePage-DbfBK4PH.js} +149 -173
- package/dist/SaleCreatePage-DbfBK4PH.js.map +1 -0
- package/dist/{SalesPage-CO3cdYX5.js → SalesPage-CTBJMxZe.js} +50 -49
- package/dist/SalesPage-CTBJMxZe.js.map +1 -0
- package/dist/SettingsPage-CiwVmzM3.js +663 -0
- package/dist/SettingsPage-CiwVmzM3.js.map +1 -0
- package/dist/{StorageUnitsPage-B9Hr_RkW.js → StorageUnitsPage-BV7nK_iE.js} +57 -56
- package/dist/{StorageUnitsPage-B9Hr_RkW.js.map → StorageUnitsPage-BV7nK_iE.js.map} +1 -1
- package/dist/{TransactionsPage-HKIGwEZN.js → TransactionsPage-Cocn4901.js} +55 -54
- package/dist/TransactionsPage-Cocn4901.js.map +1 -0
- package/dist/TransferCreatePage-DbjcjuOg.js +316 -0
- package/dist/TransferCreatePage-DbjcjuOg.js.map +1 -0
- package/dist/TransfersPage-BFVF7Xvc.js +471 -0
- package/dist/TransfersPage-BFVF7Xvc.js.map +1 -0
- package/dist/VialsPage-BNzYTLVd.js +321 -0
- package/dist/VialsPage-BNzYTLVd.js.map +1 -0
- package/dist/index.js +652 -34
- package/dist/index.js.map +1 -1
- package/dist/settingsStore-KW217unV.js +417 -0
- package/dist/settingsStore-KW217unV.js.map +1 -0
- package/package.json +1 -1
- package/dist/BrandsPage-CSA3meke.js.map +0 -1
- package/dist/DashboardPage-CqaquOs2.js.map +0 -1
- package/dist/InventoryPage-CPbzfDMR.js.map +0 -1
- package/dist/MemberProfileCard-0vjO3Gzd.js.map +0 -1
- package/dist/PaymentCreatePage-BYmDZAIB.js.map +0 -1
- package/dist/PickupCreatePage-CMGwoAXj.js +0 -426
- package/dist/PickupCreatePage-CMGwoAXj.js.map +0 -1
- package/dist/PickupsPage-D66_Wta4.js.map +0 -1
- package/dist/PmTable-B9970kPY.js.map +0 -1
- package/dist/ProductEditPage-B8qFTCW9.js.map +0 -1
- package/dist/PurchaseCreatePage-CDfNDcKG.js +0 -627
- package/dist/PurchaseCreatePage-CDfNDcKG.js.map +0 -1
- package/dist/PurchaseRequestDetailPage-C7aAwEqw.js.map +0 -1
- package/dist/SaleCreatePage-DP1Qmltu.js.map +0 -1
- package/dist/SalesPage-CO3cdYX5.js.map +0 -1
- package/dist/SettingsPage-DvVRwSFw.js +0 -711
- package/dist/SettingsPage-DvVRwSFw.js.map +0 -1
- package/dist/TransactionsPage-HKIGwEZN.js.map +0 -1
- package/dist/TransferCreatePage-DMuZqQ3c.js +0 -363
- package/dist/TransferCreatePage-DMuZqQ3c.js.map +0 -1
- package/dist/TransfersPage-COIyouL4.js +0 -480
- package/dist/TransfersPage-COIyouL4.js.map +0 -1
- package/dist/VialsPage-BNPUwGCU.js +0 -922
- package/dist/VialsPage-BNPUwGCU.js.map +0 -1
- package/dist/currency-ClRLIEg2.js +0 -1372
- package/dist/currency-ClRLIEg2.js.map +0 -1
|
@@ -1,627 +0,0 @@
|
|
|
1
|
-
import { F as e, P as t, i as n, it as r, j as i, l as a, n as ee, o as te, r as ne, y as re } from "./currency-ClRLIEg2.js";
|
|
2
|
-
import { r as o } from "./PmTable-B9970kPY.js";
|
|
3
|
-
import { a as ie, d as s, f as ae, l as oe, m as c, t as l } from "./validation-Ba7puFIO.js";
|
|
4
|
-
import { t as se } from "./useFieldErrors-hDG8ox_x.js";
|
|
5
|
-
import { a as ce, r as le, t as ue } from "./format-UOyOu75i.js";
|
|
6
|
-
import { n as de, p as fe, t as pe } from "./constants-5ZCZo-Zm.js";
|
|
7
|
-
import { t as me } from "./FacilityPicker-Dv_H95WW.js";
|
|
8
|
-
import { useEffect as he, useMemo as u, useState as d } from "react";
|
|
9
|
-
import { Fragment as ge, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
-
import { v4 as m } from "uuid";
|
|
11
|
-
import { Alert as _e, Box as ve, Button as h, Card as g, CardContent as _, Chip as ye, Divider as v, FormControl as y, FormHelperText as b, Grid as x, IconButton as be, InputLabel as S, MenuItem as C, Select as w, Stack as T, Table as xe, TableBody as Se, TableCell as E, TableHead as Ce, TableRow as D, TextField as O, Typography as k } from "@mui/material";
|
|
12
|
-
import we from "@mui/icons-material/AddRounded";
|
|
13
|
-
import { showToast as A } from "@/common/toaster/toaster";
|
|
14
|
-
import { useNavigate as Te } from "react-router-dom";
|
|
15
|
-
import Ee from "@mui/icons-material/Inventory2Rounded";
|
|
16
|
-
import De from "@mui/icons-material/SaveRounded";
|
|
17
|
-
import Oe from "@mui/icons-material/DeleteOutlineRounded";
|
|
18
|
-
//#region src/views/PurchaseCreatePage.jsx
|
|
19
|
-
var j = [{
|
|
20
|
-
value: "USER",
|
|
21
|
-
label: "Personal Use"
|
|
22
|
-
}, {
|
|
23
|
-
value: "FACILITY",
|
|
24
|
-
label: "Facility Use"
|
|
25
|
-
}];
|
|
26
|
-
function M() {
|
|
27
|
-
return {
|
|
28
|
-
key: m(),
|
|
29
|
-
batchId: m(),
|
|
30
|
-
productId: "",
|
|
31
|
-
quantity: 1,
|
|
32
|
-
buyPrice: "",
|
|
33
|
-
expiryDate: "",
|
|
34
|
-
lotNumber: "",
|
|
35
|
-
manufactureDate: "",
|
|
36
|
-
storageUnitId: ""
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function N() {
|
|
40
|
-
let N = Te(), P = a(), F = P?.managePurchaseAmounts !== !1, I = P?.allowPersonalPurchase !== !1, L = P?.requirePurchaseConfirmation === !0, ke = u(() => I ? j : j.filter((e) => e.value !== "USER"), [I]), [R, Ae] = d([]), [z, je] = d([]), [B, Me] = d([]), [V, H] = d(""), U = se(), W = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10), [G, K] = d({
|
|
41
|
-
id: m(),
|
|
42
|
-
ownerType: I ? "USER" : "FACILITY",
|
|
43
|
-
ownerId: "",
|
|
44
|
-
purchaseDate: W,
|
|
45
|
-
paymentMode: "CASH",
|
|
46
|
-
notes: "",
|
|
47
|
-
items: [M()]
|
|
48
|
-
});
|
|
49
|
-
he(() => {
|
|
50
|
-
!I && G.ownerType === "USER" && K((e) => ({
|
|
51
|
-
...e,
|
|
52
|
-
ownerType: "FACILITY",
|
|
53
|
-
ownerId: ""
|
|
54
|
-
}));
|
|
55
|
-
}, [I, G.ownerType]), n("update.manage.productManagement.purchase", () => {
|
|
56
|
-
async function n() {
|
|
57
|
-
try {
|
|
58
|
-
let [n, r, a] = await Promise.all([
|
|
59
|
-
i(),
|
|
60
|
-
t({ activeOnly: !0 }),
|
|
61
|
-
e().catch(() => [])
|
|
62
|
-
]);
|
|
63
|
-
Ae(n), je(r), Me(a);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
H(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
n();
|
|
69
|
-
}, []);
|
|
70
|
-
let q = u(() => G.ownerType === "USER" ? B.filter((e) => e.ownerType === "USER" && Number(e.qtyRemaining ?? 0) > 0 && e.status !== "EXPIRED" && e.status !== "EXHAUSTED") : G.ownerType === "FACILITY" && G.ownerId ? B.filter((e) => e.ownerType === "FACILITY" && e.ownerId === G.ownerId && Number(e.qtyRemaining ?? 0) > 0 && e.status !== "EXPIRED" && e.status !== "EXHAUSTED") : [], [
|
|
71
|
-
B,
|
|
72
|
-
G.ownerType,
|
|
73
|
-
G.ownerId
|
|
74
|
-
]), Ne = u(() => G.ownerType !== "FACILITY" || !G.ownerId ? [] : z.filter((e) => e.ownerId === G.ownerId), [
|
|
75
|
-
z,
|
|
76
|
-
G.ownerType,
|
|
77
|
-
G.ownerId
|
|
78
|
-
]);
|
|
79
|
-
function J(e, t, n) {
|
|
80
|
-
K((r) => {
|
|
81
|
-
let i = r.items.slice();
|
|
82
|
-
return i[e] = {
|
|
83
|
-
...i[e],
|
|
84
|
-
[t]: n
|
|
85
|
-
}, {
|
|
86
|
-
...r,
|
|
87
|
-
items: i
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
function Pe(e) {
|
|
92
|
-
K((t) => ({
|
|
93
|
-
...t,
|
|
94
|
-
items: t.items.filter((t, n) => n !== e)
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
function Y() {
|
|
98
|
-
K((e) => ({
|
|
99
|
-
...e,
|
|
100
|
-
items: [...e.items, M()]
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
let X = u(() => {
|
|
104
|
-
let e = !1;
|
|
105
|
-
return {
|
|
106
|
-
sum: G.items.reduce((t, n) => {
|
|
107
|
-
if (n.buyPrice === "" || n.quantity === "" || n.quantity == null) return t;
|
|
108
|
-
let r = Number(n.quantity), i = Number(n.buyPrice);
|
|
109
|
-
return Number.isNaN(r) || Number.isNaN(i) ? t : (e = !0, t + r * i);
|
|
110
|
-
}, 0),
|
|
111
|
-
priced: e
|
|
112
|
-
};
|
|
113
|
-
}, [G.items]), Z = {
|
|
114
|
-
ownerType: c(G.ownerType, "Purchase type"),
|
|
115
|
-
ownerId: G.ownerType === "FACILITY" ? c(G.ownerId, "Facility") : "",
|
|
116
|
-
purchaseDate: c(G.purchaseDate, "Purchase date")
|
|
117
|
-
}, Q = G.items.map((e) => {
|
|
118
|
-
let t = R.find((t) => t.id === e.productId), n = t?.hasExpiry === !0, r = t?.needsStorageUnit === !0 && G.ownerType === "FACILITY" ? c(e.storageUnitId, "Storage unit") : "";
|
|
119
|
-
if (!r && e.storageUnitId && t?.vaccineConfig) {
|
|
120
|
-
let n = t.vaccineConfig, i = z.find((t) => t.id === e.storageUnitId);
|
|
121
|
-
if (n.storageTempMinCelsius != null && n.storageTempMaxCelsius != null && i) {
|
|
122
|
-
let e = i.operatingTempMinCelsius, t = i.operatingTempMaxCelsius;
|
|
123
|
-
(e == null || t == null || Number(e) > Number(n.storageTempMinCelsius) || Number(t) < Number(n.storageTempMaxCelsius)) && (r = `Unit operates ${e ?? "?"}°C → ${t ?? "?"}°C, which cannot cover this product's required ${n.storageTempMinCelsius}°C → ${n.storageTempMaxCelsius}°C.`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
productId: c(e.productId, "Product"),
|
|
128
|
-
quantity: ae(e.quantity),
|
|
129
|
-
buyPrice: F ? c(e.buyPrice, "Buy price") || s(e.buyPrice) || (Number(e.buyPrice) > 0 ? "" : "Buy price must be greater than 0.") : s(e.buyPrice),
|
|
130
|
-
expiryDate: L ? "" : n && c(e.expiryDate, "Expiry date") || ie(e.expiryDate, { label: "Expiry" }),
|
|
131
|
-
manufactureDate: oe(e.manufactureDate, { label: "Manufacture date" }),
|
|
132
|
-
storageUnitId: r
|
|
133
|
-
};
|
|
134
|
-
}), $ = l(Z) && Q.every(l) && G.items.length > 0;
|
|
135
|
-
async function Fe() {
|
|
136
|
-
if (!$) {
|
|
137
|
-
U.markAllTouched(), H("Please fix the highlighted fields and try again.");
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
let e = {
|
|
141
|
-
id: G.id,
|
|
142
|
-
ownerType: G.ownerType,
|
|
143
|
-
ownerId: G.ownerType === "FACILITY" ? G.ownerId : null,
|
|
144
|
-
purchaseDate: G.purchaseDate,
|
|
145
|
-
paymentMode: F && G.paymentMode || null,
|
|
146
|
-
totalAmount: F && X.priced ? Number(X.sum.toFixed(2)) : null,
|
|
147
|
-
notes: G.notes || null,
|
|
148
|
-
items: G.items.map((e) => ({
|
|
149
|
-
batchId: e.batchId,
|
|
150
|
-
productId: e.productId,
|
|
151
|
-
quantity: Number(e.quantity),
|
|
152
|
-
buyPrice: F && e.buyPrice !== "" ? Number(e.buyPrice) : null,
|
|
153
|
-
expiryDate: e.expiryDate || null,
|
|
154
|
-
lotNumber: e.lotNumber || null,
|
|
155
|
-
manufactureDate: e.manufactureDate || null,
|
|
156
|
-
storageUnitId: e.storageUnitId || null
|
|
157
|
-
}))
|
|
158
|
-
};
|
|
159
|
-
try {
|
|
160
|
-
if (L) {
|
|
161
|
-
let t = await r(e);
|
|
162
|
-
A({
|
|
163
|
-
message: "Purchase request submitted for approval.",
|
|
164
|
-
type: "success"
|
|
165
|
-
}), N(`/ui/medplat/manage/pm/purchase-requests/${t?.id ?? G.id}`);
|
|
166
|
-
} else await re(e), A({
|
|
167
|
-
message: "Purchase recorded.",
|
|
168
|
-
type: "success"
|
|
169
|
-
}), N("/ui/medplat/manage/pm/purchases");
|
|
170
|
-
} catch (e) {
|
|
171
|
-
H(e?.response?.data?.message ?? e?.message ?? (L ? "Failed to submit purchase request" : "Failed to record purchase"));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return /* @__PURE__ */ p(ve, { children: [/* @__PURE__ */ f(ne, {}), /* @__PURE__ */ f(ee, {
|
|
175
|
-
perm: "update.manage.productManagement.purchase",
|
|
176
|
-
title: L ? "You don’t have permission to submit purchase requests" : "You don’t have permission to record purchases",
|
|
177
|
-
children: /* @__PURE__ */ p(te, {
|
|
178
|
-
title: L ? "Submit Purchase Request" : "Record Purchase",
|
|
179
|
-
subtitle: L ? "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.",
|
|
180
|
-
actions: /* @__PURE__ */ p(T, {
|
|
181
|
-
direction: "row",
|
|
182
|
-
spacing: 1,
|
|
183
|
-
children: [/* @__PURE__ */ f(h, {
|
|
184
|
-
variant: "outlined",
|
|
185
|
-
onClick: () => N(L ? "/ui/medplat/manage/pm/purchase-requests" : "/ui/medplat/manage/pm/purchases"),
|
|
186
|
-
children: "Cancel"
|
|
187
|
-
}), /* @__PURE__ */ f(h, {
|
|
188
|
-
variant: "contained",
|
|
189
|
-
startIcon: /* @__PURE__ */ f(De, {}),
|
|
190
|
-
disabled: !$,
|
|
191
|
-
onClick: () => void Fe(),
|
|
192
|
-
children: L ? "Submit Request" : "Save"
|
|
193
|
-
})]
|
|
194
|
-
}),
|
|
195
|
-
children: [
|
|
196
|
-
V ? /* @__PURE__ */ f(_e, {
|
|
197
|
-
severity: "error",
|
|
198
|
-
sx: { mb: 2 },
|
|
199
|
-
children: V
|
|
200
|
-
}) : null,
|
|
201
|
-
/* @__PURE__ */ f(g, {
|
|
202
|
-
sx: {
|
|
203
|
-
borderRadius: 4,
|
|
204
|
-
mb: 2,
|
|
205
|
-
border: "1px solid",
|
|
206
|
-
borderColor: "divider",
|
|
207
|
-
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
208
|
-
},
|
|
209
|
-
children: /* @__PURE__ */ p(_, {
|
|
210
|
-
sx: { p: 2.5 },
|
|
211
|
-
children: [/* @__PURE__ */ f(o, {
|
|
212
|
-
eyebrow: "Step 1",
|
|
213
|
-
title: "Purchase for",
|
|
214
|
-
hint: "Choose who will own this stock: yourself or a facility.",
|
|
215
|
-
sx: { mb: 2 }
|
|
216
|
-
}), /* @__PURE__ */ p(x, {
|
|
217
|
-
container: !0,
|
|
218
|
-
spacing: 2,
|
|
219
|
-
children: [/* @__PURE__ */ f(x, {
|
|
220
|
-
item: !0,
|
|
221
|
-
xs: 12,
|
|
222
|
-
md: 4,
|
|
223
|
-
children: /* @__PURE__ */ p(y, {
|
|
224
|
-
required: !0,
|
|
225
|
-
fullWidth: !0,
|
|
226
|
-
size: "small",
|
|
227
|
-
error: U.show("ownerType") && !!Z.ownerType,
|
|
228
|
-
children: [
|
|
229
|
-
/* @__PURE__ */ f(S, { children: "Purchase Type" }),
|
|
230
|
-
/* @__PURE__ */ f(w, {
|
|
231
|
-
label: "Purchase Type",
|
|
232
|
-
value: G.ownerType,
|
|
233
|
-
onChange: (e) => K({
|
|
234
|
-
...G,
|
|
235
|
-
ownerType: e.target.value,
|
|
236
|
-
ownerId: ""
|
|
237
|
-
}),
|
|
238
|
-
onBlur: U.onBlur("ownerType"),
|
|
239
|
-
children: ke.map((e) => /* @__PURE__ */ f(C, {
|
|
240
|
-
value: e.value,
|
|
241
|
-
children: e.label
|
|
242
|
-
}, e.value))
|
|
243
|
-
}),
|
|
244
|
-
/* @__PURE__ */ f(b, { children: U.show("ownerType") && Z.ownerType ? Z.ownerType : "Personal stock vs. facility stock" })
|
|
245
|
-
]
|
|
246
|
-
})
|
|
247
|
-
}), G.ownerType === "FACILITY" ? /* @__PURE__ */ f(x, {
|
|
248
|
-
item: !0,
|
|
249
|
-
xs: 12,
|
|
250
|
-
md: 4,
|
|
251
|
-
children: /* @__PURE__ */ f(me, {
|
|
252
|
-
required: !0,
|
|
253
|
-
value: G.ownerId,
|
|
254
|
-
onChange: (e) => K({
|
|
255
|
-
...G,
|
|
256
|
-
ownerId: e
|
|
257
|
-
}),
|
|
258
|
-
onBlur: U.onBlur("ownerId"),
|
|
259
|
-
error: U.show("ownerId") && !!Z.ownerId,
|
|
260
|
-
helperText: U.show("ownerId") && Z.ownerId ? Z.ownerId : "Search for the facility."
|
|
261
|
-
})
|
|
262
|
-
}) : null]
|
|
263
|
-
})]
|
|
264
|
-
})
|
|
265
|
-
}),
|
|
266
|
-
G.ownerType === "USER" || G.ownerType === "FACILITY" && G.ownerId ? /* @__PURE__ */ f(g, {
|
|
267
|
-
sx: {
|
|
268
|
-
borderRadius: 4,
|
|
269
|
-
mb: 2,
|
|
270
|
-
border: "1px solid",
|
|
271
|
-
borderColor: "divider",
|
|
272
|
-
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
273
|
-
},
|
|
274
|
-
children: /* @__PURE__ */ p(_, {
|
|
275
|
-
sx: { p: 2.5 },
|
|
276
|
-
children: [/* @__PURE__ */ f(o, {
|
|
277
|
-
eyebrow: "Context",
|
|
278
|
-
title: "Existing inventory",
|
|
279
|
-
hint: G.ownerType === "USER" ? "Your current stock." : "What this facility already has, including where it is stored.",
|
|
280
|
-
sx: { mb: 1.5 }
|
|
281
|
-
}), q.length === 0 ? /* @__PURE__ */ p(T, {
|
|
282
|
-
direction: "row",
|
|
283
|
-
spacing: 1.25,
|
|
284
|
-
alignItems: "center",
|
|
285
|
-
sx: {
|
|
286
|
-
py: 1.5,
|
|
287
|
-
color: "text.secondary"
|
|
288
|
-
},
|
|
289
|
-
children: [/* @__PURE__ */ f(Ee, { fontSize: "small" }), /* @__PURE__ */ f(k, {
|
|
290
|
-
variant: "body2",
|
|
291
|
-
children: "No active stock yet for this owner."
|
|
292
|
-
})]
|
|
293
|
-
}) : /* @__PURE__ */ p(xe, {
|
|
294
|
-
size: "small",
|
|
295
|
-
children: [/* @__PURE__ */ f(Ce, { children: /* @__PURE__ */ p(D, { children: [
|
|
296
|
-
/* @__PURE__ */ f(E, { children: "Product" }),
|
|
297
|
-
/* @__PURE__ */ f(E, { children: "Lot" }),
|
|
298
|
-
/* @__PURE__ */ f(E, {
|
|
299
|
-
align: "right",
|
|
300
|
-
children: "Remaining"
|
|
301
|
-
}),
|
|
302
|
-
/* @__PURE__ */ f(E, { children: "Expiry" }),
|
|
303
|
-
G.ownerType === "FACILITY" ? /* @__PURE__ */ f(E, { children: "Storage" }) : null,
|
|
304
|
-
/* @__PURE__ */ f(E, { children: "Status" })
|
|
305
|
-
] }) }), /* @__PURE__ */ f(Se, { children: q.map((e) => /* @__PURE__ */ p(D, { children: [
|
|
306
|
-
/* @__PURE__ */ f(E, {
|
|
307
|
-
sx: { fontWeight: 700 },
|
|
308
|
-
children: e.productName
|
|
309
|
-
}),
|
|
310
|
-
/* @__PURE__ */ f(E, {
|
|
311
|
-
sx: {
|
|
312
|
-
fontFamily: "monospace",
|
|
313
|
-
fontSize: "0.78rem"
|
|
314
|
-
},
|
|
315
|
-
children: e.lotNumber || "—"
|
|
316
|
-
}),
|
|
317
|
-
/* @__PURE__ */ f(E, {
|
|
318
|
-
align: "right",
|
|
319
|
-
sx: {
|
|
320
|
-
fontVariantNumeric: "tabular-nums",
|
|
321
|
-
fontWeight: 700
|
|
322
|
-
},
|
|
323
|
-
children: e.qtyRemaining
|
|
324
|
-
}),
|
|
325
|
-
/* @__PURE__ */ f(E, { children: e.expiryDate ? ue(e.expiryDate) : "—" }),
|
|
326
|
-
G.ownerType === "FACILITY" ? /* @__PURE__ */ f(E, { children: e.storageUnitName || "—" }) : null,
|
|
327
|
-
/* @__PURE__ */ f(E, { children: /* @__PURE__ */ f(ye, {
|
|
328
|
-
size: "small",
|
|
329
|
-
label: fe(pe, e.status),
|
|
330
|
-
color: ce(e.status)
|
|
331
|
-
}) })
|
|
332
|
-
] }, e.id)) })]
|
|
333
|
-
})]
|
|
334
|
-
})
|
|
335
|
-
}) : null,
|
|
336
|
-
/* @__PURE__ */ f(g, {
|
|
337
|
-
sx: {
|
|
338
|
-
borderRadius: 4,
|
|
339
|
-
mb: 2,
|
|
340
|
-
border: "1px solid",
|
|
341
|
-
borderColor: "divider",
|
|
342
|
-
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
343
|
-
},
|
|
344
|
-
children: /* @__PURE__ */ p(_, {
|
|
345
|
-
sx: { p: 2.5 },
|
|
346
|
-
children: [
|
|
347
|
-
/* @__PURE__ */ p(T, {
|
|
348
|
-
direction: "row",
|
|
349
|
-
justifyContent: "space-between",
|
|
350
|
-
alignItems: "flex-start",
|
|
351
|
-
sx: { mb: 2 },
|
|
352
|
-
children: [/* @__PURE__ */ f(o, {
|
|
353
|
-
eyebrow: "Step 2",
|
|
354
|
-
title: "Line items",
|
|
355
|
-
hint: "Each item creates one batch in your inventory and a receipt record."
|
|
356
|
-
}), /* @__PURE__ */ f(h, {
|
|
357
|
-
variant: "outlined",
|
|
358
|
-
startIcon: /* @__PURE__ */ f(we, {}),
|
|
359
|
-
onClick: Y,
|
|
360
|
-
children: "Add Line"
|
|
361
|
-
})]
|
|
362
|
-
}),
|
|
363
|
-
/* @__PURE__ */ f(v, { sx: { mb: 2 } }),
|
|
364
|
-
/* @__PURE__ */ f(T, {
|
|
365
|
-
spacing: 2,
|
|
366
|
-
children: G.items.map((e, t) => {
|
|
367
|
-
let n = Q[t] || {}, r = R.find((t) => t.id === e.productId), i = r?.hasExpiry === !0, a = r?.needsStorageUnit === !0 && G.ownerType === "FACILITY";
|
|
368
|
-
return /* @__PURE__ */ f(g, {
|
|
369
|
-
variant: "outlined",
|
|
370
|
-
sx: {
|
|
371
|
-
p: 2,
|
|
372
|
-
borderRadius: 3
|
|
373
|
-
},
|
|
374
|
-
children: /* @__PURE__ */ p(x, {
|
|
375
|
-
container: !0,
|
|
376
|
-
spacing: 2,
|
|
377
|
-
children: [
|
|
378
|
-
/* @__PURE__ */ f(x, {
|
|
379
|
-
item: !0,
|
|
380
|
-
xs: 12,
|
|
381
|
-
md: 3,
|
|
382
|
-
children: /* @__PURE__ */ p(y, {
|
|
383
|
-
required: !0,
|
|
384
|
-
fullWidth: !0,
|
|
385
|
-
size: "small",
|
|
386
|
-
error: U.show(`items.${t}.productId`) && !!n.productId,
|
|
387
|
-
children: [
|
|
388
|
-
/* @__PURE__ */ f(S, { children: "Product" }),
|
|
389
|
-
/* @__PURE__ */ f(w, {
|
|
390
|
-
label: "Product",
|
|
391
|
-
value: e.productId,
|
|
392
|
-
onChange: (e) => J(t, "productId", e.target.value),
|
|
393
|
-
onBlur: U.onBlur(`items.${t}.productId`),
|
|
394
|
-
children: R.map((e) => /* @__PURE__ */ f(C, {
|
|
395
|
-
value: e.id,
|
|
396
|
-
children: e.name
|
|
397
|
-
}, e.id))
|
|
398
|
-
}),
|
|
399
|
-
U.show(`items.${t}.productId`) && n.productId ? /* @__PURE__ */ f(b, { children: n.productId }) : null
|
|
400
|
-
]
|
|
401
|
-
})
|
|
402
|
-
}),
|
|
403
|
-
/* @__PURE__ */ f(x, {
|
|
404
|
-
item: !0,
|
|
405
|
-
xs: 6,
|
|
406
|
-
md: 1,
|
|
407
|
-
children: /* @__PURE__ */ f(O, {
|
|
408
|
-
required: !0,
|
|
409
|
-
fullWidth: !0,
|
|
410
|
-
size: "small",
|
|
411
|
-
type: "number",
|
|
412
|
-
label: "Qty",
|
|
413
|
-
inputProps: { min: 1 },
|
|
414
|
-
value: e.quantity,
|
|
415
|
-
onChange: (e) => J(t, "quantity", e.target.value),
|
|
416
|
-
onBlur: U.onBlur(`items.${t}.quantity`),
|
|
417
|
-
error: U.show(`items.${t}.quantity`) && !!n.quantity,
|
|
418
|
-
helperText: U.show(`items.${t}.quantity`) ? n.quantity : ""
|
|
419
|
-
})
|
|
420
|
-
}),
|
|
421
|
-
F ? /* @__PURE__ */ f(x, {
|
|
422
|
-
item: !0,
|
|
423
|
-
xs: 6,
|
|
424
|
-
md: 2,
|
|
425
|
-
children: /* @__PURE__ */ f(O, {
|
|
426
|
-
required: !0,
|
|
427
|
-
fullWidth: !0,
|
|
428
|
-
size: "small",
|
|
429
|
-
type: "number",
|
|
430
|
-
inputProps: {
|
|
431
|
-
step: "0.01",
|
|
432
|
-
min: 0
|
|
433
|
-
},
|
|
434
|
-
label: "Buy Price",
|
|
435
|
-
value: e.buyPrice,
|
|
436
|
-
onChange: (e) => J(t, "buyPrice", e.target.value),
|
|
437
|
-
onBlur: U.onBlur(`items.${t}.buyPrice`),
|
|
438
|
-
error: U.show(`items.${t}.buyPrice`) && !!n.buyPrice,
|
|
439
|
-
helperText: U.show(`items.${t}.buyPrice`) ? n.buyPrice : ""
|
|
440
|
-
})
|
|
441
|
-
}) : null,
|
|
442
|
-
L ? null : /* @__PURE__ */ f(x, {
|
|
443
|
-
item: !0,
|
|
444
|
-
xs: 6,
|
|
445
|
-
md: 2,
|
|
446
|
-
children: /* @__PURE__ */ f(O, {
|
|
447
|
-
required: i,
|
|
448
|
-
fullWidth: !0,
|
|
449
|
-
size: "small",
|
|
450
|
-
type: "date",
|
|
451
|
-
label: "Expiry",
|
|
452
|
-
InputLabelProps: { shrink: !0 },
|
|
453
|
-
inputProps: { min: W },
|
|
454
|
-
value: e.expiryDate,
|
|
455
|
-
onChange: (e) => J(t, "expiryDate", e.target.value),
|
|
456
|
-
onBlur: U.onBlur(`items.${t}.expiryDate`),
|
|
457
|
-
error: U.show(`items.${t}.expiryDate`) && !!n.expiryDate,
|
|
458
|
-
helperText: U.show(`items.${t}.expiryDate`) && n.expiryDate ? n.expiryDate : i ? "Required for this product" : ""
|
|
459
|
-
})
|
|
460
|
-
}),
|
|
461
|
-
L ? null : /* @__PURE__ */ f(x, {
|
|
462
|
-
item: !0,
|
|
463
|
-
xs: 6,
|
|
464
|
-
md: 2,
|
|
465
|
-
children: /* @__PURE__ */ f(O, {
|
|
466
|
-
fullWidth: !0,
|
|
467
|
-
size: "small",
|
|
468
|
-
label: "Lot #",
|
|
469
|
-
value: e.lotNumber,
|
|
470
|
-
onChange: (e) => J(t, "lotNumber", e.target.value)
|
|
471
|
-
})
|
|
472
|
-
}),
|
|
473
|
-
/* @__PURE__ */ f(x, {
|
|
474
|
-
item: !0,
|
|
475
|
-
xs: 10,
|
|
476
|
-
md: 1,
|
|
477
|
-
children: /* @__PURE__ */ p(y, {
|
|
478
|
-
fullWidth: !0,
|
|
479
|
-
size: "small",
|
|
480
|
-
required: a,
|
|
481
|
-
disabled: G.ownerType !== "FACILITY" || !G.ownerId,
|
|
482
|
-
error: U.show(`items.${t}.storageUnitId`) && !!n.storageUnitId,
|
|
483
|
-
children: [
|
|
484
|
-
/* @__PURE__ */ f(S, { children: "Storage" }),
|
|
485
|
-
/* @__PURE__ */ p(w, {
|
|
486
|
-
label: "Storage",
|
|
487
|
-
value: e.storageUnitId || "",
|
|
488
|
-
onChange: (e) => J(t, "storageUnitId", e.target.value),
|
|
489
|
-
onBlur: U.onBlur(`items.${t}.storageUnitId`),
|
|
490
|
-
children: [/* @__PURE__ */ f(C, {
|
|
491
|
-
value: "",
|
|
492
|
-
children: /* @__PURE__ */ f("em", { children: "—" })
|
|
493
|
-
}), Ne.map((e) => /* @__PURE__ */ f(C, {
|
|
494
|
-
value: e.id,
|
|
495
|
-
children: e.unitName
|
|
496
|
-
}, e.id))]
|
|
497
|
-
}),
|
|
498
|
-
U.show(`items.${t}.storageUnitId`) && n.storageUnitId ? /* @__PURE__ */ f(b, { children: n.storageUnitId }) : a ? /* @__PURE__ */ f(b, { children: "Required for this product" }) : null
|
|
499
|
-
]
|
|
500
|
-
})
|
|
501
|
-
}),
|
|
502
|
-
/* @__PURE__ */ f(x, {
|
|
503
|
-
item: !0,
|
|
504
|
-
xs: 2,
|
|
505
|
-
md: 1,
|
|
506
|
-
sx: { textAlign: "right" },
|
|
507
|
-
children: /* @__PURE__ */ f(be, {
|
|
508
|
-
color: "error",
|
|
509
|
-
onClick: () => Pe(t),
|
|
510
|
-
disabled: G.items.length === 1,
|
|
511
|
-
children: /* @__PURE__ */ f(Oe, {})
|
|
512
|
-
})
|
|
513
|
-
})
|
|
514
|
-
]
|
|
515
|
-
})
|
|
516
|
-
}, e.key);
|
|
517
|
-
})
|
|
518
|
-
})
|
|
519
|
-
]
|
|
520
|
-
})
|
|
521
|
-
}),
|
|
522
|
-
/* @__PURE__ */ f(g, {
|
|
523
|
-
sx: {
|
|
524
|
-
borderRadius: 4,
|
|
525
|
-
bgcolor: "grey.50",
|
|
526
|
-
border: "1px solid",
|
|
527
|
-
borderColor: "divider",
|
|
528
|
-
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
529
|
-
},
|
|
530
|
-
children: /* @__PURE__ */ p(_, {
|
|
531
|
-
sx: { p: 2.5 },
|
|
532
|
-
children: [
|
|
533
|
-
/* @__PURE__ */ f(o, {
|
|
534
|
-
eyebrow: "Step 3",
|
|
535
|
-
title: F ? "Bill summary" : "Receipt details",
|
|
536
|
-
hint: F ? "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.",
|
|
537
|
-
sx: { mb: 2 }
|
|
538
|
-
}),
|
|
539
|
-
/* @__PURE__ */ p(x, {
|
|
540
|
-
container: !0,
|
|
541
|
-
spacing: 2,
|
|
542
|
-
children: [F ? /* @__PURE__ */ f(x, {
|
|
543
|
-
item: !0,
|
|
544
|
-
xs: 12,
|
|
545
|
-
md: 6,
|
|
546
|
-
children: /* @__PURE__ */ p(y, {
|
|
547
|
-
fullWidth: !0,
|
|
548
|
-
size: "small",
|
|
549
|
-
children: [/* @__PURE__ */ f(S, { children: "Payment Mode" }), /* @__PURE__ */ p(w, {
|
|
550
|
-
label: "Payment Mode",
|
|
551
|
-
value: G.paymentMode || "",
|
|
552
|
-
onChange: (e) => K({
|
|
553
|
-
...G,
|
|
554
|
-
paymentMode: e.target.value
|
|
555
|
-
}),
|
|
556
|
-
children: [/* @__PURE__ */ f(C, {
|
|
557
|
-
value: "",
|
|
558
|
-
children: /* @__PURE__ */ f("em", { children: "—" })
|
|
559
|
-
}), de.map((e) => /* @__PURE__ */ f(C, {
|
|
560
|
-
value: e.value,
|
|
561
|
-
children: e.label
|
|
562
|
-
}, e.value))]
|
|
563
|
-
})]
|
|
564
|
-
})
|
|
565
|
-
}) : null, /* @__PURE__ */ f(x, {
|
|
566
|
-
item: !0,
|
|
567
|
-
xs: 12,
|
|
568
|
-
md: F ? 6 : 12,
|
|
569
|
-
children: /* @__PURE__ */ f(O, {
|
|
570
|
-
fullWidth: !0,
|
|
571
|
-
size: "small",
|
|
572
|
-
label: "Notes",
|
|
573
|
-
value: G.notes,
|
|
574
|
-
onChange: (e) => K({
|
|
575
|
-
...G,
|
|
576
|
-
notes: e.target.value
|
|
577
|
-
})
|
|
578
|
-
})
|
|
579
|
-
})]
|
|
580
|
-
}),
|
|
581
|
-
F ? /* @__PURE__ */ p(ge, { children: [
|
|
582
|
-
/* @__PURE__ */ f(v, { sx: { my: 2 } }),
|
|
583
|
-
/* @__PURE__ */ p(T, {
|
|
584
|
-
direction: "row",
|
|
585
|
-
justifyContent: "flex-end",
|
|
586
|
-
alignItems: "baseline",
|
|
587
|
-
spacing: 2,
|
|
588
|
-
children: [/* @__PURE__ */ p(k, {
|
|
589
|
-
variant: "body2",
|
|
590
|
-
color: "text.secondary",
|
|
591
|
-
children: [
|
|
592
|
-
"Total (",
|
|
593
|
-
G.items.length,
|
|
594
|
-
" ",
|
|
595
|
-
G.items.length === 1 ? "line" : "lines",
|
|
596
|
-
")"
|
|
597
|
-
]
|
|
598
|
-
}), /* @__PURE__ */ f(k, {
|
|
599
|
-
variant: "h4",
|
|
600
|
-
sx: {
|
|
601
|
-
fontWeight: 800,
|
|
602
|
-
fontVariantNumeric: "tabular-nums"
|
|
603
|
-
},
|
|
604
|
-
children: X.priced ? le(X.sum) : "—"
|
|
605
|
-
})]
|
|
606
|
-
}),
|
|
607
|
-
X.priced ? null : /* @__PURE__ */ f(k, {
|
|
608
|
-
variant: "caption",
|
|
609
|
-
color: "text.secondary",
|
|
610
|
-
sx: {
|
|
611
|
-
display: "block",
|
|
612
|
-
textAlign: "right"
|
|
613
|
-
},
|
|
614
|
-
children: "Add a Buy Price on at least one line to compute the total."
|
|
615
|
-
})
|
|
616
|
-
] }) : null
|
|
617
|
-
]
|
|
618
|
-
})
|
|
619
|
-
})
|
|
620
|
-
]
|
|
621
|
-
})
|
|
622
|
-
})] });
|
|
623
|
-
}
|
|
624
|
-
//#endregion
|
|
625
|
-
export { N as default };
|
|
626
|
-
|
|
627
|
-
//# sourceMappingURL=PurchaseCreatePage-CDfNDcKG.js.map
|