@argusoft/medplat-core 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/AccessRights-DUgY6ewy.js +1031 -0
  2. package/dist/AccessRights-DUgY6ewy.js.map +1 -0
  3. package/dist/AddEditQueryBuilder-D-iQiVIe.js +365 -0
  4. package/dist/AddEditQueryBuilder-D-iQiVIe.js.map +1 -0
  5. package/dist/{AddFeatures-v3TmGQee.js → AddFeatures-D1sU8RjY.js} +2 -2
  6. package/dist/{AddFeatures-v3TmGQee.js.map → AddFeatures-D1sU8RjY.js.map} +1 -1
  7. package/dist/AddLabelModal-Bq-wRqv9.js +631 -0
  8. package/dist/AddLabelModal-Bq-wRqv9.js.map +1 -0
  9. package/dist/AddMenuConfiguration-c6ZKiN0i.js +8898 -0
  10. package/dist/AddMenuConfiguration-c6ZKiN0i.js.map +1 -0
  11. package/dist/AppModal-CCtrQ5Tr.js +394 -0
  12. package/dist/AppModal-CCtrQ5Tr.js.map +1 -0
  13. package/dist/BrandsPage-DMw2vT0u-BVhvhc6J.js +387 -0
  14. package/dist/BrandsPage-DMw2vT0u-BVhvhc6J.js.map +1 -0
  15. package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js +398 -0
  16. package/dist/CategoriesPage-D3ihx9Gi-CT58g0ry.js.map +1 -0
  17. package/dist/{ChangePasswordModalCore-DutQAZOx.js → ChangePasswordModalCore-lQ9GamH1.js} +1605 -1610
  18. package/dist/ChangePasswordModalCore-lQ9GamH1.js.map +1 -0
  19. package/dist/ConditionConfig-BQBmBHaM.js +408 -0
  20. package/dist/ConditionConfig-BQBmBHaM.js.map +1 -0
  21. package/dist/DashboardPage-asr2XDRu-uOOlX9Vq.js +435 -0
  22. package/dist/DashboardPage-asr2XDRu-uOOlX9Vq.js.map +1 -0
  23. package/dist/EventConfig-BY2cgGyx.js +27 -0
  24. package/dist/EventConfig-BY2cgGyx.js.map +1 -0
  25. package/dist/EventConfigurations-CUPEN5BV.js +544 -0
  26. package/dist/EventConfigurations-CUPEN5BV.js.map +1 -0
  27. package/dist/EventConfigurations.css +1 -1
  28. package/dist/EventsExceptionModal-BX-ArkBE.js +188 -0
  29. package/dist/EventsExceptionModal-BX-ArkBE.js.map +1 -0
  30. package/dist/EventsUi-D6O9S7BK.js +258 -0
  31. package/dist/EventsUi-D6O9S7BK.js.map +1 -0
  32. package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js +79 -0
  33. package/dist/FacilityPicker-DYl_PDyt-Cbwo2tAY.js.map +1 -0
  34. package/dist/FeatureMenu-CHsBbw3W.js +525 -0
  35. package/dist/FeatureMenu-CHsBbw3W.js.map +1 -0
  36. package/dist/{FhirServerList-Dkq7Kbes.js → FhirServerList-iXBPkRVF.js} +22 -22
  37. package/dist/{FhirServerList-Dkq7Kbes.js.map → FhirServerList-iXBPkRVF.js.map} +1 -1
  38. package/dist/{FhirServerWizard-Db6Hm4bQ.js → FhirServerWizard-DZI8Olku.js} +15 -15
  39. package/dist/{FhirServerWizard-Db6Hm4bQ.js.map → FhirServerWizard-DZI8Olku.js.map} +1 -1
  40. package/dist/FlywayQuery-CQygj51V.js +179 -0
  41. package/dist/FlywayQuery-CQygj51V.js.map +1 -0
  42. package/dist/GrantPermissionModal-D7iNZd0M.js +239 -0
  43. package/dist/GrantPermissionModal-D7iNZd0M.js.map +1 -0
  44. package/dist/ImmunizationConfigurationBase-aUtx0JEe.js +8019 -0
  45. package/dist/ImmunizationConfigurationBase-aUtx0JEe.js.map +1 -0
  46. package/dist/ImmunizationConfigurationBase.css +1 -1
  47. package/dist/ImmunizationConfigurationsList-TZcLDEci.js +369 -0
  48. package/dist/ImmunizationConfigurationsList-TZcLDEci.js.map +1 -0
  49. package/dist/InventoryPage-DOotGZrj-CoPjOJEI.js +665 -0
  50. package/dist/InventoryPage-DOotGZrj-CoPjOJEI.js.map +1 -0
  51. package/dist/LanguagesModal-B3NTebYT.js +352 -0
  52. package/dist/LanguagesModal-B3NTebYT.js.map +1 -0
  53. package/dist/ManageDynamicFeature-BU0I45dd.js +4475 -0
  54. package/dist/ManageDynamicFeature-BU0I45dd.js.map +1 -0
  55. package/dist/ManageEventConfiguration-DqW3krT6.js +1216 -0
  56. package/dist/ManageEventConfiguration-DqW3krT6.js.map +1 -0
  57. package/dist/ManageEventConfiguration.css +1 -1
  58. package/dist/{ManageNotification-CfhHlfxA.js → ManageNotification-C5MhV77Q.js} +2 -2
  59. package/dist/{ManageNotification-CfhHlfxA.js.map → ManageNotification-C5MhV77Q.js.map} +1 -1
  60. package/dist/{ManageRole-4Y2PP4dQ.js → ManageRole-CNZBRKGU.js} +2 -2
  61. package/dist/{ManageRole-4Y2PP4dQ.js.map → ManageRole-CNZBRKGU.js.map} +1 -1
  62. package/dist/ManageTranslation-vRiptUAP.js +833 -0
  63. package/dist/ManageTranslation-vRiptUAP.js.map +1 -0
  64. package/dist/ManageTranslation.css +1 -1
  65. package/dist/{ManageUser-DDzyd9jm.js → ManageUser-DZltBina.js} +224 -224
  66. package/dist/{ManageUser-DDzyd9jm.js.map → ManageUser-DZltBina.js.map} +1 -1
  67. package/dist/MemberProfileCard-D5CgkTdJ-D2NgDJl3.js +272 -0
  68. package/dist/MemberProfileCard-D5CgkTdJ-D2NgDJl3.js.map +1 -0
  69. package/dist/MobileAnalytics-BLOionG_.js +17301 -0
  70. package/dist/MobileAnalytics-BLOionG_.js.map +1 -0
  71. package/dist/MobileMenuManagement-68Wijb0X.js +220 -0
  72. package/dist/MobileMenuManagement-68Wijb0X.js.map +1 -0
  73. package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js +752 -0
  74. package/dist/MobileTypeEventConfigModal-CMcj7Ozp.js.map +1 -0
  75. package/dist/NotificationFlywayQuery-BAHVjf6N.js +247 -0
  76. package/dist/NotificationFlywayQuery-BAHVjf6N.js.map +1 -0
  77. package/dist/{NotificationList-BMFpNUJG.js → NotificationList-DEyRZEuM.js} +2 -2
  78. package/dist/{NotificationList-BMFpNUJG.js.map → NotificationList-DEyRZEuM.js.map} +1 -1
  79. package/dist/OtherTypeEventConfigModal-stNmuSv_.js +1812 -0
  80. package/dist/OtherTypeEventConfigModal-stNmuSv_.js.map +1 -0
  81. package/dist/PaymentCreatePage-DfvSZ-kB-CckogYoe.js +482 -0
  82. package/dist/PaymentCreatePage-DfvSZ-kB-CckogYoe.js.map +1 -0
  83. package/dist/PaymentsPage-DMNjYWAJ-ChO9IXmk.js +157 -0
  84. package/dist/PaymentsPage-DMNjYWAJ-ChO9IXmk.js.map +1 -0
  85. package/dist/PermissionsModal-CCYkcKlC.js +151 -0
  86. package/dist/PermissionsModal-CCYkcKlC.js.map +1 -0
  87. package/dist/PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js +119 -0
  88. package/dist/PickupBatchLinesEditor-CE2RuyJT-BPceiJr8.js.map +1 -0
  89. package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js +783 -0
  90. package/dist/PickupCreatePage-B4O_-vE5-DoOo9nJO.js.map +1 -0
  91. package/dist/PickupsPage-D7zyioJB-bHKnARYw.js +818 -0
  92. package/dist/PickupsPage-D7zyioJB-bHKnARYw.js.map +1 -0
  93. package/dist/PmGuard-BZE-y4In-D_pUm5MP.js +599 -0
  94. package/dist/PmGuard-BZE-y4In-D_pUm5MP.js.map +1 -0
  95. package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js +1305 -0
  96. package/dist/ProductEditPage-BVlVUCtD-BR-tJ5Wb.js.map +1 -0
  97. package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js +253 -0
  98. package/dist/ProductsPage-DvNHIeZt-BoOOJJtk.js.map +1 -0
  99. package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js +675 -0
  100. package/dist/PurchaseCreatePage-Cq_i9snz-DRtHHFWw.js.map +1 -0
  101. package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js +1577 -0
  102. package/dist/PurchaseRequestDetailPage-CA9KFOfE-CtjG4Gx6.js.map +1 -0
  103. package/dist/PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js +279 -0
  104. package/dist/PurchaseRequestsPage-DS9i4o0--TpoxA5Kd.js.map +1 -0
  105. package/dist/PurchasesPage-DgL5T6BY-DePUuE9l.js +293 -0
  106. package/dist/PurchasesPage-DgL5T6BY-DePUuE9l.js.map +1 -0
  107. package/dist/QueryBuilder-CXaBe6sr.js +478 -0
  108. package/dist/QueryBuilder-CXaBe6sr.js.map +1 -0
  109. package/dist/{RoleManagement-DEiBNfT8.js → RoleManagement-s8iNx2Mu.js} +145 -155
  110. package/dist/RoleManagement-s8iNx2Mu.js.map +1 -0
  111. package/dist/Roles-BIyiic67.js +14 -0
  112. package/dist/Roles-BIyiic67.js.map +1 -0
  113. package/dist/SaleCreatePage-CZnIOydv-DKBw-qp7.js +544 -0
  114. package/dist/SaleCreatePage-CZnIOydv-DKBw-qp7.js.map +1 -0
  115. package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js +315 -0
  116. package/dist/SalesPage-DPIRrC_O-M8rqnK7z.js.map +1 -0
  117. package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js +676 -0
  118. package/dist/SettingsPage-BC_R6Z-Q-CKNt9zRu.js.map +1 -0
  119. package/dist/ShowFlywayQuery-D10Olk5Z.js +154 -0
  120. package/dist/ShowFlywayQuery-D10Olk5Z.js.map +1 -0
  121. package/dist/{ShowFlywayQuery-DVRCd384.js → ShowFlywayQuery-DIOUdYfG.js} +170 -123
  122. package/dist/ShowFlywayQuery-DIOUdYfG.js.map +1 -0
  123. package/dist/ShowQueryHistory-DRBKYDKk.js +313 -0
  124. package/dist/ShowQueryHistory-DRBKYDKk.js.map +1 -0
  125. package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js +728 -0
  126. package/dist/StorageUnitsPage-BDRkdCjW-UF64rf7q.js.map +1 -0
  127. package/dist/SubMenu-BdMTYtC1.js +319 -0
  128. package/dist/SubMenu-BdMTYtC1.js.map +1 -0
  129. package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js +746 -0
  130. package/dist/TransactionsPage-CqWTMNU8-Df6eGFDW.js.map +1 -0
  131. package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js +315 -0
  132. package/dist/TransferCreatePage-DF7FZaTJ-CL79V3aR.js.map +1 -0
  133. package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js +476 -0
  134. package/dist/TransfersPage-CGrRFaBF-cTwBUv0o.js.map +1 -0
  135. package/dist/TypeConfiguration-JbRCN6GR.js +114 -0
  136. package/dist/TypeConfiguration-JbRCN6GR.js.map +1 -0
  137. package/dist/{UserList-Bc8gYxRL.js → UserList-L41Xw0Q6.js} +253 -236
  138. package/dist/{UserList-Bc8gYxRL.js.map → UserList-L41Xw0Q6.js.map} +1 -1
  139. package/dist/Users-CsJ08Kjm.js.map +1 -1
  140. package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js +321 -0
  141. package/dist/VialsPage-rvvXjgZG-Oqo1v6kQ.js.map +1 -0
  142. package/dist/constants-DpXnLsAB-D6lN5cjK.js +445 -0
  143. package/dist/constants-DpXnLsAB-D6lN5cjK.js.map +1 -0
  144. package/dist/{dashboardLayoutUtils-D1xCAxp3.js → dashboardLayoutUtils-CJivzaU1.js} +95 -92
  145. package/dist/dashboardLayoutUtils-CJivzaU1.js.map +1 -0
  146. package/dist/format-UOyOu75i-D0GyylyQ.js +63 -0
  147. package/dist/format-UOyOu75i-D0GyylyQ.js.map +1 -0
  148. package/dist/index.css +1 -1
  149. package/dist/index.js +1 -1
  150. package/dist/index.lib-ETRQOzvE.js +894 -0
  151. package/dist/index.lib-ETRQOzvE.js.map +1 -0
  152. package/dist/listValueStore-BFQtDYIR-Bj0yX145.js +36 -0
  153. package/dist/listValueStore-BFQtDYIR-Bj0yX145.js.map +1 -0
  154. package/dist/useFieldErrors-hDG8ox_x-DbSAzrGo.js +28 -0
  155. package/dist/useFieldErrors-hDG8ox_x-DbSAzrGo.js.map +1 -0
  156. package/dist/validation-BzlHnL-r-CCJm2utQ.js +125 -0
  157. package/dist/validation-BzlHnL-r-CCJm2utQ.js.map +1 -0
  158. package/package.json +4 -3
  159. package/dist/AccessRights-Zm8Obm4N.js +0 -1284
  160. package/dist/AccessRights-Zm8Obm4N.js.map +0 -1
  161. package/dist/AddEditQueryBuilder-Brdnm6rQ.js +0 -313
  162. package/dist/AddEditQueryBuilder-Brdnm6rQ.js.map +0 -1
  163. package/dist/AddLabelModal-DFllBVcd.js +0 -734
  164. package/dist/AddLabelModal-DFllBVcd.js.map +0 -1
  165. package/dist/AddMenuConfiguration-Ce91MhnU.js +0 -8547
  166. package/dist/AddMenuConfiguration-Ce91MhnU.js.map +0 -1
  167. package/dist/AppModal-CtG2GjD_.js +0 -428
  168. package/dist/AppModal-CtG2GjD_.js.map +0 -1
  169. package/dist/ChangePasswordModalCore-DutQAZOx.js.map +0 -1
  170. package/dist/ConditionConfig-B4Ffpgj3.js +0 -395
  171. package/dist/ConditionConfig-B4Ffpgj3.js.map +0 -1
  172. package/dist/ConditionConfig.css +0 -1
  173. package/dist/EventConfigurations-BJcURufo.js +0 -449
  174. package/dist/EventConfigurations-BJcURufo.js.map +0 -1
  175. package/dist/EventsExceptionModal-BlZtBQoR.js +0 -200
  176. package/dist/EventsExceptionModal-BlZtBQoR.js.map +0 -1
  177. package/dist/EventsSkeleton-DK6JDKAK.js +0 -83
  178. package/dist/EventsSkeleton-DK6JDKAK.js.map +0 -1
  179. package/dist/FeatureMenu-C3503UIX.js +0 -265
  180. package/dist/FeatureMenu-C3503UIX.js.map +0 -1
  181. package/dist/FlywayQuery-Cx2sly6g.js +0 -169
  182. package/dist/FlywayQuery-Cx2sly6g.js.map +0 -1
  183. package/dist/ImmunizationConfigurationBase-DLQVSNnt.js +0 -5895
  184. package/dist/ImmunizationConfigurationBase-DLQVSNnt.js.map +0 -1
  185. package/dist/ImmunizationConfigurationsList-DdSZicTP.js +0 -344
  186. package/dist/ImmunizationConfigurationsList-DdSZicTP.js.map +0 -1
  187. package/dist/LanguagesModal-D6VfaGrl.js +0 -394
  188. package/dist/LanguagesModal-D6VfaGrl.js.map +0 -1
  189. package/dist/ManageDynamicFeature-dt096fyj.js +0 -4189
  190. package/dist/ManageDynamicFeature-dt096fyj.js.map +0 -1
  191. package/dist/ManageEventConfiguration-BpSJszSX.js +0 -1017
  192. package/dist/ManageEventConfiguration-BpSJszSX.js.map +0 -1
  193. package/dist/ManageTranslation-B4C9-lWD.js +0 -625
  194. package/dist/ManageTranslation-B4C9-lWD.js.map +0 -1
  195. package/dist/MobileMenuManagement-Cf8IZlla.js +0 -108
  196. package/dist/MobileMenuManagement-Cf8IZlla.js.map +0 -1
  197. package/dist/MobileTypeEventConfigModal-DUkUYACe.js +0 -783
  198. package/dist/MobileTypeEventConfigModal-DUkUYACe.js.map +0 -1
  199. package/dist/NotificationFlywayQuery-BY8Zzml_.js +0 -244
  200. package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +0 -1
  201. package/dist/OtherTypeEventConfigModal-CYBfr2XE.js +0 -2046
  202. package/dist/OtherTypeEventConfigModal-CYBfr2XE.js.map +0 -1
  203. package/dist/QueryBuilder-z7eqfd7D.js +0 -383
  204. package/dist/QueryBuilder-z7eqfd7D.js.map +0 -1
  205. package/dist/RoleManagement-DEiBNfT8.js.map +0 -1
  206. package/dist/ShowFlywayQuery-DVRCd384.js.map +0 -1
  207. package/dist/ShowFlywayQuery-tj42YQAS.js +0 -130
  208. package/dist/ShowFlywayQuery-tj42YQAS.js.map +0 -1
  209. package/dist/ShowQueryHistory-BDN0tzHg.js +0 -190
  210. package/dist/ShowQueryHistory-BDN0tzHg.js.map +0 -1
  211. package/dist/SubMenu-B072oEGb.js +0 -191
  212. package/dist/SubMenu-B072oEGb.js.map +0 -1
  213. package/dist/TypeConfiguration-C3xoP2Nb.js +0 -117
  214. package/dist/TypeConfiguration-C3xoP2Nb.js.map +0 -1
  215. package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +0 -1
  216. package/dist/index.lib-C3fwoM3y.js +0 -820
  217. package/dist/index.lib-C3fwoM3y.js.map +0 -1
