@argusoft/medplat-form-engine 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/AccessRights-sgIhYR30-DWNCTLI6.js +1238 -0
  2. package/dist/AccessRights-sgIhYR30-DWNCTLI6.js.map +1 -0
  3. package/dist/AddEditQueryBuilder-BaZxS2Cm-emLM3Oli.js +289 -0
  4. package/dist/AddEditQueryBuilder-BaZxS2Cm-emLM3Oli.js.map +1 -0
  5. package/dist/AddEditQueryBuilder-BaZxS2Cm.css +1 -0
  6. package/dist/AddFeatures-BxXCC6ex-1VYoA24R.js +212 -0
  7. package/dist/AddFeatures-BxXCC6ex-1VYoA24R.js.map +1 -0
  8. package/dist/AddLabelModal-DE3ploGD-DWF1SOUp.js +734 -0
  9. package/dist/AddLabelModal-DE3ploGD-DWF1SOUp.js.map +1 -0
  10. package/dist/AddMenuConfiguration-QWfpcnuP-TAM2c68S.js +5389 -0
  11. package/dist/AddMenuConfiguration-QWfpcnuP-TAM2c68S.js.map +1 -0
  12. package/dist/AddMenuConfiguration-QWfpcnuP.css +1 -0
  13. package/dist/AddRoleDrawer-ZK1eejxI-ldfhQqA_.js +453 -0
  14. package/dist/AddRoleDrawer-ZK1eejxI-ldfhQqA_.js.map +1 -0
  15. package/dist/AppModal-BgZyfrd--CNvWjWhL.js +428 -0
  16. package/dist/AppModal-BgZyfrd--CNvWjWhL.js.map +1 -0
  17. package/dist/ChangePasswordModal-MV7g8tkA-BDA1Pw0i.js +176 -0
  18. package/dist/ChangePasswordModal-MV7g8tkA-BDA1Pw0i.js.map +1 -0
  19. package/dist/ConditionConfig-GDCXIg3C-XbR1fp6h.js +395 -0
  20. package/dist/ConditionConfig-GDCXIg3C-XbR1fp6h.js.map +1 -0
  21. package/dist/ConditionConfig-GDCXIg3C.css +1 -0
  22. package/dist/EntityManagement-D-x6Qzal-BE01iKNR.js +50 -0
  23. package/dist/EntityManagement-D-x6Qzal-BE01iKNR.js.map +1 -0
  24. package/dist/EventConfigurations-jGCJ4LqP-B_ftXinp.js +384 -0
  25. package/dist/EventConfigurations-jGCJ4LqP-B_ftXinp.js.map +1 -0
  26. package/dist/EventConfigurations-jGCJ4LqP.css +1 -0
  27. package/dist/EventsExceptionModal-BF6E1Np7-DHT7pQsx.js +200 -0
  28. package/dist/EventsExceptionModal-BF6E1Np7-DHT7pQsx.js.map +1 -0
  29. package/dist/EventsSkeleton-BN7_0IGs-BAnd1Vug.js +74 -0
  30. package/dist/EventsSkeleton-BN7_0IGs-BAnd1Vug.js.map +1 -0
  31. package/dist/FeatureMenu-BYSRoNm0-D2Ak-EDd.js +249 -0
  32. package/dist/FeatureMenu-BYSRoNm0-D2Ak-EDd.js.map +1 -0
  33. package/dist/Features-CKMmuqcs-ClXAzWGV.js +11 -0
  34. package/dist/Features-CKMmuqcs-ClXAzWGV.js.map +1 -0
  35. package/dist/FlywayQuery-Cx2sly6g-B1LLSyLE.js +169 -0
  36. package/dist/FlywayQuery-Cx2sly6g-B1LLSyLE.js.map +1 -0
  37. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-CSPs9x_q.js +5162 -0
  38. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-CSPs9x_q.js.map +1 -0
  39. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.css +1 -0
  40. package/dist/ImmunizationConfigurationsList-CQnxWa09-DIujYt0W.js +335 -0
  41. package/dist/ImmunizationConfigurationsList-CQnxWa09-DIujYt0W.js.map +1 -0
  42. package/dist/ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js +186 -0
  43. package/dist/ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js.map +1 -0
  44. package/dist/LanguagesModal-rk6IGQwY-Cxw9xctN.js +394 -0
  45. package/dist/LanguagesModal-rk6IGQwY-Cxw9xctN.js.map +1 -0
  46. package/dist/ManageDynamicFeature-CeeqiS3K-D2Se68tC.js +4189 -0
  47. package/dist/ManageDynamicFeature-CeeqiS3K-D2Se68tC.js.map +1 -0
  48. package/dist/ManageEventConfiguration-BJxS2Su0-yd2dUxgz.js +1017 -0
  49. package/dist/ManageEventConfiguration-BJxS2Su0-yd2dUxgz.js.map +1 -0
  50. package/dist/ManageEventConfiguration-BJxS2Su0.css +1 -0
  51. package/dist/ManageNotification-B4prX-9Z-B4mRuGir.js +6819 -0
  52. package/dist/ManageNotification-B4prX-9Z-B4mRuGir.js.map +1 -0
  53. package/dist/ManageRole-ByqBmjuc-CApL3DJy.js +699 -0
  54. package/dist/ManageRole-ByqBmjuc-CApL3DJy.js.map +1 -0
  55. package/dist/ManageTranslation-BTxvSYKb-CwT975cy.js +616 -0
  56. package/dist/ManageTranslation-BTxvSYKb-CwT975cy.js.map +1 -0
  57. package/dist/ManageTranslation-BTxvSYKb.css +1 -0
  58. package/dist/ManageUser-PHiTNyF8-Bddmh2CC.js +2160 -0
  59. package/dist/ManageUser-PHiTNyF8-Bddmh2CC.js.map +1 -0
  60. package/dist/ManageUser-PHiTNyF8.css +1 -0
  61. package/dist/{MedplatFormWrapper-YzMB3zpp.js → MedplatFormWrapper-DbdQUpEu.js} +13624 -13168
  62. package/dist/MedplatFormWrapper-DbdQUpEu.js.map +1 -0
  63. package/dist/MobileMenuManagement-DmQU5TTo-D7n_NP0X.js +108 -0
  64. package/dist/MobileMenuManagement-DmQU5TTo-D7n_NP0X.js.map +1 -0
  65. package/dist/MobileTypeEventConfigModal-ChhO_A4f-Wd3d3SEP.js +782 -0
  66. package/dist/MobileTypeEventConfigModal-ChhO_A4f-Wd3d3SEP.js.map +1 -0
  67. package/dist/NewServerManagement-5YcAtF-g-DHV6PFTR.js +1002 -0
  68. package/dist/NewServerManagement-5YcAtF-g-DHV6PFTR.js.map +1 -0
  69. package/dist/NotificationFlywayQuery-BY8Zzml_-C7G-28dx.js +244 -0
  70. package/dist/NotificationFlywayQuery-BY8Zzml_-C7G-28dx.js.map +1 -0
  71. package/dist/NotificationList-BkpOrCpM-B-vKDGd_.js +400 -0
  72. package/dist/NotificationList-BkpOrCpM-B-vKDGd_.js.map +1 -0
  73. package/dist/OtherTypeEventConfigModal-ZnCGWm9v-tpC-SI0P.js +1952 -0
  74. package/dist/OtherTypeEventConfigModal-ZnCGWm9v-tpC-SI0P.js.map +1 -0
  75. package/dist/QueryBuilder-Cus_mRwZ-DLXSM32i.js +378 -0
  76. package/dist/QueryBuilder-Cus_mRwZ-DLXSM32i.js.map +1 -0
  77. package/dist/QueryBuilder-Cus_mRwZ.css +1 -0
  78. package/dist/QueryManagement-DXA73N2j-Wlk7hKP3.js +671 -0
  79. package/dist/QueryManagement-DXA73N2j-Wlk7hKP3.js.map +1 -0
  80. package/dist/QueryManagement-DXA73N2j.css +1 -0
  81. package/dist/RoleManagement-CLaEJ90J-BW0tG5t9.js +410 -0
  82. package/dist/RoleManagement-CLaEJ90J-BW0tG5t9.js.map +1 -0
  83. package/dist/ServerSyncModal-uNjGCQJz--PJ3F3xg.js +869 -0
  84. package/dist/ServerSyncModal-uNjGCQJz--PJ3F3xg.js.map +1 -0
  85. package/dist/ShowFlywayQuery-DMsAbtOW-TT9XXzUi.js +130 -0
  86. package/dist/ShowFlywayQuery-DMsAbtOW-TT9XXzUi.js.map +1 -0
  87. package/dist/ShowFlywayQuery-DVRCd384-BypXcNWX.js +259 -0
  88. package/dist/ShowFlywayQuery-DVRCd384-BypXcNWX.js.map +1 -0
  89. package/dist/ShowQueryHistory-BDN0tzHg-17BxK88Z.js +190 -0
  90. package/dist/ShowQueryHistory-BDN0tzHg-17BxK88Z.js.map +1 -0
  91. package/dist/SubMenu-BHcSNSUF-d-_yEXeN.js +187 -0
  92. package/dist/SubMenu-BHcSNSUF-d-_yEXeN.js.map +1 -0
  93. package/dist/TableDetails-DzREeJkm-B-WEBbQz.js +1508 -0
  94. package/dist/TableDetails-DzREeJkm-B-WEBbQz.js.map +1 -0
  95. package/dist/TableList-B9hr05Hs-BIsMbnIV.js +428 -0
  96. package/dist/TableList-B9hr05Hs-BIsMbnIV.js.map +1 -0
  97. package/dist/TypeConfiguration-C-lk8Szs-DKu6I5Im.js +116 -0
  98. package/dist/TypeConfiguration-C-lk8Szs-DKu6I5Im.js.map +1 -0
  99. package/dist/UserList-BxB1tCwM-7YIwwGQ9.js +13039 -0
  100. package/dist/UserList-BxB1tCwM-7YIwwGQ9.js.map +1 -0
  101. package/dist/UserList-BxB1tCwM.css +1 -0
  102. package/dist/UserListSkeleton-cglK2SaU-B_Tj5gUp.js +184 -0
  103. package/dist/UserListSkeleton-cglK2SaU-B_Tj5gUp.js.map +1 -0
  104. package/dist/WidgetList-BSApErov-CBYLh0Oh.js +188 -0
  105. package/dist/WidgetList-BSApErov-CBYLh0Oh.js.map +1 -0
  106. package/dist/_commonjsHelpers-BItOPCY9-B9tZyK9c.js +29 -0
  107. package/dist/_commonjsHelpers-BItOPCY9-B9tZyK9c.js.map +1 -0
  108. package/dist/i18next-CTOWN_jH-BKKbdDel.js +1389 -0
  109. package/dist/i18next-CTOWN_jH-BKKbdDel.js.map +1 -0
  110. package/dist/index-B4r0wjBD.js +563 -0
  111. package/dist/index-B4r0wjBD.js.map +1 -0
  112. package/dist/{index-CBsXn92s.js → index-CdFr9tGu.js} +107 -107
  113. package/dist/{index-CBsXn92s.js.map → index-CdFr9tGu.js.map} +1 -1
  114. package/dist/index.js +1 -1
  115. package/dist/manageImmunization-B4swS745-JldexHrO.js +1204 -0
  116. package/dist/manageImmunization-B4swS745-JldexHrO.js.map +1 -0
  117. package/dist/manageImmunization-B4swS745.css +1 -0
  118. package/package.json +1 -1
  119. package/dist/MedplatFormWrapper-YzMB3zpp.js.map +0 -1
