@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
package/dist/{PurchaseRequestDetailPage-C7aAwEqw.js → PurchaseRequestDetailPage-CNAqIFef.js}
RENAMED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { n as s, t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import le from "@mui/
|
|
8
|
-
import { showToast as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import pe from "
|
|
12
|
-
import me from "@mui/icons-material/
|
|
13
|
-
import he from "@mui/icons-material/
|
|
14
|
-
import ge from "@mui/icons-material/
|
|
1
|
+
import { C as e, a as t, f as n, r } from "./settingsStore-KW217unV.js";
|
|
2
|
+
import { a as i, i as a, r as o } from "./PmTable-BkK65bJQ.js";
|
|
3
|
+
import { n as s, t as ee } from "./format-UOyOu75i.js";
|
|
4
|
+
import { a as te, i as ne, n as re, r as ie, t as ae } from "./PmGuard-C90yhpsN.js";
|
|
5
|
+
import { useMemo as c, useState as l } from "react";
|
|
6
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
|
+
import { Alert as p, Box as m, Button as h, Card as g, CardContent as _, Chip as oe, Divider as v, Stack as y, Table as se, TableBody as ce, TableCell as b, TableHead as le, TableRow as x, TextField as S, Typography as C } from "@mui/material";
|
|
8
|
+
import { showToast as w } from "@/common/toaster/toaster";
|
|
9
|
+
import { alpha as ue } from "@mui/material/styles";
|
|
10
|
+
import de from "@mui/icons-material/RefreshRounded";
|
|
11
|
+
import { useNavigate as fe, useParams as pe } from "react-router-dom";
|
|
12
|
+
import me from "@mui/icons-material/ArrowBackRounded";
|
|
13
|
+
import he from "@mui/icons-material/CheckCircleRounded";
|
|
14
|
+
import ge from "@mui/icons-material/CancelRounded";
|
|
15
|
+
import _e from "@mui/icons-material/DoNotDisturbRounded";
|
|
15
16
|
//#region src/views/PurchaseRequestDetailPage.jsx
|
|
16
|
-
function
|
|
17
|
+
function ve(e) {
|
|
17
18
|
switch (e) {
|
|
18
19
|
case "PENDING": return "info";
|
|
19
20
|
case "APPROVED": return "success";
|
|
@@ -23,78 +24,78 @@ function _e(e) {
|
|
|
23
24
|
default: return "default";
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function T(e) {
|
|
27
28
|
return e ? e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ") : "";
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
let
|
|
31
|
-
async function
|
|
32
|
-
|
|
30
|
+
function E() {
|
|
31
|
+
let E = fe(), { requestId: O } = pe(), k = ne().has("approve.manage.productManagement.purchase"), A = r()?.managePurchaseAmounts !== !1, [j, M] = l(null), [ye, N] = l(!0), [P, F] = l(!1), [I, L] = l(""), [R, z] = l({}), [B, V] = l({}), [H, U] = l({}), [W, G] = l("");
|
|
32
|
+
async function K() {
|
|
33
|
+
N(!0), L("");
|
|
33
34
|
try {
|
|
34
|
-
let t = await e(
|
|
35
|
-
|
|
35
|
+
let t = await e(O);
|
|
36
|
+
M(t);
|
|
36
37
|
let n = {}, r = {}, i = {};
|
|
37
38
|
(t?.items ?? []).forEach((e) => {
|
|
38
39
|
n[e.id] = String(e.approvedQuantity == null ? e.requestedQuantity : e.approvedQuantity), r[e.id] = e.lotNumber ?? "", i[e.id] = e.expiryDate ? new Date(e.expiryDate).toISOString().substring(0, 10) : "";
|
|
39
|
-
}),
|
|
40
|
+
}), z(n), V(r), U(i), G(t?.decisionNotes ?? "");
|
|
40
41
|
} catch (e) {
|
|
41
|
-
|
|
42
|
+
L(e?.response?.data?.message ?? e?.message ?? "Failed to load purchase request");
|
|
42
43
|
} finally {
|
|
43
|
-
|
|
44
|
+
N(!1);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
let
|
|
50
|
-
if (!
|
|
47
|
+
ie(["view.manage.productManagement.purchase", "approve.manage.productManagement.purchase"], () => {
|
|
48
|
+
K();
|
|
49
|
+
}, [O]);
|
|
50
|
+
let q = j?.status === "PENDING", J = c(() => {
|
|
51
|
+
if (!j || !A) return null;
|
|
51
52
|
let e = 0, t = !1;
|
|
52
|
-
return (
|
|
53
|
-
let r = Number(
|
|
53
|
+
return (j.items ?? []).forEach((n) => {
|
|
54
|
+
let r = Number(R[n.id] ?? 0);
|
|
54
55
|
!Number.isFinite(r) || r <= 0 || n.buyPrice != null && (e += Number(n.buyPrice) * r, t = !0);
|
|
55
56
|
}), t ? e : null;
|
|
56
57
|
}, [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
j,
|
|
59
|
+
R,
|
|
60
|
+
A
|
|
60
61
|
]);
|
|
61
|
-
function
|
|
62
|
-
|
|
62
|
+
function be(e, t) {
|
|
63
|
+
z((n) => ({
|
|
63
64
|
...n,
|
|
64
65
|
[e]: t
|
|
65
66
|
}));
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
68
|
+
function xe(e, t) {
|
|
69
|
+
V((n) => ({
|
|
69
70
|
...n,
|
|
70
71
|
[e]: t
|
|
71
72
|
}));
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
74
|
+
function Se(e, t) {
|
|
75
|
+
U((n) => ({
|
|
75
76
|
...n,
|
|
76
77
|
[e]: t
|
|
77
78
|
}));
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
if (!
|
|
80
|
+
function Ce() {
|
|
81
|
+
if (!j) return;
|
|
81
82
|
let e = {};
|
|
82
|
-
|
|
83
|
+
j.items.forEach((t) => {
|
|
83
84
|
e[t.id] = String(t.requestedQuantity);
|
|
84
|
-
}),
|
|
85
|
+
}), z(e);
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
if (!
|
|
87
|
+
function Y() {
|
|
88
|
+
if (!j) return;
|
|
88
89
|
let e = {};
|
|
89
|
-
|
|
90
|
+
j.items.forEach((t) => {
|
|
90
91
|
e[t.id] = "0";
|
|
91
|
-
}),
|
|
92
|
+
}), z(e);
|
|
92
93
|
}
|
|
93
|
-
let
|
|
94
|
-
if (!
|
|
94
|
+
let X = c(() => {
|
|
95
|
+
if (!j) return {};
|
|
95
96
|
let e = {};
|
|
96
|
-
return (
|
|
97
|
-
let n =
|
|
97
|
+
return (j.items ?? []).forEach((t) => {
|
|
98
|
+
let n = R[t.id];
|
|
98
99
|
if (n == null || n === "") {
|
|
99
100
|
e[t.id] = "Required";
|
|
100
101
|
return;
|
|
@@ -102,183 +103,183 @@ function D() {
|
|
|
102
103
|
let r = Number(n);
|
|
103
104
|
!Number.isInteger(r) || r < 0 ? e[t.id] = "Must be 0 or a positive whole number" : r > t.requestedQuantity && (e[t.id] = `At most ${t.requestedQuantity}`);
|
|
104
105
|
}), e;
|
|
105
|
-
}, [
|
|
106
|
-
if (!
|
|
106
|
+
}, [j, R]), Z = c(() => {
|
|
107
|
+
if (!j) return {};
|
|
107
108
|
let e = {};
|
|
108
|
-
return (
|
|
109
|
-
let n = Number(
|
|
110
|
-
!Number.isFinite(n) || n <= 0 || (
|
|
109
|
+
return (j.items ?? []).forEach((t) => {
|
|
110
|
+
let n = Number(R[t.id] ?? 0);
|
|
111
|
+
!Number.isFinite(n) || n <= 0 || (B[t.id] ?? "").trim() || (e[t.id] = "Lot is required when approving this line");
|
|
111
112
|
}), e;
|
|
112
113
|
}, [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
]),
|
|
117
|
-
if (!
|
|
114
|
+
j,
|
|
115
|
+
R,
|
|
116
|
+
B
|
|
117
|
+
]), Q = c(() => {
|
|
118
|
+
if (!j) return {};
|
|
118
119
|
let e = {}, t = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
|
|
119
|
-
return (
|
|
120
|
-
let r = Number(
|
|
120
|
+
return (j.items ?? []).forEach((n) => {
|
|
121
|
+
let r = Number(R[n.id] ?? 0);
|
|
121
122
|
if (!Number.isFinite(r) || r <= 0) return;
|
|
122
|
-
let i = (
|
|
123
|
+
let i = (H[n.id] ?? "").trim();
|
|
123
124
|
i ? i < t && (e[n.id] = "Expiry must be today or later") : e[n.id] = "Expiry is required when approving this line";
|
|
124
125
|
}), e;
|
|
125
126
|
}, [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
]), we = Object.keys(
|
|
127
|
+
j,
|
|
128
|
+
R,
|
|
129
|
+
H
|
|
130
|
+
]), we = Object.keys(X).length === 0 && Object.keys(Z).length === 0 && Object.keys(Q).length === 0;
|
|
130
131
|
async function Te() {
|
|
131
|
-
if (!(!we || !
|
|
132
|
-
|
|
132
|
+
if (!(!we || !j)) {
|
|
133
|
+
F(!0), L("");
|
|
133
134
|
try {
|
|
134
|
-
let e = await
|
|
135
|
-
decisionNotes:
|
|
136
|
-
items:
|
|
137
|
-
let t = (
|
|
135
|
+
let e = await n(j.id, {
|
|
136
|
+
decisionNotes: W || null,
|
|
137
|
+
items: j.items.map((e) => {
|
|
138
|
+
let t = (B[e.id] ?? "").trim(), n = (H[e.id] ?? "").trim();
|
|
138
139
|
return {
|
|
139
140
|
itemId: e.id,
|
|
140
|
-
approvedQuantity: Number(
|
|
141
|
+
approvedQuantity: Number(R[e.id]),
|
|
141
142
|
lotNumber: t || null,
|
|
142
143
|
expiryDate: n || null
|
|
143
144
|
};
|
|
144
145
|
})
|
|
145
146
|
});
|
|
146
|
-
|
|
147
|
-
message: `Request ${
|
|
147
|
+
M(e), w({
|
|
148
|
+
message: `Request ${T(e.status).toLowerCase()}.`,
|
|
148
149
|
type: "success"
|
|
149
150
|
});
|
|
150
151
|
} catch (e) {
|
|
151
|
-
|
|
152
|
+
L(e?.response?.data?.message ?? e?.message ?? "Failed to submit decision");
|
|
152
153
|
} finally {
|
|
153
|
-
|
|
154
|
+
F(!1);
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
async function Ee() {
|
|
158
|
-
if (
|
|
159
|
-
|
|
159
|
+
if (j) {
|
|
160
|
+
F(!0), L("");
|
|
160
161
|
try {
|
|
161
|
-
|
|
162
|
+
M(await t(j.id)), w({
|
|
162
163
|
message: "Request cancelled.",
|
|
163
164
|
type: "success"
|
|
164
165
|
});
|
|
165
166
|
} catch (e) {
|
|
166
|
-
|
|
167
|
+
L(e?.response?.data?.message ?? e?.message ?? "Failed to cancel request");
|
|
167
168
|
} finally {
|
|
168
|
-
|
|
169
|
+
F(!1);
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
|
-
let $ =
|
|
173
|
-
return /* @__PURE__ */
|
|
173
|
+
let $ = q && k;
|
|
174
|
+
return /* @__PURE__ */ f(m, { children: [/* @__PURE__ */ d(re, {}), /* @__PURE__ */ d(ae, {
|
|
174
175
|
anyOf: ["view.manage.productManagement.purchase", "approve.manage.productManagement.purchase"],
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
-
title:
|
|
176
|
+
children: /* @__PURE__ */ f(te, {
|
|
177
|
+
title: j?.serialId ? `Purchase Request #${j.serialId}` : "Purchase Request",
|
|
177
178
|
subtitle: "Approve or reject each item. Your decision closes the entire request.",
|
|
178
|
-
chips:
|
|
179
|
-
actions: /* @__PURE__ */
|
|
179
|
+
chips: j?.status ? [T(j.status)] : [],
|
|
180
|
+
actions: /* @__PURE__ */ f(y, {
|
|
180
181
|
direction: "row",
|
|
181
182
|
spacing: 1,
|
|
182
|
-
children: [/* @__PURE__ */
|
|
183
|
+
children: [/* @__PURE__ */ d(h, {
|
|
183
184
|
variant: "outlined",
|
|
184
|
-
startIcon: /* @__PURE__ */
|
|
185
|
-
onClick: () =>
|
|
185
|
+
startIcon: /* @__PURE__ */ d(me, {}),
|
|
186
|
+
onClick: () => E("/ui/medplat/manage/pm/purchase-requests"),
|
|
186
187
|
children: "Back"
|
|
187
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ d(h, {
|
|
188
189
|
variant: "outlined",
|
|
189
|
-
startIcon: /* @__PURE__ */
|
|
190
|
-
onClick: () => void
|
|
190
|
+
startIcon: /* @__PURE__ */ d(de, {}),
|
|
191
|
+
onClick: () => void K(),
|
|
191
192
|
children: "Refresh"
|
|
192
193
|
})]
|
|
193
194
|
}),
|
|
194
|
-
children: [
|
|
195
|
+
children: [I ? /* @__PURE__ */ d(p, {
|
|
195
196
|
severity: "error",
|
|
196
197
|
sx: { mb: 2 },
|
|
197
|
-
children:
|
|
198
|
-
}) : null, !
|
|
198
|
+
children: I
|
|
199
|
+
}) : null, !ye && j ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(g, {
|
|
199
200
|
sx: {
|
|
200
|
-
borderRadius:
|
|
201
|
+
borderRadius: 1.5,
|
|
201
202
|
mb: 2,
|
|
202
203
|
border: "1px solid",
|
|
203
204
|
borderColor: "divider",
|
|
204
205
|
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
205
206
|
},
|
|
206
|
-
children: /* @__PURE__ */
|
|
207
|
+
children: /* @__PURE__ */ f(_, {
|
|
207
208
|
sx: { p: 2.5 },
|
|
208
209
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ f(y, {
|
|
210
211
|
direction: {
|
|
211
212
|
xs: "column",
|
|
212
213
|
md: "row"
|
|
213
214
|
},
|
|
214
215
|
spacing: 2,
|
|
215
216
|
alignItems: { md: "flex-start" },
|
|
216
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ f(m, {
|
|
217
218
|
sx: {
|
|
218
219
|
flexGrow: 1,
|
|
219
220
|
minWidth: 0
|
|
220
221
|
},
|
|
221
222
|
children: [
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ f(y, {
|
|
223
224
|
direction: "row",
|
|
224
225
|
alignItems: "center",
|
|
225
226
|
spacing: 1.5,
|
|
226
227
|
sx: { mb: .5 },
|
|
227
228
|
children: [
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ d(i, { id: j.serialId }),
|
|
230
|
+
/* @__PURE__ */ d(oe, {
|
|
230
231
|
size: "small",
|
|
231
|
-
label:
|
|
232
|
-
color:
|
|
232
|
+
label: T(j.status),
|
|
233
|
+
color: ve(j.status)
|
|
233
234
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ d(C, {
|
|
235
236
|
variant: "caption",
|
|
236
237
|
color: "text.secondary",
|
|
237
|
-
children:
|
|
238
|
+
children: j.ownerType
|
|
238
239
|
})
|
|
239
240
|
]
|
|
240
241
|
}),
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ d(C, {
|
|
242
243
|
variant: "h6",
|
|
243
244
|
sx: { fontWeight: 800 },
|
|
244
|
-
children:
|
|
245
|
+
children: j.ownerName || (j.ownerType === "USER" ? "Personal" : "Facility")
|
|
245
246
|
}),
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ f(C, {
|
|
247
248
|
variant: "caption",
|
|
248
249
|
color: "text.secondary",
|
|
249
250
|
sx: { display: "block" },
|
|
250
|
-
children: ["For purchase date ",
|
|
251
|
+
children: ["For purchase date ", ee(j.purchaseDate)]
|
|
251
252
|
})
|
|
252
253
|
]
|
|
253
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ f(y, {
|
|
254
255
|
spacing: .25,
|
|
255
256
|
sx: { minWidth: 260 },
|
|
256
257
|
children: [
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ d(D, {
|
|
258
259
|
label: "Requested by",
|
|
259
|
-
children:
|
|
260
|
+
children: j.requestedByName || `#${j.requestedBy}`
|
|
260
261
|
}),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ d(D, {
|
|
262
263
|
label: "Requested on",
|
|
263
|
-
children: s(
|
|
264
|
+
children: s(j.requestedOn)
|
|
264
265
|
}),
|
|
265
|
-
|
|
266
|
+
j.decidedBy ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(D, {
|
|
266
267
|
label: "Decided by",
|
|
267
|
-
children:
|
|
268
|
-
}), /* @__PURE__ */
|
|
268
|
+
children: j.decidedByName || `#${j.decidedBy}`
|
|
269
|
+
}), /* @__PURE__ */ d(D, {
|
|
269
270
|
label: "Decided on",
|
|
270
|
-
children: s(
|
|
271
|
+
children: s(j.decidedOn)
|
|
271
272
|
})] }) : null,
|
|
272
|
-
|
|
273
|
+
j.paymentMode ? /* @__PURE__ */ d(D, {
|
|
273
274
|
label: "Payment",
|
|
274
|
-
children:
|
|
275
|
+
children: j.paymentMode
|
|
275
276
|
}) : null
|
|
276
277
|
]
|
|
277
278
|
})]
|
|
278
279
|
}),
|
|
279
|
-
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
/* @__PURE__ */
|
|
280
|
+
j.notes ? /* @__PURE__ */ f(u, { children: [
|
|
281
|
+
/* @__PURE__ */ d(v, { sx: { my: 1.5 } }),
|
|
282
|
+
/* @__PURE__ */ d(C, {
|
|
282
283
|
variant: "caption",
|
|
283
284
|
color: "text.secondary",
|
|
284
285
|
sx: {
|
|
@@ -290,14 +291,14 @@ function D() {
|
|
|
290
291
|
},
|
|
291
292
|
children: "Requester notes"
|
|
292
293
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ d(C, {
|
|
294
295
|
variant: "body2",
|
|
295
|
-
children:
|
|
296
|
+
children: j.notes
|
|
296
297
|
})
|
|
297
298
|
] }) : null,
|
|
298
|
-
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
299
|
+
j.decisionNotes ? /* @__PURE__ */ f(u, { children: [
|
|
300
|
+
/* @__PURE__ */ d(v, { sx: { my: 1.5 } }),
|
|
301
|
+
/* @__PURE__ */ d(C, {
|
|
301
302
|
variant: "caption",
|
|
302
303
|
color: "text.secondary",
|
|
303
304
|
sx: {
|
|
@@ -309,25 +310,25 @@ function D() {
|
|
|
309
310
|
},
|
|
310
311
|
children: "Decision notes"
|
|
311
312
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ d(C, {
|
|
313
314
|
variant: "body2",
|
|
314
|
-
children:
|
|
315
|
+
children: j.decisionNotes
|
|
315
316
|
})
|
|
316
317
|
] }) : null
|
|
317
318
|
]
|
|
318
319
|
})
|
|
319
|
-
}), /* @__PURE__ */
|
|
320
|
+
}), /* @__PURE__ */ d(g, {
|
|
320
321
|
sx: {
|
|
321
|
-
borderRadius:
|
|
322
|
+
borderRadius: 1.5,
|
|
322
323
|
mb: 2,
|
|
323
324
|
border: "1px solid",
|
|
324
325
|
borderColor: "divider",
|
|
325
326
|
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
326
327
|
},
|
|
327
|
-
children: /* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ f(_, {
|
|
328
329
|
sx: { p: 2.5 },
|
|
329
330
|
children: [
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ f(y, {
|
|
331
332
|
direction: {
|
|
332
333
|
xs: "column",
|
|
333
334
|
md: "row"
|
|
@@ -335,66 +336,66 @@ function D() {
|
|
|
335
336
|
alignItems: { md: "flex-end" },
|
|
336
337
|
justifyContent: "space-between",
|
|
337
338
|
sx: { mb: 1.5 },
|
|
338
|
-
children: [/* @__PURE__ */
|
|
339
|
+
children: [/* @__PURE__ */ d(o, {
|
|
339
340
|
eyebrow: "Lines",
|
|
340
341
|
title: $ ? "Decide per-line quantities" : "Requested items",
|
|
341
342
|
hint: $ ? "Enter 0 to reject an item, or less than requested to partially approve." : null
|
|
342
|
-
}), $ ? /* @__PURE__ */
|
|
343
|
+
}), $ ? /* @__PURE__ */ f(y, {
|
|
343
344
|
direction: "row",
|
|
344
345
|
spacing: 1,
|
|
345
|
-
children: [/* @__PURE__ */
|
|
346
|
+
children: [/* @__PURE__ */ d(h, {
|
|
346
347
|
size: "small",
|
|
347
348
|
variant: "outlined",
|
|
348
|
-
onClick:
|
|
349
|
+
onClick: Ce,
|
|
349
350
|
children: "Approve all"
|
|
350
|
-
}), /* @__PURE__ */
|
|
351
|
+
}), /* @__PURE__ */ d(h, {
|
|
351
352
|
size: "small",
|
|
352
353
|
variant: "outlined",
|
|
353
354
|
color: "error",
|
|
354
|
-
onClick:
|
|
355
|
+
onClick: Y,
|
|
355
356
|
children: "Reject all"
|
|
356
357
|
})]
|
|
357
358
|
}) : null]
|
|
358
359
|
}),
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ f(se, {
|
|
360
361
|
size: "small",
|
|
361
|
-
children: [/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
|
|
362
|
+
children: [/* @__PURE__ */ d(le, { children: /* @__PURE__ */ f(x, { children: [
|
|
363
|
+
/* @__PURE__ */ d(b, { children: "Product" }),
|
|
364
|
+
/* @__PURE__ */ d(b, { children: "Lot" }),
|
|
365
|
+
/* @__PURE__ */ d(b, { children: "Expiry" }),
|
|
366
|
+
A ? /* @__PURE__ */ d(b, {
|
|
366
367
|
align: "right",
|
|
367
368
|
children: "Buy Price"
|
|
368
369
|
}) : null,
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ d(b, {
|
|
370
371
|
align: "right",
|
|
371
372
|
children: "Requested"
|
|
372
373
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ d(b, {
|
|
374
375
|
align: "right",
|
|
375
376
|
children: $ ? "Approve" : "Approved"
|
|
376
377
|
}),
|
|
377
|
-
|
|
378
|
-
] }) }), /* @__PURE__ */
|
|
379
|
-
let t =
|
|
380
|
-
return /* @__PURE__ */
|
|
381
|
-
/* @__PURE__ */
|
|
378
|
+
j.ownerType === "FACILITY" ? /* @__PURE__ */ d(b, { children: "Storage" }) : null
|
|
379
|
+
] }) }), /* @__PURE__ */ d(ce, { children: j.items.map((e) => {
|
|
380
|
+
let t = X[e.id], n = Z[e.id], r = Q[e.id], i = Number(R[e.id] ?? 0), o = $ && Number.isFinite(i) && i > 0;
|
|
381
|
+
return /* @__PURE__ */ f(x, { children: [
|
|
382
|
+
/* @__PURE__ */ d(b, {
|
|
382
383
|
sx: { fontWeight: 700 },
|
|
383
384
|
children: e.productName
|
|
384
385
|
}),
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ d(b, {
|
|
386
387
|
sx: {
|
|
387
388
|
fontFamily: "monospace",
|
|
388
389
|
fontSize: "0.78rem"
|
|
389
390
|
},
|
|
390
|
-
children: $ ? /* @__PURE__ */
|
|
391
|
+
children: $ ? /* @__PURE__ */ d(S, {
|
|
391
392
|
size: "small",
|
|
392
393
|
placeholder: "Enter lot",
|
|
393
|
-
value:
|
|
394
|
-
onChange: (t) =>
|
|
395
|
-
disabled: !
|
|
394
|
+
value: B[e.id] ?? "",
|
|
395
|
+
onChange: (t) => xe(e.id, t.target.value),
|
|
396
|
+
disabled: !o,
|
|
396
397
|
error: !!n,
|
|
397
|
-
helperText: n || (
|
|
398
|
+
helperText: n || (o ? "" : "Approve qty > 0 to enter lot"),
|
|
398
399
|
inputProps: { style: {
|
|
399
400
|
fontFamily: "monospace",
|
|
400
401
|
fontSize: "0.78rem"
|
|
@@ -402,29 +403,29 @@ function D() {
|
|
|
402
403
|
sx: { minWidth: 140 }
|
|
403
404
|
}) : e.lotNumber || "—"
|
|
404
405
|
}),
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ d(b, { children: $ ? /* @__PURE__ */ d(S, {
|
|
406
407
|
size: "small",
|
|
407
408
|
type: "date",
|
|
408
409
|
InputLabelProps: { shrink: !0 },
|
|
409
|
-
value:
|
|
410
|
-
onChange: (t) =>
|
|
411
|
-
disabled: !
|
|
410
|
+
value: H[e.id] ?? "",
|
|
411
|
+
onChange: (t) => Se(e.id, t.target.value),
|
|
412
|
+
disabled: !o,
|
|
412
413
|
error: !!r,
|
|
413
414
|
helperText: r || "",
|
|
414
415
|
sx: { minWidth: 150 }
|
|
415
|
-
}) : e.expiryDate ?
|
|
416
|
-
|
|
416
|
+
}) : e.expiryDate ? ee(e.expiryDate) : "—" }),
|
|
417
|
+
A ? /* @__PURE__ */ d(b, {
|
|
417
418
|
align: "right",
|
|
418
|
-
children: e.buyPrice == null ? /* @__PURE__ */
|
|
419
|
+
children: e.buyPrice == null ? /* @__PURE__ */ d(C, {
|
|
419
420
|
variant: "caption",
|
|
420
421
|
color: "text.disabled",
|
|
421
422
|
children: "—"
|
|
422
|
-
}) : /* @__PURE__ */
|
|
423
|
+
}) : /* @__PURE__ */ d(a, {
|
|
423
424
|
value: e.buyPrice,
|
|
424
425
|
bold: !1
|
|
425
426
|
})
|
|
426
427
|
}) : null,
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ d(b, {
|
|
428
429
|
align: "right",
|
|
429
430
|
sx: {
|
|
430
431
|
fontVariantNumeric: "tabular-nums",
|
|
@@ -432,9 +433,9 @@ function D() {
|
|
|
432
433
|
},
|
|
433
434
|
children: e.requestedQuantity
|
|
434
435
|
}),
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ d(b, {
|
|
436
437
|
align: "right",
|
|
437
|
-
children: $ ? /* @__PURE__ */
|
|
438
|
+
children: $ ? /* @__PURE__ */ d(S, {
|
|
438
439
|
size: "small",
|
|
439
440
|
type: "number",
|
|
440
441
|
inputProps: {
|
|
@@ -442,12 +443,12 @@ function D() {
|
|
|
442
443
|
max: e.requestedQuantity,
|
|
443
444
|
style: { textAlign: "right" }
|
|
444
445
|
},
|
|
445
|
-
value:
|
|
446
|
-
onChange: (t) =>
|
|
446
|
+
value: R[e.id] ?? "",
|
|
447
|
+
onChange: (t) => be(e.id, t.target.value),
|
|
447
448
|
error: !!t,
|
|
448
449
|
helperText: t || "",
|
|
449
450
|
sx: { maxWidth: 110 }
|
|
450
|
-
}) : /* @__PURE__ */
|
|
451
|
+
}) : /* @__PURE__ */ d(C, {
|
|
451
452
|
sx: {
|
|
452
453
|
fontVariantNumeric: "tabular-nums",
|
|
453
454
|
fontWeight: 700
|
|
@@ -455,39 +456,39 @@ function D() {
|
|
|
455
456
|
children: e.approvedQuantity == null ? "—" : e.approvedQuantity
|
|
456
457
|
})
|
|
457
458
|
}),
|
|
458
|
-
|
|
459
|
+
j.ownerType === "FACILITY" ? /* @__PURE__ */ d(b, { children: e.storageUnitName || "—" }) : null
|
|
459
460
|
] }, e.id);
|
|
460
461
|
}) })]
|
|
461
462
|
}),
|
|
462
|
-
$ ? /* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */
|
|
463
|
+
$ ? /* @__PURE__ */ f(u, { children: [
|
|
464
|
+
/* @__PURE__ */ d(v, { sx: { my: 2 } }),
|
|
465
|
+
/* @__PURE__ */ f(y, {
|
|
465
466
|
direction: {
|
|
466
467
|
xs: "column",
|
|
467
468
|
md: "row"
|
|
468
469
|
},
|
|
469
470
|
spacing: 2,
|
|
470
471
|
alignItems: { md: "flex-start" },
|
|
471
|
-
children: [/* @__PURE__ */
|
|
472
|
+
children: [/* @__PURE__ */ d(S, {
|
|
472
473
|
fullWidth: !0,
|
|
473
474
|
size: "small",
|
|
474
475
|
label: "Decision notes (optional)",
|
|
475
476
|
placeholder: "Rationale shown to the requester",
|
|
476
|
-
value:
|
|
477
|
-
onChange: (e) =>
|
|
477
|
+
value: W,
|
|
478
|
+
onChange: (e) => G(e.target.value),
|
|
478
479
|
multiline: !0,
|
|
479
480
|
minRows: 2
|
|
480
|
-
}),
|
|
481
|
+
}), A && J != null ? /* @__PURE__ */ f(m, {
|
|
481
482
|
sx: (e) => ({
|
|
482
483
|
minWidth: 220,
|
|
483
484
|
p: 1.5,
|
|
484
|
-
borderRadius:
|
|
485
|
+
borderRadius: 1.5,
|
|
485
486
|
border: "1px solid",
|
|
486
487
|
borderColor: "divider",
|
|
487
|
-
bgcolor:
|
|
488
|
+
bgcolor: ue(e.palette.primary.main, .04),
|
|
488
489
|
textAlign: "right"
|
|
489
490
|
}),
|
|
490
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ d(C, {
|
|
491
492
|
variant: "caption",
|
|
492
493
|
color: "text.secondary",
|
|
493
494
|
sx: {
|
|
@@ -497,55 +498,55 @@ function D() {
|
|
|
497
498
|
letterSpacing: .6
|
|
498
499
|
},
|
|
499
500
|
children: "Total if approved"
|
|
500
|
-
}), /* @__PURE__ */
|
|
501
|
-
value: Number(
|
|
501
|
+
}), /* @__PURE__ */ d(a, {
|
|
502
|
+
value: Number(J.toFixed(2)),
|
|
502
503
|
size: "big"
|
|
503
504
|
})]
|
|
504
505
|
}) : null]
|
|
505
506
|
}),
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ f(y, {
|
|
507
508
|
direction: "row",
|
|
508
509
|
spacing: 1,
|
|
509
510
|
justifyContent: "flex-end",
|
|
510
511
|
sx: { mt: 2 },
|
|
511
|
-
children: [/* @__PURE__ */
|
|
512
|
+
children: [/* @__PURE__ */ d(h, {
|
|
512
513
|
variant: "outlined",
|
|
513
514
|
color: "error",
|
|
514
|
-
startIcon: /* @__PURE__ */
|
|
515
|
-
disabled:
|
|
515
|
+
startIcon: /* @__PURE__ */ d(ge, {}),
|
|
516
|
+
disabled: P,
|
|
516
517
|
onClick: () => {
|
|
517
|
-
|
|
518
|
+
Y();
|
|
518
519
|
},
|
|
519
520
|
children: "Set all to 0"
|
|
520
|
-
}), /* @__PURE__ */
|
|
521
|
+
}), /* @__PURE__ */ d(h, {
|
|
521
522
|
variant: "contained",
|
|
522
|
-
startIcon: /* @__PURE__ */
|
|
523
|
-
disabled:
|
|
523
|
+
startIcon: /* @__PURE__ */ d(he, {}),
|
|
524
|
+
disabled: P || !we,
|
|
524
525
|
onClick: () => void Te(),
|
|
525
|
-
children:
|
|
526
|
+
children: P ? "Submitting…" : "Submit Decision"
|
|
526
527
|
})]
|
|
527
528
|
})
|
|
528
529
|
] }) : null,
|
|
529
|
-
|
|
530
|
+
q && !k ? /* @__PURE__ */ d(y, {
|
|
530
531
|
direction: "row",
|
|
531
532
|
spacing: 1,
|
|
532
533
|
justifyContent: "flex-end",
|
|
533
534
|
sx: { mt: 2 },
|
|
534
|
-
children: /* @__PURE__ */
|
|
535
|
+
children: /* @__PURE__ */ d(h, {
|
|
535
536
|
variant: "outlined",
|
|
536
537
|
color: "error",
|
|
537
|
-
startIcon: /* @__PURE__ */
|
|
538
|
-
disabled:
|
|
538
|
+
startIcon: /* @__PURE__ */ d(_e, {}),
|
|
539
|
+
disabled: P,
|
|
539
540
|
onClick: () => void Ee(),
|
|
540
|
-
children:
|
|
541
|
+
children: P ? "Cancelling…" : "Cancel Request"
|
|
541
542
|
})
|
|
542
543
|
}) : null,
|
|
543
|
-
|
|
544
|
+
j.approvedPurchaseId ? /* @__PURE__ */ f(p, {
|
|
544
545
|
severity: "success",
|
|
545
546
|
sx: { mt: 2 },
|
|
546
547
|
children: [
|
|
547
548
|
"Stock was added to inventory under purchase id ",
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ d("strong", { children: j.approvedPurchaseId }),
|
|
549
550
|
"."
|
|
550
551
|
]
|
|
551
552
|
}) : null
|
|
@@ -555,12 +556,12 @@ function D() {
|
|
|
555
556
|
})
|
|
556
557
|
})] });
|
|
557
558
|
}
|
|
558
|
-
function
|
|
559
|
-
return /* @__PURE__ */
|
|
559
|
+
function D({ label: e, children: t }) {
|
|
560
|
+
return /* @__PURE__ */ f(y, {
|
|
560
561
|
direction: "row",
|
|
561
562
|
spacing: 1,
|
|
562
563
|
sx: { minWidth: 0 },
|
|
563
|
-
children: [/* @__PURE__ */
|
|
564
|
+
children: [/* @__PURE__ */ d(C, {
|
|
564
565
|
variant: "caption",
|
|
565
566
|
color: "text.secondary",
|
|
566
567
|
sx: {
|
|
@@ -570,7 +571,7 @@ function O({ label: e, children: t }) {
|
|
|
570
571
|
letterSpacing: .5
|
|
571
572
|
},
|
|
572
573
|
children: e
|
|
573
|
-
}), /* @__PURE__ */
|
|
574
|
+
}), /* @__PURE__ */ d(C, {
|
|
574
575
|
variant: "caption",
|
|
575
576
|
sx: {
|
|
576
577
|
minWidth: 0,
|
|
@@ -581,6 +582,6 @@ function O({ label: e, children: t }) {
|
|
|
581
582
|
});
|
|
582
583
|
}
|
|
583
584
|
//#endregion
|
|
584
|
-
export {
|
|
585
|
+
export { E as default };
|
|
585
586
|
|
|
586
|
-
//# sourceMappingURL=PurchaseRequestDetailPage-
|
|
587
|
+
//# sourceMappingURL=PurchaseRequestDetailPage-CNAqIFef.js.map
|