@argusoft/medplat-product-management 1.0.6 → 1.0.7

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 (98) hide show
  1. package/dist/{BrandsPage-DM5ZRz8L.js → BrandsPage-CdqGFmGf.js} +57 -58
  2. package/dist/BrandsPage-CdqGFmGf.js.map +1 -0
  3. package/dist/CategoriesPage-DJM0Nalw.js +392 -0
  4. package/dist/CategoriesPage-DJM0Nalw.js.map +1 -0
  5. package/dist/{DashboardPage-CW77OzUg.js → DashboardPage-BASkXr00.js} +14 -14
  6. package/dist/{DashboardPage-CW77OzUg.js.map → DashboardPage-BASkXr00.js.map} +1 -1
  7. package/dist/{FacilityPicker-C2drWyqo.js → FacilityPicker-jV-qXp1k.js} +8 -6
  8. package/dist/{FacilityPicker-C2drWyqo.js.map → FacilityPicker-jV-qXp1k.js.map} +1 -1
  9. package/dist/InventoryPage-CTdq6txa.js +658 -0
  10. package/dist/InventoryPage-CTdq6txa.js.map +1 -0
  11. package/dist/{MemberProfileCard-D9jepThR.js → MemberProfileCard-DwWda-tS.js} +3 -3
  12. package/dist/{MemberProfileCard-D9jepThR.js.map → MemberProfileCard-DwWda-tS.js.map} +1 -1
  13. package/dist/{PaymentCreatePage-DAUWv5RO.js → PaymentCreatePage-B3bP-K01.js} +137 -138
  14. package/dist/PaymentCreatePage-B3bP-K01.js.map +1 -0
  15. package/dist/{PaymentsPage-B6Fs2xey.js → PaymentsPage-Dh8bqXVE.js} +42 -43
  16. package/dist/PaymentsPage-Dh8bqXVE.js.map +1 -0
  17. package/dist/PickupBatchLinesEditor-B2fLx1lU.js +116 -0
  18. package/dist/PickupBatchLinesEditor-B2fLx1lU.js.map +1 -0
  19. package/dist/{PickupCreatePage-4ffB1_yq.js → PickupCreatePage-BeYhR45k.js} +301 -257
  20. package/dist/PickupCreatePage-BeYhR45k.js.map +1 -0
  21. package/dist/PickupsPage-C6lBtAoQ.js +814 -0
  22. package/dist/PickupsPage-C6lBtAoQ.js.map +1 -0
  23. package/dist/{PmGuard-DrbbysnW.js → PmGuard-DrIl1sHL.js} +2 -2
  24. package/dist/{PmGuard-DrbbysnW.js.map → PmGuard-DrIl1sHL.js.map} +1 -1
  25. package/dist/PmTable-BSV_bMJZ.js +545 -0
  26. package/dist/PmTable-BSV_bMJZ.js.map +1 -0
  27. package/dist/ProductEditPage-DZTUH95T.js +1295 -0
  28. package/dist/ProductEditPage-DZTUH95T.js.map +1 -0
  29. package/dist/{ProductsPage-DFgK9-13.js → ProductsPage-CqOsah4_.js} +61 -64
  30. package/dist/ProductsPage-CqOsah4_.js.map +1 -0
  31. package/dist/{PurchaseCreatePage-B1eV15aS.js → PurchaseCreatePage-D6os7srp.js} +210 -153
  32. package/dist/PurchaseCreatePage-D6os7srp.js.map +1 -0
  33. package/dist/PurchaseRequestDetailPage-DErqGKiq.js +1544 -0
  34. package/dist/PurchaseRequestDetailPage-DErqGKiq.js.map +1 -0
  35. package/dist/PurchaseRequestsPage-CHBoRzzH.js +280 -0
  36. package/dist/PurchaseRequestsPage-CHBoRzzH.js.map +1 -0
  37. package/dist/{PurchasesPage-Bsrqxvb1.js → PurchasesPage-C-2K7wH6.js} +40 -41
  38. package/dist/PurchasesPage-C-2K7wH6.js.map +1 -0
  39. package/dist/{SaleCreatePage-CPyVj3Dh.js → SaleCreatePage-DB3_UEgy.js} +117 -118
  40. package/dist/SaleCreatePage-DB3_UEgy.js.map +1 -0
  41. package/dist/{SalesPage-BWpgPKz_.js → SalesPage-BhBGG426.js} +89 -90
  42. package/dist/SalesPage-BhBGG426.js.map +1 -0
  43. package/dist/SettingsPage-CBUu9DZK.js +746 -0
  44. package/dist/SettingsPage-CBUu9DZK.js.map +1 -0
  45. package/dist/StorageUnitsPage-oe0lXLd1.js +719 -0
  46. package/dist/StorageUnitsPage-oe0lXLd1.js.map +1 -0
  47. package/dist/{TransactionsPage-DQBjCHoN.js → TransactionsPage-7dRZpZOD.js} +108 -83
  48. package/dist/TransactionsPage-7dRZpZOD.js.map +1 -0
  49. package/dist/{TransferCreatePage-DdVExUif.js → TransferCreatePage-DtkAlP9l.js} +73 -74
  50. package/dist/TransferCreatePage-DtkAlP9l.js.map +1 -0
  51. package/dist/{TransfersPage-C1qS9kNL.js → TransfersPage-BaEjbvnj.js} +67 -68
  52. package/dist/TransfersPage-BaEjbvnj.js.map +1 -0
  53. package/dist/{VialsPage-rTAYlXGZ.js → VialsPage-vo9Of9oC.js} +83 -84
  54. package/dist/VialsPage-vo9Of9oC.js.map +1 -0
  55. package/dist/constants-ClZJY2x1.js +405 -0
  56. package/dist/constants-ClZJY2x1.js.map +1 -0
  57. package/dist/index.js +582 -391
  58. package/dist/index.js.map +1 -1
  59. package/dist/{settingsStore-GLCtI-tv.js → settingsStore-BlA2GIhl.js} +89 -58
  60. package/dist/settingsStore-BlA2GIhl.js.map +1 -0
  61. package/dist/{validation-BkUPqrdA.js → validation-B6Kl5Xf9.js} +23 -22
  62. package/dist/validation-B6Kl5Xf9.js.map +1 -0
  63. package/package.json +1 -1
  64. package/dist/BrandsPage-DM5ZRz8L.js.map +0 -1
  65. package/dist/CategoriesPage-v7vz_i2N.js +0 -342
  66. package/dist/CategoriesPage-v7vz_i2N.js.map +0 -1
  67. package/dist/InventoryPage-_VWlqD2e.js +0 -686
  68. package/dist/InventoryPage-_VWlqD2e.js.map +0 -1
  69. package/dist/PaymentCreatePage-DAUWv5RO.js.map +0 -1
  70. package/dist/PaymentsPage-B6Fs2xey.js.map +0 -1
  71. package/dist/PickupCreatePage-4ffB1_yq.js.map +0 -1
  72. package/dist/PickupsPage-C-21LwTf.js +0 -604
  73. package/dist/PickupsPage-C-21LwTf.js.map +0 -1
  74. package/dist/PmTable-BMFiuHdG.js +0 -375
  75. package/dist/PmTable-BMFiuHdG.js.map +0 -1
  76. package/dist/ProductEditPage-BinNxjlB.js +0 -708
  77. package/dist/ProductEditPage-BinNxjlB.js.map +0 -1
  78. package/dist/ProductsPage-DFgK9-13.js.map +0 -1
  79. package/dist/PurchaseCreatePage-B1eV15aS.js.map +0 -1
  80. package/dist/PurchaseRequestDetailPage-52S6Nf7a.js +0 -588
  81. package/dist/PurchaseRequestDetailPage-52S6Nf7a.js.map +0 -1
  82. package/dist/PurchaseRequestsPage-DNNUnXy4.js +0 -266
  83. package/dist/PurchaseRequestsPage-DNNUnXy4.js.map +0 -1
  84. package/dist/PurchasesPage-Bsrqxvb1.js.map +0 -1
  85. package/dist/SaleCreatePage-CPyVj3Dh.js.map +0 -1
  86. package/dist/SalesPage-BWpgPKz_.js.map +0 -1
  87. package/dist/SettingsPage-Ch-37E5R.js +0 -663
  88. package/dist/SettingsPage-Ch-37E5R.js.map +0 -1
  89. package/dist/StorageUnitsPage-DF0MC356.js +0 -471
  90. package/dist/StorageUnitsPage-DF0MC356.js.map +0 -1
  91. package/dist/TransactionsPage-DQBjCHoN.js.map +0 -1
  92. package/dist/TransferCreatePage-DdVExUif.js.map +0 -1
  93. package/dist/TransfersPage-C1qS9kNL.js.map +0 -1
  94. package/dist/VialsPage-rTAYlXGZ.js.map +0 -1
  95. package/dist/constants-CdzV0PxZ.js +0 -270
  96. package/dist/constants-CdzV0PxZ.js.map +0 -1
  97. package/dist/settingsStore-GLCtI-tv.js.map +0 -1
  98. package/dist/validation-BkUPqrdA.js.map +0 -1
