@argusoft/medplat-product-management 1.0.4 → 1.0.6

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.
Files changed (68) hide show
  1. package/dist/{BrandsPage-BE3kn-8b.js → BrandsPage-DM5ZRz8L.js} +7 -6
  2. package/dist/{BrandsPage-BE3kn-8b.js.map → BrandsPage-DM5ZRz8L.js.map} +1 -1
  3. package/dist/{CategoriesPage-COqi3pMi.js → CategoriesPage-v7vz_i2N.js} +7 -6
  4. package/dist/{CategoriesPage-COqi3pMi.js.map → CategoriesPage-v7vz_i2N.js.map} +1 -1
  5. package/dist/{DashboardPage-C_H1Jrey.js → DashboardPage-CW77OzUg.js} +3 -3
  6. package/dist/{DashboardPage-C_H1Jrey.js.map → DashboardPage-CW77OzUg.js.map} +1 -1
  7. package/dist/{FacilityPicker-Diq2hnYg.js → FacilityPicker-C2drWyqo.js} +2 -2
  8. package/dist/{FacilityPicker-Diq2hnYg.js.map → FacilityPicker-C2drWyqo.js.map} +1 -1
  9. package/dist/InventoryPage-_VWlqD2e.js +686 -0
  10. package/dist/InventoryPage-_VWlqD2e.js.map +1 -0
  11. package/dist/{MemberProfileCard-BLUVRILO.js → MemberProfileCard-D9jepThR.js} +3 -3
  12. package/dist/{MemberProfileCard-BLUVRILO.js.map → MemberProfileCard-D9jepThR.js.map} +1 -1
  13. package/dist/{PaymentCreatePage-B5VOgTx9.js → PaymentCreatePage-DAUWv5RO.js} +7 -7
  14. package/dist/{PaymentCreatePage-B5VOgTx9.js.map → PaymentCreatePage-DAUWv5RO.js.map} +1 -1
  15. package/dist/{PaymentsPage-DY6BclkN.js → PaymentsPage-B6Fs2xey.js} +4 -4
  16. package/dist/{PaymentsPage-DY6BclkN.js.map → PaymentsPage-B6Fs2xey.js.map} +1 -1
  17. package/dist/{PickupCreatePage-CCSiyFQF.js → PickupCreatePage-4ffB1_yq.js} +4 -4
  18. package/dist/{PickupCreatePage-CCSiyFQF.js.map → PickupCreatePage-4ffB1_yq.js.map} +1 -1
  19. package/dist/{PickupsPage-DGi6T5Of.js → PickupsPage-C-21LwTf.js} +7 -7
  20. package/dist/{PickupsPage-DGi6T5Of.js.map → PickupsPage-C-21LwTf.js.map} +1 -1
  21. package/dist/{PmGuard-C90yhpsN.js → PmGuard-DrbbysnW.js} +3 -3
  22. package/dist/{PmGuard-C90yhpsN.js.map → PmGuard-DrbbysnW.js.map} +1 -1
  23. package/dist/{PmTable-BkK65bJQ.js → PmTable-BMFiuHdG.js} +2 -2
  24. package/dist/{PmTable-BkK65bJQ.js.map → PmTable-BMFiuHdG.js.map} +1 -1
  25. package/dist/{ProductEditPage-CQj9egzW.js → ProductEditPage-BinNxjlB.js} +174 -116
  26. package/dist/ProductEditPage-BinNxjlB.js.map +1 -0
  27. package/dist/{ProductsPage-i8QVw_Jm.js → ProductsPage-DFgK9-13.js} +5 -5
  28. package/dist/{ProductsPage-i8QVw_Jm.js.map → ProductsPage-DFgK9-13.js.map} +1 -1
  29. package/dist/{PurchaseCreatePage-Bp6bl9n8.js → PurchaseCreatePage-B1eV15aS.js} +9 -9
  30. package/dist/{PurchaseCreatePage-Bp6bl9n8.js.map → PurchaseCreatePage-B1eV15aS.js.map} +1 -1
  31. package/dist/{PurchaseRequestDetailPage-CNAqIFef.js → PurchaseRequestDetailPage-52S6Nf7a.js} +6 -5
  32. package/dist/{PurchaseRequestDetailPage-CNAqIFef.js.map → PurchaseRequestDetailPage-52S6Nf7a.js.map} +1 -1
  33. package/dist/{PurchaseRequestsPage-BJqDlNrc.js → PurchaseRequestsPage-DNNUnXy4.js} +4 -4
  34. package/dist/{PurchaseRequestsPage-BJqDlNrc.js.map → PurchaseRequestsPage-DNNUnXy4.js.map} +1 -1
  35. package/dist/{PurchasesPage-BQEToymQ.js → PurchasesPage-Bsrqxvb1.js} +4 -4
  36. package/dist/{PurchasesPage-BQEToymQ.js.map → PurchasesPage-Bsrqxvb1.js.map} +1 -1
  37. package/dist/SaleCreatePage-CPyVj3Dh.js +544 -0
  38. package/dist/SaleCreatePage-CPyVj3Dh.js.map +1 -0
  39. package/dist/{SalesPage-CTBJMxZe.js → SalesPage-BWpgPKz_.js} +4 -4
  40. package/dist/{SalesPage-CTBJMxZe.js.map → SalesPage-BWpgPKz_.js.map} +1 -1
  41. package/dist/{SettingsPage-CiwVmzM3.js → SettingsPage-Ch-37E5R.js} +4 -4
  42. package/dist/{SettingsPage-CiwVmzM3.js.map → SettingsPage-Ch-37E5R.js.map} +1 -1
  43. package/dist/{StorageUnitsPage-BV7nK_iE.js → StorageUnitsPage-DF0MC356.js} +7 -7
  44. package/dist/{StorageUnitsPage-BV7nK_iE.js.map → StorageUnitsPage-DF0MC356.js.map} +1 -1
  45. package/dist/{TransactionsPage-Cocn4901.js → TransactionsPage-DQBjCHoN.js} +18 -18
  46. package/dist/{TransactionsPage-Cocn4901.js.map → TransactionsPage-DQBjCHoN.js.map} +1 -1
  47. package/dist/{TransferCreatePage-DbjcjuOg.js → TransferCreatePage-DdVExUif.js} +4 -4
  48. package/dist/{TransferCreatePage-DbjcjuOg.js.map → TransferCreatePage-DdVExUif.js.map} +1 -1
  49. package/dist/{TransfersPage-BFVF7Xvc.js → TransfersPage-C1qS9kNL.js} +5 -5
  50. package/dist/{TransfersPage-BFVF7Xvc.js.map → TransfersPage-C1qS9kNL.js.map} +1 -1
  51. package/dist/{VialsPage-BNzYTLVd.js → VialsPage-rTAYlXGZ.js} +8 -8
  52. package/dist/{VialsPage-BNzYTLVd.js.map → VialsPage-rTAYlXGZ.js.map} +1 -1
  53. package/dist/{constants-5ZCZo-Zm.js → constants-CdzV0PxZ.js} +25 -12
  54. package/dist/constants-CdzV0PxZ.js.map +1 -0
  55. package/dist/format-UOyOu75i.js.map +1 -1
  56. package/dist/index.js +5 -5
  57. package/dist/index.js.map +1 -1
  58. package/dist/{settingsStore-KW217unV.js → settingsStore-GLCtI-tv.js} +17 -14
  59. package/dist/{settingsStore-KW217unV.js.map → settingsStore-GLCtI-tv.js.map} +1 -1
  60. package/dist/{validation-Ba7puFIO.js → validation-BkUPqrdA.js} +11 -12
  61. package/dist/{validation-Ba7puFIO.js.map → validation-BkUPqrdA.js.map} +1 -1
  62. package/package.json +1 -1
  63. package/dist/InventoryPage-Bjpw6vTz.js +0 -508
  64. package/dist/InventoryPage-Bjpw6vTz.js.map +0 -1
  65. package/dist/ProductEditPage-CQj9egzW.js.map +0 -1
  66. package/dist/SaleCreatePage-DbfBK4PH.js +0 -523
  67. package/dist/SaleCreatePage-DbfBK4PH.js.map +0 -1
  68. package/dist/constants-5ZCZo-Zm.js.map +0 -1
