@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 +1 @@
1
- {"version":3,"file":"FacilityPicker-C2drWyqo.js","names":[],"sources":["../src/components/FacilityPicker.jsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { Autocomplete, CircularProgress, TextField } from '@mui/material';\nimport { getFacilitiesByIds, listFacilities } from '@pm/services/pmApi';\n\n// Synchronous facility picker. The backend now scopes /pm/facilities to the\n// current operator's assigned set (joined off user_health_infrastructure),\n// which is small — typically a handful of facilities — so we just fetch the\n// whole list once and let MUI's default client-side filter handle search.\n//\n// `value` is the facility id (string). Editing a saved row whose facility is\n// no longer in the assigned set (e.g. assignment was revoked) is supported\n// via /facilities/by-ids hydration so the picker still shows a name.\nexport default function FacilityPicker({\n value,\n onChange,\n label = 'Facility',\n required = false,\n disabled = false,\n error = false,\n helperText = '',\n onBlur,\n size = 'small',\n fullWidth = true,\n}) {\n const [open, setOpen] = useState(false);\n const [facilities, setFacilities] = useState([]);\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [selectedFacility, setSelectedFacility] = useState(null);\n\n // Hydrate the selected facility's name when `value` changes. Tries the\n // already-loaded assigned list first, then /by-ids as a fallback so a\n // facility that's no longer assigned still resolves to a name on edit.\n useEffect(() => {\n if (!value) {\n setSelectedFacility(null);\n return undefined;\n }\n if (selectedFacility?.id === value) return undefined;\n const fromAssigned = facilities.find((f) => f.id === value);\n if (fromAssigned) {\n setSelectedFacility(fromAssigned);\n return undefined;\n }\n let cancelled = false;\n (async () => {\n try {\n const found = await getFacilitiesByIds([value]);\n if (!cancelled && found[0]) setSelectedFacility(found[0]);\n } catch {\n // Leave the picker showing a raw id rather than crashing — operator\n // can still re-pick.\n }\n })();\n return () => { cancelled = true; };\n // facilities is intentionally excluded from the dep array so the picker\n // doesn't re-hydrate every time the list loads; the in-list lookup runs\n // synchronously on each render anyway.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n // Load the assigned-facility list once on first open. The list isn't huge\n // and the backend scopes it; no point in pre-fetching at mount.\n useEffect(() => {\n if (!open || loaded) return undefined;\n let cancelled = false;\n setLoading(true);\n (async () => {\n try {\n const rows = await listFacilities();\n if (!cancelled) setFacilities(rows);\n } catch {\n if (!cancelled) setFacilities([]);\n } finally {\n if (!cancelled) {\n setLoading(false);\n setLoaded(true);\n }\n }\n })();\n return () => { cancelled = true; };\n }, [open, loaded]);\n\n // Make sure the currently-selected facility is in the option set so the\n // Autocomplete can render its label without an out-of-range warning.\n const displayedOptions = useMemo(() => {\n if (!selectedFacility) return facilities;\n if (facilities.some((o) => o.id === selectedFacility.id)) return facilities;\n return [selectedFacility, ...facilities];\n }, [facilities, selectedFacility]);\n\n const noOptionsText = loading\n ? 'Loading…'\n : loaded && facilities.length === 0\n ? 'No facilities assigned to your account'\n : 'No matches';\n\n const defaultHelper = 'Only facilities assigned to your account are shown. Type to filter.';\n\n return (\n <Autocomplete\n size={size}\n fullWidth={fullWidth}\n disabled={disabled}\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n value={selectedFacility}\n isOptionEqualToValue={(a, b) => a?.id === b?.id}\n getOptionLabel={(o) => o?.name ?? ''}\n options={displayedOptions}\n loading={loading}\n onChange={(_, next) => {\n setSelectedFacility(next ?? null);\n onChange?.(next?.id ?? '');\n }}\n noOptionsText={noOptionsText}\n renderInput={(params) => (\n <TextField\n {...params}\n required={required}\n label={label}\n error={error}\n helperText={helperText || defaultHelper}\n onBlur={onBlur}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {loading ? <CircularProgress color=\"inherit\" size={16} /> : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n />\n );\n}\n"],"mappings":";;;;;AAYA,SAAwB,EAAe,EACrC,UACA,aACA,WAAQ,YACR,cAAW,IACX,cAAW,IACX,WAAQ,IACR,gBAAa,IACb,WACA,UAAO,SACP,eAAY,MACX;CACD,IAAM,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,CAAC,GAAY,KAAiB,EAAS,CAAC,CAAC,GACzC,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,CAAC,GAAkB,KAAuB,EAAS,IAAI;CAuE7D,OAlEA,QAAgB;EACd,IAAI,CAAC,GAAO;GACV,EAAoB,IAAI;GACxB;EACF;EACA,IAAI,GAAkB,OAAO,GAAO;EACpC,IAAM,IAAe,EAAW,MAAM,MAAM,EAAE,OAAO,CAAK;EAC1D,IAAI,GAAc;GAChB,EAAoB,CAAY;GAChC;EACF;EACA,IAAI,IAAY;EAUhB,QATC,YAAY;GACX,IAAI;IACF,IAAM,IAAQ,MAAM,EAAmB,CAAC,CAAK,CAAC;IAC9C,AAAI,CAAC,KAAa,EAAM,MAAI,EAAoB,EAAM,EAAE;GAC1D,QAAQ,CAGR;EACF,EAAA,CAAG,SACU;GAAE,IAAY;EAAM;CAKnC,GAAG,CAAC,CAAK,CAAC,GAIV,QAAgB;EACd,IAAI,CAAC,KAAQ,GAAQ;EACrB,IAAI,IAAY;EAehB,OAdA,EAAW,EAAI,IACd,YAAY;GACX,IAAI;IACF,IAAM,IAAO,MAAM,EAAe;IAClC,AAAK,KAAW,EAAc,CAAI;GACpC,QAAQ;IACN,AAAK,KAAW,EAAc,CAAC,CAAC;GAClC,UAAU;IACR,AAAK,MACH,EAAW,EAAK,GAChB,EAAU,EAAI;GAElB;EACF,EAAA,CAAG,SACU;GAAE,IAAY;EAAM;CACnC,GAAG,CAAC,GAAM,CAAM,CAAC,GAmBf,kBAAC,GAAD;EACQ;EACK;EACD;EACJ;EACN,cAAc,EAAQ,EAAI;EAC1B,eAAe,EAAQ,EAAK;EAC5B,OAAO;EACP,uBAAuB,GAAG,MAAM,GAAG,OAAO,GAAG;EAC7C,iBAAiB,MAAM,GAAG,QAAQ;EAClC,SAzBqB,QACnB,CAAC,KACD,EAAW,MAAM,MAAM,EAAE,OAAO,EAAiB,EAAE,IAAU,IAC1D,CAAC,GAAkB,GAAG,CAAU,GACtC,CAAC,GAAY,CAAgB,CAqBnB;EACA;EACT,WAAW,GAAG,MAAS;GAErB,AADA,EAAoB,KAAQ,IAAI,GAChC,IAAW,GAAM,MAAM,EAAE;EAC3B;EACe,eAzBG,IAClB,aACA,KAAU,EAAW,WAAW,IAC9B,2CACA;EAsBF,cAAc,MACZ,kBAAC,GAAD;GACE,GAAI;GACM;GACH;GACA;GACP,YAAY,KAAc;GAClB;GACR,YAAY;IACV,GAAG,EAAO;IACV,cACE,kBAAA,GAAA,EAAA,UAAA,CACG,IAAU,kBAAC,GAAD;KAAkB,OAAM;KAAU,MAAM;IAAK,CAAA,IAAI,MAC3D,EAAO,WAAW,YACnB,EAAA,CAAA;GAEN;EACD,CAAA;CAEJ,CAAA;AAEL"}
1
+ {"version":3,"file":"FacilityPicker-jV-qXp1k.js","names":[],"sources":["../src/components/FacilityPicker.jsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { Autocomplete, CircularProgress, TextField } from '@mui/material';\nimport { getFacilitiesByIds, listFacilities } from '@pm/services/pmApi';\n\n// Synchronous facility picker. The backend now scopes /pm/facilities to the\n// current operator's assigned set (joined off user_health_infrastructure),\n// which is small — typically a handful of facilities — so we just fetch the\n// whole list once and let MUI's default client-side filter handle search.\n//\n// `value` is the facility id (string). Editing a saved row whose facility is\n// no longer in the assigned set (e.g. assignment was revoked) is supported\n// via /facilities/by-ids hydration so the picker still shows a name.\nexport default function FacilityPicker({\n value,\n onChange,\n label = 'Facility',\n required = false,\n disabled = false,\n error = false,\n helperText = '',\n onBlur,\n size = 'small',\n fullWidth = true,\n}) {\n const [open, setOpen] = useState(false);\n const [facilities, setFacilities] = useState([]);\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [selectedFacility, setSelectedFacility] = useState(null);\n\n // Hydrate the selected facility's name when `value` changes. Tries the\n // already-loaded assigned list first, then /by-ids as a fallback so a\n // facility that's no longer assigned still resolves to a name on edit.\n useEffect(() => {\n if (!value) {\n setSelectedFacility(null);\n return undefined;\n }\n if (selectedFacility?.id === value) return undefined;\n const fromAssigned = facilities.find((f) => f.id === value);\n if (fromAssigned) {\n setSelectedFacility(fromAssigned);\n return undefined;\n }\n let cancelled = false;\n (async () => {\n try {\n const found = await getFacilitiesByIds([value]);\n if (!cancelled && found[0]) setSelectedFacility(found[0]);\n } catch {\n // Leave the picker showing a raw id rather than crashing — operator\n // can still re-pick.\n }\n })();\n return () => { cancelled = true; };\n // facilities is intentionally excluded from the dep array so the picker\n // doesn't re-hydrate every time the list loads; the in-list lookup runs\n // synchronously on each render anyway.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n // Load the assigned-facility list once on first open. The list isn't huge\n // and the backend scopes it; no point in pre-fetching at mount.\n useEffect(() => {\n if (!open || loaded) return undefined;\n let cancelled = false;\n setLoading(true);\n (async () => {\n try {\n const rows = await listFacilities();\n if (!cancelled) setFacilities(rows);\n } catch {\n if (!cancelled) setFacilities([]);\n } finally {\n if (!cancelled) {\n setLoading(false);\n setLoaded(true);\n }\n }\n })();\n return () => { cancelled = true; };\n }, [open, loaded]);\n\n // Make sure the currently-selected facility is in the option set so the\n // Autocomplete can render its label without an out-of-range warning.\n const displayedOptions = useMemo(() => {\n if (!selectedFacility) return facilities;\n if (facilities.some((o) => o.id === selectedFacility.id)) return facilities;\n return [selectedFacility, ...facilities];\n }, [facilities, selectedFacility]);\n\n const noOptionsText = loading\n ? 'Loading…'\n : loaded && facilities.length === 0\n ? 'No facilities assigned to your account'\n : 'No matches';\n\n const defaultHelper = 'Only facilities assigned to your account are shown. Type to filter.';\n\n return (\n <Autocomplete\n size={size}\n fullWidth={fullWidth}\n disabled={disabled}\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n value={selectedFacility}\n isOptionEqualToValue={(a, b) => a?.id === b?.id}\n getOptionLabel={(o) => o?.name ?? ''}\n options={displayedOptions}\n loading={loading}\n onChange={(_, next) => {\n setSelectedFacility(next ?? null);\n onChange?.(next?.id ?? '');\n }}\n noOptionsText={noOptionsText}\n renderInput={(params) => (\n <TextField\n {...params}\n required={required}\n label={label}\n error={error}\n helperText={helperText || defaultHelper}\n onBlur={onBlur}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {loading ? <CircularProgress color=\"inherit\" size={16} /> : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n />\n );\n}\n"],"mappings":";;;;;AAYA,SAAwB,EAAe,EACrC,UACA,aACA,WAAQ,YACR,cAAW,IACX,cAAW,IACX,WAAQ,IACR,gBAAa,IACb,WACA,UAAO,SACP,eAAY,MACX;CACD,IAAM,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,CAAC,GAAY,KAAiB,EAAS,CAAC,CAAC,GACzC,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,CAAC,GAAkB,KAAuB,EAAS,IAAI;CAmC7D,AA9BA,QAAgB;EACd,IAAI,CAAC,GAAO;GACV,EAAoB,IAAI;GACxB;EACF;EACA,IAAI,GAAkB,OAAO,GAAO;EACpC,IAAM,IAAe,EAAW,MAAM,MAAM,EAAE,OAAO,CAAK;EAC1D,IAAI,GAAc;GAChB,EAAoB,CAAY;GAChC;EACF;EACA,IAAI,IAAY;EAUhB,QATC,YAAY;GACX,IAAI;IACF,IAAM,IAAQ,MAAM,EAAmB,CAAC,CAAK,CAAC;IAC9C,AAAI,CAAC,KAAa,EAAM,MAAI,EAAoB,EAAM,EAAE;GAC1D,QAAQ,CAGR;EACF,EAAA,CAAG,SACU;GAAE,IAAY;EAAM;CAKnC,GAAG,CAAC,CAAK,CAAC,GAIV,QAAgB;EACd,IAAI,CAAC,KAAQ,GAAQ;EACrB,IAAI,IAAY;EAehB,OAdA,EAAW,EAAI,IACd,YAAY;GACX,IAAI;IACF,IAAM,IAAO,MAAM,EAAe;IAClC,AAAK,KAAW,EAAc,CAAI;GACpC,QAAQ;IACN,AAAK,KAAW,EAAc,CAAC,CAAC;GAClC,UAAU;IACR,AAAK,MACH,EAAW,EAAK,GAChB,EAAU,EAAI;GAElB;EACF,EAAA,CAAG,SACU;GAAE,IAAY;EAAM;CACnC,GAAG,CAAC,GAAM,CAAM,CAAC;CAIjB,IAAM,IAAmB,QACnB,CAAC,KACD,EAAW,MAAM,MAAM,EAAE,OAAO,EAAiB,EAAE,IAAU,IAC1D,CAAC,GAAkB,GAAG,CAAU,GACtC,CAAC,GAAY,CAAgB,CAAC,GAE3B,IAAgB,IAClB,aACA,KAAU,EAAW,WAAW,IAC9B,2CACA;CAIN,OACE,kBAAC,GAAD;EACQ;EACK;EACD;EACJ;EACN,cAAc,EAAQ,EAAI;EAC1B,eAAe,EAAQ,EAAK;EAC5B,OAAO;EACP,uBAAuB,GAAG,MAAM,GAAG,OAAO,GAAG;EAC7C,iBAAiB,MAAM,GAAG,QAAQ;EAClC,SAAS;EACA;EACT,WAAW,GAAG,MAAS;GAErB,AADA,EAAoB,KAAQ,IAAI,GAChC,IAAW,GAAM,MAAM,EAAE;EAC3B;EACe;EACf,cAAc,MACZ,kBAAC,GAAD;GACE,GAAI;GACM;GACH;GACA;GACP,YAAY,KAAc;GAClB;GACR,YAAY;IACV,GAAG,EAAO;IACV,cACE,kBAAA,GAAA,EAAA,UAAA,CACG,IAAU,kBAAC,GAAD;KAAkB,OAAM;KAAU,MAAM;IAAK,CAAA,IAAI,MAC3D,EAAO,WAAW,YACnB,EAAA,CAAA;GAEN;EACD,CAAA;CAEJ,CAAA;AAEL"}
@@ -0,0 +1,658 @@
1
+ import { Y as e, dt as t, it as n, j as r } from "./settingsStore-BlA2GIhl.js";
2
+ import { a as ee, c as te, l as i, o as a, s as ne, t as re } from "./PmTable-BSV_bMJZ.js";
3
+ import { C as o, a as ie, b as ae, l as s, n as oe } from "./constants-ClZJY2x1.js";
4
+ import { a as se, i as c, t as ce } from "./format-UOyOu75i.js";
5
+ import { m as l } from "./validation-B6Kl5Xf9.js";
6
+ import { a as le, i as ue, n as de, r as fe, t as pe } from "./PmGuard-DrIl1sHL.js";
7
+ import { useMemo as me, useState as u } from "react";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import { Alert as he, Box as p, Button as m, Chip as h, Dialog as g, DialogActions as _, DialogContent as v, DialogTitle as y, InputAdornment as ge, LinearProgress as _e, Skeleton as ve, Stack as b, TableBody as ye, TableCell as x, TableHead as be, TableRow as S, TextField as C, Tooltip as xe, Typography as w } from "@mui/material";
10
+ import { alpha as Se, useTheme as Ce } from "@mui/material/styles";
11
+ import { v4 as T } from "uuid";
12
+ import we from "@mui/icons-material/RefreshRounded";
13
+ import Te from "@mui/icons-material/WidgetsRounded";
14
+ import E from "@mui/icons-material/LockRounded";
15
+ import D from "@mui/icons-material/LockOpenRounded";
16
+ import O from "@mui/icons-material/ReportRounded";
17
+ import k from "@mui/icons-material/SearchRounded";
18
+ //#region src/views/InventoryPage.jsx
19
+ function A(e) {
20
+ return e ? e.status === "EXPIRED" || c(e.expiryDate) : !1;
21
+ }
22
+ var Ee = [
23
+ {
24
+ value: "ACTIVE",
25
+ label: "Active stock"
26
+ },
27
+ {
28
+ value: "IN_USE",
29
+ label: "In use"
30
+ },
31
+ {
32
+ value: "USED_UP",
33
+ label: "Used up"
34
+ },
35
+ {
36
+ value: "EXPIRED",
37
+ label: "Expired"
38
+ },
39
+ {
40
+ value: "QUARANTINED",
41
+ label: "Quarantined"
42
+ },
43
+ {
44
+ value: "WASTAGE",
45
+ label: "Has wastage"
46
+ },
47
+ {
48
+ value: "ALL",
49
+ label: "All batches"
50
+ }
51
+ ];
52
+ function De(e, t) {
53
+ let n = A(e), r = Number(e.qtyRemaining ?? 0);
54
+ switch (t) {
55
+ case "ACTIVE": return r > 0 && !n && e.isQuarantined !== !0;
56
+ case "IN_USE": return e.status === "IN_USE";
57
+ case "USED_UP": return e.status === "EXHAUSTED";
58
+ case "EXPIRED": return n;
59
+ case "QUARANTINED": return e.isQuarantined === !0 || e.status === "QUARANTINED";
60
+ case "WASTAGE": return Number(e.wastedQty ?? 0) > 0;
61
+ default: return !0;
62
+ }
63
+ }
64
+ function j() {
65
+ let c = ue().has("update.manage.productManagement.inventory"), [j, Oe] = u([]), [M, N] = u(!1), [P, F] = u(""), [I, L] = u({
66
+ open: !1,
67
+ batch: null,
68
+ reason: "OTHER",
69
+ notes: ""
70
+ }), [R, z] = u({
71
+ open: !1,
72
+ batch: null,
73
+ qty: 1,
74
+ reason: "DAMAGED",
75
+ comments: ""
76
+ }), [B, V] = u(!1), ke = Ce(), [H, U] = u(""), [W, G] = u("ACTIVE");
77
+ async function K() {
78
+ N(!0), F("");
79
+ try {
80
+ Oe(await r());
81
+ } catch (e) {
82
+ let t = e?.response?.data?.message ?? e?.message ?? "Failed to load inventory";
83
+ F(t), i({
84
+ message: t,
85
+ type: "error"
86
+ });
87
+ } finally {
88
+ N(!1);
89
+ }
90
+ }
91
+ fe("view.manage.productManagement.inventory", () => {
92
+ K();
93
+ }, []);
94
+ let q = me(() => {
95
+ let e = H.trim().toLowerCase();
96
+ return j.filter((t) => e && !`${t.productName ?? ""} ${t.lotNumber ?? ""}`.toLowerCase().includes(e) ? !1 : De(t, W));
97
+ }, [
98
+ j,
99
+ H,
100
+ W
101
+ ]), J = H.trim() !== "" || W !== "ALL";
102
+ function Y() {
103
+ U(""), G("ALL");
104
+ }
105
+ function Ae(e) {
106
+ z({
107
+ open: !0,
108
+ batch: e,
109
+ qty: e.qtyRemaining ?? 1,
110
+ reason: "DAMAGED",
111
+ comments: ""
112
+ });
113
+ }
114
+ let X = Number(R.qty), Z = Number(R.batch?.qtyRemaining ?? 0), Q = !Number.isInteger(X) || X <= 0 ? "Enter a whole number greater than 0." : X > Z ? `Only ${Z} available to waste.` : "", $ = !Q && !!R.reason;
115
+ async function je() {
116
+ if (!(!R.batch || !$)) {
117
+ V(!0);
118
+ try {
119
+ await t({
120
+ id: T(),
121
+ batchId: R.batch.id,
122
+ wastedQty: X,
123
+ reason: R.reason,
124
+ comments: R.comments || null
125
+ }), i({
126
+ message: "Wastage recorded.",
127
+ type: "success"
128
+ }), z({
129
+ open: !1,
130
+ batch: null,
131
+ qty: 1,
132
+ reason: "DAMAGED",
133
+ comments: ""
134
+ }), await K();
135
+ } catch (e) {
136
+ let t = e?.response?.data?.message ?? e?.message ?? "Failed to record wastage";
137
+ i({
138
+ message: t,
139
+ type: "error"
140
+ });
141
+ } finally {
142
+ V(!1);
143
+ }
144
+ }
145
+ }
146
+ async function Me() {
147
+ try {
148
+ await e({
149
+ id: T(),
150
+ batchId: I.batch.id,
151
+ reason: I.reason,
152
+ notes: I.notes || null
153
+ }), i({
154
+ message: "Batch quarantined.",
155
+ type: "success"
156
+ }), L({
157
+ open: !1,
158
+ batch: null,
159
+ reason: "OTHER",
160
+ notes: ""
161
+ }), await K();
162
+ } catch (e) {
163
+ let t = e?.response?.data?.message ?? e?.message ?? "Failed to quarantine";
164
+ i({
165
+ message: t,
166
+ type: "error"
167
+ });
168
+ }
169
+ }
170
+ async function Ne(e) {
171
+ try {
172
+ await n({
173
+ id: T(),
174
+ batchId: e.id
175
+ }), i({
176
+ message: "Quarantine lifted.",
177
+ type: "success"
178
+ }), await K();
179
+ } catch (e) {
180
+ let t = e?.response?.data?.message ?? e?.message ?? "Failed to unquarantine";
181
+ i({
182
+ message: t,
183
+ type: "error"
184
+ });
185
+ }
186
+ }
187
+ return /* @__PURE__ */ f(p, { children: [/* @__PURE__ */ d(de, {}), /* @__PURE__ */ f(pe, {
188
+ perm: "view.manage.productManagement.inventory",
189
+ children: [
190
+ /* @__PURE__ */ f(le, {
191
+ title: "Inventory",
192
+ subtitle: "Your stock batches. Click to see history or quarantine items if there's a problem.",
193
+ chips: ["Stock"],
194
+ actions: /* @__PURE__ */ d(b, {
195
+ direction: "row",
196
+ spacing: 1,
197
+ children: /* @__PURE__ */ d(m, {
198
+ variant: "outlined",
199
+ startIcon: /* @__PURE__ */ d(we, {}),
200
+ onClick: () => void K(),
201
+ children: "Refresh"
202
+ })
203
+ }),
204
+ children: [P ? /* @__PURE__ */ d(he, {
205
+ severity: "error",
206
+ sx: { mb: 2 },
207
+ children: P
208
+ }) : null, /* @__PURE__ */ f(te, {
209
+ eyebrow: "Stock on hand",
210
+ title: "Inventory batches",
211
+ subtitle: M ? "Loading…" : J ? `${q.length} of ${j.length} ${j.length === 1 ? "batch" : "batches"} match` : `${j.length} ${j.length === 1 ? "batch" : "batches"} visible`,
212
+ children: [/* @__PURE__ */ f(b, {
213
+ direction: {
214
+ xs: "column",
215
+ md: "row"
216
+ },
217
+ spacing: 1.5,
218
+ sx: { mb: 2 },
219
+ alignItems: { md: "center" },
220
+ children: [
221
+ /* @__PURE__ */ d(C, {
222
+ size: "small",
223
+ fullWidth: !0,
224
+ placeholder: "Search product or lot…",
225
+ value: H,
226
+ onChange: (e) => U(e.target.value),
227
+ InputProps: { startAdornment: /* @__PURE__ */ d(ge, {
228
+ position: "start",
229
+ children: /* @__PURE__ */ d(k, { fontSize: "small" })
230
+ }) },
231
+ sx: { maxWidth: { md: 360 } }
232
+ }),
233
+ /* @__PURE__ */ d(p, {
234
+ sx: { minWidth: 190 },
235
+ children: /* @__PURE__ */ d(a, {
236
+ label: "Show",
237
+ value: W,
238
+ onChange: G,
239
+ options: Ee
240
+ })
241
+ }),
242
+ /* @__PURE__ */ d(p, { sx: { flexGrow: 1 } }),
243
+ /* @__PURE__ */ d(m, {
244
+ variant: "text",
245
+ onClick: Y,
246
+ disabled: !J,
247
+ children: "Clear"
248
+ })
249
+ ]
250
+ }), /* @__PURE__ */ f(ne, {
251
+ dense: !0,
252
+ children: [/* @__PURE__ */ d(be, { children: /* @__PURE__ */ f(S, { children: [
253
+ /* @__PURE__ */ d(x, { children: "Product" }),
254
+ /* @__PURE__ */ d(x, { children: "Lot" }),
255
+ /* @__PURE__ */ d(x, { children: "Owner" }),
256
+ /* @__PURE__ */ d(x, { children: "Expiry" }),
257
+ /* @__PURE__ */ d(x, {
258
+ align: "right",
259
+ children: "Stock"
260
+ }),
261
+ /* @__PURE__ */ d(x, { children: "Storage" }),
262
+ /* @__PURE__ */ d(x, { children: "Status" }),
263
+ /* @__PURE__ */ d(x, {
264
+ align: "right",
265
+ children: "Action"
266
+ })
267
+ ] }) }), /* @__PURE__ */ d(ye, { children: M ? Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ d(S, { children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ d(x, { children: /* @__PURE__ */ d(ve, { height: 22 }) }, t)) }, t)) : q.length === 0 ? /* @__PURE__ */ d(re, {
268
+ colSpan: 8,
269
+ icon: Te,
270
+ title: J ? "No batches match your filters" : "No batches in stock",
271
+ hint: J ? "Adjust your search or filters." : "Record a purchase to add stock.",
272
+ action: J ? /* @__PURE__ */ d(m, {
273
+ variant: "text",
274
+ size: "small",
275
+ onClick: Y,
276
+ children: "Clear filters"
277
+ }) : null
278
+ }) : q.map((e) => {
279
+ let t = A(e), n = e.qtyPurchased > 0 ? e.qtyRemaining / e.qtyPurchased : 0;
280
+ return /* @__PURE__ */ f(S, {
281
+ hover: !0,
282
+ children: [
283
+ /* @__PURE__ */ d(x, { children: /* @__PURE__ */ f(b, {
284
+ direction: "row",
285
+ alignItems: "baseline",
286
+ spacing: 1,
287
+ sx: { minWidth: 0 },
288
+ children: [/* @__PURE__ */ d(w, {
289
+ variant: "body2",
290
+ sx: {
291
+ fontWeight: 700,
292
+ lineHeight: 1.2
293
+ },
294
+ children: e.productName
295
+ }), /* @__PURE__ */ d(ee, { id: e.serialId })]
296
+ }) }),
297
+ /* @__PURE__ */ d(x, { children: e.lotNumber ? /* @__PURE__ */ d(p, {
298
+ component: "span",
299
+ sx: {
300
+ display: "inline-flex",
301
+ px: .7,
302
+ py: .1,
303
+ borderRadius: 1,
304
+ bgcolor: Se(ke.palette.primary.main, .06),
305
+ color: "primary.dark",
306
+ fontFamily: "monospace",
307
+ fontSize: "0.72rem",
308
+ fontWeight: 700
309
+ },
310
+ children: e.lotNumber
311
+ }) : /* @__PURE__ */ d(w, {
312
+ variant: "caption",
313
+ color: "text.disabled",
314
+ children: "—"
315
+ }) }),
316
+ /* @__PURE__ */ f(x, { children: [/* @__PURE__ */ d(w, {
317
+ variant: "body2",
318
+ sx: { fontWeight: 700 },
319
+ children: e.ownerName || o(ie, e.ownerType)
320
+ }), /* @__PURE__ */ d(w, {
321
+ variant: "caption",
322
+ color: "text.secondary",
323
+ children: e.ownerType
324
+ })] }),
325
+ /* @__PURE__ */ d(x, { children: e.expiryDate ? /* @__PURE__ */ d(xe, {
326
+ title: t ? "Past printed expiry" : "",
327
+ children: /* @__PURE__ */ d(w, {
328
+ variant: "body2",
329
+ sx: {
330
+ fontWeight: 700,
331
+ fontVariantNumeric: "tabular-nums",
332
+ color: t ? "error.dark" : "text.primary"
333
+ },
334
+ children: ce(e.expiryDate)
335
+ })
336
+ }) : /* @__PURE__ */ d(w, {
337
+ variant: "caption",
338
+ color: "text.disabled",
339
+ children: "—"
340
+ }) }),
341
+ /* @__PURE__ */ d(x, {
342
+ align: "right",
343
+ sx: { minWidth: 150 },
344
+ children: /* @__PURE__ */ f(b, {
345
+ alignItems: "flex-end",
346
+ spacing: .5,
347
+ children: [
348
+ /* @__PURE__ */ f(w, {
349
+ variant: "body2",
350
+ sx: {
351
+ fontWeight: 800,
352
+ fontVariantNumeric: "tabular-nums"
353
+ },
354
+ children: [e.qtyRemaining, /* @__PURE__ */ f(w, {
355
+ component: "span",
356
+ variant: "caption",
357
+ color: "text.secondary",
358
+ sx: {
359
+ ml: .5,
360
+ fontVariantNumeric: "tabular-nums"
361
+ },
362
+ children: ["/ ", e.qtyPurchased]
363
+ })]
364
+ }),
365
+ /* @__PURE__ */ d(p, {
366
+ sx: { width: 80 },
367
+ children: /* @__PURE__ */ d(_e, {
368
+ variant: "determinate",
369
+ value: Math.min(100, Math.max(0, n * 100)),
370
+ sx: {
371
+ height: 4,
372
+ borderRadius: 2
373
+ },
374
+ color: n < .25 ? "warning" : "primary"
375
+ })
376
+ }),
377
+ Number(e.wastedQty ?? 0) > 0 ? /* @__PURE__ */ f(w, {
378
+ variant: "caption",
379
+ sx: {
380
+ color: "warning.dark",
381
+ fontWeight: 700
382
+ },
383
+ children: [e.wastedQty, " wasted"]
384
+ }) : null
385
+ ]
386
+ })
387
+ }),
388
+ /* @__PURE__ */ d(x, { children: e.storageUnitName ? /* @__PURE__ */ d(w, {
389
+ variant: "caption",
390
+ sx: { fontWeight: 700 },
391
+ children: e.storageUnitName
392
+ }) : /* @__PURE__ */ d(w, {
393
+ variant: "caption",
394
+ color: "text.disabled",
395
+ children: "—"
396
+ }) }),
397
+ /* @__PURE__ */ d(x, { children: /* @__PURE__ */ f(b, {
398
+ direction: "row",
399
+ spacing: .5,
400
+ flexWrap: "wrap",
401
+ useFlexGap: !0,
402
+ children: [
403
+ /* @__PURE__ */ d(h, {
404
+ size: "small",
405
+ color: se(e.status),
406
+ label: o(oe, e.status),
407
+ sx: {
408
+ fontWeight: 700,
409
+ borderRadius: 1.5,
410
+ height: 22
411
+ }
412
+ }),
413
+ e.isQuarantined ? /* @__PURE__ */ d(h, {
414
+ size: "small",
415
+ color: "error",
416
+ label: o(s, e.quarantineReason) || "Quarantined",
417
+ sx: {
418
+ fontWeight: 700,
419
+ borderRadius: 1.5,
420
+ height: 22
421
+ }
422
+ }) : null,
423
+ t && e.status !== "EXPIRED" ? /* @__PURE__ */ d(h, {
424
+ size: "small",
425
+ color: "warning",
426
+ label: "Expired",
427
+ sx: {
428
+ fontWeight: 700,
429
+ borderRadius: 1.5,
430
+ height: 22
431
+ }
432
+ }) : null,
433
+ e.sourceType ? /* @__PURE__ */ d(h, {
434
+ size: "small",
435
+ variant: "outlined",
436
+ color: e.sourceType === "PICKUP" ? "info" : e.sourceType === "TRANSFER_IN" ? "primary" : "default",
437
+ label: e.sourceType === "TRANSFER_IN" ? "Transfer" : e.sourceType === "PICKUP" ? "Pickup" : e.sourceType === "PURCHASE" ? "Purchase" : e.sourceType,
438
+ sx: {
439
+ fontWeight: 700,
440
+ borderRadius: 1.5,
441
+ height: 22
442
+ }
443
+ }) : null
444
+ ]
445
+ }) }),
446
+ /* @__PURE__ */ d(x, {
447
+ align: "right",
448
+ children: c ? e.isQuarantined ? t ? /* @__PURE__ */ d(w, {
449
+ variant: "caption",
450
+ color: "text.disabled",
451
+ children: "Expired"
452
+ }) : /* @__PURE__ */ d(m, {
453
+ size: "small",
454
+ variant: "outlined",
455
+ color: "success",
456
+ startIcon: /* @__PURE__ */ d(D, {}),
457
+ onClick: () => void Ne(e),
458
+ children: "Unquarantine"
459
+ }) : /* @__PURE__ */ f(b, {
460
+ direction: "row",
461
+ spacing: 1,
462
+ justifyContent: "flex-end",
463
+ children: [t || e.status === "EXHAUSTED" || e.status === "IN_USE" || e.canBeQuarantined === !1 ? null : /* @__PURE__ */ d(m, {
464
+ size: "small",
465
+ variant: "outlined",
466
+ color: "error",
467
+ startIcon: /* @__PURE__ */ d(E, {}),
468
+ onClick: () => L({
469
+ open: !0,
470
+ batch: e,
471
+ reason: "OTHER",
472
+ notes: ""
473
+ }),
474
+ children: "Quarantine"
475
+ }), Number(e.qtyRemaining ?? 0) > 0 ? /* @__PURE__ */ d(m, {
476
+ size: "small",
477
+ variant: "outlined",
478
+ color: "warning",
479
+ startIcon: /* @__PURE__ */ d(O, {}),
480
+ onClick: () => Ae(e),
481
+ children: "Waste"
482
+ }) : null]
483
+ }) : null
484
+ })
485
+ ]
486
+ }, e.id);
487
+ }) })]
488
+ })]
489
+ })]
490
+ }),
491
+ /* @__PURE__ */ f(g, {
492
+ open: I.open,
493
+ onClose: () => L({
494
+ ...I,
495
+ open: !1
496
+ }),
497
+ fullWidth: !0,
498
+ maxWidth: "sm",
499
+ children: [
500
+ /* @__PURE__ */ d(y, { children: "Quarantine Batch" }),
501
+ /* @__PURE__ */ d(v, {
502
+ dividers: !0,
503
+ children: /* @__PURE__ */ f(b, {
504
+ spacing: 2,
505
+ sx: { pt: 1 },
506
+ children: [
507
+ /* @__PURE__ */ f(w, {
508
+ variant: "body2",
509
+ children: [
510
+ "Product: ",
511
+ /* @__PURE__ */ d("strong", { children: I.batch?.productName }),
512
+ /* @__PURE__ */ d("br", {}),
513
+ "Lot: ",
514
+ /* @__PURE__ */ d("strong", { children: I.batch?.lotNumber || "—" }),
515
+ /* @__PURE__ */ d("br", {}),
516
+ "Remaining: ",
517
+ /* @__PURE__ */ d("strong", { children: I.batch?.qtyRemaining })
518
+ ]
519
+ }),
520
+ /* @__PURE__ */ d(a, {
521
+ label: "Reason",
522
+ required: !0,
523
+ value: I.reason,
524
+ onChange: (e) => L({
525
+ ...I,
526
+ reason: e
527
+ }),
528
+ options: s,
529
+ error: !!l(I.reason, "Reason"),
530
+ helperText: l(I.reason, "Reason") || ""
531
+ }),
532
+ /* @__PURE__ */ d(C, {
533
+ label: "Notes",
534
+ size: "small",
535
+ multiline: !0,
536
+ minRows: 2,
537
+ fullWidth: !0,
538
+ value: I.notes,
539
+ onChange: (e) => L({
540
+ ...I,
541
+ notes: e.target.value
542
+ })
543
+ })
544
+ ]
545
+ })
546
+ }),
547
+ /* @__PURE__ */ f(_, { children: [/* @__PURE__ */ d(m, {
548
+ onClick: () => L({
549
+ ...I,
550
+ open: !1
551
+ }),
552
+ children: "Cancel"
553
+ }), /* @__PURE__ */ d(m, {
554
+ variant: "contained",
555
+ color: "error",
556
+ disabled: !!l(I.reason, "Reason"),
557
+ onClick: () => void Me(),
558
+ children: "Quarantine"
559
+ })] })
560
+ ]
561
+ }),
562
+ /* @__PURE__ */ f(g, {
563
+ open: R.open,
564
+ onClose: () => {
565
+ B || z({
566
+ ...R,
567
+ open: !1
568
+ });
569
+ },
570
+ fullWidth: !0,
571
+ maxWidth: "sm",
572
+ children: [
573
+ /* @__PURE__ */ d(y, { children: "Mark Wastage" }),
574
+ /* @__PURE__ */ d(v, {
575
+ dividers: !0,
576
+ children: /* @__PURE__ */ f(b, {
577
+ spacing: 2,
578
+ sx: { pt: 1 },
579
+ children: [
580
+ /* @__PURE__ */ f(w, {
581
+ variant: "body2",
582
+ children: [
583
+ "Product: ",
584
+ /* @__PURE__ */ d("strong", { children: R.batch?.productName }),
585
+ /* @__PURE__ */ d("br", {}),
586
+ "Lot: ",
587
+ /* @__PURE__ */ d("strong", { children: R.batch?.lotNumber || "—" }),
588
+ /* @__PURE__ */ d("br", {}),
589
+ "Available to waste: ",
590
+ /* @__PURE__ */ d("strong", { children: R.batch?.qtyRemaining ?? 0 })
591
+ ]
592
+ }),
593
+ /* @__PURE__ */ d(C, {
594
+ required: !0,
595
+ label: "Quantity to waste",
596
+ size: "small",
597
+ type: "number",
598
+ fullWidth: !0,
599
+ inputProps: {
600
+ min: 1,
601
+ max: Z
602
+ },
603
+ value: R.qty,
604
+ onChange: (e) => z({
605
+ ...R,
606
+ qty: e.target.value
607
+ }),
608
+ error: !!Q,
609
+ helperText: Q || `Units to write off (max ${Z}).`
610
+ }),
611
+ /* @__PURE__ */ d(a, {
612
+ label: "Reason",
613
+ required: !0,
614
+ value: R.reason,
615
+ onChange: (e) => z({
616
+ ...R,
617
+ reason: e
618
+ }),
619
+ options: ae
620
+ }),
621
+ /* @__PURE__ */ d(C, {
622
+ label: "Comments",
623
+ size: "small",
624
+ multiline: !0,
625
+ minRows: 2,
626
+ fullWidth: !0,
627
+ value: R.comments,
628
+ onChange: (e) => z({
629
+ ...R,
630
+ comments: e.target.value
631
+ })
632
+ })
633
+ ]
634
+ })
635
+ }),
636
+ /* @__PURE__ */ f(_, { children: [/* @__PURE__ */ d(m, {
637
+ onClick: () => z({
638
+ ...R,
639
+ open: !1
640
+ }),
641
+ disabled: B,
642
+ children: "Cancel"
643
+ }), /* @__PURE__ */ d(m, {
644
+ variant: "contained",
645
+ color: "warning",
646
+ disabled: !$ || B,
647
+ onClick: () => void je(),
648
+ children: B ? "Recording…" : "Mark Wastage"
649
+ })] })
650
+ ]
651
+ })
652
+ ]
653
+ })] });
654
+ }
655
+ //#endregion
656
+ export { j as default };
657
+
658
+ //# sourceMappingURL=InventoryPage-CTdq6txa.js.map