@kenyaemr/esm-admin-app 5.4.4-pre.98 → 5.4.5-pre.544

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 (582) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/dist/1102.js +1 -0
  3. package/dist/1102.js.map +1 -0
  4. package/dist/1278.js +1 -0
  5. package/dist/1278.js.map +1 -0
  6. package/dist/1442.js +1 -0
  7. package/dist/1442.js.map +1 -0
  8. package/dist/15.js +1 -0
  9. package/dist/15.js.map +1 -0
  10. package/dist/162.js +1 -0
  11. package/dist/162.js.map +1 -0
  12. package/dist/1620.js +1 -0
  13. package/dist/1620.js.map +1 -0
  14. package/dist/1789.js +1 -0
  15. package/dist/1789.js.map +1 -0
  16. package/dist/1831.js +1 -0
  17. package/dist/1831.js.map +1 -0
  18. package/dist/1844.js +1 -0
  19. package/dist/1844.js.map +1 -0
  20. package/dist/1854.js +1 -0
  21. package/dist/1854.js.map +1 -0
  22. package/dist/1919.js +1 -0
  23. package/dist/1919.js.map +1 -0
  24. package/dist/193.js +1 -0
  25. package/dist/193.js.map +1 -0
  26. package/dist/1946.js +1 -0
  27. package/dist/1946.js.map +1 -0
  28. package/dist/2007.js +1 -0
  29. package/dist/2007.js.map +1 -0
  30. package/dist/2043.js +1 -0
  31. package/dist/2043.js.map +1 -0
  32. package/dist/2127.js +1 -0
  33. package/dist/2127.js.map +1 -0
  34. package/dist/2146.js +1 -0
  35. package/dist/2146.js.map +1 -0
  36. package/dist/2152.js +1 -0
  37. package/dist/2152.js.map +1 -0
  38. package/dist/2202.js +1 -0
  39. package/dist/2202.js.map +1 -0
  40. package/dist/2258.js +1 -0
  41. package/dist/2258.js.map +1 -0
  42. package/dist/2394.js +1 -0
  43. package/dist/2394.js.map +1 -0
  44. package/dist/2468.js +1 -0
  45. package/dist/2468.js.map +1 -0
  46. package/dist/2534.js +1 -0
  47. package/dist/2534.js.map +1 -0
  48. package/dist/2556.js +1 -0
  49. package/dist/2556.js.map +1 -0
  50. package/dist/26.js +1 -0
  51. package/dist/26.js.map +1 -0
  52. package/dist/2638.js +1 -0
  53. package/dist/2638.js.map +1 -0
  54. package/dist/2648.js +1 -0
  55. package/dist/2648.js.map +1 -0
  56. package/dist/2709.js +1 -0
  57. package/dist/2709.js.map +1 -0
  58. package/dist/2823.js +1 -0
  59. package/dist/2823.js.map +1 -0
  60. package/dist/2840.js +1 -0
  61. package/dist/2840.js.map +1 -0
  62. package/dist/2842.js +1 -0
  63. package/dist/2842.js.map +1 -0
  64. package/dist/2916.js +1 -0
  65. package/dist/2916.js.map +1 -0
  66. package/dist/2924.js +1 -0
  67. package/dist/2924.js.map +1 -0
  68. package/dist/3137.js +1 -0
  69. package/dist/3137.js.map +1 -0
  70. package/dist/3248.js +1 -0
  71. package/dist/3248.js.map +1 -0
  72. package/dist/3282.js +1 -0
  73. package/dist/3282.js.map +1 -0
  74. package/dist/3285.js +1 -0
  75. package/dist/3285.js.map +1 -0
  76. package/dist/3302.js +1 -0
  77. package/dist/3302.js.map +1 -0
  78. package/dist/3335.js +1 -0
  79. package/dist/3335.js.map +1 -0
  80. package/dist/3378.js +1 -0
  81. package/dist/3378.js.map +1 -0
  82. package/dist/3504.js +1 -0
  83. package/dist/3504.js.map +1 -0
  84. package/dist/356.js +1 -0
  85. package/dist/356.js.map +1 -0
  86. package/dist/3569.js +1 -0
  87. package/dist/3569.js.map +1 -0
  88. package/dist/3580.js +1 -0
  89. package/dist/3580.js.map +1 -0
  90. package/dist/3690.js +1 -0
  91. package/dist/3690.js.map +1 -0
  92. package/dist/3723.js +1 -0
  93. package/dist/3723.js.map +1 -0
  94. package/dist/3745.js +1 -0
  95. package/dist/3745.js.map +1 -0
  96. package/dist/3796.js +1 -0
  97. package/dist/3796.js.map +1 -0
  98. package/dist/3813.js +1 -0
  99. package/dist/3813.js.map +1 -0
  100. package/dist/393.js +6 -0
  101. package/dist/393.js.map +1 -0
  102. package/dist/3953.js +1 -0
  103. package/dist/3953.js.map +1 -0
  104. package/dist/3989.js +1 -0
  105. package/dist/3989.js.map +1 -0
  106. package/dist/4124.js +1 -0
  107. package/dist/4124.js.map +1 -0
  108. package/dist/4163.js +1 -0
  109. package/dist/4163.js.map +1 -0
  110. package/dist/4178.js +1 -0
  111. package/dist/4178.js.map +1 -0
  112. package/dist/4308.js +1 -0
  113. package/dist/4308.js.map +1 -0
  114. package/dist/4487.js +11 -0
  115. package/dist/4487.js.map +1 -0
  116. package/dist/4588.js +1 -0
  117. package/dist/4588.js.map +1 -0
  118. package/dist/4637.js +1 -0
  119. package/dist/4637.js.map +1 -0
  120. package/dist/466.js +1 -0
  121. package/dist/466.js.map +1 -0
  122. package/dist/4711.js +1 -0
  123. package/dist/4711.js.map +1 -0
  124. package/dist/4759.js +1 -0
  125. package/dist/4759.js.map +1 -0
  126. package/dist/4817.js +1 -0
  127. package/dist/4817.js.map +1 -0
  128. package/dist/4818.js +1 -0
  129. package/dist/4818.js.map +1 -0
  130. package/dist/4902.js +1 -0
  131. package/dist/4902.js.map +1 -0
  132. package/dist/4973.js +1 -0
  133. package/dist/4973.js.map +1 -0
  134. package/dist/500.js +1 -0
  135. package/dist/500.js.map +1 -0
  136. package/dist/5086.js +1 -0
  137. package/dist/5086.js.map +1 -0
  138. package/dist/5117.js +1 -0
  139. package/dist/5117.js.map +1 -0
  140. package/dist/5203.js +1 -0
  141. package/dist/5203.js.map +1 -0
  142. package/dist/5361.js +1 -0
  143. package/dist/5361.js.map +1 -0
  144. package/dist/5362.js +1 -0
  145. package/dist/5362.js.map +1 -0
  146. package/dist/5366.js +1 -0
  147. package/dist/5366.js.map +1 -0
  148. package/dist/5536.js +1 -0
  149. package/dist/5536.js.map +1 -0
  150. package/dist/5567.js +1 -0
  151. package/dist/5567.js.map +1 -0
  152. package/dist/5598.js +1 -0
  153. package/dist/5598.js.map +1 -0
  154. package/dist/5676.js +1 -0
  155. package/dist/5676.js.map +1 -0
  156. package/dist/5693.js +1 -0
  157. package/dist/5693.js.map +1 -0
  158. package/dist/5731.js +5 -0
  159. package/dist/5731.js.map +1 -0
  160. package/dist/5767.js +1 -0
  161. package/dist/5767.js.map +1 -0
  162. package/dist/5809.js +1 -0
  163. package/dist/5809.js.map +1 -0
  164. package/dist/5825.js +1 -0
  165. package/dist/5825.js.map +1 -0
  166. package/dist/5932.js +1 -0
  167. package/dist/5932.js.map +1 -0
  168. package/dist/5941.js +1 -0
  169. package/dist/5941.js.map +1 -0
  170. package/dist/6104.js +1 -0
  171. package/dist/6104.js.map +1 -0
  172. package/dist/6273.js +1 -0
  173. package/dist/6273.js.map +1 -0
  174. package/dist/6337.js +1 -0
  175. package/dist/6337.js.map +1 -0
  176. package/dist/6355.js +1 -0
  177. package/dist/{6155.js.map → 6355.js.map} +1 -1
  178. package/dist/6357.js +1 -0
  179. package/dist/6357.js.map +1 -0
  180. package/dist/6427.js +1 -0
  181. package/dist/6427.js.map +1 -0
  182. package/dist/6478.js +7 -0
  183. package/dist/6478.js.map +1 -0
  184. package/dist/6508.js +1 -0
  185. package/dist/6508.js.map +1 -0
  186. package/dist/6567.js +1 -0
  187. package/dist/6567.js.map +1 -0
  188. package/dist/6634.js +1 -0
  189. package/dist/6634.js.map +1 -0
  190. package/dist/6698.js +1 -0
  191. package/dist/6698.js.map +1 -0
  192. package/dist/682.js +1 -0
  193. package/dist/682.js.map +1 -0
  194. package/dist/6848.js +1 -0
  195. package/dist/6848.js.map +1 -0
  196. package/dist/689.js +1 -0
  197. package/dist/689.js.map +1 -0
  198. package/dist/6978.js +1 -0
  199. package/dist/6978.js.map +1 -0
  200. package/dist/7085.js +1 -0
  201. package/dist/7085.js.map +1 -0
  202. package/dist/7187.js +1 -0
  203. package/dist/7187.js.map +1 -0
  204. package/dist/7209.js +1 -0
  205. package/dist/7209.js.map +1 -0
  206. package/dist/740.js +1 -0
  207. package/dist/740.js.map +1 -0
  208. package/dist/7419.js +1 -0
  209. package/dist/7419.js.map +1 -0
  210. package/dist/7478.js +1 -0
  211. package/dist/7478.js.map +1 -0
  212. package/dist/7686.js +1 -0
  213. package/dist/7686.js.map +1 -0
  214. package/dist/770.js +1 -0
  215. package/dist/770.js.map +1 -0
  216. package/dist/7782.js +1 -0
  217. package/dist/7782.js.map +1 -0
  218. package/dist/7783.js +1 -0
  219. package/dist/7783.js.map +1 -0
  220. package/dist/7808.js +1 -0
  221. package/dist/7808.js.map +1 -0
  222. package/dist/781.js +1 -0
  223. package/dist/781.js.map +1 -0
  224. package/dist/8183.js +1 -0
  225. package/dist/8183.js.map +1 -0
  226. package/dist/8196.js +1 -0
  227. package/dist/8196.js.map +1 -0
  228. package/dist/820.js +1 -0
  229. package/dist/820.js.map +1 -0
  230. package/dist/8240.js +1 -0
  231. package/dist/{1074.js.map → 8240.js.map} +1 -1
  232. package/dist/8267.js +1 -0
  233. package/dist/8267.js.map +1 -0
  234. package/dist/8472.js +1 -0
  235. package/dist/8472.js.map +1 -0
  236. package/dist/8521.js +1 -0
  237. package/dist/8521.js.map +1 -0
  238. package/dist/8602.js +1 -0
  239. package/dist/8602.js.map +1 -0
  240. package/dist/8607.js +1 -0
  241. package/dist/8607.js.map +1 -0
  242. package/dist/8743.js +1 -0
  243. package/dist/8743.js.map +1 -0
  244. package/dist/8762.js +1 -0
  245. package/dist/8762.js.map +1 -0
  246. package/dist/8781.js +1 -0
  247. package/dist/8781.js.map +1 -0
  248. package/dist/8812.js +1 -0
  249. package/dist/8812.js.map +1 -0
  250. package/dist/8952.js +1 -0
  251. package/dist/8952.js.map +1 -0
  252. package/dist/8985.js +1 -0
  253. package/dist/8985.js.map +1 -0
  254. package/dist/8996.js +1 -0
  255. package/dist/8996.js.map +1 -0
  256. package/dist/9011.js +1 -0
  257. package/dist/9011.js.map +1 -0
  258. package/dist/9049.js +1 -0
  259. package/dist/9049.js.map +1 -0
  260. package/dist/9050.js +1 -0
  261. package/dist/9050.js.map +1 -0
  262. package/dist/9061.js +1 -0
  263. package/dist/9061.js.map +1 -0
  264. package/dist/9087.js +1 -0
  265. package/dist/9087.js.map +1 -0
  266. package/dist/9148.js +1 -0
  267. package/dist/9148.js.map +1 -0
  268. package/dist/9168.js +1 -0
  269. package/dist/9168.js.map +1 -0
  270. package/dist/935.js +1 -0
  271. package/dist/935.js.map +1 -0
  272. package/dist/9425.js +1 -0
  273. package/dist/944.js +1 -0
  274. package/dist/944.js.map +1 -0
  275. package/dist/9443.js +1 -0
  276. package/dist/9443.js.map +1 -0
  277. package/dist/9520.js +1 -0
  278. package/dist/9520.js.map +1 -0
  279. package/dist/9547.js +1 -0
  280. package/dist/9547.js.map +1 -0
  281. package/dist/9549.js +1 -0
  282. package/dist/9549.js.map +1 -0
  283. package/dist/9603.js +1 -0
  284. package/dist/9603.js.map +1 -0
  285. package/dist/9612.js +1 -0
  286. package/dist/9612.js.map +1 -0
  287. package/dist/9621.js +1 -0
  288. package/dist/9621.js.map +1 -0
  289. package/dist/9662.js +1 -0
  290. package/dist/9662.js.map +1 -0
  291. package/dist/9771.js +1 -0
  292. package/dist/9771.js.map +1 -0
  293. package/dist/9774.js +1 -0
  294. package/dist/9774.js.map +1 -0
  295. package/dist/9800.js +1 -0
  296. package/dist/9800.js.map +1 -0
  297. package/dist/9806.js +1 -0
  298. package/dist/9806.js.map +1 -0
  299. package/dist/992.js +1 -0
  300. package/dist/992.js.map +1 -0
  301. package/dist/kenyaemr-esm-admin-app.js +6 -5
  302. package/dist/kenyaemr-esm-admin-app.js.buildmanifest.json +1636 -742
  303. package/dist/kenyaemr-esm-admin-app.js.map +1 -1
  304. package/dist/main.js +6 -5
  305. package/dist/main.js.map +1 -1
  306. package/dist/routes.json +1 -1
  307. package/package.json +3 -3
  308. package/src/components/confirm-modal/confirmation-operation.test.tsx +8 -19
  309. package/src/components/dashboard/dashboard.component.tsx +4 -1
  310. package/src/components/empty-state/empty-state-log.test.tsx +3 -4
  311. package/src/components/facility-setup/constant/index.ts +3 -0
  312. package/src/components/facility-setup/facility-info.component.tsx +177 -107
  313. package/src/components/facility-setup/facility-info.scss +39 -1
  314. package/src/components/facility-setup/facility-setup.component.tsx +2 -2
  315. package/src/components/facility-setup/type/index.ts +61 -0
  316. package/src/components/facility-setup/useFacilityRegistry.ts +29 -0
  317. package/src/components/global-property/dashboard/global-property-dashboard.component.tsx +23 -0
  318. package/src/components/global-property/dashboard/global-property-dashboard.scss +6 -0
  319. package/src/components/global-property/hooks/useGlobalProperty.ts +64 -0
  320. package/src/components/global-property/hooks/useLogoUpload.ts +28 -0
  321. package/src/components/global-property/index.ts +14 -0
  322. package/src/components/global-property/modal/delete-global-property-modal.component.tsx +71 -0
  323. package/src/components/global-property/modal/delete-global-property-modal.test.tsx +131 -0
  324. package/src/components/global-property/table/global-property-table.component.tsx +241 -0
  325. package/src/components/global-property/table/global-property-table.scss +44 -0
  326. package/src/components/global-property/table/global-property-table.test.tsx +202 -0
  327. package/src/components/global-property/workspace/global-property-form-schema.ts +32 -0
  328. package/src/components/global-property/workspace/global-property.workspace.scss +40 -0
  329. package/src/components/global-property/workspace/global-property.workspace.test.tsx +172 -0
  330. package/src/components/global-property/workspace/global-property.workspace.tsx +260 -0
  331. package/src/components/global-property/workspace/upload-logo.workspace.scss +61 -0
  332. package/src/components/global-property/workspace/upload-logo.workspace.test.tsx +180 -0
  333. package/src/components/global-property/workspace/upload-logo.workspace.tsx +191 -0
  334. package/src/components/hook/healthWorkerRegistry.ts +78 -0
  335. package/src/components/hook/useProfessionalRegistryEnums.ts +59 -0
  336. package/src/components/logs-table/operation-log-table.component.tsx +87 -75
  337. package/src/components/logs-table/operation-log.test.tsx +134 -28
  338. package/src/components/modal/hwr-confirmation.modal.scss +80 -4
  339. package/src/components/modal/hwr-confirmation.modal.tsx +118 -128
  340. package/src/components/modal/hwr-sync.modal.tsx +194 -106
  341. package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-workspace/user-role-scope.workspace.tsx +1 -1
  342. package/src/components/users/manage-users/user-details/user-detail.scss +167 -39
  343. package/src/components/users/manage-users/user-details/user-details.component.tsx +130 -122
  344. package/src/components/users/manage-users/user-management.workspace.scss +233 -95
  345. package/src/components/users/manage-users/user-management.workspace.tsx +481 -375
  346. package/src/components/users/userManagementFormSchema.tsx +17 -8
  347. package/src/config-schema.ts +48 -68
  348. package/src/index.ts +21 -7
  349. package/src/left-pannel-link.component.tsx +5 -3
  350. package/src/root.component.tsx +2 -0
  351. package/src/routes.json +25 -1
  352. package/src/types/index.ts +11 -2
  353. package/translations/am.json +192 -10
  354. package/translations/en.json +205 -23
  355. package/translations/fr.json +260 -58
  356. package/translations/sw.json +329 -147
  357. package/dist/1074.js +0 -1
  358. package/dist/12.js +0 -17
  359. package/dist/12.js.map +0 -1
  360. package/dist/1201.js +0 -1
  361. package/dist/1201.js.map +0 -1
  362. package/dist/1242.js +0 -1
  363. package/dist/1242.js.map +0 -1
  364. package/dist/1311.js +0 -1
  365. package/dist/1311.js.map +0 -1
  366. package/dist/1462.js +0 -1
  367. package/dist/1462.js.map +0 -1
  368. package/dist/1469.js +0 -1
  369. package/dist/1469.js.map +0 -1
  370. package/dist/1506.js +0 -13
  371. package/dist/1506.js.map +0 -1
  372. package/dist/1718.js +0 -1
  373. package/dist/1718.js.map +0 -1
  374. package/dist/1722.js +0 -1
  375. package/dist/1722.js.map +0 -1
  376. package/dist/1772.js +0 -1
  377. package/dist/1772.js.map +0 -1
  378. package/dist/1889.js +0 -1
  379. package/dist/1889.js.map +0 -1
  380. package/dist/1972.js +0 -1
  381. package/dist/1972.js.map +0 -1
  382. package/dist/1990.js +0 -1
  383. package/dist/1990.js.map +0 -1
  384. package/dist/2016.js +0 -1
  385. package/dist/2016.js.map +0 -1
  386. package/dist/2080.js +0 -1
  387. package/dist/2080.js.map +0 -1
  388. package/dist/2096.js +0 -1
  389. package/dist/2096.js.map +0 -1
  390. package/dist/2153.js +0 -1
  391. package/dist/2153.js.map +0 -1
  392. package/dist/216.js +0 -1
  393. package/dist/216.js.map +0 -1
  394. package/dist/2270.js +0 -1
  395. package/dist/2270.js.map +0 -1
  396. package/dist/2294.js +0 -1
  397. package/dist/2294.js.map +0 -1
  398. package/dist/2345.js +0 -1
  399. package/dist/2345.js.map +0 -1
  400. package/dist/2402.js +0 -1
  401. package/dist/2402.js.map +0 -1
  402. package/dist/2500.js +0 -1
  403. package/dist/2500.js.map +0 -1
  404. package/dist/251.js +0 -1
  405. package/dist/251.js.map +0 -1
  406. package/dist/257.js +0 -1
  407. package/dist/257.js.map +0 -1
  408. package/dist/2586.js +0 -1
  409. package/dist/2586.js.map +0 -1
  410. package/dist/2625.js +0 -1
  411. package/dist/2625.js.map +0 -1
  412. package/dist/2652.js +0 -1
  413. package/dist/2652.js.map +0 -1
  414. package/dist/2685.js +0 -1
  415. package/dist/2685.js.map +0 -1
  416. package/dist/2948.js +0 -1
  417. package/dist/2948.js.map +0 -1
  418. package/dist/3089.js +0 -1
  419. package/dist/3089.js.map +0 -1
  420. package/dist/3190.js +0 -1
  421. package/dist/3190.js.map +0 -1
  422. package/dist/3224.js +0 -1
  423. package/dist/3224.js.map +0 -1
  424. package/dist/3366.js +0 -1
  425. package/dist/3366.js.map +0 -1
  426. package/dist/349.js +0 -1
  427. package/dist/349.js.map +0 -1
  428. package/dist/3548.js +0 -1
  429. package/dist/3548.js.map +0 -1
  430. package/dist/3571.js +0 -1
  431. package/dist/3571.js.map +0 -1
  432. package/dist/3691.js +0 -1
  433. package/dist/3691.js.map +0 -1
  434. package/dist/3775.js +0 -1
  435. package/dist/3775.js.map +0 -1
  436. package/dist/3816.js +0 -1
  437. package/dist/3816.js.map +0 -1
  438. package/dist/3852.js +0 -1
  439. package/dist/3852.js.map +0 -1
  440. package/dist/3906.js +0 -1
  441. package/dist/3906.js.map +0 -1
  442. package/dist/3963.js +0 -1
  443. package/dist/3963.js.map +0 -1
  444. package/dist/405.js +0 -1
  445. package/dist/405.js.map +0 -1
  446. package/dist/4296.js +0 -1
  447. package/dist/4296.js.map +0 -1
  448. package/dist/4337.js +0 -1
  449. package/dist/4337.js.map +0 -1
  450. package/dist/4735.js +0 -1
  451. package/dist/4735.js.map +0 -1
  452. package/dist/4744.js +0 -1
  453. package/dist/4744.js.map +0 -1
  454. package/dist/4813.js +0 -2
  455. package/dist/4813.js.map +0 -1
  456. package/dist/4858.js +0 -1
  457. package/dist/4858.js.map +0 -1
  458. package/dist/487.js +0 -1
  459. package/dist/487.js.map +0 -1
  460. package/dist/4970.js +0 -1
  461. package/dist/4970.js.map +0 -1
  462. package/dist/5202.js +0 -1
  463. package/dist/5202.js.map +0 -1
  464. package/dist/5294.js +0 -1
  465. package/dist/5294.js.map +0 -1
  466. package/dist/545.js +0 -1
  467. package/dist/545.js.map +0 -1
  468. package/dist/552.js +0 -1
  469. package/dist/552.js.map +0 -1
  470. package/dist/5592.js +0 -1
  471. package/dist/5592.js.map +0 -1
  472. package/dist/5669.js +0 -1
  473. package/dist/5669.js.map +0 -1
  474. package/dist/5884.js +0 -1
  475. package/dist/5884.js.map +0 -1
  476. package/dist/5940.js +0 -1
  477. package/dist/5940.js.map +0 -1
  478. package/dist/6092.js +0 -1
  479. package/dist/6092.js.map +0 -1
  480. package/dist/6155.js +0 -1
  481. package/dist/6178.js +0 -1
  482. package/dist/6178.js.map +0 -1
  483. package/dist/6399.js +0 -1
  484. package/dist/6399.js.map +0 -1
  485. package/dist/6456.js +0 -1
  486. package/dist/6466.js +0 -3
  487. package/dist/6466.js.map +0 -1
  488. package/dist/6492.js +0 -1
  489. package/dist/6492.js.map +0 -1
  490. package/dist/6676.js +0 -1
  491. package/dist/6676.js.map +0 -1
  492. package/dist/6800.js +0 -1
  493. package/dist/6800.js.map +0 -1
  494. package/dist/6976.js +0 -1
  495. package/dist/6976.js.map +0 -1
  496. package/dist/7005.js +0 -1
  497. package/dist/7005.js.map +0 -1
  498. package/dist/7201.js +0 -1
  499. package/dist/7201.js.map +0 -1
  500. package/dist/7210.js +0 -1
  501. package/dist/7210.js.map +0 -1
  502. package/dist/7234.js +0 -1
  503. package/dist/7234.js.map +0 -1
  504. package/dist/7261.js +0 -1
  505. package/dist/7261.js.map +0 -1
  506. package/dist/7326.js +0 -1
  507. package/dist/7463.js +0 -1
  508. package/dist/7463.js.map +0 -1
  509. package/dist/7528.js +0 -1
  510. package/dist/7528.js.map +0 -1
  511. package/dist/7584.js +0 -1
  512. package/dist/7584.js.map +0 -1
  513. package/dist/7607.js +0 -1
  514. package/dist/7717.js +0 -1
  515. package/dist/7717.js.map +0 -1
  516. package/dist/7737.js +0 -1
  517. package/dist/7737.js.map +0 -1
  518. package/dist/7739.js +0 -1
  519. package/dist/7739.js.map +0 -1
  520. package/dist/7765.js +0 -1
  521. package/dist/7765.js.map +0 -1
  522. package/dist/7820.js +0 -1
  523. package/dist/7820.js.map +0 -1
  524. package/dist/7844.js +0 -1
  525. package/dist/7844.js.map +0 -1
  526. package/dist/7866.js +0 -1
  527. package/dist/7866.js.map +0 -1
  528. package/dist/7916.js +0 -1
  529. package/dist/7916.js.map +0 -1
  530. package/dist/7971.js +0 -1
  531. package/dist/7971.js.map +0 -1
  532. package/dist/8159.js +0 -7
  533. package/dist/8159.js.map +0 -1
  534. package/dist/8244.js +0 -1
  535. package/dist/8244.js.map +0 -1
  536. package/dist/8262.js +0 -1
  537. package/dist/8262.js.map +0 -1
  538. package/dist/834.js +0 -1
  539. package/dist/834.js.map +0 -1
  540. package/dist/8376.js +0 -1
  541. package/dist/8376.js.map +0 -1
  542. package/dist/845.js +0 -1
  543. package/dist/845.js.map +0 -1
  544. package/dist/8546.js +0 -1
  545. package/dist/8546.js.map +0 -1
  546. package/dist/8570.js +0 -1
  547. package/dist/8570.js.map +0 -1
  548. package/dist/87.js +0 -1
  549. package/dist/87.js.map +0 -1
  550. package/dist/8727.js +0 -1
  551. package/dist/8828.js +0 -1
  552. package/dist/8828.js.map +0 -1
  553. package/dist/8860.js +0 -1
  554. package/dist/8860.js.map +0 -1
  555. package/dist/9036.js +0 -1
  556. package/dist/9036.js.map +0 -1
  557. package/dist/9124.js +0 -1
  558. package/dist/9124.js.map +0 -1
  559. package/dist/9182.js +0 -1
  560. package/dist/921.js +0 -1
  561. package/dist/921.js.map +0 -1
  562. package/dist/9404.js +0 -1
  563. package/dist/9404.js.map +0 -1
  564. package/dist/9406.js +0 -1
  565. package/dist/9406.js.map +0 -1
  566. package/dist/9446.js +0 -1
  567. package/dist/9446.js.map +0 -1
  568. package/dist/9449.js +0 -1
  569. package/dist/9449.js.map +0 -1
  570. package/dist/9566.js +0 -5
  571. package/dist/9566.js.map +0 -1
  572. package/dist/9641.js +0 -1
  573. package/dist/9641.js.map +0 -1
  574. package/dist/9711.js +0 -1
  575. package/dist/9711.js.map +0 -1
  576. package/dist/9801.js +0 -1
  577. package/dist/9801.js.map +0 -1
  578. package/dist/9835.js +0 -11
  579. package/dist/9835.js.map +0 -1
  580. package/src/components/facility-setup/facility-setup.resource.tsx +0 -7
  581. package/src/components/hook/healthWorkerAdapter.ts +0 -213
  582. package/src/components/hook/useFacilityInfo.tsx +0 -37