@@ -0,0 +1,1204 @@
1
+ import { jsx as e, jsxs as r, Fragment as Ge } from "react/jsx-runtime";
2
+ import { useState as N, useEffect as ue, Suspense as We, lazy as Qe } from "react";
3
+ import { Card as Ye, CardHeader as Q, Box as w, Typography as m, CardContent as He, FormControl as pe, Select as fe, MenuItem as V, Chip as q, Button as j, Divider as Y, Tooltip as Ze, IconButton as Ke, Autocomplete as Xe, TextField as ea } from "@mui/material";
4
+ import { showToast as M } from "@/common/toaster/toaster";
5
+ import { execute as O } from "@/common/services/GlobalApis";
6
+ import u from "@mui/material/Grid2";
7
+ import { useParams as aa, useNavigate as la } from "react-router";
8
+ import { useForm as ra, useFieldArray as ve, FormProvider as ia, Controller as H, get as E } from "react-hook-form";
9
+ import na from "@/views/custom-components/CustomCheckBox";
10
+ import { yupResolver as ta } from "@hookform/resolvers/yup";
11
+ import { useTranslateProvider as sa } from "@/common/languageTranslator/TranslationContext";
12
+ import oa from "@/views/custom-components/CustomAutoComplete";
13
+ import * as v from "yup";
14
+ import _ from "@/views/custom-components/CustomTextField";
15
+ import { f as da, l as ca } from "./ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js";
16
+ import { faTrash as he, faInfoCircle as ma } from "@fortawesome/free-solid-svg-icons";
17
+ import { useSelector as ua } from "react-redux";
18
+ import { validateAOI as pa } from "@/common/services/Users";
19
+ import { FontAwesomeIcon as Z } from "@fortawesome/react-fontawesome";
20
+ import './manageImmunization-B4swS745.css';const fa = Qe(
21
+ () => import("@/views/feature-components/LocationDirective/LocationDirectiveV2")
22
+ ), $a = () => {
23
+ var K;
24
+ const { id: S } = aa(), { translate: s } = sa(), { user: X } = ua((a) => a.Authenticate), B = la(), { t: be } = da(), [R, ge] = N("days"), [ee, ye] = N([]), [F, xe] = N("days"), [L, Ne] = N("days"), [we, _e] = N("Add Immunization"), [Ce, ke] = N([]), ze = s("Requirement"), qe = s("Min Gap (In Days)"), Ie = s("Max Gap (In Days)"), De = s("Message"), [Se, Re] = N([]), Ae = s("Select Vaccines"), [A, ae] = N({});
25
+ let $e = 10;
26
+ const [I, P] = N([]), [le, U] = N(!1), [re, Oe] = N([]), C = (a, l) => {
27
+ const n = je();
28
+ if (l === "fromDate") {
29
+ const o = n == null ? void 0 : n.fromDate, d = JSON.parse(JSON.stringify(R)), p = k(o, d, a);
30
+ g("fromDate", parseFloat(p.toFixed(1))), ge(a);
31
+ }
32
+ if (l === "toDate") {
33
+ const o = n == null ? void 0 : n.toDate, d = JSON.parse(JSON.stringify(F)), p = k(o, d, a);
34
+ g("toDate", parseFloat(p.toFixed(2))), xe(a);
35
+ }
36
+ if (l === "gapRange") {
37
+ const o = n == null ? void 0 : n.gapRange, d = JSON.parse(JSON.stringify(L)), p = k(o, d, a);
38
+ g("gapRange", parseFloat(p.toFixed(2))), Ne(a);
39
+ }
40
+ }, k = (a, l, n) => {
41
+ if (!a)
42
+ return 0;
43
+ let o;
44
+ switch (l) {
45
+ case "months":
46
+ o = a * 30;
47
+ break;
48
+ case "years":
49
+ o = a * 365;
50
+ break;
51
+ default:
52
+ o = Math.round(a);
53
+ }
54
+ let d;
55
+ switch (n) {
56
+ case "months":
57
+ d = o / 30;
58
+ break;
59
+ case "years":
60
+ d = o / 365;
61
+ break;
62
+ default:
63
+ d = Math.round(o);
64
+ }
65
+ return d;
66
+ }, Fe = async (a) => {
67
+ var l, n, o;
68
+ try {
69
+ const d = {
70
+ dependencies: ((l = a == null ? void 0 : a.dependencies) == null ? void 0 : l.map(
71
+ ({ min_gap_days: y, max_gap_days: z, required: b, vaccine: i, ...$ }) => ({
72
+ ...$,
73
+ vaccine: i.map((D) => D.code),
74
+ ...b !== "false" && { min_gap_days: y, max_gap_days: z },
75
+ required: b
76
+ })
77
+ )) || []
78
+ }, p = (a.filters || []).map((y) => ({
79
+ filterName: y.filterName,
80
+ queryCode: y.queryCode
81
+ })), c = {
82
+ ...(a == null ? void 0 : a.isRecursive) && {
83
+ gapRange: a == null ? void 0 : a.gapRange,
84
+ maxDoses: a.maxDoses
85
+ }
86
+ }, t = {
87
+ code: a == null ? void 0 : a.code,
88
+ name: a == null ? void 0 : a.name,
89
+ isrecursive: a == null ? void 0 : a.isRecursive,
90
+ fromAgeDays: parseInt(
91
+ k(a == null ? void 0 : a.fromDate, R, "days")
92
+ ),
93
+ toAgeDays: parseInt(k(a == null ? void 0 : a.toDate, F, "days")),
94
+ validations: JSON.stringify(d),
95
+ filters: JSON.stringify(p),
96
+ basedate: a == null ? void 0 : a.basedate,
97
+ recursiveobject: JSON.stringify(c),
98
+ locations: I ? JSON.stringify(I) : null,
99
+ active: !0
100
+ };
101
+ S ? (await O({
102
+ code: "update_immunization",
103
+ parameters: { ...t, id: parseInt(S) }
104
+ }), M({
105
+ message: "Immunization Updated Successfully!",
106
+ type: "success"
107
+ }), B(-1)) : ((o = (n = (await O({
108
+ code: "check_existing_code",
109
+ parameters: { code: a == null ? void 0 : a.code }
110
+ })).data) == null ? void 0 : n.result) == null ? void 0 : o.length) > 0 ? M({ message: "Code Already Exist", type: "error" }) : (await O({ code: "add_immunization", parameters: t }), M({
111
+ message: "Immunization Added Successfully",
112
+ type: "success"
113
+ }), B(-1));
114
+ } catch (d) {
115
+ console.error(d), M({ message: "Error in adding Immunization", type: "error" });
116
+ }
117
+ }, Le = v.object().shape({
118
+ code: v.string().required("Code is required"),
119
+ // Code is required
120
+ name: v.string().required("Name is required"),
121
+ // Name is required
122
+ basedate: v.string().required("Base date (name) is required"),
123
+ // Basedate is required
124
+ fromDate: v.number().transform(
125
+ (a, l) => l === "" ? void 0 : a
126
+ ).nullable().min(0, "From date must be 0 or a positive number"),
127
+ toDate: v.number().transform(
128
+ (a, l) => l === "" ? void 0 : a
129
+ ).nullable().min(0, "To date must be 0 or a positive number").when("fromDate", (a, l) => l.test(
130
+ "check-to-date",
131
+ "To date must be greater than From date",
132
+ (n) => n === 0 ? !0 : !(k(a, R, "days") !== void 0 && a > 0 && k(n, F, "days") <= k(a, R, "days"))
133
+ )),
134
+ gapRange: v.number().transform(
135
+ (a, l) => l === "" ? void 0 : a
136
+ ).nullable().min(0, "Must be 0 or a positive number").test(
137
+ "is-less-than-6-months",
138
+ "Gap range must be less than 6 months",
139
+ function(a) {
140
+ return a == null ? !0 : k(a, L, "days") < 182;
141
+ }
142
+ ),
143
+ maxDoses: v.number().transform(
144
+ (a, l) => l === "" ? void 0 : a
145
+ ).nullable().min(0, "Must be 0 or a positive number"),
146
+ dependencies: v.array().of(
147
+ v.object().shape({
148
+ vaccine: v.array().min(1, "At least one vaccine is required").required("Vaccine is required"),
149
+ required: v.string().required("Please Select a vaccine"),
150
+ min_gap_days: v.number().min(0, "No negative number").transform(
151
+ (a, l) => l === "" ? void 0 : a
152
+ ).nullable(),
153
+ max_gap_days: v.number().min(0, "No negative number").transform(
154
+ (a, l) => l === "" ? void 0 : a
155
+ ).nullable().when("min_gap_days", (a, l) => l.test(
156
+ "check-to-date",
157
+ "Max days must be greater",
158
+ (n) => n === 0 ? !0 : !(a > 0 && n <= a)
159
+ )),
160
+ message: v.string().nullable()
161
+ })
162
+ ),
163
+ filters: v.array().of(
164
+ v.object().shape({
165
+ filterName: v.string().required("Filter name is required"),
166
+ queryCode: v.string().required("Please select a query")
167
+ })
168
+ )
169
+ }), ie = ra({
170
+ defaultValues: {
171
+ code: "",
172
+ name: "",
173
+ basedate: "",
174
+ fromDate: 0,
175
+ toDate: 0,
176
+ isRecursive: !1,
177
+ gapRange: 0,
178
+ maxDoses: 0,
179
+ dependencies: [],
180
+ filters: []
181
+ },
182
+ resolver: ta(Le),
183
+ mode: "onChange"
184
+ }), {
185
+ control: h,
186
+ handleSubmit: Te,
187
+ setValue: g,
188
+ getValues: je,
189
+ clearErrors: Me,
190
+ watch: G,
191
+ formState: { errors: f }
192
+ } = ie, { fields: ne, append: te, remove: Ee } = ve({
193
+ control: h,
194
+ name: "dependencies"
195
+ }), {
196
+ fields: se,
197
+ append: oe,
198
+ remove: Je
199
+ } = ve({
200
+ control: h,
201
+ name: "filters"
202
+ }), T = G("dependencies"), W = G("isRecursive"), de = G("name");
203
+ ue(() => {
204
+ if (!S) {
205
+ const a = de.replace(/\s+/g, "_").toUpperCase();
206
+ g("code", a);
207
+ }
208
+ }, [de, S]), ue(() => {
209
+ Ve();
210
+ }, []);
211
+ const Ve = async () => {
212
+ var a, l, n, o, d;
213
+ try {
214
+ U((b) => !b);
215
+ const p = await O({
216
+ code: "imt_member_date_column"
217
+ });
218
+ ye((a = p == null ? void 0 : p.data) == null ? void 0 : a.result);
219
+ const c = await O({
220
+ code: "get_code_immunization",
221
+ parameters: {}
222
+ });
223
+ let t = (l = c == null ? void 0 : c.data) == null ? void 0 : l.result;
224
+ ke(t);
225
+ const y = await O({
226
+ code: "GET_MANAGE_IMMUNIZATION_FILTER_QUERIES",
227
+ parameters: {}
228
+ }), z = Object.values(
229
+ (((n = y == null ? void 0 : y.data) == null ? void 0 : n.result) || []).reduce((b, i) => (b[i.queryCode] = i, b), {})
230
+ );
231
+ if (Oe(z), S) {
232
+ _e("Edit Immunization");
233
+ const b = await O({
234
+ code: "get_immunization_by_id",
235
+ parameters: {
236
+ id: parseInt(S)
237
+ }
238
+ }), i = (o = b == null ? void 0 : b.data) == null ? void 0 : o.result[0];
239
+ if (g("code", i == null ? void 0 : i.code), g("name", i == null ? void 0 : i.name), g("basedate", i == null ? void 0 : i.base_date), g("fromDate", i == null ? void 0 : i.from_age_days), g("toDate", i == null ? void 0 : i.to_age_days), g("isRecursive", i == null ? void 0 : i.is_recursive), P(i != null && i.locations ? JSON.parse(i == null ? void 0 : i.locations) : []), i.is_recursive) {
240
+ const x = JSON.parse(i == null ? void 0 : i.recursive_object);
241
+ g("gapRange", x == null ? void 0 : x.gapRange), g("maxDoses", x == null ? void 0 : x.maxDoses);
242
+ }
243
+ const $ = JSON.parse(i == null ? void 0 : i.validations);
244
+ $ && ((d = $ == null ? void 0 : $.dependencies) == null || d.forEach((x) => {
245
+ const J = ((x == null ? void 0 : x.vaccine) || []).map((ce) => {
246
+ const me = t.find((Ue) => Ue.code === ce);
247
+ return {
248
+ code: ce,
249
+ name: (me == null ? void 0 : me.name) || "Unknown"
250
+ // Fallback to 'Unknown' if no match is found
251
+ };
252
+ });
253
+ x.vaccine = J, te(x);
254
+ }));
255
+ const D = i != null && i.filters ? JSON.parse(i.filters) : [];
256
+ D && D.length > 0 && D.forEach((x) => {
257
+ oe({
258
+ filterName: x.filterName || "",
259
+ queryCode: x.queryCode || ""
260
+ });
261
+ });
262
+ }
263
+ U((b) => !b);
264
+ } catch (p) {
265
+ console.error(p), U((c) => !c);
266
+ }
267
+ }, Be = async () => {
268
+ var a, l, n, o, d;
269
+ try {
270
+ const p = (l = (a = A == null ? void 0 : A.finalSelected) == null ? void 0 : a.optionSelected) == null ? void 0 : l.id, c = A.finalSelected.level, { id: t } = A.finalSelected.optionSelected;
271
+ let y = !1, z = [], b = {
272
+ ids: I.map((i) => i.locationId),
273
+ idArr: I.map((i) => i.locationIdArr)
274
+ };
275
+ for (let i = 1; i <= c; i++)
276
+ (o = b.ids) != null && o.includes(
277
+ (n = A[`level${i}`]) == null ? void 0 : n.id
278
+ ) ? y = !0 : z.push((d = A[`level${i}`]) == null ? void 0 : d.id);
279
+ if (y)
280
+ M({
281
+ message: "Please select different parent location!",
282
+ type: "info"
283
+ });
284
+ else {
285
+ const { data: i } = await pa({
286
+ roleId: X == null ? void 0 : X.roleId,
287
+ toBeAdded: t
288
+ });
289
+ P(($) => {
290
+ var D;
291
+ return [
292
+ ...$.filter(
293
+ (x) => {
294
+ var J;
295
+ return !((J = x.locationIdArr) != null && J.includes(p));
296
+ }
297
+ ),
298
+ {
299
+ locationId: p,
300
+ locationIdArr: z,
301
+ locationList: (D = i == null ? void 0 : i.message) == null ? void 0 : D.replaceAll(",", " => ")
302
+ }
303
+ ];
304
+ }), ae({
305
+ finalSelected: null,
306
+ optionsList: []
307
+ });
308
+ }
309
+ } catch (p) {
310
+ console.error(p);
311
+ }
312
+ }, Pe = (a) => {
313
+ P((l) => l.filter((n) => n.locationId !== a));
314
+ };
315
+ return /* @__PURE__ */ e(ia, { ...ie, children: /* @__PURE__ */ e(
316
+ Ye,
317
+ {
318
+ className: "mt-6 mr-3 mb-3",
319
+ elevation: 5,
320
+ component: "form",
321
+ onSubmit: Te(Fe),
322
+ noValidate: !0,
323
+ children: /* @__PURE__ */ r(ca, { isLoading: le, children: [
324
+ /* @__PURE__ */ e(u, { item: !0, container: !0, direction: "row", children: /* @__PURE__ */ e(u, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ e(
325
+ Q,
326
+ {
327
+ className: "p-2.5 px-5 flex border-b",
328
+ subheader: /* @__PURE__ */ e(
329
+ w,
330
+ {
331
+ display: "flex",
332
+ alignItems: "center",
333
+ justifyContent: "space-between",
334
+ children: /* @__PURE__ */ e(
335
+ m,
336
+ {
337
+ variant: "body2",
338
+ className: "font-bold text-lg text-customBlue",
339
+ "data-testid": "form-header",
340
+ children: be(we)
341
+ }
342
+ )
343
+ }
344
+ ),
345
+ slotProps: {
346
+ subheader: { className: "subheader-style" }
347
+ }
348
+ }
349
+ ) }) }),
350
+ /* @__PURE__ */ r(He, { children: [
351
+ /* @__PURE__ */ r(u, { container: !0, spacing: 2, children: [
352
+ /* @__PURE__ */ e(u, { className: "w-full", children: /* @__PURE__ */ r(
353
+ u,
354
+ {
355
+ container: !0,
356
+ spacing: 2,
357
+ className: "flex flex-col justify-between w-full",
358
+ children: [
359
+ /* @__PURE__ */ r("div", { className: "flex md:flex-row flex-col space-x-10 w-[100%]", children: [
360
+ /* @__PURE__ */ r("div", { className: "flex flex-col space-y-2 w-full md:w-1/2", children: [
361
+ /* @__PURE__ */ r(u, { className: "mb-3 mr-[5rem] w-full", children: [
362
+ /* @__PURE__ */ r(
363
+ m,
364
+ {
365
+ variant: "caption",
366
+ className: "p-3 pl-0 text-base",
367
+ children: [
368
+ s("Immunization Name"),
369
+ /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
370
+ ]
371
+ }
372
+ ),
373
+ /* @__PURE__ */ e(
374
+ _,
375
+ {
376
+ control: h,
377
+ id: "name",
378
+ name: "name",
379
+ className: "w-full",
380
+ errors: f,
381
+ label: "",
382
+ size: "small"
383
+ }
384
+ )
385
+ ] }),
386
+ /* @__PURE__ */ r(u, { className: "mb-3 mr-[5rem] w-full", children: [
387
+ /* @__PURE__ */ r(
388
+ m,
389
+ {
390
+ variant: "caption",
391
+ className: "p-3 pl-0 text-base",
392
+ children: [
393
+ s("Immunization Code"),
394
+ /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
395
+ ]
396
+ }
397
+ ),
398
+ /* @__PURE__ */ e(
399
+ _,
400
+ {
401
+ control: h,
402
+ id: "code",
403
+ name: "code",
404
+ className: "w-full",
405
+ errors: f,
406
+ label: "",
407
+ size: "small",
408
+ disabled: !!S
409
+ }
410
+ )
411
+ ] }),
412
+ /* @__PURE__ */ r(u, { className: "mb-3 mr-[5rem] w-full", children: [
413
+ /* @__PURE__ */ e("div", { className: "flex gap-2 items-center", children: /* @__PURE__ */ r(
414
+ m,
415
+ {
416
+ variant: "caption",
417
+ className: "p-3 pl-0 text-base",
418
+ children: [
419
+ s("Base Date"),
420
+ /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
421
+ ]
422
+ }
423
+ ) }),
424
+ /* @__PURE__ */ e(w, { className: "w-full", children: /* @__PURE__ */ r(pe, { fullWidth: !0, children: [
425
+ /* @__PURE__ */ e(
426
+ H,
427
+ {
428
+ className: "w-full",
429
+ name: "basedate",
430
+ control: h,
431
+ defaultValue: "",
432
+ render: ({ field: a }) => /* @__PURE__ */ e(
433
+ fe,
434
+ {
435
+ ...a,
436
+ className: "w-full",
437
+ sx: {
438
+ height: 38
439
+ },
440
+ error: f.basedate,
441
+ "data-testid": "mobiletypeeventconfigmodal-notification-select",
442
+ children: ee == null ? void 0 : ee.map((l, n) => /* @__PURE__ */ e(
443
+ V,
444
+ {
445
+ value: l.column_name,
446
+ children: /* @__PURE__ */ e(m, { variant: "body2", children: l.column_name })
447
+ },
448
+ n + 1
449
+ ))
450
+ }
451
+ )
452
+ }
453
+ ),
454
+ (f == null ? void 0 : f.basedate) && /* @__PURE__ */ e("p", { className: "error-helper-text-immunization", children: (K = f == null ? void 0 : f.basedate) == null ? void 0 : K.message })
455
+ ] }) })
456
+ ] }),
457
+ /* @__PURE__ */ r(u, { className: "mb-3 mr-[5rem] w-full", children: [
458
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center gap-2 w-full", children: [
459
+ /* @__PURE__ */ e(
460
+ m,
461
+ {
462
+ variant: "caption",
463
+ className: "text-base md:whitespace-nowrap",
464
+ children: s("Eligible From ")
465
+ }
466
+ ),
467
+ /* @__PURE__ */ r(u, { className: "flex gap-2 flex-wrap", children: [
468
+ /* @__PURE__ */ e(
469
+ q,
470
+ {
471
+ size: "small",
472
+ label: "Days",
473
+ clickable: !0,
474
+ color: R === "days" ? "primary" : "default",
475
+ onClick: () => C("days", "fromDate")
476
+ }
477
+ ),
478
+ /* @__PURE__ */ e(
479
+ q,
480
+ {
481
+ size: "small",
482
+ label: "Months",
483
+ clickable: !0,
484
+ color: R === "months" ? "primary" : "default",
485
+ onClick: () => C("months", "fromDate")
486
+ }
487
+ ),
488
+ /* @__PURE__ */ e(
489
+ q,
490
+ {
491
+ size: "small",
492
+ label: "Years",
493
+ clickable: !0,
494
+ color: R === "years" ? "primary" : "default",
495
+ onClick: () => C("years", "fromDate")
496
+ }
497
+ )
498
+ ] })
499
+ ] }),
500
+ /* @__PURE__ */ e(
501
+ _,
502
+ {
503
+ control: h,
504
+ id: "fromDate",
505
+ name: "fromDate",
506
+ type: "number",
507
+ errors: f,
508
+ label: "",
509
+ size: "small"
510
+ }
511
+ )
512
+ ] }),
513
+ /* @__PURE__ */ r(u, { className: "mb-3 mr-[5rem] w-full", children: [
514
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center gap-2 w-full", children: [
515
+ /* @__PURE__ */ e(
516
+ m,
517
+ {
518
+ variant: "caption",
519
+ className: "text-base md:whitespace-nowrap",
520
+ children: s("Eligible To")
521
+ }
522
+ ),
523
+ /* @__PURE__ */ r("div", { className: "flex gap-2 flex-wrap", children: [
524
+ /* @__PURE__ */ e(
525
+ q,
526
+ {
527
+ size: "small",
528
+ label: "Days",
529
+ clickable: !0,
530
+ color: F === "days" ? "primary" : "default",
531
+ onClick: () => C("days", "toDate")
532
+ }
533
+ ),
534
+ /* @__PURE__ */ e(
535
+ q,
536
+ {
537
+ size: "small",
538
+ label: "Months",
539
+ clickable: !0,
540
+ color: F === "months" ? "primary" : "default",
541
+ onClick: () => C("months", "toDate")
542
+ }
543
+ ),
544
+ /* @__PURE__ */ e(
545
+ q,
546
+ {
547
+ size: "small",
548
+ label: "Years",
549
+ clickable: !0,
550
+ color: F === "years" ? "primary" : "default",
551
+ onClick: () => C("years", "toDate")
552
+ }
553
+ )
554
+ ] })
555
+ ] }),
556
+ /* @__PURE__ */ e(
557
+ _,
558
+ {
559
+ control: h,
560
+ id: "toDate",
561
+ name: "toDate",
562
+ type: "number",
563
+ errors: f,
564
+ label: "",
565
+ size: "small"
566
+ }
567
+ )
568
+ ] })
569
+ ] }),
570
+ /* @__PURE__ */ r(u, { className: "w-full md:w-1/2", children: [
571
+ /* @__PURE__ */ e(We, { children: /* @__PURE__ */ e(
572
+ fa,
573
+ {
574
+ selectedLocation: A,
575
+ setSelectedLocation: ae,
576
+ locations: Se,
577
+ setLocations: Re,
578
+ fetchUptoLevel: $e,
579
+ templateType: "inline",
580
+ fetchAccordingToUserAoi: !0,
581
+ demographicFilterRequired: !1,
582
+ requiredUptoLevel: 1,
583
+ childForm: !0,
584
+ disabled: le
585
+ }
586
+ ) }),
587
+ /* @__PURE__ */ e(
588
+ j,
589
+ {
590
+ variant: "contained",
591
+ color: "primary",
592
+ size: "small",
593
+ onClick: Be,
594
+ className: "mt-[1rem]",
595
+ children: s("Add Location")
596
+ }
597
+ ),
598
+ /* @__PURE__ */ r("div", { className: "w-full mt-8 p-6 bg-background2 border border-gray-300 rounded-2xl shadow-lg", children: [
599
+ /* @__PURE__ */ e("h2", { className: "text-xl font-semibold mb-4 text-customBlue", children: "📍 Selected Locations" }),
600
+ /* @__PURE__ */ r("ul", { className: "", children: [
601
+ I == null ? void 0 : I.map((a) => /* @__PURE__ */ r("li", { children: [
602
+ /* @__PURE__ */ e("span", { className: "text-xl leading-none", children: "• " }),
603
+ /* @__PURE__ */ e("span", { children: a != null && a.locationList ? a == null ? void 0 : a.locationList : "" }),
604
+ /* @__PURE__ */ e(
605
+ "button",
606
+ {
607
+ onClick: () => Pe(a == null ? void 0 : a.locationId),
608
+ className: "mx-3 cursor-pointer text-red-500 hover:text-red-700 font-bold text-xl",
609
+ children: "×"
610
+ }
611
+ )
612
+ ] }, a == null ? void 0 : a.locationId)),
613
+ (I == null ? void 0 : I.length) === 0 && /* @__PURE__ */ e("li", { className: "text-gray-400 italic text-center", children: "No locations selected." })
614
+ ] })
615
+ ] })
616
+ ] })
617
+ ] }),
618
+ /* @__PURE__ */ r(u, { className: "flex flex-col md:flex-row space-x-10 w-full", children: [
619
+ /* @__PURE__ */ e(u, { className: "mb-3 mt-8", children: /* @__PURE__ */ e(
620
+ na,
621
+ {
622
+ name: "isRecursive",
623
+ sx: { "& .MuiSvgIcon-root": { fontSize: 20 } },
624
+ label: s("Repeats"),
625
+ control: h,
626
+ labelSizeInRem: "1rem",
627
+ checked: !!W
628
+ }
629
+ ) }),
630
+ W && /* @__PURE__ */ r(u, { className: "mb-3", children: [
631
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center gap-2 w-full", children: [
632
+ /* @__PURE__ */ e(
633
+ m,
634
+ {
635
+ variant: "caption",
636
+ className: "text-base md:whitespace-nowrap",
637
+ children: s("Interval")
638
+ }
639
+ ),
640
+ /* @__PURE__ */ r("div", { className: "flex gap-2 flex-wrap", children: [
641
+ /* @__PURE__ */ e(
642
+ q,
643
+ {
644
+ size: "small",
645
+ label: "Days",
646
+ clickable: !0,
647
+ color: L === "days" ? "primary" : "default",
648
+ onClick: () => C("days", "gapRange")
649
+ }
650
+ ),
651
+ /* @__PURE__ */ e(
652
+ q,
653
+ {
654
+ size: "small",
655
+ label: "Months",
656
+ clickable: !0,
657
+ color: L === "months" ? "primary" : "default",
658
+ onClick: () => C("months", "gapRange")
659
+ }
660
+ ),
661
+ /* @__PURE__ */ e(
662
+ q,
663
+ {
664
+ size: "small",
665
+ label: "Years",
666
+ clickable: !0,
667
+ color: L === "years" ? "primary" : "default",
668
+ onClick: () => C("years", "gapRange")
669
+ }
670
+ )
671
+ ] })
672
+ ] }),
673
+ /* @__PURE__ */ e(
674
+ _,
675
+ {
676
+ control: h,
677
+ id: "gapRange",
678
+ name: "gapRange",
679
+ type: "number",
680
+ className: "w-full",
681
+ errors: f,
682
+ label: "",
683
+ size: "small"
684
+ }
685
+ )
686
+ ] }),
687
+ W && /* @__PURE__ */ r(u, { className: "mb-3", children: [
688
+ /* @__PURE__ */ e("div", { className: "flex flex-col md:flex-row md:items-center gap-2 w-full", children: /* @__PURE__ */ r(
689
+ m,
690
+ {
691
+ variant: "caption",
692
+ className: " pl-0 text-base",
693
+ children: [
694
+ s("Max Doses"),
695
+ /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
696
+ ]
697
+ }
698
+ ) }),
699
+ /* @__PURE__ */ e(
700
+ _,
701
+ {
702
+ control: h,
703
+ id: "maxDoses",
704
+ name: "maxDoses",
705
+ type: "number",
706
+ className: "w-full",
707
+ errors: f,
708
+ label: "",
709
+ size: "small"
710
+ }
711
+ )
712
+ ] })
713
+ ] }),
714
+ /* @__PURE__ */ r(u, { size: { xs: 12 }, className: "mb-3", children: [
715
+ /* @__PURE__ */ e(Y, {}),
716
+ /* @__PURE__ */ r(w, { className: "flex flex-row items-center justify-between", children: [
717
+ /* @__PURE__ */ e(
718
+ Q,
719
+ {
720
+ subheader: /* @__PURE__ */ e(
721
+ w,
722
+ {
723
+ display: "flex",
724
+ alignItems: "center",
725
+ justifyContent: "space-between",
726
+ children: /* @__PURE__ */ e(
727
+ m,
728
+ {
729
+ variant: "body2",
730
+ className: "font-bold text-lg text-customBlue",
731
+ "data-testid": "form-header",
732
+ children: s("Add Validations")
733
+ }
734
+ )
735
+ }
736
+ ),
737
+ slotProps: {
738
+ subheader: {
739
+ variant: "p",
740
+ sx: { fontWeight: "bold" }
741
+ }
742
+ }
743
+ }
744
+ ),
745
+ /* @__PURE__ */ e(
746
+ j,
747
+ {
748
+ variant: "contained",
749
+ size: "small",
750
+ className: "mr-2",
751
+ onClick: () => te({
752
+ vaccine: [],
753
+ min_gap_days: 0,
754
+ max_gap_days: 0,
755
+ message: "",
756
+ required: ""
757
+ }),
758
+ children: s("Add")
759
+ }
760
+ )
761
+ ] }),
762
+ ne.map((a, l) => {
763
+ var n, o, d, p, c;
764
+ return /* @__PURE__ */ e(
765
+ w,
766
+ {
767
+ sx: {
768
+ display: "flex",
769
+ justifyContent: "space-between",
770
+ mb: 2,
771
+ alignItems: "flex-start",
772
+ border: "1px solid var(--color-gray3)",
773
+ backgroundColor: "var(--color-background)",
774
+ padding: 2,
775
+ borderRadius: 2,
776
+ position: "relative",
777
+ marginLeft: "15px"
778
+ },
779
+ children: /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-4 items-center w-full", children: [
780
+ /* @__PURE__ */ r("div", { className: "w-full md:w-[20%]", children: [
781
+ /* @__PURE__ */ e(
782
+ m,
783
+ {
784
+ variant: "caption",
785
+ className: "pb-1 text-base block",
786
+ children: Ae
787
+ }
788
+ ),
789
+ /* @__PURE__ */ e(
790
+ oa,
791
+ {
792
+ name: `dependencies.${l}.vaccine`,
793
+ options: Ce,
794
+ checkEquality: "code",
795
+ className: "w-full",
796
+ errors: f,
797
+ getOptionLabel: (t) => t.name,
798
+ control: h,
799
+ value: (o = (n = T[l]) == null ? void 0 : n.vaccine) == null ? void 0 : o.map(
800
+ (t) => t || []
801
+ )
802
+ }
803
+ )
804
+ ] }),
805
+ /* @__PURE__ */ r("div", { className: "w-full md:w-[20%]", children: [
806
+ /* @__PURE__ */ e(
807
+ m,
808
+ {
809
+ variant: "caption",
810
+ className: "pb-1 text-base block",
811
+ children: ze
812
+ }
813
+ ),
814
+ /* @__PURE__ */ e(pe, { fullWidth: !0, children: /* @__PURE__ */ e(
815
+ H,
816
+ {
817
+ name: `dependencies.${l}.required`,
818
+ control: h,
819
+ defaultValue: "",
820
+ render: ({ field: t }) => /* @__PURE__ */ r(
821
+ fe,
822
+ {
823
+ ...t,
824
+ className: "w-full",
825
+ sx: { height: 38 },
826
+ error: E(
827
+ f,
828
+ `dependencies.${l}.required`
829
+ ),
830
+ onChange: (y) => {
831
+ var z, b;
832
+ t.onChange(y.target.value), y.target.value === "false" ? (g(
833
+ `dependencies.${l}.min_gap_days`,
834
+ 0
835
+ ), g(
836
+ `dependencies.${l}.max_gap_days`,
837
+ 0
838
+ ), Me([
839
+ `dependencies.${l}.min_gap_days`,
840
+ `dependencies.${l}.max_gap_days`
841
+ ])) : (g(
842
+ `dependencies.${l}.min_gap_days`,
843
+ ((z = T[l]) == null ? void 0 : z.min_gap_days) || 0
844
+ ), g(
845
+ `dependencies.${l}.max_gap_days`,
846
+ ((b = T[l]) == null ? void 0 : b.max_gap_days) || 0
847
+ ));
848
+ },
849
+ children: [
850
+ /* @__PURE__ */ e(V, { value: "true", children: /* @__PURE__ */ e(m, { variant: "body2", children: s("Should be given") }) }),
851
+ /* @__PURE__ */ e(V, { value: "false", children: /* @__PURE__ */ e(m, { variant: "body2", children: s("Should not be given") }) }),
852
+ /* @__PURE__ */ e(V, { value: "Optional", children: /* @__PURE__ */ e(m, { variant: "body2", children: s("Optional") }) })
853
+ ]
854
+ }
855
+ )
856
+ }
857
+ ) })
858
+ ] }),
859
+ ((d = T[l]) == null ? void 0 : d.required) !== "false" && /* @__PURE__ */ r("div", { className: "w-full md:w-[15%]", children: [
860
+ /* @__PURE__ */ e(
861
+ m,
862
+ {
863
+ variant: "caption",
864
+ className: "pb-1 text-base block",
865
+ children: qe
866
+ }
867
+ ),
868
+ /* @__PURE__ */ e(
869
+ _,
870
+ {
871
+ control: h,
872
+ id: `dependencies.${l}.min_gap_days`,
873
+ name: `dependencies.${l}.min_gap_days`,
874
+ type: "number",
875
+ errors: f,
876
+ label: "",
877
+ size: "small"
878
+ }
879
+ )
880
+ ] }),
881
+ ((p = T[l]) == null ? void 0 : p.required) !== "false" && /* @__PURE__ */ r("div", { className: "w-full md:w-[15%]", children: [
882
+ /* @__PURE__ */ e(
883
+ m,
884
+ {
885
+ variant: "caption",
886
+ className: "pb-1 text-base block",
887
+ children: Ie
888
+ }
889
+ ),
890
+ /* @__PURE__ */ e(
891
+ _,
892
+ {
893
+ control: h,
894
+ id: `dependencies.${l}.max_gap_days`,
895
+ name: `dependencies.${l}.max_gap_days`,
896
+ type: "number",
897
+ errors: f,
898
+ label: "",
899
+ size: "small"
900
+ }
901
+ )
902
+ ] }),
903
+ /* @__PURE__ */ r(u, { className: "w-full md:w-[24%]", children: [
904
+ /* @__PURE__ */ e(
905
+ m,
906
+ {
907
+ variant: "caption",
908
+ className: "pb-1 text-base block",
909
+ children: De
910
+ }
911
+ ),
912
+ /* @__PURE__ */ e(
913
+ _,
914
+ {
915
+ control: h,
916
+ id: `dependencies.${l}.message`,
917
+ name: `dependencies.${l}.message`,
918
+ errors: f,
919
+ label: "",
920
+ size: "small"
921
+ }
922
+ ),
923
+ E(
924
+ f,
925
+ `dependencies.${l}.vaccine`
926
+ ) && /* @__PURE__ */ e(m, { variant: "caption", color: "error", children: (c = E(
927
+ f,
928
+ `dependencies.${l}.vaccine`
929
+ )) == null ? void 0 : c.message })
930
+ ] }),
931
+ /* @__PURE__ */ e(u, { className: "mt-8", children: /* @__PURE__ */ e(
932
+ Z,
933
+ {
934
+ icon: he,
935
+ color: "red",
936
+ className: "cursor-pointer p-1 text-xl",
937
+ onClick: () => Ee(l)
938
+ }
939
+ ) })
940
+ ] }) })
941
+ },
942
+ a.id
943
+ );
944
+ }),
945
+ ne.length === 0 && /* @__PURE__ */ e(
946
+ w,
947
+ {
948
+ sx: {
949
+ padding: 3,
950
+ marginLeft: "15px",
951
+ marginTop: 2,
952
+ textAlign: "center",
953
+ color: "text.secondary",
954
+ backgroundColor: "var(--color-background)",
955
+ borderRadius: 2,
956
+ border: "1px dashed var(--color-gray3)"
957
+ },
958
+ children: /* @__PURE__ */ e(m, { variant: "body2", color: "text.secondary", children: s("No dependencies added yet.") })
959
+ }
960
+ )
961
+ ] }),
962
+ /* @__PURE__ */ r(u, { size: { xs: 12 }, className: "mb-3", children: [
963
+ /* @__PURE__ */ e(Y, {}),
964
+ /* @__PURE__ */ r(w, { className: "flex flex-row items-center justify-between", children: [
965
+ /* @__PURE__ */ e(
966
+ Q,
967
+ {
968
+ subheader: /* @__PURE__ */ r(
969
+ w,
970
+ {
971
+ display: "flex",
972
+ alignItems: "center",
973
+ justifyContent: "space-between",
974
+ children: [
975
+ /* @__PURE__ */ e(
976
+ m,
977
+ {
978
+ variant: "body2",
979
+ className: "font-bold text-lg text-customBlue",
980
+ "data-testid": "form-header",
981
+ children: s("Add Filters")
982
+ }
983
+ ),
984
+ /* @__PURE__ */ e(
985
+ Ze,
986
+ {
987
+ arrow: !0,
988
+ title: /* @__PURE__ */ r(Ge, { children: [
989
+ "Queries with ",
990
+ /* @__PURE__ */ e("b", { children: "params" }),
991
+ " ",
992
+ /* @__PURE__ */ e("i", { children: "{{member_id}}" }),
993
+ " are shown here.",
994
+ /* @__PURE__ */ e("br", {}),
995
+ "The query must return a single boolean column named ",
996
+ /* @__PURE__ */ e("code", { children: "filter_passed" }),
997
+ ", e.g.",
998
+ " ",
999
+ /* @__PURE__ */ e("code", { children: "{ filter_passed: true }" }),
1000
+ "."
1001
+ ] }),
1002
+ children: /* @__PURE__ */ e(Ke, { size: "small", color: "info", children: /* @__PURE__ */ e(Z, { icon: ma }) })
1003
+ }
1004
+ )
1005
+ ]
1006
+ }
1007
+ ),
1008
+ slotProps: {
1009
+ subheader: {
1010
+ variant: "p",
1011
+ sx: { fontWeight: "bold" }
1012
+ }
1013
+ }
1014
+ }
1015
+ ),
1016
+ /* @__PURE__ */ e(
1017
+ j,
1018
+ {
1019
+ variant: "contained",
1020
+ size: "small",
1021
+ onClick: () => oe({
1022
+ filterName: "",
1023
+ queryCode: ""
1024
+ }),
1025
+ children: s("Add")
1026
+ }
1027
+ )
1028
+ ] }),
1029
+ se.map((a, l) => /* @__PURE__ */ e(
1030
+ w,
1031
+ {
1032
+ sx: {
1033
+ display: "flex",
1034
+ justifyContent: "space-between",
1035
+ mb: 2,
1036
+ alignItems: "flex-start",
1037
+ border: "1px solid var(--color-gray3)",
1038
+ backgroundColor: "var(--color-background)",
1039
+ padding: 2,
1040
+ borderRadius: 2,
1041
+ position: "relative",
1042
+ marginLeft: "15px"
1043
+ },
1044
+ children: /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-4 items-center w-full", children: [
1045
+ /* @__PURE__ */ r("div", { className: "w-full md:w-[45%]", children: [
1046
+ /* @__PURE__ */ e(
1047
+ m,
1048
+ {
1049
+ variant: "caption",
1050
+ className: "pb-1 text-base block",
1051
+ children: s("Filter Name")
1052
+ }
1053
+ ),
1054
+ /* @__PURE__ */ e(
1055
+ _,
1056
+ {
1057
+ control: h,
1058
+ name: `filters.${l}.filterName`,
1059
+ errors: f,
1060
+ label: "",
1061
+ size: "small"
1062
+ }
1063
+ )
1064
+ ] }),
1065
+ /* @__PURE__ */ r("div", { className: "w-full md:w-[50%]", children: [
1066
+ /* @__PURE__ */ e(
1067
+ m,
1068
+ {
1069
+ variant: "caption",
1070
+ className: "pb-1 text-base block",
1071
+ children: s("Query")
1072
+ }
1073
+ ),
1074
+ /* @__PURE__ */ e(
1075
+ H,
1076
+ {
1077
+ name: `filters.${l}.queryCode`,
1078
+ control: h,
1079
+ render: ({ field: n }) => {
1080
+ const [o, d] = N(""), p = re.find(
1081
+ (c) => c.queryCode === n.value
1082
+ ) || null;
1083
+ return /* @__PURE__ */ e(
1084
+ Xe,
1085
+ {
1086
+ options: re,
1087
+ getOptionLabel: (c) => c.queryCode || "",
1088
+ isOptionEqualToValue: (c, t) => (c == null ? void 0 : c.queryCode) === t,
1089
+ value: p,
1090
+ inputValue: o,
1091
+ onInputChange: (c, t) => {
1092
+ d(t);
1093
+ },
1094
+ onChange: (c, t) => {
1095
+ n.onChange(
1096
+ (t == null ? void 0 : t.queryCode) || ""
1097
+ ), d(
1098
+ (t == null ? void 0 : t.queryCode) || ""
1099
+ );
1100
+ },
1101
+ filterOptions: (c, { inputValue: t }) => c.filter(
1102
+ (y) => y.queryCode.toLowerCase().includes(
1103
+ t.toLowerCase()
1104
+ )
1105
+ ),
1106
+ renderOption: (c, t) => /* @__PURE__ */ e("li", { ...c, children: t.queryCode }),
1107
+ renderInput: (c) => {
1108
+ var t;
1109
+ return /* @__PURE__ */ e(
1110
+ ea,
1111
+ {
1112
+ ...c,
1113
+ size: "small",
1114
+ error: !!E(
1115
+ f,
1116
+ `filters.${l}.queryCode`
1117
+ ),
1118
+ helperText: (t = E(
1119
+ f,
1120
+ `filters.${l}.queryCode`
1121
+ )) == null ? void 0 : t.message
1122
+ }
1123
+ );
1124
+ }
1125
+ }
1126
+ );
1127
+ }
1128
+ }
1129
+ )
1130
+ ] }),
1131
+ /* @__PURE__ */ e(u, { className: "mt-8", children: /* @__PURE__ */ e(
1132
+ Z,
1133
+ {
1134
+ icon: he,
1135
+ color: "red",
1136
+ className: "cursor-pointer p-1 text-xl",
1137
+ onClick: () => Je(l)
1138
+ }
1139
+ ) })
1140
+ ] }) })
1141
+ },
1142
+ a.id
1143
+ )),
1144
+ se.length === 0 && /* @__PURE__ */ e(
1145
+ w,
1146
+ {
1147
+ sx: {
1148
+ padding: 3,
1149
+ marginLeft: "15px",
1150
+ marginTop: 2,
1151
+ textAlign: "center",
1152
+ color: "text.secondary",
1153
+ backgroundColor: "var(--color-background)",
1154
+ borderRadius: 2,
1155
+ border: "1px dashed var(--color-gray3)"
1156
+ },
1157
+ children: /* @__PURE__ */ e(m, { variant: "body2", color: "text.secondary", children: s("No filters added yet.") })
1158
+ }
1159
+ )
1160
+ ] })
1161
+ ]
1162
+ }
1163
+ ) }),
1164
+ /* @__PURE__ */ r(u, { size: { xs: 12 }, className: "mb-3", children: [
1165
+ /* @__PURE__ */ e(Y, { variant: "middle", className: "h-[0.625rem]" }),
1166
+ /* @__PURE__ */ e(u, { container: !0, spacing: 2 })
1167
+ ] })
1168
+ ] }),
1169
+ /* @__PURE__ */ r(u, { item: !0, container: !0, size: { xs: 12 }, justifyContent: "flex-end", children: [
1170
+ /* @__PURE__ */ e(
1171
+ j,
1172
+ {
1173
+ variant: "contained",
1174
+ color: "secondary",
1175
+ size: "small",
1176
+ onClick: () => {
1177
+ B("/ui/medplat/manage/immunizationConfiguratorList");
1178
+ },
1179
+ "data-testid": "manageImmunization-close-button",
1180
+ children: /* @__PURE__ */ e(m, { variant: "caption", children: s("Back") })
1181
+ }
1182
+ ),
1183
+ /* @__PURE__ */ e(
1184
+ j,
1185
+ {
1186
+ className: "ml-2 mr-4",
1187
+ size: "small",
1188
+ variant: "contained",
1189
+ color: "primary",
1190
+ type: "submit",
1191
+ "data-testid": "submit-button",
1192
+ children: s("Submit")
1193
+ }
1194
+ )
1195
+ ] })
1196
+ ] })
1197
+ ] })
1198
+ }
1199
+ ) });
1200
+ };
1201
+ export {
1202
+ $a as default
1203
+ };
1204
+ //# sourceMappingURL=manageImmunization-B4swS745-JldexHrO.js.map