@@ -0,0 +1,544 @@
1
+ import { E as e, S as t, d as n, i as r, r as i, v as a } from "./settingsStore-GLCtI-tv.js";
2
+ import { o, r as s } from "./PmTable-BMFiuHdG.js";
3
+ import { n as c } from "./constants-CdzV0PxZ.js";
4
+ import { i as ee, r as l } from "./format-UOyOu75i.js";
5
+ import { d as u, m as d, o as te, t as f } from "./validation-BkUPqrdA.js";
6
+ import { t as ne } from "./useFieldErrors-hDG8ox_x.js";
7
+ import { a as re, i as ie, n as ae, r as p, t as oe } from "./PmGuard-DrbbysnW.js";
8
+ import { t as se } from "./MemberProfileCard-D9jepThR.js";
9
+ import { useMemo as m, useState as h } from "react";
10
+ import { Fragment as ce, jsx as g, jsxs as _ } from "react/jsx-runtime";
11
+ import { Alert as v, Box as le, Button as y, Card as b, CardContent as x, Divider as S, Grid as C, IconButton as ue, InputAdornment as w, Stack as T, TextField as E, Typography as D } from "@mui/material";
12
+ import { showToast as de } from "@/common/toaster/toaster";
13
+ import { v4 as O } from "uuid";
14
+ import fe from "@mui/icons-material/AddRounded";
15
+ import { useNavigate as pe, useParams as me } from "react-router-dom";
16
+ import he from "@mui/icons-material/SaveRounded";
17
+ import ge from "@mui/icons-material/DeleteOutlineRounded";
18
+ //#region src/views/SaleCreatePage.jsx
19
+ function k() {
20
+ return {
21
+ key: O(),
22
+ batchId: "",
23
+ quantity: 1,
24
+ salePrice: ""
25
+ };
26
+ }
27
+ function A() {
28
+ let A = pe(), { memberId: j } = me(), M = r(i()?.currencyCode), [N, _e] = h([]), [P, ve] = h([]), [ye, be] = h({}), [F, xe] = h(""), [I, L] = h(""), Se = ie().has("view.manage.productManagement.dues"), R = ne(), Ce = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10), [z, B] = h({
29
+ id: O(),
30
+ saleDate: Ce,
31
+ paymentMode: "CASH",
32
+ collectingNow: "",
33
+ notes: "",
34
+ items: [k()]
35
+ });
36
+ p("update.manage.productManagement.sale", () => {
37
+ async function n() {
38
+ try {
39
+ let [n, r, i] = await Promise.all([
40
+ e(),
41
+ t().catch(() => []),
42
+ Se ? a().catch(() => []) : Promise.resolve([])
43
+ ]);
44
+ _e(n), ve(r), be(Object.fromEntries((i ?? []).map((e) => [e.memberId, Number(e.totalDue)])));
45
+ } catch (e) {
46
+ L(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
47
+ }
48
+ }
49
+ n();
50
+ }, []);
51
+ let V = (e) => N.find((t) => t.id === e), we = (e) => P.find((t) => t.id === e), H = (e) => {
52
+ let t = V(e);
53
+ return t ? we(t.productId) : null;
54
+ };
55
+ function Te(e, t) {
56
+ let n = H(t);
57
+ B((r) => {
58
+ let i = r.items.slice(), a = {
59
+ ...i[e],
60
+ batchId: t
61
+ };
62
+ return n?.salePriceMode === "FIXED" && (a.salePrice = String(n.salePrice ?? "")), i[e] = a, {
63
+ ...r,
64
+ items: i
65
+ };
66
+ });
67
+ }
68
+ let U = m(() => {
69
+ let e = new Set(P.filter((e) => e.notForSale === !0).map((e) => e.id));
70
+ return N.filter((t) => !(t.qtyRemaining <= 0 || t.isQuarantined || e.has(t.productId) || ee(t.expiryDate)));
71
+ }, [N, P]);
72
+ function W(e, t, n) {
73
+ B((r) => {
74
+ let i = r.items.slice();
75
+ return i[e] = {
76
+ ...i[e],
77
+ [t]: n
78
+ }, {
79
+ ...r,
80
+ items: i
81
+ };
82
+ });
83
+ }
84
+ let G = m(() => z.items.reduce((e, t) => !t.salePrice || !t.quantity ? e : e + Number(t.salePrice) * Number(t.quantity), 0), [z.items]), K = Number(j ? ye[j] ?? 0 : 0), Ee = Number(z.collectingNow || 0), q = Math.min(Math.max(Ee, 0), G), J = Math.max(G - q, 0), Y = J + K, X = {
85
+ saleDate: d(z.saleDate, "Sale date"),
86
+ member: j ? "" : "No member selected"
87
+ }, Z = z.collectingNow === "" ? "" : u(z.collectingNow);
88
+ !Z && z.collectingNow !== "" && Number(z.collectingNow) > G ? X.collectingNow = `Cannot collect more than the sale amount (${l(G)}). Settle old dues via Payments.` : Z && (X.collectingNow = Z);
89
+ let De = new Set(U.map((e) => e.id)), Q = z.items.map((e) => {
90
+ let t = V(e.batchId), n = te(e.quantity, "Quantity", {
91
+ required: !0,
92
+ min: 1
93
+ });
94
+ !n && t && Number(e.quantity) > t.qtyRemaining && (n = `Only ${t.qtyRemaining} available in selected batch`);
95
+ let r = d(e.batchId, "Batch");
96
+ !r && e.batchId && !De.has(e.batchId) && (r = "Batch is not available for sale (expired, quarantined, out of stock, or not-for-sale).");
97
+ let i = H(e.batchId), a = i?.salePriceMode || "FREE", o = "";
98
+ return a === "FIXED" ? o = "" : (o = u(e.salePrice) || d(e.salePrice, "Unit price"), !o && a === "CAPPED" && i?.salePrice != null && Number(e.salePrice) > Number(i.salePrice) && (o = `Price cannot exceed the MRP (${M}${l(i.salePrice)}).`)), {
99
+ batchId: r,
100
+ quantity: n,
101
+ salePrice: o
102
+ };
103
+ }), $ = f(X) && Q.every(f) && z.items.length > 0 && G > 0;
104
+ async function Oe() {
105
+ if (!$) {
106
+ R.markAllTouched(), L("Please fix the highlighted fields and try again.");
107
+ return;
108
+ }
109
+ try {
110
+ await n({
111
+ id: z.id,
112
+ saleDate: z.saleDate,
113
+ memberId: j,
114
+ paymentMode: z.paymentMode || null,
115
+ totalAmount: Number(G.toFixed(2)),
116
+ paidAmount: Number(q.toFixed(2)),
117
+ dueAmount: Number(J.toFixed(2)),
118
+ notes: z.notes || null,
119
+ items: z.items.map((e) => {
120
+ let t = V(e.batchId), n = H(e.batchId), r = n?.salePriceMode === "FIXED" && n?.salePrice != null ? Number(n.salePrice) : Number(e.salePrice);
121
+ return {
122
+ batchId: e.batchId,
123
+ productId: t?.productId,
124
+ quantity: Number(e.quantity),
125
+ salePrice: r
126
+ };
127
+ })
128
+ }), de({
129
+ message: "Sale recorded.",
130
+ type: "success"
131
+ }), A("/ui/medplat/manage/pm/sales");
132
+ } catch (e) {
133
+ L(e?.response?.data?.message ?? e?.message ?? "Failed to record sale");
134
+ }
135
+ }
136
+ return /* @__PURE__ */ _(le, { children: [/* @__PURE__ */ g(ae, {}), /* @__PURE__ */ g(oe, {
137
+ perm: "update.manage.productManagement.sale",
138
+ title: "You don’t have permission to record sales",
139
+ children: /* @__PURE__ */ _(re, {
140
+ title: "Record Sale",
141
+ actions: /* @__PURE__ */ _(T, {
142
+ direction: "row",
143
+ spacing: 1,
144
+ children: [/* @__PURE__ */ g(y, {
145
+ variant: "outlined",
146
+ onClick: () => A("/ui/medplat/manage/pm/sales"),
147
+ children: "Cancel"
148
+ }), /* @__PURE__ */ g(y, {
149
+ variant: "contained",
150
+ startIcon: /* @__PURE__ */ g(he, {}),
151
+ disabled: !$,
152
+ onClick: () => void Oe(),
153
+ children: "Save"
154
+ })]
155
+ }),
156
+ children: [
157
+ I ? /* @__PURE__ */ g(v, {
158
+ severity: "error",
159
+ sx: { mb: 2 },
160
+ children: I
161
+ }) : null,
162
+ /* @__PURE__ */ g(b, {
163
+ sx: {
164
+ borderRadius: 1.5,
165
+ mb: 2,
166
+ border: "1px solid",
167
+ borderColor: "divider",
168
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
169
+ },
170
+ children: /* @__PURE__ */ _(x, {
171
+ sx: { p: 2.5 },
172
+ children: [/* @__PURE__ */ g(s, {
173
+ eyebrow: "Step 1",
174
+ title: "Customer",
175
+ hint: "The customer is set from the link you opened. Their balance shows below.",
176
+ sx: { mb: 2 }
177
+ }), j ? /* @__PURE__ */ g(se, {
178
+ memberId: j,
179
+ previousDue: K,
180
+ currencySymbol: M,
181
+ onLoad: (e) => xe(e?.name ?? "")
182
+ }) : /* @__PURE__ */ g(v, {
183
+ severity: "warning",
184
+ children: "No member selected"
185
+ })]
186
+ })
187
+ }),
188
+ /* @__PURE__ */ g(b, {
189
+ sx: {
190
+ borderRadius: 1.5,
191
+ mb: 2,
192
+ border: "1px solid",
193
+ borderColor: "divider",
194
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
195
+ },
196
+ children: /* @__PURE__ */ _(x, {
197
+ sx: { p: 2.5 },
198
+ children: [
199
+ /* @__PURE__ */ _(T, {
200
+ direction: "row",
201
+ justifyContent: "space-between",
202
+ alignItems: "flex-start",
203
+ sx: { mb: 2 },
204
+ children: [/* @__PURE__ */ g(s, {
205
+ eyebrow: "Step 2",
206
+ title: "Line items",
207
+ hint: "Each item comes from a batch. Buy price is shown as a cost reference."
208
+ }), /* @__PURE__ */ g(y, {
209
+ variant: "outlined",
210
+ startIcon: /* @__PURE__ */ g(fe, {}),
211
+ onClick: () => B({
212
+ ...z,
213
+ items: [...z.items, k()]
214
+ }),
215
+ children: "Add Line"
216
+ })]
217
+ }),
218
+ /* @__PURE__ */ g(S, { sx: { mb: 2 } }),
219
+ /* @__PURE__ */ g(T, {
220
+ spacing: 2,
221
+ children: z.items.map((e, t) => {
222
+ let n = V(e.batchId), r = Q[t] || {}, i = H(e.batchId), a = i?.salePriceMode || "FREE", s = i?.salePrice, c = e.salePrice && e.quantity ? Number(e.salePrice) * Number(e.quantity) : 0;
223
+ return /* @__PURE__ */ g(b, {
224
+ variant: "outlined",
225
+ sx: {
226
+ p: 2,
227
+ borderRadius: 1.5
228
+ },
229
+ children: /* @__PURE__ */ _(C, {
230
+ container: !0,
231
+ spacing: 2,
232
+ alignItems: "center",
233
+ children: [
234
+ /* @__PURE__ */ g(C, {
235
+ item: !0,
236
+ xs: 12,
237
+ md: 5,
238
+ children: /* @__PURE__ */ g(o, {
239
+ label: "Batch",
240
+ required: !0,
241
+ value: e.batchId,
242
+ onChange: (e) => Te(t, e),
243
+ onBlur: R.onBlur(`items.${t}.batchId`),
244
+ error: R.show(`items.${t}.batchId`) && !!r.batchId,
245
+ options: U.map((e) => ({
246
+ value: e.id,
247
+ label: `${e.productName} · lot ${e.lotNumber || "—"} · ${e.qtyRemaining} left`
248
+ })),
249
+ helperText: R.show(`items.${t}.batchId`) && r.batchId ? r.batchId : n?.buyPrice == null ? " " : `Buy price: ${M}${l(n.buyPrice)} / unit`
250
+ })
251
+ }),
252
+ /* @__PURE__ */ g(C, {
253
+ item: !0,
254
+ xs: 6,
255
+ md: 2,
256
+ children: /* @__PURE__ */ g(E, {
257
+ required: !0,
258
+ fullWidth: !0,
259
+ size: "small",
260
+ type: "number",
261
+ label: "Qty",
262
+ inputProps: {
263
+ min: 1,
264
+ max: n?.qtyRemaining
265
+ },
266
+ value: e.quantity,
267
+ onChange: (e) => W(t, "quantity", e.target.value),
268
+ onBlur: R.onBlur(`items.${t}.quantity`),
269
+ error: R.show(`items.${t}.quantity`) && !!r.quantity,
270
+ helperText: R.show(`items.${t}.quantity`) ? r.quantity : ""
271
+ })
272
+ }),
273
+ /* @__PURE__ */ g(C, {
274
+ item: !0,
275
+ xs: 6,
276
+ md: 2,
277
+ children: /* @__PURE__ */ g(E, {
278
+ required: !0,
279
+ fullWidth: !0,
280
+ size: "small",
281
+ type: "number",
282
+ disabled: a === "FIXED",
283
+ inputProps: {
284
+ step: "0.01",
285
+ min: 0,
286
+ ...a === "CAPPED" && s != null ? { max: s } : {}
287
+ },
288
+ label: a === "FIXED" ? "Unit Price (fixed)" : "Unit Price",
289
+ InputProps: { startAdornment: /* @__PURE__ */ g(w, {
290
+ position: "start",
291
+ children: M
292
+ }) },
293
+ value: a === "FIXED" ? s ?? "" : e.salePrice,
294
+ onChange: (e) => W(t, "salePrice", e.target.value),
295
+ onBlur: R.onBlur(`items.${t}.salePrice`),
296
+ error: R.show(`items.${t}.salePrice`) && !!r.salePrice,
297
+ helperText: R.show(`items.${t}.salePrice`) && r.salePrice ? r.salePrice : a === "FIXED" ? "Fixed price" : a === "CAPPED" && s != null ? `MRP: ${M}${l(s)}` : ""
298
+ })
299
+ }),
300
+ /* @__PURE__ */ _(C, {
301
+ item: !0,
302
+ xs: 6,
303
+ md: 2,
304
+ sx: { textAlign: "right" },
305
+ children: [/* @__PURE__ */ g(D, {
306
+ variant: "caption",
307
+ color: "text.secondary",
308
+ sx: { display: "block" },
309
+ children: "Subtotal"
310
+ }), /* @__PURE__ */ _(D, {
311
+ variant: "body1",
312
+ sx: {
313
+ fontWeight: 800,
314
+ fontVariantNumeric: "tabular-nums"
315
+ },
316
+ children: [M, l(c)]
317
+ })]
318
+ }),
319
+ /* @__PURE__ */ g(C, {
320
+ item: !0,
321
+ xs: 6,
322
+ md: 1,
323
+ sx: { textAlign: "right" },
324
+ children: /* @__PURE__ */ g(ue, {
325
+ color: "error",
326
+ onClick: () => B({
327
+ ...z,
328
+ items: z.items.filter((e, n) => n !== t)
329
+ }),
330
+ disabled: z.items.length === 1,
331
+ children: /* @__PURE__ */ g(ge, {})
332
+ })
333
+ })
334
+ ]
335
+ })
336
+ }, e.key);
337
+ })
338
+ })
339
+ ]
340
+ })
341
+ }),
342
+ /* @__PURE__ */ g(b, {
343
+ sx: {
344
+ borderRadius: 1.5,
345
+ bgcolor: "grey.50",
346
+ border: "1px solid",
347
+ borderColor: "divider",
348
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
349
+ },
350
+ children: /* @__PURE__ */ _(x, {
351
+ sx: { p: 2.5 },
352
+ children: [
353
+ /* @__PURE__ */ g(s, {
354
+ eyebrow: "Step 3",
355
+ title: "Bill summary",
356
+ hint: "Shows totals, previous balance, and what you're collecting. Any remainder becomes a note of what they owe.",
357
+ sx: { mb: 2 }
358
+ }),
359
+ /* @__PURE__ */ _(C, {
360
+ container: !0,
361
+ spacing: 2,
362
+ children: [
363
+ /* @__PURE__ */ g(C, {
364
+ item: !0,
365
+ xs: 12,
366
+ md: 4,
367
+ children: /* @__PURE__ */ g(E, {
368
+ required: !0,
369
+ fullWidth: !0,
370
+ size: "small",
371
+ type: "date",
372
+ label: "Date",
373
+ InputLabelProps: { shrink: !0 },
374
+ value: z.saleDate,
375
+ onChange: (e) => B({
376
+ ...z,
377
+ saleDate: e.target.value
378
+ }),
379
+ onBlur: R.onBlur("saleDate"),
380
+ error: R.show("saleDate") && !!X.saleDate,
381
+ helperText: R.show("saleDate") ? X.saleDate : ""
382
+ })
383
+ }),
384
+ /* @__PURE__ */ g(C, {
385
+ item: !0,
386
+ xs: 12,
387
+ md: 4,
388
+ children: /* @__PURE__ */ g(o, {
389
+ label: "Payment Mode",
390
+ value: z.paymentMode || "",
391
+ onChange: (e) => B({
392
+ ...z,
393
+ paymentMode: e
394
+ }),
395
+ options: c
396
+ })
397
+ }),
398
+ /* @__PURE__ */ g(C, {
399
+ item: !0,
400
+ xs: 12,
401
+ md: 4,
402
+ children: /* @__PURE__ */ g(E, {
403
+ fullWidth: !0,
404
+ size: "small",
405
+ label: "Notes",
406
+ value: z.notes,
407
+ onChange: (e) => B({
408
+ ...z,
409
+ notes: e.target.value
410
+ })
411
+ })
412
+ })
413
+ ]
414
+ }),
415
+ /* @__PURE__ */ g(S, { sx: { my: 2 } }),
416
+ /* @__PURE__ */ _(T, {
417
+ spacing: 1.25,
418
+ children: [
419
+ /* @__PURE__ */ _(T, {
420
+ direction: "row",
421
+ justifyContent: "space-between",
422
+ alignItems: "baseline",
423
+ children: [/* @__PURE__ */ _(D, {
424
+ variant: "body2",
425
+ color: "text.secondary",
426
+ children: [
427
+ "Sale Amount (",
428
+ z.items.length,
429
+ " ",
430
+ z.items.length === 1 ? "line" : "lines",
431
+ ")"
432
+ ]
433
+ }), /* @__PURE__ */ _(D, {
434
+ variant: "h5",
435
+ sx: {
436
+ fontWeight: 800,
437
+ fontVariantNumeric: "tabular-nums"
438
+ },
439
+ children: [M, l(G)]
440
+ })]
441
+ }),
442
+ /* @__PURE__ */ _(T, {
443
+ direction: "row",
444
+ justifyContent: "space-between",
445
+ alignItems: "baseline",
446
+ children: [/* @__PURE__ */ g(D, {
447
+ variant: "body2",
448
+ color: "text.secondary",
449
+ children: "Previous Due"
450
+ }), /* @__PURE__ */ _(D, {
451
+ variant: "body1",
452
+ sx: {
453
+ fontWeight: 700,
454
+ fontVariantNumeric: "tabular-nums",
455
+ color: K > 0 ? "warning.dark" : "text.primary"
456
+ },
457
+ children: [M, l(K)]
458
+ })]
459
+ }),
460
+ /* @__PURE__ */ g(S, { sx: { my: .5 } }),
461
+ /* @__PURE__ */ _(T, {
462
+ direction: "row",
463
+ justifyContent: "space-between",
464
+ alignItems: "center",
465
+ spacing: 2,
466
+ children: [/* @__PURE__ */ g(D, {
467
+ variant: "body2",
468
+ color: "text.secondary",
469
+ sx: { flexShrink: 0 },
470
+ children: "Amount Collecting Now"
471
+ }), /* @__PURE__ */ g(E, {
472
+ size: "small",
473
+ type: "number",
474
+ inputProps: {
475
+ step: "0.01",
476
+ min: 0,
477
+ max: G,
478
+ style: {
479
+ textAlign: "right",
480
+ fontWeight: 700
481
+ }
482
+ },
483
+ InputProps: { startAdornment: /* @__PURE__ */ g(w, {
484
+ position: "start",
485
+ children: M
486
+ }) },
487
+ sx: { width: 200 },
488
+ value: z.collectingNow,
489
+ placeholder: "0.00",
490
+ onChange: (e) => B({
491
+ ...z,
492
+ collectingNow: e.target.value
493
+ }),
494
+ onBlur: R.onBlur("collectingNow"),
495
+ error: R.show("collectingNow") && !!X.collectingNow,
496
+ helperText: R.show("collectingNow") ? X.collectingNow : ""
497
+ })]
498
+ }),
499
+ /* @__PURE__ */ _(T, {
500
+ direction: "row",
501
+ justifyContent: "space-between",
502
+ alignItems: "baseline",
503
+ children: [/* @__PURE__ */ g(D, {
504
+ variant: "body2",
505
+ color: "text.secondary",
506
+ children: "Remaining Due (after this sale)"
507
+ }), /* @__PURE__ */ _(D, {
508
+ variant: "h5",
509
+ sx: {
510
+ fontWeight: 800,
511
+ fontVariantNumeric: "tabular-nums",
512
+ color: Y > 0 ? "warning.dark" : "success.dark"
513
+ },
514
+ children: [M, l(Y)]
515
+ })]
516
+ })
517
+ ]
518
+ }),
519
+ j && Y > 0 ? /* @__PURE__ */ _(v, {
520
+ severity: "warning",
521
+ sx: { mt: 2 },
522
+ children: [
523
+ M,
524
+ l(Y),
525
+ " will be recorded as pending dues",
526
+ F ? /* @__PURE__ */ _(ce, { children: [
527
+ " ",
528
+ "for ",
529
+ /* @__PURE__ */ g("strong", { children: F })
530
+ ] }) : null,
531
+ J > 0 && K > 0 ? ` (${M}${l(J)} from this sale + ${M}${l(K)} previously outstanding).` : J > 0 ? " from this sale." : " from previously outstanding dues."
532
+ ]
533
+ }) : null
534
+ ]
535
+ })
536
+ })
537
+ ]
538
+ })
539
+ })] });
540
+ }
541
+ //#endregion
542
+ export { A as default };
543
+
544
+ //# sourceMappingURL=SaleCreatePage-CPyVj3Dh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SaleCreatePage-CPyVj3Dh.js","names":[],"sources":["../src/views/SaleCreatePage.jsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { useNavigate, useParams } from \"react-router-dom\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport {\n Alert,\n Box,\n Button,\n Card,\n CardContent,\n Divider,\n Grid,\n IconButton,\n InputAdornment,\n Stack,\n TextField,\n Typography,\n} from \"@mui/material\";\nimport AddRoundedIcon from \"@mui/icons-material/AddRounded\";\nimport DeleteOutlineRoundedIcon from \"@mui/icons-material/DeleteOutlineRounded\";\nimport SaveRoundedIcon from \"@mui/icons-material/SaveRounded\";\nimport { showToast } from \"@/common/toaster/toaster\";\nimport PmPageShell from \"@pm/components/PmPageShell\";\nimport PmNav from \"@pm/components/PmNav\";\nimport PmGuard from \"@pm/components/PmGuard\";\nimport { usePermissionedEffect, usePmPermissions } from \"@pm/utils/permissions\";\nimport {\n createSale,\n getMemberOutstandingDues,\n getProducts,\n listBatches,\n} from \"@pm/services/pmApi\";\nimport MemberProfileCard from \"@pm/components/MemberProfileCard\";\nimport { PAYMENT_MODES } from \"@pm/utils/constants\";\nimport { formatNumber, isPastExpiry } from \"@pm/utils/format\";\nimport { currencySymbol } from \"@pm/utils/currency\";\nimport { usePmSettings } from \"@pm/utils/settingsStore\";\nimport { PmFormSection, PmSelect } from \"@pm/components/PmTable\";\nimport {\n isClean,\n validateInteger,\n validatePrice,\n validateRequired,\n} from \"@pm/utils/validation\";\nimport { useFieldErrors } from \"@pm/utils/useFieldErrors\";\n\nfunction emptyLine() {\n return { key: uuidv4(), batchId: \"\", quantity: 1, salePrice: \"\" };\n}\n\nexport default function SaleCreatePage() {\n const navigate = useNavigate();\n const { memberId } = useParams();\n const settings = usePmSettings();\n const cur = currencySymbol(settings?.currencyCode);\n const [batches, setBatches] = useState([]);\n const [products, setProducts] = useState([]);\n // Map of memberId -> previousDue. The dues endpoint only returns members\n // with non-zero dues so the map stays small. Looked up by route memberId.\n const [duesByMember, setDuesByMember] = useState({});\n // Cached after MemberProfileCard fetches — used by the warning Alert that\n // references the member by name when remaining dues will be recorded.\n const [memberName, setMemberName] = useState(\"\");\n const [error, setError] = useState(\"\");\n const perms = usePmPermissions();\n // When the operator can't see dues, previousDue gracefully degrades to 0\n // instead of populating duesByMember from a 403'ing call.\n const canSeeDues = perms.has(\"view.manage.productManagement.dues\");\n const fieldErrors = useFieldErrors();\n const today = new Date().toISOString().substring(0, 10);\n const [form, setForm] = useState({\n id: uuidv4(),\n saleDate: today,\n paymentMode: \"CASH\",\n collectingNow: \"\",\n notes: \"\",\n items: [emptyLine()],\n });\n\n usePermissionedEffect(\n \"update.manage.productManagement.sale\",\n () => {\n async function load() {\n try {\n // Members are picked via async search now — no upfront load. Dues\n // come from the (aggregated) backend query and get attached to a\n // picked member by id.\n const [b, p, dues] = await Promise.all([\n listBatches(),\n getProducts().catch(() => []),\n // Silent degrade when the operator lacks the dues permission —\n // previousDue will stay 0 and the sale itself still works.\n canSeeDues\n ? getMemberOutstandingDues().catch(() => [])\n : Promise.resolve([]),\n ]);\n setBatches(b);\n setProducts(p);\n setDuesByMember(\n Object.fromEntries(\n (dues ?? []).map((d) => [d.memberId, Number(d.totalDue)]),\n ),\n );\n } catch (err) {\n setError(\n err?.response?.data?.message ??\n err?.message ??\n \"Failed to load reference data\",\n );\n }\n }\n void load();\n },\n [],\n );\n\n const batchById = (id) => batches.find((b) => b.id === id);\n const productById = (id) => products.find((p) => p.id === id);\n // The pricing product for a line (via its batch). Drives the sale-price\n // control: FIXED locks the price, CAPPED enforces an MRP, FREE is open.\n const productForBatch = (batchId) => {\n const b = batchById(batchId);\n return b ? productById(b.productId) : null;\n };\n\n // Selecting a batch also seeds the price for a FIXED-price product so the\n // totals/preview and payload are correct without the operator typing it.\n function selectBatch(idx, batchId) {\n const prod = productForBatch(batchId);\n setForm((f) => {\n const items = f.items.slice();\n const next = { ...items[idx], batchId };\n if (prod?.salePriceMode === 'FIXED') next.salePrice = String(prod.salePrice ?? '');\n items[idx] = next;\n return { ...f, items };\n });\n }\n\n // Batches that can be sold: stock on hand, not quarantined, not past expiry, and\n // the underlying product is not flagged as not-for-sale. Computed once per render.\n const sellableBatches = useMemo(() => {\n const notForSaleProductIds = new Set(\n products.filter((p) => p.notForSale === true).map((p) => p.id),\n );\n return batches.filter((b) => {\n if (b.qtyRemaining <= 0) return false;\n if (b.isQuarantined) return false;\n if (notForSaleProductIds.has(b.productId)) return false;\n // A batch is sellable on the day of its printed expiry; only the\n // following day counts as expired (matches the unit packaging rule).\n if (isPastExpiry(b.expiryDate)) return false;\n return true;\n });\n }, [batches, products]);\n\n function patchLine(idx, k, v) {\n setForm((f) => {\n const items = f.items.slice();\n items[idx] = { ...items[idx], [k]: v };\n return { ...f, items };\n });\n }\n\n // -------- Money math --------\n const saleAmount = useMemo(\n () =>\n form.items.reduce((sum, line) => {\n if (!line.salePrice || !line.quantity) return sum;\n return sum + Number(line.salePrice) * Number(line.quantity);\n }, 0),\n [form.items],\n );\n\n const previousDue = Number(memberId ? (duesByMember[memberId] ?? 0) : 0);\n const collectedRaw = Number(form.collectingNow || 0);\n // Clip the collected amount at the current sale's total — anything more would\n // need to be applied to the member's old dues, which is a separate Payment flow.\n const collected = Math.min(Math.max(collectedRaw, 0), saleAmount);\n const saleDue = Math.max(saleAmount - collected, 0);\n const remainingDue = saleDue + previousDue;\n\n // -------- Validation --------\n const headerErrors = {\n saleDate: validateRequired(form.saleDate, \"Sale date\"),\n member: memberId ? \"\" : \"No member selected\",\n };\n // Collecting Now: optional; if filled, must be a non-negative number ≤ sale amount.\n const collectingErr =\n form.collectingNow === \"\" ? \"\" : validatePrice(form.collectingNow);\n if (\n !collectingErr &&\n form.collectingNow !== \"\" &&\n Number(form.collectingNow) > saleAmount\n ) {\n headerErrors.collectingNow = `Cannot collect more than the sale amount (${formatNumber(saleAmount)}). Settle old dues via Payments.`;\n } else if (collectingErr) {\n headerErrors.collectingNow = collectingErr;\n }\n\n const sellableBatchIds = new Set(sellableBatches.map((b) => b.id));\n const lineErrors = form.items.map((line) => {\n const batch = batchById(line.batchId);\n const qty = validateInteger(line.quantity, \"Quantity\", {\n required: true,\n min: 1,\n });\n let qtyErr = qty;\n if (!qtyErr && batch && Number(line.quantity) > batch.qtyRemaining) {\n qtyErr = `Only ${batch.qtyRemaining} available in selected batch`;\n }\n let batchErr = validateRequired(line.batchId, \"Batch\");\n if (!batchErr && line.batchId && !sellableBatchIds.has(line.batchId)) {\n batchErr =\n \"Batch is not available for sale (expired, quarantined, out of stock, or not-for-sale).\";\n }\n // Sale-price validation depends on the product's pricing policy.\n const prod = productForBatch(line.batchId);\n const mode = prod?.salePriceMode || \"FREE\";\n let priceErr = \"\";\n if (mode === \"FIXED\") {\n priceErr = \"\"; // price is locked to the product's fixed price\n } else {\n priceErr =\n validatePrice(line.salePrice) ||\n validateRequired(line.salePrice, \"Unit price\");\n if (!priceErr && mode === \"CAPPED\" && prod?.salePrice != null\n && Number(line.salePrice) > Number(prod.salePrice)) {\n priceErr = `Price cannot exceed the MRP (${cur}${formatNumber(prod.salePrice)}).`;\n }\n }\n return {\n batchId: batchErr,\n quantity: qtyErr,\n salePrice: priceErr,\n };\n });\n const formIsValid =\n isClean(headerErrors) &&\n lineErrors.every(isClean) &&\n form.items.length > 0 &&\n saleAmount > 0;\n\n async function save() {\n if (!formIsValid) {\n fieldErrors.markAllTouched();\n setError(\"Please fix the highlighted fields and try again.\");\n return;\n }\n try {\n await createSale({\n id: form.id,\n saleDate: form.saleDate,\n memberId,\n paymentMode: form.paymentMode || null,\n totalAmount: Number(saleAmount.toFixed(2)),\n paidAmount: Number(collected.toFixed(2)),\n dueAmount: Number(saleDue.toFixed(2)),\n notes: form.notes || null,\n items: form.items.map((l) => {\n const batch = batchById(l.batchId);\n const prod = productForBatch(l.batchId);\n // FIXED products send the configured price (backend also enforces it).\n const price = prod?.salePriceMode === 'FIXED' && prod?.salePrice != null\n ? Number(prod.salePrice)\n : Number(l.salePrice);\n return {\n batchId: l.batchId,\n productId: batch?.productId,\n quantity: Number(l.quantity),\n salePrice: price,\n };\n }),\n });\n showToast({ message: \"Sale recorded.\", type: \"success\" });\n navigate(\"/ui/medplat/manage/pm/sales\");\n } catch (err) {\n setError(\n err?.response?.data?.message ?? err?.message ?? \"Failed to record sale\",\n );\n }\n }\n\n return (\n <Box>\n <PmNav />\n <PmGuard\n perm={\"update.manage.productManagement.sale\"}\n title=\"You don’t have permission to record sales\"\n >\n <PmPageShell\n title=\"Record Sale\"\n actions={\n <Stack direction=\"row\" spacing={1}>\n <Button\n variant=\"outlined\"\n onClick={() => navigate(\"/ui/medplat/manage/pm/sales\")}\n >\n Cancel\n </Button>\n <Button\n variant=\"contained\"\n startIcon={<SaveRoundedIcon />}\n disabled={!formIsValid}\n onClick={() => void save()}\n >\n Save\n </Button>\n </Stack>\n }\n >\n {error ? (\n <Alert severity=\"error\" sx={{ mb: 2 }}>\n {error}\n </Alert>\n ) : null}\n\n {/* ---------- Member ---------- */}\n <Card\n sx={{\n borderRadius: 1.5,\n mb: 2,\n border: \"1px solid\",\n borderColor: \"divider\",\n boxShadow: \"0 12px 32px rgba(15, 23, 42, 0.045)\",\n }}\n >\n <CardContent sx={{ p: 2.5 }}>\n <PmFormSection\n eyebrow=\"Step 1\"\n title=\"Customer\"\n hint=\"The customer is set from the link you opened. Their balance shows below.\"\n sx={{ mb: 2 }}\n />\n {memberId ? (\n <MemberProfileCard\n memberId={memberId}\n previousDue={previousDue}\n currencySymbol={cur}\n onLoad={(p) => setMemberName(p?.name ?? \"\")}\n />\n ) : (\n <Alert severity=\"warning\">No member selected</Alert>\n )}\n </CardContent>\n </Card>\n\n {/* ---------- Line items ---------- */}\n <Card\n sx={{\n borderRadius: 1.5,\n mb: 2,\n border: \"1px solid\",\n borderColor: \"divider\",\n boxShadow: \"0 12px 32px rgba(15, 23, 42, 0.045)\",\n }}\n >\n <CardContent sx={{ p: 2.5 }}>\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n sx={{ mb: 2 }}\n >\n <PmFormSection\n eyebrow=\"Step 2\"\n title=\"Line items\"\n hint=\"Each item comes from a batch. Buy price is shown as a cost reference.\"\n />\n <Button\n variant=\"outlined\"\n startIcon={<AddRoundedIcon />}\n onClick={() =>\n setForm({ ...form, items: [...form.items, emptyLine()] })\n }\n >\n Add Line\n </Button>\n </Stack>\n <Divider sx={{ mb: 2 }} />\n <Stack spacing={2}>\n {form.items.map((line, idx) => {\n const batch = batchById(line.batchId);\n const lerr = lineErrors[idx] || {};\n const lineProduct = productForBatch(line.batchId);\n const priceMode = lineProduct?.salePriceMode || \"FREE\";\n const priceCap = lineProduct?.salePrice;\n const subtotal =\n line.salePrice && line.quantity\n ? Number(line.salePrice) * Number(line.quantity)\n : 0;\n return (\n <Card\n key={line.key}\n variant=\"outlined\"\n sx={{ p: 2, borderRadius: 1.5 }}\n >\n <Grid container spacing={2} alignItems=\"center\">\n <Grid item xs={12} md={5}>\n <PmSelect\n label=\"Batch\"\n required\n value={line.batchId}\n onChange={(v) => selectBatch(idx, v)}\n onBlur={fieldErrors.onBlur(`items.${idx}.batchId`)}\n error={fieldErrors.show(`items.${idx}.batchId`) && !!lerr.batchId}\n options={sellableBatches.map((b) => ({\n value: b.id,\n label: `${b.productName} · lot ${b.lotNumber || \"—\"} · ${b.qtyRemaining} left`,\n }))}\n helperText={fieldErrors.show(`items.${idx}.batchId`) && lerr.batchId\n ? lerr.batchId\n : batch?.buyPrice != null\n ? `Buy price: ${cur}${formatNumber(batch.buyPrice)} / unit`\n : \" \"}\n />\n </Grid>\n <Grid item xs={6} md={2}>\n <TextField\n required\n fullWidth\n size=\"small\"\n type=\"number\"\n label=\"Qty\"\n inputProps={{ min: 1, max: batch?.qtyRemaining }}\n value={line.quantity}\n onChange={(e) =>\n patchLine(idx, \"quantity\", e.target.value)\n }\n onBlur={fieldErrors.onBlur(`items.${idx}.quantity`)}\n error={\n fieldErrors.show(`items.${idx}.quantity`) &&\n !!lerr.quantity\n }\n helperText={\n fieldErrors.show(`items.${idx}.quantity`)\n ? lerr.quantity\n : \"\"\n }\n />\n </Grid>\n <Grid item xs={6} md={2}>\n <TextField\n required\n fullWidth\n size=\"small\"\n type=\"number\"\n disabled={priceMode === \"FIXED\"}\n inputProps={{\n step: \"0.01\",\n min: 0,\n ...(priceMode === \"CAPPED\" && priceCap != null ? { max: priceCap } : {}),\n }}\n label={priceMode === \"FIXED\" ? \"Unit Price (fixed)\" : \"Unit Price\"}\n InputProps={{\n startAdornment: (\n <InputAdornment position=\"start\">\n {cur}\n </InputAdornment>\n ),\n }}\n value={priceMode === \"FIXED\" ? (priceCap ?? \"\") : line.salePrice}\n onChange={(e) =>\n patchLine(idx, \"salePrice\", e.target.value)\n }\n onBlur={fieldErrors.onBlur(\n `items.${idx}.salePrice`,\n )}\n error={\n fieldErrors.show(`items.${idx}.salePrice`) &&\n !!lerr.salePrice\n }\n helperText={\n fieldErrors.show(`items.${idx}.salePrice`) && lerr.salePrice\n ? lerr.salePrice\n : priceMode === \"FIXED\"\n ? \"Fixed price\"\n : priceMode === \"CAPPED\" && priceCap != null\n ? `MRP: ${cur}${formatNumber(priceCap)}`\n : \"\"\n }\n />\n </Grid>\n <Grid item xs={6} md={2} sx={{ textAlign: \"right\" }}>\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n sx={{ display: \"block\" }}\n >\n Subtotal\n </Typography>\n <Typography\n variant=\"body1\"\n sx={{\n fontWeight: 800,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n {cur}\n {formatNumber(subtotal)}\n </Typography>\n </Grid>\n <Grid item xs={6} md={1} sx={{ textAlign: \"right\" }}>\n <IconButton\n color=\"error\"\n onClick={() =>\n setForm({\n ...form,\n items: form.items.filter((_, i) => i !== idx),\n })\n }\n disabled={form.items.length === 1}\n >\n <DeleteOutlineRoundedIcon />\n </IconButton>\n </Grid>\n </Grid>\n </Card>\n );\n })}\n </Stack>\n </CardContent>\n </Card>\n\n {/* ---------- Bill Summary footer ---------- */}\n <Card\n sx={{\n borderRadius: 1.5,\n bgcolor: \"grey.50\",\n border: \"1px solid\",\n borderColor: \"divider\",\n boxShadow: \"0 12px 32px rgba(15, 23, 42, 0.045)\",\n }}\n >\n <CardContent sx={{ p: 2.5 }}>\n <PmFormSection\n eyebrow=\"Step 3\"\n title=\"Bill summary\"\n hint=\"Shows totals, previous balance, and what you're collecting. Any remainder becomes a note of what they owe.\"\n sx={{ mb: 2 }}\n />\n <Grid container spacing={2}>\n <Grid item xs={12} md={4}>\n <TextField\n required\n fullWidth\n size=\"small\"\n type=\"date\"\n label=\"Date\"\n InputLabelProps={{ shrink: true }}\n value={form.saleDate}\n onChange={(e) =>\n setForm({ ...form, saleDate: e.target.value })\n }\n onBlur={fieldErrors.onBlur(\"saleDate\")}\n error={\n fieldErrors.show(\"saleDate\") && !!headerErrors.saleDate\n }\n helperText={\n fieldErrors.show(\"saleDate\") ? headerErrors.saleDate : \"\"\n }\n />\n </Grid>\n <Grid item xs={12} md={4}>\n <PmSelect\n label=\"Payment Mode\"\n value={form.paymentMode || \"\"}\n onChange={(v) => setForm({ ...form, paymentMode: v })}\n options={PAYMENT_MODES}\n />\n </Grid>\n <Grid item xs={12} md={4}>\n <TextField\n fullWidth\n size=\"small\"\n label=\"Notes\"\n value={form.notes}\n onChange={(e) =>\n setForm({ ...form, notes: e.target.value })\n }\n />\n </Grid>\n </Grid>\n\n <Divider sx={{ my: 2 }} />\n\n <Stack spacing={1.25}>\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"baseline\"\n >\n <Typography variant=\"body2\" color=\"text.secondary\">\n Sale Amount ({form.items.length}{\" \"}\n {form.items.length === 1 ? \"line\" : \"lines\"})\n </Typography>\n <Typography\n variant=\"h5\"\n sx={{ fontWeight: 800, fontVariantNumeric: \"tabular-nums\" }}\n >\n {cur}\n {formatNumber(saleAmount)}\n </Typography>\n </Stack>\n\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"baseline\"\n >\n <Typography variant=\"body2\" color=\"text.secondary\">\n Previous Due\n </Typography>\n <Typography\n variant=\"body1\"\n sx={{\n fontWeight: 700,\n fontVariantNumeric: \"tabular-nums\",\n color: previousDue > 0 ? \"warning.dark\" : \"text.primary\",\n }}\n >\n {cur}\n {formatNumber(previousDue)}\n </Typography>\n </Stack>\n\n <Divider sx={{ my: 0.5 }} />\n\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={2}\n >\n <Typography\n variant=\"body2\"\n color=\"text.secondary\"\n sx={{ flexShrink: 0 }}\n >\n Amount Collecting Now\n </Typography>\n <TextField\n size=\"small\"\n type=\"number\"\n inputProps={{\n step: \"0.01\",\n min: 0,\n max: saleAmount,\n style: { textAlign: \"right\", fontWeight: 700 },\n }}\n InputProps={{\n startAdornment: (\n <InputAdornment position=\"start\">{cur}</InputAdornment>\n ),\n }}\n sx={{ width: 200 }}\n value={form.collectingNow}\n placeholder=\"0.00\"\n onChange={(e) =>\n setForm({ ...form, collectingNow: e.target.value })\n }\n onBlur={fieldErrors.onBlur(\"collectingNow\")}\n error={\n fieldErrors.show(\"collectingNow\") &&\n !!headerErrors.collectingNow\n }\n helperText={\n fieldErrors.show(\"collectingNow\")\n ? headerErrors.collectingNow\n : \"\"\n }\n />\n </Stack>\n\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"baseline\"\n >\n <Typography variant=\"body2\" color=\"text.secondary\">\n Remaining Due (after this sale)\n </Typography>\n <Typography\n variant=\"h5\"\n sx={{\n fontWeight: 800,\n fontVariantNumeric: \"tabular-nums\",\n color: remainingDue > 0 ? \"warning.dark\" : \"success.dark\",\n }}\n >\n {cur}\n {formatNumber(remainingDue)}\n </Typography>\n </Stack>\n </Stack>\n\n {memberId && remainingDue > 0 ? (\n <Alert severity=\"warning\" sx={{ mt: 2 }}>\n {cur}\n {formatNumber(remainingDue)} will be recorded as pending dues\n {memberName ? (\n <>\n {\" \"}\n for <strong>{memberName}</strong>\n </>\n ) : null}\n {saleDue > 0 && previousDue > 0\n ? ` (${cur}${formatNumber(saleDue)} from this sale + ${cur}${formatNumber(previousDue)} previously outstanding).`\n : saleDue > 0\n ? \" from this sale.\"\n : \" from previously outstanding dues.\"}\n </Alert>\n ) : null}\n </CardContent>\n </Card>\n </PmPageShell>\n </PmGuard>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6CA,SAAS,IAAY;CACnB,OAAO;EAAE,KAAK,EAAO;EAAG,SAAS;EAAI,UAAU;EAAG,WAAW;CAAG;AAClE;AAEA,SAAwB,IAAiB;CACvC,IAAM,IAAW,GAAY,GACvB,EAAE,gBAAa,GAAU,GAEzB,IAAM,EADK,EACU,CAAA,EAAU,YAAY,GAC3C,CAAC,GAAS,MAAc,EAAS,CAAC,CAAC,GACnC,CAAC,GAAU,MAAe,EAAS,C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AAe,IAC5B,EAAa,gBACb;UAEP,CAAA,CACI;;SAEP,kBAAC,GAAD;UACE,WAAU;UACV,gBAAe;UACf,YAAW;oBAHb,CAKE,kBAAC,GAAD;WAAY,SAAQ;WAAQ,OAAM;qBAAiB;UAEvC,CAAA,GACZ,kBAAC,GAAD;WACE,SAAQ;WACR,IAAI;YACF,YAAY;YACZ,oBAAoB;YACpB,OAAO,IAAe,IAAI,iBAAiB;WAC7C;qBANF,CAQG,GACA,EAAa,CAAY,CAChB;YACP;;QACF;;OAEN,KAAY,IAAe,IAC1B,kBAAC,GAAD;QAAO,UAAS;QAAU,IAAI,EAAE,IAAI,EAAE;kBAAtC;SACG;SACA,EAAa,CAAY;SAAE;SAC3B,IACC,kBAAA,IAAA,EAAA,UAAA;UACG;UAAI;UACD,kBAAC,UAAD,EAAA,UAAS,EAAmB,CAAA;SAChC,EAAA,CAAA,IACA;SACH,IAAU,KAAK,IAAc,IAC1B,KAAK,IAAM,EAAa,CAAO,EAAE,oBAAoB,IAAM,EAAa,CAAW,EAAE,6BACrF,IAAU,IACR,qBACA;QACD;YACL;MACO;;IACT,CAAA;GACK;;CACN,CAAA,CACN,EAAA,CAAA;AAET"}
@@ -1,7 +1,7 @@
1
- import { L as e, b as t, i as n, r } from "./settingsStore-KW217unV.js";
2
- import { a as i, c as a, i as o, s, t as ee } from "./PmTable-BkK65bJQ.js";
1
+ import { L as e, b as t, i as n, r } from "./settingsStore-GLCtI-tv.js";
2
+ import { a as i, c as a, i as o, s, t as ee } from "./PmTable-BMFiuHdG.js";
3
3
  import { r as c, t as l } from "./format-UOyOu75i.js";
4
- import { a as u, n as d, r as f, t as p } from "./PmGuard-C90yhpsN.js";
4
+ import { a as u, n as d, r as f, t as p } from "./PmGuard-DrbbysnW.js";
5
5
  import { useMemo as m, useState as h } from "react";
6
6
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
7
7
  import { Alert as v, Avatar as y, Box as b, Button as x, Chip as S, Skeleton as C, Stack as w, TableBody as T, TableCell as E, TableHead as D, TableRow as O, Typography as k } from "@mui/material";
@@ -312,4 +312,4 @@ function V() {
312
312
  //#endregion
313
313
  export { V as default };
314
314
 
315
- //# sourceMappingURL=SalesPage-CTBJMxZe.js.map
315
+ //# sourceMappingURL=SalesPage-BWpgPKz_.js.map