@argusoft/medplat-core 1.0.30 → 1.0.31
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 → AccessRights-DUgY6ewy.js} +151 -143
- package/dist/AccessRights-DUgY6ewy.js.map +1 -0
- package/dist/AddMenuConfiguration-c6ZKiN0i.js +8898 -0
- package/dist/AddMenuConfiguration-c6ZKiN0i.js.map +1 -0
- package/dist/{BrandsPage-DmRW5bhm-Bk1szrjI.js → BrandsPage-DMw2vT0u-BVhvhc6J.js} +14 -14
- package/dist/{BrandsPage-DmRW5bhm-Bk1szrjI.js.map → BrandsPage-DMw2vT0u-BVhvhc6J.js.map} +1 -1
- package/dist/{CategoriesPage-BsS5IQh3-B03lWRY5.js → CategoriesPage-D3ihx9Gi-CT58g0ry.js} +112 -105
- package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js.map +1 -0
- package/dist/{ChangePasswordModalCore-BPsJquTS.js → ChangePasswordModalCore-lQ9GamH1.js} +3 -3
- package/dist/{ChangePasswordModalCore-BPsJquTS.js.map → ChangePasswordModalCore-lQ9GamH1.js.map} +1 -1
- package/dist/ConditionConfig-BQBmBHaM.js +408 -0
- package/dist/ConditionConfig-BQBmBHaM.js.map +1 -0
- package/dist/{DashboardPage-C3bKc5na-sBd9Yqbi.js → DashboardPage-asr2XDRu-uOOlX9Vq.js} +29 -29
- package/dist/{DashboardPage-C3bKc5na-sBd9Yqbi.js.map → DashboardPage-asr2XDRu-uOOlX9Vq.js.map} +1 -1
- package/dist/EventConfig-BY2cgGyx.js +27 -0
- package/dist/{EventConfig-BmLemzX3.js.map → EventConfig-BY2cgGyx.js.map} +1 -1
- package/dist/EventConfigurations-CUPEN5BV.js +544 -0
- package/dist/EventConfigurations-CUPEN5BV.js.map +1 -0
- package/dist/EventConfigurations.css +1 -1
- package/dist/EventsExceptionModal-BX-ArkBE.js +188 -0
- package/dist/EventsExceptionModal-BX-ArkBE.js.map +1 -0
- package/dist/EventsUi-D6O9S7BK.js +258 -0
- package/dist/EventsUi-D6O9S7BK.js.map +1 -0
- package/dist/{FacilityPicker-BiZeupmP-CyPHmj6b.js → FacilityPicker-DYl_PDyt-Cbwo2tAY.js} +10 -10
- package/dist/{FacilityPicker-BiZeupmP-CyPHmj6b.js.map → FacilityPicker-DYl_PDyt-Cbwo2tAY.js.map} +1 -1
- package/dist/{FeatureMenu-DYJmDt7q.js → FeatureMenu-CHsBbw3W.js} +9 -5
- package/dist/FeatureMenu-CHsBbw3W.js.map +1 -0
- package/dist/{FhirServerList-DuTwnngN.js → FhirServerList-iXBPkRVF.js} +11 -11
- package/dist/{FhirServerList-DuTwnngN.js.map → FhirServerList-iXBPkRVF.js.map} +1 -1
- package/dist/{GrantPermissionModal-BDN66Atn.js → GrantPermissionModal-D7iNZd0M.js} +54 -51
- package/dist/GrantPermissionModal-D7iNZd0M.js.map +1 -0
- package/dist/{ImmunizationConfigurationBase-Di1KO3oW.js → ImmunizationConfigurationBase-aUtx0JEe.js} +3440 -3060
- package/dist/ImmunizationConfigurationBase-aUtx0JEe.js.map +1 -0
- package/dist/{InventoryPage-C_AxSy7A-QLvlL4rE.js → InventoryPage-DOotGZrj-CoPjOJEI.js} +10 -10
- package/dist/{InventoryPage-C_AxSy7A-QLvlL4rE.js.map → InventoryPage-DOotGZrj-CoPjOJEI.js.map} +1 -1
- package/dist/ManageEventConfiguration-DqW3krT6.js +1216 -0
- package/dist/ManageEventConfiguration-DqW3krT6.js.map +1 -0
- package/dist/ManageEventConfiguration.css +1 -1
- package/dist/{ManageUser-DCFkUMV9.js → ManageUser-DZltBina.js} +134 -134
- package/dist/{ManageUser-DCFkUMV9.js.map → ManageUser-DZltBina.js.map} +1 -1
- package/dist/{MemberProfileCard-BdUNgHRB-VywqQdFF.js → MemberProfileCard-D5CgkTdJ-D2NgDJl3.js} +25 -25
- package/dist/{MemberProfileCard-BdUNgHRB-VywqQdFF.js.map → MemberProfileCard-D5CgkTdJ-D2NgDJl3.js.map} +1 -1
- package/dist/MobileAnalytics-BLOionG_.js +17301 -0
- package/dist/MobileAnalytics-BLOionG_.js.map +1 -0
- package/dist/MobileMenuManagement-68Wijb0X.js +220 -0
- package/dist/MobileMenuManagement-68Wijb0X.js.map +1 -0
- package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js +752 -0
- package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js.map +1 -0
- package/dist/OtherTypeEventConfigModal-stNmuSv_.js +1812 -0
- package/dist/OtherTypeEventConfigModal-stNmuSv_.js.map +1 -0
- package/dist/{PaymentCreatePage-CIVe0P0p-25BQVpOX.js → PaymentCreatePage-DfvSZ-kB-CckogYoe.js} +14 -14
- package/dist/{PaymentCreatePage-CIVe0P0p-25BQVpOX.js.map → PaymentCreatePage-DfvSZ-kB-CckogYoe.js.map} +1 -1
- package/dist/{PaymentsPage-BvPe5Q9F-D2gfziwW.js → PaymentsPage-DMNjYWAJ-ChO9IXmk.js} +24 -24
- package/dist/{PaymentsPage-BvPe5Q9F-D2gfziwW.js.map → PaymentsPage-DMNjYWAJ-ChO9IXmk.js.map} +1 -1
- package/dist/{PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js → PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js} +2 -2
- package/dist/{PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js.map → PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js.map} +1 -1
- package/dist/{PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js → PickupCreatePage-B4O_-vE5-DoOo9nJO.js} +64 -64
- package/dist/{PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js.map → PickupCreatePage-B4O_-vE5-DoOo9nJO.js.map} +1 -1
- package/dist/{PickupsPage-Ctpghavs-CUp4uIZq.js → PickupsPage-D7zyioJB-bHKnARYw.js} +29 -29
- package/dist/PickupsPage-D7zyioJB-bHKnARYw.js.map +1 -0
- package/dist/{PmGuard-b10TGXEi-G3N0G_Wg.js → PmGuard-BZE-y4In-D_pUm5MP.js} +25 -25
- package/dist/{PmGuard-b10TGXEi-G3N0G_Wg.js.map → PmGuard-BZE-y4In-D_pUm5MP.js.map} +1 -1
- package/dist/{ProductEditPage-C1thoKHu-URQaZ6st.js → ProductEditPage-BVlVUCtD-BR-tJ5Wb.js} +475 -472
- package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map +1 -0
- package/dist/{ProductsPage-CupVmOD4-D45a_hf-.js → ProductsPage-DvNHIeZt-BoOOJJtk.js} +36 -35
- package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js.map +1 -0
- package/dist/{PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js → PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js} +214 -187
- package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map +1 -0
- package/dist/{PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js → PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js} +80 -80
- package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js.map +1 -0
- package/dist/{PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js → PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js} +29 -29
- package/dist/{PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js.map → PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js.map} +1 -1
- package/dist/{PurchasesPage-It1GHiXl-eH4IsF_U.js → PurchasesPage-DgL5T6BY-DePUuE9l.js} +31 -31
- package/dist/{PurchasesPage-It1GHiXl-eH4IsF_U.js.map → PurchasesPage-DgL5T6BY-DePUuE9l.js.map} +1 -1
- package/dist/{SaleCreatePage-C9kFmTvm-B3Y0o4CX.js → SaleCreatePage-CZnIOydv-DKBw-qp7.js} +15 -15
- package/dist/{SaleCreatePage-C9kFmTvm-B3Y0o4CX.js.map → SaleCreatePage-CZnIOydv-DKBw-qp7.js.map} +1 -1
- package/dist/{SalesPage-D18DCseD-BxktGDRQ.js → SalesPage-DPIRrC_O-M8rqnK7z.js} +62 -62
- package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js.map +1 -0
- package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js +676 -0
- package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js.map +1 -0
- package/dist/{ShowFlywayQuery-D1y_4A1u.js → ShowFlywayQuery-DIOUdYfG.js} +26 -19
- package/dist/{ShowFlywayQuery-D1y_4A1u.js.map → ShowFlywayQuery-DIOUdYfG.js.map} +1 -1
- package/dist/{StorageUnitsPage-7EqwuMOI-BwUso1Th.js → StorageUnitsPage-BDRkdCjW-UF64rf7q.js} +195 -188
- package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js.map +1 -0
- package/dist/{SubMenu-eEDhZUvh.js → SubMenu-BdMTYtC1.js} +5 -3
- package/dist/SubMenu-BdMTYtC1.js.map +1 -0
- package/dist/{TransactionsPage-DrH53pVS-BkhIGB6C.js → TransactionsPage-CqWTMNU8-Df6eGFDW.js} +48 -48
- package/dist/{TransactionsPage-DrH53pVS-BkhIGB6C.js.map → TransactionsPage-CqWTMNU8-Df6eGFDW.js.map} +1 -1
- package/dist/{TransferCreatePage-CuvoMrYH-DTTfHjz-.js → TransferCreatePage-DF7FZaTJ-CL79V3aR.js} +8 -8
- package/dist/{TransferCreatePage-CuvoMrYH-DTTfHjz-.js.map → TransferCreatePage-DF7FZaTJ-CL79V3aR.js.map} +1 -1
- package/dist/{TransfersPage-Cf701t8s-BBbN7cBf.js → TransfersPage-CGrRFaBF-cTwBUv0o.js} +69 -69
- package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js.map +1 -0
- package/dist/TypeConfiguration-JbRCN6GR.js +114 -0
- package/dist/TypeConfiguration-JbRCN6GR.js.map +1 -0
- package/dist/{UserList-DgPxsnj2.js → UserList-L41Xw0Q6.js} +2 -2
- package/dist/{UserList-DgPxsnj2.js.map → UserList-L41Xw0Q6.js.map} +1 -1
- package/dist/Users-CsJ08Kjm.js +40 -0
- package/dist/{Users-Bpc4Sazd.js.map → Users-CsJ08Kjm.js.map} +1 -1
- package/dist/{VialsPage-8oAc1yFv-Cl3FUXBJ.js → VialsPage-rvvXjgZG-Oqo1v6kQ.js} +35 -35
- package/dist/{VialsPage-8oAc1yFv-Cl3FUXBJ.js.map → VialsPage-rvvXjgZG-Oqo1v6kQ.js.map} +1 -1
- package/dist/{constants-ClZJY2x1-MkSWn6TZ.js → constants-DpXnLsAB-D6lN5cjK.js} +58 -47
- package/dist/constants-DpXnLsAB-D6lN5cjK.js.map +1 -0
- package/dist/{dashboardLayoutUtils-D1xCAxp3.js → dashboardLayoutUtils-CJivzaU1.js} +95 -92
- package/dist/dashboardLayoutUtils-CJivzaU1.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.lib-ETRQOzvE.js +894 -0
- package/dist/index.lib-ETRQOzvE.js.map +1 -0
- package/dist/listValueStore-BFQtDYIR-Bj0yX145.js +36 -0
- package/dist/listValueStore-BFQtDYIR-Bj0yX145.js.map +1 -0
- package/package.json +1 -1
- package/dist/AccessRights-xrday-L1.js.map +0 -1
- package/dist/AddMenuConfiguration-e5BVXhmw.js +0 -8547
- package/dist/AddMenuConfiguration-e5BVXhmw.js.map +0 -1
- package/dist/CategoriesPage-BsS5IQh3-B03lWRY5.js.map +0 -1
- package/dist/ConditionConfig-Ddz9halE.js +0 -395
- package/dist/ConditionConfig-Ddz9halE.js.map +0 -1
- package/dist/ConditionConfig.css +0 -1
- package/dist/EventConfig-BmLemzX3.js +0 -26
- package/dist/EventConfigurations-Bzh1qWXU.js +0 -450
- package/dist/EventConfigurations-Bzh1qWXU.js.map +0 -1
- package/dist/EventsExceptionModal-B2SRrnB1.js +0 -200
- package/dist/EventsExceptionModal-B2SRrnB1.js.map +0 -1
- package/dist/EventsSkeleton-BIcPks4T.js +0 -61
- package/dist/EventsSkeleton-BIcPks4T.js.map +0 -1
- package/dist/FeatureMenu-DYJmDt7q.js.map +0 -1
- package/dist/GrantPermissionModal-BDN66Atn.js.map +0 -1
- package/dist/ImmunizationConfigurationBase-Di1KO3oW.js.map +0 -1
- package/dist/ManageEventConfiguration-CoYcpjR9.js +0 -1085
- package/dist/ManageEventConfiguration-CoYcpjR9.js.map +0 -1
- package/dist/MobileAnalytics-pQoE8cG1.js +0 -16888
- package/dist/MobileAnalytics-pQoE8cG1.js.map +0 -1
- package/dist/MobileMenuManagement-Cf8IZlla.js +0 -108
- package/dist/MobileMenuManagement-Cf8IZlla.js.map +0 -1
- package/dist/MobileTypeEventConfigModal-BeveaX0C.js +0 -783
- package/dist/MobileTypeEventConfigModal-BeveaX0C.js.map +0 -1
- package/dist/OtherTypeEventConfigModal-CM6VkdmY.js +0 -2046
- package/dist/OtherTypeEventConfigModal-CM6VkdmY.js.map +0 -1
- package/dist/PickupsPage-Ctpghavs-CUp4uIZq.js.map +0 -1
- package/dist/ProductEditPage-C1thoKHu-URQaZ6st.js.map +0 -1
- package/dist/ProductsPage-CupVmOD4-D45a_hf-.js.map +0 -1
- package/dist/PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js.map +0 -1
- package/dist/PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js.map +0 -1
- package/dist/SalesPage-D18DCseD-BxktGDRQ.js.map +0 -1
- package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js +0 -747
- package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js.map +0 -1
- package/dist/StorageUnitsPage-7EqwuMOI-BwUso1Th.js.map +0 -1
- package/dist/SubMenu-eEDhZUvh.js.map +0 -1
- package/dist/TransfersPage-Cf701t8s-BBbN7cBf.js.map +0 -1
- package/dist/TypeConfiguration-3O6ABrK-.js +0 -117
- package/dist/TypeConfiguration-3O6ABrK-.js.map +0 -1
- package/dist/Users-Bpc4Sazd.js +0 -41
- package/dist/constants-ClZJY2x1-MkSWn6TZ.js.map +0 -1
- package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +0 -1
- package/dist/index.lib-Dn8PMkeD.js +0 -862
- package/dist/index.lib-Dn8PMkeD.js.map +0 -1
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { n as
|
|
5
|
-
import { Y as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
1
|
+
import { S as Ye, W as Pe, G as O, h as je, p as Qe, k as _, m as Ge, s as _e, l as Ke, a as Xe, f as Ze } from "./ImmunizationConfigurationBase-aUtx0JEe.js";
|
|
2
|
+
import { _ as Je, k as ei, n as ii, p as ti, o as ni, s as Be, f as ri, c as Ie } from "./constants-DpXnLsAB-D6lN5cjK.js";
|
|
3
|
+
import { r as D, v as oi, d as ai, u as li, l as si, f as ci, C as ui } from "./validation-BzlHnL-r-CCJm2utQ.js";
|
|
4
|
+
import { n as di } from "./useFieldErrors-hDG8ox_x-DbSAzrGo.js";
|
|
5
|
+
import { Y as mi, Z as pi, Q as gi, q as hi } from "./PmGuard-BZE-y4In-D_pUm5MP.js";
|
|
6
|
+
import { m as fi } from "./listValueStore-BFQtDYIR-Bj0yX145.js";
|
|
7
|
+
import { useState as E, useMemo as Ee, useEffect as ue, useRef as He } from "react";
|
|
8
|
+
import { jsxs as u, jsx as e, Fragment as Z } from "react/jsx-runtime";
|
|
9
|
+
import le from "prop-types";
|
|
10
|
+
import { Box as H, Alert as ke, Card as se, CardContent as ce, Typography as v, Grid as a, TextField as M, FormControlLabel as z, Checkbox as N, Stack as F, Divider as vi, Button as J, CircularProgress as $e, IconButton as Fe } from "@mui/material";
|
|
11
|
+
import { v4 as de } from "uuid";
|
|
12
|
+
import Ci from "@mui/icons-material/AddRounded";
|
|
13
|
+
import { useParams as xi, useNavigate as bi } from "react-router-dom";
|
|
14
|
+
import yi from "@mui/icons-material/SaveRounded";
|
|
15
|
+
import Vi from "@mui/icons-material/DeleteOutlineRounded";
|
|
16
|
+
import Ai from "@mui/icons-material/AddPhotoAlternateRounded";
|
|
17
|
+
import Ti from "@mui/icons-material/CloseRounded";
|
|
18
|
+
var ee = 5, Mi = 5 * 1024 * 1024, G = {
|
|
18
19
|
display: "block",
|
|
19
20
|
fontWeight: 800,
|
|
20
21
|
letterSpacing: 0.6,
|
|
21
22
|
color: "text.secondary"
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
+
function ie() {
|
|
24
25
|
return {
|
|
25
|
-
key:
|
|
26
|
+
key: de(),
|
|
26
27
|
profileType: "AGE_BASED",
|
|
27
28
|
fromAge: "",
|
|
28
29
|
fromUnit: "YEARS",
|
|
@@ -31,11 +32,11 @@ function ae() {
|
|
|
31
32
|
doseAmount: ""
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
var
|
|
35
|
+
var j = {
|
|
35
36
|
vaccineCode: "",
|
|
36
37
|
vialVolumeMl: "",
|
|
37
38
|
singleDose: !1,
|
|
38
|
-
profiles: [
|
|
39
|
+
profiles: [ie()],
|
|
39
40
|
openVialValidityHours: 6,
|
|
40
41
|
openVialValidityUnit: "HOURS",
|
|
41
42
|
maxConcurrentOpenVials: 2,
|
|
@@ -47,40 +48,40 @@ var L = {
|
|
|
47
48
|
storageTempMaxCelsius: "",
|
|
48
49
|
comments: ""
|
|
49
50
|
};
|
|
50
|
-
function
|
|
51
|
-
var
|
|
52
|
-
let
|
|
51
|
+
function Si(p, W) {
|
|
52
|
+
var P;
|
|
53
|
+
let b = !W && !!p.singleDose, S = (f) => f === "" || f == null ? null : Number(f);
|
|
53
54
|
return {
|
|
54
|
-
vaccineCode: (
|
|
55
|
-
vialVolumeMl: Number(
|
|
56
|
-
singleDose:
|
|
57
|
-
profiles:
|
|
58
|
-
let
|
|
55
|
+
vaccineCode: (P = p.vaccineCode) == null ? void 0 : P.trim().toUpperCase(),
|
|
56
|
+
vialVolumeMl: Number(p.vialVolumeMl),
|
|
57
|
+
singleDose: b,
|
|
58
|
+
profiles: (b ? (p.profiles ?? []).slice(0, 1) : p.profiles ?? []).map((f) => {
|
|
59
|
+
let k = S(f.toAge);
|
|
59
60
|
return {
|
|
60
|
-
profileType:
|
|
61
|
-
fromAge:
|
|
62
|
-
fromUnit:
|
|
63
|
-
toAge:
|
|
64
|
-
toUnit:
|
|
65
|
-
doseAmount:
|
|
61
|
+
profileType: f.profileType || "AGE_BASED",
|
|
62
|
+
fromAge: S(f.fromAge),
|
|
63
|
+
fromUnit: f.fromUnit || "YEARS",
|
|
64
|
+
toAge: k,
|
|
65
|
+
toUnit: k == null ? null : f.toUnit || "YEARS",
|
|
66
|
+
doseAmount: b ? null : S(f.doseAmount)
|
|
66
67
|
};
|
|
67
68
|
}),
|
|
68
|
-
openVialValidityHours: Number(
|
|
69
|
-
openVialValidityUnit:
|
|
70
|
-
maxConcurrentOpenVials:
|
|
71
|
-
requiresReconstitution: !!
|
|
72
|
-
reconstitutedValidityHours:
|
|
73
|
-
reconstitutedValidityUnit:
|
|
74
|
-
route:
|
|
75
|
-
storageTempMinCelsius:
|
|
76
|
-
storageTempMaxCelsius:
|
|
77
|
-
comments:
|
|
69
|
+
openVialValidityHours: Number(p.openVialValidityHours ?? 6),
|
|
70
|
+
openVialValidityUnit: p.openVialValidityUnit || "HOURS",
|
|
71
|
+
maxConcurrentOpenVials: b ? null : Number(p.maxConcurrentOpenVials ?? 2),
|
|
72
|
+
requiresReconstitution: !!p.requiresReconstitution,
|
|
73
|
+
reconstitutedValidityHours: S(p.reconstitutedValidityHours),
|
|
74
|
+
reconstitutedValidityUnit: p.reconstitutedValidityUnit || "HOURS",
|
|
75
|
+
route: p.route || null,
|
|
76
|
+
storageTempMinCelsius: S(p.storageTempMinCelsius),
|
|
77
|
+
storageTempMaxCelsius: S(p.storageTempMaxCelsius),
|
|
78
|
+
comments: p.comments || null
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
var
|
|
82
|
-
let { productId:
|
|
83
|
-
id:
|
|
81
|
+
function Li() {
|
|
82
|
+
var pe, ge, he, fe, ve, Ce, xe, be, ye, Ve, Ae, Te, Me, Se, Ue, Re, we, Oe;
|
|
83
|
+
let { productId: p } = xi(), W = bi(), [b, S] = E(!0), [P, f] = E(""), [k, K] = E(!1), [q, X] = E([]), [te, ne] = E([]), [re, d] = E([]), n = di(), y = Ye(), { productUnits: L } = fi(), R = (y == null ? void 0 : y.manageSales) !== !1, [t, w] = E({
|
|
84
|
+
id: p,
|
|
84
85
|
name: "",
|
|
85
86
|
categoryId: "",
|
|
86
87
|
brandId: "",
|
|
@@ -96,146 +97,163 @@ function Wi() {
|
|
|
96
97
|
isActive: !0,
|
|
97
98
|
imageUuids: [],
|
|
98
99
|
vaccineConfig: null
|
|
99
|
-
}),
|
|
100
|
-
|
|
100
|
+
}), B = Ee(() => q.find((i) => i.id === t.categoryId), [q, t.categoryId]), m = ((pe = B == null ? void 0 : B.code) == null ? void 0 : pe.toUpperCase()) === Je, oe = t.unit && !L.some((i) => i.value === t.unit) ? [...L, {
|
|
101
|
+
value: t.unit,
|
|
102
|
+
label: ei(t.unit)
|
|
103
|
+
}] : L, A = m && t.unit === "DROPS";
|
|
104
|
+
mi("update.manage.productManagement.product", () => {
|
|
101
105
|
async function i() {
|
|
102
|
-
var l,
|
|
103
|
-
|
|
106
|
+
var l, c;
|
|
107
|
+
S(!0);
|
|
104
108
|
try {
|
|
105
|
-
let [s,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
let [s, C, I] = await Promise.all([
|
|
110
|
+
_e(),
|
|
111
|
+
Ke(),
|
|
112
|
+
Xe().catch(() => [])
|
|
109
113
|
]);
|
|
110
|
-
|
|
114
|
+
X(s), ne(C), d(I);
|
|
111
115
|
try {
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
id:
|
|
115
|
-
name:
|
|
116
|
-
categoryId:
|
|
117
|
-
brandId:
|
|
118
|
-
description:
|
|
119
|
-
unit:
|
|
120
|
-
unitOther:
|
|
121
|
-
hasExpiry:
|
|
122
|
-
needsStorageUnit:
|
|
123
|
-
notForSale:
|
|
124
|
-
canBeQuarantined:
|
|
125
|
-
salePriceMode:
|
|
126
|
-
salePrice:
|
|
127
|
-
isActive:
|
|
128
|
-
imageUuids:
|
|
129
|
-
vaccineConfig:
|
|
130
|
-
vaccineCode:
|
|
131
|
-
vialVolumeMl:
|
|
132
|
-
singleDose:
|
|
133
|
-
profiles: (
|
|
134
|
-
key:
|
|
135
|
-
profileType:
|
|
136
|
-
fromAge:
|
|
137
|
-
fromUnit:
|
|
138
|
-
toAge:
|
|
139
|
-
toUnit:
|
|
140
|
-
doseAmount:
|
|
141
|
-
})) : [
|
|
142
|
-
openVialValidityHours:
|
|
143
|
-
openVialValidityUnit:
|
|
144
|
-
maxConcurrentOpenVials:
|
|
145
|
-
requiresReconstitution:
|
|
146
|
-
reconstitutedValidityHours:
|
|
147
|
-
reconstitutedValidityUnit:
|
|
148
|
-
route:
|
|
149
|
-
storageTempMinCelsius:
|
|
150
|
-
storageTempMaxCelsius:
|
|
151
|
-
comments:
|
|
116
|
+
let r = await Ze(p);
|
|
117
|
+
K(!1), w({
|
|
118
|
+
id: r.id,
|
|
119
|
+
name: r.name ?? "",
|
|
120
|
+
categoryId: r.categoryId ?? "",
|
|
121
|
+
brandId: r.brandId ?? "",
|
|
122
|
+
description: r.description ?? "",
|
|
123
|
+
unit: r.unit ?? "",
|
|
124
|
+
unitOther: r.unitOther ?? "",
|
|
125
|
+
hasExpiry: r.hasExpiry ?? !1,
|
|
126
|
+
needsStorageUnit: r.needsStorageUnit ?? !1,
|
|
127
|
+
notForSale: r.notForSale ?? !1,
|
|
128
|
+
canBeQuarantined: r.canBeQuarantined ?? !0,
|
|
129
|
+
salePriceMode: r.salePriceMode ?? "FREE",
|
|
130
|
+
salePrice: r.salePrice ?? "",
|
|
131
|
+
isActive: r.isActive ?? !0,
|
|
132
|
+
imageUuids: r.imageUuids ?? [],
|
|
133
|
+
vaccineConfig: r.vaccineConfig ? {
|
|
134
|
+
vaccineCode: r.vaccineConfig.vaccineCode ?? "",
|
|
135
|
+
vialVolumeMl: r.vaccineConfig.vialVolumeMl ?? "",
|
|
136
|
+
singleDose: r.vaccineConfig.singleDose ?? !1,
|
|
137
|
+
profiles: (r.vaccineConfig.profiles ?? []).length > 0 ? r.vaccineConfig.profiles.map((h) => ({
|
|
138
|
+
key: de(),
|
|
139
|
+
profileType: h.profileType ?? "AGE_BASED",
|
|
140
|
+
fromAge: h.fromAge ?? "",
|
|
141
|
+
fromUnit: h.fromUnit ?? "YEARS",
|
|
142
|
+
toAge: h.toAge ?? "",
|
|
143
|
+
toUnit: h.toUnit ?? "YEARS",
|
|
144
|
+
doseAmount: h.doseAmount ?? ""
|
|
145
|
+
})) : [ie()],
|
|
146
|
+
openVialValidityHours: r.vaccineConfig.openVialValidityHours ?? 6,
|
|
147
|
+
openVialValidityUnit: r.vaccineConfig.openVialValidityUnit ?? "HOURS",
|
|
148
|
+
maxConcurrentOpenVials: r.vaccineConfig.maxConcurrentOpenVials ?? 2,
|
|
149
|
+
requiresReconstitution: r.vaccineConfig.requiresReconstitution ?? !1,
|
|
150
|
+
reconstitutedValidityHours: r.vaccineConfig.reconstitutedValidityHours ?? "",
|
|
151
|
+
reconstitutedValidityUnit: r.vaccineConfig.reconstitutedValidityUnit ?? "HOURS",
|
|
152
|
+
route: r.vaccineConfig.route ?? "",
|
|
153
|
+
storageTempMinCelsius: r.vaccineConfig.storageTempMinCelsius ?? "",
|
|
154
|
+
storageTempMaxCelsius: r.vaccineConfig.storageTempMaxCelsius ?? "",
|
|
155
|
+
comments: r.vaccineConfig.comments ?? ""
|
|
152
156
|
} : null
|
|
153
157
|
});
|
|
154
158
|
} catch {
|
|
155
|
-
|
|
159
|
+
K(!0);
|
|
156
160
|
}
|
|
157
161
|
} catch (s) {
|
|
158
|
-
|
|
162
|
+
f(((c = (l = s == null ? void 0 : s.response) == null ? void 0 : l.data) == null ? void 0 : c.message) ?? (s == null ? void 0 : s.message) ?? "Failed to load product");
|
|
159
163
|
} finally {
|
|
160
|
-
|
|
164
|
+
S(!1);
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
i();
|
|
164
|
-
}, [
|
|
165
|
-
|
|
168
|
+
}, [p]), ue(() => {
|
|
169
|
+
w(m ? (i) => ({
|
|
166
170
|
...i,
|
|
167
|
-
unit: i.unit === "VIAL" || i.unit === "DROPS" ? i.unit :
|
|
171
|
+
unit: i.unit === "VIAL" || i.unit === "DROPS" ? i.unit : ii,
|
|
168
172
|
needsStorageUnit: !0,
|
|
169
|
-
vaccineConfig: i.vaccineConfig ?? { ...
|
|
173
|
+
vaccineConfig: i.vaccineConfig ?? { ...j }
|
|
170
174
|
}) : (i) => i.vaccineConfig ? {
|
|
171
175
|
...i,
|
|
172
176
|
vaccineConfig: null
|
|
173
177
|
} : i);
|
|
174
|
-
}, [
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
...
|
|
178
|
+
}, [m]);
|
|
179
|
+
function V(i, l) {
|
|
180
|
+
w((c) => ({
|
|
181
|
+
...c,
|
|
178
182
|
[i]: l
|
|
179
183
|
}));
|
|
180
184
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
...
|
|
185
|
+
function U(i, l) {
|
|
186
|
+
w((c) => ({
|
|
187
|
+
...c,
|
|
184
188
|
vaccineConfig: {
|
|
185
|
-
...
|
|
189
|
+
...c.vaccineConfig ?? j,
|
|
186
190
|
[i]: l
|
|
187
191
|
}
|
|
188
192
|
}));
|
|
189
193
|
}
|
|
190
|
-
function
|
|
191
|
-
|
|
192
|
-
let
|
|
193
|
-
return
|
|
194
|
-
...
|
|
195
|
-
[l]:
|
|
194
|
+
function Q(i, l, c) {
|
|
195
|
+
w((s) => {
|
|
196
|
+
let C = s.vaccineConfig ?? j, I = (C.profiles ?? []).slice();
|
|
197
|
+
return I[i] = {
|
|
198
|
+
...I[i],
|
|
199
|
+
[l]: c
|
|
196
200
|
}, {
|
|
197
201
|
...s,
|
|
198
202
|
vaccineConfig: {
|
|
199
|
-
...
|
|
200
|
-
profiles:
|
|
203
|
+
...C,
|
|
204
|
+
profiles: I
|
|
201
205
|
}
|
|
202
206
|
};
|
|
203
207
|
});
|
|
204
208
|
}
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
let l = i.vaccineConfig ??
|
|
209
|
+
function qe() {
|
|
210
|
+
w((i) => {
|
|
211
|
+
let l = i.vaccineConfig ?? j;
|
|
208
212
|
return {
|
|
209
213
|
...i,
|
|
210
214
|
vaccineConfig: {
|
|
211
215
|
...l,
|
|
212
|
-
profiles: [...l.profiles ?? [],
|
|
216
|
+
profiles: [...l.profiles ?? [], ie()]
|
|
213
217
|
}
|
|
214
218
|
};
|
|
215
219
|
});
|
|
216
220
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
219
|
-
let
|
|
221
|
+
function De(i) {
|
|
222
|
+
w((l) => {
|
|
223
|
+
let c = l.vaccineConfig ?? j;
|
|
220
224
|
return {
|
|
221
225
|
...l,
|
|
222
226
|
vaccineConfig: {
|
|
223
|
-
...
|
|
224
|
-
profiles: (
|
|
227
|
+
...c,
|
|
228
|
+
profiles: (c.profiles ?? []).filter((s, C) => C !== i)
|
|
225
229
|
}
|
|
226
230
|
};
|
|
227
231
|
});
|
|
228
232
|
}
|
|
229
|
-
function
|
|
230
|
-
|
|
233
|
+
function ze(i) {
|
|
234
|
+
w((l) => {
|
|
235
|
+
var C;
|
|
236
|
+
let c = l.vaccineConfig ?? j, s = (C = c.profiles) != null && C.length ? c.profiles : [ie()];
|
|
237
|
+
return {
|
|
238
|
+
...l,
|
|
239
|
+
vaccineConfig: {
|
|
240
|
+
...c,
|
|
241
|
+
singleDose: i,
|
|
242
|
+
profiles: i ? s.slice(0, 1) : s
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function Ne(i) {
|
|
248
|
+
let l = t.vaccineConfig ?? {}, c = l.profiles ?? [], s = A ? "drops" : "ml", C = A ? {
|
|
231
249
|
min: 0,
|
|
232
250
|
step: 1
|
|
233
251
|
} : {
|
|
234
252
|
step: "0.01",
|
|
235
253
|
min: 0
|
|
236
|
-
};
|
|
237
|
-
return /* @__PURE__ */ u(
|
|
238
|
-
/* @__PURE__ */ u(
|
|
254
|
+
}, I = l.vialVolumeMl === "" || l.vialVolumeMl == null ? "—" : l.vialVolumeMl;
|
|
255
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
256
|
+
/* @__PURE__ */ u(F, {
|
|
239
257
|
direction: "row",
|
|
240
258
|
justifyContent: "space-between",
|
|
241
259
|
alignItems: "center",
|
|
@@ -243,12 +261,12 @@ function Wi() {
|
|
|
243
261
|
children: [/* @__PURE__ */ e(v, {
|
|
244
262
|
variant: "body2",
|
|
245
263
|
sx: { fontWeight: 700 },
|
|
246
|
-
children: "Dose profiles"
|
|
247
|
-
}), /* @__PURE__ */ e(
|
|
264
|
+
children: i ? "Applicable age range" : "Dose profiles"
|
|
265
|
+
}), i ? null : /* @__PURE__ */ e(J, {
|
|
248
266
|
size: "small",
|
|
249
267
|
variant: "outlined",
|
|
250
|
-
startIcon: /* @__PURE__ */ e(
|
|
251
|
-
onClick:
|
|
268
|
+
startIcon: /* @__PURE__ */ e(Ci, {}),
|
|
269
|
+
onClick: qe,
|
|
252
270
|
children: "Add profile"
|
|
253
271
|
})]
|
|
254
272
|
}),
|
|
@@ -260,7 +278,13 @@ function Wi() {
|
|
|
260
278
|
mb: 1.5
|
|
261
279
|
},
|
|
262
280
|
children: [
|
|
263
|
-
|
|
281
|
+
i ? /* @__PURE__ */ u(Z, { children: [
|
|
282
|
+
"Each vial is one dose of ",
|
|
283
|
+
I,
|
|
284
|
+
" ",
|
|
285
|
+
s,
|
|
286
|
+
", so there is nothing to choose. Set the ages this product applies to, and a patient outside that range is blocked from receiving it."
|
|
287
|
+
] }) : /* @__PURE__ */ e(Z, { children: "Each band sets one dose. It is measured from the patient's reference date, so the right dose is chosen automatically when giving the vaccine." }),
|
|
264
288
|
/* @__PURE__ */ e("br", {}),
|
|
265
289
|
/* @__PURE__ */ e("strong", { children: "From" }),
|
|
266
290
|
" is included and ",
|
|
@@ -268,11 +292,11 @@ function Wi() {
|
|
|
268
292
|
" is not — a patient exactly at a To value falls into the next band. Leave To blank for no upper limit."
|
|
269
293
|
]
|
|
270
294
|
}),
|
|
271
|
-
/* @__PURE__ */ e(
|
|
295
|
+
/* @__PURE__ */ e(F, {
|
|
272
296
|
spacing: 1.5,
|
|
273
|
-
children:
|
|
274
|
-
let
|
|
275
|
-
return /* @__PURE__ */ e(
|
|
297
|
+
children: c.map((r, h) => {
|
|
298
|
+
let $ = `profiles.${h}.fromAge`, g = `profiles.${h}.toAge`, x = `profiles.${h}.doseAmount`, Y = r.toAge !== "" && r.toAge != null;
|
|
299
|
+
return /* @__PURE__ */ e(H, {
|
|
276
300
|
sx: {
|
|
277
301
|
p: 1.5,
|
|
278
302
|
border: "1px solid",
|
|
@@ -288,7 +312,7 @@ function Wi() {
|
|
|
288
312
|
item: !0,
|
|
289
313
|
xs: 6,
|
|
290
314
|
md: 2,
|
|
291
|
-
children: /* @__PURE__ */ e(
|
|
315
|
+
children: /* @__PURE__ */ e(M, {
|
|
292
316
|
required: !0,
|
|
293
317
|
fullWidth: !0,
|
|
294
318
|
size: "small",
|
|
@@ -298,29 +322,29 @@ function Wi() {
|
|
|
298
322
|
step: 1
|
|
299
323
|
},
|
|
300
324
|
label: "From",
|
|
301
|
-
value:
|
|
302
|
-
onChange: (
|
|
303
|
-
onBlur: n.onBlur(
|
|
304
|
-
error: n.show(
|
|
305
|
-
helperText: n.show(
|
|
325
|
+
value: r.fromAge ?? "",
|
|
326
|
+
onChange: (T) => Q(h, "fromAge", T.target.value),
|
|
327
|
+
onBlur: n.onBlur($),
|
|
328
|
+
error: n.show($) && !!o[$],
|
|
329
|
+
helperText: n.show($) ? o[$] : ""
|
|
306
330
|
})
|
|
307
331
|
}),
|
|
308
332
|
/* @__PURE__ */ e(a, {
|
|
309
333
|
item: !0,
|
|
310
334
|
xs: 6,
|
|
311
335
|
md: 2,
|
|
312
|
-
children: /* @__PURE__ */ e(
|
|
336
|
+
children: /* @__PURE__ */ e(O, {
|
|
313
337
|
label: "From unit",
|
|
314
|
-
value:
|
|
315
|
-
onChange: (
|
|
316
|
-
options:
|
|
338
|
+
value: r.fromUnit || "YEARS",
|
|
339
|
+
onChange: (T) => Q(h, "fromUnit", T),
|
|
340
|
+
options: Ie
|
|
317
341
|
})
|
|
318
342
|
}),
|
|
319
343
|
/* @__PURE__ */ e(a, {
|
|
320
344
|
item: !0,
|
|
321
345
|
xs: 6,
|
|
322
346
|
md: 2,
|
|
323
|
-
children: /* @__PURE__ */ e(
|
|
347
|
+
children: /* @__PURE__ */ e(M, {
|
|
324
348
|
fullWidth: !0,
|
|
325
349
|
size: "small",
|
|
326
350
|
type: "number",
|
|
@@ -329,124 +353,123 @@ function Wi() {
|
|
|
329
353
|
step: 1
|
|
330
354
|
},
|
|
331
355
|
label: "To",
|
|
332
|
-
value:
|
|
333
|
-
onChange: (
|
|
334
|
-
onBlur: n.onBlur(
|
|
335
|
-
error: n.show(
|
|
336
|
-
helperText: n.show(
|
|
356
|
+
value: r.toAge ?? "",
|
|
357
|
+
onChange: (T) => Q(h, "toAge", T.target.value),
|
|
358
|
+
onBlur: n.onBlur(g),
|
|
359
|
+
error: n.show(g) && !!o[g],
|
|
360
|
+
helperText: n.show(g) && o[g] ? o[g] : "Blank = no limit"
|
|
337
361
|
})
|
|
338
362
|
}),
|
|
339
363
|
/* @__PURE__ */ e(a, {
|
|
340
364
|
item: !0,
|
|
341
365
|
xs: 6,
|
|
342
366
|
md: 2,
|
|
343
|
-
children: /* @__PURE__ */ e(
|
|
367
|
+
children: /* @__PURE__ */ e(O, {
|
|
344
368
|
label: "To unit",
|
|
345
|
-
disabled: !
|
|
346
|
-
value:
|
|
347
|
-
onChange: (
|
|
348
|
-
options:
|
|
369
|
+
disabled: !Y,
|
|
370
|
+
value: Y ? r.toUnit || "YEARS" : "",
|
|
371
|
+
onChange: (T) => Q(h, "toUnit", T),
|
|
372
|
+
options: Ie
|
|
349
373
|
})
|
|
350
374
|
}),
|
|
351
|
-
/* @__PURE__ */ e(a, {
|
|
375
|
+
i ? null : /* @__PURE__ */ u(Z, { children: [/* @__PURE__ */ e(a, {
|
|
352
376
|
item: !0,
|
|
353
377
|
xs: 8,
|
|
354
378
|
md: 3,
|
|
355
|
-
children: /* @__PURE__ */ e(
|
|
379
|
+
children: /* @__PURE__ */ e(M, {
|
|
356
380
|
required: !0,
|
|
357
381
|
fullWidth: !0,
|
|
358
382
|
size: "small",
|
|
359
383
|
type: "number",
|
|
360
|
-
inputProps:
|
|
361
|
-
label: `Dose (${
|
|
362
|
-
value:
|
|
363
|
-
onChange: (
|
|
364
|
-
onBlur: n.onBlur(
|
|
365
|
-
error: n.show(
|
|
366
|
-
helperText: n.show(
|
|
384
|
+
inputProps: C,
|
|
385
|
+
label: `Dose (${s})`,
|
|
386
|
+
value: r.doseAmount ?? "",
|
|
387
|
+
onChange: (T) => Q(h, "doseAmount", T.target.value),
|
|
388
|
+
onBlur: n.onBlur(x),
|
|
389
|
+
error: n.show(x) && !!o[x],
|
|
390
|
+
helperText: n.show(x) ? o[x] : ""
|
|
367
391
|
})
|
|
368
|
-
}),
|
|
369
|
-
/* @__PURE__ */ e(a, {
|
|
392
|
+
}), /* @__PURE__ */ e(a, {
|
|
370
393
|
item: !0,
|
|
371
394
|
xs: 4,
|
|
372
395
|
md: 1,
|
|
373
396
|
sx: { textAlign: "right" },
|
|
374
|
-
children: /* @__PURE__ */ e(
|
|
397
|
+
children: /* @__PURE__ */ e(Fe, {
|
|
375
398
|
color: "error",
|
|
376
|
-
onClick: () =>
|
|
377
|
-
disabled:
|
|
378
|
-
children: /* @__PURE__ */ e(
|
|
399
|
+
onClick: () => De(h),
|
|
400
|
+
disabled: c.length === 1,
|
|
401
|
+
children: /* @__PURE__ */ e(Vi, {})
|
|
379
402
|
})
|
|
380
|
-
})
|
|
403
|
+
})] })
|
|
381
404
|
]
|
|
382
405
|
})
|
|
383
|
-
},
|
|
406
|
+
}, r.key);
|
|
384
407
|
})
|
|
385
408
|
}),
|
|
386
|
-
n.show("profiles") &&
|
|
409
|
+
n.show("profiles") && o.profiles ? /* @__PURE__ */ e(v, {
|
|
387
410
|
variant: "caption",
|
|
388
411
|
color: "error",
|
|
389
412
|
sx: {
|
|
390
413
|
display: "block",
|
|
391
414
|
mt: 1
|
|
392
415
|
},
|
|
393
|
-
children:
|
|
416
|
+
children: o.profiles
|
|
394
417
|
}) : null
|
|
395
418
|
] });
|
|
396
419
|
}
|
|
397
|
-
let
|
|
420
|
+
let o = Ee(() => {
|
|
398
421
|
let i = {
|
|
399
|
-
name:
|
|
400
|
-
categoryId:
|
|
401
|
-
brandId:
|
|
402
|
-
unit:
|
|
403
|
-
unitOther: t.unit === "OTHER" ?
|
|
404
|
-
salePrice:
|
|
422
|
+
name: D(t.name, "Product name"),
|
|
423
|
+
categoryId: D(t.categoryId, "Category"),
|
|
424
|
+
brandId: D(t.brandId, "Brand"),
|
|
425
|
+
unit: D(t.unit, "Unit"),
|
|
426
|
+
unitOther: t.unit === "OTHER" ? D(t.unitOther, "Custom unit") : "",
|
|
427
|
+
salePrice: R && !t.notForSale && t.salePriceMode !== "FREE" ? D(t.salePrice, "Sale price") || (Number(t.salePrice) > 0 ? "" : "Sale price must be greater than 0.") : ""
|
|
405
428
|
};
|
|
406
|
-
if (
|
|
407
|
-
let l = t.vaccineConfig,
|
|
408
|
-
|
|
409
|
-
vaccineCode:
|
|
410
|
-
vialVolumeMl:
|
|
411
|
-
openVialValidityHours:
|
|
412
|
-
reconstitutedValidityHours:
|
|
429
|
+
if (m && t.vaccineConfig) {
|
|
430
|
+
let l = t.vaccineConfig, c = !A && l.singleDose, s = oi(l.storageTempMinCelsius, l.storageTempMaxCelsius);
|
|
431
|
+
Object.assign(i, {
|
|
432
|
+
vaccineCode: D(l.vaccineCode, "Vaccine"),
|
|
433
|
+
vialVolumeMl: si(l.vialVolumeMl),
|
|
434
|
+
openVialValidityHours: c ? "" : li(l.openVialValidityHours),
|
|
435
|
+
reconstitutedValidityHours: ai(l.reconstitutedValidityHours, l.requiresReconstitution),
|
|
413
436
|
storageTempMinCelsius: s.min,
|
|
414
437
|
storageTempMaxCelsius: s.max
|
|
415
|
-
})
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
})
|
|
433
|
-
}
|
|
438
|
+
});
|
|
439
|
+
let C = Number(l.vialVolumeMl), I = A ? "drops" : "ml", r = l.profiles ?? [];
|
|
440
|
+
r.length === 0 && (i.profiles = c ? "Add the age range this product applies to." : "Add at least one administration profile.");
|
|
441
|
+
let h = {
|
|
442
|
+
DAYS: 1,
|
|
443
|
+
WEEKS: 7,
|
|
444
|
+
MONTHS: 30,
|
|
445
|
+
YEARS: 365
|
|
446
|
+
}, $ = (g, x) => Number(g) * (h[x] || 1);
|
|
447
|
+
r.forEach((g, x) => {
|
|
448
|
+
let Y = Number(g.fromAge);
|
|
449
|
+
if (g.fromAge === "" || g.fromAge == null ? i[`profiles.${x}.fromAge`] = "Required" : (!Number.isInteger(Y) || Y < 0) && (i[`profiles.${x}.fromAge`] = "Whole number, 0 or more"), g.toAge !== "" && g.toAge != null) {
|
|
450
|
+
let ae = Number(g.toAge);
|
|
451
|
+
!Number.isInteger(ae) || ae < 0 ? i[`profiles.${x}.toAge`] = "Whole number, 0 or more" : $(ae, g.toUnit) <= $(Y, g.fromUnit) && (i[`profiles.${x}.toAge`] = "Must be greater than From");
|
|
452
|
+
}
|
|
453
|
+
if (c) return;
|
|
454
|
+
let T = Number(g.doseAmount);
|
|
455
|
+
g.doseAmount === "" || g.doseAmount == null ? i[`profiles.${x}.doseAmount`] = "Required" : !Number.isFinite(T) || T <= 0 ? i[`profiles.${x}.doseAmount`] = "Must be greater than 0" : A && !Number.isInteger(T) ? i[`profiles.${x}.doseAmount`] = "Whole number" : Number.isFinite(C) && C > 0 && T > C && (i[`profiles.${x}.doseAmount`] = `At most ${C} ${I}`);
|
|
456
|
+
}), c || (i.maxConcurrentOpenVials = ci(l.maxConcurrentOpenVials));
|
|
434
457
|
}
|
|
435
458
|
return i;
|
|
436
459
|
}, [
|
|
437
460
|
t,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
]),
|
|
442
|
-
async function
|
|
443
|
-
var i, l,
|
|
444
|
-
if (!
|
|
445
|
-
n.markAllTouched(),
|
|
461
|
+
m,
|
|
462
|
+
A,
|
|
463
|
+
R
|
|
464
|
+
]), me = ui(o);
|
|
465
|
+
async function Le() {
|
|
466
|
+
var i, l, c;
|
|
467
|
+
if (!me) {
|
|
468
|
+
n.markAllTouched(), f("Please fix the highlighted fields and try again.");
|
|
446
469
|
return;
|
|
447
470
|
}
|
|
448
471
|
try {
|
|
449
|
-
await
|
|
472
|
+
await Qe({
|
|
450
473
|
id: t.id,
|
|
451
474
|
name: t.name.trim(),
|
|
452
475
|
categoryId: t.categoryId,
|
|
@@ -456,58 +479,58 @@ function Wi() {
|
|
|
456
479
|
unitOther: t.unit === "OTHER" && ((i = t.unitOther) == null ? void 0 : i.trim()) || null,
|
|
457
480
|
hasExpiry: !!t.hasExpiry,
|
|
458
481
|
needsStorageUnit: !!t.needsStorageUnit,
|
|
459
|
-
notForSale:
|
|
482
|
+
notForSale: R ? !!t.notForSale : !1,
|
|
460
483
|
canBeQuarantined: !!t.canBeQuarantined,
|
|
461
|
-
salePriceMode:
|
|
462
|
-
salePrice:
|
|
484
|
+
salePriceMode: R && !t.notForSale ? t.salePriceMode : "FREE",
|
|
485
|
+
salePrice: R && !t.notForSale && t.salePriceMode !== "FREE" && t.salePrice !== "" ? Number(t.salePrice) : null,
|
|
463
486
|
isActive: !!t.isActive,
|
|
464
487
|
imageUuids: t.imageUuids ?? [],
|
|
465
|
-
vaccineConfig: t.vaccineConfig ?
|
|
466
|
-
}),
|
|
488
|
+
vaccineConfig: t.vaccineConfig ? Si(t.vaccineConfig, A) : null
|
|
489
|
+
}), _({
|
|
467
490
|
message: "Product saved.",
|
|
468
491
|
type: "success"
|
|
469
|
-
}),
|
|
492
|
+
}), W("/ui/medplat/manage/pm/products");
|
|
470
493
|
} catch (s) {
|
|
471
|
-
|
|
494
|
+
f(((c = (l = s == null ? void 0 : s.response) == null ? void 0 : l.data) == null ? void 0 : c.message) ?? (s == null ? void 0 : s.message) ?? "Failed to save product");
|
|
472
495
|
}
|
|
473
496
|
}
|
|
474
|
-
return /* @__PURE__ */ u(
|
|
497
|
+
return /* @__PURE__ */ u(H, { children: [/* @__PURE__ */ e(pi, {}), /* @__PURE__ */ e(gi, {
|
|
475
498
|
perm: "update.manage.productManagement.product",
|
|
476
499
|
title: "You don’t have permission to create or edit products",
|
|
477
|
-
children: /* @__PURE__ */ u(
|
|
478
|
-
title:
|
|
479
|
-
subtitle: `Category: ${(
|
|
480
|
-
actions: /* @__PURE__ */ u(
|
|
500
|
+
children: /* @__PURE__ */ u(hi, {
|
|
501
|
+
title: k ? "Add Product" : "Edit Product",
|
|
502
|
+
subtitle: `Category: ${(B == null ? void 0 : B.code) ?? "—"}`,
|
|
503
|
+
actions: /* @__PURE__ */ u(F, {
|
|
481
504
|
direction: "row",
|
|
482
505
|
spacing: 1,
|
|
483
|
-
children: [/* @__PURE__ */ e(
|
|
506
|
+
children: [/* @__PURE__ */ e(J, {
|
|
484
507
|
variant: "outlined",
|
|
485
|
-
onClick: () =>
|
|
508
|
+
onClick: () => W("/ui/medplat/manage/pm/products"),
|
|
486
509
|
children: "Cancel"
|
|
487
|
-
}), /* @__PURE__ */ e(
|
|
510
|
+
}), /* @__PURE__ */ e(J, {
|
|
488
511
|
variant: "contained",
|
|
489
|
-
startIcon: /* @__PURE__ */ e(
|
|
490
|
-
disabled: !
|
|
491
|
-
onClick: () => void
|
|
512
|
+
startIcon: /* @__PURE__ */ e(yi, {}),
|
|
513
|
+
disabled: !me,
|
|
514
|
+
onClick: () => void Le(),
|
|
492
515
|
children: "Save"
|
|
493
516
|
})]
|
|
494
517
|
}),
|
|
495
518
|
children: [
|
|
496
|
-
|
|
519
|
+
b ? /* @__PURE__ */ e(ke, {
|
|
497
520
|
severity: "info",
|
|
498
521
|
children: "Loading…"
|
|
499
522
|
}) : null,
|
|
500
|
-
|
|
523
|
+
P ? /* @__PURE__ */ e(ke, {
|
|
501
524
|
severity: "error",
|
|
502
525
|
sx: { mb: 2 },
|
|
503
|
-
children:
|
|
526
|
+
children: P
|
|
504
527
|
}) : null,
|
|
505
|
-
/* @__PURE__ */ e(
|
|
528
|
+
/* @__PURE__ */ e(se, {
|
|
506
529
|
sx: {
|
|
507
530
|
borderRadius: 1.5,
|
|
508
531
|
mb: 2
|
|
509
532
|
},
|
|
510
|
-
children: /* @__PURE__ */ u(
|
|
533
|
+
children: /* @__PURE__ */ u(ce, { children: [/* @__PURE__ */ e(v, {
|
|
511
534
|
variant: "h6",
|
|
512
535
|
sx: {
|
|
513
536
|
fontWeight: 800,
|
|
@@ -522,19 +545,19 @@ function Wi() {
|
|
|
522
545
|
item: !0,
|
|
523
546
|
xs: 12,
|
|
524
547
|
md: 6,
|
|
525
|
-
children: /* @__PURE__ */ e(
|
|
548
|
+
children: /* @__PURE__ */ e(M, {
|
|
526
549
|
required: !0,
|
|
527
550
|
fullWidth: !0,
|
|
528
551
|
size: "small",
|
|
529
552
|
label: "Product Name",
|
|
530
553
|
value: t.name,
|
|
531
554
|
inputProps: { maxLength: 255 },
|
|
532
|
-
onChange: (i) =>
|
|
555
|
+
onChange: (i) => V("name", i.target.value),
|
|
533
556
|
onBlur: n.onBlur("name"),
|
|
534
|
-
error: n.show("name") && !!
|
|
557
|
+
error: n.show("name") && !!o.name,
|
|
535
558
|
FormHelperTextProps: { component: "div" },
|
|
536
|
-
helperText: /* @__PURE__ */ e(
|
|
537
|
-
message: n.show("name") ?
|
|
559
|
+
helperText: /* @__PURE__ */ e(Pe, {
|
|
560
|
+
message: n.show("name") ? o.name : "",
|
|
538
561
|
value: t.name,
|
|
539
562
|
max: 255
|
|
540
563
|
})
|
|
@@ -544,15 +567,15 @@ function Wi() {
|
|
|
544
567
|
item: !0,
|
|
545
568
|
xs: 12,
|
|
546
569
|
md: 3,
|
|
547
|
-
children: /* @__PURE__ */ e(
|
|
570
|
+
children: /* @__PURE__ */ e(O, {
|
|
548
571
|
label: "Category",
|
|
549
572
|
required: !0,
|
|
550
573
|
value: t.categoryId,
|
|
551
|
-
onChange: (i) =>
|
|
574
|
+
onChange: (i) => V("categoryId", i),
|
|
552
575
|
onBlur: n.onBlur("categoryId"),
|
|
553
|
-
error: n.show("categoryId") && !!
|
|
554
|
-
helperText: n.show("categoryId") ?
|
|
555
|
-
options:
|
|
576
|
+
error: n.show("categoryId") && !!o.categoryId,
|
|
577
|
+
helperText: n.show("categoryId") ? o.categoryId : "",
|
|
578
|
+
options: q.map((i) => ({
|
|
556
579
|
value: i.id,
|
|
557
580
|
label: `${i.name} (${i.code})`
|
|
558
581
|
}))
|
|
@@ -562,52 +585,52 @@ function Wi() {
|
|
|
562
585
|
item: !0,
|
|
563
586
|
xs: 12,
|
|
564
587
|
md: 3,
|
|
565
|
-
children: /* @__PURE__ */ e(
|
|
588
|
+
children: /* @__PURE__ */ e(O, {
|
|
566
589
|
label: "Brand",
|
|
567
590
|
required: !0,
|
|
568
591
|
value: t.brandId,
|
|
569
|
-
onChange: (i) =>
|
|
592
|
+
onChange: (i) => V("brandId", i),
|
|
570
593
|
onBlur: n.onBlur("brandId"),
|
|
571
|
-
error: n.show("brandId") && !!
|
|
572
|
-
helperText: n.show("brandId") ?
|
|
573
|
-
options:
|
|
594
|
+
error: n.show("brandId") && !!o.brandId,
|
|
595
|
+
helperText: n.show("brandId") ? o.brandId : "",
|
|
596
|
+
options: te.map((i) => ({
|
|
574
597
|
value: i.id,
|
|
575
598
|
label: i.name
|
|
576
599
|
}))
|
|
577
600
|
})
|
|
578
601
|
}),
|
|
579
|
-
|
|
602
|
+
m ? null : /* @__PURE__ */ e(a, {
|
|
580
603
|
item: !0,
|
|
581
604
|
xs: 12,
|
|
582
605
|
md: 3,
|
|
583
|
-
children: /* @__PURE__ */ e(
|
|
606
|
+
children: /* @__PURE__ */ e(O, {
|
|
584
607
|
label: "Unit",
|
|
585
608
|
required: !0,
|
|
586
609
|
value: t.unit,
|
|
587
|
-
onChange: (i) =>
|
|
610
|
+
onChange: (i) => V("unit", i),
|
|
588
611
|
onBlur: n.onBlur("unit"),
|
|
589
|
-
error: n.show("unit") && !!
|
|
590
|
-
helperText: n.show("unit") &&
|
|
591
|
-
options:
|
|
612
|
+
error: n.show("unit") && !!o.unit,
|
|
613
|
+
helperText: n.show("unit") && o.unit ? o.unit : "",
|
|
614
|
+
options: oe
|
|
592
615
|
})
|
|
593
616
|
}),
|
|
594
|
-
!
|
|
617
|
+
!m && t.unit === "OTHER" ? /* @__PURE__ */ e(a, {
|
|
595
618
|
item: !0,
|
|
596
619
|
xs: 12,
|
|
597
620
|
md: 3,
|
|
598
|
-
children: /* @__PURE__ */ e(
|
|
621
|
+
children: /* @__PURE__ */ e(M, {
|
|
599
622
|
required: !0,
|
|
600
623
|
fullWidth: !0,
|
|
601
624
|
size: "small",
|
|
602
625
|
label: "Custom unit name",
|
|
603
626
|
value: t.unitOther,
|
|
604
627
|
inputProps: { maxLength: 50 },
|
|
605
|
-
onChange: (i) =>
|
|
628
|
+
onChange: (i) => V("unitOther", i.target.value),
|
|
606
629
|
onBlur: n.onBlur("unitOther"),
|
|
607
|
-
error: n.show("unitOther") && !!
|
|
630
|
+
error: n.show("unitOther") && !!o.unitOther,
|
|
608
631
|
FormHelperTextProps: { component: "div" },
|
|
609
|
-
helperText: /* @__PURE__ */ e(
|
|
610
|
-
message: n.show("unitOther") &&
|
|
632
|
+
helperText: /* @__PURE__ */ e(Pe, {
|
|
633
|
+
message: n.show("unitOther") && o.unitOther ? o.unitOther : "e.g. Strip, Ampoule, Sachet",
|
|
611
634
|
value: t.unitOther,
|
|
612
635
|
max: 50
|
|
613
636
|
})
|
|
@@ -617,36 +640,36 @@ function Wi() {
|
|
|
617
640
|
item: !0,
|
|
618
641
|
xs: 6,
|
|
619
642
|
md: 3,
|
|
620
|
-
children: /* @__PURE__ */ e(
|
|
621
|
-
control: /* @__PURE__ */ e(
|
|
643
|
+
children: /* @__PURE__ */ e(z, {
|
|
644
|
+
control: /* @__PURE__ */ e(N, {
|
|
622
645
|
checked: !!t.hasExpiry,
|
|
623
|
-
disabled:
|
|
624
|
-
onChange: (i) =>
|
|
646
|
+
disabled: m,
|
|
647
|
+
onChange: (i) => V("hasExpiry", i.target.checked)
|
|
625
648
|
}),
|
|
626
|
-
label:
|
|
649
|
+
label: m ? "Has expiry (vaccine)" : "Has expiry"
|
|
627
650
|
})
|
|
628
651
|
}),
|
|
629
652
|
/* @__PURE__ */ e(a, {
|
|
630
653
|
item: !0,
|
|
631
654
|
xs: 6,
|
|
632
655
|
md: 3,
|
|
633
|
-
children: /* @__PURE__ */ e(
|
|
634
|
-
control: /* @__PURE__ */ e(
|
|
656
|
+
children: /* @__PURE__ */ e(z, {
|
|
657
|
+
control: /* @__PURE__ */ e(N, {
|
|
635
658
|
checked: !!t.needsStorageUnit,
|
|
636
|
-
disabled:
|
|
637
|
-
onChange: (i) =>
|
|
659
|
+
disabled: m,
|
|
660
|
+
onChange: (i) => V("needsStorageUnit", i.target.checked)
|
|
638
661
|
}),
|
|
639
|
-
label:
|
|
662
|
+
label: m ? "Needs storage unit (vaccine)" : "Needs storage unit"
|
|
640
663
|
})
|
|
641
664
|
}),
|
|
642
|
-
|
|
665
|
+
R ? /* @__PURE__ */ e(a, {
|
|
643
666
|
item: !0,
|
|
644
667
|
xs: 6,
|
|
645
668
|
md: 3,
|
|
646
|
-
children: /* @__PURE__ */ e(
|
|
647
|
-
control: /* @__PURE__ */ e(
|
|
669
|
+
children: /* @__PURE__ */ e(z, {
|
|
670
|
+
control: /* @__PURE__ */ e(N, {
|
|
648
671
|
checked: !!t.notForSale,
|
|
649
|
-
onChange: (i) =>
|
|
672
|
+
onChange: (i) => V("notForSale", i.target.checked)
|
|
650
673
|
}),
|
|
651
674
|
label: "Not for sale"
|
|
652
675
|
})
|
|
@@ -655,10 +678,10 @@ function Wi() {
|
|
|
655
678
|
item: !0,
|
|
656
679
|
xs: 6,
|
|
657
680
|
md: 3,
|
|
658
|
-
children: /* @__PURE__ */ e(
|
|
659
|
-
control: /* @__PURE__ */ e(
|
|
681
|
+
children: /* @__PURE__ */ e(z, {
|
|
682
|
+
control: /* @__PURE__ */ e(N, {
|
|
660
683
|
checked: !!t.canBeQuarantined,
|
|
661
|
-
onChange: (i) =>
|
|
684
|
+
onChange: (i) => V("canBeQuarantined", i.target.checked)
|
|
662
685
|
}),
|
|
663
686
|
label: "Can be quarantined"
|
|
664
687
|
})
|
|
@@ -667,30 +690,30 @@ function Wi() {
|
|
|
667
690
|
item: !0,
|
|
668
691
|
xs: 6,
|
|
669
692
|
md: 3,
|
|
670
|
-
children: /* @__PURE__ */ e(
|
|
671
|
-
control: /* @__PURE__ */ e(
|
|
693
|
+
children: /* @__PURE__ */ e(z, {
|
|
694
|
+
control: /* @__PURE__ */ e(N, {
|
|
672
695
|
checked: !!t.isActive,
|
|
673
|
-
onChange: (i) =>
|
|
696
|
+
onChange: (i) => V("isActive", i.target.checked)
|
|
674
697
|
}),
|
|
675
698
|
label: "Active"
|
|
676
699
|
})
|
|
677
700
|
}),
|
|
678
|
-
|
|
701
|
+
R && !t.notForSale ? /* @__PURE__ */ u(Z, { children: [/* @__PURE__ */ e(a, {
|
|
679
702
|
item: !0,
|
|
680
703
|
xs: 12,
|
|
681
704
|
md: 4,
|
|
682
|
-
children: /* @__PURE__ */ e(
|
|
705
|
+
children: /* @__PURE__ */ e(O, {
|
|
683
706
|
label: "Sale price mode",
|
|
684
707
|
value: t.salePriceMode,
|
|
685
|
-
onChange: (i) =>
|
|
686
|
-
options:
|
|
708
|
+
onChange: (i) => V("salePriceMode", i),
|
|
709
|
+
options: ti,
|
|
687
710
|
helperText: "Fixed shows a locked price at sale time; MRP caps the entered price."
|
|
688
711
|
})
|
|
689
712
|
}), t.salePriceMode === "FREE" ? null : /* @__PURE__ */ e(a, {
|
|
690
713
|
item: !0,
|
|
691
714
|
xs: 12,
|
|
692
715
|
md: 4,
|
|
693
|
-
children: /* @__PURE__ */ e(
|
|
716
|
+
children: /* @__PURE__ */ e(M, {
|
|
694
717
|
required: !0,
|
|
695
718
|
fullWidth: !0,
|
|
696
719
|
size: "small",
|
|
@@ -701,35 +724,35 @@ function Wi() {
|
|
|
701
724
|
},
|
|
702
725
|
label: t.salePriceMode === "FIXED" ? "Fixed sale price" : "Price cap (MRP)",
|
|
703
726
|
value: t.salePrice,
|
|
704
|
-
onChange: (i) =>
|
|
727
|
+
onChange: (i) => V("salePrice", i.target.value),
|
|
705
728
|
onBlur: n.onBlur("salePrice"),
|
|
706
|
-
error: n.show("salePrice") && !!
|
|
707
|
-
helperText: n.show("salePrice") ?
|
|
729
|
+
error: n.show("salePrice") && !!o.salePrice,
|
|
730
|
+
helperText: n.show("salePrice") ? o.salePrice : ""
|
|
708
731
|
})
|
|
709
732
|
})] }) : null,
|
|
710
733
|
/* @__PURE__ */ e(a, {
|
|
711
734
|
item: !0,
|
|
712
735
|
xs: 12,
|
|
713
|
-
children: /* @__PURE__ */ e(
|
|
736
|
+
children: /* @__PURE__ */ e(M, {
|
|
714
737
|
fullWidth: !0,
|
|
715
738
|
size: "small",
|
|
716
739
|
multiline: !0,
|
|
717
740
|
minRows: 2,
|
|
718
741
|
label: "Description",
|
|
719
742
|
value: t.description,
|
|
720
|
-
onChange: (i) =>
|
|
743
|
+
onChange: (i) => V("description", i.target.value)
|
|
721
744
|
})
|
|
722
745
|
})
|
|
723
746
|
]
|
|
724
747
|
})] })
|
|
725
748
|
}),
|
|
726
|
-
/* @__PURE__ */ e(
|
|
749
|
+
/* @__PURE__ */ e(se, {
|
|
727
750
|
sx: {
|
|
728
751
|
borderRadius: 1.5,
|
|
729
752
|
mb: 2
|
|
730
753
|
},
|
|
731
|
-
children: /* @__PURE__ */ u(
|
|
732
|
-
/* @__PURE__ */ u(
|
|
754
|
+
children: /* @__PURE__ */ u(ce, { children: [
|
|
755
|
+
/* @__PURE__ */ u(F, {
|
|
733
756
|
direction: "row",
|
|
734
757
|
justifyContent: "space-between",
|
|
735
758
|
alignItems: "center",
|
|
@@ -743,7 +766,7 @@ function Wi() {
|
|
|
743
766
|
color: "text.secondary",
|
|
744
767
|
children: [
|
|
745
768
|
"Optional · up to ",
|
|
746
|
-
|
|
769
|
+
ee,
|
|
747
770
|
" images"
|
|
748
771
|
]
|
|
749
772
|
})]
|
|
@@ -757,16 +780,16 @@ function Wi() {
|
|
|
757
780
|
},
|
|
758
781
|
children: "Add photos of the product or its packaging. The first image is used as the main picture."
|
|
759
782
|
}),
|
|
760
|
-
/* @__PURE__ */ e(
|
|
783
|
+
/* @__PURE__ */ e(We, {
|
|
761
784
|
value: t.imageUuids,
|
|
762
|
-
onChange: (i) =>
|
|
785
|
+
onChange: (i) => V("imageUuids", i)
|
|
763
786
|
})
|
|
764
787
|
] })
|
|
765
788
|
}),
|
|
766
|
-
|
|
789
|
+
m ? /* @__PURE__ */ e(se, {
|
|
767
790
|
sx: { borderRadius: 1.5 },
|
|
768
|
-
children: /* @__PURE__ */ u(
|
|
769
|
-
/* @__PURE__ */ u(
|
|
791
|
+
children: /* @__PURE__ */ u(ce, { children: [
|
|
792
|
+
/* @__PURE__ */ u(F, {
|
|
770
793
|
direction: "row",
|
|
771
794
|
justifyContent: "space-between",
|
|
772
795
|
alignItems: "center",
|
|
@@ -781,7 +804,7 @@ function Wi() {
|
|
|
781
804
|
children: "Required for vaccine products. Controls vial size, dosing, and shelf life rules."
|
|
782
805
|
})]
|
|
783
806
|
}),
|
|
784
|
-
/* @__PURE__ */ e(
|
|
807
|
+
/* @__PURE__ */ e(vi, { sx: { mb: 2 } }),
|
|
785
808
|
/* @__PURE__ */ u(a, {
|
|
786
809
|
container: !0,
|
|
787
810
|
spacing: 2,
|
|
@@ -791,7 +814,7 @@ function Wi() {
|
|
|
791
814
|
xs: 12,
|
|
792
815
|
children: /* @__PURE__ */ e(v, {
|
|
793
816
|
variant: "overline",
|
|
794
|
-
sx:
|
|
817
|
+
sx: G,
|
|
795
818
|
children: "Vaccine & measure"
|
|
796
819
|
})
|
|
797
820
|
}),
|
|
@@ -799,16 +822,16 @@ function Wi() {
|
|
|
799
822
|
item: !0,
|
|
800
823
|
xs: 12,
|
|
801
824
|
md: 4,
|
|
802
|
-
children: /* @__PURE__ */ e(
|
|
825
|
+
children: /* @__PURE__ */ e(O, {
|
|
803
826
|
label: "Vaccine",
|
|
804
827
|
required: !0,
|
|
805
|
-
value: ((
|
|
806
|
-
onChange: (i) =>
|
|
828
|
+
value: ((ge = t.vaccineConfig) == null ? void 0 : ge.vaccineCode) || "",
|
|
829
|
+
onChange: (i) => U("vaccineCode", i),
|
|
807
830
|
onBlur: n.onBlur("vaccineCode"),
|
|
808
|
-
error: n.show("vaccineCode") && !!
|
|
809
|
-
helperText: n.show("vaccineCode") &&
|
|
831
|
+
error: n.show("vaccineCode") && !!o.vaccineCode,
|
|
832
|
+
helperText: n.show("vaccineCode") && o.vaccineCode ? o.vaccineCode : "",
|
|
810
833
|
noOptionsText: "No vaccines configured in immunization master",
|
|
811
|
-
options:
|
|
834
|
+
options: re.map((i) => ({
|
|
812
835
|
value: i.vaccineCode,
|
|
813
836
|
label: `${i.vaccineName} (${i.vaccineCode})`
|
|
814
837
|
}))
|
|
@@ -818,11 +841,11 @@ function Wi() {
|
|
|
818
841
|
item: !0,
|
|
819
842
|
xs: 12,
|
|
820
843
|
md: 4,
|
|
821
|
-
children: /* @__PURE__ */ e(
|
|
844
|
+
children: /* @__PURE__ */ e(O, {
|
|
822
845
|
label: "Measured in",
|
|
823
846
|
value: t.unit,
|
|
824
|
-
onChange: (i) =>
|
|
825
|
-
options:
|
|
847
|
+
onChange: (i) => V("unit", i),
|
|
848
|
+
options: ni,
|
|
826
849
|
helperText: "Vials are dosed in millilitres; drops are counted."
|
|
827
850
|
})
|
|
828
851
|
}),
|
|
@@ -830,24 +853,24 @@ function Wi() {
|
|
|
830
853
|
item: !0,
|
|
831
854
|
xs: 12,
|
|
832
855
|
md: 4,
|
|
833
|
-
children: /* @__PURE__ */ e(
|
|
856
|
+
children: /* @__PURE__ */ e(M, {
|
|
834
857
|
required: !0,
|
|
835
858
|
fullWidth: !0,
|
|
836
859
|
size: "small",
|
|
837
860
|
type: "number",
|
|
838
|
-
inputProps:
|
|
861
|
+
inputProps: A ? {
|
|
839
862
|
min: 1,
|
|
840
863
|
step: 1
|
|
841
864
|
} : {
|
|
842
865
|
step: "0.01",
|
|
843
866
|
min: 0
|
|
844
867
|
},
|
|
845
|
-
label:
|
|
846
|
-
value: ((
|
|
847
|
-
onChange: (i) =>
|
|
868
|
+
label: A ? "Drops per vial" : "Vial volume (ml)",
|
|
869
|
+
value: ((he = t.vaccineConfig) == null ? void 0 : he.vialVolumeMl) ?? "",
|
|
870
|
+
onChange: (i) => U("vialVolumeMl", i.target.value),
|
|
848
871
|
onBlur: n.onBlur("vialVolumeMl"),
|
|
849
|
-
error: n.show("vialVolumeMl") && !!
|
|
850
|
-
helperText: n.show("vialVolumeMl") ?
|
|
872
|
+
error: n.show("vialVolumeMl") && !!o.vialVolumeMl,
|
|
873
|
+
helperText: n.show("vialVolumeMl") ? o.vialVolumeMl : A ? "Total drops in a fresh vial" : ""
|
|
851
874
|
})
|
|
852
875
|
}),
|
|
853
876
|
/* @__PURE__ */ e(a, {
|
|
@@ -856,19 +879,19 @@ function Wi() {
|
|
|
856
879
|
children: /* @__PURE__ */ e(v, {
|
|
857
880
|
variant: "overline",
|
|
858
881
|
sx: {
|
|
859
|
-
...
|
|
882
|
+
...G,
|
|
860
883
|
mt: 1
|
|
861
884
|
},
|
|
862
885
|
children: "Dosing"
|
|
863
886
|
})
|
|
864
887
|
}),
|
|
865
|
-
|
|
888
|
+
A ? null : /* @__PURE__ */ u(a, {
|
|
866
889
|
item: !0,
|
|
867
890
|
xs: 12,
|
|
868
|
-
children: [/* @__PURE__ */ e(
|
|
869
|
-
control: /* @__PURE__ */ e(
|
|
870
|
-
checked: !!((
|
|
871
|
-
onChange: (i) =>
|
|
891
|
+
children: [/* @__PURE__ */ e(z, {
|
|
892
|
+
control: /* @__PURE__ */ e(N, {
|
|
893
|
+
checked: !!((fe = t.vaccineConfig) != null && fe.singleDose),
|
|
894
|
+
onChange: (i) => ze(i.target.checked)
|
|
872
895
|
}),
|
|
873
896
|
label: "Single dose vial"
|
|
874
897
|
}), /* @__PURE__ */ e(v, {
|
|
@@ -885,27 +908,7 @@ function Wi() {
|
|
|
885
908
|
/* @__PURE__ */ e(a, {
|
|
886
909
|
item: !0,
|
|
887
910
|
xs: 12,
|
|
888
|
-
children: !
|
|
889
|
-
sx: {
|
|
890
|
-
p: 1.5,
|
|
891
|
-
border: "1px solid",
|
|
892
|
-
borderColor: "divider",
|
|
893
|
-
borderRadius: 1.5
|
|
894
|
-
},
|
|
895
|
-
children: [/* @__PURE__ */ e(v, {
|
|
896
|
-
variant: "body2",
|
|
897
|
-
sx: { fontWeight: 700 },
|
|
898
|
-
children: "Single dose"
|
|
899
|
-
}), /* @__PURE__ */ u(v, {
|
|
900
|
-
variant: "caption",
|
|
901
|
-
color: "text.secondary",
|
|
902
|
-
children: [
|
|
903
|
-
"Each vial is one dose of ",
|
|
904
|
-
((he = t.vaccineConfig) == null ? void 0 : he.vialVolumeMl) || "—",
|
|
905
|
-
" ml, given to any patient. No dose profiles are needed."
|
|
906
|
-
]
|
|
907
|
-
})]
|
|
908
|
-
}) : qe()
|
|
911
|
+
children: Ne(!A && !!((ve = t.vaccineConfig) != null && ve.singleDose))
|
|
909
912
|
}),
|
|
910
913
|
/* @__PURE__ */ e(a, {
|
|
911
914
|
item: !0,
|
|
@@ -913,50 +916,50 @@ function Wi() {
|
|
|
913
916
|
children: /* @__PURE__ */ e(v, {
|
|
914
917
|
variant: "overline",
|
|
915
918
|
sx: {
|
|
916
|
-
...
|
|
919
|
+
...G,
|
|
917
920
|
mt: 1
|
|
918
921
|
},
|
|
919
922
|
children: "Open vial & reconstitution"
|
|
920
923
|
})
|
|
921
924
|
}),
|
|
922
|
-
!
|
|
925
|
+
!A && ((Ce = t.vaccineConfig) != null && Ce.singleDose) ? null : /* @__PURE__ */ e(a, {
|
|
923
926
|
item: !0,
|
|
924
927
|
xs: 12,
|
|
925
928
|
md: 4,
|
|
926
|
-
children: /* @__PURE__ */ u(
|
|
929
|
+
children: /* @__PURE__ */ u(F, {
|
|
927
930
|
direction: "row",
|
|
928
931
|
spacing: 1,
|
|
929
|
-
children: [/* @__PURE__ */ e(
|
|
932
|
+
children: [/* @__PURE__ */ e(M, {
|
|
930
933
|
required: !0,
|
|
931
934
|
fullWidth: !0,
|
|
932
935
|
size: "small",
|
|
933
936
|
type: "number",
|
|
934
937
|
inputProps: { min: 1 },
|
|
935
938
|
label: "Open vial validity",
|
|
936
|
-
value: ((
|
|
937
|
-
onChange: (i) =>
|
|
939
|
+
value: ((xe = t.vaccineConfig) == null ? void 0 : xe.openVialValidityHours) ?? "",
|
|
940
|
+
onChange: (i) => U("openVialValidityHours", i.target.value),
|
|
938
941
|
onBlur: n.onBlur("openVialValidityHours"),
|
|
939
|
-
error: n.show("openVialValidityHours") && !!
|
|
940
|
-
helperText: n.show("openVialValidityHours") ?
|
|
941
|
-
}), /* @__PURE__ */ e(
|
|
942
|
+
error: n.show("openVialValidityHours") && !!o.openVialValidityHours,
|
|
943
|
+
helperText: n.show("openVialValidityHours") ? o.openVialValidityHours : "How long the vial stays usable once opened"
|
|
944
|
+
}), /* @__PURE__ */ e(H, {
|
|
942
945
|
sx: {
|
|
943
946
|
minWidth: 132,
|
|
944
947
|
flexShrink: 0
|
|
945
948
|
},
|
|
946
|
-
children: /* @__PURE__ */ e(
|
|
949
|
+
children: /* @__PURE__ */ e(O, {
|
|
947
950
|
label: "Unit",
|
|
948
|
-
value: ((
|
|
949
|
-
onChange: (i) =>
|
|
950
|
-
options:
|
|
951
|
+
value: ((be = t.vaccineConfig) == null ? void 0 : be.openVialValidityUnit) || "HOURS",
|
|
952
|
+
onChange: (i) => U("openVialValidityUnit", i),
|
|
953
|
+
options: Be
|
|
951
954
|
})
|
|
952
955
|
})]
|
|
953
956
|
})
|
|
954
957
|
}),
|
|
955
|
-
!
|
|
958
|
+
!A && ((ye = t.vaccineConfig) != null && ye.singleDose) ? null : /* @__PURE__ */ e(a, {
|
|
956
959
|
item: !0,
|
|
957
960
|
xs: 12,
|
|
958
961
|
md: 4,
|
|
959
|
-
children: /* @__PURE__ */ e(
|
|
962
|
+
children: /* @__PURE__ */ e(M, {
|
|
960
963
|
required: !0,
|
|
961
964
|
fullWidth: !0,
|
|
962
965
|
size: "small",
|
|
@@ -966,53 +969,53 @@ function Wi() {
|
|
|
966
969
|
max: 20
|
|
967
970
|
},
|
|
968
971
|
label: "Max concurrent open vials",
|
|
969
|
-
value: ((
|
|
970
|
-
onChange: (i) =>
|
|
972
|
+
value: ((Ve = t.vaccineConfig) == null ? void 0 : Ve.maxConcurrentOpenVials) ?? "",
|
|
973
|
+
onChange: (i) => U("maxConcurrentOpenVials", i.target.value),
|
|
971
974
|
onBlur: n.onBlur("maxConcurrentOpenVials"),
|
|
972
|
-
error: n.show("maxConcurrentOpenVials") && !!
|
|
973
|
-
helperText: n.show("maxConcurrentOpenVials") ?
|
|
975
|
+
error: n.show("maxConcurrentOpenVials") && !!o.maxConcurrentOpenVials,
|
|
976
|
+
helperText: n.show("maxConcurrentOpenVials") ? o.maxConcurrentOpenVials : ""
|
|
974
977
|
})
|
|
975
978
|
}),
|
|
976
979
|
/* @__PURE__ */ e(a, {
|
|
977
980
|
item: !0,
|
|
978
981
|
xs: 12,
|
|
979
|
-
children: /* @__PURE__ */ e(
|
|
980
|
-
control: /* @__PURE__ */ e(
|
|
981
|
-
checked: !!((
|
|
982
|
-
onChange: (i) =>
|
|
982
|
+
children: /* @__PURE__ */ e(z, {
|
|
983
|
+
control: /* @__PURE__ */ e(N, {
|
|
984
|
+
checked: !!((Ae = t.vaccineConfig) != null && Ae.requiresReconstitution),
|
|
985
|
+
onChange: (i) => U("requiresReconstitution", i.target.checked)
|
|
983
986
|
}),
|
|
984
987
|
label: "Requires reconstitution"
|
|
985
988
|
})
|
|
986
989
|
}),
|
|
987
|
-
(
|
|
990
|
+
(Te = t.vaccineConfig) != null && Te.requiresReconstitution ? /* @__PURE__ */ e(a, {
|
|
988
991
|
item: !0,
|
|
989
992
|
xs: 12,
|
|
990
993
|
md: 4,
|
|
991
|
-
children: /* @__PURE__ */ u(
|
|
994
|
+
children: /* @__PURE__ */ u(F, {
|
|
992
995
|
direction: "row",
|
|
993
996
|
spacing: 1,
|
|
994
|
-
children: [/* @__PURE__ */ e(
|
|
997
|
+
children: [/* @__PURE__ */ e(M, {
|
|
995
998
|
fullWidth: !0,
|
|
996
999
|
size: "small",
|
|
997
1000
|
type: "number",
|
|
998
1001
|
inputProps: { min: 1 },
|
|
999
1002
|
required: !0,
|
|
1000
1003
|
label: "Reconstituted validity",
|
|
1001
|
-
value: ((
|
|
1002
|
-
onChange: (i) =>
|
|
1004
|
+
value: ((Me = t.vaccineConfig) == null ? void 0 : Me.reconstitutedValidityHours) ?? "",
|
|
1005
|
+
onChange: (i) => U("reconstitutedValidityHours", i.target.value),
|
|
1003
1006
|
onBlur: n.onBlur("reconstitutedValidityHours"),
|
|
1004
|
-
error: n.show("reconstitutedValidityHours") && !!
|
|
1005
|
-
helperText: n.show("reconstitutedValidityHours") ?
|
|
1006
|
-
}), /* @__PURE__ */ e(
|
|
1007
|
+
error: n.show("reconstitutedValidityHours") && !!o.reconstitutedValidityHours,
|
|
1008
|
+
helperText: n.show("reconstitutedValidityHours") ? o.reconstitutedValidityHours : ""
|
|
1009
|
+
}), /* @__PURE__ */ e(H, {
|
|
1007
1010
|
sx: {
|
|
1008
1011
|
minWidth: 132,
|
|
1009
1012
|
flexShrink: 0
|
|
1010
1013
|
},
|
|
1011
|
-
children: /* @__PURE__ */ e(
|
|
1014
|
+
children: /* @__PURE__ */ e(O, {
|
|
1012
1015
|
label: "Unit",
|
|
1013
|
-
value: ((
|
|
1014
|
-
onChange: (i) =>
|
|
1015
|
-
options:
|
|
1016
|
+
value: ((Se = t.vaccineConfig) == null ? void 0 : Se.reconstitutedValidityUnit) || "HOURS",
|
|
1017
|
+
onChange: (i) => U("reconstitutedValidityUnit", i),
|
|
1018
|
+
options: Be
|
|
1016
1019
|
})
|
|
1017
1020
|
})]
|
|
1018
1021
|
})
|
|
@@ -1023,7 +1026,7 @@ function Wi() {
|
|
|
1023
1026
|
children: /* @__PURE__ */ e(v, {
|
|
1024
1027
|
variant: "overline",
|
|
1025
1028
|
sx: {
|
|
1026
|
-
...
|
|
1029
|
+
...G,
|
|
1027
1030
|
mt: 1
|
|
1028
1031
|
},
|
|
1029
1032
|
children: "Storage & route"
|
|
@@ -1033,18 +1036,18 @@ function Wi() {
|
|
|
1033
1036
|
item: !0,
|
|
1034
1037
|
xs: 12,
|
|
1035
1038
|
md: 4,
|
|
1036
|
-
children: /* @__PURE__ */ e(
|
|
1039
|
+
children: /* @__PURE__ */ e(O, {
|
|
1037
1040
|
label: "Route of administration",
|
|
1038
|
-
value: ((
|
|
1039
|
-
onChange: (i) =>
|
|
1040
|
-
options:
|
|
1041
|
+
value: ((Ue = t.vaccineConfig) == null ? void 0 : Ue.route) || "",
|
|
1042
|
+
onChange: (i) => U("route", i),
|
|
1043
|
+
options: ri
|
|
1041
1044
|
})
|
|
1042
1045
|
}),
|
|
1043
1046
|
/* @__PURE__ */ e(a, {
|
|
1044
1047
|
item: !0,
|
|
1045
1048
|
xs: 6,
|
|
1046
1049
|
md: 4,
|
|
1047
|
-
children: /* @__PURE__ */ e(
|
|
1050
|
+
children: /* @__PURE__ */ e(M, {
|
|
1048
1051
|
fullWidth: !0,
|
|
1049
1052
|
size: "small",
|
|
1050
1053
|
type: "number",
|
|
@@ -1054,18 +1057,18 @@ function Wi() {
|
|
|
1054
1057
|
max: 30
|
|
1055
1058
|
},
|
|
1056
1059
|
label: "Storage temp min (°C)",
|
|
1057
|
-
value: ((
|
|
1058
|
-
onChange: (i) =>
|
|
1060
|
+
value: ((Re = t.vaccineConfig) == null ? void 0 : Re.storageTempMinCelsius) ?? "",
|
|
1061
|
+
onChange: (i) => U("storageTempMinCelsius", i.target.value),
|
|
1059
1062
|
onBlur: n.onBlur("storageTempMinCelsius"),
|
|
1060
|
-
error: n.show("storageTempMinCelsius") && !!
|
|
1061
|
-
helperText: n.show("storageTempMinCelsius") &&
|
|
1063
|
+
error: n.show("storageTempMinCelsius") && !!o.storageTempMinCelsius,
|
|
1064
|
+
helperText: n.show("storageTempMinCelsius") && o.storageTempMinCelsius ? o.storageTempMinCelsius : "−90°C to +30°C"
|
|
1062
1065
|
})
|
|
1063
1066
|
}),
|
|
1064
1067
|
/* @__PURE__ */ e(a, {
|
|
1065
1068
|
item: !0,
|
|
1066
1069
|
xs: 6,
|
|
1067
1070
|
md: 4,
|
|
1068
|
-
children: /* @__PURE__ */ e(
|
|
1071
|
+
children: /* @__PURE__ */ e(M, {
|
|
1069
1072
|
fullWidth: !0,
|
|
1070
1073
|
size: "small",
|
|
1071
1074
|
type: "number",
|
|
@@ -1075,11 +1078,11 @@ function Wi() {
|
|
|
1075
1078
|
max: 30
|
|
1076
1079
|
},
|
|
1077
1080
|
label: "Storage temp max (°C)",
|
|
1078
|
-
value: ((
|
|
1079
|
-
onChange: (i) =>
|
|
1081
|
+
value: ((we = t.vaccineConfig) == null ? void 0 : we.storageTempMaxCelsius) ?? "",
|
|
1082
|
+
onChange: (i) => U("storageTempMaxCelsius", i.target.value),
|
|
1080
1083
|
onBlur: n.onBlur("storageTempMaxCelsius"),
|
|
1081
|
-
error: n.show("storageTempMaxCelsius") && !!
|
|
1082
|
-
helperText: n.show("storageTempMaxCelsius") &&
|
|
1084
|
+
error: n.show("storageTempMaxCelsius") && !!o.storageTempMaxCelsius,
|
|
1085
|
+
helperText: n.show("storageTempMaxCelsius") && o.storageTempMaxCelsius ? o.storageTempMaxCelsius : "−90°C to +30°C"
|
|
1083
1086
|
})
|
|
1084
1087
|
}),
|
|
1085
1088
|
/* @__PURE__ */ e(a, {
|
|
@@ -1088,7 +1091,7 @@ function Wi() {
|
|
|
1088
1091
|
children: /* @__PURE__ */ e(v, {
|
|
1089
1092
|
variant: "overline",
|
|
1090
1093
|
sx: {
|
|
1091
|
-
...
|
|
1094
|
+
...G,
|
|
1092
1095
|
mt: 1
|
|
1093
1096
|
},
|
|
1094
1097
|
children: "Notes"
|
|
@@ -1097,14 +1100,14 @@ function Wi() {
|
|
|
1097
1100
|
/* @__PURE__ */ e(a, {
|
|
1098
1101
|
item: !0,
|
|
1099
1102
|
xs: 12,
|
|
1100
|
-
children: /* @__PURE__ */ e(
|
|
1103
|
+
children: /* @__PURE__ */ e(M, {
|
|
1101
1104
|
fullWidth: !0,
|
|
1102
1105
|
size: "small",
|
|
1103
1106
|
multiline: !0,
|
|
1104
1107
|
minRows: 2,
|
|
1105
1108
|
label: "Comments",
|
|
1106
|
-
value: ((
|
|
1107
|
-
onChange: (i) =>
|
|
1109
|
+
value: ((Oe = t.vaccineConfig) == null ? void 0 : Oe.comments) || "",
|
|
1110
|
+
onChange: (i) => U("comments", i.target.value)
|
|
1108
1111
|
})
|
|
1109
1112
|
})
|
|
1110
1113
|
]
|
|
@@ -1115,94 +1118,94 @@ function Wi() {
|
|
|
1115
1118
|
})
|
|
1116
1119
|
})] });
|
|
1117
1120
|
}
|
|
1118
|
-
function
|
|
1119
|
-
let
|
|
1120
|
-
|
|
1121
|
-
function
|
|
1122
|
-
|
|
1123
|
-
...
|
|
1121
|
+
function We({ value: p, onChange: W }) {
|
|
1122
|
+
let b = p ?? [], S = He(null), [P, f] = E(!1), [k, K] = E({}), q = He({});
|
|
1123
|
+
q.current = k;
|
|
1124
|
+
function X(d, n) {
|
|
1125
|
+
K((y) => y[d] ? y : {
|
|
1126
|
+
...y,
|
|
1124
1127
|
[d]: n
|
|
1125
1128
|
});
|
|
1126
1129
|
}
|
|
1127
|
-
|
|
1130
|
+
ue(() => {
|
|
1128
1131
|
let d = !1;
|
|
1129
|
-
return
|
|
1130
|
-
|
|
1131
|
-
d ||
|
|
1132
|
+
return b.forEach((n) => {
|
|
1133
|
+
q.current[n] || je(n).then((y) => {
|
|
1134
|
+
d || X(n, URL.createObjectURL(y));
|
|
1132
1135
|
}).catch(() => {
|
|
1133
1136
|
});
|
|
1134
1137
|
}), () => {
|
|
1135
1138
|
d = !0;
|
|
1136
1139
|
};
|
|
1137
|
-
}, [
|
|
1138
|
-
Object.values(
|
|
1140
|
+
}, [b]), ue(() => () => {
|
|
1141
|
+
Object.values(q.current).forEach((d) => {
|
|
1139
1142
|
try {
|
|
1140
1143
|
URL.revokeObjectURL(d);
|
|
1141
1144
|
} catch {
|
|
1142
1145
|
}
|
|
1143
1146
|
});
|
|
1144
1147
|
}, []);
|
|
1145
|
-
async function
|
|
1146
|
-
var
|
|
1148
|
+
async function te(d) {
|
|
1149
|
+
var w, B;
|
|
1147
1150
|
let n = Array.from(d || []);
|
|
1148
1151
|
if (n.length === 0) return;
|
|
1149
|
-
let
|
|
1150
|
-
if (
|
|
1151
|
-
|
|
1152
|
-
message: `You can add at most ${
|
|
1152
|
+
let y = ee - b.length;
|
|
1153
|
+
if (y <= 0) {
|
|
1154
|
+
_({
|
|
1155
|
+
message: `You can add at most ${ee} images.`,
|
|
1153
1156
|
type: "warning"
|
|
1154
1157
|
});
|
|
1155
1158
|
return;
|
|
1156
1159
|
}
|
|
1157
|
-
let
|
|
1158
|
-
if (
|
|
1159
|
-
|
|
1160
|
-
message:
|
|
1160
|
+
let L = n.find((m) => !m.type.startsWith("image/") || m.size > Mi);
|
|
1161
|
+
if (L) {
|
|
1162
|
+
_({
|
|
1163
|
+
message: L.type.startsWith("image/") ? "Each image must be 5 MB or smaller." : "Only image files can be uploaded.",
|
|
1161
1164
|
type: "error"
|
|
1162
1165
|
});
|
|
1163
1166
|
return;
|
|
1164
1167
|
}
|
|
1165
|
-
let R = n.slice(0,
|
|
1166
|
-
n.length >
|
|
1167
|
-
message: `Only ${
|
|
1168
|
+
let R = n.slice(0, y);
|
|
1169
|
+
n.length > y && _({
|
|
1170
|
+
message: `Only ${y} more image${y === 1 ? "" : "s"} can be added.`,
|
|
1168
1171
|
type: "warning"
|
|
1169
1172
|
});
|
|
1170
|
-
let
|
|
1171
|
-
|
|
1173
|
+
let t = R.map(() => de());
|
|
1174
|
+
f(!0);
|
|
1172
1175
|
try {
|
|
1173
|
-
await
|
|
1174
|
-
} catch (
|
|
1175
|
-
|
|
1176
|
-
message: ((
|
|
1176
|
+
await Ge(R, t), R.forEach((m, oe) => X(t[oe], URL.createObjectURL(m))), W([...b, ...t]);
|
|
1177
|
+
} catch (m) {
|
|
1178
|
+
_({
|
|
1179
|
+
message: ((B = (w = m == null ? void 0 : m.response) == null ? void 0 : w.data) == null ? void 0 : B.message) ?? (m == null ? void 0 : m.message) ?? "Failed to upload images",
|
|
1177
1180
|
type: "error"
|
|
1178
1181
|
});
|
|
1179
1182
|
} finally {
|
|
1180
|
-
|
|
1183
|
+
f(!1);
|
|
1181
1184
|
}
|
|
1182
1185
|
}
|
|
1183
|
-
function
|
|
1184
|
-
|
|
1186
|
+
function ne(d) {
|
|
1187
|
+
W(b.filter((n) => n !== d));
|
|
1185
1188
|
}
|
|
1186
|
-
let
|
|
1187
|
-
return /* @__PURE__ */ u(
|
|
1189
|
+
let re = b.length >= ee;
|
|
1190
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1188
1191
|
/* @__PURE__ */ e("input", {
|
|
1189
|
-
ref:
|
|
1192
|
+
ref: S,
|
|
1190
1193
|
type: "file",
|
|
1191
1194
|
accept: "image/*",
|
|
1192
1195
|
multiple: !0,
|
|
1193
1196
|
hidden: !0,
|
|
1194
1197
|
onChange: (d) => {
|
|
1195
|
-
|
|
1198
|
+
te(d.target.files), d.target.value = "";
|
|
1196
1199
|
}
|
|
1197
1200
|
}),
|
|
1198
|
-
/* @__PURE__ */ u(
|
|
1201
|
+
/* @__PURE__ */ u(F, {
|
|
1199
1202
|
direction: "row",
|
|
1200
1203
|
spacing: 1.5,
|
|
1201
1204
|
sx: {
|
|
1202
1205
|
flexWrap: "wrap",
|
|
1203
1206
|
gap: 1.5
|
|
1204
1207
|
},
|
|
1205
|
-
children: [
|
|
1208
|
+
children: [b.map((d, n) => /* @__PURE__ */ u(H, {
|
|
1206
1209
|
sx: {
|
|
1207
1210
|
position: "relative",
|
|
1208
1211
|
width: 104,
|
|
@@ -1217,17 +1220,17 @@ function $e({ value: g, onChange: k }) {
|
|
|
1217
1220
|
justifyContent: "center"
|
|
1218
1221
|
},
|
|
1219
1222
|
children: [
|
|
1220
|
-
|
|
1223
|
+
k[d] ? /* @__PURE__ */ e(H, {
|
|
1221
1224
|
component: "img",
|
|
1222
|
-
src:
|
|
1225
|
+
src: k[d],
|
|
1223
1226
|
alt: `Product image ${n + 1}`,
|
|
1224
1227
|
sx: {
|
|
1225
1228
|
width: "100%",
|
|
1226
1229
|
height: "100%",
|
|
1227
1230
|
objectFit: "cover"
|
|
1228
1231
|
}
|
|
1229
|
-
}) : /* @__PURE__ */ e(
|
|
1230
|
-
n === 0 ? /* @__PURE__ */ e(
|
|
1232
|
+
}) : /* @__PURE__ */ e($e, { size: 20 }),
|
|
1233
|
+
n === 0 ? /* @__PURE__ */ e(H, {
|
|
1231
1234
|
sx: {
|
|
1232
1235
|
position: "absolute",
|
|
1233
1236
|
left: 0,
|
|
@@ -1243,9 +1246,9 @@ function $e({ value: g, onChange: k }) {
|
|
|
1243
1246
|
},
|
|
1244
1247
|
children: "MAIN"
|
|
1245
1248
|
}) : null,
|
|
1246
|
-
/* @__PURE__ */ e(
|
|
1249
|
+
/* @__PURE__ */ e(Fe, {
|
|
1247
1250
|
size: "small",
|
|
1248
|
-
onClick: () =>
|
|
1251
|
+
onClick: () => ne(d),
|
|
1249
1252
|
sx: {
|
|
1250
1253
|
position: "absolute",
|
|
1251
1254
|
top: 2,
|
|
@@ -1256,16 +1259,16 @@ function $e({ value: g, onChange: k }) {
|
|
|
1256
1259
|
"&:hover": { bgcolor: "rgba(0,0,0,0.7)" }
|
|
1257
1260
|
},
|
|
1258
1261
|
"aria-label": "Remove image",
|
|
1259
|
-
children: /* @__PURE__ */ e(
|
|
1262
|
+
children: /* @__PURE__ */ e(Ti, { sx: { fontSize: 16 } })
|
|
1260
1263
|
})
|
|
1261
1264
|
]
|
|
1262
|
-
}, d)),
|
|
1265
|
+
}, d)), re ? null : /* @__PURE__ */ u(J, {
|
|
1263
1266
|
variant: "outlined",
|
|
1264
1267
|
onClick: () => {
|
|
1265
1268
|
var d;
|
|
1266
|
-
return (d =
|
|
1269
|
+
return (d = S.current) == null ? void 0 : d.click();
|
|
1267
1270
|
},
|
|
1268
|
-
disabled:
|
|
1271
|
+
disabled: P,
|
|
1269
1272
|
sx: {
|
|
1270
1273
|
width: 104,
|
|
1271
1274
|
height: 104,
|
|
@@ -1274,14 +1277,14 @@ function $e({ value: g, onChange: k }) {
|
|
|
1274
1277
|
gap: 0.5,
|
|
1275
1278
|
color: "text.secondary"
|
|
1276
1279
|
},
|
|
1277
|
-
children: [
|
|
1280
|
+
children: [P ? /* @__PURE__ */ e($e, { size: 22 }) : /* @__PURE__ */ e(Ai, {}), /* @__PURE__ */ e(v, {
|
|
1278
1281
|
variant: "caption",
|
|
1279
1282
|
sx: { fontWeight: 700 },
|
|
1280
|
-
children:
|
|
1283
|
+
children: P ? "Uploading…" : "Add"
|
|
1281
1284
|
})]
|
|
1282
1285
|
})]
|
|
1283
1286
|
}),
|
|
1284
|
-
|
|
1287
|
+
b.length === 0 && !P ? /* @__PURE__ */ e(v, {
|
|
1285
1288
|
variant: "caption",
|
|
1286
1289
|
color: "text.disabled",
|
|
1287
1290
|
sx: {
|
|
@@ -1292,11 +1295,11 @@ function $e({ value: g, onChange: k }) {
|
|
|
1292
1295
|
}) : null
|
|
1293
1296
|
] });
|
|
1294
1297
|
}
|
|
1295
|
-
|
|
1296
|
-
value:
|
|
1297
|
-
onChange:
|
|
1298
|
+
We.propTypes = {
|
|
1299
|
+
value: le.arrayOf(le.string),
|
|
1300
|
+
onChange: le.func.isRequired
|
|
1298
1301
|
};
|
|
1299
1302
|
export {
|
|
1300
|
-
|
|
1303
|
+
Li as default
|
|
1301
1304
|
};
|
|
1302
|
-
//# sourceMappingURL=ProductEditPage-
|
|
1305
|
+
//# sourceMappingURL=ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map
|