@argusoft/medplat-core 1.0.29 → 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-DUgY6ewy.js +1031 -0
- package/dist/AccessRights-DUgY6ewy.js.map +1 -0
- package/dist/AddEditQueryBuilder-D-iQiVIe.js +365 -0
- package/dist/AddEditQueryBuilder-D-iQiVIe.js.map +1 -0
- package/dist/{AddFeatures-v3TmGQee.js → AddFeatures-D1sU8RjY.js} +2 -2
- package/dist/{AddFeatures-v3TmGQee.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-c6ZKiN0i.js +8898 -0
- package/dist/AddMenuConfiguration-c6ZKiN0i.js.map +1 -0
- package/dist/AppModal-CCtrQ5Tr.js +394 -0
- package/dist/AppModal-CCtrQ5Tr.js.map +1 -0
- package/dist/BrandsPage-DMw2vT0u-BVhvhc6J.js +387 -0
- package/dist/BrandsPage-DMw2vT0u-BVhvhc6J.js.map +1 -0
- package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js +398 -0
- package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js.map +1 -0
- package/dist/{ChangePasswordModalCore-DutQAZOx.js → ChangePasswordModalCore-lQ9GamH1.js} +1605 -1610
- package/dist/ChangePasswordModalCore-lQ9GamH1.js.map +1 -0
- package/dist/ConditionConfig-BQBmBHaM.js +408 -0
- package/dist/ConditionConfig-BQBmBHaM.js.map +1 -0
- package/dist/DashboardPage-asr2XDRu-uOOlX9Vq.js +435 -0
- package/dist/DashboardPage-asr2XDRu-uOOlX9Vq.js.map +1 -0
- package/dist/EventConfig-BY2cgGyx.js +27 -0
- package/dist/EventConfig-BY2cgGyx.js.map +1 -0
- 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-DYl_PDyt-Cbwo2tAY.js +79 -0
- package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js.map +1 -0
- package/dist/FeatureMenu-CHsBbw3W.js +525 -0
- package/dist/FeatureMenu-CHsBbw3W.js.map +1 -0
- package/dist/{FhirServerList-Dkq7Kbes.js → FhirServerList-iXBPkRVF.js} +22 -22
- package/dist/{FhirServerList-Dkq7Kbes.js.map → FhirServerList-iXBPkRVF.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/GrantPermissionModal-D7iNZd0M.js +239 -0
- package/dist/GrantPermissionModal-D7iNZd0M.js.map +1 -0
- package/dist/ImmunizationConfigurationBase-aUtx0JEe.js +8019 -0
- package/dist/ImmunizationConfigurationBase-aUtx0JEe.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-DOotGZrj-CoPjOJEI.js +665 -0
- package/dist/InventoryPage-DOotGZrj-CoPjOJEI.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-DqW3krT6.js +1216 -0
- package/dist/ManageEventConfiguration-DqW3krT6.js.map +1 -0
- package/dist/ManageEventConfiguration.css +1 -1
- package/dist/{ManageNotification-CfhHlfxA.js → ManageNotification-C5MhV77Q.js} +2 -2
- package/dist/{ManageNotification-CfhHlfxA.js.map → ManageNotification-C5MhV77Q.js.map} +1 -1
- package/dist/{ManageRole-4Y2PP4dQ.js → ManageRole-CNZBRKGU.js} +2 -2
- package/dist/{ManageRole-4Y2PP4dQ.js.map → ManageRole-CNZBRKGU.js.map} +1 -1
- package/dist/ManageTranslation-vRiptUAP.js +833 -0
- package/dist/ManageTranslation-vRiptUAP.js.map +1 -0
- package/dist/ManageTranslation.css +1 -1
- package/dist/{ManageUser-DDzyd9jm.js → ManageUser-DZltBina.js} +224 -224
- package/dist/{ManageUser-DDzyd9jm.js.map → ManageUser-DZltBina.js.map} +1 -1
- package/dist/MemberProfileCard-D5CgkTdJ-D2NgDJl3.js +272 -0
- package/dist/MemberProfileCard-D5CgkTdJ-D2NgDJl3.js.map +1 -0
- 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/NotificationFlywayQuery-BAHVjf6N.js +247 -0
- package/dist/NotificationFlywayQuery-BAHVjf6N.js.map +1 -0
- package/dist/{NotificationList-BMFpNUJG.js → NotificationList-DEyRZEuM.js} +2 -2
- package/dist/{NotificationList-BMFpNUJG.js.map → NotificationList-DEyRZEuM.js.map} +1 -1
- package/dist/OtherTypeEventConfigModal-stNmuSv_.js +1812 -0
- package/dist/OtherTypeEventConfigModal-stNmuSv_.js.map +1 -0
- package/dist/PaymentCreatePage-DfvSZ-kB-CckogYoe.js +482 -0
- package/dist/PaymentCreatePage-DfvSZ-kB-CckogYoe.js.map +1 -0
- package/dist/PaymentsPage-DMNjYWAJ-ChO9IXmk.js +157 -0
- package/dist/PaymentsPage-DMNjYWAJ-ChO9IXmk.js.map +1 -0
- package/dist/PermissionsModal-CCYkcKlC.js +151 -0
- package/dist/PermissionsModal-CCYkcKlC.js.map +1 -0
- package/dist/PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js +119 -0
- package/dist/PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js.map +1 -0
- package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js +783 -0
- package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js.map +1 -0
- package/dist/PickupsPage-D7zyioJB-bHKnARYw.js +818 -0
- package/dist/PickupsPage-D7zyioJB-bHKnARYw.js.map +1 -0
- package/dist/PmGuard-BZE-y4In-D_pUm5MP.js +599 -0
- package/dist/PmGuard-BZE-y4In-D_pUm5MP.js.map +1 -0
- package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js +1305 -0
- package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map +1 -0
- package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js +253 -0
- package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js.map +1 -0
- package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js +675 -0
- package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map +1 -0
- package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js +1577 -0
- package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js.map +1 -0
- package/dist/PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js +279 -0
- package/dist/PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js.map +1 -0
- package/dist/PurchasesPage-DgL5T6BY-DePUuE9l.js +293 -0
- package/dist/PurchasesPage-DgL5T6BY-DePUuE9l.js.map +1 -0
- package/dist/QueryBuilder-CXaBe6sr.js +478 -0
- package/dist/QueryBuilder-CXaBe6sr.js.map +1 -0
- package/dist/{RoleManagement-DEiBNfT8.js → RoleManagement-s8iNx2Mu.js} +145 -155
- 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-CZnIOydv-DKBw-qp7.js +544 -0
- package/dist/SaleCreatePage-CZnIOydv-DKBw-qp7.js.map +1 -0
- package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js +315 -0
- 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-D10Olk5Z.js +154 -0
- package/dist/ShowFlywayQuery-D10Olk5Z.js.map +1 -0
- package/dist/{ShowFlywayQuery-DVRCd384.js → ShowFlywayQuery-DIOUdYfG.js} +170 -123
- package/dist/ShowFlywayQuery-DIOUdYfG.js.map +1 -0
- package/dist/ShowQueryHistory-DRBKYDKk.js +313 -0
- package/dist/ShowQueryHistory-DRBKYDKk.js.map +1 -0
- package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js +728 -0
- package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js.map +1 -0
- package/dist/SubMenu-BdMTYtC1.js +319 -0
- package/dist/SubMenu-BdMTYtC1.js.map +1 -0
- package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js +746 -0
- package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js.map +1 -0
- package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js +315 -0
- package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js.map +1 -0
- package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js +476 -0
- 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-Bc8gYxRL.js → UserList-L41Xw0Q6.js} +253 -236
- package/dist/{UserList-Bc8gYxRL.js.map → UserList-L41Xw0Q6.js.map} +1 -1
- package/dist/Users-CsJ08Kjm.js.map +1 -1
- package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js +321 -0
- package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js.map +1 -0
- package/dist/constants-DpXnLsAB-D6lN5cjK.js +445 -0
- 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/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 +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/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 +4 -3
- package/dist/AccessRights-Zm8Obm4N.js +0 -1284
- package/dist/AccessRights-Zm8Obm4N.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-Ce91MhnU.js +0 -8547
- package/dist/AddMenuConfiguration-Ce91MhnU.js.map +0 -1
- package/dist/AppModal-CtG2GjD_.js +0 -428
- package/dist/AppModal-CtG2GjD_.js.map +0 -1
- package/dist/ChangePasswordModalCore-DutQAZOx.js.map +0 -1
- package/dist/ConditionConfig-B4Ffpgj3.js +0 -395
- package/dist/ConditionConfig-B4Ffpgj3.js.map +0 -1
- package/dist/ConditionConfig.css +0 -1
- package/dist/EventConfigurations-BJcURufo.js +0 -449
- package/dist/EventConfigurations-BJcURufo.js.map +0 -1
- package/dist/EventsExceptionModal-BlZtBQoR.js +0 -200
- package/dist/EventsExceptionModal-BlZtBQoR.js.map +0 -1
- package/dist/EventsSkeleton-DK6JDKAK.js +0 -83
- package/dist/EventsSkeleton-DK6JDKAK.js.map +0 -1
- package/dist/FeatureMenu-C3503UIX.js +0 -265
- package/dist/FeatureMenu-C3503UIX.js.map +0 -1
- package/dist/FlywayQuery-Cx2sly6g.js +0 -169
- package/dist/FlywayQuery-Cx2sly6g.js.map +0 -1
- package/dist/ImmunizationConfigurationBase-DLQVSNnt.js +0 -5895
- package/dist/ImmunizationConfigurationBase-DLQVSNnt.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-dt096fyj.js +0 -4189
- package/dist/ManageDynamicFeature-dt096fyj.js.map +0 -1
- package/dist/ManageEventConfiguration-BpSJszSX.js +0 -1017
- package/dist/ManageEventConfiguration-BpSJszSX.js.map +0 -1
- package/dist/ManageTranslation-B4C9-lWD.js +0 -625
- package/dist/ManageTranslation-B4C9-lWD.js.map +0 -1
- package/dist/MobileMenuManagement-Cf8IZlla.js +0 -108
- package/dist/MobileMenuManagement-Cf8IZlla.js.map +0 -1
- package/dist/MobileTypeEventConfigModal-DUkUYACe.js +0 -783
- package/dist/MobileTypeEventConfigModal-DUkUYACe.js.map +0 -1
- package/dist/NotificationFlywayQuery-BY8Zzml_.js +0 -244
- package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +0 -1
- package/dist/OtherTypeEventConfigModal-CYBfr2XE.js +0 -2046
- package/dist/OtherTypeEventConfigModal-CYBfr2XE.js.map +0 -1
- package/dist/QueryBuilder-z7eqfd7D.js +0 -383
- package/dist/QueryBuilder-z7eqfd7D.js.map +0 -1
- package/dist/RoleManagement-DEiBNfT8.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-B072oEGb.js +0 -191
- package/dist/SubMenu-B072oEGb.js.map +0 -1
- package/dist/TypeConfiguration-C3xoP2Nb.js +0 -117
- package/dist/TypeConfiguration-C3xoP2Nb.js.map +0 -1
- package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +0 -1
- package/dist/index.lib-C3fwoM3y.js +0 -820
- package/dist/index.lib-C3fwoM3y.js.map +0 -1
|
@@ -0,0 +1,1305 @@
|
|
|
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 = {
|
|
19
|
+
display: "block",
|
|
20
|
+
fontWeight: 800,
|
|
21
|
+
letterSpacing: 0.6,
|
|
22
|
+
color: "text.secondary"
|
|
23
|
+
};
|
|
24
|
+
function ie() {
|
|
25
|
+
return {
|
|
26
|
+
key: de(),
|
|
27
|
+
profileType: "AGE_BASED",
|
|
28
|
+
fromAge: "",
|
|
29
|
+
fromUnit: "YEARS",
|
|
30
|
+
toAge: "",
|
|
31
|
+
toUnit: "YEARS",
|
|
32
|
+
doseAmount: ""
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
var j = {
|
|
36
|
+
vaccineCode: "",
|
|
37
|
+
vialVolumeMl: "",
|
|
38
|
+
singleDose: !1,
|
|
39
|
+
profiles: [ie()],
|
|
40
|
+
openVialValidityHours: 6,
|
|
41
|
+
openVialValidityUnit: "HOURS",
|
|
42
|
+
maxConcurrentOpenVials: 2,
|
|
43
|
+
requiresReconstitution: !1,
|
|
44
|
+
reconstitutedValidityHours: "",
|
|
45
|
+
reconstitutedValidityUnit: "HOURS",
|
|
46
|
+
route: "",
|
|
47
|
+
storageTempMinCelsius: "",
|
|
48
|
+
storageTempMaxCelsius: "",
|
|
49
|
+
comments: ""
|
|
50
|
+
};
|
|
51
|
+
function Si(p, W) {
|
|
52
|
+
var P;
|
|
53
|
+
let b = !W && !!p.singleDose, S = (f) => f === "" || f == null ? null : Number(f);
|
|
54
|
+
return {
|
|
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);
|
|
60
|
+
return {
|
|
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)
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
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
|
|
79
|
+
};
|
|
80
|
+
}
|
|
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,
|
|
85
|
+
name: "",
|
|
86
|
+
categoryId: "",
|
|
87
|
+
brandId: "",
|
|
88
|
+
description: "",
|
|
89
|
+
unit: "",
|
|
90
|
+
unitOther: "",
|
|
91
|
+
hasExpiry: !0,
|
|
92
|
+
needsStorageUnit: !1,
|
|
93
|
+
notForSale: !1,
|
|
94
|
+
canBeQuarantined: !0,
|
|
95
|
+
salePriceMode: "FREE",
|
|
96
|
+
salePrice: "",
|
|
97
|
+
isActive: !0,
|
|
98
|
+
imageUuids: [],
|
|
99
|
+
vaccineConfig: null
|
|
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", () => {
|
|
105
|
+
async function i() {
|
|
106
|
+
var l, c;
|
|
107
|
+
S(!0);
|
|
108
|
+
try {
|
|
109
|
+
let [s, C, I] = await Promise.all([
|
|
110
|
+
_e(),
|
|
111
|
+
Ke(),
|
|
112
|
+
Xe().catch(() => [])
|
|
113
|
+
]);
|
|
114
|
+
X(s), ne(C), d(I);
|
|
115
|
+
try {
|
|
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 ?? ""
|
|
156
|
+
} : null
|
|
157
|
+
});
|
|
158
|
+
} catch {
|
|
159
|
+
K(!0);
|
|
160
|
+
}
|
|
161
|
+
} catch (s) {
|
|
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");
|
|
163
|
+
} finally {
|
|
164
|
+
S(!1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
i();
|
|
168
|
+
}, [p]), ue(() => {
|
|
169
|
+
w(m ? (i) => ({
|
|
170
|
+
...i,
|
|
171
|
+
unit: i.unit === "VIAL" || i.unit === "DROPS" ? i.unit : ii,
|
|
172
|
+
needsStorageUnit: !0,
|
|
173
|
+
vaccineConfig: i.vaccineConfig ?? { ...j }
|
|
174
|
+
}) : (i) => i.vaccineConfig ? {
|
|
175
|
+
...i,
|
|
176
|
+
vaccineConfig: null
|
|
177
|
+
} : i);
|
|
178
|
+
}, [m]);
|
|
179
|
+
function V(i, l) {
|
|
180
|
+
w((c) => ({
|
|
181
|
+
...c,
|
|
182
|
+
[i]: l
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
function U(i, l) {
|
|
186
|
+
w((c) => ({
|
|
187
|
+
...c,
|
|
188
|
+
vaccineConfig: {
|
|
189
|
+
...c.vaccineConfig ?? j,
|
|
190
|
+
[i]: l
|
|
191
|
+
}
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
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
|
|
200
|
+
}, {
|
|
201
|
+
...s,
|
|
202
|
+
vaccineConfig: {
|
|
203
|
+
...C,
|
|
204
|
+
profiles: I
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function qe() {
|
|
210
|
+
w((i) => {
|
|
211
|
+
let l = i.vaccineConfig ?? j;
|
|
212
|
+
return {
|
|
213
|
+
...i,
|
|
214
|
+
vaccineConfig: {
|
|
215
|
+
...l,
|
|
216
|
+
profiles: [...l.profiles ?? [], ie()]
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function De(i) {
|
|
222
|
+
w((l) => {
|
|
223
|
+
let c = l.vaccineConfig ?? j;
|
|
224
|
+
return {
|
|
225
|
+
...l,
|
|
226
|
+
vaccineConfig: {
|
|
227
|
+
...c,
|
|
228
|
+
profiles: (c.profiles ?? []).filter((s, C) => C !== i)
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
}
|
|
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 ? {
|
|
249
|
+
min: 0,
|
|
250
|
+
step: 1
|
|
251
|
+
} : {
|
|
252
|
+
step: "0.01",
|
|
253
|
+
min: 0
|
|
254
|
+
}, I = l.vialVolumeMl === "" || l.vialVolumeMl == null ? "—" : l.vialVolumeMl;
|
|
255
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
256
|
+
/* @__PURE__ */ u(F, {
|
|
257
|
+
direction: "row",
|
|
258
|
+
justifyContent: "space-between",
|
|
259
|
+
alignItems: "center",
|
|
260
|
+
sx: { mb: 0.5 },
|
|
261
|
+
children: [/* @__PURE__ */ e(v, {
|
|
262
|
+
variant: "body2",
|
|
263
|
+
sx: { fontWeight: 700 },
|
|
264
|
+
children: i ? "Applicable age range" : "Dose profiles"
|
|
265
|
+
}), i ? null : /* @__PURE__ */ e(J, {
|
|
266
|
+
size: "small",
|
|
267
|
+
variant: "outlined",
|
|
268
|
+
startIcon: /* @__PURE__ */ e(Ci, {}),
|
|
269
|
+
onClick: qe,
|
|
270
|
+
children: "Add profile"
|
|
271
|
+
})]
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ u(v, {
|
|
274
|
+
variant: "caption",
|
|
275
|
+
color: "text.secondary",
|
|
276
|
+
sx: {
|
|
277
|
+
display: "block",
|
|
278
|
+
mb: 1.5
|
|
279
|
+
},
|
|
280
|
+
children: [
|
|
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." }),
|
|
288
|
+
/* @__PURE__ */ e("br", {}),
|
|
289
|
+
/* @__PURE__ */ e("strong", { children: "From" }),
|
|
290
|
+
" is included and ",
|
|
291
|
+
/* @__PURE__ */ e("strong", { children: "To" }),
|
|
292
|
+
" is not — a patient exactly at a To value falls into the next band. Leave To blank for no upper limit."
|
|
293
|
+
]
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ e(F, {
|
|
296
|
+
spacing: 1.5,
|
|
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, {
|
|
300
|
+
sx: {
|
|
301
|
+
p: 1.5,
|
|
302
|
+
border: "1px solid",
|
|
303
|
+
borderColor: "divider",
|
|
304
|
+
borderRadius: 1.5
|
|
305
|
+
},
|
|
306
|
+
children: /* @__PURE__ */ u(a, {
|
|
307
|
+
container: !0,
|
|
308
|
+
spacing: 1.5,
|
|
309
|
+
alignItems: "flex-start",
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ e(a, {
|
|
312
|
+
item: !0,
|
|
313
|
+
xs: 6,
|
|
314
|
+
md: 2,
|
|
315
|
+
children: /* @__PURE__ */ e(M, {
|
|
316
|
+
required: !0,
|
|
317
|
+
fullWidth: !0,
|
|
318
|
+
size: "small",
|
|
319
|
+
type: "number",
|
|
320
|
+
inputProps: {
|
|
321
|
+
min: 0,
|
|
322
|
+
step: 1
|
|
323
|
+
},
|
|
324
|
+
label: "From",
|
|
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[$] : ""
|
|
330
|
+
})
|
|
331
|
+
}),
|
|
332
|
+
/* @__PURE__ */ e(a, {
|
|
333
|
+
item: !0,
|
|
334
|
+
xs: 6,
|
|
335
|
+
md: 2,
|
|
336
|
+
children: /* @__PURE__ */ e(O, {
|
|
337
|
+
label: "From unit",
|
|
338
|
+
value: r.fromUnit || "YEARS",
|
|
339
|
+
onChange: (T) => Q(h, "fromUnit", T),
|
|
340
|
+
options: Ie
|
|
341
|
+
})
|
|
342
|
+
}),
|
|
343
|
+
/* @__PURE__ */ e(a, {
|
|
344
|
+
item: !0,
|
|
345
|
+
xs: 6,
|
|
346
|
+
md: 2,
|
|
347
|
+
children: /* @__PURE__ */ e(M, {
|
|
348
|
+
fullWidth: !0,
|
|
349
|
+
size: "small",
|
|
350
|
+
type: "number",
|
|
351
|
+
inputProps: {
|
|
352
|
+
min: 0,
|
|
353
|
+
step: 1
|
|
354
|
+
},
|
|
355
|
+
label: "To",
|
|
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"
|
|
361
|
+
})
|
|
362
|
+
}),
|
|
363
|
+
/* @__PURE__ */ e(a, {
|
|
364
|
+
item: !0,
|
|
365
|
+
xs: 6,
|
|
366
|
+
md: 2,
|
|
367
|
+
children: /* @__PURE__ */ e(O, {
|
|
368
|
+
label: "To unit",
|
|
369
|
+
disabled: !Y,
|
|
370
|
+
value: Y ? r.toUnit || "YEARS" : "",
|
|
371
|
+
onChange: (T) => Q(h, "toUnit", T),
|
|
372
|
+
options: Ie
|
|
373
|
+
})
|
|
374
|
+
}),
|
|
375
|
+
i ? null : /* @__PURE__ */ u(Z, { children: [/* @__PURE__ */ e(a, {
|
|
376
|
+
item: !0,
|
|
377
|
+
xs: 8,
|
|
378
|
+
md: 3,
|
|
379
|
+
children: /* @__PURE__ */ e(M, {
|
|
380
|
+
required: !0,
|
|
381
|
+
fullWidth: !0,
|
|
382
|
+
size: "small",
|
|
383
|
+
type: "number",
|
|
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] : ""
|
|
391
|
+
})
|
|
392
|
+
}), /* @__PURE__ */ e(a, {
|
|
393
|
+
item: !0,
|
|
394
|
+
xs: 4,
|
|
395
|
+
md: 1,
|
|
396
|
+
sx: { textAlign: "right" },
|
|
397
|
+
children: /* @__PURE__ */ e(Fe, {
|
|
398
|
+
color: "error",
|
|
399
|
+
onClick: () => De(h),
|
|
400
|
+
disabled: c.length === 1,
|
|
401
|
+
children: /* @__PURE__ */ e(Vi, {})
|
|
402
|
+
})
|
|
403
|
+
})] })
|
|
404
|
+
]
|
|
405
|
+
})
|
|
406
|
+
}, r.key);
|
|
407
|
+
})
|
|
408
|
+
}),
|
|
409
|
+
n.show("profiles") && o.profiles ? /* @__PURE__ */ e(v, {
|
|
410
|
+
variant: "caption",
|
|
411
|
+
color: "error",
|
|
412
|
+
sx: {
|
|
413
|
+
display: "block",
|
|
414
|
+
mt: 1
|
|
415
|
+
},
|
|
416
|
+
children: o.profiles
|
|
417
|
+
}) : null
|
|
418
|
+
] });
|
|
419
|
+
}
|
|
420
|
+
let o = Ee(() => {
|
|
421
|
+
let i = {
|
|
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.") : ""
|
|
428
|
+
};
|
|
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),
|
|
436
|
+
storageTempMinCelsius: s.min,
|
|
437
|
+
storageTempMaxCelsius: s.max
|
|
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));
|
|
457
|
+
}
|
|
458
|
+
return i;
|
|
459
|
+
}, [
|
|
460
|
+
t,
|
|
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.");
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
try {
|
|
472
|
+
await Qe({
|
|
473
|
+
id: t.id,
|
|
474
|
+
name: t.name.trim(),
|
|
475
|
+
categoryId: t.categoryId,
|
|
476
|
+
brandId: t.brandId,
|
|
477
|
+
description: t.description || null,
|
|
478
|
+
unit: t.unit,
|
|
479
|
+
unitOther: t.unit === "OTHER" && ((i = t.unitOther) == null ? void 0 : i.trim()) || null,
|
|
480
|
+
hasExpiry: !!t.hasExpiry,
|
|
481
|
+
needsStorageUnit: !!t.needsStorageUnit,
|
|
482
|
+
notForSale: R ? !!t.notForSale : !1,
|
|
483
|
+
canBeQuarantined: !!t.canBeQuarantined,
|
|
484
|
+
salePriceMode: R && !t.notForSale ? t.salePriceMode : "FREE",
|
|
485
|
+
salePrice: R && !t.notForSale && t.salePriceMode !== "FREE" && t.salePrice !== "" ? Number(t.salePrice) : null,
|
|
486
|
+
isActive: !!t.isActive,
|
|
487
|
+
imageUuids: t.imageUuids ?? [],
|
|
488
|
+
vaccineConfig: t.vaccineConfig ? Si(t.vaccineConfig, A) : null
|
|
489
|
+
}), _({
|
|
490
|
+
message: "Product saved.",
|
|
491
|
+
type: "success"
|
|
492
|
+
}), W("/ui/medplat/manage/pm/products");
|
|
493
|
+
} catch (s) {
|
|
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");
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return /* @__PURE__ */ u(H, { children: [/* @__PURE__ */ e(pi, {}), /* @__PURE__ */ e(gi, {
|
|
498
|
+
perm: "update.manage.productManagement.product",
|
|
499
|
+
title: "You don’t have permission to create or edit products",
|
|
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, {
|
|
504
|
+
direction: "row",
|
|
505
|
+
spacing: 1,
|
|
506
|
+
children: [/* @__PURE__ */ e(J, {
|
|
507
|
+
variant: "outlined",
|
|
508
|
+
onClick: () => W("/ui/medplat/manage/pm/products"),
|
|
509
|
+
children: "Cancel"
|
|
510
|
+
}), /* @__PURE__ */ e(J, {
|
|
511
|
+
variant: "contained",
|
|
512
|
+
startIcon: /* @__PURE__ */ e(yi, {}),
|
|
513
|
+
disabled: !me,
|
|
514
|
+
onClick: () => void Le(),
|
|
515
|
+
children: "Save"
|
|
516
|
+
})]
|
|
517
|
+
}),
|
|
518
|
+
children: [
|
|
519
|
+
b ? /* @__PURE__ */ e(ke, {
|
|
520
|
+
severity: "info",
|
|
521
|
+
children: "Loading…"
|
|
522
|
+
}) : null,
|
|
523
|
+
P ? /* @__PURE__ */ e(ke, {
|
|
524
|
+
severity: "error",
|
|
525
|
+
sx: { mb: 2 },
|
|
526
|
+
children: P
|
|
527
|
+
}) : null,
|
|
528
|
+
/* @__PURE__ */ e(se, {
|
|
529
|
+
sx: {
|
|
530
|
+
borderRadius: 1.5,
|
|
531
|
+
mb: 2
|
|
532
|
+
},
|
|
533
|
+
children: /* @__PURE__ */ u(ce, { children: [/* @__PURE__ */ e(v, {
|
|
534
|
+
variant: "h6",
|
|
535
|
+
sx: {
|
|
536
|
+
fontWeight: 800,
|
|
537
|
+
mb: 2
|
|
538
|
+
},
|
|
539
|
+
children: "Basic Details"
|
|
540
|
+
}), /* @__PURE__ */ u(a, {
|
|
541
|
+
container: !0,
|
|
542
|
+
spacing: 2,
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ e(a, {
|
|
545
|
+
item: !0,
|
|
546
|
+
xs: 12,
|
|
547
|
+
md: 6,
|
|
548
|
+
children: /* @__PURE__ */ e(M, {
|
|
549
|
+
required: !0,
|
|
550
|
+
fullWidth: !0,
|
|
551
|
+
size: "small",
|
|
552
|
+
label: "Product Name",
|
|
553
|
+
value: t.name,
|
|
554
|
+
inputProps: { maxLength: 255 },
|
|
555
|
+
onChange: (i) => V("name", i.target.value),
|
|
556
|
+
onBlur: n.onBlur("name"),
|
|
557
|
+
error: n.show("name") && !!o.name,
|
|
558
|
+
FormHelperTextProps: { component: "div" },
|
|
559
|
+
helperText: /* @__PURE__ */ e(Pe, {
|
|
560
|
+
message: n.show("name") ? o.name : "",
|
|
561
|
+
value: t.name,
|
|
562
|
+
max: 255
|
|
563
|
+
})
|
|
564
|
+
})
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ e(a, {
|
|
567
|
+
item: !0,
|
|
568
|
+
xs: 12,
|
|
569
|
+
md: 3,
|
|
570
|
+
children: /* @__PURE__ */ e(O, {
|
|
571
|
+
label: "Category",
|
|
572
|
+
required: !0,
|
|
573
|
+
value: t.categoryId,
|
|
574
|
+
onChange: (i) => V("categoryId", i),
|
|
575
|
+
onBlur: n.onBlur("categoryId"),
|
|
576
|
+
error: n.show("categoryId") && !!o.categoryId,
|
|
577
|
+
helperText: n.show("categoryId") ? o.categoryId : "",
|
|
578
|
+
options: q.map((i) => ({
|
|
579
|
+
value: i.id,
|
|
580
|
+
label: `${i.name} (${i.code})`
|
|
581
|
+
}))
|
|
582
|
+
})
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ e(a, {
|
|
585
|
+
item: !0,
|
|
586
|
+
xs: 12,
|
|
587
|
+
md: 3,
|
|
588
|
+
children: /* @__PURE__ */ e(O, {
|
|
589
|
+
label: "Brand",
|
|
590
|
+
required: !0,
|
|
591
|
+
value: t.brandId,
|
|
592
|
+
onChange: (i) => V("brandId", i),
|
|
593
|
+
onBlur: n.onBlur("brandId"),
|
|
594
|
+
error: n.show("brandId") && !!o.brandId,
|
|
595
|
+
helperText: n.show("brandId") ? o.brandId : "",
|
|
596
|
+
options: te.map((i) => ({
|
|
597
|
+
value: i.id,
|
|
598
|
+
label: i.name
|
|
599
|
+
}))
|
|
600
|
+
})
|
|
601
|
+
}),
|
|
602
|
+
m ? null : /* @__PURE__ */ e(a, {
|
|
603
|
+
item: !0,
|
|
604
|
+
xs: 12,
|
|
605
|
+
md: 3,
|
|
606
|
+
children: /* @__PURE__ */ e(O, {
|
|
607
|
+
label: "Unit",
|
|
608
|
+
required: !0,
|
|
609
|
+
value: t.unit,
|
|
610
|
+
onChange: (i) => V("unit", i),
|
|
611
|
+
onBlur: n.onBlur("unit"),
|
|
612
|
+
error: n.show("unit") && !!o.unit,
|
|
613
|
+
helperText: n.show("unit") && o.unit ? o.unit : "",
|
|
614
|
+
options: oe
|
|
615
|
+
})
|
|
616
|
+
}),
|
|
617
|
+
!m && t.unit === "OTHER" ? /* @__PURE__ */ e(a, {
|
|
618
|
+
item: !0,
|
|
619
|
+
xs: 12,
|
|
620
|
+
md: 3,
|
|
621
|
+
children: /* @__PURE__ */ e(M, {
|
|
622
|
+
required: !0,
|
|
623
|
+
fullWidth: !0,
|
|
624
|
+
size: "small",
|
|
625
|
+
label: "Custom unit name",
|
|
626
|
+
value: t.unitOther,
|
|
627
|
+
inputProps: { maxLength: 50 },
|
|
628
|
+
onChange: (i) => V("unitOther", i.target.value),
|
|
629
|
+
onBlur: n.onBlur("unitOther"),
|
|
630
|
+
error: n.show("unitOther") && !!o.unitOther,
|
|
631
|
+
FormHelperTextProps: { component: "div" },
|
|
632
|
+
helperText: /* @__PURE__ */ e(Pe, {
|
|
633
|
+
message: n.show("unitOther") && o.unitOther ? o.unitOther : "e.g. Strip, Ampoule, Sachet",
|
|
634
|
+
value: t.unitOther,
|
|
635
|
+
max: 50
|
|
636
|
+
})
|
|
637
|
+
})
|
|
638
|
+
}) : null,
|
|
639
|
+
/* @__PURE__ */ e(a, {
|
|
640
|
+
item: !0,
|
|
641
|
+
xs: 6,
|
|
642
|
+
md: 3,
|
|
643
|
+
children: /* @__PURE__ */ e(z, {
|
|
644
|
+
control: /* @__PURE__ */ e(N, {
|
|
645
|
+
checked: !!t.hasExpiry,
|
|
646
|
+
disabled: m,
|
|
647
|
+
onChange: (i) => V("hasExpiry", i.target.checked)
|
|
648
|
+
}),
|
|
649
|
+
label: m ? "Has expiry (vaccine)" : "Has expiry"
|
|
650
|
+
})
|
|
651
|
+
}),
|
|
652
|
+
/* @__PURE__ */ e(a, {
|
|
653
|
+
item: !0,
|
|
654
|
+
xs: 6,
|
|
655
|
+
md: 3,
|
|
656
|
+
children: /* @__PURE__ */ e(z, {
|
|
657
|
+
control: /* @__PURE__ */ e(N, {
|
|
658
|
+
checked: !!t.needsStorageUnit,
|
|
659
|
+
disabled: m,
|
|
660
|
+
onChange: (i) => V("needsStorageUnit", i.target.checked)
|
|
661
|
+
}),
|
|
662
|
+
label: m ? "Needs storage unit (vaccine)" : "Needs storage unit"
|
|
663
|
+
})
|
|
664
|
+
}),
|
|
665
|
+
R ? /* @__PURE__ */ e(a, {
|
|
666
|
+
item: !0,
|
|
667
|
+
xs: 6,
|
|
668
|
+
md: 3,
|
|
669
|
+
children: /* @__PURE__ */ e(z, {
|
|
670
|
+
control: /* @__PURE__ */ e(N, {
|
|
671
|
+
checked: !!t.notForSale,
|
|
672
|
+
onChange: (i) => V("notForSale", i.target.checked)
|
|
673
|
+
}),
|
|
674
|
+
label: "Not for sale"
|
|
675
|
+
})
|
|
676
|
+
}) : null,
|
|
677
|
+
/* @__PURE__ */ e(a, {
|
|
678
|
+
item: !0,
|
|
679
|
+
xs: 6,
|
|
680
|
+
md: 3,
|
|
681
|
+
children: /* @__PURE__ */ e(z, {
|
|
682
|
+
control: /* @__PURE__ */ e(N, {
|
|
683
|
+
checked: !!t.canBeQuarantined,
|
|
684
|
+
onChange: (i) => V("canBeQuarantined", i.target.checked)
|
|
685
|
+
}),
|
|
686
|
+
label: "Can be quarantined"
|
|
687
|
+
})
|
|
688
|
+
}),
|
|
689
|
+
/* @__PURE__ */ e(a, {
|
|
690
|
+
item: !0,
|
|
691
|
+
xs: 6,
|
|
692
|
+
md: 3,
|
|
693
|
+
children: /* @__PURE__ */ e(z, {
|
|
694
|
+
control: /* @__PURE__ */ e(N, {
|
|
695
|
+
checked: !!t.isActive,
|
|
696
|
+
onChange: (i) => V("isActive", i.target.checked)
|
|
697
|
+
}),
|
|
698
|
+
label: "Active"
|
|
699
|
+
})
|
|
700
|
+
}),
|
|
701
|
+
R && !t.notForSale ? /* @__PURE__ */ u(Z, { children: [/* @__PURE__ */ e(a, {
|
|
702
|
+
item: !0,
|
|
703
|
+
xs: 12,
|
|
704
|
+
md: 4,
|
|
705
|
+
children: /* @__PURE__ */ e(O, {
|
|
706
|
+
label: "Sale price mode",
|
|
707
|
+
value: t.salePriceMode,
|
|
708
|
+
onChange: (i) => V("salePriceMode", i),
|
|
709
|
+
options: ti,
|
|
710
|
+
helperText: "Fixed shows a locked price at sale time; MRP caps the entered price."
|
|
711
|
+
})
|
|
712
|
+
}), t.salePriceMode === "FREE" ? null : /* @__PURE__ */ e(a, {
|
|
713
|
+
item: !0,
|
|
714
|
+
xs: 12,
|
|
715
|
+
md: 4,
|
|
716
|
+
children: /* @__PURE__ */ e(M, {
|
|
717
|
+
required: !0,
|
|
718
|
+
fullWidth: !0,
|
|
719
|
+
size: "small",
|
|
720
|
+
type: "number",
|
|
721
|
+
inputProps: {
|
|
722
|
+
step: "0.01",
|
|
723
|
+
min: 0
|
|
724
|
+
},
|
|
725
|
+
label: t.salePriceMode === "FIXED" ? "Fixed sale price" : "Price cap (MRP)",
|
|
726
|
+
value: t.salePrice,
|
|
727
|
+
onChange: (i) => V("salePrice", i.target.value),
|
|
728
|
+
onBlur: n.onBlur("salePrice"),
|
|
729
|
+
error: n.show("salePrice") && !!o.salePrice,
|
|
730
|
+
helperText: n.show("salePrice") ? o.salePrice : ""
|
|
731
|
+
})
|
|
732
|
+
})] }) : null,
|
|
733
|
+
/* @__PURE__ */ e(a, {
|
|
734
|
+
item: !0,
|
|
735
|
+
xs: 12,
|
|
736
|
+
children: /* @__PURE__ */ e(M, {
|
|
737
|
+
fullWidth: !0,
|
|
738
|
+
size: "small",
|
|
739
|
+
multiline: !0,
|
|
740
|
+
minRows: 2,
|
|
741
|
+
label: "Description",
|
|
742
|
+
value: t.description,
|
|
743
|
+
onChange: (i) => V("description", i.target.value)
|
|
744
|
+
})
|
|
745
|
+
})
|
|
746
|
+
]
|
|
747
|
+
})] })
|
|
748
|
+
}),
|
|
749
|
+
/* @__PURE__ */ e(se, {
|
|
750
|
+
sx: {
|
|
751
|
+
borderRadius: 1.5,
|
|
752
|
+
mb: 2
|
|
753
|
+
},
|
|
754
|
+
children: /* @__PURE__ */ u(ce, { children: [
|
|
755
|
+
/* @__PURE__ */ u(F, {
|
|
756
|
+
direction: "row",
|
|
757
|
+
justifyContent: "space-between",
|
|
758
|
+
alignItems: "center",
|
|
759
|
+
sx: { mb: 0.5 },
|
|
760
|
+
children: [/* @__PURE__ */ e(v, {
|
|
761
|
+
variant: "h6",
|
|
762
|
+
sx: { fontWeight: 800 },
|
|
763
|
+
children: "Product Images"
|
|
764
|
+
}), /* @__PURE__ */ u(v, {
|
|
765
|
+
variant: "caption",
|
|
766
|
+
color: "text.secondary",
|
|
767
|
+
children: [
|
|
768
|
+
"Optional · up to ",
|
|
769
|
+
ee,
|
|
770
|
+
" images"
|
|
771
|
+
]
|
|
772
|
+
})]
|
|
773
|
+
}),
|
|
774
|
+
/* @__PURE__ */ e(v, {
|
|
775
|
+
variant: "caption",
|
|
776
|
+
color: "text.secondary",
|
|
777
|
+
sx: {
|
|
778
|
+
display: "block",
|
|
779
|
+
mb: 2
|
|
780
|
+
},
|
|
781
|
+
children: "Add photos of the product or its packaging. The first image is used as the main picture."
|
|
782
|
+
}),
|
|
783
|
+
/* @__PURE__ */ e(We, {
|
|
784
|
+
value: t.imageUuids,
|
|
785
|
+
onChange: (i) => V("imageUuids", i)
|
|
786
|
+
})
|
|
787
|
+
] })
|
|
788
|
+
}),
|
|
789
|
+
m ? /* @__PURE__ */ e(se, {
|
|
790
|
+
sx: { borderRadius: 1.5 },
|
|
791
|
+
children: /* @__PURE__ */ u(ce, { children: [
|
|
792
|
+
/* @__PURE__ */ u(F, {
|
|
793
|
+
direction: "row",
|
|
794
|
+
justifyContent: "space-between",
|
|
795
|
+
alignItems: "center",
|
|
796
|
+
sx: { mb: 2 },
|
|
797
|
+
children: [/* @__PURE__ */ e(v, {
|
|
798
|
+
variant: "h6",
|
|
799
|
+
sx: { fontWeight: 800 },
|
|
800
|
+
children: "Vaccine Configuration"
|
|
801
|
+
}), /* @__PURE__ */ e(v, {
|
|
802
|
+
variant: "caption",
|
|
803
|
+
color: "text.secondary",
|
|
804
|
+
children: "Required for vaccine products. Controls vial size, dosing, and shelf life rules."
|
|
805
|
+
})]
|
|
806
|
+
}),
|
|
807
|
+
/* @__PURE__ */ e(vi, { sx: { mb: 2 } }),
|
|
808
|
+
/* @__PURE__ */ u(a, {
|
|
809
|
+
container: !0,
|
|
810
|
+
spacing: 2,
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ e(a, {
|
|
813
|
+
item: !0,
|
|
814
|
+
xs: 12,
|
|
815
|
+
children: /* @__PURE__ */ e(v, {
|
|
816
|
+
variant: "overline",
|
|
817
|
+
sx: G,
|
|
818
|
+
children: "Vaccine & measure"
|
|
819
|
+
})
|
|
820
|
+
}),
|
|
821
|
+
/* @__PURE__ */ e(a, {
|
|
822
|
+
item: !0,
|
|
823
|
+
xs: 12,
|
|
824
|
+
md: 4,
|
|
825
|
+
children: /* @__PURE__ */ e(O, {
|
|
826
|
+
label: "Vaccine",
|
|
827
|
+
required: !0,
|
|
828
|
+
value: ((ge = t.vaccineConfig) == null ? void 0 : ge.vaccineCode) || "",
|
|
829
|
+
onChange: (i) => U("vaccineCode", i),
|
|
830
|
+
onBlur: n.onBlur("vaccineCode"),
|
|
831
|
+
error: n.show("vaccineCode") && !!o.vaccineCode,
|
|
832
|
+
helperText: n.show("vaccineCode") && o.vaccineCode ? o.vaccineCode : "",
|
|
833
|
+
noOptionsText: "No vaccines configured in immunization master",
|
|
834
|
+
options: re.map((i) => ({
|
|
835
|
+
value: i.vaccineCode,
|
|
836
|
+
label: `${i.vaccineName} (${i.vaccineCode})`
|
|
837
|
+
}))
|
|
838
|
+
})
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ e(a, {
|
|
841
|
+
item: !0,
|
|
842
|
+
xs: 12,
|
|
843
|
+
md: 4,
|
|
844
|
+
children: /* @__PURE__ */ e(O, {
|
|
845
|
+
label: "Measured in",
|
|
846
|
+
value: t.unit,
|
|
847
|
+
onChange: (i) => V("unit", i),
|
|
848
|
+
options: ni,
|
|
849
|
+
helperText: "Vials are dosed in millilitres; drops are counted."
|
|
850
|
+
})
|
|
851
|
+
}),
|
|
852
|
+
/* @__PURE__ */ e(a, {
|
|
853
|
+
item: !0,
|
|
854
|
+
xs: 12,
|
|
855
|
+
md: 4,
|
|
856
|
+
children: /* @__PURE__ */ e(M, {
|
|
857
|
+
required: !0,
|
|
858
|
+
fullWidth: !0,
|
|
859
|
+
size: "small",
|
|
860
|
+
type: "number",
|
|
861
|
+
inputProps: A ? {
|
|
862
|
+
min: 1,
|
|
863
|
+
step: 1
|
|
864
|
+
} : {
|
|
865
|
+
step: "0.01",
|
|
866
|
+
min: 0
|
|
867
|
+
},
|
|
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),
|
|
871
|
+
onBlur: n.onBlur("vialVolumeMl"),
|
|
872
|
+
error: n.show("vialVolumeMl") && !!o.vialVolumeMl,
|
|
873
|
+
helperText: n.show("vialVolumeMl") ? o.vialVolumeMl : A ? "Total drops in a fresh vial" : ""
|
|
874
|
+
})
|
|
875
|
+
}),
|
|
876
|
+
/* @__PURE__ */ e(a, {
|
|
877
|
+
item: !0,
|
|
878
|
+
xs: 12,
|
|
879
|
+
children: /* @__PURE__ */ e(v, {
|
|
880
|
+
variant: "overline",
|
|
881
|
+
sx: {
|
|
882
|
+
...G,
|
|
883
|
+
mt: 1
|
|
884
|
+
},
|
|
885
|
+
children: "Dosing"
|
|
886
|
+
})
|
|
887
|
+
}),
|
|
888
|
+
A ? null : /* @__PURE__ */ u(a, {
|
|
889
|
+
item: !0,
|
|
890
|
+
xs: 12,
|
|
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)
|
|
895
|
+
}),
|
|
896
|
+
label: "Single dose vial"
|
|
897
|
+
}), /* @__PURE__ */ e(v, {
|
|
898
|
+
variant: "caption",
|
|
899
|
+
color: "text.secondary",
|
|
900
|
+
sx: {
|
|
901
|
+
display: "block",
|
|
902
|
+
ml: 4,
|
|
903
|
+
mt: -0.5
|
|
904
|
+
},
|
|
905
|
+
children: "One dose per vial — used up the moment it's opened, so there's no limit on how many can be open at once."
|
|
906
|
+
})]
|
|
907
|
+
}),
|
|
908
|
+
/* @__PURE__ */ e(a, {
|
|
909
|
+
item: !0,
|
|
910
|
+
xs: 12,
|
|
911
|
+
children: Ne(!A && !!((ve = t.vaccineConfig) != null && ve.singleDose))
|
|
912
|
+
}),
|
|
913
|
+
/* @__PURE__ */ e(a, {
|
|
914
|
+
item: !0,
|
|
915
|
+
xs: 12,
|
|
916
|
+
children: /* @__PURE__ */ e(v, {
|
|
917
|
+
variant: "overline",
|
|
918
|
+
sx: {
|
|
919
|
+
...G,
|
|
920
|
+
mt: 1
|
|
921
|
+
},
|
|
922
|
+
children: "Open vial & reconstitution"
|
|
923
|
+
})
|
|
924
|
+
}),
|
|
925
|
+
!A && ((Ce = t.vaccineConfig) != null && Ce.singleDose) ? null : /* @__PURE__ */ e(a, {
|
|
926
|
+
item: !0,
|
|
927
|
+
xs: 12,
|
|
928
|
+
md: 4,
|
|
929
|
+
children: /* @__PURE__ */ u(F, {
|
|
930
|
+
direction: "row",
|
|
931
|
+
spacing: 1,
|
|
932
|
+
children: [/* @__PURE__ */ e(M, {
|
|
933
|
+
required: !0,
|
|
934
|
+
fullWidth: !0,
|
|
935
|
+
size: "small",
|
|
936
|
+
type: "number",
|
|
937
|
+
inputProps: { min: 1 },
|
|
938
|
+
label: "Open vial validity",
|
|
939
|
+
value: ((xe = t.vaccineConfig) == null ? void 0 : xe.openVialValidityHours) ?? "",
|
|
940
|
+
onChange: (i) => U("openVialValidityHours", i.target.value),
|
|
941
|
+
onBlur: n.onBlur("openVialValidityHours"),
|
|
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, {
|
|
945
|
+
sx: {
|
|
946
|
+
minWidth: 132,
|
|
947
|
+
flexShrink: 0
|
|
948
|
+
},
|
|
949
|
+
children: /* @__PURE__ */ e(O, {
|
|
950
|
+
label: "Unit",
|
|
951
|
+
value: ((be = t.vaccineConfig) == null ? void 0 : be.openVialValidityUnit) || "HOURS",
|
|
952
|
+
onChange: (i) => U("openVialValidityUnit", i),
|
|
953
|
+
options: Be
|
|
954
|
+
})
|
|
955
|
+
})]
|
|
956
|
+
})
|
|
957
|
+
}),
|
|
958
|
+
!A && ((ye = t.vaccineConfig) != null && ye.singleDose) ? null : /* @__PURE__ */ e(a, {
|
|
959
|
+
item: !0,
|
|
960
|
+
xs: 12,
|
|
961
|
+
md: 4,
|
|
962
|
+
children: /* @__PURE__ */ e(M, {
|
|
963
|
+
required: !0,
|
|
964
|
+
fullWidth: !0,
|
|
965
|
+
size: "small",
|
|
966
|
+
type: "number",
|
|
967
|
+
inputProps: {
|
|
968
|
+
min: 1,
|
|
969
|
+
max: 20
|
|
970
|
+
},
|
|
971
|
+
label: "Max concurrent open vials",
|
|
972
|
+
value: ((Ve = t.vaccineConfig) == null ? void 0 : Ve.maxConcurrentOpenVials) ?? "",
|
|
973
|
+
onChange: (i) => U("maxConcurrentOpenVials", i.target.value),
|
|
974
|
+
onBlur: n.onBlur("maxConcurrentOpenVials"),
|
|
975
|
+
error: n.show("maxConcurrentOpenVials") && !!o.maxConcurrentOpenVials,
|
|
976
|
+
helperText: n.show("maxConcurrentOpenVials") ? o.maxConcurrentOpenVials : ""
|
|
977
|
+
})
|
|
978
|
+
}),
|
|
979
|
+
/* @__PURE__ */ e(a, {
|
|
980
|
+
item: !0,
|
|
981
|
+
xs: 12,
|
|
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)
|
|
986
|
+
}),
|
|
987
|
+
label: "Requires reconstitution"
|
|
988
|
+
})
|
|
989
|
+
}),
|
|
990
|
+
(Te = t.vaccineConfig) != null && Te.requiresReconstitution ? /* @__PURE__ */ e(a, {
|
|
991
|
+
item: !0,
|
|
992
|
+
xs: 12,
|
|
993
|
+
md: 4,
|
|
994
|
+
children: /* @__PURE__ */ u(F, {
|
|
995
|
+
direction: "row",
|
|
996
|
+
spacing: 1,
|
|
997
|
+
children: [/* @__PURE__ */ e(M, {
|
|
998
|
+
fullWidth: !0,
|
|
999
|
+
size: "small",
|
|
1000
|
+
type: "number",
|
|
1001
|
+
inputProps: { min: 1 },
|
|
1002
|
+
required: !0,
|
|
1003
|
+
label: "Reconstituted validity",
|
|
1004
|
+
value: ((Me = t.vaccineConfig) == null ? void 0 : Me.reconstitutedValidityHours) ?? "",
|
|
1005
|
+
onChange: (i) => U("reconstitutedValidityHours", i.target.value),
|
|
1006
|
+
onBlur: n.onBlur("reconstitutedValidityHours"),
|
|
1007
|
+
error: n.show("reconstitutedValidityHours") && !!o.reconstitutedValidityHours,
|
|
1008
|
+
helperText: n.show("reconstitutedValidityHours") ? o.reconstitutedValidityHours : ""
|
|
1009
|
+
}), /* @__PURE__ */ e(H, {
|
|
1010
|
+
sx: {
|
|
1011
|
+
minWidth: 132,
|
|
1012
|
+
flexShrink: 0
|
|
1013
|
+
},
|
|
1014
|
+
children: /* @__PURE__ */ e(O, {
|
|
1015
|
+
label: "Unit",
|
|
1016
|
+
value: ((Se = t.vaccineConfig) == null ? void 0 : Se.reconstitutedValidityUnit) || "HOURS",
|
|
1017
|
+
onChange: (i) => U("reconstitutedValidityUnit", i),
|
|
1018
|
+
options: Be
|
|
1019
|
+
})
|
|
1020
|
+
})]
|
|
1021
|
+
})
|
|
1022
|
+
}) : null,
|
|
1023
|
+
/* @__PURE__ */ e(a, {
|
|
1024
|
+
item: !0,
|
|
1025
|
+
xs: 12,
|
|
1026
|
+
children: /* @__PURE__ */ e(v, {
|
|
1027
|
+
variant: "overline",
|
|
1028
|
+
sx: {
|
|
1029
|
+
...G,
|
|
1030
|
+
mt: 1
|
|
1031
|
+
},
|
|
1032
|
+
children: "Storage & route"
|
|
1033
|
+
})
|
|
1034
|
+
}),
|
|
1035
|
+
/* @__PURE__ */ e(a, {
|
|
1036
|
+
item: !0,
|
|
1037
|
+
xs: 12,
|
|
1038
|
+
md: 4,
|
|
1039
|
+
children: /* @__PURE__ */ e(O, {
|
|
1040
|
+
label: "Route of administration",
|
|
1041
|
+
value: ((Ue = t.vaccineConfig) == null ? void 0 : Ue.route) || "",
|
|
1042
|
+
onChange: (i) => U("route", i),
|
|
1043
|
+
options: ri
|
|
1044
|
+
})
|
|
1045
|
+
}),
|
|
1046
|
+
/* @__PURE__ */ e(a, {
|
|
1047
|
+
item: !0,
|
|
1048
|
+
xs: 6,
|
|
1049
|
+
md: 4,
|
|
1050
|
+
children: /* @__PURE__ */ e(M, {
|
|
1051
|
+
fullWidth: !0,
|
|
1052
|
+
size: "small",
|
|
1053
|
+
type: "number",
|
|
1054
|
+
inputProps: {
|
|
1055
|
+
step: "0.1",
|
|
1056
|
+
min: -90,
|
|
1057
|
+
max: 30
|
|
1058
|
+
},
|
|
1059
|
+
label: "Storage temp min (°C)",
|
|
1060
|
+
value: ((Re = t.vaccineConfig) == null ? void 0 : Re.storageTempMinCelsius) ?? "",
|
|
1061
|
+
onChange: (i) => U("storageTempMinCelsius", i.target.value),
|
|
1062
|
+
onBlur: n.onBlur("storageTempMinCelsius"),
|
|
1063
|
+
error: n.show("storageTempMinCelsius") && !!o.storageTempMinCelsius,
|
|
1064
|
+
helperText: n.show("storageTempMinCelsius") && o.storageTempMinCelsius ? o.storageTempMinCelsius : "−90°C to +30°C"
|
|
1065
|
+
})
|
|
1066
|
+
}),
|
|
1067
|
+
/* @__PURE__ */ e(a, {
|
|
1068
|
+
item: !0,
|
|
1069
|
+
xs: 6,
|
|
1070
|
+
md: 4,
|
|
1071
|
+
children: /* @__PURE__ */ e(M, {
|
|
1072
|
+
fullWidth: !0,
|
|
1073
|
+
size: "small",
|
|
1074
|
+
type: "number",
|
|
1075
|
+
inputProps: {
|
|
1076
|
+
step: "0.1",
|
|
1077
|
+
min: -90,
|
|
1078
|
+
max: 30
|
|
1079
|
+
},
|
|
1080
|
+
label: "Storage temp max (°C)",
|
|
1081
|
+
value: ((we = t.vaccineConfig) == null ? void 0 : we.storageTempMaxCelsius) ?? "",
|
|
1082
|
+
onChange: (i) => U("storageTempMaxCelsius", i.target.value),
|
|
1083
|
+
onBlur: n.onBlur("storageTempMaxCelsius"),
|
|
1084
|
+
error: n.show("storageTempMaxCelsius") && !!o.storageTempMaxCelsius,
|
|
1085
|
+
helperText: n.show("storageTempMaxCelsius") && o.storageTempMaxCelsius ? o.storageTempMaxCelsius : "−90°C to +30°C"
|
|
1086
|
+
})
|
|
1087
|
+
}),
|
|
1088
|
+
/* @__PURE__ */ e(a, {
|
|
1089
|
+
item: !0,
|
|
1090
|
+
xs: 12,
|
|
1091
|
+
children: /* @__PURE__ */ e(v, {
|
|
1092
|
+
variant: "overline",
|
|
1093
|
+
sx: {
|
|
1094
|
+
...G,
|
|
1095
|
+
mt: 1
|
|
1096
|
+
},
|
|
1097
|
+
children: "Notes"
|
|
1098
|
+
})
|
|
1099
|
+
}),
|
|
1100
|
+
/* @__PURE__ */ e(a, {
|
|
1101
|
+
item: !0,
|
|
1102
|
+
xs: 12,
|
|
1103
|
+
children: /* @__PURE__ */ e(M, {
|
|
1104
|
+
fullWidth: !0,
|
|
1105
|
+
size: "small",
|
|
1106
|
+
multiline: !0,
|
|
1107
|
+
minRows: 2,
|
|
1108
|
+
label: "Comments",
|
|
1109
|
+
value: ((Oe = t.vaccineConfig) == null ? void 0 : Oe.comments) || "",
|
|
1110
|
+
onChange: (i) => U("comments", i.target.value)
|
|
1111
|
+
})
|
|
1112
|
+
})
|
|
1113
|
+
]
|
|
1114
|
+
})
|
|
1115
|
+
] })
|
|
1116
|
+
}) : null
|
|
1117
|
+
]
|
|
1118
|
+
})
|
|
1119
|
+
})] });
|
|
1120
|
+
}
|
|
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,
|
|
1127
|
+
[d]: n
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
ue(() => {
|
|
1131
|
+
let d = !1;
|
|
1132
|
+
return b.forEach((n) => {
|
|
1133
|
+
q.current[n] || je(n).then((y) => {
|
|
1134
|
+
d || X(n, URL.createObjectURL(y));
|
|
1135
|
+
}).catch(() => {
|
|
1136
|
+
});
|
|
1137
|
+
}), () => {
|
|
1138
|
+
d = !0;
|
|
1139
|
+
};
|
|
1140
|
+
}, [b]), ue(() => () => {
|
|
1141
|
+
Object.values(q.current).forEach((d) => {
|
|
1142
|
+
try {
|
|
1143
|
+
URL.revokeObjectURL(d);
|
|
1144
|
+
} catch {
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
}, []);
|
|
1148
|
+
async function te(d) {
|
|
1149
|
+
var w, B;
|
|
1150
|
+
let n = Array.from(d || []);
|
|
1151
|
+
if (n.length === 0) return;
|
|
1152
|
+
let y = ee - b.length;
|
|
1153
|
+
if (y <= 0) {
|
|
1154
|
+
_({
|
|
1155
|
+
message: `You can add at most ${ee} images.`,
|
|
1156
|
+
type: "warning"
|
|
1157
|
+
});
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
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.",
|
|
1164
|
+
type: "error"
|
|
1165
|
+
});
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
let R = n.slice(0, y);
|
|
1169
|
+
n.length > y && _({
|
|
1170
|
+
message: `Only ${y} more image${y === 1 ? "" : "s"} can be added.`,
|
|
1171
|
+
type: "warning"
|
|
1172
|
+
});
|
|
1173
|
+
let t = R.map(() => de());
|
|
1174
|
+
f(!0);
|
|
1175
|
+
try {
|
|
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",
|
|
1180
|
+
type: "error"
|
|
1181
|
+
});
|
|
1182
|
+
} finally {
|
|
1183
|
+
f(!1);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
function ne(d) {
|
|
1187
|
+
W(b.filter((n) => n !== d));
|
|
1188
|
+
}
|
|
1189
|
+
let re = b.length >= ee;
|
|
1190
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1191
|
+
/* @__PURE__ */ e("input", {
|
|
1192
|
+
ref: S,
|
|
1193
|
+
type: "file",
|
|
1194
|
+
accept: "image/*",
|
|
1195
|
+
multiple: !0,
|
|
1196
|
+
hidden: !0,
|
|
1197
|
+
onChange: (d) => {
|
|
1198
|
+
te(d.target.files), d.target.value = "";
|
|
1199
|
+
}
|
|
1200
|
+
}),
|
|
1201
|
+
/* @__PURE__ */ u(F, {
|
|
1202
|
+
direction: "row",
|
|
1203
|
+
spacing: 1.5,
|
|
1204
|
+
sx: {
|
|
1205
|
+
flexWrap: "wrap",
|
|
1206
|
+
gap: 1.5
|
|
1207
|
+
},
|
|
1208
|
+
children: [b.map((d, n) => /* @__PURE__ */ u(H, {
|
|
1209
|
+
sx: {
|
|
1210
|
+
position: "relative",
|
|
1211
|
+
width: 104,
|
|
1212
|
+
height: 104,
|
|
1213
|
+
borderRadius: 1.5,
|
|
1214
|
+
border: "1px solid",
|
|
1215
|
+
borderColor: "divider",
|
|
1216
|
+
overflow: "hidden",
|
|
1217
|
+
bgcolor: "grey.50",
|
|
1218
|
+
display: "flex",
|
|
1219
|
+
alignItems: "center",
|
|
1220
|
+
justifyContent: "center"
|
|
1221
|
+
},
|
|
1222
|
+
children: [
|
|
1223
|
+
k[d] ? /* @__PURE__ */ e(H, {
|
|
1224
|
+
component: "img",
|
|
1225
|
+
src: k[d],
|
|
1226
|
+
alt: `Product image ${n + 1}`,
|
|
1227
|
+
sx: {
|
|
1228
|
+
width: "100%",
|
|
1229
|
+
height: "100%",
|
|
1230
|
+
objectFit: "cover"
|
|
1231
|
+
}
|
|
1232
|
+
}) : /* @__PURE__ */ e($e, { size: 20 }),
|
|
1233
|
+
n === 0 ? /* @__PURE__ */ e(H, {
|
|
1234
|
+
sx: {
|
|
1235
|
+
position: "absolute",
|
|
1236
|
+
left: 0,
|
|
1237
|
+
bottom: 0,
|
|
1238
|
+
right: 0,
|
|
1239
|
+
bgcolor: "rgba(0,0,0,0.55)",
|
|
1240
|
+
color: "#fff",
|
|
1241
|
+
fontSize: "0.6rem",
|
|
1242
|
+
fontWeight: 800,
|
|
1243
|
+
letterSpacing: 0.5,
|
|
1244
|
+
textAlign: "center",
|
|
1245
|
+
py: 0.25
|
|
1246
|
+
},
|
|
1247
|
+
children: "MAIN"
|
|
1248
|
+
}) : null,
|
|
1249
|
+
/* @__PURE__ */ e(Fe, {
|
|
1250
|
+
size: "small",
|
|
1251
|
+
onClick: () => ne(d),
|
|
1252
|
+
sx: {
|
|
1253
|
+
position: "absolute",
|
|
1254
|
+
top: 2,
|
|
1255
|
+
right: 2,
|
|
1256
|
+
p: 0.25,
|
|
1257
|
+
bgcolor: "rgba(0,0,0,0.5)",
|
|
1258
|
+
color: "#fff",
|
|
1259
|
+
"&:hover": { bgcolor: "rgba(0,0,0,0.7)" }
|
|
1260
|
+
},
|
|
1261
|
+
"aria-label": "Remove image",
|
|
1262
|
+
children: /* @__PURE__ */ e(Ti, { sx: { fontSize: 16 } })
|
|
1263
|
+
})
|
|
1264
|
+
]
|
|
1265
|
+
}, d)), re ? null : /* @__PURE__ */ u(J, {
|
|
1266
|
+
variant: "outlined",
|
|
1267
|
+
onClick: () => {
|
|
1268
|
+
var d;
|
|
1269
|
+
return (d = S.current) == null ? void 0 : d.click();
|
|
1270
|
+
},
|
|
1271
|
+
disabled: P,
|
|
1272
|
+
sx: {
|
|
1273
|
+
width: 104,
|
|
1274
|
+
height: 104,
|
|
1275
|
+
borderStyle: "dashed",
|
|
1276
|
+
flexDirection: "column",
|
|
1277
|
+
gap: 0.5,
|
|
1278
|
+
color: "text.secondary"
|
|
1279
|
+
},
|
|
1280
|
+
children: [P ? /* @__PURE__ */ e($e, { size: 22 }) : /* @__PURE__ */ e(Ai, {}), /* @__PURE__ */ e(v, {
|
|
1281
|
+
variant: "caption",
|
|
1282
|
+
sx: { fontWeight: 700 },
|
|
1283
|
+
children: P ? "Uploading…" : "Add"
|
|
1284
|
+
})]
|
|
1285
|
+
})]
|
|
1286
|
+
}),
|
|
1287
|
+
b.length === 0 && !P ? /* @__PURE__ */ e(v, {
|
|
1288
|
+
variant: "caption",
|
|
1289
|
+
color: "text.disabled",
|
|
1290
|
+
sx: {
|
|
1291
|
+
display: "block",
|
|
1292
|
+
mt: 1
|
|
1293
|
+
},
|
|
1294
|
+
children: "No images added yet."
|
|
1295
|
+
}) : null
|
|
1296
|
+
] });
|
|
1297
|
+
}
|
|
1298
|
+
We.propTypes = {
|
|
1299
|
+
value: le.arrayOf(le.string),
|
|
1300
|
+
onChange: le.func.isRequired
|
|
1301
|
+
};
|
|
1302
|
+
export {
|
|
1303
|
+
Li as default
|
|
1304
|
+
};
|
|
1305
|
+
//# sourceMappingURL=ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map
|