@argusoft/medplat-core 1.0.30 → 1.0.32

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 (226) hide show
  1. package/dist/{AccessRights-xrday-L1.js → AccessRights-DBjTQA1-.js} +395 -390
  2. package/dist/AccessRights-DBjTQA1-.js.map +1 -0
  3. package/dist/{AddFeatures-D1sU8RjY.js → AddFeatures-COj4ZTIM.js} +2 -2
  4. package/dist/{AddFeatures-D1sU8RjY.js.map → AddFeatures-COj4ZTIM.js.map} +1 -1
  5. package/dist/AddMenuConfiguration-Creeib5X.js +11223 -0
  6. package/dist/AddMenuConfiguration-Creeib5X.js.map +1 -0
  7. package/dist/AddMenuConfiguration.css +1 -1
  8. package/dist/{BrandsPage-DmRW5bhm-Bk1szrjI.js → BrandsPage-CdcAvaml-ZtVTX6vX.js} +43 -43
  9. package/dist/{BrandsPage-DmRW5bhm-Bk1szrjI.js.map → BrandsPage-CdcAvaml-ZtVTX6vX.js.map} +1 -1
  10. package/dist/{CategoriesPage-BsS5IQh3-B03lWRY5.js → CategoriesPage-BprQEYJw-CclreTv1.js} +109 -102
  11. package/dist/CategoriesPage-BprQEYJw-CclreTv1.js.map +1 -0
  12. package/dist/{ChangePasswordModalCore-BPsJquTS.js → ChangePasswordModalCore-DZGOkbRY.js} +3 -3
  13. package/dist/{ChangePasswordModalCore-BPsJquTS.js.map → ChangePasswordModalCore-DZGOkbRY.js.map} +1 -1
  14. package/dist/ConditionConfig-Bpm6OoV5.js +408 -0
  15. package/dist/ConditionConfig-Bpm6OoV5.js.map +1 -0
  16. package/dist/{DashboardPage-C3bKc5na-sBd9Yqbi.js → DashboardPage-CTiGSx71-CsYohJ5e.js} +32 -32
  17. package/dist/{DashboardPage-C3bKc5na-sBd9Yqbi.js.map → DashboardPage-CTiGSx71-CsYohJ5e.js.map} +1 -1
  18. package/dist/EntityManagement-BGwJGl9k.js +62 -0
  19. package/dist/EntityManagement-BGwJGl9k.js.map +1 -0
  20. package/dist/EventConfig-BY2cgGyx.js +27 -0
  21. package/dist/{EventConfig-BmLemzX3.js.map → EventConfig-BY2cgGyx.js.map} +1 -1
  22. package/dist/EventConfigurations-B-z7xHh_.js +544 -0
  23. package/dist/EventConfigurations-B-z7xHh_.js.map +1 -0
  24. package/dist/EventConfigurations.css +1 -1
  25. package/dist/EventsExceptionModal-DafomIv6.js +188 -0
  26. package/dist/EventsExceptionModal-DafomIv6.js.map +1 -0
  27. package/dist/EventsUi-Dl_yckSA.js +263 -0
  28. package/dist/EventsUi-Dl_yckSA.js.map +1 -0
  29. package/dist/FacilityPicker-BXa2VF7i-Dab_Jwa5.js +112 -0
  30. package/dist/FacilityPicker-BXa2VF7i-Dab_Jwa5.js.map +1 -0
  31. package/dist/{FeatureMenu-DYJmDt7q.js → FeatureMenu-Kc73yPHH.js} +9 -5
  32. package/dist/FeatureMenu-Kc73yPHH.js.map +1 -0
  33. package/dist/{FhirServerList-DuTwnngN.js → FhirServerList-CrIHMAxz.js} +16 -16
  34. package/dist/{FhirServerList-DuTwnngN.js.map → FhirServerList-CrIHMAxz.js.map} +1 -1
  35. package/dist/{FhirServerProfile-CUOwC6Wb.js → FhirServerProfile-D3aYcpwY.js} +8 -8
  36. package/dist/{FhirServerProfile-CUOwC6Wb.js.map → FhirServerProfile-D3aYcpwY.js.map} +1 -1
  37. package/dist/{FhirServerWizard-DZI8Olku.js → FhirServerWizard-Db6Hm4bQ.js} +15 -15
  38. package/dist/{FhirServerWizard-DZI8Olku.js.map → FhirServerWizard-Db6Hm4bQ.js.map} +1 -1
  39. package/dist/{GrantPermissionModal-BDN66Atn.js → GrantPermissionModal-D7iNZd0M.js} +54 -51
  40. package/dist/GrantPermissionModal-D7iNZd0M.js.map +1 -0
  41. package/dist/ImmunizationConfigurationBase-lKsJZMak.js +8060 -0
  42. package/dist/ImmunizationConfigurationBase-lKsJZMak.js.map +1 -0
  43. package/dist/InventoryPage-JadYMCzU-CzJQfQ2A.js +1017 -0
  44. package/dist/InventoryPage-JadYMCzU-CzJQfQ2A.js.map +1 -0
  45. package/dist/LocationWiseExpectedTargetPage-CjKk1aTF.js +1344 -0
  46. package/dist/LocationWiseExpectedTargetPage-CjKk1aTF.js.map +1 -0
  47. package/dist/{ManageDynamicFeature-BU0I45dd.js → ManageDynamicFeature-CuyYfx_P.js} +104 -97
  48. package/dist/ManageDynamicFeature-CuyYfx_P.js.map +1 -0
  49. package/dist/ManageEventConfiguration-DqPbn3Oi.js +1216 -0
  50. package/dist/ManageEventConfiguration-DqPbn3Oi.js.map +1 -0
  51. package/dist/ManageEventConfiguration.css +1 -1
  52. package/dist/ManageRole-CyfpySt9.js +981 -0
  53. package/dist/ManageRole-CyfpySt9.js.map +1 -0
  54. package/dist/{ManageUser-DCFkUMV9.js → ManageUser-Dm0l833u.js} +286 -286
  55. package/dist/{ManageUser-DCFkUMV9.js.map → ManageUser-Dm0l833u.js.map} +1 -1
  56. package/dist/{MemberProfileCard-BdUNgHRB-VywqQdFF.js → MemberProfileCard-01d_jz3w-DYHtbgMX.js} +46 -46
  57. package/dist/{MemberProfileCard-BdUNgHRB-VywqQdFF.js.map → MemberProfileCard-01d_jz3w-DYHtbgMX.js.map} +1 -1
  58. package/dist/MobileAnalytics-C9oc2yAo.js +18399 -0
  59. package/dist/MobileAnalytics-C9oc2yAo.js.map +1 -0
  60. package/dist/MobileMenuManagement-BmzTPXy7.js +231 -0
  61. package/dist/MobileMenuManagement-BmzTPXy7.js.map +1 -0
  62. package/dist/MobileTypeEventConfigModal-DodU3beR.js +752 -0
  63. package/dist/MobileTypeEventConfigModal-DodU3beR.js.map +1 -0
  64. package/dist/{NewServerManagement-Cxe0dV0O.js → NewServerManagement-BdayO78D.js} +368 -352
  65. package/dist/NewServerManagement-BdayO78D.js.map +1 -0
  66. package/dist/OtherTypeEventConfigModal-D_9S50aI.js +1414 -0
  67. package/dist/OtherTypeEventConfigModal-D_9S50aI.js.map +1 -0
  68. package/dist/{PaymentCreatePage-CIVe0P0p-25BQVpOX.js → PaymentCreatePage-D6NZBUC3-DxXf2kvH.js} +58 -58
  69. package/dist/{PaymentCreatePage-CIVe0P0p-25BQVpOX.js.map → PaymentCreatePage-D6NZBUC3-DxXf2kvH.js.map} +1 -1
  70. package/dist/{PaymentsPage-BvPe5Q9F-D2gfziwW.js → PaymentsPage-CHieGNrn-BnYCtqHd.js} +37 -37
  71. package/dist/{PaymentsPage-BvPe5Q9F-D2gfziwW.js.map → PaymentsPage-CHieGNrn-BnYCtqHd.js.map} +1 -1
  72. package/dist/{PermissionsModal-CCYkcKlC.js → PermissionsModal-Dxbkkrqe.js} +18 -18
  73. package/dist/PermissionsModal-Dxbkkrqe.js.map +1 -0
  74. package/dist/{PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js → PickupBatchLinesEditor-QPaqFtUO-CY7BShYh.js} +2 -2
  75. package/dist/{PickupBatchLinesEditor-DHmcAG23-DL2p6IKJ.js.map → PickupBatchLinesEditor-QPaqFtUO-CY7BShYh.js.map} +1 -1
  76. package/dist/PickupCreatePage-C7_67u_u-OId8-e2a.js +801 -0
  77. package/dist/PickupCreatePage-C7_67u_u-OId8-e2a.js.map +1 -0
  78. package/dist/{PickupsPage-Ctpghavs-CUp4uIZq.js → PickupsPage-BWblMlic-CWkgeBw0.js} +132 -132
  79. package/dist/PickupsPage-BWblMlic-CWkgeBw0.js.map +1 -0
  80. package/dist/PmGuard-BvUUbU80-BpYNaDzl.js +641 -0
  81. package/dist/PmGuard-BvUUbU80-BpYNaDzl.js.map +1 -0
  82. package/dist/ProductEditPage-Dbq4vUAA-BoBmTPPL.js +1523 -0
  83. package/dist/ProductEditPage-Dbq4vUAA-BoBmTPPL.js.map +1 -0
  84. package/dist/{ProductsPage-CupVmOD4-D45a_hf-.js → ProductsPage-BI22nPb4-CQBjnc-n.js} +44 -43
  85. package/dist/ProductsPage-BI22nPb4-CQBjnc-n.js.map +1 -0
  86. package/dist/PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js +724 -0
  87. package/dist/PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js.map +1 -0
  88. package/dist/{PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js → PurchaseRequestDetailPage-DhBuOGHZ-CWZPqzt9.js} +428 -418
  89. package/dist/PurchaseRequestDetailPage-DhBuOGHZ-CWZPqzt9.js.map +1 -0
  90. package/dist/{PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js → PurchaseRequestsPage-Bj9HUMxb-B7-AxT8m.js} +65 -65
  91. package/dist/{PurchaseRequestsPage-DPAPzpmm-mDH2IrTl.js.map → PurchaseRequestsPage-Bj9HUMxb-B7-AxT8m.js.map} +1 -1
  92. package/dist/{PurchasesPage-It1GHiXl-eH4IsF_U.js → PurchasesPage-Djl1AqD_-DXeYFMrX.js} +55 -55
  93. package/dist/{PurchasesPage-It1GHiXl-eH4IsF_U.js.map → PurchasesPage-Djl1AqD_-DXeYFMrX.js.map} +1 -1
  94. package/dist/{RoleManagement-s8iNx2Mu.js → RoleManagement-DVYufwy-.js} +3 -3
  95. package/dist/{RoleManagement-s8iNx2Mu.js.map → RoleManagement-DVYufwy-.js.map} +1 -1
  96. package/dist/Roles-BoNGJhtR.js +19 -0
  97. package/dist/Roles-BoNGJhtR.js.map +1 -0
  98. package/dist/{SaleCreatePage-C9kFmTvm-B3Y0o4CX.js → SaleCreatePage-DHBLmlBr-BlgjVsq6.js} +39 -39
  99. package/dist/{SaleCreatePage-C9kFmTvm-B3Y0o4CX.js.map → SaleCreatePage-DHBLmlBr-BlgjVsq6.js.map} +1 -1
  100. package/dist/{SalesPage-D18DCseD-BxktGDRQ.js → SalesPage-eF9Yr42z-BQ9FlXC3.js} +61 -61
  101. package/dist/{SalesPage-D18DCseD-BxktGDRQ.js.map → SalesPage-eF9Yr42z-BQ9FlXC3.js.map} +1 -1
  102. package/dist/SettingsPage-Cre-UE3r-9ntnLYsQ.js +741 -0
  103. package/dist/SettingsPage-Cre-UE3r-9ntnLYsQ.js.map +1 -0
  104. package/dist/{ShowFlywayQuery-D1y_4A1u.js → ShowFlywayQuery-DIOUdYfG.js} +26 -19
  105. package/dist/{ShowFlywayQuery-D1y_4A1u.js.map → ShowFlywayQuery-DIOUdYfG.js.map} +1 -1
  106. package/dist/{StorageUnitsPage-7EqwuMOI-BwUso1Th.js → StorageUnitsPage-CTEVuemZ-B4osG74N.js} +253 -223
  107. package/dist/StorageUnitsPage-CTEVuemZ-B4osG74N.js.map +1 -0
  108. package/dist/{SubMenu-eEDhZUvh.js → SubMenu-OO2zhKiu.js} +5 -3
  109. package/dist/SubMenu-OO2zhKiu.js.map +1 -0
  110. package/dist/{TableDetails-BtafRxXb.js → TableDetails-Cc40dEUs.js} +272 -267
  111. package/dist/TableDetails-Cc40dEUs.js.map +1 -0
  112. package/dist/{TableList-Dpo6dO7S.js → TableList-B5tX4wII.js} +316 -312
  113. package/dist/TableList-B5tX4wII.js.map +1 -0
  114. package/dist/{TransactionsPage-DrH53pVS-BkhIGB6C.js → TransactionsPage-Zuu7sjID-B-ACzvd1.js} +195 -180
  115. package/dist/TransactionsPage-Zuu7sjID-B-ACzvd1.js.map +1 -0
  116. package/dist/TransferCreatePage-DlT0nCDj-B2SdPgYB.js +635 -0
  117. package/dist/TransferCreatePage-DlT0nCDj-B2SdPgYB.js.map +1 -0
  118. package/dist/TransfersPage-DqaSvHda-G2tFa5Jq.js +600 -0
  119. package/dist/TransfersPage-DqaSvHda-G2tFa5Jq.js.map +1 -0
  120. package/dist/TypeConfiguration-EaFiOzRE.js +114 -0
  121. package/dist/TypeConfiguration-EaFiOzRE.js.map +1 -0
  122. package/dist/UserList-Cf5B-o_1.js +1904 -0
  123. package/dist/UserList-Cf5B-o_1.js.map +1 -0
  124. package/dist/Users-MC7txo1V.js +43 -0
  125. package/dist/{Users-Bpc4Sazd.js.map → Users-MC7txo1V.js.map} +1 -1
  126. package/dist/VaccineEducation-T_UE57Ef.js +231 -0
  127. package/dist/VaccineEducation-T_UE57Ef.js.map +1 -0
  128. package/dist/VaccineEducation.css +1 -0
  129. package/dist/VaccineEducationConfigurator-CWc20_rv.js +50948 -0
  130. package/dist/VaccineEducationConfigurator-CWc20_rv.js.map +1 -0
  131. package/dist/VaccineEducationConfigurator.css +4 -0
  132. package/dist/VaccineEducationList-Ok7_5EFb.js +334 -0
  133. package/dist/VaccineEducationList-Ok7_5EFb.js.map +1 -0
  134. package/dist/VialsPage-LoDaUqVv-DmMXbK8j.js +457 -0
  135. package/dist/VialsPage-LoDaUqVv-DmMXbK8j.js.map +1 -0
  136. package/dist/{constants-ClZJY2x1-MkSWn6TZ.js → constants-BTpJFQe_-CYPZIqQF.js} +166 -56
  137. package/dist/constants-BTpJFQe_-CYPZIqQF.js.map +1 -0
  138. package/dist/dashboardLayoutUtils--xUnoKPa.js +615 -0
  139. package/dist/dashboardLayoutUtils--xUnoKPa.js.map +1 -0
  140. package/dist/index-mfoqII2U.js +524 -0
  141. package/dist/index-mfoqII2U.js.map +1 -0
  142. package/dist/{index-D9YNFPn9.js → index-o8Pyt1Bt.js} +445 -439
  143. package/dist/index-o8Pyt1Bt.js.map +1 -0
  144. package/dist/index.css +1 -1
  145. package/dist/index.js +1 -1
  146. package/dist/index.lib-BySa9-Z-.js +936 -0
  147. package/dist/index.lib-BySa9-Z-.js.map +1 -0
  148. package/dist/listValueStore-5d4vNGQM-WclZ5nBG.js +43 -0
  149. package/dist/listValueStore-5d4vNGQM-WclZ5nBG.js.map +1 -0
  150. package/package.json +5 -1
  151. package/dist/AccessRights-xrday-L1.js.map +0 -1
  152. package/dist/AddMenuConfiguration-e5BVXhmw.js +0 -8547
  153. package/dist/AddMenuConfiguration-e5BVXhmw.js.map +0 -1
  154. package/dist/CategoriesPage-BsS5IQh3-B03lWRY5.js.map +0 -1
  155. package/dist/ConditionConfig-Ddz9halE.js +0 -395
  156. package/dist/ConditionConfig-Ddz9halE.js.map +0 -1
  157. package/dist/ConditionConfig.css +0 -1
  158. package/dist/EntityManagement-CPQL6qBj.js +0 -50
  159. package/dist/EntityManagement-CPQL6qBj.js.map +0 -1
  160. package/dist/EventConfig-BmLemzX3.js +0 -26
  161. package/dist/EventConfigurations-Bzh1qWXU.js +0 -450
  162. package/dist/EventConfigurations-Bzh1qWXU.js.map +0 -1
  163. package/dist/EventsExceptionModal-B2SRrnB1.js +0 -200
  164. package/dist/EventsExceptionModal-B2SRrnB1.js.map +0 -1
  165. package/dist/EventsSkeleton-BIcPks4T.js +0 -61
  166. package/dist/EventsSkeleton-BIcPks4T.js.map +0 -1
  167. package/dist/FacilityPicker-BiZeupmP-CyPHmj6b.js +0 -79
  168. package/dist/FacilityPicker-BiZeupmP-CyPHmj6b.js.map +0 -1
  169. package/dist/FeatureMenu-DYJmDt7q.js.map +0 -1
  170. package/dist/GrantPermissionModal-BDN66Atn.js.map +0 -1
  171. package/dist/ImmunizationConfigurationBase-Di1KO3oW.js +0 -7639
  172. package/dist/ImmunizationConfigurationBase-Di1KO3oW.js.map +0 -1
  173. package/dist/InventoryPage-C_AxSy7A-QLvlL4rE.js +0 -665
  174. package/dist/InventoryPage-C_AxSy7A-QLvlL4rE.js.map +0 -1
  175. package/dist/ManageDynamicFeature-BU0I45dd.js.map +0 -1
  176. package/dist/ManageEventConfiguration-CoYcpjR9.js +0 -1085
  177. package/dist/ManageEventConfiguration-CoYcpjR9.js.map +0 -1
  178. package/dist/ManageRole-CNZBRKGU.js +0 -776
  179. package/dist/ManageRole-CNZBRKGU.js.map +0 -1
  180. package/dist/MobileAnalytics-pQoE8cG1.js +0 -16888
  181. package/dist/MobileAnalytics-pQoE8cG1.js.map +0 -1
  182. package/dist/MobileMenuManagement-Cf8IZlla.js +0 -108
  183. package/dist/MobileMenuManagement-Cf8IZlla.js.map +0 -1
  184. package/dist/MobileTypeEventConfigModal-BeveaX0C.js +0 -783
  185. package/dist/MobileTypeEventConfigModal-BeveaX0C.js.map +0 -1
  186. package/dist/NewServerManagement-Cxe0dV0O.js.map +0 -1
  187. package/dist/OtherTypeEventConfigModal-CM6VkdmY.js +0 -2046
  188. package/dist/OtherTypeEventConfigModal-CM6VkdmY.js.map +0 -1
  189. package/dist/PermissionsModal-CCYkcKlC.js.map +0 -1
  190. package/dist/PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js +0 -783
  191. package/dist/PickupCreatePage-CB0Sl0Hb-Mmj7zESG.js.map +0 -1
  192. package/dist/PickupsPage-Ctpghavs-CUp4uIZq.js.map +0 -1
  193. package/dist/PmGuard-b10TGXEi-G3N0G_Wg.js +0 -599
  194. package/dist/PmGuard-b10TGXEi-G3N0G_Wg.js.map +0 -1
  195. package/dist/ProductEditPage-C1thoKHu-URQaZ6st.js +0 -1302
  196. package/dist/ProductEditPage-C1thoKHu-URQaZ6st.js.map +0 -1
  197. package/dist/ProductsPage-CupVmOD4-D45a_hf-.js.map +0 -1
  198. package/dist/PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js +0 -648
  199. package/dist/PurchaseCreatePage-YD3NmhPQ-2j4etSjM.js.map +0 -1
  200. package/dist/PurchaseRequestDetailPage-Dg_MRY_N-D1bgTEAn.js.map +0 -1
  201. package/dist/Roles-BIyiic67.js +0 -14
  202. package/dist/Roles-BIyiic67.js.map +0 -1
  203. package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js +0 -747
  204. package/dist/SettingsPage-VsxI-ano-DcmtUUEj.js.map +0 -1
  205. package/dist/StorageUnitsPage-7EqwuMOI-BwUso1Th.js.map +0 -1
  206. package/dist/SubMenu-eEDhZUvh.js.map +0 -1
  207. package/dist/TableDetails-BtafRxXb.js.map +0 -1
  208. package/dist/TableList-Dpo6dO7S.js.map +0 -1
  209. package/dist/TransactionsPage-DrH53pVS-BkhIGB6C.js.map +0 -1
  210. package/dist/TransferCreatePage-CuvoMrYH-DTTfHjz-.js +0 -315
  211. package/dist/TransferCreatePage-CuvoMrYH-DTTfHjz-.js.map +0 -1
  212. package/dist/TransfersPage-Cf701t8s-BBbN7cBf.js +0 -476
  213. package/dist/TransfersPage-Cf701t8s-BBbN7cBf.js.map +0 -1
  214. package/dist/TypeConfiguration-3O6ABrK-.js +0 -117
  215. package/dist/TypeConfiguration-3O6ABrK-.js.map +0 -1
  216. package/dist/UserList-DgPxsnj2.js +0 -1129
  217. package/dist/UserList-DgPxsnj2.js.map +0 -1
  218. package/dist/Users-Bpc4Sazd.js +0 -41
  219. package/dist/VialsPage-8oAc1yFv-Cl3FUXBJ.js +0 -321
  220. package/dist/VialsPage-8oAc1yFv-Cl3FUXBJ.js.map +0 -1
  221. package/dist/constants-ClZJY2x1-MkSWn6TZ.js.map +0 -1
  222. package/dist/dashboardLayoutUtils-D1xCAxp3.js +0 -405
  223. package/dist/dashboardLayoutUtils-D1xCAxp3.js.map +0 -1
  224. package/dist/index-D9YNFPn9.js.map +0 -1
  225. package/dist/index.lib-Dn8PMkeD.js +0 -862
  226. package/dist/index.lib-Dn8PMkeD.js.map +0 -1