@@ -0,0 +1,61 @@
1
+ export type FacilityRegistryAddress = {
2
+ country?: string;
3
+ county_code?: string;
4
+ county?: string;
5
+ sub_county_code?: string;
6
+ sub_county?: string;
7
+ postal_address?: string;
8
+ physical_location?: string;
9
+ town?: string;
10
+ latitude?: number | null;
11
+ longitude?: number | null;
12
+ };
13
+
14
+ export type FacilityRegistryBedOccupancy = {
15
+ totalBeds?: number;
16
+ normalBeds?: number;
17
+ icuBeds?: number;
18
+ hduBeds?: number;
19
+ dialysisBeds?: number;
20
+ numberOfCots?: number;
21
+ };
22
+
23
+ export type FacilityRegistryRecord = {
24
+ fr_code: string;
25
+ fid_code?: string;
26
+ registration_number?: string;
27
+ official_name?: string;
28
+ keph_level?: string;
29
+ facility_type?: string;
30
+ facility_ownership?: string;
31
+ license_status?: string;
32
+ license_number?: string;
33
+ license_start_date?: string | null;
34
+ license_end_date?: string | null;
35
+ regulatory_body?: string;
36
+ sha_contract_status?: string;
37
+ sha_contract_start_date?: string | null;
38
+ sha_contract_end_date?: string | null;
39
+ is_hub?: boolean;
40
+ facility_phone_number?: string;
41
+ facility_email?: string;
42
+ facility_administrator_name?: string;
43
+ facility_administrator_email?: string;
44
+ facility_administrator_phone?: string;
45
+ facility_administrator_identifier?: string;
46
+ address?: FacilityRegistryAddress;
47
+ regulatory_operational_status?: string;
48
+ sha_operational_status?: string;
49
+ bed_occupancy?: FacilityRegistryBedOccupancy;
50
+ sha_contracted_services?: Array<{ name?: string } | string>;
51
+ last_synced_at?: string;
52
+ last_sync_status?: 'SUCCESS' | 'FAILURE';
53
+ };
54
+
55
+ export type FacilityRegistrySyncResult = {
56
+ success: boolean;
57
+ fr_code: string;
58
+ official_name: string;
59
+ last_synced_at: string;
60
+ last_sync_status: 'SUCCESS' | 'FAILURE';
61
+ };
@@ -0,0 +1,29 @@
1
+ import useSWR from 'swr';
2
+ import { openmrsFetch, restBaseUrl, type FetchResponse } from '@openmrs/esm-framework';
3
+ import { FacilityRegistryRecord, FacilityRegistrySyncResult } from './type';
4
+ import { facilityRegistryUrl } from './constant';
5
+
6
+ export const useFacilityRegistry = () => {
7
+ const { data, error, isLoading, mutate } = useSWR<FetchResponse<FacilityRegistryRecord>>(
8
+ facilityRegistryUrl,
9
+ openmrsFetch,
10
+ {
11
+ revalidateOnFocus: false,
12
+ },
13
+ );
14
+
15
+ const notYetSynced = error?.response?.status === 404;
16
+
17
+ return {
18
+ facility: data?.data,
19
+ isLoading,
20
+ error: notYetSynced ? null : error,
21
+ notYetSynced,
22
+ mutate,
23
+ };
24
+ };
25
+
26
+ export const syncFacilityRegistry = async (): Promise<FacilityRegistrySyncResult> => {
27
+ const response = await openmrsFetch<FacilityRegistrySyncResult>(facilityRegistryUrl + '/sync', { method: 'POST' });
28
+ return response.data;
29
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { PageHeader, FacilityPictogram } from '@openmrs/esm-framework';
3
+ import { useTranslation } from 'react-i18next';
4
+
5
+ import GlobalPropertyTable from '../table/global-property-table.component';
6
+ import styles from './global-property-dashboard.scss';
7
+
8
+ const GlobalPropertyDashboard: React.FC = () => {
9
+ const { t } = useTranslation();
10
+
11
+ return (
12
+ <div>
13
+ <PageHeader
14
+ className={styles.pageHeader}
15
+ title={t('globalProperty', 'Global Property')}
16
+ illustration={<FacilityPictogram />}
17
+ />
18
+ <GlobalPropertyTable />
19
+ </div>
20
+ );
21
+ };
22
+
23
+ export default GlobalPropertyDashboard;
@@ -0,0 +1,6 @@
1
+ @use '@carbon/layout';
2
+ @use '@carbon/colors';
3
+
4
+ .pageHeader {
5
+ border-bottom: 1px solid colors.$gray-10;
6
+ }
@@ -0,0 +1,64 @@
1
+ import { openmrsFetch, restBaseUrl, useOpenmrsPagination } from '@openmrs/esm-framework';
2
+
3
+ import { type SystemSettings } from '../../../types';
4
+
5
+ export type GlobalPropertyPayload = {
6
+ property: string;
7
+ value: string;
8
+ description?: string | null;
9
+ datatypeClassname?: string | null;
10
+ datatypeConfig?: string | null;
11
+ preferredHandlerClassname?: string | null;
12
+ handlerConfig?: string | null;
13
+ };
14
+
15
+ export async function saveOrUpdateGlobalProperty(payload: GlobalPropertyPayload, uuid?: string): Promise<void> {
16
+ const url = uuid ? `${restBaseUrl}/systemsetting/${uuid}` : `${restBaseUrl}/systemsetting`;
17
+ const body: Record<string, unknown> = {
18
+ property: payload.property,
19
+ value: payload.value,
20
+ };
21
+ if (payload.description) {
22
+ body.description = payload.description;
23
+ }
24
+ if (payload.datatypeClassname) {
25
+ body.datatypeClassname = payload.datatypeClassname;
26
+ }
27
+ if (payload.datatypeConfig) {
28
+ body.datatypeConfig = payload.datatypeConfig;
29
+ }
30
+ if (payload.preferredHandlerClassname) {
31
+ body.preferredHandlerClassname = payload.preferredHandlerClassname;
32
+ }
33
+ if (payload.handlerConfig != null) {
34
+ body.handlerConfig = payload.handlerConfig;
35
+ }
36
+
37
+ const response = await openmrsFetch(url, {
38
+ method: 'POST',
39
+ headers: { 'Content-Type': 'application/json' },
40
+ body: JSON.stringify(body),
41
+ });
42
+
43
+ if (!response.ok) {
44
+ const errorData = await response.json().catch(() => ({}));
45
+ throw new Error(errorData?.error?.message ?? 'Failed to save global property');
46
+ }
47
+ }
48
+
49
+ export async function deleteGlobalProperty(uuid: string): Promise<void> {
50
+ const response = await openmrsFetch(`${restBaseUrl}/systemsetting/${uuid}?purge=true`, {
51
+ method: 'DELETE',
52
+ });
53
+ if (!response.ok) {
54
+ const errorData = await response.json().catch(() => ({}));
55
+ throw new Error(errorData?.error?.message ?? 'Failed to delete global property');
56
+ }
57
+ }
58
+
59
+ export function useGlobalProperties(pageSize: number = 10, searchTerm?: string) {
60
+ const searchQuery = searchTerm ? `&q=${encodeURIComponent(searchTerm)}` : '';
61
+ const baseUrl = `${restBaseUrl}/systemsetting?v=default`;
62
+ const url = searchTerm ? `${baseUrl}${searchQuery}` : baseUrl;
63
+ return useOpenmrsPagination<SystemSettings>(url, pageSize);
64
+ }
@@ -0,0 +1,28 @@
1
+ import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
+
3
+ export const ALLOWED_LOGO_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp'];
4
+ export const MAX_LOGO_SIZE_BYTES = 2 * 1024 * 1024; // 2 MB
5
+
6
+ export type LogoTarget = 'prescription' | 'receipt';
7
+
8
+ export type UploadLogoResponse = {
9
+ savedPath: string;
10
+ message: string;
11
+ };
12
+
13
+ export async function uploadLogo(file: File, target: LogoTarget = 'prescription'): Promise<UploadLogoResponse> {
14
+ const formData = new FormData();
15
+ formData.append('file', file);
16
+
17
+ const response = await openmrsFetch(`${restBaseUrl}/palladiumemr/logo?target=${target}`, {
18
+ method: 'POST',
19
+ body: formData,
20
+ });
21
+
22
+ if (!response.ok) {
23
+ const errorData = await response.json().catch(() => ({}));
24
+ throw new Error(errorData?.error ?? errorData?.error?.message ?? 'Failed to upload image');
25
+ }
26
+
27
+ return response.json();
28
+ }
@@ -0,0 +1,14 @@
1
+ import { getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
2
+ import { createLeftPanelLink } from '../../left-pannel-link.component';
3
+ import { moduleName } from '../../constants';
4
+
5
+ // t('globalProperty','Global property')
6
+ export const globalPropertyLink = getSyncLifecycle(
7
+ createLeftPanelLink({ title: 'globalProperty', name: 'global-property' }),
8
+ { moduleName, featureName: 'global-property' },
9
+ );
10
+
11
+ export const globalPropertyDashboard = getAsyncLifecycle(
12
+ () => import('./dashboard/global-property-dashboard.component'),
13
+ { moduleName, featureName: 'global-property' },
14
+ );
@@ -0,0 +1,71 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, InlineLoading } from '@carbon/react';
3
+ import { showSnackbar } from '@openmrs/esm-framework';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import { deleteGlobalProperty } from '../hooks/useGlobalProperty';
7
+
8
+ interface DeleteGlobalPropertyModalProps {
9
+ close: () => void;
10
+ property: string;
11
+ uuid: string;
12
+ onDeleted: () => void;
13
+ }
14
+
15
+ const DeleteGlobalPropertyModal: React.FC<DeleteGlobalPropertyModalProps> = ({ close, property, uuid, onDeleted }) => {
16
+ const { t } = useTranslation();
17
+ const [isDeleting, setIsDeleting] = useState(false);
18
+
19
+ const handleDelete = async () => {
20
+ setIsDeleting(true);
21
+ try {
22
+ await deleteGlobalProperty(uuid);
23
+ showSnackbar({
24
+ isLowContrast: true,
25
+ kind: 'success',
26
+ title: t('gpDeleted', 'Global property deleted'),
27
+ subtitle: t('gpDeletedSubtitle', '{{property}} was deleted successfully.', { property }),
28
+ });
29
+ onDeleted();
30
+ close();
31
+ } catch (error) {
32
+ showSnackbar({
33
+ kind: 'error',
34
+ title: t('gpDeleteError', 'Error deleting global property'),
35
+ subtitle: error?.message,
36
+ });
37
+ } finally {
38
+ setIsDeleting(false);
39
+ }
40
+ };
41
+
42
+ return (
43
+ <>
44
+ <div className="cds--modal-header">
45
+ <h3 className="cds--modal-header__heading">{t('deleteGlobalProperty', 'Delete global property')}</h3>
46
+ </div>
47
+ <div className="cds--modal-content">
48
+ <p>
49
+ {t(
50
+ 'deleteGlobalPropertyConfirmation',
51
+ 'Are you sure you want to delete the global property "{{property}}"?',
52
+ {
53
+ property,
54
+ },
55
+ )}
56
+ </p>
57
+ <p>{t('deleteGlobalPropertyWarning', 'This action cannot be undone.')}</p>
58
+ </div>
59
+ <div className="cds--modal-footer">
60
+ <Button kind="secondary" onClick={close} disabled={isDeleting}>
61
+ {t('cancel', 'Cancel')}
62
+ </Button>
63
+ <Button kind="danger" onClick={handleDelete} disabled={isDeleting}>
64
+ {isDeleting ? <InlineLoading description={t('deleting', 'Deleting...')} /> : t('delete', 'Delete')}
65
+ </Button>
66
+ </div>
67
+ </>
68
+ );
69
+ };
70
+
71
+ export default DeleteGlobalPropertyModal;
@@ -0,0 +1,131 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
5
+ import DeleteGlobalPropertyModal from './delete-global-property-modal.component';
6
+
7
+ const mockShowSnackbar = vi.fn();
8
+ const mockDeleteGlobalProperty = vi.fn();
9
+
10
+ vi.mock('react-i18next', () => ({
11
+ useTranslation: () => ({ t: (_key: string, fallback: string, opts?: Record<string, unknown>) => fallback }),
12
+ }));
13
+
14
+ vi.mock('@openmrs/esm-framework', () => ({
15
+ showSnackbar: (...args: unknown[]) => mockShowSnackbar(...args),
16
+ }));
17
+
18
+ vi.mock('../hooks/useGlobalProperty', () => ({
19
+ deleteGlobalProperty: (...args: unknown[]) => mockDeleteGlobalProperty(...args),
20
+ }));
21
+
22
+ describe('DeleteGlobalPropertyModal', () => {
23
+ const defaultProps = {
24
+ close: vi.fn(),
25
+ property: 'setting.example',
26
+ uuid: 'uuid-abc',
27
+ onDeleted: vi.fn(),
28
+ };
29
+
30
+ beforeEach(() => {
31
+ vi.clearAllMocks();
32
+ });
33
+
34
+ it('displays the modal heading', () => {
35
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
36
+ expect(screen.getByText('Delete global property')).toBeInTheDocument();
37
+ });
38
+
39
+ it('shows the property name in the confirmation message', () => {
40
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
41
+ expect(screen.getByText('Are you sure you want to delete the global property "{{property}}"?')).toBeInTheDocument();
42
+ });
43
+
44
+ it('shows a warning that the action cannot be undone', () => {
45
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
46
+ expect(screen.getByText('This action cannot be undone.')).toBeInTheDocument();
47
+ });
48
+
49
+ it('calls close when the Cancel button is clicked', () => {
50
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
51
+ fireEvent.click(screen.getByText('Cancel'));
52
+ expect(defaultProps.close).toHaveBeenCalledTimes(1);
53
+ });
54
+
55
+ it('does not call onDeleted when Cancel is clicked', () => {
56
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
57
+ fireEvent.click(screen.getByText('Cancel'));
58
+ expect(defaultProps.onDeleted).not.toHaveBeenCalled();
59
+ });
60
+
61
+ it('calls deleteGlobalProperty with the correct uuid when Delete is clicked', async () => {
62
+ mockDeleteGlobalProperty.mockResolvedValue(undefined);
63
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
64
+ fireEvent.click(screen.getByText('Delete'));
65
+ await waitFor(() => {
66
+ expect(mockDeleteGlobalProperty).toHaveBeenCalledWith('uuid-abc');
67
+ });
68
+ });
69
+
70
+ it('shows a success snackbar and closes the modal after successful deletion', async () => {
71
+ mockDeleteGlobalProperty.mockResolvedValue(undefined);
72
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
73
+ fireEvent.click(screen.getByText('Delete'));
74
+ await waitFor(() => {
75
+ expect(mockShowSnackbar).toHaveBeenCalledWith(expect.objectContaining({ kind: 'success' }));
76
+ expect(defaultProps.onDeleted).toHaveBeenCalledTimes(1);
77
+ expect(defaultProps.close).toHaveBeenCalledTimes(1);
78
+ });
79
+ });
80
+
81
+ it('shows an error snackbar when deletion fails', async () => {
82
+ mockDeleteGlobalProperty.mockRejectedValue(new Error('Server error'));
83
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
84
+ fireEvent.click(screen.getByText('Delete'));
85
+ await waitFor(() => {
86
+ expect(mockShowSnackbar).toHaveBeenCalledWith(expect.objectContaining({ kind: 'error' }));
87
+ expect(defaultProps.close).not.toHaveBeenCalled();
88
+ expect(defaultProps.onDeleted).not.toHaveBeenCalled();
89
+ });
90
+ });
91
+
92
+ it('disables both buttons while deletion is in progress', async () => {
93
+ let resolveDelete: () => void;
94
+ mockDeleteGlobalProperty.mockReturnValue(
95
+ new Promise<void>((res) => {
96
+ resolveDelete = res;
97
+ }),
98
+ );
99
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
100
+
101
+ fireEvent.click(screen.getByText('Delete'));
102
+
103
+ await waitFor(() => {
104
+ expect(screen.getByText('Cancel')).toBeDisabled();
105
+ });
106
+
107
+ await act(async () => {
108
+ resolveDelete!();
109
+ });
110
+ });
111
+
112
+ it('shows a loading indicator while deletion is in progress', async () => {
113
+ let resolveDelete: () => void;
114
+ mockDeleteGlobalProperty.mockReturnValue(
115
+ new Promise<void>((res) => {
116
+ resolveDelete = res;
117
+ }),
118
+ );
119
+ render(<DeleteGlobalPropertyModal {...defaultProps} />);
120
+
121
+ fireEvent.click(screen.getByText('Delete'));
122
+
123
+ await waitFor(() => {
124
+ expect(screen.getByText('Deleting...')).toBeInTheDocument();
125
+ });
126
+
127
+ await act(async () => {
128
+ resolveDelete!();
129
+ });
130
+ });
131
+ });
@@ -0,0 +1,241 @@
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
+ import {
3
+ Button,
4
+ DataTable,
5
+ OverflowMenu,
6
+ OverflowMenuItem,
7
+ Pagination,
8
+ Table,
9
+ TableBody,
10
+ TableCell,
11
+ TableContainer,
12
+ TableHead,
13
+ TableHeader,
14
+ TableRow,
15
+ TableToolbar,
16
+ TableToolbarContent,
17
+ TableToolbarSearch,
18
+ Tag,
19
+ type DataTableHeader,
20
+ } from '@carbon/react';
21
+ import { Add, Upload } from '@carbon/react/icons';
22
+ import { useTranslation } from 'react-i18next';
23
+ import { ErrorCard, launchWorkspace2, showModal, useDebounce, usePaginationInfo } from '@openmrs/esm-framework';
24
+
25
+ import { useGlobalProperties } from '../hooks/useGlobalProperty';
26
+ import styles from './global-property-table.scss';
27
+
28
+ const DEFAULT_PAGE_SIZE = 10;
29
+ const PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
30
+
31
+ type GlobalPropertyRow = {
32
+ id: string;
33
+ property: string;
34
+ value: string;
35
+ };
36
+
37
+ const GlobalPropertyTable: React.FC = () => {
38
+ const { t } = useTranslation();
39
+
40
+ const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE);
41
+ const [searchTerm, setSearchTerm] = useState('');
42
+ const debouncedSearchTerm = useDebounce(searchTerm, 300);
43
+
44
+ const {
45
+ data: globalProperties = [],
46
+ error,
47
+ goTo,
48
+ currentPage,
49
+ totalCount,
50
+ mutate,
51
+ } = useGlobalProperties(pageSize, debouncedSearchTerm);
52
+
53
+ const { pageSizes } = usePaginationInfo(DEFAULT_PAGE_SIZE, totalCount, currentPage, globalProperties.length);
54
+
55
+ const headers: Array<DataTableHeader> = useMemo(
56
+ () => [
57
+ { key: 'property', header: t('property', 'Property') },
58
+ { key: 'value', header: t('value', 'Value') },
59
+ ],
60
+ [t],
61
+ );
62
+
63
+ const tableRows: Array<GlobalPropertyRow> = useMemo(
64
+ () =>
65
+ globalProperties.map((gp, idx) => ({
66
+ id: gp?.uuid ?? `gp-${idx}`,
67
+ property: gp?.property ?? '',
68
+ value: gp?.value ?? '',
69
+ })),
70
+ [globalProperties],
71
+ );
72
+
73
+ const handleSearchChange = useCallback(
74
+ (event: React.ChangeEvent<HTMLInputElement> | '', value?: string) => {
75
+ const searchValue = typeof event === 'string' ? value ?? '' : event.target.value;
76
+ setSearchTerm(searchValue);
77
+ if (currentPage !== 1) {
78
+ goTo(1);
79
+ }
80
+ },
81
+ [currentPage, goTo],
82
+ );
83
+
84
+ const handlePaginationChange = useCallback(
85
+ ({ page, pageSize: newSize }: { page: number; pageSize: number }) => {
86
+ if (newSize !== pageSize) {
87
+ setPageSize(newSize);
88
+ }
89
+ goTo(page);
90
+ },
91
+ [pageSize, goTo],
92
+ );
93
+
94
+ const openWorkspace = useCallback(
95
+ (systemSetting?: (typeof globalProperties)[number]) => {
96
+ launchWorkspace2('global-property-workspace', {
97
+ systemSetting,
98
+ mutateGlobalProperty: mutate,
99
+ });
100
+ },
101
+ [globalProperties, mutate],
102
+ );
103
+
104
+ const openUploadImageWorkspace = useCallback(() => {
105
+ launchWorkspace2('upload-logo-workspace', {
106
+ mutateGlobalProperty: mutate,
107
+ });
108
+ }, [mutate]);
109
+
110
+ const handleEdit = useCallback(
111
+ (row: GlobalPropertyRow) => {
112
+ const systemSetting = globalProperties.find((gp) => gp.uuid === row.id);
113
+ openWorkspace(systemSetting);
114
+ },
115
+ [globalProperties, openWorkspace],
116
+ );
117
+
118
+ const handleDelete = useCallback(
119
+ (row: GlobalPropertyRow) => {
120
+ const dispose = showModal('delete-global-property-modal', {
121
+ close: () => dispose(),
122
+ property: row.property,
123
+ uuid: row.id,
124
+ onDeleted: () => mutate(),
125
+ });
126
+ },
127
+ [mutate],
128
+ );
129
+
130
+ if (error) {
131
+ return (
132
+ <div className={styles.dataTableContainer}>
133
+ <ErrorCard error={error} headerTitle={t('globalPropertyError', 'Global property')} />
134
+ </div>
135
+ );
136
+ }
137
+
138
+ return (
139
+ <div className={styles.container}>
140
+ <DataTable size="sm" rows={tableRows} headers={headers} isSortable useZebraStyles>
141
+ {({
142
+ rows,
143
+ headers,
144
+ getHeaderProps,
145
+ getRowProps,
146
+ getBatchActionProps,
147
+ getToolbarProps,
148
+ getTableProps,
149
+ getTableContainerProps,
150
+ }) => {
151
+ const batchActionProps = getBatchActionProps();
152
+
153
+ return (
154
+ <TableContainer
155
+ title={t('globalProperty', 'Global Property')}
156
+ description={t(
157
+ 'globalPropertyDescription',
158
+ 'A list of all global properties for the system. Filter by search term to find specific properties.',
159
+ )}
160
+ {...getTableContainerProps()}>
161
+ <TableToolbar {...getToolbarProps()}>
162
+ <TableToolbarContent aria-hidden={batchActionProps.shouldShowBatchActions}>
163
+ <TableToolbarSearch
164
+ persistent
165
+ onChange={handleSearchChange}
166
+ placeholder={t('searchForGlobalProperties', 'Search for global properties')}
167
+ />
168
+ <Button renderIcon={Add} onClick={() => openWorkspace()} size="sm" kind="primary">
169
+ {t('addGlobalProperty', 'Add global property')}
170
+ </Button>
171
+ <Button renderIcon={Upload} onClick={openUploadImageWorkspace} size="sm" kind="tertiary">
172
+ {t('uploadImage', 'Upload image')}
173
+ </Button>
174
+ </TableToolbarContent>
175
+ </TableToolbar>
176
+
177
+ <Table {...getTableProps()} aria-label="Global properties">
178
+ <TableHead>
179
+ <TableRow>
180
+ {headers.map((header) => (
181
+ <TableHeader {...getHeaderProps({ header })}>{header.header}</TableHeader>
182
+ ))}
183
+ <TableHeader aria-label={t('rowActions', 'Row actions')} />
184
+ </TableRow>
185
+ </TableHead>
186
+
187
+ <TableBody>
188
+ {rows.map((row, index) => {
189
+ return (
190
+ <React.Fragment key={row.id}>
191
+ <TableRow {...getRowProps({ row })}>
192
+ {row.cells.map((cell) => {
193
+ if (cell.info.header === 'status') {
194
+ return (
195
+ <TableCell key={cell.id}>
196
+ <Tag size="sm">{cell.value}</Tag>
197
+ </TableCell>
198
+ );
199
+ }
200
+ return <TableCell key={cell.id}>{cell.value}</TableCell>;
201
+ })}
202
+ <TableCell className="cds--table-column-menu">
203
+ <OverflowMenu flipped aria-label="overflow-menu">
204
+ <OverflowMenuItem
205
+ onClick={() => handleEdit(tableRows[index])}
206
+ itemText={t('edit', 'Edit')}
207
+ />
208
+ <OverflowMenuItem
209
+ isDelete
210
+ onClick={() => handleDelete(tableRows[index])}
211
+ itemText={t('delete', 'Delete')}
212
+ />
213
+ </OverflowMenu>
214
+ </TableCell>
215
+ </TableRow>
216
+ </React.Fragment>
217
+ );
218
+ })}
219
+ </TableBody>
220
+ </Table>
221
+ </TableContainer>
222
+ );
223
+ }}
224
+ </DataTable>
225
+ <Pagination
226
+ itemsPerPageText={t('itemsPerPage', 'Items per page:')}
227
+ forwardText={t('nextPage', 'Next page')}
228
+ backwardText={t('previousPage', 'Previous page')}
229
+ itemRangeText={(min, max, total) => t('minMaxItems', '{{min}}-{{max}} of {{total}} items', { min, max, total })}
230
+ pageRangeText={(_current, total) => t('pageRangeText', 'of {{count}} pages', { count: total })}
231
+ page={currentPage}
232
+ pageSize={pageSize}
233
+ pageSizes={pageSizes?.length > 0 ? pageSizes : PAGE_SIZE_OPTIONS}
234
+ totalItems={totalCount ?? 0}
235
+ onChange={handlePaginationChange}
236
+ />
237
+ </div>
238
+ );
239
+ };
240
+
241
+ export default GlobalPropertyTable;