@argusoft/medplat-core 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccessRights-xrday-L1.js +1023 -0
- package/dist/AccessRights-xrday-L1.js.map +1 -0
- package/dist/AddEditQueryBuilder-D-iQiVIe.js +365 -0
- package/dist/AddEditQueryBuilder-D-iQiVIe.js.map +1 -0
- package/dist/{AddFeatures-C0Z29oSd.js → AddFeatures-D1sU8RjY.js} +2 -2
- package/dist/{AddFeatures-C0Z29oSd.js.map → AddFeatures-D1sU8RjY.js.map} +1 -1
- package/dist/AddLabelModal-Bq-wRqv9.js +631 -0
- package/dist/AddLabelModal-Bq-wRqv9.js.map +1 -0
- package/dist/AddMenuConfiguration-e5BVXhmw.js +8547 -0
- package/dist/AddMenuConfiguration-e5BVXhmw.js.map +1 -0
- package/dist/{AddRoleDrawer-CQdzQZLb.js → AddRoleDrawer-0gqAK8N0.js} +62 -63
- package/dist/AddRoleDrawer-0gqAK8N0.js.map +1 -0
- package/dist/AppModal-CCtrQ5Tr.js +394 -0
- package/dist/AppModal-CCtrQ5Tr.js.map +1 -0
- package/dist/BrandsPage-DmRW5bhm-Bk1szrjI.js +387 -0
- package/dist/BrandsPage-DmRW5bhm-Bk1szrjI.js.map +1 -0
- package/dist/CategoriesPage-BsS5IQh3-B03lWRY5.js +391 -0
- package/dist/CategoriesPage-BsS5IQh3-B03lWRY5.js.map +1 -0
- package/dist/{ChangePasswordModalCore-CDxkeIIM.js → ChangePasswordModalCore-BPsJquTS.js} +1606 -1611
- package/dist/ChangePasswordModalCore-BPsJquTS.js.map +1 -0
- package/dist/{ConditionConfig-DSsgGEXS.js → ConditionConfig-Ddz9halE.js} +2 -2
- package/dist/ConditionConfig-Ddz9halE.js.map +1 -0
- package/dist/DashboardPage-C3bKc5na-sBd9Yqbi.js +435 -0
- package/dist/DashboardPage-C3bKc5na-sBd9Yqbi.js.map +1 -0
- package/dist/{EntityManagement-GaYsBTvf.js → EntityManagement-CPQL6qBj.js} +2 -2
- package/dist/{EntityManagement-GaYsBTvf.js.map → EntityManagement-CPQL6qBj.js.map} +1 -1
- package/dist/EventConfig-BmLemzX3.js +26 -0
- package/dist/EventConfig-BmLemzX3.js.map +1 -0
- package/dist/{EventConfigurations-kNtAj_WM.js → EventConfigurations-Bzh1qWXU.js} +31 -30
- package/dist/{EventConfigurations-kNtAj_WM.js.map → EventConfigurations-Bzh1qWXU.js.map} +1 -1
- package/dist/{EventsExceptionModal-D4Bf1ilS.js → EventsExceptionModal-B2SRrnB1.js} +2 -2
- package/dist/{EventsExceptionModal-D4Bf1ilS.js.map → EventsExceptionModal-B2SRrnB1.js.map} +1 -1
- package/dist/EventsSkeleton-BIcPks4T.js +61 -0
- package/dist/EventsSkeleton-BIcPks4T.js.map +1 -0
- package/dist/FacilityPicker-BiZeupmP-CyPHmj6b.js +79 -0
- package/dist/FacilityPicker-BiZeupmP-CyPHmj6b.js.map +1 -0
- package/dist/FeatureMenu-DYJmDt7q.js +521 -0
- package/dist/FeatureMenu-DYJmDt7q.js.map +1 -0
- package/dist/Features-Dne21RWu.js +14 -0
- package/dist/Features-Dne21RWu.js.map +1 -0
- package/dist/{FhirServerList-Dkq7Kbes.js → FhirServerList-DuTwnngN.js} +19 -19
- package/dist/{FhirServerList-Dkq7Kbes.js.map → FhirServerList-DuTwnngN.js.map} +1 -1
- package/dist/{FhirServerWizard-Db6Hm4bQ.js → FhirServerWizard-DZI8Olku.js} +15 -15
- package/dist/{FhirServerWizard-Db6Hm4bQ.js.map → FhirServerWizard-DZI8Olku.js.map} +1 -1
- package/dist/FlywayQuery-CQygj51V.js +179 -0
- package/dist/FlywayQuery-CQygj51V.js.map +1 -0
- package/dist/{ManageNotification-CaBAOhji.js → Google-DQxMfbaL.js} +1725 -2652
- package/dist/{ManageNotification-CaBAOhji.js.map → Google-DQxMfbaL.js.map} +1 -1
- package/dist/GrantPermissionModal-BDN66Atn.js +236 -0
- package/dist/GrantPermissionModal-BDN66Atn.js.map +1 -0
- package/dist/ImmunizationConfigurationBase-Di1KO3oW.js +7639 -0
- package/dist/ImmunizationConfigurationBase-Di1KO3oW.js.map +1 -0
- package/dist/ImmunizationConfigurationBase.css +1 -1
- package/dist/ImmunizationConfigurationsList-TZcLDEci.js +369 -0
- package/dist/ImmunizationConfigurationsList-TZcLDEci.js.map +1 -0
- package/dist/InventoryPage-C_AxSy7A-QLvlL4rE.js +665 -0
- package/dist/InventoryPage-C_AxSy7A-QLvlL4rE.js.map +1 -0
- package/dist/LanguagesModal-B3NTebYT.js +352 -0
- package/dist/LanguagesModal-B3NTebYT.js.map +1 -0
- package/dist/ManageDynamicFeature-BU0I45dd.js +4475 -0
- package/dist/ManageDynamicFeature-BU0I45dd.js.map +1 -0
- package/dist/{ManageEventConfiguration-DV3I5POA.js → ManageEventConfiguration-CoYcpjR9.js} +465 -397
- package/dist/ManageEventConfiguration-CoYcpjR9.js.map +1 -0
- package/dist/ManageNotification-C5MhV77Q.js +934 -0
- package/dist/ManageNotification-C5MhV77Q.js.map +1 -0
- package/dist/{ManageRole-CGYfglpo.js → ManageRole-CNZBRKGU.js} +32 -30
- package/dist/ManageRole-CNZBRKGU.js.map +1 -0
- package/dist/ManageTranslation-vRiptUAP.js +833 -0
- package/dist/ManageTranslation-vRiptUAP.js.map +1 -0
- package/dist/ManageTranslation.css +1 -1
- package/dist/{ManageUser-AY1EUDLI.js → ManageUser-DCFkUMV9.js} +1722 -1586
- package/dist/ManageUser-DCFkUMV9.js.map +1 -0
- package/dist/MemberProfileCard-BdUNgHRB-VywqQdFF.js +272 -0
- package/dist/MemberProfileCard-BdUNgHRB-VywqQdFF.js.map +1 -0
- package/dist/MobileAnalytics-pQoE8cG1.js +16888 -0
- package/dist/MobileAnalytics-pQoE8cG1.js.map +1 -0
- package/dist/MobileMenuManagement-Cf8IZlla.js +108 -0
- package/dist/MobileMenuManagement-Cf8IZlla.js.map +1 -0
- package/dist/{MobileTypeEventConfigModal-BxLympIO.js → MobileTypeEventConfigModal-BeveaX0C.js} +2 -2
- package/dist/MobileTypeEventConfigModal-BeveaX0C.js.map +1 -0
- package/dist/NotificationFlywayQuery-BAHVjf6N.js +247 -0
- package/dist/NotificationFlywayQuery-BAHVjf6N.js.map +1 -0
- package/dist/{NotificationList-C3Vb_jKU.js → NotificationList-DEyRZEuM.js} +109 -110
- package/dist/NotificationList-DEyRZEuM.js.map +1 -0
- package/dist/{OtherTypeEventConfigModal-BeG1GrUi.js → OtherTypeEventConfigModal-CM6VkdmY.js} +570 -478
- package/dist/OtherTypeEventConfigModal-CM6VkdmY.js.map +1 -0
- package/dist/PaymentCreatePage-CIVe0P0p-25BQVpOX.js +482 -0
- package/dist/PaymentCreatePage-CIVe0P0p-25BQVpOX.js.map +1 -0
- package/dist/PaymentsPage-BvPe5Q9F-D2gfziwW.js +157 -0
- package/dist/PaymentsPage-BvPe5Q9F-D2gfziwW.js.map +1 -0
- package/dist/PermissionsModal-CCYkcKlC.js +151 -0
- package/dist/PermissionsModal-CCYkcKlC.js.map +1 -0
- package/dist/PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js +119 -0
- package/dist/PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js.map +1 -0
- package/dist/PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js +783 -0
- package/dist/PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js.map +1 -0
- package/dist/PickupsPage-Ctpghavs-CUp4uIZq.js +818 -0
- package/dist/PickupsPage-Ctpghavs-CUp4uIZq.js.map +1 -0
- package/dist/PmGuard-b10TGXEi-G3N0G_Wg.js +599 -0
- package/dist/PmGuard-b10TGXEi-G3N0G_Wg.js.map +1 -0
- package/dist/ProductEditPage-C1thoKHu-URQaZ6st.js +1302 -0
- package/dist/ProductEditPage-C1thoKHu-URQaZ6st.js.map +1 -0
- package/dist/ProductsPage-CupVmOD4-D45a_hf-.js +252 -0
- package/dist/ProductsPage-CupVmOD4-D45a_hf-.js.map +1 -0
- package/dist/PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js +648 -0
- package/dist/PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js.map +1 -0
- package/dist/PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js +1577 -0
- package/dist/PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js.map +1 -0
- package/dist/PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js +279 -0
- package/dist/PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js.map +1 -0
- package/dist/PurchasesPage-It1GHiXl-eH4IsF_U.js +293 -0
- package/dist/PurchasesPage-It1GHiXl-eH4IsF_U.js.map +1 -0
- package/dist/QueryBuilder-CXaBe6sr.js +478 -0
- package/dist/QueryBuilder-CXaBe6sr.js.map +1 -0
- package/dist/{RoleManagement-BPl2cE27.js → RoleManagement-s8iNx2Mu.js} +131 -142
- package/dist/RoleManagement-s8iNx2Mu.js.map +1 -0
- package/dist/Roles-BIyiic67.js +14 -0
- package/dist/Roles-BIyiic67.js.map +1 -0
- package/dist/SaleCreatePage-C9kFmTvm-B3Y0o4CX.js +544 -0
- package/dist/SaleCreatePage-C9kFmTvm-B3Y0o4CX.js.map +1 -0
- package/dist/SalesPage-D18DCseD-BxktGDRQ.js +315 -0
- package/dist/SalesPage-D18DCseD-BxktGDRQ.js.map +1 -0
- package/dist/{ServerSyncModal-D_oFpv3C.js → ServerSyncModal-92U3xtqI.js} +84 -85
- package/dist/ServerSyncModal-92U3xtqI.js.map +1 -0
- package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js +747 -0
- package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js.map +1 -0
- package/dist/ShowFlywayQuery-D10Olk5Z.js +154 -0
- package/dist/ShowFlywayQuery-D10Olk5Z.js.map +1 -0
- package/dist/{ShowFlywayQuery-DVRCd384.js → ShowFlywayQuery-D1y_4A1u.js} +161 -121
- package/dist/ShowFlywayQuery-D1y_4A1u.js.map +1 -0
- package/dist/ShowQueryHistory-DRBKYDKk.js +313 -0
- package/dist/ShowQueryHistory-DRBKYDKk.js.map +1 -0
- package/dist/StorageUnitsPage-7EqwuMOI-BwUso1Th.js +721 -0
- package/dist/StorageUnitsPage-7EqwuMOI-BwUso1Th.js.map +1 -0
- package/dist/SubMenu-eEDhZUvh.js +317 -0
- package/dist/SubMenu-eEDhZUvh.js.map +1 -0
- package/dist/{TableDetails-Cf_YfnY2.js → TableDetails-BtafRxXb.js} +1069 -831
- package/dist/TableDetails-BtafRxXb.js.map +1 -0
- package/dist/{TableList-D6jnIbnz.js → TableList-Dpo6dO7S.js} +2 -2
- package/dist/{TableList-D6jnIbnz.js.map → TableList-Dpo6dO7S.js.map} +1 -1
- package/dist/TransactionsPage-DrH53pVS-BkhIGB6C.js +746 -0
- package/dist/TransactionsPage-DrH53pVS-BkhIGB6C.js.map +1 -0
- package/dist/TransferCreatePage-CuvoMrYH-DTTfHjz-.js +315 -0
- package/dist/TransferCreatePage-CuvoMrYH-DTTfHjz-.js.map +1 -0
- package/dist/TransfersPage-Cf701t8s-BBbN7cBf.js +476 -0
- package/dist/TransfersPage-Cf701t8s-BBbN7cBf.js.map +1 -0
- package/dist/{TypeConfiguration-37wp-gsl.js → TypeConfiguration-3O6ABrK-.js} +2 -2
- package/dist/{TypeConfiguration-37wp-gsl.js.map → TypeConfiguration-3O6ABrK-.js.map} +1 -1
- package/dist/{UserList-Bc8gYxRL.js → UserList-DgPxsnj2.js} +253 -236
- package/dist/{UserList-Bc8gYxRL.js.map → UserList-DgPxsnj2.js.map} +1 -1
- package/dist/Users-Bpc4Sazd.js +41 -0
- package/dist/Users-Bpc4Sazd.js.map +1 -0
- package/dist/VialsPage-8oAc1yFv-Cl3FUXBJ.js +321 -0
- package/dist/VialsPage-8oAc1yFv-Cl3FUXBJ.js.map +1 -0
- package/dist/{WidgetList-Dw_FmbbE.js → WidgetList-D7YuWfDD.js} +2 -2
- package/dist/{WidgetList-Dw_FmbbE.js.map → WidgetList-D7YuWfDD.js.map} +1 -1
- package/dist/constants-ClZJY2x1-MkSWn6TZ.js +434 -0
- package/dist/constants-ClZJY2x1-MkSWn6TZ.js.map +1 -0
- package/dist/dashboardLayoutUtils-D1xCAxp3.js +405 -0
- package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +1 -0
- package/dist/format-UOyOu75i-D0GyylyQ.js +63 -0
- package/dist/format-UOyOu75i-D0GyylyQ.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +4 -752
- package/dist/index.js.map +1 -1
- package/dist/index.lib-Dn8PMkeD.js +862 -0
- package/dist/index.lib-Dn8PMkeD.js.map +1 -0
- package/dist/useFieldErrors-hDG8ox_x-DbSAzrGo.js +28 -0
- package/dist/useFieldErrors-hDG8ox_x-DbSAzrGo.js.map +1 -0
- package/dist/validation-BzlHnL-r-CCJm2utQ.js +125 -0
- package/dist/validation-BzlHnL-r-CCJm2utQ.js.map +1 -0
- package/package.json +5 -4
- package/dist/AccessRights-CHu27ZOw.js +0 -1262
- package/dist/AccessRights-CHu27ZOw.js.map +0 -1
- package/dist/AddEditQueryBuilder-Brdnm6rQ.js +0 -313
- package/dist/AddEditQueryBuilder-Brdnm6rQ.js.map +0 -1
- package/dist/AddLabelModal-DFllBVcd.js +0 -734
- package/dist/AddLabelModal-DFllBVcd.js.map +0 -1
- package/dist/AddMenuConfiguration-BSQLl88V.js +0 -6570
- package/dist/AddMenuConfiguration-BSQLl88V.js.map +0 -1
- package/dist/AddRoleDrawer-CQdzQZLb.js.map +0 -1
- package/dist/AppModal-CtG2GjD_.js +0 -428
- package/dist/AppModal-CtG2GjD_.js.map +0 -1
- package/dist/ChangePasswordModalCore-CDxkeIIM.js.map +0 -1
- package/dist/ConditionConfig-DSsgGEXS.js.map +0 -1
- package/dist/EventsSkeleton-8iiETGcf.js +0 -76
- package/dist/EventsSkeleton-8iiETGcf.js.map +0 -1
- package/dist/FeatureMenu-jl7-Tk6y.js +0 -265
- package/dist/FeatureMenu-jl7-Tk6y.js.map +0 -1
- package/dist/Features-CObdzJp_.js +0 -13
- package/dist/Features-CObdzJp_.js.map +0 -1
- package/dist/FlywayQuery-Cx2sly6g.js +0 -169
- package/dist/FlywayQuery-Cx2sly6g.js.map +0 -1
- package/dist/ImmunizationConfigurationBase-DZGqwda2.js +0 -5910
- package/dist/ImmunizationConfigurationBase-DZGqwda2.js.map +0 -1
- package/dist/ImmunizationConfigurationsList-DdSZicTP.js +0 -344
- package/dist/ImmunizationConfigurationsList-DdSZicTP.js.map +0 -1
- package/dist/LanguagesModal-D6VfaGrl.js +0 -394
- package/dist/LanguagesModal-D6VfaGrl.js.map +0 -1
- package/dist/ManageDynamicFeature-BhONvfC_.js +0 -4189
- package/dist/ManageDynamicFeature-BhONvfC_.js.map +0 -1
- package/dist/ManageEventConfiguration-DV3I5POA.js.map +0 -1
- package/dist/ManageRole-CGYfglpo.js.map +0 -1
- package/dist/ManageTranslation-B4C9-lWD.js +0 -625
- package/dist/ManageTranslation-B4C9-lWD.js.map +0 -1
- package/dist/ManageUser-AY1EUDLI.js.map +0 -1
- package/dist/MobileMenuManagement-CVAKyKDa.js +0 -112
- package/dist/MobileMenuManagement-CVAKyKDa.js.map +0 -1
- package/dist/MobileTypeEventConfigModal-BxLympIO.js.map +0 -1
- package/dist/NotificationFlywayQuery-BY8Zzml_.js +0 -244
- package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +0 -1
- package/dist/NotificationList-C3Vb_jKU.js.map +0 -1
- package/dist/OtherTypeEventConfigModal-BeG1GrUi.js.map +0 -1
- package/dist/QueryBuilder-z7eqfd7D.js +0 -383
- package/dist/QueryBuilder-z7eqfd7D.js.map +0 -1
- package/dist/RoleManagement-BPl2cE27.js.map +0 -1
- package/dist/ServerSyncModal-D_oFpv3C.js.map +0 -1
- package/dist/ShowFlywayQuery-DVRCd384.js.map +0 -1
- package/dist/ShowFlywayQuery-tj42YQAS.js +0 -130
- package/dist/ShowFlywayQuery-tj42YQAS.js.map +0 -1
- package/dist/ShowQueryHistory-BDN0tzHg.js +0 -190
- package/dist/ShowQueryHistory-BDN0tzHg.js.map +0 -1
- package/dist/SubMenu-DYxAPH2Z.js +0 -191
- package/dist/SubMenu-DYxAPH2Z.js.map +0 -1
- package/dist/TableDetails-Cf_YfnY2.js.map +0 -1
- package/dist/Users-CsJ08Kjm.js +0 -40
- package/dist/Users-CsJ08Kjm.js.map +0 -1
- package/dist/dashboardLayoutUtils-Bt5HA96J.js +0 -265
- package/dist/dashboardLayoutUtils-Bt5HA96J.js.map +0 -1
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
import { C as me, K as E, G as A, o as he, k as K, F as ye, f as be, _ as xe, D as ge } from "./ImmunizationConfigurationBase-Di1KO3oW.js";
|
|
2
|
+
import { C as Ie, p as we, l as fe } from "./constants-ClZJY2x1-MkSWn6TZ.js";
|
|
3
|
+
import { o as W, t as Pe, s as Te } from "./format-UOyOu75i-D0GyylyQ.js";
|
|
4
|
+
import { r as P, b as X, S as Ce, x as Se, y as ve, C as Z } from "./validation-BzlHnL-r-CCJm2utQ.js";
|
|
5
|
+
import { n as De } from "./useFieldErrors-hDG8ox_x-DbSAzrGo.js";
|
|
6
|
+
import { Y as $e, Z as qe, Q as Fe, q as Ee } from "./PmGuard-b10TGXEi-G3N0G_Wg.js";
|
|
7
|
+
import { d as Ae } from "./FacilityPicker-BiZeupmP-CyPHmj6b.js";
|
|
8
|
+
import { useMemo as R, useState as v, useEffect as Re } from "react";
|
|
9
|
+
import { jsxs as u, jsx as t, Fragment as Ue } from "react/jsx-runtime";
|
|
10
|
+
import { Box as Be, Alert as Me, Card as D, CardContent as U, Grid as d, Stack as $, Typography as B, Table as Ne, TableHead as Le, TableRow as J, TableCell as p, TableBody as Ye, Chip as ke, Button as O, Divider as _, TextField as T, IconButton as ze } from "@mui/material";
|
|
11
|
+
import { v4 as j } from "uuid";
|
|
12
|
+
import We from "@mui/icons-material/AddRounded";
|
|
13
|
+
import { useNavigate as Xe } from "react-router-dom";
|
|
14
|
+
import Oe from "@mui/icons-material/Inventory2Rounded";
|
|
15
|
+
import je from "@mui/icons-material/SaveRounded";
|
|
16
|
+
import He from "@mui/icons-material/DeleteOutlineRounded";
|
|
17
|
+
var Ge = [{
|
|
18
|
+
value: "USER",
|
|
19
|
+
label: "Personal Use"
|
|
20
|
+
}, {
|
|
21
|
+
value: "FACILITY",
|
|
22
|
+
label: "Facility Use"
|
|
23
|
+
}];
|
|
24
|
+
function ee() {
|
|
25
|
+
return {
|
|
26
|
+
key: j(),
|
|
27
|
+
batchId: j(),
|
|
28
|
+
productId: "",
|
|
29
|
+
quantity: 1,
|
|
30
|
+
buyPrice: "",
|
|
31
|
+
expectedSalePrice: "",
|
|
32
|
+
expiryDate: "",
|
|
33
|
+
lotNumber: "",
|
|
34
|
+
manufactureDate: "",
|
|
35
|
+
storageUnitId: ""
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function dr() {
|
|
39
|
+
let M = Xe(), c = me(), y = (c == null ? void 0 : c.managePurchaseAmounts) !== !1, N = (c == null ? void 0 : c.manageSales) !== !1, C = (c == null ? void 0 : c.allowPersonalPurchase) !== !1, q = (c == null ? void 0 : c.allowFacilityPurchase) !== !1, m = (c == null ? void 0 : c.requirePurchaseConfirmation) === !0, re = R(() => Ge.filter((e) => (e.value !== "USER" || C) && (e.value !== "FACILITY" || q)), [C, q]), te = C ? "USER" : "FACILITY", [F, ie] = v([]), [L, ae] = v([]), [Y, ne] = v([]), [H, k] = v(""), l = De(), z = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10), [a, g] = v({
|
|
40
|
+
id: j(),
|
|
41
|
+
ownerType: te,
|
|
42
|
+
ownerId: "",
|
|
43
|
+
purchaseDate: z,
|
|
44
|
+
paymentMode: "CASH",
|
|
45
|
+
notes: "",
|
|
46
|
+
items: [ee()]
|
|
47
|
+
});
|
|
48
|
+
Re(() => {
|
|
49
|
+
!C && a.ownerType === "USER" ? g((e) => ({
|
|
50
|
+
...e,
|
|
51
|
+
ownerType: "FACILITY",
|
|
52
|
+
ownerId: ""
|
|
53
|
+
})) : !q && a.ownerType === "FACILITY" && g((e) => ({
|
|
54
|
+
...e,
|
|
55
|
+
ownerType: "USER",
|
|
56
|
+
ownerId: ""
|
|
57
|
+
}));
|
|
58
|
+
}, [
|
|
59
|
+
C,
|
|
60
|
+
q,
|
|
61
|
+
a.ownerType
|
|
62
|
+
]), $e("update.manage.productManagement.purchase", () => {
|
|
63
|
+
async function e() {
|
|
64
|
+
var r, n;
|
|
65
|
+
try {
|
|
66
|
+
let [i, s, h] = await Promise.all([
|
|
67
|
+
be(),
|
|
68
|
+
xe({ activeOnly: !0 }),
|
|
69
|
+
ge().catch(() => [])
|
|
70
|
+
]);
|
|
71
|
+
ie(i), ae(s), ne(h);
|
|
72
|
+
} catch (i) {
|
|
73
|
+
k(((n = (r = i == null ? void 0 : i.response) == null ? void 0 : r.data) == null ? void 0 : n.message) ?? (i == null ? void 0 : i.message) ?? "Failed to load reference data");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
e();
|
|
77
|
+
}, []);
|
|
78
|
+
let G = R(() => a.ownerType === "USER" ? Y.filter((e) => e.ownerType === "USER" && Number(e.qtyRemaining ?? 0) > 0 && e.status !== "EXPIRED" && e.status !== "EXHAUSTED") : a.ownerType === "FACILITY" && a.ownerId ? Y.filter((e) => e.ownerType === "FACILITY" && e.ownerId === a.ownerId && Number(e.qtyRemaining ?? 0) > 0 && e.status !== "EXPIRED" && e.status !== "EXHAUSTED") : [], [
|
|
79
|
+
Y,
|
|
80
|
+
a.ownerType,
|
|
81
|
+
a.ownerId
|
|
82
|
+
]), oe = R(() => a.ownerType !== "FACILITY" || !a.ownerId ? [] : L.filter((e) => e.ownerId === a.ownerId), [
|
|
83
|
+
L,
|
|
84
|
+
a.ownerType,
|
|
85
|
+
a.ownerId
|
|
86
|
+
]);
|
|
87
|
+
function I(e, r, n) {
|
|
88
|
+
g((i) => {
|
|
89
|
+
let s = i.items.slice();
|
|
90
|
+
return s[e] = {
|
|
91
|
+
...s[e],
|
|
92
|
+
[r]: n
|
|
93
|
+
}, {
|
|
94
|
+
...i,
|
|
95
|
+
items: s
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function le(e) {
|
|
100
|
+
g((r) => ({
|
|
101
|
+
...r,
|
|
102
|
+
items: r.items.filter((n, i) => i !== e)
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
function se() {
|
|
106
|
+
g((e) => ({
|
|
107
|
+
...e,
|
|
108
|
+
items: [...e.items, ee()]
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
let S = R(() => {
|
|
112
|
+
let e = !1;
|
|
113
|
+
return {
|
|
114
|
+
sum: a.items.reduce((r, n) => {
|
|
115
|
+
if (n.buyPrice === "" || n.quantity === "" || n.quantity == null) return r;
|
|
116
|
+
let i = Number(n.quantity), s = Number(n.buyPrice);
|
|
117
|
+
return Number.isNaN(i) || Number.isNaN(s) ? r : (e = !0, r + i * s);
|
|
118
|
+
}, 0),
|
|
119
|
+
priced: e
|
|
120
|
+
};
|
|
121
|
+
}, [a.items]), w = {
|
|
122
|
+
ownerType: P(a.ownerType, "Purchase type"),
|
|
123
|
+
ownerId: a.ownerType === "FACILITY" ? P(a.ownerId, "Facility") : "",
|
|
124
|
+
purchaseDate: P(a.purchaseDate, "Purchase date")
|
|
125
|
+
}, Q = a.items.map((e) => {
|
|
126
|
+
let r = F.find((b) => b.id === e.productId), n = (r == null ? void 0 : r.hasExpiry) === !0, i = (r == null ? void 0 : r.needsStorageUnit) === !0 && a.ownerType === "FACILITY" ? P(e.storageUnitId, "Storage unit") : "";
|
|
127
|
+
if (!i && e.storageUnitId && (r != null && r.vaccineConfig)) {
|
|
128
|
+
let b = r.vaccineConfig, o = L.find((x) => x.id === e.storageUnitId);
|
|
129
|
+
if (b.storageTempMinCelsius != null && b.storageTempMaxCelsius != null && o) {
|
|
130
|
+
let x = o.operatingTempMinCelsius, f = o.operatingTempMaxCelsius;
|
|
131
|
+
(x == null || f == null || Number(x) > Number(b.storageTempMinCelsius) || Number(f) < Number(b.storageTempMaxCelsius)) && (i = `Unit operates ${x ?? "?"}°C → ${f ?? "?"}°C, which cannot cover this product's required ${b.storageTempMinCelsius}°C → ${b.storageTempMaxCelsius}°C.`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
let s = (r == null ? void 0 : r.salePriceMode) || "FREE", h = "";
|
|
135
|
+
return N && r && !r.notForSale && s !== "FIXED" && e.expectedSalePrice !== "" && e.expectedSalePrice != null && (h = X(e.expectedSalePrice), !h && s === "CAPPED" && r.salePrice != null && Number(e.expectedSalePrice) > Number(r.salePrice) && (h = `Cannot exceed the MRP (${W(r.salePrice)}).`)), {
|
|
136
|
+
productId: P(e.productId, "Product"),
|
|
137
|
+
quantity: ve(e.quantity),
|
|
138
|
+
buyPrice: y ? P(e.buyPrice, "Buy price") || X(e.buyPrice) || (Number(e.buyPrice) > 0 ? "" : "Buy price must be greater than 0.") : X(e.buyPrice),
|
|
139
|
+
expectedSalePrice: h,
|
|
140
|
+
expiryDate: m ? "" : n && P(e.expiryDate, "Expiry date") || Se(e.expiryDate, { label: "Expiry" }),
|
|
141
|
+
manufactureDate: Ce(e.manufactureDate, { label: "Manufacture date" }),
|
|
142
|
+
storageUnitId: i
|
|
143
|
+
};
|
|
144
|
+
}), V = Z(w) && Q.every(Z) && a.items.length > 0;
|
|
145
|
+
async function ue() {
|
|
146
|
+
var r, n;
|
|
147
|
+
if (!V) {
|
|
148
|
+
l.markAllTouched(), k("Please fix the highlighted fields and try again.");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
let e = {
|
|
152
|
+
id: a.id,
|
|
153
|
+
ownerType: a.ownerType,
|
|
154
|
+
ownerId: a.ownerType === "FACILITY" ? a.ownerId : null,
|
|
155
|
+
purchaseDate: a.purchaseDate,
|
|
156
|
+
paymentMode: y && a.paymentMode || null,
|
|
157
|
+
totalAmount: y && S.priced ? Number(S.sum.toFixed(2)) : null,
|
|
158
|
+
notes: a.notes || null,
|
|
159
|
+
items: a.items.map((i) => ({
|
|
160
|
+
batchId: i.batchId,
|
|
161
|
+
productId: i.productId,
|
|
162
|
+
quantity: Number(i.quantity),
|
|
163
|
+
buyPrice: y && i.buyPrice !== "" ? Number(i.buyPrice) : null,
|
|
164
|
+
expectedSalePrice: (() => {
|
|
165
|
+
if (!N) return null;
|
|
166
|
+
let s = F.find((h) => h.id === i.productId);
|
|
167
|
+
return !s || s.notForSale || s.salePriceMode === "FIXED" || i.expectedSalePrice === "" ? null : Number(i.expectedSalePrice);
|
|
168
|
+
})(),
|
|
169
|
+
expiryDate: i.expiryDate || null,
|
|
170
|
+
lotNumber: i.lotNumber || null,
|
|
171
|
+
manufactureDate: i.manufactureDate || null,
|
|
172
|
+
storageUnitId: i.storageUnitId || null
|
|
173
|
+
}))
|
|
174
|
+
};
|
|
175
|
+
try {
|
|
176
|
+
if (m) {
|
|
177
|
+
let i = await he(e);
|
|
178
|
+
K({
|
|
179
|
+
message: "Purchase request submitted for approval.",
|
|
180
|
+
type: "success"
|
|
181
|
+
}), M(`/ui/medplat/manage/pm/purchase-requests/${(i == null ? void 0 : i.id) ?? a.id}`);
|
|
182
|
+
} else await ye(e), K({
|
|
183
|
+
message: "Purchase recorded.",
|
|
184
|
+
type: "success"
|
|
185
|
+
}), M("/ui/medplat/manage/pm/purchases");
|
|
186
|
+
} catch (i) {
|
|
187
|
+
k(((n = (r = i == null ? void 0 : i.response) == null ? void 0 : r.data) == null ? void 0 : n.message) ?? (i == null ? void 0 : i.message) ?? (m ? "Failed to submit purchase request" : "Failed to record purchase"));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return /* @__PURE__ */ u(Be, { children: [/* @__PURE__ */ t(qe, {}), /* @__PURE__ */ t(Fe, {
|
|
191
|
+
perm: "update.manage.productManagement.purchase",
|
|
192
|
+
title: m ? "You don’t have permission to submit purchase requests" : "You don’t have permission to record purchases",
|
|
193
|
+
children: /* @__PURE__ */ u(Ee, {
|
|
194
|
+
title: m ? "Submit Purchase Request" : "Record Purchase",
|
|
195
|
+
subtitle: m ? "Purchases need approval before stock is added. Submit the request and wait for a manager to confirm." : "Each item creates a batch that you can track and a record in your ledger.",
|
|
196
|
+
actions: /* @__PURE__ */ u($, {
|
|
197
|
+
direction: "row",
|
|
198
|
+
spacing: 1,
|
|
199
|
+
children: [/* @__PURE__ */ t(O, {
|
|
200
|
+
variant: "outlined",
|
|
201
|
+
onClick: () => M(m ? "/ui/medplat/manage/pm/purchase-requests" : "/ui/medplat/manage/pm/purchases"),
|
|
202
|
+
children: "Cancel"
|
|
203
|
+
}), /* @__PURE__ */ t(O, {
|
|
204
|
+
variant: "contained",
|
|
205
|
+
startIcon: /* @__PURE__ */ t(je, {}),
|
|
206
|
+
disabled: !V,
|
|
207
|
+
onClick: () => void ue(),
|
|
208
|
+
children: m ? "Submit Request" : "Save"
|
|
209
|
+
})]
|
|
210
|
+
}),
|
|
211
|
+
children: [
|
|
212
|
+
H ? /* @__PURE__ */ t(Me, {
|
|
213
|
+
severity: "error",
|
|
214
|
+
sx: { mb: 2 },
|
|
215
|
+
children: H
|
|
216
|
+
}) : null,
|
|
217
|
+
/* @__PURE__ */ t(D, {
|
|
218
|
+
sx: {
|
|
219
|
+
borderRadius: 1.5,
|
|
220
|
+
mb: 2,
|
|
221
|
+
border: "1px solid",
|
|
222
|
+
borderColor: "divider",
|
|
223
|
+
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
224
|
+
},
|
|
225
|
+
children: /* @__PURE__ */ u(U, {
|
|
226
|
+
sx: { p: 2.5 },
|
|
227
|
+
children: [/* @__PURE__ */ t(E, {
|
|
228
|
+
eyebrow: "Step 1",
|
|
229
|
+
title: "Purchase for",
|
|
230
|
+
hint: "Choose who will own this stock: yourself or a facility.",
|
|
231
|
+
sx: { mb: 2 }
|
|
232
|
+
}), /* @__PURE__ */ u(d, {
|
|
233
|
+
container: !0,
|
|
234
|
+
spacing: 2,
|
|
235
|
+
children: [/* @__PURE__ */ t(d, {
|
|
236
|
+
item: !0,
|
|
237
|
+
xs: 12,
|
|
238
|
+
md: 4,
|
|
239
|
+
children: /* @__PURE__ */ t(A, {
|
|
240
|
+
label: "Purchase Type",
|
|
241
|
+
required: !0,
|
|
242
|
+
value: a.ownerType,
|
|
243
|
+
onChange: (e) => g({
|
|
244
|
+
...a,
|
|
245
|
+
ownerType: e,
|
|
246
|
+
ownerId: ""
|
|
247
|
+
}),
|
|
248
|
+
onBlur: l.onBlur("ownerType"),
|
|
249
|
+
error: l.show("ownerType") && !!w.ownerType,
|
|
250
|
+
options: re,
|
|
251
|
+
helperText: l.show("ownerType") && w.ownerType ? w.ownerType : "Personal stock vs. facility stock"
|
|
252
|
+
})
|
|
253
|
+
}), a.ownerType === "FACILITY" ? /* @__PURE__ */ t(d, {
|
|
254
|
+
item: !0,
|
|
255
|
+
xs: 12,
|
|
256
|
+
md: 4,
|
|
257
|
+
children: /* @__PURE__ */ t(Ae, {
|
|
258
|
+
required: !0,
|
|
259
|
+
value: a.ownerId,
|
|
260
|
+
onChange: (e) => g({
|
|
261
|
+
...a,
|
|
262
|
+
ownerId: e
|
|
263
|
+
}),
|
|
264
|
+
onBlur: l.onBlur("ownerId"),
|
|
265
|
+
error: l.show("ownerId") && !!w.ownerId,
|
|
266
|
+
helperText: l.show("ownerId") && w.ownerId ? w.ownerId : "Search for the facility."
|
|
267
|
+
})
|
|
268
|
+
}) : null]
|
|
269
|
+
})]
|
|
270
|
+
})
|
|
271
|
+
}),
|
|
272
|
+
a.ownerType === "USER" || a.ownerType === "FACILITY" && a.ownerId ? /* @__PURE__ */ t(D, {
|
|
273
|
+
sx: {
|
|
274
|
+
borderRadius: 1.5,
|
|
275
|
+
mb: 2,
|
|
276
|
+
border: "1px solid",
|
|
277
|
+
borderColor: "divider",
|
|
278
|
+
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
279
|
+
},
|
|
280
|
+
children: /* @__PURE__ */ u(U, {
|
|
281
|
+
sx: { p: 2.5 },
|
|
282
|
+
children: [/* @__PURE__ */ t(E, {
|
|
283
|
+
eyebrow: "Context",
|
|
284
|
+
title: "Existing inventory",
|
|
285
|
+
hint: a.ownerType === "USER" ? "Your current stock." : "What this facility already has, including where it is stored.",
|
|
286
|
+
sx: { mb: 1.5 }
|
|
287
|
+
}), G.length === 0 ? /* @__PURE__ */ u($, {
|
|
288
|
+
direction: "row",
|
|
289
|
+
spacing: 1.25,
|
|
290
|
+
alignItems: "center",
|
|
291
|
+
sx: {
|
|
292
|
+
py: 1.5,
|
|
293
|
+
color: "text.secondary"
|
|
294
|
+
},
|
|
295
|
+
children: [/* @__PURE__ */ t(Oe, { fontSize: "small" }), /* @__PURE__ */ t(B, {
|
|
296
|
+
variant: "body2",
|
|
297
|
+
children: "No active stock yet for this owner."
|
|
298
|
+
})]
|
|
299
|
+
}) : /* @__PURE__ */ u(Ne, {
|
|
300
|
+
size: "small",
|
|
301
|
+
children: [/* @__PURE__ */ t(Le, { children: /* @__PURE__ */ u(J, { children: [
|
|
302
|
+
/* @__PURE__ */ t(p, { children: "Product" }),
|
|
303
|
+
/* @__PURE__ */ t(p, { children: "Lot" }),
|
|
304
|
+
/* @__PURE__ */ t(p, {
|
|
305
|
+
align: "right",
|
|
306
|
+
children: "Remaining"
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ t(p, { children: "Expiry" }),
|
|
309
|
+
a.ownerType === "FACILITY" ? /* @__PURE__ */ t(p, { children: "Storage" }) : null,
|
|
310
|
+
/* @__PURE__ */ t(p, { children: "Status" })
|
|
311
|
+
] }) }), /* @__PURE__ */ t(Ye, { children: G.map((e) => /* @__PURE__ */ u(J, { children: [
|
|
312
|
+
/* @__PURE__ */ t(p, {
|
|
313
|
+
sx: { fontWeight: 700 },
|
|
314
|
+
children: e.productName
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ t(p, {
|
|
317
|
+
sx: {
|
|
318
|
+
fontFamily: "monospace",
|
|
319
|
+
fontSize: "0.78rem"
|
|
320
|
+
},
|
|
321
|
+
children: e.lotNumber || "—"
|
|
322
|
+
}),
|
|
323
|
+
/* @__PURE__ */ t(p, {
|
|
324
|
+
align: "right",
|
|
325
|
+
sx: {
|
|
326
|
+
fontVariantNumeric: "tabular-nums",
|
|
327
|
+
fontWeight: 700
|
|
328
|
+
},
|
|
329
|
+
children: e.qtyRemaining
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ t(p, { children: e.expiryDate ? Pe(e.expiryDate) : "—" }),
|
|
332
|
+
a.ownerType === "FACILITY" ? /* @__PURE__ */ t(p, { children: e.storageUnitName || "—" }) : null,
|
|
333
|
+
/* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(ke, {
|
|
334
|
+
size: "small",
|
|
335
|
+
label: Ie(we, e.status),
|
|
336
|
+
color: Te(e.status)
|
|
337
|
+
}) })
|
|
338
|
+
] }, e.id)) })]
|
|
339
|
+
})]
|
|
340
|
+
})
|
|
341
|
+
}) : null,
|
|
342
|
+
/* @__PURE__ */ t(D, {
|
|
343
|
+
sx: {
|
|
344
|
+
borderRadius: 1.5,
|
|
345
|
+
mb: 2,
|
|
346
|
+
border: "1px solid",
|
|
347
|
+
borderColor: "divider",
|
|
348
|
+
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
349
|
+
},
|
|
350
|
+
children: /* @__PURE__ */ u(U, {
|
|
351
|
+
sx: { p: 2.5 },
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ u($, {
|
|
354
|
+
direction: "row",
|
|
355
|
+
justifyContent: "space-between",
|
|
356
|
+
alignItems: "flex-start",
|
|
357
|
+
sx: { mb: 2 },
|
|
358
|
+
children: [/* @__PURE__ */ t(E, {
|
|
359
|
+
eyebrow: "Step 2",
|
|
360
|
+
title: "Line items",
|
|
361
|
+
hint: "Each item creates one batch in your inventory and a receipt record."
|
|
362
|
+
}), /* @__PURE__ */ t(O, {
|
|
363
|
+
variant: "outlined",
|
|
364
|
+
startIcon: /* @__PURE__ */ t(We, {}),
|
|
365
|
+
onClick: se,
|
|
366
|
+
children: "Add Line"
|
|
367
|
+
})]
|
|
368
|
+
}),
|
|
369
|
+
/* @__PURE__ */ t(_, { sx: { mb: 2 } }),
|
|
370
|
+
/* @__PURE__ */ t($, {
|
|
371
|
+
spacing: 2,
|
|
372
|
+
children: a.items.map((e, r) => {
|
|
373
|
+
let n = Q[r] || {}, i = F.find((o) => o.id === e.productId), s = (i == null ? void 0 : i.hasExpiry) === !0, h = (i == null ? void 0 : i.needsStorageUnit) === !0 && a.ownerType === "FACILITY", b = new Set(a.items.filter((o, x) => x !== r).map((o) => o.productId).filter(Boolean));
|
|
374
|
+
return /* @__PURE__ */ t(D, {
|
|
375
|
+
variant: "outlined",
|
|
376
|
+
sx: {
|
|
377
|
+
p: 2,
|
|
378
|
+
borderRadius: 1.5
|
|
379
|
+
},
|
|
380
|
+
children: /* @__PURE__ */ u(d, {
|
|
381
|
+
container: !0,
|
|
382
|
+
spacing: 2,
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ t(d, {
|
|
385
|
+
item: !0,
|
|
386
|
+
xs: 12,
|
|
387
|
+
md: 3,
|
|
388
|
+
children: /* @__PURE__ */ t(A, {
|
|
389
|
+
label: "Product",
|
|
390
|
+
required: !0,
|
|
391
|
+
value: e.productId,
|
|
392
|
+
onChange: (o) => I(r, "productId", o),
|
|
393
|
+
onBlur: l.onBlur(`items.${r}.productId`),
|
|
394
|
+
error: l.show(`items.${r}.productId`) && !!n.productId,
|
|
395
|
+
helperText: l.show(`items.${r}.productId`) ? n.productId : "",
|
|
396
|
+
options: F.filter((o) => o.id === e.productId || !b.has(o.id)).map((o) => ({
|
|
397
|
+
value: o.id,
|
|
398
|
+
label: o.name
|
|
399
|
+
}))
|
|
400
|
+
})
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ t(d, {
|
|
403
|
+
item: !0,
|
|
404
|
+
xs: 6,
|
|
405
|
+
md: 1,
|
|
406
|
+
children: /* @__PURE__ */ t(T, {
|
|
407
|
+
required: !0,
|
|
408
|
+
fullWidth: !0,
|
|
409
|
+
size: "small",
|
|
410
|
+
type: "number",
|
|
411
|
+
label: "Qty",
|
|
412
|
+
inputProps: { min: 1 },
|
|
413
|
+
value: e.quantity,
|
|
414
|
+
onChange: (o) => I(r, "quantity", o.target.value),
|
|
415
|
+
onBlur: l.onBlur(`items.${r}.quantity`),
|
|
416
|
+
error: l.show(`items.${r}.quantity`) && !!n.quantity,
|
|
417
|
+
helperText: l.show(`items.${r}.quantity`) ? n.quantity : ""
|
|
418
|
+
})
|
|
419
|
+
}),
|
|
420
|
+
y ? /* @__PURE__ */ t(d, {
|
|
421
|
+
item: !0,
|
|
422
|
+
xs: 6,
|
|
423
|
+
md: 2,
|
|
424
|
+
children: /* @__PURE__ */ t(T, {
|
|
425
|
+
required: !0,
|
|
426
|
+
fullWidth: !0,
|
|
427
|
+
size: "small",
|
|
428
|
+
type: "number",
|
|
429
|
+
inputProps: {
|
|
430
|
+
step: "0.01",
|
|
431
|
+
min: 0
|
|
432
|
+
},
|
|
433
|
+
label: "Buy Price",
|
|
434
|
+
value: e.buyPrice,
|
|
435
|
+
onChange: (o) => I(r, "buyPrice", o.target.value),
|
|
436
|
+
onBlur: l.onBlur(`items.${r}.buyPrice`),
|
|
437
|
+
error: l.show(`items.${r}.buyPrice`) && !!n.buyPrice,
|
|
438
|
+
helperText: l.show(`items.${r}.buyPrice`) ? n.buyPrice : ""
|
|
439
|
+
})
|
|
440
|
+
}) : null,
|
|
441
|
+
N ? (() => {
|
|
442
|
+
let o = (i == null ? void 0 : i.salePriceMode) || "FREE", x = !!(i != null && i.notForSale), f = o === "FIXED", de = !i || x || f, ce = l.show(`items.${r}.expectedSalePrice`) && n.expectedSalePrice ? n.expectedSalePrice : i ? x ? "Not for sale" : f ? "Fixed price" : o === "CAPPED" && i.salePrice != null ? `Max (MRP) ${W(i.salePrice)}` : "Optional estimate" : "Pick a product first";
|
|
443
|
+
return /* @__PURE__ */ t(d, {
|
|
444
|
+
item: !0,
|
|
445
|
+
xs: 6,
|
|
446
|
+
md: 2,
|
|
447
|
+
children: /* @__PURE__ */ t(T, {
|
|
448
|
+
fullWidth: !0,
|
|
449
|
+
size: "small",
|
|
450
|
+
type: "number",
|
|
451
|
+
inputProps: {
|
|
452
|
+
step: "0.01",
|
|
453
|
+
min: 0
|
|
454
|
+
},
|
|
455
|
+
label: "Approx. Sale Price",
|
|
456
|
+
disabled: de,
|
|
457
|
+
value: f ? (i == null ? void 0 : i.salePrice) ?? "" : e.expectedSalePrice,
|
|
458
|
+
onChange: (pe) => I(r, "expectedSalePrice", pe.target.value),
|
|
459
|
+
onBlur: l.onBlur(`items.${r}.expectedSalePrice`),
|
|
460
|
+
error: l.show(`items.${r}.expectedSalePrice`) && !!n.expectedSalePrice,
|
|
461
|
+
helperText: ce
|
|
462
|
+
})
|
|
463
|
+
});
|
|
464
|
+
})() : null,
|
|
465
|
+
m ? null : /* @__PURE__ */ t(d, {
|
|
466
|
+
item: !0,
|
|
467
|
+
xs: 6,
|
|
468
|
+
md: 2,
|
|
469
|
+
children: /* @__PURE__ */ t(T, {
|
|
470
|
+
required: s,
|
|
471
|
+
fullWidth: !0,
|
|
472
|
+
size: "small",
|
|
473
|
+
type: "date",
|
|
474
|
+
label: "Expiry",
|
|
475
|
+
InputLabelProps: { shrink: !0 },
|
|
476
|
+
inputProps: { min: z },
|
|
477
|
+
value: e.expiryDate,
|
|
478
|
+
onChange: (o) => I(r, "expiryDate", o.target.value),
|
|
479
|
+
onBlur: l.onBlur(`items.${r}.expiryDate`),
|
|
480
|
+
error: l.show(`items.${r}.expiryDate`) && !!n.expiryDate,
|
|
481
|
+
helperText: l.show(`items.${r}.expiryDate`) && n.expiryDate ? n.expiryDate : s ? "Required for this product" : ""
|
|
482
|
+
})
|
|
483
|
+
}),
|
|
484
|
+
m ? null : /* @__PURE__ */ t(d, {
|
|
485
|
+
item: !0,
|
|
486
|
+
xs: 6,
|
|
487
|
+
md: 2,
|
|
488
|
+
children: /* @__PURE__ */ t(T, {
|
|
489
|
+
fullWidth: !0,
|
|
490
|
+
size: "small",
|
|
491
|
+
type: "date",
|
|
492
|
+
label: "Manufactured",
|
|
493
|
+
InputLabelProps: { shrink: !0 },
|
|
494
|
+
inputProps: { max: z },
|
|
495
|
+
value: e.manufactureDate,
|
|
496
|
+
onChange: (o) => I(r, "manufactureDate", o.target.value),
|
|
497
|
+
onBlur: l.onBlur(`items.${r}.manufactureDate`),
|
|
498
|
+
error: l.show(`items.${r}.manufactureDate`) && !!n.manufactureDate,
|
|
499
|
+
helperText: l.show(`items.${r}.manufactureDate`) && n.manufactureDate ? n.manufactureDate : "Optional"
|
|
500
|
+
})
|
|
501
|
+
}),
|
|
502
|
+
m ? null : /* @__PURE__ */ t(d, {
|
|
503
|
+
item: !0,
|
|
504
|
+
xs: 6,
|
|
505
|
+
md: 2,
|
|
506
|
+
children: /* @__PURE__ */ t(T, {
|
|
507
|
+
fullWidth: !0,
|
|
508
|
+
size: "small",
|
|
509
|
+
label: "Lot #",
|
|
510
|
+
value: e.lotNumber,
|
|
511
|
+
onChange: (o) => I(r, "lotNumber", o.target.value)
|
|
512
|
+
})
|
|
513
|
+
}),
|
|
514
|
+
/* @__PURE__ */ t(d, {
|
|
515
|
+
item: !0,
|
|
516
|
+
xs: 10,
|
|
517
|
+
md: 1,
|
|
518
|
+
children: /* @__PURE__ */ t(A, {
|
|
519
|
+
label: "Storage",
|
|
520
|
+
required: h,
|
|
521
|
+
disabled: a.ownerType !== "FACILITY" || !a.ownerId,
|
|
522
|
+
value: e.storageUnitId || "",
|
|
523
|
+
onChange: (o) => I(r, "storageUnitId", o),
|
|
524
|
+
onBlur: l.onBlur(`items.${r}.storageUnitId`),
|
|
525
|
+
error: l.show(`items.${r}.storageUnitId`) && !!n.storageUnitId,
|
|
526
|
+
options: oe.map((o) => ({
|
|
527
|
+
value: o.id,
|
|
528
|
+
label: o.unitName
|
|
529
|
+
})),
|
|
530
|
+
helperText: l.show(`items.${r}.storageUnitId`) && n.storageUnitId ? n.storageUnitId : h ? "Required for this product" : ""
|
|
531
|
+
})
|
|
532
|
+
}),
|
|
533
|
+
/* @__PURE__ */ t(d, {
|
|
534
|
+
item: !0,
|
|
535
|
+
xs: 2,
|
|
536
|
+
md: 1,
|
|
537
|
+
sx: { textAlign: "right" },
|
|
538
|
+
children: /* @__PURE__ */ t(ze, {
|
|
539
|
+
color: "error",
|
|
540
|
+
onClick: () => le(r),
|
|
541
|
+
disabled: a.items.length === 1,
|
|
542
|
+
children: /* @__PURE__ */ t(He, {})
|
|
543
|
+
})
|
|
544
|
+
})
|
|
545
|
+
]
|
|
546
|
+
})
|
|
547
|
+
}, e.key);
|
|
548
|
+
})
|
|
549
|
+
})
|
|
550
|
+
]
|
|
551
|
+
})
|
|
552
|
+
}),
|
|
553
|
+
/* @__PURE__ */ t(D, {
|
|
554
|
+
sx: {
|
|
555
|
+
borderRadius: 1.5,
|
|
556
|
+
bgcolor: "grey.50",
|
|
557
|
+
border: "1px solid",
|
|
558
|
+
borderColor: "divider",
|
|
559
|
+
boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
|
|
560
|
+
},
|
|
561
|
+
children: /* @__PURE__ */ u(U, {
|
|
562
|
+
sx: { p: 2.5 },
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ t(E, {
|
|
565
|
+
eyebrow: "Step 3",
|
|
566
|
+
title: y ? "Bill summary" : "Receipt details",
|
|
567
|
+
hint: y ? "The total is calculated from items. Add payment mode and notes. The date is set automatically." : "Add notes about this receipt. The date is set automatically.",
|
|
568
|
+
sx: { mb: 2 }
|
|
569
|
+
}),
|
|
570
|
+
/* @__PURE__ */ u(d, {
|
|
571
|
+
container: !0,
|
|
572
|
+
spacing: 2,
|
|
573
|
+
children: [y ? /* @__PURE__ */ t(d, {
|
|
574
|
+
item: !0,
|
|
575
|
+
xs: 12,
|
|
576
|
+
md: 6,
|
|
577
|
+
children: /* @__PURE__ */ t(A, {
|
|
578
|
+
label: "Payment Mode",
|
|
579
|
+
value: a.paymentMode || "",
|
|
580
|
+
onChange: (e) => g({
|
|
581
|
+
...a,
|
|
582
|
+
paymentMode: e
|
|
583
|
+
}),
|
|
584
|
+
options: fe
|
|
585
|
+
})
|
|
586
|
+
}) : null, /* @__PURE__ */ t(d, {
|
|
587
|
+
item: !0,
|
|
588
|
+
xs: 12,
|
|
589
|
+
md: y ? 6 : 12,
|
|
590
|
+
children: /* @__PURE__ */ t(T, {
|
|
591
|
+
fullWidth: !0,
|
|
592
|
+
size: "small",
|
|
593
|
+
label: "Notes",
|
|
594
|
+
value: a.notes,
|
|
595
|
+
onChange: (e) => g({
|
|
596
|
+
...a,
|
|
597
|
+
notes: e.target.value
|
|
598
|
+
})
|
|
599
|
+
})
|
|
600
|
+
})]
|
|
601
|
+
}),
|
|
602
|
+
y ? /* @__PURE__ */ u(Ue, { children: [
|
|
603
|
+
/* @__PURE__ */ t(_, { sx: { my: 2 } }),
|
|
604
|
+
/* @__PURE__ */ u($, {
|
|
605
|
+
direction: "row",
|
|
606
|
+
justifyContent: "flex-end",
|
|
607
|
+
alignItems: "baseline",
|
|
608
|
+
spacing: 2,
|
|
609
|
+
children: [/* @__PURE__ */ u(B, {
|
|
610
|
+
variant: "body2",
|
|
611
|
+
color: "text.secondary",
|
|
612
|
+
children: [
|
|
613
|
+
"Total (",
|
|
614
|
+
a.items.length,
|
|
615
|
+
" ",
|
|
616
|
+
a.items.length === 1 ? "line" : "lines",
|
|
617
|
+
")"
|
|
618
|
+
]
|
|
619
|
+
}), /* @__PURE__ */ t(B, {
|
|
620
|
+
variant: "h4",
|
|
621
|
+
sx: {
|
|
622
|
+
fontWeight: 800,
|
|
623
|
+
fontVariantNumeric: "tabular-nums"
|
|
624
|
+
},
|
|
625
|
+
children: S.priced ? W(S.sum) : "—"
|
|
626
|
+
})]
|
|
627
|
+
}),
|
|
628
|
+
S.priced ? null : /* @__PURE__ */ t(B, {
|
|
629
|
+
variant: "caption",
|
|
630
|
+
color: "text.secondary",
|
|
631
|
+
sx: {
|
|
632
|
+
display: "block",
|
|
633
|
+
textAlign: "right"
|
|
634
|
+
},
|
|
635
|
+
children: "Add a Buy Price on at least one line to compute the total."
|
|
636
|
+
})
|
|
637
|
+
] }) : null
|
|
638
|
+
]
|
|
639
|
+
})
|
|
640
|
+
})
|
|
641
|
+
]
|
|
642
|
+
})
|
|
643
|
+
})] });
|
|
644
|
+
}
|
|
645
|
+
export {
|
|
646
|
+
dr as default
|
|
647
|
+
};
|
|
648
|
+
//# sourceMappingURL=PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js.map
|