@argusoft/medplat-core 1.0.26 → 1.0.27
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-CupmTG3T.js → AccessRights-CHu27ZOw.js} +220 -217
- package/dist/AccessRights-CHu27ZOw.js.map +1 -0
- package/dist/{AddEditQueryBuilder-C8ZSkOF0.js → AddEditQueryBuilder-Brdnm6rQ.js} +2 -2
- package/dist/{AddEditQueryBuilder-C8ZSkOF0.js.map → AddEditQueryBuilder-Brdnm6rQ.js.map} +1 -1
- package/dist/{AddFeatures-CqE3v0BN.js → AddFeatures-C0Z29oSd.js} +2 -2
- package/dist/{AddFeatures-CqE3v0BN.js.map → AddFeatures-C0Z29oSd.js.map} +1 -1
- package/dist/{AddLabelModal-CB8E8cYG.js → AddLabelModal-DFllBVcd.js} +2 -2
- package/dist/{AddLabelModal-CB8E8cYG.js.map → AddLabelModal-DFllBVcd.js.map} +1 -1
- package/dist/{AppModal-BKgIwe1h.js → AppModal-CtG2GjD_.js} +2 -2
- package/dist/{AppModal-BKgIwe1h.js.map → AppModal-CtG2GjD_.js.map} +1 -1
- package/dist/{ChangePasswordModalCore-DTYWRTa-.js → ChangePasswordModalCore-CDxkeIIM.js} +2 -2
- package/dist/{ChangePasswordModalCore-DTYWRTa-.js.map → ChangePasswordModalCore-CDxkeIIM.js.map} +1 -1
- package/dist/{EventConfigurations-lPcZGpLi.js → EventConfigurations-kNtAj_WM.js} +76 -76
- package/dist/EventConfigurations-kNtAj_WM.js.map +1 -0
- package/dist/{FeatureMenu-DUZL32RI.js → FeatureMenu-jl7-Tk6y.js} +49 -49
- package/dist/FeatureMenu-jl7-Tk6y.js.map +1 -0
- package/dist/FileSaver.min-CN9EpL2h.js.map +1 -1
- package/dist/{ImmunizationConfigurationsList-K2ddBpPJ.js → ImmunizationConfigurationsList-DdSZicTP.js} +72 -73
- package/dist/{ImmunizationConfigurationsList-K2ddBpPJ.js.map → ImmunizationConfigurationsList-DdSZicTP.js.map} +1 -1
- package/dist/ImmunizationSkeleton-D2tdv5k-.js.map +1 -1
- package/dist/{LanguagesModal-CX3oS8rk.js → LanguagesModal-D6VfaGrl.js} +2 -2
- package/dist/{LanguagesModal-CX3oS8rk.js.map → LanguagesModal-D6VfaGrl.js.map} +1 -1
- package/dist/{ManageNotification-CSl02Wq7.js → ManageNotification-CaBAOhji.js} +2 -2
- package/dist/ManageNotification-CaBAOhji.js.map +1 -0
- package/dist/{ManageRole-B9bs_T00.js → ManageRole-CGYfglpo.js} +2 -2
- package/dist/{ManageRole-B9bs_T00.js.map → ManageRole-CGYfglpo.js.map} +1 -1
- package/dist/{ManageTranslation-D9IScGhk.js → ManageTranslation-B4C9-lWD.js} +74 -74
- package/dist/ManageTranslation-B4C9-lWD.js.map +1 -0
- package/dist/{ManageUser-AB3_Vfp_.js → ManageUser-AY1EUDLI.js} +600 -601
- package/dist/ManageUser-AY1EUDLI.js.map +1 -0
- package/dist/{NotificationList-D1U1LYnz.js → NotificationList-C3Vb_jKU.js} +73 -73
- package/dist/NotificationList-C3Vb_jKU.js.map +1 -0
- package/dist/OtherTypeEventConfigModal-BeG1GrUi.js.map +1 -1
- package/dist/{QueryBuilder-DI0wCJbz.js → QueryBuilder-z7eqfd7D.js} +117 -119
- package/dist/QueryBuilder-z7eqfd7D.js.map +1 -0
- package/dist/{QueryManagement-CRykYGum.js → QueryManagement-BIhEDKuA.js} +114 -114
- package/dist/QueryManagement-BIhEDKuA.js.map +1 -0
- package/dist/{RoleManagement-BIiW9uTq.js → RoleManagement-BPl2cE27.js} +99 -99
- package/dist/RoleManagement-BPl2cE27.js.map +1 -0
- package/dist/{SubMenu-CM_4wNCR.js → SubMenu-DYxAPH2Z.js} +34 -34
- package/dist/SubMenu-DYxAPH2Z.js.map +1 -0
- package/dist/{UserList-2gGuDgNa.js → UserList-Bc8gYxRL.js} +397 -400
- package/dist/UserList-Bc8gYxRL.js.map +1 -0
- package/dist/{WidgetList-B7X8Awkg.js → WidgetList-Dw_FmbbE.js} +26 -26
- package/dist/WidgetList-Dw_FmbbE.js.map +1 -0
- package/dist/i18next-CTOWN_jH.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +10 -10
- package/dist/xlsx.min-D1LFqt_b.js.map +1 -1
- package/package.json +1 -1
- package/dist/AccessRights-CupmTG3T.js.map +0 -1
- package/dist/EventConfigurations-lPcZGpLi.js.map +0 -1
- package/dist/FeatureMenu-DUZL32RI.js.map +0 -1
- package/dist/ManageNotification-CSl02Wq7.js.map +0 -1
- package/dist/ManageTranslation-D9IScGhk.js.map +0 -1
- package/dist/ManageUser-AB3_Vfp_.js.map +0 -1
- package/dist/NotificationList-D1U1LYnz.js.map +0 -1
- package/dist/QueryBuilder-DI0wCJbz.js.map +0 -1
- package/dist/QueryManagement-CRykYGum.js.map +0 -1
- package/dist/RoleManagement-BIiW9uTq.js.map +0 -1
- package/dist/SubMenu-CM_4wNCR.js.map +0 -1
- package/dist/UserList-2gGuDgNa.js.map +0 -1
- package/dist/WidgetList-B7X8Awkg.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as C, Fragment as
|
|
2
|
-
import { useState as r, useCallback as
|
|
3
|
-
import { Dialog as
|
|
1
|
+
import { jsxs as C, Fragment as te, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as r, useCallback as ae, useEffect as _, useRef as ne } from "react";
|
|
3
|
+
import { Dialog as oe, DialogTitle as ie, DialogContent as se, TextField as P, DialogActions as re, Button as x, Box as le, Card as ce, Typography as de } from "@mui/material";
|
|
4
4
|
import { showToast as y } from "@/common/toaster/toaster";
|
|
5
|
-
import { execute as
|
|
5
|
+
import { execute as B } from "@/common/services/GlobalApis";
|
|
6
6
|
import $ from "@mui/material/Grid2";
|
|
7
|
-
import { useNavigate as
|
|
8
|
-
import { u as
|
|
7
|
+
import { useNavigate as me } from "react-router";
|
|
8
|
+
import { u as ue, I as fe } from "./ImmunizationSkeleton-D2tdv5k-.js";
|
|
9
9
|
import A from "prop-types";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useTranslateProvider as
|
|
13
|
-
import
|
|
14
|
-
import { FontAwesomeIcon as
|
|
15
|
-
import { faPen as
|
|
16
|
-
import { getAssignedFeatures as
|
|
10
|
+
import G from "@/views/custom-components/CustomConfirmationModal";
|
|
11
|
+
import ye from "@/hooks/useTrackEvent";
|
|
12
|
+
import { useTranslateProvider as pe } from "@/common/languageTranslator/TranslationContext";
|
|
13
|
+
import ge from "@/views/custom-components/CustomizedTable/CustomizedTableV2";
|
|
14
|
+
import { FontAwesomeIcon as Q } from "@fortawesome/react-fontawesome";
|
|
15
|
+
import { faPen as he, faTrash as Ce } from "@fortawesome/free-solid-svg-icons";
|
|
16
|
+
import { getAssignedFeatures as we } from "@/utils/feature";
|
|
17
17
|
import O from "@/common/services/util/GeneralUtil.js";
|
|
18
|
-
const
|
|
19
|
-
const [b, v] = r(""), { translate: u } =
|
|
18
|
+
const H = ({ configuredQuery: p, open: w, onClose: g, dataTestId: F }) => {
|
|
19
|
+
const [b, v] = r(""), { translate: u } = pe(), [L, f] = r(!1), k = ae(() => {
|
|
20
20
|
let o = JSON.parse(JSON.stringify(p));
|
|
21
21
|
if (o.forEach((s) => {
|
|
22
22
|
delete s.id, delete s.created_at, delete s.updated_at;
|
|
@@ -28,21 +28,21 @@ const V = ({ configuredQuery: p, open: w, onClose: g, dataTestId: F }) => {
|
|
|
28
28
|
const t = s[M];
|
|
29
29
|
return typeof t == "string" ? `'${t.replace(/'/g, "''")}'` : t == null ? "NULL" : typeof t == "boolean" ? t ? "TRUE" : "FALSE" : t;
|
|
30
30
|
}).join(", ")})`).join(`,
|
|
31
|
-
`), D = `${d.filter((s) => s !== "code").map((s) => `${s} = EXCLUDED.${s}`).join(", ")}, updated_at = CURRENT_TIMESTAMP`,
|
|
31
|
+
`), D = `${d.filter((s) => s !== "code").map((s) => `${s} = EXCLUDED.${s}`).join(", ")}, updated_at = CURRENT_TIMESTAMP`, E = `INSERT INTO rch_immunization_configuration (${d.join(", ")})
|
|
32
32
|
VALUES
|
|
33
33
|
${h}
|
|
34
34
|
ON CONFLICT (code) DO UPDATE SET
|
|
35
35
|
${D};
|
|
36
36
|
`;
|
|
37
|
-
v(
|
|
37
|
+
v(E);
|
|
38
38
|
}, [p]), I = () => {
|
|
39
39
|
var o;
|
|
40
40
|
(o = navigator == null ? void 0 : navigator.clipboard) == null || o.writeText(b).then(() => {
|
|
41
41
|
y({ message: "Query Copied", type: "success" }), g();
|
|
42
42
|
});
|
|
43
|
-
},
|
|
43
|
+
}, R = () => {
|
|
44
44
|
z(), f((o) => !o);
|
|
45
|
-
}, T =
|
|
45
|
+
}, T = ye(), z = () => {
|
|
46
46
|
const o = new Blob([b], { type: "text/plain" }), d = (o.size / 1024).toFixed(2), h = URL.createObjectURL(o), c = document.createElement("a");
|
|
47
47
|
c.href = h, c.download = `V${(/* @__PURE__ */ new Date()).getTime()}__CHANGE_IN_IMMUNIZATION_TABLE}.sql`, document.body.appendChild(c), c.click(), T("file_download", {
|
|
48
48
|
file_type: "sql",
|
|
@@ -54,23 +54,23 @@ ${D};
|
|
|
54
54
|
z();
|
|
55
55
|
};
|
|
56
56
|
return _(() => {
|
|
57
|
-
p &&
|
|
58
|
-
}, [p]), /* @__PURE__ */ C(
|
|
57
|
+
p && k();
|
|
58
|
+
}, [p]), /* @__PURE__ */ C(te, { children: [
|
|
59
59
|
/* @__PURE__ */ n(
|
|
60
|
-
|
|
60
|
+
G,
|
|
61
61
|
{
|
|
62
62
|
description: "This Flyway contains keyword 'public'. Are you sure you want to download?",
|
|
63
63
|
title: "CONFIRM ACTION",
|
|
64
|
-
handleClick:
|
|
64
|
+
handleClick: R,
|
|
65
65
|
open: L,
|
|
66
66
|
handleClose: () => f((o) => !o),
|
|
67
67
|
dataTestId: "showflywayquery-customconfirmationmodal-confirmation-modal"
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
|
-
/* @__PURE__ */ C(
|
|
71
|
-
/* @__PURE__ */ n(
|
|
72
|
-
/* @__PURE__ */ n(
|
|
73
|
-
|
|
70
|
+
/* @__PURE__ */ C(oe, { open: w, onClose: g, fullWidth: !0, maxWidth: "md", "data-testid": F, children: [
|
|
71
|
+
/* @__PURE__ */ n(ie, { className: "p-2.5 px-5 flex border-b font-medium text-lg", children: u("Flyway Query") }),
|
|
72
|
+
/* @__PURE__ */ n(se, { children: /* @__PURE__ */ n(
|
|
73
|
+
P,
|
|
74
74
|
{
|
|
75
75
|
multiline: !0,
|
|
76
76
|
rows: 10,
|
|
@@ -93,7 +93,7 @@ ${D};
|
|
|
93
93
|
"data-testid": "showflywayquery-textfield-query-display"
|
|
94
94
|
}
|
|
95
95
|
) }),
|
|
96
|
-
/* @__PURE__ */ C(
|
|
96
|
+
/* @__PURE__ */ C(re, { children: [
|
|
97
97
|
/* @__PURE__ */ n(
|
|
98
98
|
x,
|
|
99
99
|
{
|
|
@@ -131,23 +131,22 @@ ${D};
|
|
|
131
131
|
] })
|
|
132
132
|
] });
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
H.propTypes = {
|
|
135
135
|
configuredQuery: A.any,
|
|
136
136
|
open: A.any,
|
|
137
137
|
onClose: A.any,
|
|
138
138
|
dataTestId: A.any
|
|
139
139
|
};
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const p = ue(), { t: w } = fe(), [g, F] = r([]), [b, v] = r([]), [u, L] = r([]), [f, E] = r(""), [I, k] = r(!1), [T, z] = r(!1), [S, o] = r([]), [d, h] = r([]), [c, D] = r(!1), [R, s] = r(!1), [j, M] = r({}), [t, W] = r({}), q = oe(t);
|
|
140
|
+
const Me = () => {
|
|
141
|
+
const p = me(), { t: w } = ue(), [g, F] = r([]), [b, v] = r([]), [u, L] = r([]), [f, k] = r(""), [I, R] = r(!1), [T, z] = r(!1), [S, o] = r([]), [d, h] = r([]), [c, D] = r(!1), [E, s] = r(!1), [j, M] = r({}), [t, J] = r(null), V = ne(t);
|
|
143
142
|
_(() => {
|
|
144
|
-
|
|
143
|
+
V.current = t;
|
|
145
144
|
}, [t]), _(() => {
|
|
146
145
|
h(() => g.filter(
|
|
147
146
|
(a) => S.some((l) => l.id === a.id)
|
|
148
147
|
));
|
|
149
148
|
}, [S]);
|
|
150
|
-
const
|
|
149
|
+
const W = [
|
|
151
150
|
{ field: "Sr. No.", label: "#", align: "left" },
|
|
152
151
|
// { field: 'code', label: 'Code', align: 'left', isBold: true },
|
|
153
152
|
{ field: "name", label: "Name", align: "left" },
|
|
@@ -155,55 +154,55 @@ const $e = () => {
|
|
|
155
154
|
{ field: "toAgeDays", label: "Eligible To" },
|
|
156
155
|
{ field: "base_date", label: "Base Date" },
|
|
157
156
|
{ field: "Actions", label: "Actions" }
|
|
158
|
-
],
|
|
159
|
-
|
|
157
|
+
], K = [
|
|
158
|
+
O.hasCheckRights(t == null ? void 0 : t["update.manage.manageImmunization"]) && {
|
|
160
159
|
label: "Fill Form",
|
|
161
|
-
icon: /* @__PURE__ */ n(
|
|
160
|
+
icon: /* @__PURE__ */ n(Q, { icon: he }),
|
|
162
161
|
onClick: (e) => {
|
|
163
162
|
p(`/ui/medplat/manage/manageImmunization/${e == null ? void 0 : e.id}`);
|
|
164
163
|
}
|
|
165
164
|
},
|
|
166
|
-
|
|
165
|
+
O.hasCheckRights(t == null ? void 0 : t["update.manage.manageImmunization"]) && {
|
|
167
166
|
label: "",
|
|
168
|
-
icon: /* @__PURE__ */ n(
|
|
167
|
+
icon: /* @__PURE__ */ n(Q, { icon: Ce }),
|
|
169
168
|
onClick: (e) => {
|
|
170
169
|
s(!0), M(e);
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
];
|
|
174
173
|
_(() => {
|
|
175
|
-
|
|
174
|
+
U();
|
|
176
175
|
}, []);
|
|
177
|
-
const
|
|
176
|
+
const Y = (e) => {
|
|
178
177
|
const a = JSON.parse(e);
|
|
179
178
|
return a.dependencies && a.dependencies.length > 0 ? a.dependencies[0].message : "NA";
|
|
180
|
-
},
|
|
179
|
+
}, q = (e) => {
|
|
181
180
|
if (typeof e != "number" || e <= 0) return "-";
|
|
182
181
|
const a = Math.floor(e / 365), l = e % 365, m = Math.floor(l / 30), N = l % 30, i = [];
|
|
183
182
|
return a > 0 && i.push(`${a} ${a === 1 ? "year" : "years"}`), m > 0 && i.push(`${m} ${m === 1 ? "month" : "months"}`), (N > 0 || a === 0 && m === 0) && i.push(`${N} ${N === 1 ? "day" : "days"}`), i.join(" ") || "0 days";
|
|
184
|
-
},
|
|
183
|
+
}, U = async () => {
|
|
185
184
|
var e, a;
|
|
186
185
|
try {
|
|
187
186
|
D((i) => !i);
|
|
188
|
-
const l = await
|
|
187
|
+
const l = await B({
|
|
189
188
|
code: "get_immunization_detail",
|
|
190
189
|
parameters: {}
|
|
191
190
|
});
|
|
192
191
|
F((e = l == null ? void 0 : l.data) == null ? void 0 : e.result);
|
|
193
192
|
const m = (a = l == null ? void 0 : l.data) == null ? void 0 : a.result.filter((i) => i.is_active === !0).map((i) => ({
|
|
194
193
|
...i,
|
|
195
|
-
fromAgeDays:
|
|
196
|
-
toAgeDays:
|
|
197
|
-
validationMessage: i.validations ?
|
|
198
|
-
})), { data: N } = await
|
|
194
|
+
fromAgeDays: q(i.from_age_days),
|
|
195
|
+
toAgeDays: q(i.to_age_days),
|
|
196
|
+
validationMessage: i.validations ? Y(i.validations) : "NA"
|
|
197
|
+
})), { data: N } = await we(
|
|
199
198
|
"techo.manage.immunizationConfiguratorList"
|
|
200
199
|
);
|
|
201
|
-
|
|
200
|
+
J(JSON.parse(N)), v(m), L(m), D((i) => !i);
|
|
202
201
|
} catch (l) {
|
|
203
202
|
console.error(l), y({ message: "Error in loading immunization", type: "error" }), D((m) => !m);
|
|
204
203
|
}
|
|
205
|
-
},
|
|
206
|
-
|
|
204
|
+
}, X = (e) => {
|
|
205
|
+
k(e.target.value);
|
|
207
206
|
};
|
|
208
207
|
_(() => {
|
|
209
208
|
if (!f) {
|
|
@@ -215,9 +214,9 @@ const $e = () => {
|
|
|
215
214
|
);
|
|
216
215
|
v(e);
|
|
217
216
|
}, [f, u]);
|
|
218
|
-
const
|
|
217
|
+
const Z = () => {
|
|
219
218
|
(d == null ? void 0 : d.length) > 0 ? z(!0) : y({ message: "Select atleast one row", type: "info" });
|
|
220
|
-
},
|
|
219
|
+
}, ee = async (e) => {
|
|
221
220
|
try {
|
|
222
221
|
let a = {
|
|
223
222
|
id: parseInt(e.id),
|
|
@@ -232,10 +231,10 @@ const $e = () => {
|
|
|
232
231
|
locations: e.locations || "[]",
|
|
233
232
|
active: !1
|
|
234
233
|
};
|
|
235
|
-
s(!1), await
|
|
234
|
+
s(!1), await B({
|
|
236
235
|
code: "update_immunization",
|
|
237
236
|
parameters: { ...a }
|
|
238
|
-
}),
|
|
237
|
+
}), U(), y({
|
|
239
238
|
message: "Immunization status changed Successfully!",
|
|
240
239
|
type: "success"
|
|
241
240
|
});
|
|
@@ -243,15 +242,15 @@ const $e = () => {
|
|
|
243
242
|
console.error(a), y({ type: "error", message: "error toggling status" });
|
|
244
243
|
}
|
|
245
244
|
};
|
|
246
|
-
return
|
|
247
|
-
|
|
245
|
+
return !c && t !== null && !O.hasCheckRights(t == null ? void 0 : t["view.manage.manageImmunization"]) ? /* @__PURE__ */ n(le, { className: "flex justify-center items-center w-full h-[80vh]", children: /* @__PURE__ */ n(
|
|
246
|
+
ce,
|
|
248
247
|
{
|
|
249
248
|
className: "h-80 w-150 flex justify-center items-center",
|
|
250
|
-
children: /* @__PURE__ */ n(
|
|
249
|
+
children: /* @__PURE__ */ n(de, { variant: "h5", className: "text-customBlue", children: "You dont have permission to view Manage Immunization" })
|
|
251
250
|
}
|
|
252
251
|
) }) : /* @__PURE__ */ C($, { container: !0, justifyContent: "flex-end", className: "mt-5 mr-5", children: [
|
|
253
252
|
T && /* @__PURE__ */ n(
|
|
254
|
-
|
|
253
|
+
H,
|
|
255
254
|
{
|
|
256
255
|
configuredQuery: d,
|
|
257
256
|
open: T,
|
|
@@ -261,10 +260,10 @@ const $e = () => {
|
|
|
261
260
|
dataTestId: "eventconfiguration-query-showflywayquery"
|
|
262
261
|
}
|
|
263
262
|
),
|
|
264
|
-
/* @__PURE__ */ C(
|
|
263
|
+
/* @__PURE__ */ C(fe, { isLoading: c, children: [
|
|
265
264
|
/* @__PURE__ */ C($, { item: !0, children: [
|
|
266
265
|
/* @__PURE__ */ n(
|
|
267
|
-
|
|
266
|
+
P,
|
|
268
267
|
{
|
|
269
268
|
className: "bg-white p-0 m-0",
|
|
270
269
|
placeholder: "Search code",
|
|
@@ -275,16 +274,16 @@ const $e = () => {
|
|
|
275
274
|
// Adjust text padding inside input
|
|
276
275
|
},
|
|
277
276
|
value: f,
|
|
278
|
-
onChange:
|
|
277
|
+
onChange: X
|
|
279
278
|
}
|
|
280
279
|
),
|
|
281
|
-
|
|
280
|
+
O.hasCheckRights(t == null ? void 0 : t["view.manage.manageImmunization.flywayQuery"], t == null ? void 0 : t.canGenerateFlyway) && /* @__PURE__ */ n(
|
|
282
281
|
x,
|
|
283
282
|
{
|
|
284
283
|
className: "mb-4 ml-4",
|
|
285
284
|
variant: "contained",
|
|
286
285
|
onClick: () => {
|
|
287
|
-
|
|
286
|
+
R((e) => !e);
|
|
288
287
|
},
|
|
289
288
|
size: "small",
|
|
290
289
|
"data-testid": "immunizationList-button-add",
|
|
@@ -297,7 +296,7 @@ const $e = () => {
|
|
|
297
296
|
className: "mb-4 ml-4",
|
|
298
297
|
variant: "contained",
|
|
299
298
|
onClick: () => {
|
|
300
|
-
|
|
299
|
+
Z();
|
|
301
300
|
},
|
|
302
301
|
size: "small",
|
|
303
302
|
"data-testid": "immunizationList-button-add",
|
|
@@ -306,16 +305,16 @@ const $e = () => {
|
|
|
306
305
|
)
|
|
307
306
|
] }),
|
|
308
307
|
/* @__PURE__ */ n($, { size: { xs: 12 }, children: /* @__PURE__ */ n(
|
|
309
|
-
|
|
308
|
+
ge,
|
|
310
309
|
{
|
|
311
310
|
dataTestId: "Immunization-configurator-customizedtable",
|
|
312
|
-
columns:
|
|
311
|
+
columns: W,
|
|
313
312
|
tableData: b,
|
|
314
313
|
paginationConfig: {
|
|
315
314
|
pagination: !0,
|
|
316
315
|
rowsPerPageInTable: 20
|
|
317
316
|
},
|
|
318
|
-
actions:
|
|
317
|
+
actions: K,
|
|
319
318
|
rowSelectionConfig: {
|
|
320
319
|
rowSelectionEnabled: I,
|
|
321
320
|
selectedRows: S,
|
|
@@ -328,18 +327,18 @@ const $e = () => {
|
|
|
328
327
|
) })
|
|
329
328
|
] }),
|
|
330
329
|
/* @__PURE__ */ n(
|
|
331
|
-
|
|
330
|
+
G,
|
|
332
331
|
{
|
|
333
|
-
open:
|
|
332
|
+
open: E,
|
|
334
333
|
description: "Are you sure you want to change the state of this Immunization ?",
|
|
335
334
|
title: "CONFIRM ACTION",
|
|
336
|
-
handleClick: () =>
|
|
335
|
+
handleClick: () => ee(j),
|
|
337
336
|
handleClose: () => s(!1)
|
|
338
337
|
}
|
|
339
338
|
)
|
|
340
339
|
] });
|
|
341
340
|
};
|
|
342
341
|
export {
|
|
343
|
-
|
|
342
|
+
Me as default
|
|
344
343
|
};
|
|
345
|
-
//# sourceMappingURL=ImmunizationConfigurationsList-
|
|
344
|
+
//# sourceMappingURL=ImmunizationConfigurationsList-DdSZicTP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImmunizationConfigurationsList-K2ddBpPJ.js","sources":["../src/views/Immunization/ShowFlywayQuery.jsx","../src/views/Immunization/ImmunizationConfigurationsList.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport { Dialog, DialogActions, DialogContent, DialogTitle, Button, TextField } from '@mui/material';\nimport { showToast } from '@/common/toaster/toaster';\nimport CustomConfirmationModal from '@/views/custom-components/CustomConfirmationModal';\n// import moment from 'moment/moment';\nimport useTrackEvent from '@/hooks/useTrackEvent';\nimport { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';\n\n/**\n * A React functional component that displays a configured Flyway query.\n * @module ShowFlywayQuery\n * @param {Object} props - Component properties.\n * @param {Object} props.configuredQuery - The query configuration object to display.\n * @param {boolean} props.open - Boolean flag indicating if the component should be visible.\n * @param {function} props.onClose - Callback function to close the component.\n */\n\nconst ShowFlywayQuery = ({ configuredQuery, open, onClose, dataTestId }) => {\n const [text, setText] = useState('');\n // const [isPublicKeyword, setIsPublicKeyword] = useState(false);\n const { translate } = useTranslateProvider();\n\n const [openConfirm, setOpenConfirm] = useState(false);\n\n /**\n *\n * Generates a SQL query string based on the `configuredQuery` object.\n * @function generateQueryText\n * @param {Object} configuredQuery - The query configuration object used to generate the SQL query.\n * @param {string} configuredQuery.code - The unique code for the query.\n * @param {string} configuredQuery.uuid - The unique identifier for the query.\n * @param {number} configuredQuery.createdBy - The ID of the user who created the query.\n * @param {string} [configuredQuery.params] - The parameters for the query.\n * @param {string} configuredQuery.query - The actual SQL query text.\n * @param {string} [configuredQuery.description] - A description of the query.\n * @param {boolean} [configuredQuery.returnsResultSet] - Flag indicating if the query returns a result set.\n * @param {string} [configuredQuery.state] - The state of the query (e.g., 'ACTIVE').\n * @returns {void}\n */\n\n const generateQueryText = useCallback(() => {\n // Ensure configuredQuery is a non-empty array\n // if (!Array.isArray(configuredQuery) || configuredQuery.length === 0) {\n // throw new Error('configuredQuery should be a non-empty array of objects.');\n // }\n\n // Remove 'id', 'created_at', and 'updated_at' properties from each object\n let queryList = JSON.parse(JSON.stringify(configuredQuery));\n queryList.forEach((obj) => {\n delete obj.id;\n delete obj.created_at;\n delete obj.updated_at;\n });\n\n // Extract column names from the first object\n if (!Array.isArray(queryList) || queryList.length === 0) {\n showToast({ message: 'No data to generate', type: 'error' });\n return;\n }\n\n // Extract column names from the first object\n const columns = Object.keys(queryList[0]);\n\n // Map over queryList to create a string of values for each object\n const values = queryList\n .map((row) => {\n const valueString = columns\n .map((col) => {\n const value = row[col];\n if (typeof value === 'string') {\n // Escape single quotes in strings and enclose in single quotes\n return `'${value.replace(/'/g, \"''\")}'`;\n } else if (value === null || value === undefined) {\n // Handle null or undefined values\n return 'NULL';\n } else if (typeof value === 'boolean') {\n // Convert boolean to PostgreSQL boolean literals\n return value ? 'TRUE' : 'FALSE';\n }\n // For numbers and other types, return as is\n return value;\n })\n .join(', ');\n return `(${valueString})`;\n })\n .join(',\\n');\n\n // Construct the ON CONFLICT clause to update all columns except the primary key\n const updateClause = columns\n .filter((col) => col !== 'code') // Assuming 'code' is the primary key\n .map((col) => `${col} = EXCLUDED.${col}`)\n .join(', ');\n const finalUpdateClause = `${updateClause}, updated_at = CURRENT_TIMESTAMP`;\n\n // Construct the final INSERT statement with ON CONFLICT DO UPDATE\n\n // Construct the final INSERT statement with ON CONFLICT DO UPDATE\n const query = `INSERT INTO rch_immunization_configuration (${columns.join(', ')}) \\nVALUES\\n${values}\\nON CONFLICT (code) DO UPDATE SET\\n${finalUpdateClause};\n `;\n\n // return query;\n setText(query);\n\n // const publicKeyword = configuredQuery?.configJson?.includes('public');\n // setIsPublicKeyword(publicKeyword);\n // // Delete existing event configuration\n // let queryText = `DELETE FROM EVENT_CONFIGURATION WHERE uuid = '${configuredQuery.uuid}';\\n\\n`;\n\n // // Insert new event configuration\n // queryText += `INSERT INTO EVENT_CONFIGURATION (created_by, created_on, modified_by, modified_on, day, description, event_type, event_type_detail_id, form_type_id, hour, minute, name, config_json, state, trigger_when, event_type_detail_code, uuid)\\nVALUES (\\n`;\n // queryText += `${configuredQuery.createdBy}, current_date, ${configuredQuery.createdBy}, current_date, `;\n\n // queryText +=\n // configuredQuery.day !== undefined && configuredQuery.day !== null ? `${configuredQuery.day}, ` : 'null, ';\n // queryText += configuredQuery.description ? `'${configuredQuery.description.replace(/'/g, \"''\")}', ` : 'null, ';\n // queryText += `'${configuredQuery.eventType}', `;\n // queryText +=\n // configuredQuery.eventTypeDetailId !== undefined && configuredQuery.eventTypeDetailId !== null\n // ? `${configuredQuery.eventTypeDetailId}, `\n // : 'null, ';\n // queryText +=\n // configuredQuery.formTypeId !== undefined && configuredQuery.formTypeId !== null\n // ? `${configuredQuery.formTypeId}, `\n // : 'null, ';\n // queryText +=\n // configuredQuery.hour !== undefined && configuredQuery.hour !== null ? `${configuredQuery.hour}, ` : 'null, ';\n // queryText +=\n // configuredQuery.minute !== undefined && configuredQuery.minute !== null\n // ? `${configuredQuery.minute}, `\n // : 'null, ';\n // queryText += `'${configuredQuery.name.replace(/'/g, \"''\")}', `;\n // queryText += `'${configuredQuery.configJson.replace(/'/g, \"''\")}', `;\n // queryText += `'${configuredQuery.state}', `;\n // queryText +=\n // configuredQuery.trigerWhen !== undefined && configuredQuery.trigerWhen !== null\n // ? `'${configuredQuery.trigerWhen}', `\n // : 'null, ';\n // queryText +=\n // configuredQuery.eventTypeDetailCode !== undefined && configuredQuery.eventTypeDetailCode !== null\n // ? `${configuredQuery.eventTypeDetailCode}, `\n // : 'null, ';\n // queryText += `'${configuredQuery.uuid}');\\n`;\n\n // if (configuredQuery.eventType === 'TIMMER_BASED' && configuredQuery.state !== 'INACTIVE') {\n // let nextDate = moment();\n // switch (configuredQuery.trigerWhen) {\n // case 'MONTHLY':\n // nextDate.add(1, 'months').set({\n // date: configuredQuery.day,\n // hour: configuredQuery.hour || 0,\n // minute: configuredQuery.minute || 0,\n // second: 0,\n // });\n // break;\n // case 'DAILY':\n // nextDate\n // .add(getNextDate(configuredQuery), 'days')\n // .set({ hour: configuredQuery.hour || 0, minute: configuredQuery.minute || 0, second: 0 });\n // break;\n // case 'HOURLY':\n // nextDate.add(1, 'hours').set({ minute: getNextDate(configuredQuery), second: 0 });\n // break;\n // case 'MINUTE':\n // nextDate.add(configuredQuery.minute, 'minutes').set({ second: 0 });\n // break;\n // default:\n // }\n\n // queryText += `\\nDELETE FROM TIMER_EVENT WHERE event_config_uuid = '${configuredQuery.uuid}' AND status = 'NEW';\\n\\n`;\n // queryText += `INSERT INTO timer_event (event_config_uuid, processed, status, type, system_trigger_on)\\nVALUES (\\n`;\n // queryText += `'${configuredQuery.uuid}', false, 'NEW', 'TIMER_EVENT', '${nextDate.format('MM-DD-yyyy HH:mm:ss')}');\\n`;\n // }\n\n // // Handle notification configurations\n // if (configuredQuery.configJson !== null) {\n // const notificationConfigs = JSON.parse(configuredQuery.configJson);\n // let firstDelete = true;\n\n // notificationConfigs.forEach((config) => {\n // if (config.conditions !== null && config.conditions.length > 0) {\n // config.conditions.forEach((condition) => {\n // if (condition.notificaitonConfigsType !== null && condition.notificaitonConfigsType.length > 0) {\n // if (firstDelete) {\n // queryText += `\\nDELETE FROM EVENT_CONFIGURATION_TYPE WHERE event_config_uuid = '${configuredQuery.uuid}';\\n`;\n // firstDelete = false;\n // }\n // condition.notificaitonConfigsType.forEach((configType) => {\n // queryText += `\\nINSERT INTO EVENT_CONFIGURATION_TYPE (id, base_date_field_name, event_config_uuid, day, email_subject, email_subject_parameter, hour, minute, mobile_notification_type, template, template_parameter, triger_when, type, user_field_name, family_field_name, member_field_name, query_master_id, query_master_param_json, query_code, sms_config_json, push_notification_config_json)\\nVALUES (\\n`;\n // queryText += `'${configType.id}', `;\n // queryText += configType.baseDateFieldName ? `'${configType.baseDateFieldName}', ` : 'null, ';\n // queryText += `'${configuredQuery.uuid}', `;\n // queryText += configType.day !== undefined && configType.day !== null ? `${configType.day}, ` : 'null, ';\n // queryText += configType.emailSubject ? `'${configType.emailSubject.replace(/'/g, \"''\")}', ` : 'null, ';\n // queryText += configType.emailSubjectParameter ? `'${configType.emailSubjectParameter}', ` : 'null, ';\n // queryText +=\n // configType.hour !== undefined && configType.hour !== null ? `${configType.hour}, ` : 'null, ';\n // queryText +=\n // configType.miniute !== undefined && configType.miniute !== null\n // ? `${configType.miniute}, `\n // : 'null, ';\n // queryText +=\n // configType.mobileNotificationType !== undefined && configType.mobileNotificationType !== null\n // ? `${configType.mobileNotificationType}, `\n // : 'null, ';\n // queryText += configType.template ? `'${configType.template.replace(/'/g, \"''\")}', ` : 'null, ';\n // queryText += configType.templateParameter\n // ? `'${configType.templateParameter.replace(/'/g, \"''\")}', `\n // : 'null, ';\n // queryText += configType.trigerWhen ? `'${configType.trigerWhen}', ` : 'null, ';\n // queryText += configType.type ? `'${configType.type}', ` : 'null, ';\n // queryText += configType.userFieldName ? `'${configType.userFieldName}', ` : 'null, ';\n // queryText += configType.familyFieldName ? `'${configType.familyFieldName}', ` : 'null, ';\n // queryText += configType.memberFieldName ? `'${configType.memberFieldName}', ` : 'null, ';\n // queryText +=\n // configType.queryMasterId !== undefined && configType.queryMasterId !== null\n // ? `${configType.queryMasterId}, `\n // : 'null, ';\n // queryText +=\n // configType.queryMasterParamJson !== undefined && configType.queryMasterParamJson !== null\n // ? `'${JSON.stringify(configType.queryMasterParamJson).replace(/'/g, \"''\")}', `\n // : 'null, ';\n // queryText += configType.queryCode ? `'${configType.queryCode}', ` : 'null, ';\n // queryText +=\n // configType.smsConfigJson !== undefined && configType.smsConfigJson !== null\n // ? `'${JSON.stringify(configType.smsConfigJson).replace(/'/g, \"''\")}', `\n // : 'null, ';\n // queryText +=\n // configType.pushNotificationConfigJson !== undefined && configType.pushNotificationConfigJson !== null\n // ? `'${JSON.stringify(configType.pushNotificationConfigJson).replace(/'/g, \"''\")}'`\n // : 'null';\n // queryText += ');\\n';\n\n // // Handle mobile notification configs\n // if (configType.mobileNotificationConfigs && configType.mobileNotificationConfigs.length > 0) {\n // queryText += `\\nDELETE FROM EVENT_MOBILE_CONFIGURATION WHERE notification_type_config_id = '${configType.id}';\\n`;\n // configType.mobileNotificationConfigs.forEach((mobileConfig) => {\n // queryText += `\\nINSERT INTO EVENT_MOBILE_CONFIGURATION (id, notification_code, notification_type_config_id, number_of_days_added_for_due_date, number_of_days_added_for_expiry_date, number_of_days_added_for_on_date)\\nVALUES (\\n`;\n // queryText += `'${mobileConfig.id}', '${mobileConfig.notificationCode}', '${mobileConfig.notificationTypeConfigId}', ${mobileConfig.numberOfDaysAddedForDueDate}, ${mobileConfig.numberOfDaysAddedForExpiryDate}, ${mobileConfig.numberOfDaysAddedForOnDate});\\n`;\n // });\n // }\n // });\n // }\n // });\n // }\n // });\n // }\n\n // // Insert sync system configuration master\n // let eventConfigObj = {\n // id: configuredQuery.id,\n // name: configuredQuery.name,\n // description: configuredQuery.description,\n // eventType: configuredQuery.eventType,\n // eventTypeDetailId: configuredQuery.eventTypeDetailId,\n // formTypeId: configuredQuery.formTypeId,\n // eventTypeDetailCode: configuredQuery.eventTypeDetailCode,\n // trigerWhen: configuredQuery.trigerWhen,\n // day: configuredQuery.day,\n // hour: configuredQuery.hour,\n // minute: configuredQuery.minute,\n // state: configuredQuery.state,\n // createdBy: configuredQuery.createdBy,\n // createdOn: moment().valueOf(),\n // notificationConfigDetails: JSON.parse(configuredQuery.configJson),\n // status: null,\n // completionTime: null,\n // configJson: null,\n // uuid: configuredQuery.uuid,\n // };\n\n // queryText += `\\nINSERT INTO SYNC_SYSTEM_CONFIGURATION_MASTER (feature_type, config_json, created_on, created_by, feature_uuid, feature_name)\\nVALUES (\\n`;\n // queryText += `'EVENT_BUILDER', '${JSON.stringify(eventConfigObj).replace(/'/g, \"''\")}', current_date, ${configuredQuery.createdBy}, '${configuredQuery.uuid}', '${configuredQuery.name}');\\n`;\n // setText(queryText);\n }, [configuredQuery]);\n\n /**\n *\n * Copies the generated query text to the clipboard and displays a success message.\n * @function copyQuery\n * @returns {void}\n */\n\n // const getNextDate = function (eventObj) {\n // const now = new Date();\n // const eventDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), eventObj.hour, eventObj.minute);\n\n // if (eventDate > now) {\n // return 0;\n // } else {\n // return 1;\n // }\n // };\n\n const copyQuery = () => {\n navigator?.clipboard?.writeText(text).then(() => {\n showToast({ message: 'Query Copied', type: 'success' });\n onClose();\n });\n };\n\n /**\n * Triggers a download operation and toggles the confirmation dialog visibility.\n * The function assumes that `download` and `setOpenConfirm` are available in the current scope.\n * @function askForConfirmation\n * @returns {void}\n */\n\n const askForConfirmation = () => {\n download();\n setOpenConfirm((cur) => !cur);\n };\n\n const trackEvent = useTrackEvent();\n\n /**\n * Creates and triggers a download of a text file containing the query text.\n *\n * @function download\n * @returns {void}\n */\n\n const download = () => {\n const blob = new Blob([text], { type: 'text/plain' });\n const blobSizeInKB = (blob.size / 1024).toFixed(2);\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `V${new Date().getTime()}__CHANGE_IN_IMMUNIZATION_TABLE}.sql`;\n document.body.appendChild(a);\n a.click();\n\n trackEvent('file_download', {\n file_type: 'sql',\n file_name: a.download,\n file_size: `${blobSizeInKB} KB`,\n download_status: 'success',\n });\n\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n\n showToast({ message: 'Query Downloaded SuccessFully', type: 'success' });\n\n onClose();\n };\n\n /**\n *\n * Handles the download process based on the presence of a public keyword in the query text.\n * @function handleDownload\n * @returns {void}\n */\n\n const handleDownload = () => {\n download();\n // if (isPublicKeyword) {\n // setOpenConfirm((cur) => !cur);\n // } else {\n // download();\n // }\n };\n\n /**\n * `useEffect` Hook to Generate Query Text\n *\n * This effect hook is used to generate the SQL query text whenever the `configuredQuery` dependency changes.\n *\n * @function useEffect\n * @param {Object} configuredQuery - The query configuration object used to generate the SQL query text.\n * @param {function} generateQueryText - A function that generates the query text based on `configuredQuery`.\n */\n\n useEffect(() => {\n if (configuredQuery) {\n generateQueryText();\n }\n }, [configuredQuery]);\n return (\n <>\n <CustomConfirmationModal\n description={\"This Flyway contains keyword 'public'. Are you sure you want to download?\"}\n title={'CONFIRM ACTION'}\n handleClick={askForConfirmation}\n open={openConfirm}\n handleClose={() => setOpenConfirm((cur) => !cur)}\n dataTestId=\"showflywayquery-customconfirmationmodal-confirmation-modal\"\n />\n <Dialog open={open} onClose={onClose} fullWidth maxWidth=\"md\" data-testid={dataTestId}>\n <DialogTitle className=\"p-2.5 px-5 flex border-b font-medium text-lg\">{translate('Flyway Query')}</DialogTitle>\n <DialogContent>\n <TextField\n multiline\n rows={10}\n variant=\"outlined\"\n fullWidth\n value={text}\n sx={{\n '& .MuiInputBase-input': {\n fontSize: '14px',\n },\n '& .MuiOutlinedInput-root': {\n borderRadius: '5px',\n },\n }}\n slotProps={{\n input: {\n readOnly: true,\n },\n }}\n data-testid=\"showflywayquery-textfield-query-display\"\n />\n </DialogContent>\n <DialogActions>\n <Button\n onClick={handleDownload}\n variant=\"contained\"\n size=\"small\"\n color=\"primary\"\n data-testid=\"showflywayquery-button-download-action\"\n >\n {translate('Download')}\n </Button>\n <Button\n onClick={copyQuery}\n variant=\"contained\"\n size=\"small\"\n color=\"primary\"\n data-testid=\"showflywayquery-button-copyquery-action\"\n >\n {translate('Copy Query')}\n </Button>\n <Button\n onClick={onClose}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n data-testid=\"showflywayquery-button-cancel-action\"\n >\n {translate('Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n </>\n );\n};\n\nShowFlywayQuery.propTypes = {\n configuredQuery: PropTypes.any,\n open: PropTypes.any,\n onClose: PropTypes.any,\n dataTestId: PropTypes.any,\n};\n\nexport default ShowFlywayQuery;\n","import React, { useEffect, useState, useRef } from \"react\";\nimport { Button, TextField, Box, Card, Typography } from \"@mui/material\";\nimport { showToast } from \"@/common/toaster/toaster\";\nimport { execute } from \"@/common/services/GlobalApis\";\nimport Grid from \"@mui/material/Grid2\";\nimport { useTranslation } from \"react-i18next\";\nimport { useNavigate } from \"react-router\";\nimport { ImmunizationConfigurationsListSkeleton } from \"./Skeletons/ImmunizationSkeleton\";\nimport ShowFlywayQuery from \"./ShowFlywayQuery.jsx\";\nimport CustomConfirmationModal from \"@/views/custom-components/CustomConfirmationModal\";\nimport CustomizedTable from \"@/views/custom-components/CustomizedTable/CustomizedTableV2\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { faPen, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { getAssignedFeatures } from \"@/utils/feature\";\nimport GeneralUtil from \"@/common/services/util/GeneralUtil.js\";\n\nconst ImmunizationConfigurationsList = () => {\n const navigate = useNavigate();\n const { t } = useTranslation();\n const [immunizationData, setImmunizationData] = useState([]);\n const [tableData, setTableData] = useState([]);\n const [originalData, setOriginalData] = useState([]);\n const [search, setSearch] = useState(\"\");\n const [openSelectColumn, setOpenSelectColumn] = useState(false);\n const [openFlywayQuery, setOpenFlywayQuery] = useState(false);\n const [selectedRows, setSelectedRows] = useState([]);\n const [configuredQueryList, setConfiguredQueryList] = useState([]);\n const [isLoading, setIsLoading] = useState(false);\n const [open, setOpen] = useState(false);\n const [rowData, setRowData] = useState({});\n const [rights, setRights] = useState({});\n const rightsRef = useRef(rights);\n\n useEffect(() => {\n rightsRef.current = rights;\n }, [rights]);\n\n\n useEffect(() => {\n setConfiguredQueryList(() => {\n const filteredImmunization = immunizationData.filter((item) =>\n selectedRows.some((selected) => selected.id === item.id)\n );\n return filteredImmunization;\n });\n }, [selectedRows]);\n\n const tableFields = [\n { field: \"Sr. No.\", label: \"#\", align: \"left\" },\n // { field: 'code', label: 'Code', align: 'left', isBold: true },\n { field: \"name\", label: \"Name\", align: \"left\" },\n { field: \"fromAgeDays\", label: \"Eligible From\" },\n { field: \"toAgeDays\", label: \"Eligible To\" },\n { field: \"base_date\", label: \"Base Date\" },\n { field: \"Actions\", label: \"Actions\" },\n ];\n\n const actions = [\n (!GeneralUtil.isTecho || rights?.['update.manage.manageImmunization']) && \n {\n label: \"Fill Form\",\n icon: <FontAwesomeIcon icon={faPen} />,\n onClick: (row) => {\n navigate(`/ui/medplat/manage/manageImmunization/${row?.id}`);\n },\n },\n (!GeneralUtil.isTecho || rights?.['update.manage.manageImmunization']) && \n {\n label: \"\",\n icon: <FontAwesomeIcon icon={faTrash} />,\n onClick: (row) => {\n setOpen(true);\n setRowData(row);\n },\n },\n ];\n\n useEffect(() => {\n loadInitial();\n }, []);\n\n const getValidationMessage = (validations) => {\n const validationsObj = JSON.parse(validations);\n return validationsObj.dependencies && validationsObj.dependencies.length > 0\n ? validationsObj.dependencies[0].message\n : \"NA\";\n };\n\n const convertDaysToHumanReadable = (days) => {\n if (typeof days !== \"number\" || days <= 0) return \"-\";\n\n const years = Math.floor(days / 365);\n const remainingDaysAfterYears = days % 365;\n const months = Math.floor(remainingDaysAfterYears / 30);\n const remainingDays = remainingDaysAfterYears % 30;\n\n const parts = [];\n if (years > 0) {\n parts.push(`${years} ${years === 1 ? \"year\" : \"years\"}`);\n }\n if (months > 0) {\n parts.push(`${months} ${months === 1 ? \"month\" : \"months\"}`);\n }\n if (remainingDays > 0 || (years === 0 && months === 0)) {\n parts.push(`${remainingDays} ${remainingDays === 1 ? \"day\" : \"days\"}`);\n }\n\n return parts.join(\" \") || \"0 days\";\n };\n\n const loadInitial = async () => {\n try {\n setIsLoading((cur) => !cur);\n const res = await execute({\n code: \"get_immunization_detail\",\n parameters: {},\n });\n setImmunizationData(res?.data?.result);\n const immunizations = res?.data?.result\n .filter((el) => el.is_active === true)\n .map((el) => {\n return {\n ...el,\n fromAgeDays: convertDaysToHumanReadable(el.from_age_days),\n toAgeDays: convertDaysToHumanReadable(el.to_age_days),\n validationMessage: el.validations\n ? getValidationMessage(el.validations)\n : \"NA\",\n };\n });\n const { data: assignedFeatures } = await getAssignedFeatures(\n \"techo.manage.immunizationConfiguratorList\"\n );\n setRights(JSON.parse(assignedFeatures));\n setTableData(immunizations);\n setOriginalData(immunizations);\n setIsLoading((cur) => !cur);\n } catch (error) {\n console.error(error);\n showToast({ message: \"Error in loading immunization\", type: \"error\" });\n setIsLoading((cur) => !cur);\n }\n };\n\n const handleSearch = (e) => {\n setSearch(e.target.value);\n };\n\n useEffect(() => {\n if (!search) {\n setTableData(originalData); // Reset to original data if search is empty\n return;\n }\n\n const filteredData = originalData.filter(\n (item) =>\n item.code.toLowerCase().includes(search.toLowerCase()) ||\n item.name.toLowerCase().includes(search.toLowerCase())\n );\n\n setTableData(filteredData);\n }, [search, originalData]);\n\n const handleFlywayOpen = () => {\n if (configuredQueryList?.length > 0) {\n setOpenFlywayQuery(true);\n } else {\n showToast({ message: \"Select atleast one row\", type: \"info\" });\n }\n };\n\n const handleOpenStatusModal = async (row) => {\n try {\n let formData = {\n id: parseInt(row.id),\n code: row.code,\n name: row.name,\n isrecursive: row.is_recursive || false,\n fromAgeDays: row.from_age_days,\n toAgeDays: row.to_age_days,\n basedate: row.base_date,\n validations: row.validations,\n recursiveobject: row.recursive_object,\n locations: row.locations || \"[]\",\n active: false,\n };\n setOpen(false);\n await execute({\n code: \"update_immunization\",\n parameters: { ...formData },\n });\n loadInitial();\n showToast({\n message: \"Immunization status changed Successfully!\",\n type: \"success\",\n });\n } catch (error) {\n console.error(error);\n showToast({ type: \"error\", message: \"error toggling status\" });\n }\n };\n\n return GeneralUtil.isTecho && !isLoading && !rights?.[\"view.manage.manageImmunization\"] ? (\n <Box className=\"flex justify-center items-center w-full h-[80vh]\">\n <Card\n className=\"h-80 w-150 flex justify-center items-center\"\n >\n <Typography variant=\"h5\" className=\"text-customBlue\">\n You dont have permission to view Manage Immunization\n </Typography>\n </Card>\n </Box>\n ) : (\n <Grid container justifyContent=\"flex-end\" className=\"mt-5 mr-5\">\n {openFlywayQuery && (\n <ShowFlywayQuery\n configuredQuery={configuredQueryList}\n open={openFlywayQuery}\n onClose={() => {\n setOpenFlywayQuery((cur) => !cur);\n }}\n dataTestId=\"eventconfiguration-query-showflywayquery\"\n />\n )}\n <ImmunizationConfigurationsListSkeleton isLoading={isLoading}>\n <Grid item>\n <TextField\n className=\"bg-white p-0 m-0\"\n placeholder=\"Search code\"\n sx={{\n \"& .MuiInputBase-root\": { height: \"35px\" }, // Controls the overall input height\n \"& .MuiInputBase-input\": { padding: \"6px 12px\" }, // Adjust text padding inside input\n }}\n value={search}\n onChange={handleSearch}\n />\n {(!GeneralUtil.isTecho\n ? rightsRef.current?.canGenerateFlyway\n : rights?.['view.manage.manageImmunization.flywayQuery']) && (\n <Button\n className=\"mb-4 ml-4\"\n variant=\"contained\"\n onClick={() => {\n setOpenSelectColumn((curr) => !curr);\n }}\n size=\"small\"\n data-testid=\"immunizationList-button-add\"\n >\n {!openSelectColumn\n ? t(\"Select Immunization\")\n : t(\"Hide Selection\")}\n </Button>\n )}\n {openSelectColumn && !openFlywayQuery && (\n <Button\n className=\"mb-4 ml-4\"\n variant=\"contained\"\n onClick={() => {\n handleFlywayOpen();\n }}\n size=\"small\"\n data-testid=\"immunizationList-button-add\"\n >\n {t(\"Show Flyway\")}\n </Button>\n )}\n {/* <Button\n className=\"mb-4 ml-4\"\n variant=\"contained\"\n onClick={() => {\n navigate(\"/ui/medplat/manage/manageImmunization\");\n }}\n size=\"small\"\n data-testid=\"immunizationList-button-add\"\n >\n {t(\"Add Immunization\")}\n </Button> */}\n </Grid>\n <Grid size={{ xs: 12 }}>\n <CustomizedTable\n dataTestId=\"Immunization-configurator-customizedtable\"\n columns={tableFields}\n tableData={tableData}\n paginationConfig={{\n pagination: true,\n rowsPerPageInTable: 20,\n }}\n actions={actions}\n rowSelectionConfig={{\n rowSelectionEnabled: openSelectColumn,\n selectedRows,\n setSelectedRows,\n }}\n styleConfig={{ tableStyle: { maxHeight: 45 } }}\n isLoading={isLoading}\n strip={true}\n />\n </Grid>\n </ImmunizationConfigurationsListSkeleton>\n <CustomConfirmationModal\n open={open}\n description={\n \"Are you sure you want to change the state of this Immunization ?\"\n }\n title={\"CONFIRM ACTION\"}\n handleClick={() => handleOpenStatusModal(rowData)}\n handleClose={() => setOpen(false)}\n />\n </Grid>\n );\n};\n\nexport default ImmunizationConfigurationsList;\n"],"names":["ShowFlywayQuery","configuredQuery","open","onClose","dataTestId","text","setText","useState","translate","useTranslateProvider","openConfirm","setOpenConfirm","generateQueryText","useCallback","queryList","obj","showToast","columns","values","row","col","value","finalUpdateClause","query","copyQuery","_a","askForConfirmation","download","cur","trackEvent","useTrackEvent","blob","blobSizeInKB","url","a","handleDownload","useEffect","jsxs","Fragment","jsx","CustomConfirmationModal","Dialog","DialogTitle","DialogContent","TextField","DialogActions","Button","PropTypes","ImmunizationConfigurationsList","navigate","useNavigate","t","useTranslation","immunizationData","setImmunizationData","tableData","setTableData","originalData","setOriginalData","search","setSearch","openSelectColumn","setOpenSelectColumn","openFlywayQuery","setOpenFlywayQuery","selectedRows","setSelectedRows","configuredQueryList","setConfiguredQueryList","isLoading","setIsLoading","setOpen","rowData","setRowData","rights","setRights","rightsRef","useRef","item","selected","tableFields","actions","GeneralUtil","FontAwesomeIcon","faPen","faTrash","loadInitial","getValidationMessage","validations","validationsObj","convertDaysToHumanReadable","days","years","remainingDaysAfterYears","months","remainingDays","parts","res","execute","immunizations","_b","el","assignedFeatures","getAssignedFeatures","error","handleSearch","filteredData","handleFlywayOpen","handleOpenStatusModal","formData","Box","Card","Typography","Grid","ImmunizationConfigurationsListSkeleton","curr","CustomizedTable"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAMA,IAAkB,CAAC,EAAE,iBAAAC,GAAiB,MAAAC,GAAM,SAAAC,GAAS,YAAAC,QAAiB;AAC1E,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAE,GAE7B,EAAE,WAAAC,EAAA,IAAcC,GAAA,GAEhB,CAACC,GAAaC,CAAc,IAAIJ,EAAS,EAAK,GAkB9CK,IAAoBC,GAAY,MAAM;AAO1C,QAAIC,IAAY,KAAK,MAAM,KAAK,UAAUb,CAAe,CAAC;AAQ1D,QAPAa,EAAU,QAAQ,CAACC,MAAQ;AACzB,aAAOA,EAAI,IACX,OAAOA,EAAI,YACX,OAAOA,EAAI;AAAA,IACb,CAAC,GAGG,CAAC,MAAM,QAAQD,CAAS,KAAKA,EAAU,WAAW,GAAG;AACvD,MAAAE,EAAU,EAAE,SAAS,uBAAuB,MAAM,SAAS;AAC3D;AAAA,IACF;AAGA,UAAMC,IAAU,OAAO,KAAKH,EAAU,CAAC,CAAC,GAGlCI,IAASJ,EACZ,IAAI,CAACK,MAkBG,IAjBaF,EACjB,IAAI,CAACG,MAAQ;AACZ,YAAMC,IAAQF,EA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;AAAA,UAEtB,SAAA0B;AAAA,UACA,oBAAoB;AAAA,YAClB,qBAAqBpB;AAAA,YACrB,cAAAI;AAAA,YACA,iBAAAC;AAAA,UAAA;AAAA,UAEF,aAAa,EAAE,YAAY,EAAE,WAAW,KAAG;AAAA,UAC3C,WAAAG;AAAA,UACA,OAAO;AAAA,QAAA;AAAA,MAAA,EACT,CACF;AAAA,IAAA,GACF;AAAA,IACA,gBAAA9B;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAAtC;AAAA,QACA,aACE;AAAA,QAEF,OAAO;AAAA,QACP,aAAa,MAAM0G,GAAsBpC,CAAO;AAAA,QAChD,aAAa,MAAMD,EAAQ,EAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAClC,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ImmunizationConfigurationsList-DdSZicTP.js","sources":["../src/views/Immunization/ShowFlywayQuery.jsx","../src/views/Immunization/ImmunizationConfigurationsList.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport { Dialog, DialogActions, DialogContent, DialogTitle, Button, TextField } from '@mui/material';\nimport { showToast } from '@/common/toaster/toaster';\nimport CustomConfirmationModal from '@/views/custom-components/CustomConfirmationModal';\n// import moment from 'moment/moment';\nimport useTrackEvent from '@/hooks/useTrackEvent';\nimport { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';\n\n/**\n * A React functional component that displays a configured Flyway query.\n * @module ShowFlywayQuery\n * @param {Object} props - Component properties.\n * @param {Object} props.configuredQuery - The query configuration object to display.\n * @param {boolean} props.open - Boolean flag indicating if the component should be visible.\n * @param {function} props.onClose - Callback function to close the component.\n */\n\nconst ShowFlywayQuery = ({ configuredQuery, open, onClose, dataTestId }) => {\n const [text, setText] = useState('');\n // const [isPublicKeyword, setIsPublicKeyword] = useState(false);\n const { translate } = useTranslateProvider();\n\n const [openConfirm, setOpenConfirm] = useState(false);\n\n /**\n *\n * Generates a SQL query string based on the `configuredQuery` object.\n * @function generateQueryText\n * @param {Object} configuredQuery - The query configuration object used to generate the SQL query.\n * @param {string} configuredQuery.code - The unique code for the query.\n * @param {string} configuredQuery.uuid - The unique identifier for the query.\n * @param {number} configuredQuery.createdBy - The ID of the user who created the query.\n * @param {string} [configuredQuery.params] - The parameters for the query.\n * @param {string} configuredQuery.query - The actual SQL query text.\n * @param {string} [configuredQuery.description] - A description of the query.\n * @param {boolean} [configuredQuery.returnsResultSet] - Flag indicating if the query returns a result set.\n * @param {string} [configuredQuery.state] - The state of the query (e.g., 'ACTIVE').\n * @returns {void}\n */\n\n const generateQueryText = useCallback(() => {\n // Ensure configuredQuery is a non-empty array\n // if (!Array.isArray(configuredQuery) || configuredQuery.length === 0) {\n // throw new Error('configuredQuery should be a non-empty array of objects.');\n // }\n\n // Remove 'id', 'created_at', and 'updated_at' properties from each object\n let queryList = JSON.parse(JSON.stringify(configuredQuery));\n queryList.forEach((obj) => {\n delete obj.id;\n delete obj.created_at;\n delete obj.updated_at;\n });\n\n // Extract column names from the first object\n if (!Array.isArray(queryList) || queryList.length === 0) {\n showToast({ message: 'No data to generate', type: 'error' });\n return;\n }\n\n // Extract column names from the first object\n const columns = Object.keys(queryList[0]);\n\n // Map over queryList to create a string of values for each object\n const values = queryList\n .map((row) => {\n const valueString = columns\n .map((col) => {\n const value = row[col];\n if (typeof value === 'string') {\n // Escape single quotes in strings and enclose in single quotes\n return `'${value.replace(/'/g, \"''\")}'`;\n } else if (value === null || value === undefined) {\n // Handle null or undefined values\n return 'NULL';\n } else if (typeof value === 'boolean') {\n // Convert boolean to PostgreSQL boolean literals\n return value ? 'TRUE' : 'FALSE';\n }\n // For numbers and other types, return as is\n return value;\n })\n .join(', ');\n return `(${valueString})`;\n })\n .join(',\\n');\n\n // Construct the ON CONFLICT clause to update all columns except the primary key\n const updateClause = columns\n .filter((col) => col !== 'code') // Assuming 'code' is the primary key\n .map((col) => `${col} = EXCLUDED.${col}`)\n .join(', ');\n const finalUpdateClause = `${updateClause}, updated_at = CURRENT_TIMESTAMP`;\n\n // Construct the final INSERT statement with ON CONFLICT DO UPDATE\n\n // Construct the final INSERT statement with ON CONFLICT DO UPDATE\n const query = `INSERT INTO rch_immunization_configuration (${columns.join(', ')}) \\nVALUES\\n${values}\\nON CONFLICT (code) DO UPDATE SET\\n${finalUpdateClause};\n `;\n\n // return query;\n setText(query);\n\n // const publicKeyword = configuredQuery?.configJson?.includes('public');\n // setIsPublicKeyword(publicKeyword);\n // // Delete existing event configuration\n // let queryText = `DELETE FROM EVENT_CONFIGURATION WHERE uuid = '${configuredQuery.uuid}';\\n\\n`;\n\n // // Insert new event configuration\n // queryText += `INSERT INTO EVENT_CONFIGURATION (created_by, created_on, modified_by, modified_on, day, description, event_type, event_type_detail_id, form_type_id, hour, minute, name, config_json, state, trigger_when, event_type_detail_code, uuid)\\nVALUES (\\n`;\n // queryText += `${configuredQuery.createdBy}, current_date, ${configuredQuery.createdBy}, current_date, `;\n\n // queryText +=\n // configuredQuery.day !== undefined && configuredQuery.day !== null ? `${configuredQuery.day}, ` : 'null, ';\n // queryText += configuredQuery.description ? `'${configuredQuery.description.replace(/'/g, \"''\")}', ` : 'null, ';\n // queryText += `'${configuredQuery.eventType}', `;\n // queryText +=\n // configuredQuery.eventTypeDetailId !== undefined && configuredQuery.eventTypeDetailId !== null\n // ? `${configuredQuery.eventTypeDetailId}, `\n // : 'null, ';\n // queryText +=\n // configuredQuery.formTypeId !== undefined && configuredQuery.formTypeId !== null\n // ? `${configuredQuery.formTypeId}, `\n // : 'null, ';\n // queryText +=\n // configuredQuery.hour !== undefined && configuredQuery.hour !== null ? `${configuredQuery.hour}, ` : 'null, ';\n // queryText +=\n // configuredQuery.minute !== undefined && configuredQuery.minute !== null\n // ? `${configuredQuery.minute}, `\n // : 'null, ';\n // queryText += `'${configuredQuery.name.replace(/'/g, \"''\")}', `;\n // queryText += `'${configuredQuery.configJson.replace(/'/g, \"''\")}', `;\n // queryText += `'${configuredQuery.state}', `;\n // queryText +=\n // configuredQuery.trigerWhen !== undefined && configuredQuery.trigerWhen !== null\n // ? `'${configuredQuery.trigerWhen}', `\n // : 'null, ';\n // queryText +=\n // configuredQuery.eventTypeDetailCode !== undefined && configuredQuery.eventTypeDetailCode !== null\n // ? `${configuredQuery.eventTypeDetailCode}, `\n // : 'null, ';\n // queryText += `'${configuredQuery.uuid}');\\n`;\n\n // if (configuredQuery.eventType === 'TIMMER_BASED' && configuredQuery.state !== 'INACTIVE') {\n // let nextDate = moment();\n // switch (configuredQuery.trigerWhen) {\n // case 'MONTHLY':\n // nextDate.add(1, 'months').set({\n // date: configuredQuery.day,\n // hour: configuredQuery.hour || 0,\n // minute: configuredQuery.minute || 0,\n // second: 0,\n // });\n // break;\n // case 'DAILY':\n // nextDate\n // .add(getNextDate(configuredQuery), 'days')\n // .set({ hour: configuredQuery.hour || 0, minute: configuredQuery.minute || 0, second: 0 });\n // break;\n // case 'HOURLY':\n // nextDate.add(1, 'hours').set({ minute: getNextDate(configuredQuery), second: 0 });\n // break;\n // case 'MINUTE':\n // nextDate.add(configuredQuery.minute, 'minutes').set({ second: 0 });\n // break;\n // default:\n // }\n\n // queryText += `\\nDELETE FROM TIMER_EVENT WHERE event_config_uuid = '${configuredQuery.uuid}' AND status = 'NEW';\\n\\n`;\n // queryText += `INSERT INTO timer_event (event_config_uuid, processed, status, type, system_trigger_on)\\nVALUES (\\n`;\n // queryText += `'${configuredQuery.uuid}', false, 'NEW', 'TIMER_EVENT', '${nextDate.format('MM-DD-yyyy HH:mm:ss')}');\\n`;\n // }\n\n // // Handle notification configurations\n // if (configuredQuery.configJson !== null) {\n // const notificationConfigs = JSON.parse(configuredQuery.configJson);\n // let firstDelete = true;\n\n // notificationConfigs.forEach((config) => {\n // if (config.conditions !== null && config.conditions.length > 0) {\n // config.conditions.forEach((condition) => {\n // if (condition.notificaitonConfigsType !== null && condition.notificaitonConfigsType.length > 0) {\n // if (firstDelete) {\n // queryText += `\\nDELETE FROM EVENT_CONFIGURATION_TYPE WHERE event_config_uuid = '${configuredQuery.uuid}';\\n`;\n // firstDelete = false;\n // }\n // condition.notificaitonConfigsType.forEach((configType) => {\n // queryText += `\\nINSERT INTO EVENT_CONFIGURATION_TYPE (id, base_date_field_name, event_config_uuid, day, email_subject, email_subject_parameter, hour, minute, mobile_notification_type, template, template_parameter, triger_when, type, user_field_name, family_field_name, member_field_name, query_master_id, query_master_param_json, query_code, sms_config_json, push_notification_config_json)\\nVALUES (\\n`;\n // queryText += `'${configType.id}', `;\n // queryText += configType.baseDateFieldName ? `'${configType.baseDateFieldName}', ` : 'null, ';\n // queryText += `'${configuredQuery.uuid}', `;\n // queryText += configType.day !== undefined && configType.day !== null ? `${configType.day}, ` : 'null, ';\n // queryText += configType.emailSubject ? `'${configType.emailSubject.replace(/'/g, \"''\")}', ` : 'null, ';\n // queryText += configType.emailSubjectParameter ? `'${configType.emailSubjectParameter}', ` : 'null, ';\n // queryText +=\n // configType.hour !== undefined && configType.hour !== null ? `${configType.hour}, ` : 'null, ';\n // queryText +=\n // configType.miniute !== undefined && configType.miniute !== null\n // ? `${configType.miniute}, `\n // : 'null, ';\n // queryText +=\n // configType.mobileNotificationType !== undefined && configType.mobileNotificationType !== null\n // ? `${configType.mobileNotificationType}, `\n // : 'null, ';\n // queryText += configType.template ? `'${configType.template.replace(/'/g, \"''\")}', ` : 'null, ';\n // queryText += configType.templateParameter\n // ? `'${configType.templateParameter.replace(/'/g, \"''\")}', `\n // : 'null, ';\n // queryText += configType.trigerWhen ? `'${configType.trigerWhen}', ` : 'null, ';\n // queryText += configType.type ? `'${configType.type}', ` : 'null, ';\n // queryText += configType.userFieldName ? `'${configType.userFieldName}', ` : 'null, ';\n // queryText += configType.familyFieldName ? `'${configType.familyFieldName}', ` : 'null, ';\n // queryText += configType.memberFieldName ? `'${configType.memberFieldName}', ` : 'null, ';\n // queryText +=\n // configType.queryMasterId !== undefined && configType.queryMasterId !== null\n // ? `${configType.queryMasterId}, `\n // : 'null, ';\n // queryText +=\n // configType.queryMasterParamJson !== undefined && configType.queryMasterParamJson !== null\n // ? `'${JSON.stringify(configType.queryMasterParamJson).replace(/'/g, \"''\")}', `\n // : 'null, ';\n // queryText += configType.queryCode ? `'${configType.queryCode}', ` : 'null, ';\n // queryText +=\n // configType.smsConfigJson !== undefined && configType.smsConfigJson !== null\n // ? `'${JSON.stringify(configType.smsConfigJson).replace(/'/g, \"''\")}', `\n // : 'null, ';\n // queryText +=\n // configType.pushNotificationConfigJson !== undefined && configType.pushNotificationConfigJson !== null\n // ? `'${JSON.stringify(configType.pushNotificationConfigJson).replace(/'/g, \"''\")}'`\n // : 'null';\n // queryText += ');\\n';\n\n // // Handle mobile notification configs\n // if (configType.mobileNotificationConfigs && configType.mobileNotificationConfigs.length > 0) {\n // queryText += `\\nDELETE FROM EVENT_MOBILE_CONFIGURATION WHERE notification_type_config_id = '${configType.id}';\\n`;\n // configType.mobileNotificationConfigs.forEach((mobileConfig) => {\n // queryText += `\\nINSERT INTO EVENT_MOBILE_CONFIGURATION (id, notification_code, notification_type_config_id, number_of_days_added_for_due_date, number_of_days_added_for_expiry_date, number_of_days_added_for_on_date)\\nVALUES (\\n`;\n // queryText += `'${mobileConfig.id}', '${mobileConfig.notificationCode}', '${mobileConfig.notificationTypeConfigId}', ${mobileConfig.numberOfDaysAddedForDueDate}, ${mobileConfig.numberOfDaysAddedForExpiryDate}, ${mobileConfig.numberOfDaysAddedForOnDate});\\n`;\n // });\n // }\n // });\n // }\n // });\n // }\n // });\n // }\n\n // // Insert sync system configuration master\n // let eventConfigObj = {\n // id: configuredQuery.id,\n // name: configuredQuery.name,\n // description: configuredQuery.description,\n // eventType: configuredQuery.eventType,\n // eventTypeDetailId: configuredQuery.eventTypeDetailId,\n // formTypeId: configuredQuery.formTypeId,\n // eventTypeDetailCode: configuredQuery.eventTypeDetailCode,\n // trigerWhen: configuredQuery.trigerWhen,\n // day: configuredQuery.day,\n // hour: configuredQuery.hour,\n // minute: configuredQuery.minute,\n // state: configuredQuery.state,\n // createdBy: configuredQuery.createdBy,\n // createdOn: moment().valueOf(),\n // notificationConfigDetails: JSON.parse(configuredQuery.configJson),\n // status: null,\n // completionTime: null,\n // configJson: null,\n // uuid: configuredQuery.uuid,\n // };\n\n // queryText += `\\nINSERT INTO SYNC_SYSTEM_CONFIGURATION_MASTER (feature_type, config_json, created_on, created_by, feature_uuid, feature_name)\\nVALUES (\\n`;\n // queryText += `'EVENT_BUILDER', '${JSON.stringify(eventConfigObj).replace(/'/g, \"''\")}', current_date, ${configuredQuery.createdBy}, '${configuredQuery.uuid}', '${configuredQuery.name}');\\n`;\n // setText(queryText);\n }, [configuredQuery]);\n\n /**\n *\n * Copies the generated query text to the clipboard and displays a success message.\n * @function copyQuery\n * @returns {void}\n */\n\n // const getNextDate = function (eventObj) {\n // const now = new Date();\n // const eventDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), eventObj.hour, eventObj.minute);\n\n // if (eventDate > now) {\n // return 0;\n // } else {\n // return 1;\n // }\n // };\n\n const copyQuery = () => {\n navigator?.clipboard?.writeText(text).then(() => {\n showToast({ message: 'Query Copied', type: 'success' });\n onClose();\n });\n };\n\n /**\n * Triggers a download operation and toggles the confirmation dialog visibility.\n * The function assumes that `download` and `setOpenConfirm` are available in the current scope.\n * @function askForConfirmation\n * @returns {void}\n */\n\n const askForConfirmation = () => {\n download();\n setOpenConfirm((cur) => !cur);\n };\n\n const trackEvent = useTrackEvent();\n\n /**\n * Creates and triggers a download of a text file containing the query text.\n *\n * @function download\n * @returns {void}\n */\n\n const download = () => {\n const blob = new Blob([text], { type: 'text/plain' });\n const blobSizeInKB = (blob.size / 1024).toFixed(2);\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `V${new Date().getTime()}__CHANGE_IN_IMMUNIZATION_TABLE}.sql`;\n document.body.appendChild(a);\n a.click();\n\n trackEvent('file_download', {\n file_type: 'sql',\n file_name: a.download,\n file_size: `${blobSizeInKB} KB`,\n download_status: 'success',\n });\n\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n\n showToast({ message: 'Query Downloaded SuccessFully', type: 'success' });\n\n onClose();\n };\n\n /**\n *\n * Handles the download process based on the presence of a public keyword in the query text.\n * @function handleDownload\n * @returns {void}\n */\n\n const handleDownload = () => {\n download();\n // if (isPublicKeyword) {\n // setOpenConfirm((cur) => !cur);\n // } else {\n // download();\n // }\n };\n\n /**\n * `useEffect` Hook to Generate Query Text\n *\n * This effect hook is used to generate the SQL query text whenever the `configuredQuery` dependency changes.\n *\n * @function useEffect\n * @param {Object} configuredQuery - The query configuration object used to generate the SQL query text.\n * @param {function} generateQueryText - A function that generates the query text based on `configuredQuery`.\n */\n\n useEffect(() => {\n if (configuredQuery) {\n generateQueryText();\n }\n }, [configuredQuery]);\n return (\n <>\n <CustomConfirmationModal\n description={\"This Flyway contains keyword 'public'. Are you sure you want to download?\"}\n title={'CONFIRM ACTION'}\n handleClick={askForConfirmation}\n open={openConfirm}\n handleClose={() => setOpenConfirm((cur) => !cur)}\n dataTestId=\"showflywayquery-customconfirmationmodal-confirmation-modal\"\n />\n <Dialog open={open} onClose={onClose} fullWidth maxWidth=\"md\" data-testid={dataTestId}>\n <DialogTitle className=\"p-2.5 px-5 flex border-b font-medium text-lg\">{translate('Flyway Query')}</DialogTitle>\n <DialogContent>\n <TextField\n multiline\n rows={10}\n variant=\"outlined\"\n fullWidth\n value={text}\n sx={{\n '& .MuiInputBase-input': {\n fontSize: '14px',\n },\n '& .MuiOutlinedInput-root': {\n borderRadius: '5px',\n },\n }}\n slotProps={{\n input: {\n readOnly: true,\n },\n }}\n data-testid=\"showflywayquery-textfield-query-display\"\n />\n </DialogContent>\n <DialogActions>\n <Button\n onClick={handleDownload}\n variant=\"contained\"\n size=\"small\"\n color=\"primary\"\n data-testid=\"showflywayquery-button-download-action\"\n >\n {translate('Download')}\n </Button>\n <Button\n onClick={copyQuery}\n variant=\"contained\"\n size=\"small\"\n color=\"primary\"\n data-testid=\"showflywayquery-button-copyquery-action\"\n >\n {translate('Copy Query')}\n </Button>\n <Button\n onClick={onClose}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n data-testid=\"showflywayquery-button-cancel-action\"\n >\n {translate('Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n </>\n );\n};\n\nShowFlywayQuery.propTypes = {\n configuredQuery: PropTypes.any,\n open: PropTypes.any,\n onClose: PropTypes.any,\n dataTestId: PropTypes.any,\n};\n\nexport default ShowFlywayQuery;\n","import React, { useEffect, useState, useRef } from \"react\";\nimport { Button, TextField, Box, Card, Typography } from \"@mui/material\";\nimport { showToast } from \"@/common/toaster/toaster\";\nimport { execute } from \"@/common/services/GlobalApis\";\nimport Grid from \"@mui/material/Grid2\";\nimport { useTranslation } from \"react-i18next\";\nimport { useNavigate } from \"react-router\";\nimport { ImmunizationConfigurationsListSkeleton } from \"./Skeletons/ImmunizationSkeleton\";\nimport ShowFlywayQuery from \"./ShowFlywayQuery.jsx\";\nimport CustomConfirmationModal from \"@/views/custom-components/CustomConfirmationModal\";\nimport CustomizedTable from \"@/views/custom-components/CustomizedTable/CustomizedTableV2\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { faPen, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { getAssignedFeatures } from \"@/utils/feature\";\nimport GeneralUtil from \"@/common/services/util/GeneralUtil.js\";\n\nconst ImmunizationConfigurationsList = () => {\n const navigate = useNavigate();\n const { t } = useTranslation();\n const [immunizationData, setImmunizationData] = useState([]);\n const [tableData, setTableData] = useState([]);\n const [originalData, setOriginalData] = useState([]);\n const [search, setSearch] = useState(\"\");\n const [openSelectColumn, setOpenSelectColumn] = useState(false);\n const [openFlywayQuery, setOpenFlywayQuery] = useState(false);\n const [selectedRows, setSelectedRows] = useState([]);\n const [configuredQueryList, setConfiguredQueryList] = useState([]);\n const [isLoading, setIsLoading] = useState(false);\n const [open, setOpen] = useState(false);\n const [rowData, setRowData] = useState({});\n const [rights, setRights] = useState(null);\n const rightsRef = useRef(rights);\n\n useEffect(() => {\n rightsRef.current = rights;\n }, [rights]);\n\n\n useEffect(() => {\n setConfiguredQueryList(() => {\n const filteredImmunization = immunizationData.filter((item) =>\n selectedRows.some((selected) => selected.id === item.id)\n );\n return filteredImmunization;\n });\n }, [selectedRows]);\n\n const tableFields = [\n { field: \"Sr. No.\", label: \"#\", align: \"left\" },\n // { field: 'code', label: 'Code', align: 'left', isBold: true },\n { field: \"name\", label: \"Name\", align: \"left\" },\n { field: \"fromAgeDays\", label: \"Eligible From\" },\n { field: \"toAgeDays\", label: \"Eligible To\" },\n { field: \"base_date\", label: \"Base Date\" },\n { field: \"Actions\", label: \"Actions\" },\n ];\n\n const actions = [\n GeneralUtil.hasCheckRights(rights?.['update.manage.manageImmunization']) &&\n {\n label: \"Fill Form\",\n icon: <FontAwesomeIcon icon={faPen} />,\n onClick: (row) => {\n navigate(`/ui/medplat/manage/manageImmunization/${row?.id}`);\n },\n },\n GeneralUtil.hasCheckRights(rights?.['update.manage.manageImmunization']) &&\n {\n label: \"\",\n icon: <FontAwesomeIcon icon={faTrash} />,\n onClick: (row) => {\n setOpen(true);\n setRowData(row);\n },\n },\n ];\n\n useEffect(() => {\n loadInitial();\n }, []);\n\n const getValidationMessage = (validations) => {\n const validationsObj = JSON.parse(validations);\n return validationsObj.dependencies && validationsObj.dependencies.length > 0\n ? validationsObj.dependencies[0].message\n : \"NA\";\n };\n\n const convertDaysToHumanReadable = (days) => {\n if (typeof days !== \"number\" || days <= 0) return \"-\";\n\n const years = Math.floor(days / 365);\n const remainingDaysAfterYears = days % 365;\n const months = Math.floor(remainingDaysAfterYears / 30);\n const remainingDays = remainingDaysAfterYears % 30;\n\n const parts = [];\n if (years > 0) {\n parts.push(`${years} ${years === 1 ? \"year\" : \"years\"}`);\n }\n if (months > 0) {\n parts.push(`${months} ${months === 1 ? \"month\" : \"months\"}`);\n }\n if (remainingDays > 0 || (years === 0 && months === 0)) {\n parts.push(`${remainingDays} ${remainingDays === 1 ? \"day\" : \"days\"}`);\n }\n\n return parts.join(\" \") || \"0 days\";\n };\n\n const loadInitial = async () => {\n try {\n setIsLoading((cur) => !cur);\n const res = await execute({\n code: \"get_immunization_detail\",\n parameters: {},\n });\n setImmunizationData(res?.data?.result);\n const immunizations = res?.data?.result\n .filter((el) => el.is_active === true)\n .map((el) => {\n return {\n ...el,\n fromAgeDays: convertDaysToHumanReadable(el.from_age_days),\n toAgeDays: convertDaysToHumanReadable(el.to_age_days),\n validationMessage: el.validations\n ? getValidationMessage(el.validations)\n : \"NA\",\n };\n });\n const { data: assignedFeatures } = await getAssignedFeatures(\n \"techo.manage.immunizationConfiguratorList\"\n );\n setRights(JSON.parse(assignedFeatures));\n setTableData(immunizations);\n setOriginalData(immunizations);\n setIsLoading((cur) => !cur);\n } catch (error) {\n console.error(error);\n showToast({ message: \"Error in loading immunization\", type: \"error\" });\n setIsLoading((cur) => !cur);\n }\n };\n\n const handleSearch = (e) => {\n setSearch(e.target.value);\n };\n\n useEffect(() => {\n if (!search) {\n setTableData(originalData); // Reset to original data if search is empty\n return;\n }\n\n const filteredData = originalData.filter(\n (item) =>\n item.code.toLowerCase().includes(search.toLowerCase()) ||\n item.name.toLowerCase().includes(search.toLowerCase())\n );\n\n setTableData(filteredData);\n }, [search, originalData]);\n\n const handleFlywayOpen = () => {\n if (configuredQueryList?.length > 0) {\n setOpenFlywayQuery(true);\n } else {\n showToast({ message: \"Select atleast one row\", type: \"info\" });\n }\n };\n\n const handleOpenStatusModal = async (row) => {\n try {\n let formData = {\n id: parseInt(row.id),\n code: row.code,\n name: row.name,\n isrecursive: row.is_recursive || false,\n fromAgeDays: row.from_age_days,\n toAgeDays: row.to_age_days,\n basedate: row.base_date,\n validations: row.validations,\n recursiveobject: row.recursive_object,\n locations: row.locations || \"[]\",\n active: false,\n };\n setOpen(false);\n await execute({\n code: \"update_immunization\",\n parameters: { ...formData },\n });\n loadInitial();\n showToast({\n message: \"Immunization status changed Successfully!\",\n type: \"success\",\n });\n } catch (error) {\n console.error(error);\n showToast({ type: \"error\", message: \"error toggling status\" });\n }\n };\n\n return !isLoading && rights !== null && !GeneralUtil.hasCheckRights(rights?.[\"view.manage.manageImmunization\"]) ? (\n <Box className=\"flex justify-center items-center w-full h-[80vh]\">\n <Card\n className=\"h-80 w-150 flex justify-center items-center\"\n >\n <Typography variant=\"h5\" className=\"text-customBlue\">\n You dont have permission to view Manage Immunization\n </Typography>\n </Card>\n </Box>\n ) : (\n <Grid container justifyContent=\"flex-end\" className=\"mt-5 mr-5\">\n {openFlywayQuery && (\n <ShowFlywayQuery\n configuredQuery={configuredQueryList}\n open={openFlywayQuery}\n onClose={() => {\n setOpenFlywayQuery((cur) => !cur);\n }}\n dataTestId=\"eventconfiguration-query-showflywayquery\"\n />\n )}\n <ImmunizationConfigurationsListSkeleton isLoading={isLoading}>\n <Grid item>\n <TextField\n className=\"bg-white p-0 m-0\"\n placeholder=\"Search code\"\n sx={{\n \"& .MuiInputBase-root\": { height: \"35px\" }, // Controls the overall input height\n \"& .MuiInputBase-input\": { padding: \"6px 12px\" }, // Adjust text padding inside input\n }}\n value={search}\n onChange={handleSearch}\n />\n {GeneralUtil.hasCheckRights(rights?.['view.manage.manageImmunization.flywayQuery'], rights?.canGenerateFlyway) && (\n <Button\n className=\"mb-4 ml-4\"\n variant=\"contained\"\n onClick={() => {\n setOpenSelectColumn((curr) => !curr);\n }}\n size=\"small\"\n data-testid=\"immunizationList-button-add\"\n >\n {!openSelectColumn\n ? t(\"Select Immunization\")\n : t(\"Hide Selection\")}\n </Button>\n )}\n {openSelectColumn && !openFlywayQuery && (\n <Button\n className=\"mb-4 ml-4\"\n variant=\"contained\"\n onClick={() => {\n handleFlywayOpen();\n }}\n size=\"small\"\n data-testid=\"immunizationList-button-add\"\n >\n {t(\"Show Flyway\")}\n </Button>\n )}\n {/* <Button\n className=\"mb-4 ml-4\"\n variant=\"contained\"\n onClick={() => {\n navigate(\"/ui/medplat/manage/manageImmunization\");\n }}\n size=\"small\"\n data-testid=\"immunizationList-button-add\"\n >\n {t(\"Add Immunization\")}\n </Button> */}\n </Grid>\n <Grid size={{ xs: 12 }}>\n <CustomizedTable\n dataTestId=\"Immunization-configurator-customizedtable\"\n columns={tableFields}\n tableData={tableData}\n paginationConfig={{\n pagination: true,\n rowsPerPageInTable: 20,\n }}\n actions={actions}\n rowSelectionConfig={{\n rowSelectionEnabled: openSelectColumn,\n selectedRows,\n setSelectedRows,\n }}\n styleConfig={{ tableStyle: { maxHeight: 45 } }}\n isLoading={isLoading}\n strip={true}\n />\n </Grid>\n </ImmunizationConfigurationsListSkeleton>\n <CustomConfirmationModal\n open={open}\n description={\n \"Are you sure you want to change the state of this Immunization ?\"\n }\n title={\"CONFIRM ACTION\"}\n handleClick={() => handleOpenStatusModal(rowData)}\n handleClose={() => setOpen(false)}\n />\n </Grid>\n );\n};\n\nexport default ImmunizationConfigurationsList;\n"],"names":["ShowFlywayQuery","configuredQuery","open","onClose","dataTestId","text","setText","useState","translate","useTranslateProvider","openConfirm","setOpenConfirm","generateQueryText","useCallback","queryList","obj","showToast","columns","values","row","col","value","finalUpdateClause","query","copyQuery","_a","askForConfirmation","download","cur","trackEvent","useTrackEvent","blob","blobSizeInKB","url","a","handleDownload","useEffect","jsxs","Fragment","jsx","CustomConfirmationModal","Dialog","DialogTitle","DialogContent","TextField","DialogActions","Button","PropTypes","ImmunizationConfigurationsList","navigate","useNavigate","t","useTranslation","immunizationData","setImmunizationData","tableData","setTableData","originalData","setOriginalData","search","setSearch","openSelectColumn","setOpenSelectColumn","openFlywayQuery","setOpenFlywayQuery","selectedRows","setSelectedRows","configuredQueryList","setConfiguredQueryList","isLoading","setIsLoading","setOpen","rowData","setRowData","rights","setRights","rightsRef","useRef","item","selected","tableFields","actions","GeneralUtil","FontAwesomeIcon","faPen","faTrash","loadInitial","getValidationMessage","validations","validationsObj","convertDaysToHumanReadable","days","years","remainingDaysAfterYears","months","remainingDays","parts","res","execute","immunizations","_b","el","assignedFeatures","getAssignedFeatures","error","handleSearch","filteredData","handleFlywayOpen","handleOpenStatusModal","formData","Box","Card","Typography","Grid","ImmunizationConfigurationsListSkeleton","curr","CustomizedTable"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAMA,IAAkB,CAAC,EAAE,iBAAAC,GAAiB,MAAAC,GAAM,SAAAC,GAAS,YAAAC,QAAiB;AAC1E,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAE,GAE7B,EAAE,WAAAC,EAAA,IAAcC,GAAA,GAEhB,CAACC,GAAaC,CAAc,IAAIJ,EAAS,EAAK,GAkB9CK,IAAoBC,GAAY,MAAM;AAO1C,QAAIC,IAAY,KAAK,MAAM,KAAK,UAAUb,CAAe,CAAC;AAQ1D,QAPAa,EAAU,QAAQ,CAACC,MAAQ;AACzB,aAAOA,EAAI,IACX,OAAOA,EAAI,YACX,OAAOA,EAAI;AAAA,IACb,CAAC,GAGG,CAAC,MAAM,QAAQD,CAAS,KAAKA,EAAU,WAAW,GAAG;AACvD,MAAAE,EAAU,EAAE,SAAS,uBAAuB,MAAM,SAAS;AAC3D;AAAA,IACF;AAGA,UAAMC,IAAU,OAAO,KAAKH,EAAU,CAAC,CAAC,GAGlCI,IAASJ,EACZ,IAAI,CAACK,MAkBG,IAjBaF,EACjB,IAAI,CAACG,MAAQ;AACZ,YAAMC,IAAQF,EAAIC,CAAG;AACrB,aAAI,OAAOC,KAAU,WAEZ,IAAIA,EAAM,QAAQ,MAAM,IAAI,CAAC,MAC3BA,KAAU,OAEZ,SACE,OAAOA,KAAU,YAEnBA,IAAQ,SAAS,UAGnBA;AAAA,IACT,CAAC,EACA,KAAK,IAAI,CACU,GACvB,EACA,KAAK;AAAA,CAAK,GAOPC,IAAoB,GAJLL,EAClB,OAAO,CAACG,MAAQA,MAAQ,MAAM,EAC9B,IAAI,CAACA,MAAQ,GAAGA,CAAG,eAAeA,CAAG,EAAE,EACvC,KAAK,IAAI,CAC6B,oCAKnCG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