@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,56 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Alert as g, Box as de, Button as _, Card as v, CardContent as y, Divider as b,
|
|
1
|
+
import { E as e, S as t, d as n, i as r, r as i, v as ee } from "./settingsStore-KW217unV.js";
|
|
2
|
+
import { o as a, r as o } from "./PmTable-BkK65bJQ.js";
|
|
3
|
+
import { n as te } from "./constants-5ZCZo-Zm.js";
|
|
4
|
+
import { i as ne, r as s } from "./format-UOyOu75i.js";
|
|
5
|
+
import { d as c, m as l, o as re, t as u } from "./validation-Ba7puFIO.js";
|
|
6
|
+
import { t as ie } from "./useFieldErrors-hDG8ox_x.js";
|
|
7
|
+
import { a as ae, i as oe, n as se, r as d, t as ce } from "./PmGuard-C90yhpsN.js";
|
|
8
|
+
import { t as le } from "./MemberProfileCard-BLUVRILO.js";
|
|
9
|
+
import { useMemo as f, useState as p } from "react";
|
|
10
|
+
import { Fragment as ue, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { Alert as g, Box as de, Button as _, Card as v, CardContent as y, Divider as b, Grid as x, IconButton as fe, InputAdornment as S, Stack as C, TextField as w, Typography as T } from "@mui/material";
|
|
12
|
+
import { showToast as pe } from "@/common/toaster/toaster";
|
|
13
|
+
import { v4 as E } from "uuid";
|
|
12
14
|
import me from "@mui/icons-material/AddRounded";
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import ye from "@mui/icons-material/DeleteOutlineRounded";
|
|
15
|
+
import { useNavigate as D, useParams as he } from "react-router-dom";
|
|
16
|
+
import ge from "@mui/icons-material/SaveRounded";
|
|
17
|
+
import _e from "@mui/icons-material/DeleteOutlineRounded";
|
|
17
18
|
//#region src/views/SaleCreatePage.jsx
|
|
18
|
-
function
|
|
19
|
+
function O() {
|
|
19
20
|
return {
|
|
20
|
-
key:
|
|
21
|
+
key: E(),
|
|
21
22
|
batchId: "",
|
|
22
23
|
quantity: 1,
|
|
23
24
|
salePrice: ""
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
let
|
|
28
|
-
id:
|
|
29
|
-
saleDate:
|
|
27
|
+
function k() {
|
|
28
|
+
let k = D(), { memberId: A } = he(), j = r(i()?.currencyCode), [M, ve] = p([]), [N, P] = p([]), [ye, be] = p({}), [F, I] = p(""), [L, R] = p(""), xe = oe().has("view.manage.productManagement.dues"), z = ie(), Se = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10), [B, V] = p({
|
|
29
|
+
id: E(),
|
|
30
|
+
saleDate: Se,
|
|
30
31
|
paymentMode: "CASH",
|
|
31
32
|
collectingNow: "",
|
|
32
33
|
notes: "",
|
|
33
|
-
items: [
|
|
34
|
+
items: [O()]
|
|
34
35
|
});
|
|
35
|
-
|
|
36
|
+
d("update.manage.productManagement.sale", () => {
|
|
36
37
|
async function n() {
|
|
37
38
|
try {
|
|
38
39
|
let [n, r, i] = await Promise.all([
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
e(),
|
|
41
|
+
t().catch(() => []),
|
|
42
|
+
xe ? ee().catch(() => []) : Promise.resolve([])
|
|
42
43
|
]);
|
|
43
|
-
|
|
44
|
+
ve(n), P(r), be(Object.fromEntries((i ?? []).map((e) => [e.memberId, Number(e.totalDue)])));
|
|
44
45
|
} catch (e) {
|
|
45
46
|
R(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
n();
|
|
49
50
|
}, []);
|
|
50
|
-
let H = (e) =>
|
|
51
|
-
let e = new Set(
|
|
52
|
-
return
|
|
53
|
-
}, [
|
|
51
|
+
let H = (e) => M.find((t) => t.id === e), U = f(() => {
|
|
52
|
+
let e = new Set(N.filter((e) => e.notForSale === !0).map((e) => e.id));
|
|
53
|
+
return M.filter((t) => !(t.qtyRemaining <= 0 || t.isQuarantined || e.has(t.productId) || ne(t.expiryDate)));
|
|
54
|
+
}, [M, N]);
|
|
54
55
|
function W(e, t, n) {
|
|
55
56
|
V((r) => {
|
|
56
57
|
let i = r.items.slice();
|
|
@@ -63,34 +64,34 @@ function j() {
|
|
|
63
64
|
};
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
let G =
|
|
67
|
-
saleDate:
|
|
68
|
-
member:
|
|
69
|
-
}, Z = B.collectingNow === "" ? "" :
|
|
70
|
-
!Z && B.collectingNow !== "" && Number(B.collectingNow) > G ? X.collectingNow = `Cannot collect more than the sale amount (${
|
|
71
|
-
let
|
|
72
|
-
let t = H(e.batchId), n =
|
|
67
|
+
let G = f(() => B.items.reduce((e, t) => !t.salePrice || !t.quantity ? e : e + Number(t.salePrice) * Number(t.quantity), 0), [B.items]), K = Number(A ? ye[A] ?? 0 : 0), Ce = Number(B.collectingNow || 0), q = Math.min(Math.max(Ce, 0), G), J = Math.max(G - q, 0), Y = J + K, X = {
|
|
68
|
+
saleDate: l(B.saleDate, "Sale date"),
|
|
69
|
+
member: A ? "" : "No member selected"
|
|
70
|
+
}, Z = B.collectingNow === "" ? "" : c(B.collectingNow);
|
|
71
|
+
!Z && B.collectingNow !== "" && Number(B.collectingNow) > G ? X.collectingNow = `Cannot collect more than the sale amount (${s(G)}). Settle old dues via Payments.` : Z && (X.collectingNow = Z);
|
|
72
|
+
let we = new Set(U.map((e) => e.id)), Q = B.items.map((e) => {
|
|
73
|
+
let t = H(e.batchId), n = re(e.quantity, "Quantity", {
|
|
73
74
|
required: !0,
|
|
74
75
|
min: 1
|
|
75
76
|
});
|
|
76
77
|
!n && t && Number(e.quantity) > t.qtyRemaining && (n = `Only ${t.qtyRemaining} available in selected batch`);
|
|
77
|
-
let r =
|
|
78
|
-
return !r && e.batchId && !
|
|
78
|
+
let r = l(e.batchId, "Batch");
|
|
79
|
+
return !r && e.batchId && !we.has(e.batchId) && (r = "Batch is not available for sale (expired, quarantined, out of stock, or not-for-sale)."), {
|
|
79
80
|
batchId: r,
|
|
80
81
|
quantity: n,
|
|
81
|
-
salePrice:
|
|
82
|
+
salePrice: c(e.salePrice) || l(e.salePrice, "Unit price")
|
|
82
83
|
};
|
|
83
|
-
}), $ =
|
|
84
|
-
async function
|
|
84
|
+
}), $ = u(X) && Q.every(u) && B.items.length > 0 && G > 0;
|
|
85
|
+
async function Te() {
|
|
85
86
|
if (!$) {
|
|
86
87
|
z.markAllTouched(), R("Please fix the highlighted fields and try again.");
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
try {
|
|
90
|
-
await
|
|
91
|
+
await n({
|
|
91
92
|
id: B.id,
|
|
92
93
|
saleDate: B.saleDate,
|
|
93
|
-
memberId:
|
|
94
|
+
memberId: A,
|
|
94
95
|
paymentMode: B.paymentMode || null,
|
|
95
96
|
totalAmount: Number(G.toFixed(2)),
|
|
96
97
|
paidAmount: Number(q.toFixed(2)),
|
|
@@ -105,150 +106,135 @@ function j() {
|
|
|
105
106
|
salePrice: Number(e.salePrice)
|
|
106
107
|
};
|
|
107
108
|
})
|
|
108
|
-
}),
|
|
109
|
+
}), pe({
|
|
109
110
|
message: "Sale recorded.",
|
|
110
111
|
type: "success"
|
|
111
|
-
}),
|
|
112
|
+
}), k("/ui/medplat/manage/pm/sales");
|
|
112
113
|
} catch (e) {
|
|
113
114
|
R(e?.response?.data?.message ?? e?.message ?? "Failed to record sale");
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ h(de, { children: [/* @__PURE__ */ m(se, {}), /* @__PURE__ */ m(ce, {
|
|
117
118
|
perm: "update.manage.productManagement.sale",
|
|
118
119
|
title: "You don’t have permission to record sales",
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
+
children: /* @__PURE__ */ h(ae, {
|
|
120
121
|
title: "Record Sale",
|
|
121
|
-
actions: /* @__PURE__ */
|
|
122
|
+
actions: /* @__PURE__ */ h(C, {
|
|
122
123
|
direction: "row",
|
|
123
124
|
spacing: 1,
|
|
124
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [/* @__PURE__ */ m(_, {
|
|
125
126
|
variant: "outlined",
|
|
126
|
-
onClick: () =>
|
|
127
|
+
onClick: () => k("/ui/medplat/manage/pm/sales"),
|
|
127
128
|
children: "Cancel"
|
|
128
|
-
}), /* @__PURE__ */
|
|
129
|
+
}), /* @__PURE__ */ m(_, {
|
|
129
130
|
variant: "contained",
|
|
130
|
-
startIcon: /* @__PURE__ */
|
|
131
|
+
startIcon: /* @__PURE__ */ m(ge, {}),
|
|
131
132
|
disabled: !$,
|
|
132
|
-
onClick: () => void
|
|
133
|
+
onClick: () => void Te(),
|
|
133
134
|
children: "Save"
|
|
134
135
|
})]
|
|
135
136
|
}),
|
|
136
137
|
children: [
|
|
137
|
-
L ? /* @__PURE__ */
|
|
138
|
+
L ? /* @__PURE__ */ m(g, {
|
|
138
139
|
severity: "error",
|
|
139
140
|
sx: { mb: 2 },
|
|
140
141
|
children: L
|
|
141
142
|
}) : null,
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ m(v, {
|
|
143
144
|
sx: {
|
|
144
|
-
borderRadius:
|
|
145
|
+
borderRadius: 1.5,
|
|
145
146
|
mb: 2,
|
|
146
147
|
border: "1px solid",
|
|
147
148
|
borderColor: "divider",
|
|
148
149
|
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
149
150
|
},
|
|
150
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ h(y, {
|
|
151
152
|
sx: { p: 2.5 },
|
|
152
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ m(o, {
|
|
153
154
|
eyebrow: "Step 1",
|
|
154
155
|
title: "Customer",
|
|
155
156
|
hint: "The customer is set from the link you opened. Their balance shows below.",
|
|
156
157
|
sx: { mb: 2 }
|
|
157
|
-
}),
|
|
158
|
-
memberId:
|
|
158
|
+
}), A ? /* @__PURE__ */ m(le, {
|
|
159
|
+
memberId: A,
|
|
159
160
|
previousDue: K,
|
|
160
|
-
currencySymbol:
|
|
161
|
-
onLoad: (e) =>
|
|
162
|
-
}) : /* @__PURE__ */
|
|
161
|
+
currencySymbol: j,
|
|
162
|
+
onLoad: (e) => I(e?.name ?? "")
|
|
163
|
+
}) : /* @__PURE__ */ m(g, {
|
|
163
164
|
severity: "warning",
|
|
164
165
|
children: "No member selected"
|
|
165
166
|
})]
|
|
166
167
|
})
|
|
167
168
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ m(v, {
|
|
169
170
|
sx: {
|
|
170
|
-
borderRadius:
|
|
171
|
+
borderRadius: 1.5,
|
|
171
172
|
mb: 2,
|
|
172
173
|
border: "1px solid",
|
|
173
174
|
borderColor: "divider",
|
|
174
175
|
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
175
176
|
},
|
|
176
|
-
children: /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ h(y, {
|
|
177
178
|
sx: { p: 2.5 },
|
|
178
179
|
children: [
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ h(C, {
|
|
180
181
|
direction: "row",
|
|
181
182
|
justifyContent: "space-between",
|
|
182
183
|
alignItems: "flex-start",
|
|
183
184
|
sx: { mb: 2 },
|
|
184
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ m(o, {
|
|
185
186
|
eyebrow: "Step 2",
|
|
186
187
|
title: "Line items",
|
|
187
188
|
hint: "Each item comes from a batch. Buy price is shown as a cost reference."
|
|
188
|
-
}), /* @__PURE__ */
|
|
189
|
+
}), /* @__PURE__ */ m(_, {
|
|
189
190
|
variant: "outlined",
|
|
190
|
-
startIcon: /* @__PURE__ */
|
|
191
|
+
startIcon: /* @__PURE__ */ m(me, {}),
|
|
191
192
|
onClick: () => V({
|
|
192
193
|
...B,
|
|
193
|
-
items: [...B.items,
|
|
194
|
+
items: [...B.items, O()]
|
|
194
195
|
}),
|
|
195
196
|
children: "Add Line"
|
|
196
197
|
})]
|
|
197
198
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ m(b, { sx: { mb: 2 } }),
|
|
200
|
+
/* @__PURE__ */ m(C, {
|
|
200
201
|
spacing: 2,
|
|
201
202
|
children: B.items.map((e, t) => {
|
|
202
203
|
let n = H(e.batchId), r = Q[t] || {}, i = e.salePrice && e.quantity ? Number(e.salePrice) * Number(e.quantity) : 0;
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ m(v, {
|
|
204
205
|
variant: "outlined",
|
|
205
206
|
sx: {
|
|
206
207
|
p: 2,
|
|
207
|
-
borderRadius:
|
|
208
|
+
borderRadius: 1.5
|
|
208
209
|
},
|
|
209
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ h(x, {
|
|
210
211
|
container: !0,
|
|
211
212
|
spacing: 2,
|
|
212
213
|
alignItems: "center",
|
|
213
214
|
children: [
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ m(x, {
|
|
215
216
|
item: !0,
|
|
216
217
|
xs: 12,
|
|
217
218
|
md: 5,
|
|
218
|
-
children: /* @__PURE__ */ m(
|
|
219
|
+
children: /* @__PURE__ */ m(a, {
|
|
220
|
+
label: "Batch",
|
|
219
221
|
required: !0,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
value: e.batchId,
|
|
223
|
+
onChange: (e) => W(t, "batchId", e),
|
|
224
|
+
onBlur: z.onBlur(`items.${t}.batchId`),
|
|
222
225
|
error: z.show(`items.${t}.batchId`) && !!r.batchId,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
onChange: (e) => W(t, "batchId", e.target.value),
|
|
229
|
-
onBlur: z.onBlur(`items.${t}.batchId`),
|
|
230
|
-
children: U.map((e) => /* @__PURE__ */ m(T, {
|
|
231
|
-
value: e.id,
|
|
232
|
-
children: [
|
|
233
|
-
e.productName,
|
|
234
|
-
" · lot ",
|
|
235
|
-
e.lotNumber || "—",
|
|
236
|
-
" ·",
|
|
237
|
-
" ",
|
|
238
|
-
e.qtyRemaining,
|
|
239
|
-
" left"
|
|
240
|
-
]
|
|
241
|
-
}, e.id))
|
|
242
|
-
}),
|
|
243
|
-
/* @__PURE__ */ p(fe, { children: z.show(`items.${t}.batchId`) && r.batchId ? r.batchId : n?.buyPrice == null ? " " : `Buy price: ${N}${u(n.buyPrice)} / unit` })
|
|
244
|
-
]
|
|
226
|
+
options: U.map((e) => ({
|
|
227
|
+
value: e.id,
|
|
228
|
+
label: `${e.productName} · lot ${e.lotNumber || "—"} · ${e.qtyRemaining} left`
|
|
229
|
+
})),
|
|
230
|
+
helperText: z.show(`items.${t}.batchId`) && r.batchId ? r.batchId : n?.buyPrice == null ? " " : `Buy price: ${j}${s(n.buyPrice)} / unit`
|
|
245
231
|
})
|
|
246
232
|
}),
|
|
247
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ m(x, {
|
|
248
234
|
item: !0,
|
|
249
235
|
xs: 6,
|
|
250
236
|
md: 2,
|
|
251
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ m(w, {
|
|
252
238
|
required: !0,
|
|
253
239
|
fullWidth: !0,
|
|
254
240
|
size: "small",
|
|
@@ -265,11 +251,11 @@ function j() {
|
|
|
265
251
|
helperText: z.show(`items.${t}.quantity`) ? r.quantity : ""
|
|
266
252
|
})
|
|
267
253
|
}),
|
|
268
|
-
/* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ m(x, {
|
|
269
255
|
item: !0,
|
|
270
256
|
xs: 6,
|
|
271
257
|
md: 2,
|
|
272
|
-
children: /* @__PURE__ */
|
|
258
|
+
children: /* @__PURE__ */ m(w, {
|
|
273
259
|
required: !0,
|
|
274
260
|
fullWidth: !0,
|
|
275
261
|
size: "small",
|
|
@@ -279,9 +265,9 @@ function j() {
|
|
|
279
265
|
min: 0
|
|
280
266
|
},
|
|
281
267
|
label: "Unit Price",
|
|
282
|
-
InputProps: { startAdornment: /* @__PURE__ */
|
|
268
|
+
InputProps: { startAdornment: /* @__PURE__ */ m(S, {
|
|
283
269
|
position: "start",
|
|
284
|
-
children:
|
|
270
|
+
children: j
|
|
285
271
|
}) },
|
|
286
272
|
value: e.salePrice,
|
|
287
273
|
onChange: (e) => W(t, "salePrice", e.target.value),
|
|
@@ -290,38 +276,38 @@ function j() {
|
|
|
290
276
|
helperText: z.show(`items.${t}.salePrice`) ? r.salePrice : ""
|
|
291
277
|
})
|
|
292
278
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
279
|
+
/* @__PURE__ */ h(x, {
|
|
294
280
|
item: !0,
|
|
295
281
|
xs: 6,
|
|
296
282
|
md: 2,
|
|
297
283
|
sx: { textAlign: "right" },
|
|
298
|
-
children: [/* @__PURE__ */
|
|
284
|
+
children: [/* @__PURE__ */ m(T, {
|
|
299
285
|
variant: "caption",
|
|
300
286
|
color: "text.secondary",
|
|
301
287
|
sx: { display: "block" },
|
|
302
288
|
children: "Subtotal"
|
|
303
|
-
}), /* @__PURE__ */
|
|
289
|
+
}), /* @__PURE__ */ h(T, {
|
|
304
290
|
variant: "body1",
|
|
305
291
|
sx: {
|
|
306
292
|
fontWeight: 800,
|
|
307
293
|
fontVariantNumeric: "tabular-nums"
|
|
308
294
|
},
|
|
309
|
-
children: [
|
|
295
|
+
children: [j, s(i)]
|
|
310
296
|
})]
|
|
311
297
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ m(x, {
|
|
313
299
|
item: !0,
|
|
314
300
|
xs: 6,
|
|
315
301
|
md: 1,
|
|
316
302
|
sx: { textAlign: "right" },
|
|
317
|
-
children: /* @__PURE__ */
|
|
303
|
+
children: /* @__PURE__ */ m(fe, {
|
|
318
304
|
color: "error",
|
|
319
305
|
onClick: () => V({
|
|
320
306
|
...B,
|
|
321
307
|
items: B.items.filter((e, n) => n !== t)
|
|
322
308
|
}),
|
|
323
309
|
disabled: B.items.length === 1,
|
|
324
|
-
children: /* @__PURE__ */
|
|
310
|
+
children: /* @__PURE__ */ m(_e, {})
|
|
325
311
|
})
|
|
326
312
|
})
|
|
327
313
|
]
|
|
@@ -332,32 +318,32 @@ function j() {
|
|
|
332
318
|
]
|
|
333
319
|
})
|
|
334
320
|
}),
|
|
335
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ m(v, {
|
|
336
322
|
sx: {
|
|
337
|
-
borderRadius:
|
|
323
|
+
borderRadius: 1.5,
|
|
338
324
|
bgcolor: "grey.50",
|
|
339
325
|
border: "1px solid",
|
|
340
326
|
borderColor: "divider",
|
|
341
327
|
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
342
328
|
},
|
|
343
|
-
children: /* @__PURE__ */
|
|
329
|
+
children: /* @__PURE__ */ h(y, {
|
|
344
330
|
sx: { p: 2.5 },
|
|
345
331
|
children: [
|
|
346
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ m(o, {
|
|
347
333
|
eyebrow: "Step 3",
|
|
348
334
|
title: "Bill summary",
|
|
349
335
|
hint: "Shows totals, previous balance, and what you're collecting. Any remainder becomes a note of what they owe.",
|
|
350
336
|
sx: { mb: 2 }
|
|
351
337
|
}),
|
|
352
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ h(x, {
|
|
353
339
|
container: !0,
|
|
354
340
|
spacing: 2,
|
|
355
341
|
children: [
|
|
356
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ m(x, {
|
|
357
343
|
item: !0,
|
|
358
344
|
xs: 12,
|
|
359
345
|
md: 4,
|
|
360
|
-
children: /* @__PURE__ */
|
|
346
|
+
children: /* @__PURE__ */ m(w, {
|
|
361
347
|
required: !0,
|
|
362
348
|
fullWidth: !0,
|
|
363
349
|
size: "small",
|
|
@@ -374,35 +360,25 @@ function j() {
|
|
|
374
360
|
helperText: z.show("saleDate") ? X.saleDate : ""
|
|
375
361
|
})
|
|
376
362
|
}),
|
|
377
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ m(x, {
|
|
378
364
|
item: !0,
|
|
379
365
|
xs: 12,
|
|
380
366
|
md: 4,
|
|
381
|
-
children: /* @__PURE__ */ m(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
paymentMode: e.target.value
|
|
390
|
-
}),
|
|
391
|
-
children: [/* @__PURE__ */ p(T, {
|
|
392
|
-
value: "",
|
|
393
|
-
children: /* @__PURE__ */ p("em", { children: "—" })
|
|
394
|
-
}), ce.map((e) => /* @__PURE__ */ p(T, {
|
|
395
|
-
value: e.value,
|
|
396
|
-
children: e.label
|
|
397
|
-
}, e.value))]
|
|
398
|
-
})]
|
|
367
|
+
children: /* @__PURE__ */ m(a, {
|
|
368
|
+
label: "Payment Mode",
|
|
369
|
+
value: B.paymentMode || "",
|
|
370
|
+
onChange: (e) => V({
|
|
371
|
+
...B,
|
|
372
|
+
paymentMode: e
|
|
373
|
+
}),
|
|
374
|
+
options: te
|
|
399
375
|
})
|
|
400
376
|
}),
|
|
401
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ m(x, {
|
|
402
378
|
item: !0,
|
|
403
379
|
xs: 12,
|
|
404
380
|
md: 4,
|
|
405
|
-
children: /* @__PURE__ */
|
|
381
|
+
children: /* @__PURE__ */ m(w, {
|
|
406
382
|
fullWidth: !0,
|
|
407
383
|
size: "small",
|
|
408
384
|
label: "Notes",
|
|
@@ -415,15 +391,15 @@ function j() {
|
|
|
415
391
|
})
|
|
416
392
|
]
|
|
417
393
|
}),
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ m(b, { sx: { my: 2 } }),
|
|
395
|
+
/* @__PURE__ */ h(C, {
|
|
420
396
|
spacing: 1.25,
|
|
421
397
|
children: [
|
|
422
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ h(C, {
|
|
423
399
|
direction: "row",
|
|
424
400
|
justifyContent: "space-between",
|
|
425
401
|
alignItems: "baseline",
|
|
426
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ h(T, {
|
|
427
403
|
variant: "body2",
|
|
428
404
|
color: "text.secondary",
|
|
429
405
|
children: [
|
|
@@ -433,45 +409,45 @@ function j() {
|
|
|
433
409
|
B.items.length === 1 ? "line" : "lines",
|
|
434
410
|
")"
|
|
435
411
|
]
|
|
436
|
-
}), /* @__PURE__ */
|
|
412
|
+
}), /* @__PURE__ */ h(T, {
|
|
437
413
|
variant: "h5",
|
|
438
414
|
sx: {
|
|
439
415
|
fontWeight: 800,
|
|
440
416
|
fontVariantNumeric: "tabular-nums"
|
|
441
417
|
},
|
|
442
|
-
children: [
|
|
418
|
+
children: [j, s(G)]
|
|
443
419
|
})]
|
|
444
420
|
}),
|
|
445
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ h(C, {
|
|
446
422
|
direction: "row",
|
|
447
423
|
justifyContent: "space-between",
|
|
448
424
|
alignItems: "baseline",
|
|
449
|
-
children: [/* @__PURE__ */
|
|
425
|
+
children: [/* @__PURE__ */ m(T, {
|
|
450
426
|
variant: "body2",
|
|
451
427
|
color: "text.secondary",
|
|
452
428
|
children: "Previous Due"
|
|
453
|
-
}), /* @__PURE__ */
|
|
429
|
+
}), /* @__PURE__ */ h(T, {
|
|
454
430
|
variant: "body1",
|
|
455
431
|
sx: {
|
|
456
432
|
fontWeight: 700,
|
|
457
433
|
fontVariantNumeric: "tabular-nums",
|
|
458
434
|
color: K > 0 ? "warning.dark" : "text.primary"
|
|
459
435
|
},
|
|
460
|
-
children: [
|
|
436
|
+
children: [j, s(K)]
|
|
461
437
|
})]
|
|
462
438
|
}),
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ m(b, { sx: { my: .5 } }),
|
|
440
|
+
/* @__PURE__ */ h(C, {
|
|
465
441
|
direction: "row",
|
|
466
442
|
justifyContent: "space-between",
|
|
467
443
|
alignItems: "center",
|
|
468
444
|
spacing: 2,
|
|
469
|
-
children: [/* @__PURE__ */
|
|
445
|
+
children: [/* @__PURE__ */ m(T, {
|
|
470
446
|
variant: "body2",
|
|
471
447
|
color: "text.secondary",
|
|
472
448
|
sx: { flexShrink: 0 },
|
|
473
449
|
children: "Amount Collecting Now"
|
|
474
|
-
}), /* @__PURE__ */
|
|
450
|
+
}), /* @__PURE__ */ m(w, {
|
|
475
451
|
size: "small",
|
|
476
452
|
type: "number",
|
|
477
453
|
inputProps: {
|
|
@@ -483,9 +459,9 @@ function j() {
|
|
|
483
459
|
fontWeight: 700
|
|
484
460
|
}
|
|
485
461
|
},
|
|
486
|
-
InputProps: { startAdornment: /* @__PURE__ */
|
|
462
|
+
InputProps: { startAdornment: /* @__PURE__ */ m(S, {
|
|
487
463
|
position: "start",
|
|
488
|
-
children:
|
|
464
|
+
children: j
|
|
489
465
|
}) },
|
|
490
466
|
sx: { width: 200 },
|
|
491
467
|
value: B.collectingNow,
|
|
@@ -499,39 +475,39 @@ function j() {
|
|
|
499
475
|
helperText: z.show("collectingNow") ? X.collectingNow : ""
|
|
500
476
|
})]
|
|
501
477
|
}),
|
|
502
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ h(C, {
|
|
503
479
|
direction: "row",
|
|
504
480
|
justifyContent: "space-between",
|
|
505
481
|
alignItems: "baseline",
|
|
506
|
-
children: [/* @__PURE__ */
|
|
482
|
+
children: [/* @__PURE__ */ m(T, {
|
|
507
483
|
variant: "body2",
|
|
508
484
|
color: "text.secondary",
|
|
509
485
|
children: "Remaining Due (after this sale)"
|
|
510
|
-
}), /* @__PURE__ */
|
|
486
|
+
}), /* @__PURE__ */ h(T, {
|
|
511
487
|
variant: "h5",
|
|
512
488
|
sx: {
|
|
513
489
|
fontWeight: 800,
|
|
514
490
|
fontVariantNumeric: "tabular-nums",
|
|
515
491
|
color: Y > 0 ? "warning.dark" : "success.dark"
|
|
516
492
|
},
|
|
517
|
-
children: [
|
|
493
|
+
children: [j, s(Y)]
|
|
518
494
|
})]
|
|
519
495
|
})
|
|
520
496
|
]
|
|
521
497
|
}),
|
|
522
|
-
|
|
498
|
+
A && Y > 0 ? /* @__PURE__ */ h(g, {
|
|
523
499
|
severity: "warning",
|
|
524
500
|
sx: { mt: 2 },
|
|
525
501
|
children: [
|
|
526
|
-
|
|
527
|
-
|
|
502
|
+
j,
|
|
503
|
+
s(Y),
|
|
528
504
|
" will be recorded as pending dues",
|
|
529
|
-
|
|
505
|
+
F ? /* @__PURE__ */ h(ue, { children: [
|
|
530
506
|
" ",
|
|
531
507
|
"for ",
|
|
532
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ m("strong", { children: F })
|
|
533
509
|
] }) : null,
|
|
534
|
-
J > 0 && K > 0 ? ` (${
|
|
510
|
+
J > 0 && K > 0 ? ` (${j}${s(J)} from this sale + ${j}${s(K)} previously outstanding).` : J > 0 ? " from this sale." : " from previously outstanding dues."
|
|
535
511
|
]
|
|
536
512
|
}) : null
|
|
537
513
|
]
|
|
@@ -542,6 +518,6 @@ function j() {
|
|
|
542
518
|
})] });
|
|
543
519
|
}
|
|
544
520
|
//#endregion
|
|
545
|
-
export {
|
|
521
|
+
export { k as default };
|
|
546
522
|
|
|
547
|
-
//# sourceMappingURL=SaleCreatePage-
|
|
523
|
+
//# sourceMappingURL=SaleCreatePage-DbfBK4PH.js.map
|