@@ -1,27 +1,29 @@
1
- import { E as e, G as t, O as n, k as r } from "./settingsStore-GLCtI-tv.js";
2
- import { o as i, r as a } from "./PmTable-BMFiuHdG.js";
3
- import { t as o } from "./format-UOyOu75i.js";
4
- import { a as s, n as c, r as l, t as u } from "./PmGuard-DrbbysnW.js";
5
- import { useMemo as d, useState as f } from "react";
6
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
7
- import { Alert as h, Autocomplete as g, Box as _, Button as v, Card as y, CardContent as b, Chip as x, Grid as S, Stack as C, TextField as w } from "@mui/material";
8
- import { showToast as T } from "@/common/toaster/toaster";
9
- import { v4 as E } from "uuid";
10
- import { useNavigate as D } from "react-router-dom";
11
- import ee from "@mui/icons-material/SaveRounded";
12
- import { DateTimePicker as O, LocalizationProvider as k } from "@mui/x-date-pickers";
13
- import { AdapterDayjs as A } from "@mui/x-date-pickers/AdapterDayjs";
1
+ import { A as e, F as t, P as n, Q as r, j as i, r as a } from "./settingsStore-BlA2GIhl.js";
2
+ import { l as o, r as s } from "./PmTable-BSV_bMJZ.js";
3
+ import { a as c, n as l, r as u, t as d } from "./PmGuard-DrIl1sHL.js";
4
+ import { i as f, n as p, r as m, t as h } from "./PickupBatchLinesEditor-B2fLx1lU.js";
5
+ import { useEffect as g, useMemo as _, useState as v } from "react";
6
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
7
+ import { Alert as x, Autocomplete as S, Box as C, Button as w, Card as T, CardContent as E, Divider as D, Grid as O, Stack as ee, TextField as k, ToggleButton as te, ToggleButtonGroup as ne, Typography as re } from "@mui/material";
8
+ import { v4 as A } from "uuid";
9
+ import ie from "@mui/icons-material/AddRounded";
10
+ import { useNavigate as ae } from "react-router-dom";
11
+ import oe from "@mui/icons-material/SaveRounded";
12
+ import se from "@mui/icons-material/GroupsRounded";
13
+ import { DateTimePicker as ce, LocalizationProvider as le } from "@mui/x-date-pickers";
14
+ import { AdapterDayjs as j } from "@mui/x-date-pickers/AdapterDayjs";
15
+ import ue from "@mui/icons-material/PersonRounded";
14
16
  //#region \0rolldown/runtime.js
