@argusoft/medplat-product-management 1.0.1 → 1.0.2
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/PickupCreatePage-CMGwoAXj.js +426 -0
- package/dist/PickupCreatePage-CMGwoAXj.js.map +1 -0
- package/dist/{PickupsPage-DCEr0LHK.js → PickupsPage-D66_Wta4.js} +144 -108
- package/dist/PickupsPage-D66_Wta4.js.map +1 -0
- package/dist/{PurchaseCreatePage-Dcsg4uoB.js → PurchaseCreatePage-CDfNDcKG.js} +138 -137
- package/dist/PurchaseCreatePage-CDfNDcKG.js.map +1 -0
- package/dist/{VialsPage-CcbY4v6H.js → VialsPage-BNPUwGCU.js} +291 -224
- package/dist/VialsPage-BNPUwGCU.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/PickupCreatePage-CE-oCXD_.js +0 -310
- package/dist/PickupCreatePage-CE-oCXD_.js.map +0 -1
- package/dist/PickupsPage-DCEr0LHK.js.map +0 -1
- package/dist/PurchaseCreatePage-Dcsg4uoB.js.map +0 -1
- package/dist/VialsPage-CcbY4v6H.js.map +0 -1
|
@@ -9,21 +9,21 @@ import { useEffect as he, useMemo as u, useState as d } from "react";
|
|
|
9
9
|
import { Fragment as ge, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
10
|
import { v4 as m } from "uuid";
|
|
11
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
|
|
13
|
-
import { showToast as
|
|
14
|
-
import { useNavigate as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
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
18
|
//#region src/views/PurchaseCreatePage.jsx
|
|
19
|
-
var
|
|
19
|
+
var j = [{
|
|
20
20
|
value: "USER",
|
|
21
21
|
label: "Personal Use"
|
|
22
22
|
}, {
|
|
23
23
|
value: "FACILITY",
|
|
24
24
|
label: "Facility Use"
|
|
25
25
|
}];
|
|
26
|
-
function
|
|
26
|
+
function M() {
|
|
27
27
|
return {
|
|
28
28
|
key: m(),
|
|
29
29
|
batchId: m(),
|
|
@@ -36,23 +36,23 @@ function N() {
|
|
|
36
36
|
storageUnitId: ""
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
let
|
|
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
41
|
id: m(),
|
|
42
|
-
ownerType:
|
|
42
|
+
ownerType: I ? "USER" : "FACILITY",
|
|
43
43
|
ownerId: "",
|
|
44
|
-
purchaseDate:
|
|
44
|
+
purchaseDate: W,
|
|
45
45
|
paymentMode: "CASH",
|
|
46
46
|
notes: "",
|
|
47
|
-
items: [
|
|
47
|
+
items: [M()]
|
|
48
48
|
});
|
|
49
49
|
he(() => {
|
|
50
|
-
!
|
|
50
|
+
!I && G.ownerType === "USER" && K((e) => ({
|
|
51
51
|
...e,
|
|
52
52
|
ownerType: "FACILITY",
|
|
53
53
|
ownerId: ""
|
|
54
54
|
}));
|
|
55
|
-
}, [
|
|
55
|
+
}, [I, G.ownerType]), n("update.manage.productManagement.purchase", () => {
|
|
56
56
|
async function n() {
|
|
57
57
|
try {
|
|
58
58
|
let [n, r, a] = await Promise.all([
|
|
@@ -60,24 +60,24 @@ function P() {
|
|
|
60
60
|
t({ activeOnly: !0 }),
|
|
61
61
|
e().catch(() => [])
|
|
62
62
|
]);
|
|
63
|
-
|
|
63
|
+
Ae(n), je(r), Me(a);
|
|
64
64
|
} catch (e) {
|
|
65
|
-
|
|
65
|
+
H(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
n();
|
|
69
69
|
}, []);
|
|
70
|
-
let
|
|
71
|
-
V,
|
|
72
|
-
K.ownerType,
|
|
73
|
-
K.ownerId
|
|
74
|
-
]), Me = u(() => K.ownerType !== "FACILITY" || !K.ownerId ? [] : B.filter((e) => e.ownerId === K.ownerId), [
|
|
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") : [], [
|
|
75
71
|
B,
|
|
76
|
-
|
|
77
|
-
|
|
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
78
|
]);
|
|
79
|
-
function
|
|
80
|
-
|
|
79
|
+
function J(e, t, n) {
|
|
80
|
+
K((r) => {
|
|
81
81
|
let i = r.items.slice();
|
|
82
82
|
return i[e] = {
|
|
83
83
|
...i[e],
|
|
@@ -88,36 +88,36 @@ function P() {
|
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
91
|
+
function Pe(e) {
|
|
92
|
+
K((t) => ({
|
|
93
93
|
...t,
|
|
94
94
|
items: t.items.filter((t, n) => n !== e)
|
|
95
95
|
}));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
97
|
+
function Y() {
|
|
98
|
+
K((e) => ({
|
|
99
99
|
...e,
|
|
100
|
-
items: [...e.items,
|
|
100
|
+
items: [...e.items, M()]
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
let X = u(() => {
|
|
104
104
|
let e = !1;
|
|
105
105
|
return {
|
|
106
|
-
sum:
|
|
106
|
+
sum: G.items.reduce((t, n) => {
|
|
107
107
|
if (n.buyPrice === "" || n.quantity === "" || n.quantity == null) return t;
|
|
108
108
|
let r = Number(n.quantity), i = Number(n.buyPrice);
|
|
109
109
|
return Number.isNaN(r) || Number.isNaN(i) ? t : (e = !0, t + r * i);
|
|
110
110
|
}, 0),
|
|
111
111
|
priced: e
|
|
112
112
|
};
|
|
113
|
-
}, [
|
|
114
|
-
ownerType: c(
|
|
115
|
-
ownerId:
|
|
116
|
-
purchaseDate: c(
|
|
117
|
-
}, Q =
|
|
118
|
-
let t =
|
|
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
119
|
if (!r && e.storageUnitId && t?.vaccineConfig) {
|
|
120
|
-
let n = t.vaccineConfig, i =
|
|
120
|
+
let n = t.vaccineConfig, i = z.find((t) => t.id === e.storageUnitId);
|
|
121
121
|
if (n.storageTempMinCelsius != null && n.storageTempMaxCelsius != null && i) {
|
|
122
122
|
let e = i.operatingTempMinCelsius, t = i.operatingTempMaxCelsius;
|
|
123
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.`);
|
|
@@ -126,30 +126,30 @@ function P() {
|
|
|
126
126
|
return {
|
|
127
127
|
productId: c(e.productId, "Product"),
|
|
128
128
|
quantity: ae(e.quantity),
|
|
129
|
-
buyPrice: s(e.buyPrice),
|
|
130
|
-
expiryDate:
|
|
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
131
|
manufactureDate: oe(e.manufactureDate, { label: "Manufacture date" }),
|
|
132
132
|
storageUnitId: r
|
|
133
133
|
};
|
|
134
|
-
}), $ = l(Z) && Q.every(l) &&
|
|
134
|
+
}), $ = l(Z) && Q.every(l) && G.items.length > 0;
|
|
135
135
|
async function Fe() {
|
|
136
136
|
if (!$) {
|
|
137
|
-
|
|
137
|
+
U.markAllTouched(), H("Please fix the highlighted fields and try again.");
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
let e = {
|
|
141
|
-
id:
|
|
142
|
-
ownerType:
|
|
143
|
-
ownerId:
|
|
144
|
-
purchaseDate:
|
|
145
|
-
paymentMode:
|
|
146
|
-
totalAmount:
|
|
147
|
-
notes:
|
|
148
|
-
items:
|
|
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
149
|
batchId: e.batchId,
|
|
150
150
|
productId: e.productId,
|
|
151
151
|
quantity: Number(e.quantity),
|
|
152
|
-
buyPrice:
|
|
152
|
+
buyPrice: F && e.buyPrice !== "" ? Number(e.buyPrice) : null,
|
|
153
153
|
expiryDate: e.expiryDate || null,
|
|
154
154
|
lotNumber: e.lotNumber || null,
|
|
155
155
|
manufactureDate: e.manufactureDate || null,
|
|
@@ -157,46 +157,46 @@ function P() {
|
|
|
157
157
|
}))
|
|
158
158
|
};
|
|
159
159
|
try {
|
|
160
|
-
if (
|
|
160
|
+
if (L) {
|
|
161
161
|
let t = await r(e);
|
|
162
|
-
|
|
162
|
+
A({
|
|
163
163
|
message: "Purchase request submitted for approval.",
|
|
164
164
|
type: "success"
|
|
165
|
-
}),
|
|
166
|
-
} else await re(e),
|
|
165
|
+
}), N(`/ui/medplat/manage/pm/purchase-requests/${t?.id ?? G.id}`);
|
|
166
|
+
} else await re(e), A({
|
|
167
167
|
message: "Purchase recorded.",
|
|
168
168
|
type: "success"
|
|
169
|
-
}),
|
|
169
|
+
}), N("/ui/medplat/manage/pm/purchases");
|
|
170
170
|
} catch (e) {
|
|
171
|
-
|
|
171
|
+
H(e?.response?.data?.message ?? e?.message ?? (L ? "Failed to submit purchase request" : "Failed to record purchase"));
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
return /* @__PURE__ */ p(ve, { children: [/* @__PURE__ */ f(ne, {}), /* @__PURE__ */ f(ee, {
|
|
175
175
|
perm: "update.manage.productManagement.purchase",
|
|
176
|
-
title:
|
|
176
|
+
title: L ? "You don’t have permission to submit purchase requests" : "You don’t have permission to record purchases",
|
|
177
177
|
children: /* @__PURE__ */ p(te, {
|
|
178
|
-
title:
|
|
179
|
-
subtitle:
|
|
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
180
|
actions: /* @__PURE__ */ p(T, {
|
|
181
181
|
direction: "row",
|
|
182
182
|
spacing: 1,
|
|
183
183
|
children: [/* @__PURE__ */ f(h, {
|
|
184
184
|
variant: "outlined",
|
|
185
|
-
onClick: () =>
|
|
185
|
+
onClick: () => N(L ? "/ui/medplat/manage/pm/purchase-requests" : "/ui/medplat/manage/pm/purchases"),
|
|
186
186
|
children: "Cancel"
|
|
187
187
|
}), /* @__PURE__ */ f(h, {
|
|
188
188
|
variant: "contained",
|
|
189
|
-
startIcon: /* @__PURE__ */ f(
|
|
189
|
+
startIcon: /* @__PURE__ */ f(De, {}),
|
|
190
190
|
disabled: !$,
|
|
191
191
|
onClick: () => void Fe(),
|
|
192
|
-
children:
|
|
192
|
+
children: L ? "Submit Request" : "Save"
|
|
193
193
|
})]
|
|
194
194
|
}),
|
|
195
195
|
children: [
|
|
196
|
-
|
|
196
|
+
V ? /* @__PURE__ */ f(_e, {
|
|
197
197
|
severity: "error",
|
|
198
198
|
sx: { mb: 2 },
|
|
199
|
-
children:
|
|
199
|
+
children: V
|
|
200
200
|
}) : null,
|
|
201
201
|
/* @__PURE__ */ f(g, {
|
|
202
202
|
sx: {
|
|
@@ -224,46 +224,46 @@ function P() {
|
|
|
224
224
|
required: !0,
|
|
225
225
|
fullWidth: !0,
|
|
226
226
|
size: "small",
|
|
227
|
-
error:
|
|
227
|
+
error: U.show("ownerType") && !!Z.ownerType,
|
|
228
228
|
children: [
|
|
229
229
|
/* @__PURE__ */ f(S, { children: "Purchase Type" }),
|
|
230
230
|
/* @__PURE__ */ f(w, {
|
|
231
231
|
label: "Purchase Type",
|
|
232
|
-
value:
|
|
233
|
-
onChange: (e) =>
|
|
234
|
-
...
|
|
232
|
+
value: G.ownerType,
|
|
233
|
+
onChange: (e) => K({
|
|
234
|
+
...G,
|
|
235
235
|
ownerType: e.target.value,
|
|
236
236
|
ownerId: ""
|
|
237
237
|
}),
|
|
238
|
-
onBlur:
|
|
239
|
-
children:
|
|
238
|
+
onBlur: U.onBlur("ownerType"),
|
|
239
|
+
children: ke.map((e) => /* @__PURE__ */ f(C, {
|
|
240
240
|
value: e.value,
|
|
241
241
|
children: e.label
|
|
242
242
|
}, e.value))
|
|
243
243
|
}),
|
|
244
|
-
/* @__PURE__ */ f(b, { children:
|
|
244
|
+
/* @__PURE__ */ f(b, { children: U.show("ownerType") && Z.ownerType ? Z.ownerType : "Personal stock vs. facility stock" })
|
|
245
245
|
]
|
|
246
246
|
})
|
|
247
|
-
}),
|
|
247
|
+
}), G.ownerType === "FACILITY" ? /* @__PURE__ */ f(x, {
|
|
248
248
|
item: !0,
|
|
249
249
|
xs: 12,
|
|
250
250
|
md: 4,
|
|
251
251
|
children: /* @__PURE__ */ f(me, {
|
|
252
252
|
required: !0,
|
|
253
|
-
value:
|
|
254
|
-
onChange: (e) =>
|
|
255
|
-
...
|
|
253
|
+
value: G.ownerId,
|
|
254
|
+
onChange: (e) => K({
|
|
255
|
+
...G,
|
|
256
256
|
ownerId: e
|
|
257
257
|
}),
|
|
258
|
-
onBlur:
|
|
259
|
-
error:
|
|
260
|
-
helperText:
|
|
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
261
|
})
|
|
262
262
|
}) : null]
|
|
263
263
|
})]
|
|
264
264
|
})
|
|
265
265
|
}),
|
|
266
|
-
|
|
266
|
+
G.ownerType === "USER" || G.ownerType === "FACILITY" && G.ownerId ? /* @__PURE__ */ f(g, {
|
|
267
267
|
sx: {
|
|
268
268
|
borderRadius: 4,
|
|
269
269
|
mb: 2,
|
|
@@ -276,9 +276,9 @@ function P() {
|
|
|
276
276
|
children: [/* @__PURE__ */ f(o, {
|
|
277
277
|
eyebrow: "Context",
|
|
278
278
|
title: "Existing inventory",
|
|
279
|
-
hint:
|
|
279
|
+
hint: G.ownerType === "USER" ? "Your current stock." : "What this facility already has, including where it is stored.",
|
|
280
280
|
sx: { mb: 1.5 }
|
|
281
|
-
}),
|
|
281
|
+
}), q.length === 0 ? /* @__PURE__ */ p(T, {
|
|
282
282
|
direction: "row",
|
|
283
283
|
spacing: 1.25,
|
|
284
284
|
alignItems: "center",
|
|
@@ -286,7 +286,7 @@ function P() {
|
|
|
286
286
|
py: 1.5,
|
|
287
287
|
color: "text.secondary"
|
|
288
288
|
},
|
|
289
|
-
children: [/* @__PURE__ */ f(
|
|
289
|
+
children: [/* @__PURE__ */ f(Ee, { fontSize: "small" }), /* @__PURE__ */ f(k, {
|
|
290
290
|
variant: "body2",
|
|
291
291
|
children: "No active stock yet for this owner."
|
|
292
292
|
})]
|
|
@@ -300,9 +300,9 @@ function P() {
|
|
|
300
300
|
children: "Remaining"
|
|
301
301
|
}),
|
|
302
302
|
/* @__PURE__ */ f(E, { children: "Expiry" }),
|
|
303
|
-
|
|
303
|
+
G.ownerType === "FACILITY" ? /* @__PURE__ */ f(E, { children: "Storage" }) : null,
|
|
304
304
|
/* @__PURE__ */ f(E, { children: "Status" })
|
|
305
|
-
] }) }), /* @__PURE__ */ f(Se, { children:
|
|
305
|
+
] }) }), /* @__PURE__ */ f(Se, { children: q.map((e) => /* @__PURE__ */ p(D, { children: [
|
|
306
306
|
/* @__PURE__ */ f(E, {
|
|
307
307
|
sx: { fontWeight: 700 },
|
|
308
308
|
children: e.productName
|
|
@@ -323,7 +323,7 @@ function P() {
|
|
|
323
323
|
children: e.qtyRemaining
|
|
324
324
|
}),
|
|
325
325
|
/* @__PURE__ */ f(E, { children: e.expiryDate ? ue(e.expiryDate) : "—" }),
|
|
326
|
-
|
|
326
|
+
G.ownerType === "FACILITY" ? /* @__PURE__ */ f(E, { children: e.storageUnitName || "—" }) : null,
|
|
327
327
|
/* @__PURE__ */ f(E, { children: /* @__PURE__ */ f(ye, {
|
|
328
328
|
size: "small",
|
|
329
329
|
label: fe(pe, e.status),
|
|
@@ -355,16 +355,16 @@ function P() {
|
|
|
355
355
|
hint: "Each item creates one batch in your inventory and a receipt record."
|
|
356
356
|
}), /* @__PURE__ */ f(h, {
|
|
357
357
|
variant: "outlined",
|
|
358
|
-
startIcon: /* @__PURE__ */ f(
|
|
359
|
-
onClick:
|
|
358
|
+
startIcon: /* @__PURE__ */ f(we, {}),
|
|
359
|
+
onClick: Y,
|
|
360
360
|
children: "Add Line"
|
|
361
361
|
})]
|
|
362
362
|
}),
|
|
363
363
|
/* @__PURE__ */ f(v, { sx: { mb: 2 } }),
|
|
364
364
|
/* @__PURE__ */ f(T, {
|
|
365
365
|
spacing: 2,
|
|
366
|
-
children:
|
|
367
|
-
let n = Q[t] || {}, r =
|
|
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
368
|
return /* @__PURE__ */ f(g, {
|
|
369
369
|
variant: "outlined",
|
|
370
370
|
sx: {
|
|
@@ -383,20 +383,20 @@ function P() {
|
|
|
383
383
|
required: !0,
|
|
384
384
|
fullWidth: !0,
|
|
385
385
|
size: "small",
|
|
386
|
-
error:
|
|
386
|
+
error: U.show(`items.${t}.productId`) && !!n.productId,
|
|
387
387
|
children: [
|
|
388
388
|
/* @__PURE__ */ f(S, { children: "Product" }),
|
|
389
389
|
/* @__PURE__ */ f(w, {
|
|
390
390
|
label: "Product",
|
|
391
391
|
value: e.productId,
|
|
392
|
-
onChange: (e) =>
|
|
393
|
-
onBlur:
|
|
394
|
-
children:
|
|
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
395
|
value: e.id,
|
|
396
396
|
children: e.name
|
|
397
397
|
}, e.id))
|
|
398
398
|
}),
|
|
399
|
-
|
|
399
|
+
U.show(`items.${t}.productId`) && n.productId ? /* @__PURE__ */ f(b, { children: n.productId }) : null
|
|
400
400
|
]
|
|
401
401
|
})
|
|
402
402
|
}),
|
|
@@ -412,17 +412,18 @@ function P() {
|
|
|
412
412
|
label: "Qty",
|
|
413
413
|
inputProps: { min: 1 },
|
|
414
414
|
value: e.quantity,
|
|
415
|
-
onChange: (e) =>
|
|
416
|
-
onBlur:
|
|
417
|
-
error:
|
|
418
|
-
helperText:
|
|
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
419
|
})
|
|
420
420
|
}),
|
|
421
|
-
|
|
421
|
+
F ? /* @__PURE__ */ f(x, {
|
|
422
422
|
item: !0,
|
|
423
423
|
xs: 6,
|
|
424
424
|
md: 2,
|
|
425
425
|
children: /* @__PURE__ */ f(O, {
|
|
426
|
+
required: !0,
|
|
426
427
|
fullWidth: !0,
|
|
427
428
|
size: "small",
|
|
428
429
|
type: "number",
|
|
@@ -432,13 +433,13 @@ function P() {
|
|
|
432
433
|
},
|
|
433
434
|
label: "Buy Price",
|
|
434
435
|
value: e.buyPrice,
|
|
435
|
-
onChange: (e) =>
|
|
436
|
-
onBlur:
|
|
437
|
-
error:
|
|
438
|
-
helperText:
|
|
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 : ""
|
|
439
440
|
})
|
|
440
441
|
}) : null,
|
|
441
|
-
|
|
442
|
+
L ? null : /* @__PURE__ */ f(x, {
|
|
442
443
|
item: !0,
|
|
443
444
|
xs: 6,
|
|
444
445
|
md: 2,
|
|
@@ -449,15 +450,15 @@ function P() {
|
|
|
449
450
|
type: "date",
|
|
450
451
|
label: "Expiry",
|
|
451
452
|
InputLabelProps: { shrink: !0 },
|
|
452
|
-
inputProps: { min:
|
|
453
|
+
inputProps: { min: W },
|
|
453
454
|
value: e.expiryDate,
|
|
454
|
-
onChange: (e) =>
|
|
455
|
-
onBlur:
|
|
456
|
-
error:
|
|
457
|
-
helperText:
|
|
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" : ""
|
|
458
459
|
})
|
|
459
460
|
}),
|
|
460
|
-
|
|
461
|
+
L ? null : /* @__PURE__ */ f(x, {
|
|
461
462
|
item: !0,
|
|
462
463
|
xs: 6,
|
|
463
464
|
md: 2,
|
|
@@ -466,7 +467,7 @@ function P() {
|
|
|
466
467
|
size: "small",
|
|
467
468
|
label: "Lot #",
|
|
468
469
|
value: e.lotNumber,
|
|
469
|
-
onChange: (e) =>
|
|
470
|
+
onChange: (e) => J(t, "lotNumber", e.target.value)
|
|
470
471
|
})
|
|
471
472
|
}),
|
|
472
473
|
/* @__PURE__ */ f(x, {
|
|
@@ -477,24 +478,24 @@ function P() {
|
|
|
477
478
|
fullWidth: !0,
|
|
478
479
|
size: "small",
|
|
479
480
|
required: a,
|
|
480
|
-
disabled:
|
|
481
|
-
error:
|
|
481
|
+
disabled: G.ownerType !== "FACILITY" || !G.ownerId,
|
|
482
|
+
error: U.show(`items.${t}.storageUnitId`) && !!n.storageUnitId,
|
|
482
483
|
children: [
|
|
483
484
|
/* @__PURE__ */ f(S, { children: "Storage" }),
|
|
484
485
|
/* @__PURE__ */ p(w, {
|
|
485
486
|
label: "Storage",
|
|
486
487
|
value: e.storageUnitId || "",
|
|
487
|
-
onChange: (e) =>
|
|
488
|
-
onBlur:
|
|
488
|
+
onChange: (e) => J(t, "storageUnitId", e.target.value),
|
|
489
|
+
onBlur: U.onBlur(`items.${t}.storageUnitId`),
|
|
489
490
|
children: [/* @__PURE__ */ f(C, {
|
|
490
491
|
value: "",
|
|
491
492
|
children: /* @__PURE__ */ f("em", { children: "—" })
|
|
492
|
-
}),
|
|
493
|
+
}), Ne.map((e) => /* @__PURE__ */ f(C, {
|
|
493
494
|
value: e.id,
|
|
494
495
|
children: e.unitName
|
|
495
496
|
}, e.id))]
|
|
496
497
|
}),
|
|
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
|
|
498
499
|
]
|
|
499
500
|
})
|
|
500
501
|
}),
|
|
@@ -505,9 +506,9 @@ function P() {
|
|
|
505
506
|
sx: { textAlign: "right" },
|
|
506
507
|
children: /* @__PURE__ */ f(be, {
|
|
507
508
|
color: "error",
|
|
508
|
-
onClick: () =>
|
|
509
|
-
disabled:
|
|
510
|
-
children: /* @__PURE__ */ f(
|
|
509
|
+
onClick: () => Pe(t),
|
|
510
|
+
disabled: G.items.length === 1,
|
|
511
|
+
children: /* @__PURE__ */ f(Oe, {})
|
|
511
512
|
})
|
|
512
513
|
})
|
|
513
514
|
]
|
|
@@ -531,14 +532,14 @@ function P() {
|
|
|
531
532
|
children: [
|
|
532
533
|
/* @__PURE__ */ f(o, {
|
|
533
534
|
eyebrow: "Step 3",
|
|
534
|
-
title:
|
|
535
|
-
hint:
|
|
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.",
|
|
536
537
|
sx: { mb: 2 }
|
|
537
538
|
}),
|
|
538
539
|
/* @__PURE__ */ p(x, {
|
|
539
540
|
container: !0,
|
|
540
541
|
spacing: 2,
|
|
541
|
-
children: [
|
|
542
|
+
children: [F ? /* @__PURE__ */ f(x, {
|
|
542
543
|
item: !0,
|
|
543
544
|
xs: 12,
|
|
544
545
|
md: 6,
|
|
@@ -547,9 +548,9 @@ function P() {
|
|
|
547
548
|
size: "small",
|
|
548
549
|
children: [/* @__PURE__ */ f(S, { children: "Payment Mode" }), /* @__PURE__ */ p(w, {
|
|
549
550
|
label: "Payment Mode",
|
|
550
|
-
value:
|
|
551
|
-
onChange: (e) =>
|
|
552
|
-
...
|
|
551
|
+
value: G.paymentMode || "",
|
|
552
|
+
onChange: (e) => K({
|
|
553
|
+
...G,
|
|
553
554
|
paymentMode: e.target.value
|
|
554
555
|
}),
|
|
555
556
|
children: [/* @__PURE__ */ f(C, {
|
|
@@ -564,20 +565,20 @@ function P() {
|
|
|
564
565
|
}) : null, /* @__PURE__ */ f(x, {
|
|
565
566
|
item: !0,
|
|
566
567
|
xs: 12,
|
|
567
|
-
md:
|
|
568
|
+
md: F ? 6 : 12,
|
|
568
569
|
children: /* @__PURE__ */ f(O, {
|
|
569
570
|
fullWidth: !0,
|
|
570
571
|
size: "small",
|
|
571
572
|
label: "Notes",
|
|
572
|
-
value:
|
|
573
|
-
onChange: (e) =>
|
|
574
|
-
...
|
|
573
|
+
value: G.notes,
|
|
574
|
+
onChange: (e) => K({
|
|
575
|
+
...G,
|
|
575
576
|
notes: e.target.value
|
|
576
577
|
})
|
|
577
578
|
})
|
|
578
579
|
})]
|
|
579
580
|
}),
|
|
580
|
-
|
|
581
|
+
F ? /* @__PURE__ */ p(ge, { children: [
|
|
581
582
|
/* @__PURE__ */ f(v, { sx: { my: 2 } }),
|
|
582
583
|
/* @__PURE__ */ p(T, {
|
|
583
584
|
direction: "row",
|
|
@@ -589,9 +590,9 @@ function P() {
|
|
|
589
590
|
color: "text.secondary",
|
|
590
591
|
children: [
|
|
591
592
|
"Total (",
|
|
592
|
-
|
|
593
|
+
G.items.length,
|
|
593
594
|
" ",
|
|
594
|
-
|
|
595
|
+
G.items.length === 1 ? "line" : "lines",
|
|
595
596
|
")"
|
|
596
597
|
]
|
|
597
598
|
}), /* @__PURE__ */ f(k, {
|
|
@@ -621,6 +622,6 @@ function P() {
|
|
|
621
622
|
})] });
|
|
622
623
|
}
|
|
623
624
|
//#endregion
|
|
624
|
-
export {
|
|
625
|
+
export { N as default };
|
|
625
626
|
|
|
626
|
-
//# sourceMappingURL=PurchaseCreatePage-
|
|
627
|
+
//# sourceMappingURL=PurchaseCreatePage-CDfNDcKG.js.map
|