@@ -0,0 +1,1216 @@
1
+ import { jsxs as l, Fragment as bt, jsx as t } from "react/jsx-runtime";
2
+ import { b as Ct, c as Tt, d as xt, u as Et, s as It } from "./EventConfig-BY2cgGyx.js";
3
+ import { retrieveAllNotifications as Rt, getReportsList as Mt } from "@/common/services/GlobalApis";
4
+ import { showToast as L } from "@/common/toaster/toaster";
5
+ import Dt from "@/views/custom-components/CustomTextArea";
6
+ import P from "@/views/custom-components/CustomTextField";
7
+ import { yupResolver as qt } from "@hookform/resolvers/yup";
8
+ import F from "@/views/custom-components/CustomDropdown";
9
+ import Nt from "@/views/custom-components/PostgresEditor";
10
+ import { Box as h, Paper as re, Typography as R, Divider as we, Button as Y, Tooltip as V, IconButton as K, Chip as Oe, Collapse as St } from "@mui/material";
11
+ import v from "@mui/material/Grid2";
12
+ import { useRef as ze, useState as g, useEffect as Ae, useMemo as J, Suspense as _e, lazy as le } from "react";
13
+ import { useForm as wt } from "react-hook-form";
14
+ import { useNavigate as Ot } from "react-router";
15
+ import { useParams as zt } from "react-router-dom";
16
+ import * as M from "yup";
17
+ import { useTranslateProvider as At } from "@/common/languageTranslator/TranslationContext";
18
+ import _t from "@/hooks/useTrackEvent";
19
+ import { useDebounceFn as kt } from "@/hooks/useDebounceFn";
20
+ import { E as Wt, T as $t, d as Lt, e as se, F as C, f as G, b as Pt, I as Ft, l as Yt, A as Ut, i as Bt } from "./EventsUi-D6O9S7BK.js";
21
+ import D from "@/common/fontAwesomeIcons/FontAwesomeIcons";
22
+ import jt from "@/views/custom-components/CustomConfirmationModal";
23
+ import './ManageEventConfiguration.css';const Ht = le(() => import("./ConditionConfig-BQBmBHaM.js")), Qt = le(
24
+ () => import("./MobileTypeEventConfigModal-CMcj7Ozp.js")
25
+ ), Vt = le(
26
+ () => import("./OtherTypeEventConfigModal-stNmuSv_.js")
27
+ );
28
+ function vn() {
29
+ var qe, Ne;
30
+ const { translate: i } = At(), de = ze(null), ce = ze(!1), { id: A } = zt(), ue = Ot(), [_, ke] = g(null), [me, We] = g(null), [fe, $e] = g({}), [u, I] = g(
31
+ []
32
+ ), [pe, Le] = g(null), [X, Pe] = g(null), [Fe, ge] = g(null), [Ye, Ue] = g(null), [q, k] = g(null), [Be, he] = g(null), [je, He] = g(null), [N, S] = g(null), [ye, Qe] = g(!1), [ve, be] = g(!1), [Ce, Z] = g(!1), [U, w] = g([]), [Ve, B] = g(!1), [Ke, Je] = g([]), [ee, j] = g({}), [W, te] = g({}), [H, ne] = g(null), Te = () => Qe(!ye), Ge = M.object().shape({
33
+ name: M.string().required("Enter Name"),
34
+ eventType: M.string().required("Select Event Type"),
35
+ recursionInterval: M.number().typeError("Recursion Interval must be a number").when([], {
36
+ is: () => y === "RECURSION",
37
+ then: (e) => e.required("Recursion Interval is required").moreThan(0, "Recursion Interval must be greater than or equal to 1").lessThan(1441, "Recursion Interval must be less than or equal to 1440"),
38
+ otherwise: (e) => e.notRequired()
39
+ }),
40
+ trigerWhen: M.string().test(
41
+ "is-required",
42
+ "trigerWhen is required",
43
+ function(e) {
44
+ return y === "TIMMER_BASED" ? !!e : !0;
45
+ }
46
+ ),
47
+ day: M.string().test("is-required", "day is required", function(e) {
48
+ return y === "TIMMER_BASED" && (T === "AFTER" || T === "MONTHLY") ? !!e : !0;
49
+ }),
50
+ hour: M.string().test(
51
+ "is-required",
52
+ "hour is required",
53
+ function(e) {
54
+ return y === "TIMMER_BASED" && (T === "AFTER" || T === "MONTHLY" || T === "DAILY") ? !!e : !0;
55
+ }
56
+ ),
57
+ minute: M.string().notRequired()
58
+ }), {
59
+ control: x,
60
+ handleSubmit: Xe,
61
+ setValue: ie,
62
+ watch: xe,
63
+ formState: { errors: E, isSubmitting: Ze }
64
+ } = wt({
65
+ defaultValues: {
66
+ name: "",
67
+ description: "",
68
+ eventType: "",
69
+ recursionInterval: 0,
70
+ minute: 0
71
+ },
72
+ resolver: qt(Ge),
73
+ mode: "onChange"
74
+ }), y = xe("eventType");
75
+ let T = xe("trigerWhen");
76
+ Ae(() => {
77
+ let e = de.current;
78
+ return () => {
79
+ ae("conversion_event", {
80
+ form: e,
81
+ form_name: "Manage Event Configuration",
82
+ submit: ce.current
83
+ });
84
+ };
85
+ }, []);
86
+ const et = async (e) => {
87
+ try {
88
+ if (u.length > 0) {
89
+ if (u.some(
90
+ (o) => !o.query
91
+ )) {
92
+ const o = {};
93
+ u.forEach((c, f) => {
94
+ c.query || (o[f] = "Query Required");
95
+ }), j(o), L({
96
+ message: "Every configuration needs a query before you can save.",
97
+ type: "warn"
98
+ });
99
+ return;
100
+ }
101
+ e.minute = Number(e.minute || 0), e.notificationConfigDetails = u;
102
+ const a = y === "TIMMER_BASED", d = y === "FORM_SUBMITTED", p = y === "MANUAL", r = y === "RECURSION";
103
+ a || (delete e.trigerWhen, delete e.day, delete e.hour, delete e.minute), d || delete e.formTypeId, !d && !p && (delete e.eventTypeDetailCode, delete e.eventTypeDetailId), r ? (delete e.formTypeId, e.trigerWhen = "RECURSION") : delete e.recursionInterval;
104
+ const m = ["AFTER", "MONTHLY", "WEEKLY"], b = ["AFTER", "MONTHLY", "DAILY", "WEEKLY"];
105
+ m.includes(T) || delete e.day, b.includes(T) || (delete e.day, delete e.hour), T === "IMMEDIATELY" && (delete e.day, delete e.hour, delete e.minute);
106
+ const s = u.map((o) => {
107
+ var c;
108
+ return {
109
+ ...o,
110
+ conditions: (c = o.conditions) == null ? void 0 : c.map((f) => ({
111
+ ...f,
112
+ notificaitonConfigsType: f.notificaitonConfigsType ? f.notificaitonConfigsType.map((O) => ({
113
+ ...O,
114
+ queryCode: O.queryCode === "" ? null : O.queryCode
115
+ })) : f.notificaitonConfigsType
116
+ }))
117
+ };
118
+ });
119
+ e.notificationConfigDetails = s, A ? await Et(e) : await It(e), ae("button_click", {
120
+ button_name: "manageeventconfiguration-save-button",
121
+ button_type: "submit",
122
+ button_id: "manageeventconfiguration-save-button"
123
+ }), L({
124
+ message: A ? "Event updated successfully" : "Event created successfully",
125
+ type: "success"
126
+ }), ce.current = !0, ue("/ui/medplat/notification/all");
127
+ } else
128
+ L({
129
+ message: "Add at least one configuration before saving.",
130
+ type: "warn"
131
+ });
132
+ } catch {
133
+ L({
134
+ message: "Could not save this event. Please try again.",
135
+ type: "error"
136
+ }), B((n) => !n);
137
+ }
138
+ };
139
+ Ae(() => {
140
+ tt();
141
+ }, []);
142
+ const tt = async () => {
143
+ var e, n, a, d;
144
+ try {
145
+ B((o) => !o);
146
+ const p = await Ct({ is_active: !0 });
147
+ ke(p == null ? void 0 : p.data);
148
+ const r = await Tt();
149
+ We(r == null ? void 0 : r.data);
150
+ const m = await Rt(!0);
151
+ let b = {};
152
+ (e = m == null ? void 0 : m.data) == null || e.forEach((o) => {
153
+ b[o == null ? void 0 : o.id] = o == null ? void 0 : o.notificationName;
154
+ }), $e(b);
155
+ const { data: s } = await Mt();
156
+ if (Je(s || []), A) {
157
+ const o = await xt(A);
158
+ (a = (n = o == null ? void 0 : o.data) == null ? void 0 : n.notificationConfigDetails) == null || a.forEach((f) => {
159
+ Ee(f);
160
+ });
161
+ let c = o == null ? void 0 : o.data;
162
+ (d = Object.keys(c)) == null || d.forEach((f) => {
163
+ c[f] !== void 0 && c[f] !== null && ie(f, c[f]);
164
+ }), I((c == null ? void 0 : c.notificationConfigDetails) || []);
165
+ }
166
+ B((o) => !o);
167
+ } catch (p) {
168
+ L({
169
+ message: "Could not load this event. Please try again.",
170
+ type: `Error:${p == null ? void 0 : p.message}`
171
+ }), B((r) => !r);
172
+ }
173
+ }, Ee = (e) => {
174
+ e.implicitParam = ["#resourceId#"];
175
+ const n = [
176
+ "from",
177
+ "where",
178
+ "group",
179
+ "having",
180
+ "order",
181
+ "limit",
182
+ "offset",
183
+ "union",
184
+ "intersect",
185
+ "except",
186
+ "window",
187
+ "fetch",
188
+ "into",
189
+ "returning"
190
+ ];
191
+ if (e != null && e.query) {
192
+ let a = "", d = null;
193
+ for (let s = 0; s < e.query.length; s++) {
194
+ const o = e.query[s], c = e.query[s + 1];
195
+ if (d)
196
+ a += o, o === d && (d = null);
197
+ else if (o === "'" || o === '"')
198
+ d = o, a += o;
199
+ else if (o === "-" && c === "-") {
200
+ for (; s < e.query.length && e.query[s] !== `
201
+ `; )
202
+ s++;
203
+ a += `
204
+ `;
205
+ } else if (o === "/" && c === "*") {
206
+ for (s += 2; s < e.query.length && !(e.query[s] === "*" && e.query[s + 1] === "/"); )
207
+ s++;
208
+ s++, a += " ";
209
+ } else
210
+ a += o;
211
+ }
212
+ let p = 0;
213
+ d = null;
214
+ let r = -1, m = -1;
215
+ const b = [];
216
+ for (let s = 0; s < a.length; s++) {
217
+ const o = a[s];
218
+ if (d)
219
+ o === d && (d = null);
220
+ else if (o === "'" || o === '"')
221
+ d = o;
222
+ else if (o === "(")
223
+ p++;
224
+ else if (o === ")")
225
+ p--;
226
+ else if (p === 0) {
227
+ if (o === ";" && r >= 0) {
228
+ m = s;
229
+ break;
230
+ } else if (o === "," && r >= 0)
231
+ b.push(s);
232
+ else if (/[a-z_]/i.test(o) && !/[\w.]/.test(a[s - 1] || "")) {
233
+ const c = (a.slice(s).match(/^[a-z_]+/i) || [""])[0];
234
+ if (r < 0)
235
+ c.toLowerCase() === "select" && (r = s + c.length), s += c.length - 1;
236
+ else if (n.includes(c.toLowerCase())) {
237
+ m = s;
238
+ break;
239
+ } else
240
+ s += c.length - 1;
241
+ }
242
+ }
243
+ }
244
+ if (r >= 0) {
245
+ m < 0 && (m = a.length);
246
+ const s = [];
247
+ let o = r;
248
+ b.filter((c) => c < m).forEach((c) => {
249
+ s.push(a.substring(o, c)), o = c + 1;
250
+ }), s.push(a.substring(o, m)), s.forEach((c) => {
251
+ const f = c.replace(/^\s*(distinct\s+on\s*\([\s\S]*?\)|distinct|all)\s+/i, "").trim();
252
+ if (f && f !== "*" && !f.endsWith(".*")) {
253
+ let O = 0, Q = null, oe = -1;
254
+ for (let $ = 0; $ < f.length; $++) {
255
+ const z = f[$];
256
+ Q ? z === Q && (Q = null) : z === "'" || z === '"' ? Q = z : z === "(" ? O++ : z === ")" ? O-- : O === 0 && /\s/.test(z) && /^as\s/i.test(f.substring($ + 1)) && (oe = $ + 1);
257
+ }
258
+ const Se = (oe >= 0 ? f.substring(oe + 3).trim() : f.replace(/\s+/g, " ").trim()).replace(/^"|"$/g, "");
259
+ /^[a-z_][\w$]*(\.[a-z_][\w$]*)*$/i.test(Se) && e.implicitParam.push("#" + Se + "#");
260
+ }
261
+ });
262
+ }
263
+ }
264
+ }, nt = (e) => {
265
+ const n = u == null ? void 0 : u.filter(
266
+ (a, d) => d !== e
267
+ );
268
+ I(n), j({}), te({});
269
+ }, it = (e, n) => {
270
+ const a = [...u], d = a[e].conditions.filter((p, r) => r !== n);
271
+ a[e].conditions = d, I(a);
272
+ }, Ie = async (e, n, a, d) => {
273
+ Pe(e), Le(n), a ? (ge(a), he(!0), k(JSON.parse(JSON.stringify(a))), w((a == null ? void 0 : a.notificaitonConfigsType) || []), Ue(d)) : (ge({}), k({}), w([]), he(!1)), S({}), Te();
274
+ }, at = (e, n) => {
275
+ const a = [...u];
276
+ a[e].query = n, I(a), j((d) => {
277
+ const p = { ...d };
278
+ return n ? delete p[e] : p[e] = "Query Required", p;
279
+ });
280
+ }, ot = kt((e) => {
281
+ I((n) => {
282
+ const a = [...n];
283
+ return a[e] && Ee(a[e]), a;
284
+ });
285
+ }, 400), Re = async () => {
286
+ const e = {};
287
+ if (u.forEach((n, a) => {
288
+ n.query || (e[a] = "Query Required");
289
+ }), Object.keys(e).length > 0) {
290
+ j(e);
291
+ return;
292
+ }
293
+ I([
294
+ ...u,
295
+ { query: "", conditions: [], queryParam: null }
296
+ ]), te({});
297
+ }, Me = async (e, n) => {
298
+ e ? (e.index = n, He(e), S({
299
+ ...JSON.parse(JSON.stringify(e)),
300
+ implicitParam: X.implicitParam
301
+ }), be(!0)) : (S({ ...N, implicitParam: X.implicitParam }), be(!1)), rt();
302
+ }, rt = () => {
303
+ Z((e) => !e);
304
+ }, De = (e) => {
305
+ if (ve) {
306
+ const n = U.map((a, d) => d === e.index ? { ...a, ...e } : a);
307
+ w(n);
308
+ } else
309
+ w([...U, e]);
310
+ dt(e);
311
+ }, st = (e) => {
312
+ w(
313
+ (n) => n.filter((a, d) => d !== e)
314
+ );
315
+ }, lt = (e) => {
316
+ Me(U[e], e);
317
+ }, dt = (e) => {
318
+ let n = { ...q };
319
+ q.notificaitonConfigsType || (n.notificaitonConfigsType = []), ve ? n.notificaitonConfigsType[je.index] = e : n.notificaitonConfigsType.push(e), k(n), S({});
320
+ }, ae = _t(), ct = (e) => {
321
+ if (Be) {
322
+ const n = [...u];
323
+ k({ ...q, ...e });
324
+ let a = { ...q, ...e };
325
+ n[pe].conditions[Ye] = a, I(n), w([]);
326
+ } else {
327
+ const n = [...u];
328
+ k({ ...q, ...e });
329
+ let a = { ...q, ...e };
330
+ n[pe].conditions.push(a), I(n), w([]);
331
+ }
332
+ }, ut = (e) => {
333
+ S({ ...N, ...e });
334
+ }, mt = J(
335
+ () => Wt.map((e) => ({
336
+ value: e.value,
337
+ label: i(e.label)
338
+ })),
339
+ [i]
340
+ ), ft = J(
341
+ () => $t.map((e) => ({
342
+ value: e.value,
343
+ label: i(e.label)
344
+ })),
345
+ [i]
346
+ ), pt = J(
347
+ () => (_ || []).map((e) => ({ value: e.id, label: e.name })),
348
+ [_]
349
+ ), gt = J(
350
+ () => Object.entries(me || {}).map(([e, n]) => ({ value: e, label: n })),
351
+ [me]
352
+ ), ht = y === "TIMMER_BASED" && ["AFTER", "MONTHLY", "WEEKLY"].includes(T), yt = y === "TIMMER_BASED" && ["AFTER", "MONTHLY", "DAILY", "WEEKLY"].includes(T), vt = y === "TIMMER_BASED" && T && T !== "IMMEDIATELY";
353
+ return /* @__PURE__ */ l(bt, { children: [
354
+ /* @__PURE__ */ t(
355
+ h,
356
+ {
357
+ component: "form",
358
+ ref: de,
359
+ onSubmit: Xe(et),
360
+ "data-testid": "manageeventconfiguration-form",
361
+ sx: { display: "block", pb: 2 },
362
+ children: /* @__PURE__ */ l(Lt, { isLoading: Ve, children: [
363
+ /* @__PURE__ */ t(
364
+ re,
365
+ {
366
+ elevation: 0,
367
+ sx: {
368
+ p: { xs: 2.5, md: 3 },
369
+ mt: 2,
370
+ mb: 3,
371
+ border: "1px solid",
372
+ borderColor: "divider",
373
+ borderRadius: (e) => `${e.shape.cardRadius}px`,
374
+ backgroundColor: "background.paper"
375
+ },
376
+ children: /* @__PURE__ */ l(h, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
377
+ /* @__PURE__ */ t(
378
+ h,
379
+ {
380
+ sx: {
381
+ display: "flex",
382
+ justifyContent: "space-between",
383
+ alignItems: "flex-start",
384
+ flexWrap: "wrap",
385
+ gap: 2
386
+ },
387
+ "data-testid": "manageeventconfiguration-cardheader-subheader",
388
+ children: /* @__PURE__ */ l(h, { sx: { minWidth: { xs: "100%", lg: "50%" } }, children: [
389
+ /* @__PURE__ */ t(
390
+ R,
391
+ {
392
+ variant: "h5",
393
+ component: "h1",
394
+ sx: { fontWeight: 800, color: "text.primary", mb: 0.5 },
395
+ children: i(A ? "Update event" : "New event")
396
+ }
397
+ ),
398
+ /* @__PURE__ */ t(R, { variant: "body2", color: "text.secondary", children: i(
399
+ "Name the event, choose what triggers it, then add the queries and conditions that decide what happens."
400
+ ) })
401
+ ] })
402
+ }
403
+ ),
404
+ /* @__PURE__ */ l(h, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
405
+ /* @__PURE__ */ t(se, { children: i("Event details") }),
406
+ /* @__PURE__ */ l(v, { container: !0, spacing: 2, alignItems: "flex-start", children: [
407
+ /* @__PURE__ */ l(
408
+ v,
409
+ {
410
+ size: { xs: 12, md: 6 },
411
+ "data-testid": "manageeventconfiguration-name-field",
412
+ children: [
413
+ /* @__PURE__ */ t(C, { required: !0, children: i("Name") }),
414
+ /* @__PURE__ */ t(
415
+ P,
416
+ {
417
+ control: x,
418
+ id: "name",
419
+ name: "name",
420
+ errors: E,
421
+ label: "",
422
+ size: "small",
423
+ dataTestId: "manageeventconfiguration-name-textfield"
424
+ }
425
+ )
426
+ ]
427
+ }
428
+ ),
429
+ /* @__PURE__ */ l(
430
+ v,
431
+ {
432
+ size: { xs: 12, md: 6 },
433
+ "data-testid": "manageeventconfiguration-description-field",
434
+ children: [
435
+ /* @__PURE__ */ t(C, { children: i("Description") }),
436
+ /* @__PURE__ */ t(
437
+ Dt,
438
+ {
439
+ control: x,
440
+ id: "description",
441
+ name: "description",
442
+ errors: E,
443
+ label: "",
444
+ minRows: 2,
445
+ "data-testid": "manageeventconfiguration-description-textarea"
446
+ }
447
+ ),
448
+ /* @__PURE__ */ t(G, { children: i("What this event is for, in one line") })
449
+ ]
450
+ }
451
+ )
452
+ ] })
453
+ ] }),
454
+ /* @__PURE__ */ t(we, {}),
455
+ /* @__PURE__ */ l(h, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
456
+ /* @__PURE__ */ t(
457
+ se,
458
+ {
459
+ hint: i("What makes this event run"),
460
+ children: i("Trigger")
461
+ }
462
+ ),
463
+ /* @__PURE__ */ l(v, { container: !0, spacing: 2, alignItems: "flex-start", children: [
464
+ /* @__PURE__ */ l(
465
+ v,
466
+ {
467
+ size: { xs: 12, md: 6 },
468
+ "data-testid": "manageeventconfiguration-eventtype-field",
469
+ children: [
470
+ /* @__PURE__ */ t(C, { required: !0, children: i("Event Type") }),
471
+ /* @__PURE__ */ t(
472
+ F,
473
+ {
474
+ control: x,
475
+ name: "eventType",
476
+ options: mt,
477
+ displayName: "label",
478
+ optionValue: "value",
479
+ errors: E,
480
+ dataTestId: "manageeventconfiguration-eventtype-select"
481
+ }
482
+ )
483
+ ]
484
+ }
485
+ ),
486
+ y === "FORM_SUBMITTED" && /* @__PURE__ */ l(
487
+ v,
488
+ {
489
+ size: { xs: 12, md: 6 },
490
+ "data-testid": "manageeventconfiguration-formtype-field",
491
+ children: [
492
+ /* @__PURE__ */ t(C, { children: i("Form Type") }),
493
+ /* @__PURE__ */ t(
494
+ F,
495
+ {
496
+ control: x,
497
+ name: "formTypeId",
498
+ options: pt,
499
+ displayName: "label",
500
+ optionValue: "value",
501
+ errors: E,
502
+ isSortedOptions: !0,
503
+ onChange: (e) => {
504
+ const n = _ == null ? void 0 : _.find(
505
+ (a) => {
506
+ var d;
507
+ return a.id === ((d = e == null ? void 0 : e.target) == null ? void 0 : d.value);
508
+ }
509
+ );
510
+ ie("eventTypeDetailCode", n == null ? void 0 : n.code), ie(
511
+ "eventTypeDetailId",
512
+ (n == null ? void 0 : n.detaiId) || null
513
+ );
514
+ },
515
+ dataTestId: "manageeventconfiguration-formtype-select"
516
+ }
517
+ )
518
+ ]
519
+ }
520
+ ),
521
+ y === "TIMMER_BASED" && /* @__PURE__ */ l(
522
+ v,
523
+ {
524
+ size: { xs: 12, md: 6 },
525
+ "data-testid": "manageeventconfiguration-triggerwhen-field",
526
+ children: [
527
+ /* @__PURE__ */ t(C, { required: !0, children: i("Trigger When") }),
528
+ /* @__PURE__ */ t(
529
+ F,
530
+ {
531
+ control: x,
532
+ name: "trigerWhen",
533
+ options: ft,
534
+ displayName: "label",
535
+ optionValue: "value",
536
+ errors: E,
537
+ dataTestId: "manageeventconfiguration-triggerwhen-select"
538
+ }
539
+ )
540
+ ]
541
+ }
542
+ ),
543
+ ht && /* @__PURE__ */ l(
544
+ v,
545
+ {
546
+ size: { xs: 12, md: 6 },
547
+ "data-testid": "manageeventconfiguration-day-field",
548
+ children: [
549
+ /* @__PURE__ */ t(C, { required: !0, children: i("Day") }),
550
+ /* @__PURE__ */ t(
551
+ P,
552
+ {
553
+ control: x,
554
+ id: "day",
555
+ name: "day",
556
+ errors: E,
557
+ type: "number",
558
+ label: "",
559
+ size: "small",
560
+ dataTestId: "manageeventconfiguration-day-textfield"
561
+ }
562
+ )
563
+ ]
564
+ }
565
+ ),
566
+ yt && /* @__PURE__ */ l(
567
+ v,
568
+ {
569
+ size: { xs: 12, md: 6 },
570
+ "data-testid": "manageeventconfiguration-hour-field",
571
+ children: [
572
+ /* @__PURE__ */ t(C, { required: !0, children: i("Hour") }),
573
+ /* @__PURE__ */ t(
574
+ P,
575
+ {
576
+ control: x,
577
+ id: "hour",
578
+ name: "hour",
579
+ type: "number",
580
+ errors: E,
581
+ label: "",
582
+ size: "small",
583
+ dataTestId: "manageeventconfiguration-hour-textfield"
584
+ }
585
+ )
586
+ ]
587
+ }
588
+ ),
589
+ vt && /* @__PURE__ */ l(
590
+ v,
591
+ {
592
+ size: { xs: 12, md: 6 },
593
+ "data-testid": "manageeventconfiguration-minute-field",
594
+ children: [
595
+ /* @__PURE__ */ t(C, { children: i("Minute") }),
596
+ /* @__PURE__ */ t(
597
+ P,
598
+ {
599
+ control: x,
600
+ id: "minute",
601
+ name: "minute",
602
+ errors: E,
603
+ type: "number",
604
+ label: "",
605
+ size: "small",
606
+ dataTestId: "manageeventconfiguration-minute-textfield"
607
+ }
608
+ )
609
+ ]
610
+ }
611
+ ),
612
+ y === "RECURSION" && /* @__PURE__ */ l(v, { size: { xs: 12, md: 6 }, children: [
613
+ /* @__PURE__ */ t(C, { required: !0, children: i("Recursion Interval (in Minutes)") }),
614
+ /* @__PURE__ */ t(
615
+ P,
616
+ {
617
+ type: "number",
618
+ control: x,
619
+ id: "recursionInterval",
620
+ name: "recursionInterval",
621
+ errors: E,
622
+ label: "",
623
+ size: "small",
624
+ dataTestId: "manageeventconfiguration-recursionInterval-textfield"
625
+ }
626
+ ),
627
+ /* @__PURE__ */ t(G, { children: i("Between 1 and 1440 minutes") })
628
+ ] }),
629
+ (y === "TIMMER_BASED" || y === "RECURSION") && /* @__PURE__ */ l(v, { size: { xs: 12, md: 6 }, children: [
630
+ /* @__PURE__ */ t(C, { children: i("Reports") }),
631
+ /* @__PURE__ */ t(
632
+ F,
633
+ {
634
+ id: "reportUUID",
635
+ name: "reportUUID",
636
+ displayName: "name",
637
+ optionValue: "uuid",
638
+ multiple: !0,
639
+ control: x,
640
+ options: Ke,
641
+ errors: E
642
+ }
643
+ ),
644
+ /* @__PURE__ */ t(G, { children: i("Reports refreshed after each run") })
645
+ ] }),
646
+ y === "MANUAL" && /* @__PURE__ */ l(
647
+ v,
648
+ {
649
+ size: { xs: 12, md: 6 },
650
+ "data-testid": "manageeventconfiguration-event-field",
651
+ children: [
652
+ /* @__PURE__ */ t(C, { children: i("Event") }),
653
+ /* @__PURE__ */ t(
654
+ F,
655
+ {
656
+ control: x,
657
+ name: "eventTypeDetailCode",
658
+ options: gt,
659
+ displayName: "label",
660
+ optionValue: "value",
661
+ errors: E,
662
+ dataTestId: "manageeventconfiguration-eventtype-detail-select"
663
+ }
664
+ )
665
+ ]
666
+ }
667
+ )
668
+ ] })
669
+ ] }),
670
+ /* @__PURE__ */ t(we, {}),
671
+ /* @__PURE__ */ l(h, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
672
+ /* @__PURE__ */ l(
673
+ h,
674
+ {
675
+ sx: {
676
+ display: "flex",
677
+ justifyContent: "space-between",
678
+ alignItems: "flex-start",
679
+ flexWrap: "wrap",
680
+ gap: 2
681
+ },
682
+ children: [
683
+ /* @__PURE__ */ t(
684
+ se,
685
+ {
686
+ hint: i(
687
+ "Each configuration runs a query, then acts on the rows it returns."
688
+ ),
689
+ children: i("Configurations")
690
+ }
691
+ ),
692
+ /* @__PURE__ */ t(
693
+ Y,
694
+ {
695
+ size: "small",
696
+ variant: "outlined",
697
+ startIcon: /* @__PURE__ */ t(D, { iconName: "faPlus" }),
698
+ onClick: Re,
699
+ "data-testid": "manageeventconfiguration-add-button",
700
+ children: i("Add configuration")
701
+ }
702
+ )
703
+ ]
704
+ }
705
+ ),
706
+ /* @__PURE__ */ l(
707
+ h,
708
+ {
709
+ sx: { display: "flex", flexDirection: "column", gap: 2 },
710
+ "data-testid": "manageeventconfiguration-table-container",
711
+ children: [
712
+ (u == null ? void 0 : u.length) === 0 && /* @__PURE__ */ t(
713
+ Pt,
714
+ {
715
+ icon: "faDatabase",
716
+ title: i("No configurations yet"),
717
+ body: i(
718
+ "Add a configuration to write the query this event runs and the actions it triggers."
719
+ ),
720
+ action: /* @__PURE__ */ t(
721
+ Y,
722
+ {
723
+ size: "small",
724
+ variant: "contained",
725
+ startIcon: /* @__PURE__ */ t(D, { iconName: "faPlus" }),
726
+ onClick: Re,
727
+ children: i("Add configuration")
728
+ }
729
+ ),
730
+ dataTestId: "manageeventconfiguration-no-configurations"
731
+ }
732
+ ),
733
+ u == null ? void 0 : u.map((e, n) => {
734
+ var a, d, p;
735
+ return /* @__PURE__ */ l(
736
+ re,
737
+ {
738
+ elevation: 0,
739
+ variant: "outlined",
740
+ sx: {
741
+ p: 2,
742
+ borderRadius: (r) => `${r.shape.cardRadius}px`,
743
+ display: "flex",
744
+ flexDirection: "column",
745
+ gap: 2
746
+ },
747
+ "data-testid": `manageeventconfiguration-table-row-${n}`,
748
+ children: [
749
+ /* @__PURE__ */ l(
750
+ h,
751
+ {
752
+ sx: {
753
+ display: "flex",
754
+ justifyContent: "space-between",
755
+ alignItems: "center",
756
+ gap: 2,
757
+ flexWrap: "wrap"
758
+ },
759
+ children: [
760
+ /* @__PURE__ */ l(
761
+ h,
762
+ {
763
+ sx: {
764
+ display: "flex",
765
+ alignItems: "center",
766
+ gap: 1,
767
+ flexWrap: "wrap"
768
+ },
769
+ children: [
770
+ /* @__PURE__ */ t(
771
+ V,
772
+ {
773
+ title: W[n] ? i("Expand") : i("Collapse"),
774
+ children: /* @__PURE__ */ t(
775
+ K,
776
+ {
777
+ size: "small",
778
+ onClick: () => te((r) => ({
779
+ ...r,
780
+ [n]: !r[n]
781
+ })),
782
+ "aria-expanded": !W[n],
783
+ "aria-label": W[n] ? i("Expand") : i("Collapse"),
784
+ "data-testid": `manageeventconfiguration-table-row-${n}-collapse`,
785
+ children: /* @__PURE__ */ t(
786
+ D,
787
+ {
788
+ iconName: W[n] ? "faChevronRight" : "faChevronDown",
789
+ size: "sm"
790
+ }
791
+ )
792
+ }
793
+ )
794
+ }
795
+ ),
796
+ /* @__PURE__ */ l(
797
+ R,
798
+ {
799
+ variant: "subtitle2",
800
+ sx: { fontWeight: 700 },
801
+ children: [
802
+ i("Configuration"),
803
+ " ",
804
+ n + 1
805
+ ]
806
+ }
807
+ ),
808
+ !(e != null && e.query) && /* @__PURE__ */ t(
809
+ Oe,
810
+ {
811
+ size: "small",
812
+ color: "warning",
813
+ variant: "outlined",
814
+ label: i("Query missing")
815
+ }
816
+ ),
817
+ /* @__PURE__ */ l(R, { variant: "caption", color: "text.secondary", children: [
818
+ ((a = e == null ? void 0 : e.conditions) == null ? void 0 : a.length) || 0,
819
+ " ",
820
+ i("conditions"),
821
+ " · ",
822
+ ((e == null ? void 0 : e.conditions) || []).reduce(
823
+ (r, m) => {
824
+ var b;
825
+ return r + (((b = m == null ? void 0 : m.notificaitonConfigsType) == null ? void 0 : b.length) || 0);
826
+ },
827
+ 0
828
+ ),
829
+ " ",
830
+ i("actions")
831
+ ] })
832
+ ]
833
+ }
834
+ ),
835
+ /* @__PURE__ */ t(
836
+ h,
837
+ {
838
+ "data-testid": `manageeventconfiguration-table-row-${n}-action`,
839
+ children: /* @__PURE__ */ t(V, { title: i("Delete configuration"), children: /* @__PURE__ */ t(
840
+ K,
841
+ {
842
+ size: "small",
843
+ color: "error",
844
+ onClick: () => ne(n),
845
+ "aria-label": i("Delete configuration"),
846
+ "data-testid": `manageeventconfiguration-table-row-${n}-action-delete`,
847
+ children: /* @__PURE__ */ t(D, { iconName: "faTrash" })
848
+ }
849
+ ) })
850
+ }
851
+ )
852
+ ]
853
+ }
854
+ ),
855
+ /* @__PURE__ */ t(
856
+ St,
857
+ {
858
+ in: !W[n],
859
+ unmountOnExit: !1,
860
+ children: /* @__PURE__ */ l(v, { container: !0, spacing: 2, alignItems: "stretch", children: [
861
+ /* @__PURE__ */ l(
862
+ v,
863
+ {
864
+ size: { xs: 12, lg: 6.5 },
865
+ sx: { display: "flex", flexDirection: "column", gap: 1 },
866
+ "data-testid": `manageeventconfiguration-table-row-${n}-query`,
867
+ children: [
868
+ /* @__PURE__ */ t(C, { required: !0, children: /* @__PURE__ */ t("span", { "data-testid": "manageeventconfiguration-table-header-query", children: i("Query") }) }),
869
+ /* @__PURE__ */ t(
870
+ h,
871
+ {
872
+ sx: {
873
+ overflow: "hidden",
874
+ borderRadius: (r) => `${r.shape.borderRadius}px`,
875
+ border: "1px solid",
876
+ borderColor: ee[n] ? "error.main" : "divider"
877
+ },
878
+ "data-testid": `manageeventconfiguration-table-row-${n}-query-textarea`,
879
+ children: /* @__PURE__ */ t(
880
+ Nt,
881
+ {
882
+ height: "30vh",
883
+ autoFocus: !1,
884
+ defaultValue: e.query || "",
885
+ onChange: (r) => {
886
+ at(n, r), ot(n);
887
+ }
888
+ }
889
+ )
890
+ }
891
+ ),
892
+ ee[n] && /* @__PURE__ */ t(
893
+ R,
894
+ {
895
+ variant: "caption",
896
+ color: "error",
897
+ "data-testid": "custom-error-message",
898
+ children: i(ee[n])
899
+ }
900
+ ),
901
+ /* @__PURE__ */ t(G, { children: i(
902
+ "Every column this query selects becomes a placeholder the conditions can use."
903
+ ) }),
904
+ /* @__PURE__ */ t(
905
+ Ft,
906
+ {
907
+ params: e == null ? void 0 : e.implicitParam,
908
+ translate: i
909
+ }
910
+ )
911
+ ]
912
+ }
913
+ ),
914
+ /* @__PURE__ */ l(
915
+ v,
916
+ {
917
+ size: { xs: 12, lg: 5.5 },
918
+ sx: { display: "flex", flexDirection: "column", gap: 1 },
919
+ "data-testid": `manageeventconfiguration-table-row-${n}-condition`,
920
+ children: [
921
+ /* @__PURE__ */ l(
922
+ h,
923
+ {
924
+ sx: {
925
+ display: "flex",
926
+ justifyContent: "space-between",
927
+ alignItems: "center",
928
+ gap: 2
929
+ },
930
+ children: [
931
+ /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t("span", { "data-testid": "manageeventconfiguration-table-header-condition", children: i("Condition") }) }),
932
+ /* @__PURE__ */ t(
933
+ Y,
934
+ {
935
+ size: "small",
936
+ variant: "text",
937
+ startIcon: /* @__PURE__ */ t(D, { iconName: "faPlus", size: "sm" }),
938
+ onClick: () => Ie(e, n),
939
+ "data-testid": ((d = e == null ? void 0 : e.conditions) == null ? void 0 : d.length) > 0 ? `manageeventconfiguration-table-row-${n}-condition-add` : `manageeventconfiguration-table-row-${n}-condition-add-empty`,
940
+ children: i("Add condition")
941
+ }
942
+ )
943
+ ]
944
+ }
945
+ ),
946
+ ((p = e == null ? void 0 : e.conditions) == null ? void 0 : p.length) > 0 ? /* @__PURE__ */ t(
947
+ h,
948
+ {
949
+ sx: {
950
+ display: "flex",
951
+ flexDirection: "column",
952
+ flex: "1 1 auto",
953
+ maxHeight: "30vh",
954
+ overflowY: "auto",
955
+ border: "1px solid",
956
+ borderColor: "divider",
957
+ borderRadius: (r) => `${r.shape.borderRadius}px`
958
+ },
959
+ children: e.conditions.map((r, m) => {
960
+ var b;
961
+ return /* @__PURE__ */ l(
962
+ h,
963
+ {
964
+ sx: {
965
+ display: "flex",
966
+ alignItems: "center",
967
+ justifyContent: "space-between",
968
+ gap: 1,
969
+ px: 1.5,
970
+ py: 1,
971
+ borderTop: m === 0 ? "none" : "1px solid",
972
+ borderColor: "divider"
973
+ },
974
+ "data-testid": "manageeventconfiguration-condition-rows",
975
+ children: [
976
+ /* @__PURE__ */ l(h, { sx: { minWidth: 0 }, children: [
977
+ /* @__PURE__ */ t(
978
+ R,
979
+ {
980
+ variant: "body2",
981
+ sx: {
982
+ fontFamily: r != null && r.condition ? "monospace" : "inherit",
983
+ wordBreak: "break-word"
984
+ },
985
+ children: (r == null ? void 0 : r.condition) || i("Always runs")
986
+ }
987
+ ),
988
+ ((b = r == null ? void 0 : r.notificaitonConfigsType) == null ? void 0 : b.length) > 0 ? /* @__PURE__ */ t(
989
+ h,
990
+ {
991
+ sx: {
992
+ display: "flex",
993
+ flexWrap: "wrap",
994
+ gap: 0.5,
995
+ mt: 0.5
996
+ },
997
+ children: r.notificaitonConfigsType.map(
998
+ (s, o) => /* @__PURE__ */ t(
999
+ Oe,
1000
+ {
1001
+ size: "small",
1002
+ variant: "outlined",
1003
+ icon: /* @__PURE__ */ t(
1004
+ D,
1005
+ {
1006
+ iconName: Bt(s == null ? void 0 : s.type),
1007
+ size: "sm"
1008
+ }
1009
+ ),
1010
+ label: i(
1011
+ Yt(Ut, s == null ? void 0 : s.type)
1012
+ )
1013
+ },
1014
+ o + 1
1015
+ )
1016
+ )
1017
+ }
1018
+ ) : /* @__PURE__ */ t(
1019
+ R,
1020
+ {
1021
+ variant: "caption",
1022
+ color: "warning.main",
1023
+ children: i("No actions")
1024
+ }
1025
+ )
1026
+ ] }),
1027
+ /* @__PURE__ */ l(h, { sx: { display: "flex", gap: 0.5, flexShrink: 0 }, children: [
1028
+ /* @__PURE__ */ t(V, { title: i("Edit condition"), children: /* @__PURE__ */ t(
1029
+ K,
1030
+ {
1031
+ size: "small",
1032
+ "aria-label": i("Edit condition"),
1033
+ onClick: () => Ie(
1034
+ e,
1035
+ n,
1036
+ r,
1037
+ m
1038
+ ),
1039
+ "data-testid": `manageeventconfiguration-table-row-${n}-condition-edit-${m}`,
1040
+ children: /* @__PURE__ */ t(D, { iconName: "faPen", size: "sm" })
1041
+ }
1042
+ ) }),
1043
+ /* @__PURE__ */ t(V, { title: i("Delete condition"), children: /* @__PURE__ */ t(
1044
+ K,
1045
+ {
1046
+ size: "small",
1047
+ color: "error",
1048
+ "aria-label": i("Delete condition"),
1049
+ onClick: () => it(n, m),
1050
+ "data-testid": `manageeventconfiguration-table-row-${n}-condition-delete-${m}`,
1051
+ children: /* @__PURE__ */ t(D, { iconName: "faTrash", size: "sm" })
1052
+ }
1053
+ ) })
1054
+ ] })
1055
+ ]
1056
+ },
1057
+ m + 1
1058
+ );
1059
+ })
1060
+ }
1061
+ ) : /* @__PURE__ */ t(
1062
+ h,
1063
+ {
1064
+ sx: {
1065
+ flex: "1 1 auto",
1066
+ display: "flex",
1067
+ alignItems: "center",
1068
+ justifyContent: "center",
1069
+ textAlign: "center",
1070
+ px: 2,
1071
+ py: 3,
1072
+ border: "1px dashed",
1073
+ borderColor: "divider",
1074
+ borderRadius: (r) => `${r.shape.borderRadius}px`
1075
+ },
1076
+ children: /* @__PURE__ */ t(R, { variant: "body2", color: "text.secondary", children: i(
1077
+ "No conditions yet. Without one, this configuration does nothing."
1078
+ ) })
1079
+ }
1080
+ )
1081
+ ]
1082
+ }
1083
+ )
1084
+ ] })
1085
+ }
1086
+ )
1087
+ ]
1088
+ },
1089
+ n + 1
1090
+ );
1091
+ })
1092
+ ]
1093
+ }
1094
+ )
1095
+ ] })
1096
+ ] })
1097
+ }
1098
+ ),
1099
+ /* @__PURE__ */ l(
1100
+ re,
1101
+ {
1102
+ elevation: 0,
1103
+ sx: {
1104
+ position: "sticky",
1105
+ bottom: 0,
1106
+ zIndex: 2,
1107
+ display: "flex",
1108
+ justifyContent: "flex-end",
1109
+ gap: 1.5,
1110
+ p: 2,
1111
+ border: "1px solid",
1112
+ borderColor: "divider",
1113
+ borderRadius: (e) => `${e.shape.cardRadius}px`,
1114
+ backgroundColor: "background.paper"
1115
+ },
1116
+ "data-testid": "manageeventconfiguration-cardactions",
1117
+ children: [
1118
+ /* @__PURE__ */ t(
1119
+ Y,
1120
+ {
1121
+ variant: "outlined",
1122
+ color: "inherit",
1123
+ type: "button",
1124
+ size: "small",
1125
+ onClick: () => {
1126
+ ae("button_click", {
1127
+ button_name: "manageeventconfiguration-back-button",
1128
+ button_type: "cancel",
1129
+ button_id: "manageeventconfiguration-back-button"
1130
+ }), ue("/ui/medplat/notification/all");
1131
+ },
1132
+ "data-testid": "manageeventconfiguration-back-button",
1133
+ children: i("Cancel")
1134
+ }
1135
+ ),
1136
+ /* @__PURE__ */ t(
1137
+ Y,
1138
+ {
1139
+ size: "small",
1140
+ variant: "contained",
1141
+ type: "submit",
1142
+ color: "primary",
1143
+ disabled: Ze,
1144
+ "data-testid": "manageeventconfiguration-save-button",
1145
+ children: i(`${A ? "Update" : "Save"}`)
1146
+ }
1147
+ )
1148
+ ]
1149
+ }
1150
+ )
1151
+ ] })
1152
+ }
1153
+ ),
1154
+ /* @__PURE__ */ t(
1155
+ jt,
1156
+ {
1157
+ open: H !== null,
1158
+ handleClose: () => ne(null),
1159
+ handleClick: () => {
1160
+ nt(H), ne(null);
1161
+ },
1162
+ title: i("Delete this configuration?"),
1163
+ description: `${i("Configuration")} ${(H ?? 0) + 1}, its query and ${((Ne = (qe = u == null ? void 0 : u[H]) == null ? void 0 : qe.conditions) == null ? void 0 : Ne.length) || 0} ${i(
1164
+ "conditions will be removed. This cannot be undone."
1165
+ )}`,
1166
+ dataTestId: "manageeventconfiguration-delete-configuration-confirmation"
1167
+ }
1168
+ ),
1169
+ /* @__PURE__ */ t(_e, { children: /* @__PURE__ */ t(
1170
+ Ht,
1171
+ {
1172
+ selectedConfig: X,
1173
+ notificationtypeMap: fe,
1174
+ selectedCondition: Fe,
1175
+ newCondition: q,
1176
+ handleTypeConfigurationDelete: st,
1177
+ handleTypeConfigurationEdit: lt,
1178
+ addTypeConfig: Me,
1179
+ setNewConditionData: ct,
1180
+ typeConfigurationData: U,
1181
+ setNewTypeData: ut,
1182
+ overlayOpen: ye,
1183
+ handleOverlayState: Te,
1184
+ "data-testid": "manageeventconfiguration-conditionconfig"
1185
+ }
1186
+ ) }),
1187
+ /* @__PURE__ */ t(_e, { children: (N == null ? void 0 : N.type) === "MOBILE" ? /* @__PURE__ */ t(
1188
+ Qt,
1189
+ {
1190
+ type: N,
1191
+ open: Ce,
1192
+ notificationtypeMap: fe,
1193
+ handleClick: De,
1194
+ handleClose: () => {
1195
+ Z((e) => !e), S({});
1196
+ },
1197
+ "data-testid": "manageeventconfiguration-mobiletypeeventconfigmodal"
1198
+ }
1199
+ ) : /* @__PURE__ */ t(
1200
+ Vt,
1201
+ {
1202
+ type: N,
1203
+ open: Ce,
1204
+ handleClick: De,
1205
+ handleClose: () => {
1206
+ Z((e) => !e), S({});
1207
+ },
1208
+ "data-testid": "manageeventconfiguration-othertypeeventconfigmodal"
1209
+ }
1210
+ ) })
1211
+ ] });
1212
+ }
1213
+ export {
1214
+ vn as default
1215
+ };
1216
+ //# sourceMappingURL=ManageEventConfiguration-DqW3krT6.js.map