@@ -0,0 +1,981 @@
1
+ import { jsxs as r, jsx as a, Fragment as ee } from "react/jsx-runtime";
2
+ import { useRef as A, useState as se, useEffect as Z, useCallback as ae } from "react";
3
+ import { Modal as Ee, Box as G, IconButton as ke, Alert as _e, FormControl as C, Tooltip as Be, FormGroup as Fe, Button as me } from "@mui/material";
4
+ import Se from "@/hooks/useTrackEvent";
5
+ import { b as qe, a as Le, c as Ae, e as De } from "./Roles-BoNGJhtR.js";
6
+ import { getRoleList as Oe, getLocationTypes as Pe, execute as te } from "@/common/services/GlobalApis";
7
+ import { showToast as le } from "@/common/toaster/toaster";
8
+ import { useForm as He } from "react-hook-form";
9
+ import { yupResolver as We } from "@hookform/resolvers/yup";
10
+ import "@/assets/scss/scrollBar.scss";
11
+ import { FormItem as g } from "@/views/custom-components/FormItem.jsx";
12
+ import * as R from "yup";
13
+ import V from "@/views/custom-components/CustomTextField";
14
+ import ue from "@/views/custom-components/CustomDropdown";
15
+ import oe from "@/views/custom-components/CustomCheckBox";
16
+ import L from "@/views/custom-components/CustomAutoComplete";
17
+ import { useTranslateProvider as $e } from "@/common/languageTranslator/TranslationContext";
18
+ import { FontAwesomeIcon as he } from "@fortawesome/react-fontawesome";
19
+ import { faXmark as je, faCircleInfo as Ue } from "@fortawesome/free-solid-svg-icons";
20
+ import ze from "@/common/services/util/GeneralUtil";
21
+ import x from "@/common/config/implementationConfig";
22
+ import k from "prop-types";
23
+ import re from "@/views/custom-components/CustomToggleSwitch";
24
+ import { useSelector as Ge } from "react-redux";
25
+ import { getUseSkeleton as Ve } from "@/store/reducers/SkeletonReducer";
26
+ const fe = ({ children: d, isLoading: i }) => !Ge(Ve) || !i ? d : /* @__PURE__ */ r("div", { className: "pt-6 h-[88vh]", children: [
27
+ /* @__PURE__ */ r("div", { className: "px-8 pt-2 pb-4 flex items-center justify-between", children: [
28
+ /* @__PURE__ */ a("div", { className: "bg-gray-300 animate-pulse rounded-md w-32 h-8" }),
29
+ /* @__PURE__ */ a("div", { className: "bg-gray-300 animate-pulse rounded-full w-10 h-10" })
30
+ ] }),
31
+ /* @__PURE__ */ r("div", { className: "px-8 pb-8 space-y-6 overflow-y-auto max-h-[80vh]", children: [
32
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [1, 2, 3].map((s) => /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
33
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
34
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
35
+ ] }, s)) }),
36
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6 w-full", children: /* @__PURE__ */ r("div", { className: "w-full", children: [
37
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
38
+ /* @__PURE__ */ a("div", { className: "h-8 bg-gray-300 rounded-full w-16 animate-pulse" })
39
+ ] }) }),
40
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
41
+ [1, 2].map((s) => /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
42
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
43
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
44
+ ] }, s)),
45
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [1, 2].map((s) => /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
46
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
47
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
48
+ ] }, s)) }),
49
+ [1, 2].map((s) => /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
50
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
51
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
52
+ ] }, s))
53
+ ] }),
54
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-6", children: [
55
+ /* @__PURE__ */ r("div", { className: "w-[60%]", children: [
56
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
57
+ /* @__PURE__ */ a("div", { className: "h-8 bg-gray-300 rounded-full w-16 animate-pulse" })
58
+ ] }),
59
+ /* @__PURE__ */ r("div", { className: "w-[40%] flex items-center gap-2", children: [
60
+ /* @__PURE__ */ a("div", { className: "h-5 w-5 bg-gray-300 rounded animate-pulse" }),
61
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 animate-pulse" })
62
+ ] })
63
+ ] }),
64
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
65
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
66
+ /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-4", children: [1, 2, 3, 4].map((s) => /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
67
+ /* @__PURE__ */ a("div", { className: "h-5 w-5 bg-gray-300 rounded animate-pulse" }),
68
+ /* @__PURE__ */ a("div", { className: "h-4 w-16 bg-gray-300 rounded animate-pulse" })
69
+ ] }, s)) })
70
+ ] })
71
+ ] }),
72
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-end gap-3 pt-6 px-8 pb-4 border-t border-slate-100", children: [
73
+ /* @__PURE__ */ a("div", { className: "h-9 w-20 bg-gray-300 rounded animate-pulse" }),
74
+ /* @__PURE__ */ a("div", { className: "h-9 w-24 bg-gray-300 rounded animate-pulse" })
75
+ ] })
76
+ ] });
77
+ fe.propTypes = {
78
+ children: k.any,
79
+ isLoading: k.any
80
+ };
81
+ const D = 50, Ze = /^[A-Z]+(_[A-Z]+)*$/, Xe = [
82
+ "TWO",
83
+ "THREE",
84
+ "FOUR",
85
+ "FIVE",
86
+ "SIX",
87
+ "SEVEN",
88
+ "EIGHT",
89
+ "NINE",
90
+ "TEN"
91
+ ], ge = 400, Ke = (d = "") => d.toUpperCase().replace(/[^A-Z]+/g, "_").replace(/^_+|_+$/g, "").slice(0, D).replace(/_+$/g, ""), Ye = (d = "") => d.toUpperCase().replace(/[^A-Z_]/g, "").slice(0, D), Je = (d, i) => {
92
+ const u = D - i.length - 1, s = d.slice(0, Math.max(u, 0)).replace(/_+$/g, "");
93
+ return s ? `${s}_${i}` : "";
94
+ }, Qe = (d, i, u) => {
95
+ const s = (f) => {
96
+ const M = i.get(f);
97
+ return !M || M.roleId === u;
98
+ };
99
+ return s(d) ? d : Xe.map((f) => Je(d, f)).find(
100
+ (f) => f && s(f)
101
+ ) ?? "";
102
+ }, ea = ({
103
+ name: d,
104
+ code: i,
105
+ roleId: u,
106
+ isLocked: s,
107
+ isOpen: f,
108
+ setValue: M,
109
+ trigger: B
110
+ }) => {
111
+ const E = A(/* @__PURE__ */ new Map()), p = A(!1), S = A(0), [X, v] = se({ state: "idle", message: "" });
112
+ Z(() => {
113
+ f || (p.current = !1, E.current = /* @__PURE__ */ new Map(), v({ state: "idle", message: "" }));
114
+ }, [f]);
115
+ const w = ae(async (T) => {
116
+ const t = S.current + 1;
117
+ S.current = t;
118
+ const { data: y } = await qe(T);
119
+ if (t !== S.current)
120
+ return null;
121
+ const n = /* @__PURE__ */ new Map();
122
+ return ((y == null ? void 0 : y.result) ?? []).forEach((F) => {
123
+ F != null && F.roleCode && n.set(F.roleCode.trim().toUpperCase(), F);
124
+ }), E.current = n, n;
125
+ }, []), K = ae(
126
+ (T) => {
127
+ const t = E.current.get((T ?? "").toUpperCase());
128
+ return !t || t.roleId === u;
129
+ },
130
+ [u]
131
+ ), W = ae(() => {
132
+ p.current = !0;
133
+ }, []);
134
+ return Z(() => {
135
+ if (!f || s || p.current)
136
+ return;
137
+ const T = Ke(d);
138
+ if (!T) {
139
+ E.current = /* @__PURE__ */ new Map(), M("code", ""), v({ state: "idle", message: "" });
140
+ return;
141
+ }
142
+ v({ state: "checking", message: "Checking availability..." });
143
+ const t = setTimeout(async () => {
144
+ try {
145
+ const y = await w(T);
146
+ if (!y)
147
+ return;
148
+ const n = Qe(T, y, u);
149
+ M("code", n), v(
150
+ n ? {
151
+ state: "available",
152
+ message: "System generated, you can change it"
153
+ } : {
154
+ state: "taken",
155
+ message: "Could not generate a free code, please enter one"
156
+ }
157
+ ), B("code");
158
+ } catch (y) {
159
+ console.error(y), v({
160
+ state: "error",
161
+ message: "Could not verify Role Code availability"
162
+ });
163
+ }
164
+ }, ge);
165
+ return () => clearTimeout(t);
166
+ }, [d, f, s, u, w, M, B]), Z(() => {
167
+ if (!f || s || !p.current)
168
+ return;
169
+ if (!i) {
170
+ E.current = /* @__PURE__ */ new Map(), v({ state: "idle", message: "" });
171
+ return;
172
+ }
173
+ v({ state: "checking", message: "Checking availability..." });
174
+ const T = setTimeout(async () => {
175
+ try {
176
+ const t = await w(i);
177
+ if (!t)
178
+ return;
179
+ const y = t.get(i.toUpperCase());
180
+ v(
181
+ y && y.roleId !== u ? {
182
+ state: "taken",
183
+ message: `Already used by "${y.roleName}"`
184
+ } : { state: "available", message: "Role Code is available" }
185
+ ), B("code");
186
+ } catch (t) {
187
+ console.error(t), v({
188
+ state: "error",
189
+ message: "Could not verify Role Code availability"
190
+ });
191
+ }
192
+ }, ge);
193
+ return () => clearTimeout(T);
194
+ }, [i, f, s, u, w, B]), { status: X, isCodeAvailable: K, markAsManuallyEdited: W };
195
+ }, aa = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], ta = [
196
+ { label: "Authenticator App", value: "AUTHENTICATOR_APP" }
197
+ ], la = ({
198
+ selectedId: d,
199
+ isUpdate: i,
200
+ open: u,
201
+ setOpen: s,
202
+ isRoleListModified: f
203
+ }) => {
204
+ var de;
205
+ const M = A(null), B = A(!1), E = Se(), [p, S] = se({}), [X, v] = se(!1), w = !!(i && ((de = p == null ? void 0 : p.roleData) != null && de.code)), K = i && !w, W = A(() => !0), T = R.object().shape({
206
+ name: R.string().required("Enter Role Name"),
207
+ code: w ? R.string().notRequired() : R.string().required("Enter Role Code").max(
208
+ D,
209
+ `Role Code cannot be longer than ${D} characters`
210
+ ).test("role-code-format", "Enter a valid Role Code", function(e) {
211
+ return e ? /[^A-Z_]/.test(e) ? this.createError({
212
+ message: "Role Code can contain capital letters and underscores only"
213
+ }) : e.startsWith("_") ? this.createError({
214
+ message: "Role Code cannot start with an underscore"
215
+ }) : e.endsWith("_") ? this.createError({
216
+ message: "Role Code cannot end with an underscore"
217
+ }) : e.includes("__") ? this.createError({
218
+ message: "Role Code cannot contain two underscores in a row"
219
+ }) : Ze.test(e) : !0;
220
+ }).test(
221
+ "role-code-available",
222
+ "This Role Code is already in use",
223
+ (e) => W.current(e)
224
+ ),
225
+ locationTypes: R.array().when("isLocationRequired", {
226
+ is: !0,
227
+ then: (e) => e.min(1, "Select Location Type").required("Select Location Type"),
228
+ otherwise: (e) => e.notRequired()
229
+ }),
230
+ roleType: x.role.showRoleType ? R.string().required("Select Role Type") : R.string().notRequired(),
231
+ isBankDetailsRequired: x.role.showBankDetailsRequired ? R.boolean().nullable().defined("Please Select a Value") : R.boolean().notRequired(),
232
+ healthInfrastructureIds: R.array().when("isHealthInfraMandatory", {
233
+ is: !0,
234
+ then: (e) => e.min(1, "Select Health Infrastructure Type").required("Select Health Infrastructure Type"),
235
+ otherwise: (e) => e.notRequired()
236
+ }),
237
+ twoFactorType: R.string().when("isTwoFactorEnabled", {
238
+ is: !0,
239
+ then: (e) => e.required("Select Authentication Method"),
240
+ otherwise: (e) => e.notRequired().nullable()
241
+ })
242
+ }), {
243
+ control: t,
244
+ handleSubmit: y,
245
+ formState: { errors: n, isSubmitting: F },
246
+ setValue: N,
247
+ // getValues,
248
+ watch: _,
249
+ reset: pe,
250
+ trigger: ye
251
+ } = He({
252
+ defaultValues: {
253
+ name: "",
254
+ locationTypes: [],
255
+ maxPosition: "",
256
+ maxHealthInfra: "",
257
+ roleType: "",
258
+ isLastNameMandatory: !1,
259
+ isAadharNumMandatory: !1,
260
+ isEmailMandatory: !1,
261
+ isContactNumMandatory: !1,
262
+ isConvoxIdMandatory: !1,
263
+ isHealthInfraMandatory: !1,
264
+ isGeolocationMandatory: !1,
265
+ roleIds: [],
266
+ canManageRoleIds: [],
267
+ manageByTeamTypeIds: [],
268
+ canSelfManage: !1,
269
+ healthInfrastructureIds: [],
270
+ categoryIds: [],
271
+ isBankDetailsRequired: !1,
272
+ isBankDetailsMandatory: !1,
273
+ isTwoFactorEnabled: !1,
274
+ twoFactorType: "",
275
+ id: "",
276
+ code: "",
277
+ description: "",
278
+ createdBy: "",
279
+ state: "",
280
+ createdOn: "",
281
+ assignedFeatureList: "",
282
+ assignedFeatures: "",
283
+ isSmagTrainedMandatory: "",
284
+ isLocationRequired: !0,
285
+ isNodalMandatory: !1
286
+ },
287
+ resolver: We(T),
288
+ mode: "onChange",
289
+ shouldUnregister: !1
290
+ }), be = _("isBankDetailsRequired"), ve = _("isTwoFactorEnabled"), ne = _("roleType"), we = ne === "WEB" || ne === "BOTH", Y = _("locationTypes"), { translate: J } = $e(), Ne = _("isLocationRequired"), Te = _("isHealthInfraMandatory"), Ie = _("name"), Re = _("code"), {
291
+ status: ie,
292
+ isCodeAvailable: Ce,
293
+ markAsManuallyEdited: xe
294
+ } = ea({
295
+ name: Ie,
296
+ code: Re,
297
+ roleId: d,
298
+ isLocked: w,
299
+ isOpen: u !== 0,
300
+ setValue: N,
301
+ trigger: ye
302
+ });
303
+ W.current = Ce;
304
+ const Q = [
305
+ { label: "Email", value: "isEmailMandatory" },
306
+ { label: "Aadhar Number", value: "isAadharNumMandatory" },
307
+ { label: "Contact Number", value: "isContactNumMandatory" },
308
+ { label: "Convox Id", value: "isConvoxIdMandatory" },
309
+ { label: "Last Name", value: "isLastNameMandatory" },
310
+ { label: "Health Infrastructure", value: "isHealthInfraMandatory" },
311
+ { label: "GeoLocation", value: "isGeolocationMandatory" },
312
+ { label: "Smag Trained", value: "isSmagTrainedMandatory" },
313
+ { label: "Nodal", value: "isNodalMandatory" },
314
+ { label: "PFMS Code", value: "isPfmsCodeMandatory" },
315
+ { label: "SNA Beneficiary ID", value: "isSnaBeneficiaryIdMandatory" }
316
+ ].filter((e) => {
317
+ var l;
318
+ return ((l = x.role.mandatoryFieldsToExclude) == null ? void 0 : l.length) > 0 ? !x.role.mandatoryFieldsToExclude.includes(e.value) : !0;
319
+ }), $ = () => {
320
+ s(0), pe(), E("conversion_event", {
321
+ form: M.current,
322
+ form_name: "Manage Role",
323
+ submit: B.current
324
+ }), E("button_click", {
325
+ button_name: "add role close button",
326
+ button_type: "cancel",
327
+ button_id: "managerole-close-button"
328
+ });
329
+ }, q = (e, l, h) => {
330
+ N(h, l);
331
+ }, Me = async (e) => {
332
+ var l, h, j;
333
+ try {
334
+ E("button_click", {
335
+ button_name: i ? "update role button" : "add role button",
336
+ button_type: "submit",
337
+ button_id: "managerole-add-button"
338
+ }), delete e.bankDetailsRequired, delete e.bankDetailsMandatory, e.roleType !== "WEB" && e.roleType !== "BOTH" && (e.isTwoFactorEnabled = !1), e.isTwoFactorEnabled ? e.twoFactorType || (e.twoFactorType = "AUTHENTICATOR_APP") : e.twoFactorType = null, i || (delete e.id, delete e.state, delete e.createdOn, delete e.createdBy, delete e.description, delete e.assignedFeatures, delete e.assignedFeatureList), w || (e.code = (l = e.code) == null ? void 0 : l.trim().toUpperCase()), e.roleIds = e.roleIds.map((o) => o == null ? void 0 : o.id), e.canManageRoleIds = e.canManageRoleIds.map((o) => o == null ? void 0 : o.id), e.manageByTeamTypeIds = e.manageByTeamTypeIds.map(
339
+ (o) => o == null ? void 0 : o.id
340
+ ), e.healthInfrastructureIds = e.healthInfrastructureIds.map(
341
+ (o) => o == null ? void 0 : o.id
342
+ ), e.categoryIds = e.categoryIds.map((o) => o == null ? void 0 : o.id), e.locationTypes = e.isLocationRequired === !0 ? e.locationTypes : [], delete e.isLocationRequired, e.manageByRoleIds = e.roleIds, i ? await Ae(e) : await De(e), le({
343
+ type: "success",
344
+ message: `Role ${i ? "Updated" : "Added"} Successfully`
345
+ }), B.current = !0, $(), f();
346
+ } catch (o) {
347
+ le({
348
+ type: "error",
349
+ message: `Role Cannot be added: ${(j = (h = o == null ? void 0 : o.response) == null ? void 0 : h.data) == null ? void 0 : j.message}`
350
+ });
351
+ }
352
+ };
353
+ return Z(() => {
354
+ (async () => {
355
+ try {
356
+ v((h) => !h);
357
+ const l = ze.getEnv();
358
+ if (u !== 0) {
359
+ const [h, j, o, U, z] = await Promise.all([
360
+ Oe(),
361
+ Pe(),
362
+ te({
363
+ code: "team_all_types_for_roles",
364
+ parameters: {}
365
+ }),
366
+ te({
367
+ code: "retrieve_field_values_for_form_field",
368
+ parameters: {
369
+ form: "WEB",
370
+ fieldKey: "role_catg"
371
+ }
372
+ }),
373
+ te({
374
+ code: "retrieve_field_values_for_form_field",
375
+ parameters: {
376
+ form: "WEB",
377
+ fieldKey: "infra_type"
378
+ }
379
+ })
380
+ ]);
381
+ if (S((I) => {
382
+ var O, P, H;
383
+ return {
384
+ ...I,
385
+ roles: h.data,
386
+ locationData: j.data,
387
+ manageTeam: (O = o == null ? void 0 : o.data) == null ? void 0 : O.result,
388
+ category: (P = U == null ? void 0 : U.data) == null ? void 0 : P.result,
389
+ healthInfraType: (H = z == null ? void 0 : z.data) == null ? void 0 : H.result
390
+ };
391
+ }), d) {
392
+ const { data: I } = await Le(d);
393
+ S((c) => ({ ...c, roleData: I, env: l })), Object.keys(I).map((c) => N(c, I[c])), N("isBankDetailsRequired", I.isBankDetailsRequired), N("isBankDetailsMandatory", I.isBankDetailsMandatory);
394
+ const {
395
+ manageByTeamTypeIds: O,
396
+ healthInfrastructureIds: P,
397
+ roleIds: H,
398
+ categoryIds: ce
399
+ } = I;
400
+ N(
401
+ "manageByTeamTypeIds",
402
+ O ? O.map(
403
+ (c) => {
404
+ var b;
405
+ return (b = o.data.result) == null ? void 0 : b.find((m) => (m == null ? void 0 : m.id) === c);
406
+ }
407
+ ) : []
408
+ ), N(
409
+ "healthInfrastructureIds",
410
+ P ? P.map(
411
+ (c) => {
412
+ var b;
413
+ return (b = z.data.result) == null ? void 0 : b.find(
414
+ (m) => (m == null ? void 0 : m.id) === c
415
+ );
416
+ }
417
+ ).filter((c) => c !== void 0) : []
418
+ ), N(
419
+ "categoryIds",
420
+ ce ? ce.map(
421
+ (c) => {
422
+ var b;
423
+ return (b = U.data.result) == null ? void 0 : b.find((m) => (m == null ? void 0 : m.id) === c);
424
+ }
425
+ ) : []
426
+ ), N(
427
+ "roleIds",
428
+ H ? H.map((c) => {
429
+ var b;
430
+ return (b = h.data) == null ? void 0 : b.find((m) => (m == null ? void 0 : m.id) === c);
431
+ }).filter((c) => c !== void 0) : []
432
+ ), N(
433
+ "canManageRoleIds",
434
+ I.canManageRoleIds ? I.canManageRoleIds.map((c) => {
435
+ var b;
436
+ return (b = h.data) == null ? void 0 : b.find((m) => (m == null ? void 0 : m.id) === c);
437
+ }).filter((c) => c !== void 0) : []
438
+ ), I.locationTypes.length > 0 ? N("isLocationRequired", !0) : N("isLocationRequired", !1);
439
+ }
440
+ }
441
+ v((h) => !h);
442
+ } catch (l) {
443
+ le({
444
+ message: `Error in manage role :${l == null ? void 0 : l.message}`,
445
+ type: "error"
446
+ }), v((h) => !h);
447
+ }
448
+ })();
449
+ }, [d, u]), /* @__PURE__ */ a(
450
+ Ee,
451
+ {
452
+ open: u !== 0,
453
+ onClose: $,
454
+ "data-testid": "managerole-modal",
455
+ children: /* @__PURE__ */ a("div", { className: "mt-10 fixed inset-0 z-[100] flex items-center justify-center p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ a(
456
+ G,
457
+ {
458
+ className: "w-full max-w-2xl rounded-[2.5rem] shadow-2xl shadow-blue-900/10 overflow-hidden flex flex-col animate-in zoom-in-95 duration-300",
459
+ sx: { bgcolor: (e) => e.palette.custom.customBackground },
460
+ children: /* @__PURE__ */ r(fe, { isLoading: X, children: [
461
+ /* @__PURE__ */ r("div", { className: "px-8 pt-8 pb-4 flex items-center justify-between", children: [
462
+ /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
463
+ G,
464
+ {
465
+ component: "h2",
466
+ className: "text-2xl font-bold text-customBlue",
467
+ sx: { color: "text.primary" },
468
+ children: i ? "Update Role" : "Add New Role"
469
+ }
470
+ ) }),
471
+ /* @__PURE__ */ a(
472
+ ke,
473
+ {
474
+ size: "small",
475
+ onClick: $,
476
+ className: "w-10 h-10 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 hover:bg-slate-200 hover:text-slate-600 transition-all",
477
+ "data-testid": "managerole-close-icon",
478
+ children: /* @__PURE__ */ a(he, { icon: je, size: "lg" })
479
+ }
480
+ )
481
+ ] }),
482
+ /* @__PURE__ */ r(
483
+ "form",
484
+ {
485
+ onSubmit: y(Me),
486
+ ref: M,
487
+ className: "px-8 pb-8 space-y-6 overflow-y-auto max-h-[80vh]",
488
+ children: [
489
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
490
+ K && /* @__PURE__ */ a(
491
+ _e,
492
+ {
493
+ severity: "warning",
494
+ "data-testid": "managerole-legacy-code-alert",
495
+ children: "This role does not have a Role Code yet. A code has been generated below — review or edit it before saving, as it cannot be changed once this role is saved with a code."
496
+ }
497
+ ),
498
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
499
+ /* @__PURE__ */ a(C, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(g, { label: "Role Name", children: /* @__PURE__ */ a(
500
+ V,
501
+ {
502
+ placeholder: "Role Name",
503
+ name: "name",
504
+ id: "name",
505
+ errors: n,
506
+ control: t,
507
+ dataTestId: "managerole-role-name-field"
508
+ }
509
+ ) }) }) }),
510
+ /* @__PURE__ */ a(C, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
511
+ g,
512
+ {
513
+ label: "Role Code",
514
+ required: !w,
515
+ additionalLabel: /* @__PURE__ */ a(
516
+ Be,
517
+ {
518
+ arrow: !0,
519
+ placement: "top",
520
+ title: w ? "This role already has a saved Role Code. Once a Role Code is set it can never be changed, so this field is locked." : "Auto-generated from the Role Name (capital letters and underscores only) as you type. Edit it yourself at any time — once you do, it stops following the Role Name. After you save this role, its Role Code becomes permanent and this field will be locked on every future edit.",
521
+ children: /* @__PURE__ */ a(
522
+ G,
523
+ {
524
+ component: "span",
525
+ className: "cursor-help",
526
+ sx: { color: "info.main", display: "inline-flex" },
527
+ "data-testid": "managerole-role-code-info-icon",
528
+ children: /* @__PURE__ */ a(he, { icon: Ue, size: "sm" })
529
+ }
530
+ )
531
+ }
532
+ ),
533
+ children: /* @__PURE__ */ a(
534
+ V,
535
+ {
536
+ placeholder: "ROLE_CODE",
537
+ name: "code",
538
+ id: "code",
539
+ errors: n,
540
+ control: t,
541
+ disabled: w,
542
+ successMessage: w ? "" : ie.message,
543
+ inputProps: { maxLength: D },
544
+ onChange: (e) => {
545
+ xe(), N("code", Ye(e.target.value), {
546
+ shouldValidate: !0
547
+ });
548
+ },
549
+ dataTestId: "managerole-role-code-field"
550
+ }
551
+ )
552
+ }
553
+ ) }) })
554
+ ] }),
555
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
556
+ /* @__PURE__ */ a(C, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
557
+ g,
558
+ {
559
+ label: "Max Position",
560
+ tooltip: "This is the maximum no of users that can be created at one location of this role type",
561
+ children: /* @__PURE__ */ a(
562
+ V,
563
+ {
564
+ name: "maxPosition",
565
+ id: "maxPosition",
566
+ errors: n,
567
+ control: t,
568
+ rules: {
569
+ maxLength: 3,
570
+ pattern: /^\d{1,3}$/
571
+ },
572
+ inputProps: {
573
+ maxLength: 3,
574
+ inputMode: "numeric",
575
+ pattern: "[0-9]*",
576
+ onInput: (e) => {
577
+ e.target.value = e.target.value.replace(/\D/g, "");
578
+ }
579
+ },
580
+ dataTestId: "managerole-max-position-field"
581
+ }
582
+ )
583
+ }
584
+ ) }) }),
585
+ x.role.showMaxHealthData && /* @__PURE__ */ a(C, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(g, { label: "Max Health Infrastructure", children: /* @__PURE__ */ a(
586
+ V,
587
+ {
588
+ name: "maxHealthInfra",
589
+ id: "maxHealthInfra",
590
+ control: t,
591
+ errors: n,
592
+ rules: {
593
+ maxLength: 3,
594
+ pattern: /^\d{1,3}$/
595
+ },
596
+ inputProps: {
597
+ maxLength: 3,
598
+ inputMode: "numeric",
599
+ pattern: "[0-9]*",
600
+ onInput: (e) => {
601
+ e.target.value = e.target.value.replace(
602
+ /\D/g,
603
+ ""
604
+ );
605
+ }
606
+ },
607
+ dataTestId: "managerole-max-health-infra-field"
608
+ }
609
+ ) }) }) })
610
+ ] })
611
+ ] }),
612
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6 w-full", children: /* @__PURE__ */ a(
613
+ C,
614
+ {
615
+ variant: "outlined",
616
+ className: "flex flex-row items-center w-full ",
617
+ children: /* @__PURE__ */ a(
618
+ g,
619
+ {
620
+ label: "Location Required",
621
+ required: !0,
622
+ direction: "row",
623
+ children: /* @__PURE__ */ a(
624
+ re,
625
+ {
626
+ control: t,
627
+ name: "isLocationRequired",
628
+ options: [
629
+ { label: "Yes", value: !0 },
630
+ { label: "No", value: !1 }
631
+ ],
632
+ errors: n
633
+ }
634
+ )
635
+ }
636
+ )
637
+ }
638
+ ) }),
639
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
640
+ (Ne === !0 || F) && /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
641
+ g,
642
+ {
643
+ label: "Location",
644
+ required: !0,
645
+ tooltip: "The OU level where users of this role perform their job function",
646
+ children: /* @__PURE__ */ a(
647
+ L,
648
+ {
649
+ id: "locationTypes",
650
+ control: t,
651
+ name: "locationTypes",
652
+ options: p.locationData,
653
+ value: Y == null ? void 0 : Y.map(
654
+ (e) => {
655
+ var l;
656
+ return (l = p.locationData) == null ? void 0 : l.find(
657
+ (h) => h.type === (e == null ? void 0 : e.type)
658
+ );
659
+ }
660
+ ),
661
+ errors: n,
662
+ getOptionLabel: (e) => e == null ? void 0 : e.name,
663
+ dataTestId: "managerole-location-type-select",
664
+ checkEquality: "type",
665
+ onChange: (e, l) => q(e, l, "locationTypes")
666
+ }
667
+ )
668
+ }
669
+ ) }) }),
670
+ /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
671
+ g,
672
+ {
673
+ label: "Can Manage Role",
674
+ tooltip: "Please select the roles that shall be managed by this role",
675
+ children: /* @__PURE__ */ a(
676
+ L,
677
+ {
678
+ name: "roleIds",
679
+ id: "roleIds",
680
+ errors: n,
681
+ control: t,
682
+ dataTestId: "managerole-manage-role-select",
683
+ options: p.roles,
684
+ onChange: (e, l) => q(e, l, "roleIds"),
685
+ getOptionLabel: (e) => e == null ? void 0 : e.name
686
+ }
687
+ )
688
+ }
689
+ ) }),
690
+ x.role.showManagedFrom && /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
691
+ g,
692
+ {
693
+ label: "Managed From",
694
+ tooltip: "Please select the roles that can manage this role",
695
+ children: /* @__PURE__ */ a(
696
+ L,
697
+ {
698
+ name: "canManageRoleIds",
699
+ id: "canManageRoleIds",
700
+ errors: n,
701
+ control: t,
702
+ dataTestId: "managerole-managed-by-role-select",
703
+ options: p.roles,
704
+ onChange: (e, l) => q(e, l, "canManageRoleIds"),
705
+ getOptionLabel: (e) => e == null ? void 0 : e.name
706
+ }
707
+ )
708
+ }
709
+ ) }),
710
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
711
+ x.role.showRoleType && /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
712
+ g,
713
+ {
714
+ label: "Role Type",
715
+ tooltip: "Please select Role Type",
716
+ required: !0,
717
+ children: /* @__PURE__ */ a(
718
+ ue,
719
+ {
720
+ control: t,
721
+ id: "roleType",
722
+ name: "roleType",
723
+ options: aa,
724
+ displayName: "name",
725
+ optionValue: "name",
726
+ errors: n,
727
+ dataTestId: "managerole-role-type-dropdown"
728
+ }
729
+ )
730
+ }
731
+ ) }),
732
+ x.role.showCanManageTeam && /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
733
+ g,
734
+ {
735
+ label: "Can Manage Team",
736
+ tooltip: "Please select the teams that shall be managed by this role",
737
+ children: /* @__PURE__ */ a(
738
+ L,
739
+ {
740
+ control: t,
741
+ name: "manageByTeamTypeIds",
742
+ id: "manageByTeamTypeIds",
743
+ errors: n,
744
+ options: p.manageTeam,
745
+ dataTestId: "managerole-manage-team-select",
746
+ onChange: (e, l) => q(e, l, "manageByTeamTypeIds"),
747
+ getOptionLabel: (e) => e == null ? void 0 : e.type
748
+ }
749
+ )
750
+ }
751
+ ) })
752
+ ] }),
753
+ /* @__PURE__ */ a("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
754
+ g,
755
+ {
756
+ label: "Select Health Infrastructure type",
757
+ tooltip: "Please select the institute to be associated with the role",
758
+ required: Te,
759
+ children: /* @__PURE__ */ a(
760
+ L,
761
+ {
762
+ options: p.healthInfraType,
763
+ errors: n,
764
+ name: "healthInfrastructureIds",
765
+ id: "healthInfrastructureIds",
766
+ dataTestId: "managerole-health-infrastructure-select",
767
+ control: t,
768
+ onChange: (e, l) => q(e, l, "healthInfrastructureIds"),
769
+ getOptionLabel: (e) => e == null ? void 0 : e.value
770
+ }
771
+ )
772
+ }
773
+ ) }) }),
774
+ x.role.showCategoryIds && /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
775
+ g,
776
+ {
777
+ label: "Category",
778
+ tooltip: "Please select the category to be associated with the role",
779
+ children: /* @__PURE__ */ a(
780
+ L,
781
+ {
782
+ id: "categoryIds",
783
+ name: "categoryIds",
784
+ errors: n,
785
+ options: p.category,
786
+ dataTestId: "managerole-role-category-select",
787
+ control: t,
788
+ onChange: (e, l) => q(e, l, "categoryIds"),
789
+ getOptionLabel: (e) => e == null ? void 0 : e.value
790
+ }
791
+ )
792
+ }
793
+ ) }) }) })
794
+ ] }),
795
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-6", children: [
796
+ x.role.showBankDetailsRequired && /* @__PURE__ */ a(
797
+ C,
798
+ {
799
+ variant: "outlined",
800
+ className: "flex flex-row items-center w-[60%] ",
801
+ children: /* @__PURE__ */ a(
802
+ g,
803
+ {
804
+ label: "Bank Details Required",
805
+ tooltip: "Select if bank details are required for this role",
806
+ required: !0,
807
+ labelWidth: "50%",
808
+ childrenWidth: "50%",
809
+ direction: "row",
810
+ children: /* @__PURE__ */ a(
811
+ re,
812
+ {
813
+ control: t,
814
+ name: "isBankDetailsRequired",
815
+ options: [
816
+ { label: "Yes", value: !0 },
817
+ { label: "No", value: !1 }
818
+ ],
819
+ errors: n
820
+ }
821
+ )
822
+ }
823
+ )
824
+ }
825
+ ),
826
+ !i && /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a(C, { variant: "outlined ", className: "w-[40%]", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
827
+ /* @__PURE__ */ a("label", { className: "text-sm font-medium text-gray-700", children: "Self Manage" }),
828
+ /* @__PURE__ */ a(
829
+ oe,
830
+ {
831
+ name: "canSelfManage",
832
+ control: t,
833
+ isFullWidth: !1,
834
+ "data-testid": "managerole-self-manage-checkbox"
835
+ }
836
+ )
837
+ ] }) }) })
838
+ ] }),
839
+ we && /* @__PURE__ */ r("div", { className: "flex items-center gap-6 w-full", children: [
840
+ /* @__PURE__ */ a(
841
+ C,
842
+ {
843
+ variant: "outlined",
844
+ className: "flex flex-row items-center w-[50%]",
845
+ children: /* @__PURE__ */ a(
846
+ g,
847
+ {
848
+ label: "Two-Factor Authentication",
849
+ tooltip: "Require users of this role to use a two-factor authentication app",
850
+ labelWidth: "60%",
851
+ childrenWidth: "40%",
852
+ direction: "row",
853
+ children: /* @__PURE__ */ a(
854
+ re,
855
+ {
856
+ control: t,
857
+ name: "isTwoFactorEnabled",
858
+ options: [
859
+ { label: "Yes", value: !0 },
860
+ { label: "No", value: !1 }
861
+ ],
862
+ errors: n
863
+ }
864
+ )
865
+ }
866
+ )
867
+ }
868
+ ),
869
+ ve === !0 && /* @__PURE__ */ a(C, { variant: "outlined", className: "w-[50%]", children: /* @__PURE__ */ a(
870
+ g,
871
+ {
872
+ label: "Authentication Method",
873
+ tooltip: "Select which authentication method users of this role will use",
874
+ required: !0,
875
+ children: /* @__PURE__ */ a(
876
+ ue,
877
+ {
878
+ control: t,
879
+ id: "twoFactorType",
880
+ name: "twoFactorType",
881
+ options: ta,
882
+ displayName: "label",
883
+ optionValue: "value",
884
+ errors: n,
885
+ dataTestId: "managerole-two-factor-type-dropdown"
886
+ }
887
+ )
888
+ }
889
+ ) })
890
+ ] }),
891
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6", children: /* @__PURE__ */ a(
892
+ C,
893
+ {
894
+ variant: "outlined",
895
+ className: "flex flex-col items-start justify-between",
896
+ children: /* @__PURE__ */ a(
897
+ g,
898
+ {
899
+ label: "Mandatory Fields",
900
+ tooltip: "These fields are Mandatory when creating users of this role type",
901
+ children: /* @__PURE__ */ r(Fe, { row: !0, children: [
902
+ Q == null ? void 0 : Q.map((e) => /* @__PURE__ */ a(
903
+ oe,
904
+ {
905
+ control: t,
906
+ name: e.value,
907
+ label: e.label,
908
+ isFullWidth: !1,
909
+ "data-testid": `managerole-mandatory-field-${e.value}`
910
+ },
911
+ e.value
912
+ )),
913
+ be === !0 && /* @__PURE__ */ a(
914
+ oe,
915
+ {
916
+ name: "isBankDetailsMandatory",
917
+ control: t,
918
+ label: "Bank Details",
919
+ isFullWidth: !1,
920
+ "data-testid": "managerole-bank-details-mandatory-checkbox"
921
+ }
922
+ )
923
+ ] })
924
+ }
925
+ )
926
+ }
927
+ ) }),
928
+ /* @__PURE__ */ r(
929
+ G,
930
+ {
931
+ className: "flex items-center justify-end gap-3 pt-6 border-t",
932
+ sx: { borderColor: "divider" },
933
+ children: [
934
+ /* @__PURE__ */ a(
935
+ me,
936
+ {
937
+ variant: "contained",
938
+ color: "secondary",
939
+ size: "small",
940
+ onClick: $,
941
+ "data-testid": "managerole-close-button",
942
+ children: J("Close")
943
+ }
944
+ ),
945
+ /* @__PURE__ */ a(
946
+ me,
947
+ {
948
+ variant: "contained",
949
+ color: "primary",
950
+ size: "small",
951
+ type: "submit",
952
+ disabled: ie.state === "checking",
953
+ "data-testid": "managerole-submit-button",
954
+ children: i ? `${J("Update Role")}` : `${J("Add Role")}`
955
+ }
956
+ )
957
+ ]
958
+ }
959
+ )
960
+ ]
961
+ }
962
+ )
963
+ ] })
964
+ }
965
+ ) })
966
+ }
967
+ );
968
+ };
969
+ la.propTypes = {
970
+ isUpdate: k.bool,
971
+ role: k.object,
972
+ onClose: k.func,
973
+ open: k.bool,
974
+ setOpen: k.func,
975
+ selectedId: k.string,
976
+ isRoleListModified: k.bool
977
+ };
978
+ export {
979
+ la as default
980
+ };
981
+ //# sourceMappingURL=ManageRole-CyfpySt9.js.map