15
- var j = Object.create, M = Object.defineProperty, N = Object.getOwnPropertyDescriptor, P = Object.getOwnPropertyNames, F = Object.getPrototypeOf, I = Object.prototype.hasOwnProperty, te = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), ne = (e, t, n, r) => {
16
- if (t && typeof t == "object" || typeof t == "function") for (var i = P(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !I.call(e, s) && s !== n && M(e, s, {
17
+ var M = Object.create, N = Object.defineProperty, de = Object.getOwnPropertyDescriptor, P = Object.getOwnPropertyNames, fe = Object.getPrototypeOf, F = Object.prototype.hasOwnProperty, I = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), L = (e, t, n, r) => {
18
+ if (t && typeof t == "object" || typeof t == "function") for (var i = P(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !F.call(e, s) && s !== n && N(e, s, {
17
19
  get: ((e) => t[e]).bind(null, s),
18
- enumerable: !(r = N(t, s)) || r.enumerable
20
+ enumerable: !(r = de(t, s)) || r.enumerable
19
21
  });
20
22
  return e;
21
- }, L = /* @__PURE__ */ ((e, t, n) => (n = e == null ? {} : j(F(e)), ne(t || !e || !e.__esModule ? M(n, "default", {
23
+ }, R = /* @__PURE__ */ ((e, t, n) => (n = e == null ? {} : M(fe(e)), L(t || !e || !e.__esModule || !F.call(e, "default") ? N(n, "default", {
22
24
  value: e,
23
25
  enumerable: !0
24
- }) : n, e)))((/* @__PURE__ */ te(((e, t) => {
26
+ }) : n, e)))((/* @__PURE__ */ I(((e, t) => {
25
27
  (function(n, r) {
26
28
  typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
27
29
  })(e, (function() {
@@ -316,130 +318,166 @@ var j = Object.create, M = Object.defineProperty, N = Object.getOwnPropertyDescr
316
318
  }, w.en = b[y], w.Ls = b, w.p = {}, w;
317
319
  }));
318
320
  })))(), 1);
319
- function re(e) {
320
- return !(e.ownerType !== "FACILITY" || Number(e.qtyRemaining ?? 0) <= 0 || e.status === "EXPIRED" || e.status === "EXHAUSTED" || e.status === "QUARANTINED");
321
+ function z() {
322
+ return p(A);
321
323
  }
322
- function ie() {
323
- let j = D(), [M, N] = f([]), [P, F] = f([]), [I, te] = f([]), [ne, ie] = f(!0), [ae, oe] = f(!1), [R, z] = f(""), [B, V] = f({
324
- id: E(),
325
- personalBatchId: E(),
324
+ function B() {
325
+ let p = ae(), M = a()?.allowGroupSessions === !0, [N, de] = v([]), [P, fe] = v([]), [F, I] = v([]), [L, B] = v([]), [pe, me] = v(!0), [V, H] = v(!1), [U, W] = v(""), [G, K] = v({
326
+ id: A(),
327
+ sessionType: "INDIVIDUAL",
326
328
  facilityId: "",
327
- sourceBatchId: "",
328
- pickedQty: 1,
329
+ memberUserIds: [],
330
+ lines: [z()],
329
331
  notes: "",
330
332
  sessionName: "",
331
333
  sessionDescription: "",
332
- sessionStartTime: (0, L.default)(),
334
+ sessionStartTime: (0, R.default)(),
333
335
  sessionExpectedEndTime: null,
334
336
  sessionSite: ""
335
337
  });
336
- l("update.manage.productManagement.pickup", () => {
337
- async function t() {
338
+ u("update.manage.productManagement.pickup", () => {
339
+ async function e() {
338
340
  try {
339
- let [t, i, a] = await Promise.all([
341
+ let [e, r, a] = await Promise.all([
340
342
  n(),
341
- e(),
342
- r().catch(() => [])
343
+ i(),
344
+ t().catch(() => [])
343
345
  ]);
344
- N(t), F(i), te(a);
346
+ de(e), fe(r), B(a);
345
347
  } catch (e) {
346
- z(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
348
+ W(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
347
349
  } finally {
348
- ie(!1);
350
+ me(!1);
349
351
  }
350
352
  }
351
- t();
352
- }, []);
353
- let H = I.length > 0, U = d(() => B.facilityId ? P.filter(re).filter((e) => e.ownerId === B.facilityId) : [], [P, B.facilityId]), W = d(() => P.find((e) => e.id === B.sourceBatchId) ?? null, [P, B.sourceBatchId]);
354
- function G(e, t) {
355
- V((n) => ({
353
+ e();
354
+ }, []), g(() => {
355
+ let t = !0;
356
+ if (!G.facilityId) {
357
+ I([]);
358
+ return;
359
+ }
360
+ return e(G.facilityId).then((e) => {
361
+ t && I(e);
362
+ }).catch(() => {
363
+ t && I([]);
364
+ }), () => {
365
+ t = !1;
366
+ };
367
+ }, [G.facilityId]);
368
+ let he = L.length > 0, q = M && G.sessionType === "GROUP", ge = _(() => G.facilityId ? P.filter(m).filter((e) => e.ownerId === G.facilityId) : [], [P, G.facilityId]);
369
+ function J(e, t) {
370
+ K((n) => ({
356
371
  ...n,
357
372
  [e]: t
358
373
  }));
359
374
  }
360
- function se(e) {
361
- V((t) => ({
375
+ function _e(e) {
376
+ K((t) => ({
362
377
  ...t,
363
378
  facilityId: e,
364
- sourceBatchId: ""
379
+ memberUserIds: [],
380
+ lines: [z()]
381
+ }));
382
+ }
383
+ function ve(e, t, n) {
384
+ K((r) => {
385
+ let i = r.lines.slice();
386
+ return i[e] = {
387
+ ...i[e],
388
+ [t]: n
389
+ }, {
390
+ ...r,
391
+ lines: i
392
+ };
393
+ });
394
+ }
395
+ function ye() {
396
+ K((e) => ({
397
+ ...e,
398
+ lines: [...e.lines, z()]
365
399
  }));
366
400
  }
367
- let K = Number(B.pickedQty), q = Number(W?.qtyRemaining ?? 0), J = W ? !Number.isInteger(K) || K <= 0 ? "Enter a whole number greater than 0." : K > q ? `Only ${q} available in this batch.` : "" : "", Y = B.sessionName.trim() ? "" : "Session name is required.", X = B.sessionStartTime && L.default.isDayjs(B.sessionStartTime) && B.sessionStartTime.isValid(), Z = X ? B.sessionStartTime.valueOf() < Date.now() - 300 * 1e3 ? "Start time cannot be in the past." : "" : "Start time is required.", Q = B.sessionExpectedEndTime && L.default.isDayjs(B.sessionExpectedEndTime) && B.sessionExpectedEndTime.isValid(), $ = Q ? X && !B.sessionExpectedEndTime.isAfter(B.sessionStartTime) ? "Expected end must be after the start time." : "" : "Expected end time is required.", ce = !!B.facilityId && !!B.sourceBatchId && !J && !H && !Y && !Z && !$;
368
- async function le() {
369
- if (ce) {
370
- oe(!0), z("");
401
+ function be(e) {
402
+ K((t) => ({
403
+ ...t,
404
+ lines: t.lines.filter((t, n) => n !== e)
405
+ }));
406
+ }
407
+ let xe = f(G.lines, ge), Se = G.lines.length > 0 && xe.every((e) => Object.keys(e).length === 0), Y = G.sessionName.trim() ? "" : "Session name is required.", X = G.sessionStartTime && R.default.isDayjs(G.sessionStartTime) && G.sessionStartTime.isValid(), Z = X ? G.sessionStartTime.valueOf() < Date.now() - 3e5 ? "Start time cannot be in the past." : "" : "Start time is required.", Ce = G.sessionExpectedEndTime && R.default.isDayjs(G.sessionExpectedEndTime) && G.sessionExpectedEndTime.isValid(), Q = Ce ? X && !G.sessionExpectedEndTime.isAfter(G.sessionStartTime) ? "Expected end must be after the start time." : "" : "Expected end time is required.", $ = q && G.memberUserIds.length === 0 ? "Pick at least one member for a group session." : "", we = !!G.facilityId && Se && !he && !Y && !Z && !Q && !$;
408
+ async function Te() {
409
+ if (we) {
410
+ H(!0), W("");
371
411
  try {
372
- await t({
373
- id: B.id,
374
- personalBatchId: B.personalBatchId,
375
- sourceBatchId: B.sourceBatchId,
376
- pickedQty: K,
377
- notes: B.notes || null,
378
- sessionName: B.sessionName.trim(),
379
- sessionDescription: B.sessionDescription.trim() || null,
380
- sessionStartTime: X ? B.sessionStartTime.toISOString() : null,
381
- sessionExpectedEndTime: Q ? B.sessionExpectedEndTime.toISOString() : null,
382
- sessionSite: B.sessionSite.trim() || null
383
- }), T({
384
- message: "Pickup recorded successfully",
412
+ await r({
413
+ id: G.id,
414
+ sessionType: q ? "GROUP" : "INDIVIDUAL",
415
+ memberUserIds: q ? G.memberUserIds : null,
416
+ lines: G.lines.map((e) => ({
417
+ sourceBatchId: e.sourceBatchId,
418
+ personalBatchId: e.personalBatchId,
419
+ pickedQty: Number(e.pickedQty)
420
+ })),
421
+ notes: G.notes || null,
422
+ sessionName: G.sessionName.trim(),
423
+ sessionDescription: G.sessionDescription.trim() || null,
424
+ sessionStartTime: X ? G.sessionStartTime.toISOString() : null,
425
+ sessionExpectedEndTime: Ce ? G.sessionExpectedEndTime.toISOString() : null,
426
+ sessionSite: G.sessionSite.trim() || null
427
+ }), o({
428
+ message: "Session started successfully",
385
429
  type: "success"
386
- }), j("/ui/medplat/manage/pm/pickups");
430
+ }), p("/ui/medplat/manage/pm/pickups");
387
431
  } catch (e) {
388
- z(e?.response?.data?.message ?? e?.message ?? "Failed to record pickup");
432
+ W(e?.response?.data?.message ?? e?.message ?? "Failed to start session");
389
433
  } finally {
390
- oe(!1);
434
+ H(!1);
391
435
  }
392
436
  }
393
437
  }
394
- return /* @__PURE__ */ m(_, { children: [/* @__PURE__ */ p(c, {}), /* @__PURE__ */ p(u, {
438
+ return /* @__PURE__ */ b(C, { children: [/* @__PURE__ */ y(l, {}), /* @__PURE__ */ y(d, {
395
439
  perm: "update.manage.productManagement.pickup",
396
440
  title: "You don’t have permission to record pickups",
397
- children: /* @__PURE__ */ m(s, {
398
- title: "Record Pickup",
399
- subtitle: "Check out stock from a facility for your field work. Record returns and wastage when you bring stock back.",
400
- actions: /* @__PURE__ */ m(C, {
441
+ children: /* @__PURE__ */ b(c, {
442
+ title: "Start Session",
443
+ subtitle: "Check out stock from a facility for field work. It can be your own session or a shared group session. Record returns and wastage when stock comes back.",
444
+ actions: /* @__PURE__ */ b(ee, {
401
445
  direction: "row",
402
446
  spacing: 1,
403
- children: [/* @__PURE__ */ p(v, {
447
+ children: [/* @__PURE__ */ y(w, {
404
448
  variant: "outlined",
405
- onClick: () => j("/ui/medplat/manage/pm/pickups"),
449
+ onClick: () => p("/ui/medplat/manage/pm/pickups"),
406
450
  children: "Cancel"
407
- }), /* @__PURE__ */ p(v, {
451
+ }), /* @__PURE__ */ y(w, {
408
452
  variant: "contained",
409
- startIcon: /* @__PURE__ */ p(ee, {}),
410
- disabled: !ce || ae,
411
- onClick: () => void le(),
412
- children: ae ? "Recording…" : "Record Pickup"
453
+ startIcon: /* @__PURE__ */ y(oe, {}),
454
+ disabled: !we || V,
455
+ onClick: () => void Te(),
456
+ children: V ? "Starting…" : "Start Session"
413
457
  })]
414
458
  }),
415
459
  children: [
416
- R ? /* @__PURE__ */ p(h, {
460
+ U ? /* @__PURE__ */ y(x, {
417
461
  severity: "error",
418
462
  sx: { mb: 2 },
419
- children: R
463
+ children: U
420
464
  }) : null,
421
- H ? /* @__PURE__ */ m(h, {
465
+ he ? /* @__PURE__ */ b(x, {
422
466
  severity: "warning",
423
467
  sx: { mb: 2 },
424
- action: /* @__PURE__ */ p(v, {
468
+ action: /* @__PURE__ */ y(w, {
425
469
  color: "inherit",
426
470
  size: "small",
427
- onClick: () => j("/ui/medplat/manage/pm/pickups"),
471
+ onClick: () => p("/ui/medplat/manage/pm/pickups"),
428
472
  children: "Go to Pickups"
429
473
  }),
430
474
  children: [
431
- "You already have ",
432
- /* @__PURE__ */ p("strong", { children: I.length }),
433
- " open outreach session",
434
- I.length === 1 ? "" : "s",
435
- ". End the active session",
436
- I.length === 1 ? "" : "s",
437
- " before starting a new pickup, or use ",
438
- /* @__PURE__ */ p("strong", { children: "Top Up" }),
439
- " on the Pickups page to add more stock to an active session."
475
+ "You are already part of an open session. End it before starting a new one, or use ",
476
+ /* @__PURE__ */ y("strong", { children: "Top Up" }),
477
+ " on the Pickups page to add more stock to it."
440
478
  ]
441
479
  }) : null,
442
- /* @__PURE__ */ p(y, {
480
+ /* @__PURE__ */ y(T, {
443
481
  sx: {
444
482
  borderRadius: 1.5,
445
483
  mb: 2,
@@ -447,57 +485,88 @@ function ie() {
447
485
  borderColor: "divider",
448
486
  boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
449
487
  },
450
- children: /* @__PURE__ */ m(b, {
488
+ children: /* @__PURE__ */ b(E, {
451
489
  sx: { p: 2.5 },
452
- children: [/* @__PURE__ */ p(a, {
453
- eyebrow: "Step 1",
454
- title: "Source",
455
- hint: "Select a facility and then the batch to pick up.",
456
- sx: { mb: 2 }
457
- }), /* @__PURE__ */ m(S, {
458
- container: !0,
459
- spacing: 2,
460
- children: [/* @__PURE__ */ p(S, {
461
- item: !0,
462
- xs: 12,
463
- md: 5,
464
- children: /* @__PURE__ */ p(g, {
465
- size: "small",
466
- options: M,
467
- getOptionLabel: (e) => e?.name ?? "",
468
- isOptionEqualToValue: (e, t) => e?.id === t?.id,
469
- value: M.find((e) => e.id === B.facilityId) ?? null,
470
- onChange: (e, t) => se(t?.id ?? ""),
471
- loading: ne,
472
- renderInput: (e) => /* @__PURE__ */ p(w, {
473
- ...e,
474
- required: !0,
475
- label: "Source Facility",
476
- placeholder: "Pick a facility you're assigned to"
490
+ children: [
491
+ /* @__PURE__ */ y(s, {
492
+ eyebrow: "Step 1",
493
+ title: M ? "Session type & source" : "Session source",
494
+ hint: M ? "Run the session yourself or share it with colleagues from the same facility." : "Pick the facility whose stock you are checking out for this outreach session.",
495
+ sx: { mb: 2 }
496
+ }),
497
+ M ? /* @__PURE__ */ b(ne, {
498
+ exclusive: !0,
499
+ size: "small",
500
+ color: "primary",
501
+ value: G.sessionType,
502
+ onChange: (e, t) => {
503
+ t && J("sessionType", t);
504
+ },
505
+ sx: { mb: 2 },
506
+ children: [/* @__PURE__ */ b(te, {
507
+ value: "INDIVIDUAL",
508
+ children: [/* @__PURE__ */ y(ue, {
509
+ fontSize: "small",
510
+ sx: { mr: .75 }
511
+ }), "Individual"]
512
+ }), /* @__PURE__ */ b(te, {
513
+ value: "GROUP",
514
+ children: [/* @__PURE__ */ y(se, {
515
+ fontSize: "small",
516
+ sx: { mr: .75 }
517
+ }), "Group"]
518
+ })]
519
+ }) : null,
520
+ /* @__PURE__ */ b(O, {
521
+ container: !0,
522
+ spacing: 2,
523
+ children: [/* @__PURE__ */ y(O, {
524
+ item: !0,
525
+ xs: 12,
526
+ md: q ? 5 : 12,
527
+ children: /* @__PURE__ */ y(S, {
528
+ size: "small",
529
+ options: N,
530
+ getOptionLabel: (e) => e?.name ?? "",
531
+ isOptionEqualToValue: (e, t) => e?.id === t?.id,
532
+ value: N.find((e) => e.id === G.facilityId) ?? null,
533
+ onChange: (e, t) => _e(t?.id ?? ""),
534
+ loading: pe,
535
+ renderInput: (e) => /* @__PURE__ */ y(k, {
536
+ ...e,
537
+ required: !0,
538
+ label: "Source Facility",
539
+ placeholder: "Pick a facility you're assigned to"
540
+ })
477
541
  })
478
- })
479
- }), /* @__PURE__ */ p(S, {
480
- item: !0,
481
- xs: 12,
482
- md: 7,
483
- children: /* @__PURE__ */ p(i, {
484
- label: "Source Batch",
485
- required: !0,
486
- disabled: !B.facilityId,
487
- value: B.sourceBatchId,
488
- onChange: (e) => G("sourceBatchId", e),
489
- options: U.map((e) => ({
490
- value: e.id,
491
- label: `${e.productName} · qty ${e.qtyRemaining}${e.lotNumber ? ` · ${e.lotNumber}` : ""}${e.expiryDate ? ` · exp ${o(e.expiryDate)}` : ""}`
492
- })),
493
- noOptionsText: "No pickable stock in this facility",
494
- helperText: B.facilityId ? U.length === 0 ? "This facility has no in-stock batches you can pick up right now." : "Active facility batches only — quarantined / expired / exhausted stock is hidden." : "Pick a facility first."
495
- })
496
- })]
497
- })]
542
+ }), q ? /* @__PURE__ */ y(O, {
543
+ item: !0,
544
+ xs: 12,
545
+ md: 7,
546
+ children: /* @__PURE__ */ y(S, {
547
+ multiple: !0,
548
+ size: "small",
549
+ disabled: !G.facilityId,
550
+ options: F,
551
+ getOptionLabel: (e) => e?.name ?? String(e?.id ?? ""),
552
+ isOptionEqualToValue: (e, t) => e?.id === t?.id,
553
+ value: F.filter((e) => G.memberUserIds.includes(e.id)),
554
+ onChange: (e, t) => J("memberUserIds", t.map((e) => e.id)),
555
+ renderInput: (e) => /* @__PURE__ */ y(k, {
556
+ ...e,
557
+ required: !0,
558
+ label: "Members",
559
+ placeholder: G.facilityId ? "Add colleagues" : "Pick a facility first",
560
+ error: !!$,
561
+ helperText: $ || "Anyone here can administer from the shared stock. You alone can end or top up the session."
562
+ })
563
+ })
564
+ }) : null]
565
+ })
566
+ ]
498
567
  })
499
568
  }),
500
- /* @__PURE__ */ p(y, {
569
+ /* @__PURE__ */ y(T, {
501
570
  sx: {
502
571
  borderRadius: 1.5,
503
572
  mb: 2,
@@ -505,202 +574,177 @@ function ie() {
505
574
  borderColor: "divider",
506
575
  boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
507
576
  },
508
- children: /* @__PURE__ */ m(b, {
577
+ children: /* @__PURE__ */ b(E, {
509
578
  sx: { p: 2.5 },
510
- children: [/* @__PURE__ */ p(a, {
579
+ children: [
580
+ /* @__PURE__ */ b(ee, {
581
+ direction: "row",
582
+ justifyContent: "space-between",
583
+ alignItems: "flex-start",
584
+ sx: { mb: 2 },
585
+ children: [/* @__PURE__ */ y(s, {
586
+ eyebrow: "Step 2",
587
+ title: "Batches",
588
+ hint: "Add one or more batches to take on this session. They can be the same vaccine (different lots) or different vaccines."
589
+ }), /* @__PURE__ */ y(w, {
590
+ variant: "outlined",
591
+ startIcon: /* @__PURE__ */ y(ie, {}),
592
+ disabled: !G.facilityId,
593
+ onClick: ye,
594
+ children: "Add Batch"
595
+ })]
596
+ }),
597
+ /* @__PURE__ */ y(D, { sx: { mb: 2 } }),
598
+ G.facilityId ? /* @__PURE__ */ y(h, {
599
+ lines: G.lines,
600
+ batches: ge,
601
+ errors: xe,
602
+ onPatch: ve,
603
+ onRemove: be
604
+ }) : /* @__PURE__ */ y(re, {
605
+ variant: "body2",
606
+ color: "text.secondary",
607
+ children: "Pick a facility first to choose batches."
608
+ })
609
+ ]
610
+ })
611
+ }),
612
+ /* @__PURE__ */ y(T, {
613
+ sx: {
614
+ borderRadius: 1.5,
615
+ mb: 2,
616
+ border: "1px solid",
617
+ borderColor: "divider",
618
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
619
+ },
620
+ children: /* @__PURE__ */ b(E, {
621
+ sx: { p: 2.5 },
622
+ children: [/* @__PURE__ */ y(s, {
511
623
  eyebrow: "Session",
512
624
  title: "Outreach session details",
513
- hint: "Records the purpose, timing and location of this outreach session. Shown when administering from this stock.",
625
+ hint: "Records the purpose, timing and location of this session. Shown when administering from this stock.",
514
626
  sx: { mb: 2 }
515
- }), /* @__PURE__ */ m(S, {
627
+ }), /* @__PURE__ */ b(O, {
516
628
  container: !0,
517
629
  spacing: 2,
518
630
  children: [
519
- /* @__PURE__ */ p(S, {
631
+ /* @__PURE__ */ y(O, {
520
632
  item: !0,
521
633
  xs: 12,
522
634
  md: 6,
523
- children: /* @__PURE__ */ p(w, {
635
+ children: /* @__PURE__ */ y(k, {
524
636
  required: !0,
525
637
  fullWidth: !0,
526
638
  size: "small",
527
639
  label: "Session name",
528
640
  inputProps: { maxLength: 150 },
529
- value: B.sessionName,
530
- onChange: (e) => G("sessionName", e.target.value),
531
- error: !!Y && B.sessionName !== "",
532
- helperText: B.sessionName === "" ? "e.g. Anganwadi camp – Ward 4" : Y
641
+ value: G.sessionName,
642
+ onChange: (e) => J("sessionName", e.target.value),
643
+ error: !!Y && G.sessionName !== "",
644
+ helperText: G.sessionName === "" ? "e.g. Anganwadi camp – Ward 4" : Y
533
645
  })
534
646
  }),
535
- /* @__PURE__ */ p(S, {
647
+ /* @__PURE__ */ y(O, {
536
648
  item: !0,
537
649
  xs: 12,
538
650
  md: 6,
539
- children: /* @__PURE__ */ p(w, {
651
+ children: /* @__PURE__ */ y(k, {
540
652
  fullWidth: !0,
541
653
  size: "small",
542
654
  label: "Session site (optional)",
543
655
  placeholder: "Location / site reference",
544
656
  inputProps: { maxLength: 200 },
545
- value: B.sessionSite,
546
- onChange: (e) => G("sessionSite", e.target.value)
657
+ value: G.sessionSite,
658
+ onChange: (e) => J("sessionSite", e.target.value)
547
659
  })
548
660
  }),
549
- /* @__PURE__ */ p(S, {
661
+ /* @__PURE__ */ y(O, {
550
662
  item: !0,
551
663
  xs: 12,
552
664
  md: 6,
553
- children: /* @__PURE__ */ p(k, {
554
- dateAdapter: A,
665
+ children: /* @__PURE__ */ y(le, {
666
+ dateAdapter: j,
555
667
  adapterLocale: "en",
556
- children: /* @__PURE__ */ p(O, {
668
+ children: /* @__PURE__ */ y(ce, {
557
669
  label: "Start time",
558
- value: B.sessionStartTime,
559
- onChange: (e) => G("sessionStartTime", e),
670
+ value: G.sessionStartTime,
671
+ onChange: (e) => J("sessionStartTime", e),
560
672
  ampm: !1,
561
- minDateTime: (0, L.default)().subtract(5, "minute"),
673
+ minDateTime: (0, R.default)().subtract(5, "minute"),
562
674
  slotProps: {
563
675
  actionBar: { actions: ["clear"] },
564
676
  textField: {
565
677
  size: "small",
566
678
  fullWidth: !0,
567
679
  required: !0,
568
- error: !!Z && B.sessionStartTime !== null,
569
- helperText: B.sessionStartTime !== null && Z || "Cannot be in the past. (5 minutes buffer allowed)"
680
+ error: !!Z && G.sessionStartTime !== null,
681
+ helperText: G.sessionStartTime !== null && Z || "Cannot be in the past. (5 minutes buffer allowed)"
570
682
  }
571
683
  }
572
684
  })
573
685
  })
574
686
  }),
575
- /* @__PURE__ */ p(S, {
687
+ /* @__PURE__ */ y(O, {
576
688
  item: !0,
577
689
  xs: 12,
578
690
  md: 6,
579
- children: /* @__PURE__ */ p(k, {
580
- dateAdapter: A,
691
+ children: /* @__PURE__ */ y(le, {
692
+ dateAdapter: j,
581
693
  adapterLocale: "en",
582
- children: /* @__PURE__ */ p(O, {
694
+ children: /* @__PURE__ */ y(ce, {
583
695
  label: "Expected End Time",
584
- value: B.sessionExpectedEndTime,
585
- onChange: (e) => G("sessionExpectedEndTime", e),
696
+ value: G.sessionExpectedEndTime,
697
+ onChange: (e) => J("sessionExpectedEndTime", e),
586
698
  ampm: !1,
587
- minDateTime: X ? B.sessionStartTime : void 0,
699
+ minDateTime: X ? G.sessionStartTime : void 0,
588
700
  slotProps: {
589
701
  actionBar: { actions: ["clear"] },
590
702
  textField: {
591
703
  size: "small",
592
704
  fullWidth: !0,
593
705
  required: !0,
594
- error: !!$ && B.sessionExpectedEndTime !== null,
595
- helperText: B.sessionExpectedEndTime !== null && $ || "When the session is expected to end."
706
+ error: !!Q && G.sessionExpectedEndTime !== null,
707
+ helperText: G.sessionExpectedEndTime !== null && Q || "When the session is expected to end."
596
708
  }
597
709
  }
598
710
  })
599
711
  })
600
712
  }),
601
- /* @__PURE__ */ p(S, {
713
+ /* @__PURE__ */ y(O, {
714
+ item: !0,
715
+ xs: 12,
716
+ md: 6,
717
+ children: /* @__PURE__ */ y(k, {
718
+ fullWidth: !0,
719
+ size: "small",
720
+ label: "Notes (optional)",
721
+ placeholder: "Anything worth recording about this session",
722
+ value: G.notes,
723
+ onChange: (e) => J("notes", e.target.value)
724
+ })
725
+ }),
726
+ /* @__PURE__ */ y(O, {
602
727
  item: !0,
603
728
  xs: 12,
604
- children: /* @__PURE__ */ p(w, {
729
+ children: /* @__PURE__ */ y(k, {
605
730
  fullWidth: !0,
606
731
  size: "small",
607
732
  multiline: !0,
608
733
  minRows: 2,
609
734
  label: "Purpose / description (optional)",
610
- value: B.sessionDescription,
611
- onChange: (e) => G("sessionDescription", e.target.value)
735
+ value: G.sessionDescription,
736
+ onChange: (e) => J("sessionDescription", e.target.value)
612
737
  })
613
738
  })
614
739
  ]
615
740
  })]
616
741
  })
617
- }),
618
- W ? /* @__PURE__ */ p(y, {
619
- sx: {
620
- borderRadius: 1.5,
621
- mb: 2,
622
- border: "1px solid",
623
- borderColor: "divider",
624
- boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
625
- },
626
- children: /* @__PURE__ */ m(b, {
627
- sx: { p: 2.5 },
628
- children: [
629
- /* @__PURE__ */ p(a, {
630
- eyebrow: "Step 2",
631
- title: "Quantity",
632
- hint: `Available: ${q}. You can pick up to this amount.`,
633
- sx: { mb: 2 }
634
- }),
635
- /* @__PURE__ */ m(S, {
636
- container: !0,
637
- spacing: 2,
638
- children: [/* @__PURE__ */ p(S, {
639
- item: !0,
640
- xs: 12,
641
- md: 4,
642
- children: /* @__PURE__ */ p(w, {
643
- required: !0,
644
- fullWidth: !0,
645
- size: "small",
646
- type: "number",
647
- label: "Pick Quantity",
648
- inputProps: {
649
- min: 1,
650
- max: q
651
- },
652
- value: B.pickedQty,
653
- onChange: (e) => G("pickedQty", e.target.value),
654
- error: !!J,
655
- helperText: J || `Out of ${q} available`
656
- })
657
- }), /* @__PURE__ */ p(S, {
658
- item: !0,
659
- xs: 12,
660
- md: 8,
661
- children: /* @__PURE__ */ p(w, {
662
- fullWidth: !0,
663
- size: "small",
664
- label: "Notes (optional)",
665
- placeholder: "Anything worth recording about this pickup",
666
- value: B.notes,
667
- onChange: (e) => G("notes", e.target.value)
668
- })
669
- })]
670
- }),
671
- /* @__PURE__ */ m(C, {
672
- direction: "row",
673
- spacing: 1,
674
- sx: { mt: 2 },
675
- flexWrap: "wrap",
676
- useFlexGap: !0,
677
- children: [
678
- /* @__PURE__ */ p(x, {
679
- size: "small",
680
- label: `Product · ${W.productName}`
681
- }),
682
- W.lotNumber ? /* @__PURE__ */ p(x, {
683
- size: "small",
684
- label: `Lot · ${W.lotNumber}`
685
- }) : null,
686
- W.expiryDate ? /* @__PURE__ */ p(x, {
687
- size: "small",
688
- label: `Expiry · ${o(W.expiryDate)}`
689
- }) : null,
690
- W.storageUnitName ? /* @__PURE__ */ p(x, {
691
- size: "small",
692
- label: `From · ${W.storageUnitName}`
693
- }) : null
694
- ]
695
- })
696
- ]
697
- })
698
- }) : null
742
+ })
699
743
  ]
700
744
  })
701
745
  })] });
702
746
  }
703
747
  //#endregion
704
- export { ie as default };
748
+ export { B as default };
705
749
 
706
- //# sourceMappingURL=PickupCreatePage-4ffB1_yq.js.map
750
+ //# sourceMappingURL=PickupCreatePage-BeYhR45k.js.map