ui-soxo-bootstrap-core 2.6.40-dev.1 → 2.6.40-dev.11

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 (419) hide show
  1. package/.babelrc +8 -8
  2. package/.github/workflows/npm-publish.yml +5 -4
  3. package/.husky/pre-commit +11 -11
  4. package/.prettierrc.json +10 -10
  5. package/DEVELOPER_GUIDE.md +323 -323
  6. package/babel.config.js +2 -2
  7. package/core/components/component-loader/component-loader.js +125 -125
  8. package/core/components/component-wrapper/component-wrapper.js +121 -121
  9. package/core/components/external-window/DEVELOPER_GUIDE.md +705 -705
  10. package/core/components/external-window/external-window.js +236 -236
  11. package/core/components/external-window/external-window.test.js +80 -80
  12. package/core/components/extra-info/extra-info-details.js +155 -155
  13. package/core/components/extra-info/extra-info-details.scss +26 -26
  14. package/core/components/extra-info/extra-info.js +134 -134
  15. package/core/components/index.js +12 -12
  16. package/core/components/landing-api/landing-api.js +707 -707
  17. package/core/components/landing-api/landing-api.scss +41 -41
  18. package/core/components/license-management/license-alert.js +97 -97
  19. package/core/components/menu-template-api/menu-template-api.js +321 -321
  20. package/core/components/root-application-api/root-application-api.js +174 -174
  21. package/core/index.js +13 -13
  22. package/core/lib/Store.js +369 -369
  23. package/core/lib/components/application-bootstrap/application-bootstrap.js +115 -115
  24. package/core/lib/components/approval-form/approval-form.js +280 -280
  25. package/core/lib/components/approval-form/approval-form.scss +183 -183
  26. package/core/lib/components/approval-list/approval-list.js +143 -143
  27. package/core/lib/components/approval-list/approval-list.scss +2 -2
  28. package/core/lib/components/approval-list/components/request-card/request-card.js +42 -42
  29. package/core/lib/components/approval-list/components/request-card/request-card.scss +30 -30
  30. package/core/lib/components/camera/camera.js +230 -230
  31. package/core/lib/components/camera/camera.scss +86 -86
  32. package/core/lib/components/comment-block/comment-block.js +138 -138
  33. package/core/lib/components/comment-block/comment-block.scss +3 -3
  34. package/core/lib/components/confirm-modal/confirm-modal.js +82 -82
  35. package/core/lib/components/confirm-modal/confirm-modal.scss +2 -2
  36. package/core/lib/components/consent/consent.js +67 -67
  37. package/core/lib/components/consent/pdf-signature.js +299 -299
  38. package/core/lib/components/consent/signature-pad.js +90 -90
  39. package/core/lib/components/consent/signature-pad.scss +14 -14
  40. package/core/lib/components/file-upload/file-upload.js +133 -133
  41. package/core/lib/components/finger-print-reader/finger-print-reader.js +295 -295
  42. package/core/lib/components/finger-print-reader/finger-print-reader.scss +47 -47
  43. package/core/lib/components/finger-print-search/finger-print-search.js +200 -200
  44. package/core/lib/components/finger-print-search/finger-print-search.scss +47 -47
  45. package/core/lib/components/global-header/animations.js +18 -18
  46. package/core/lib/components/global-header/global-header.js +286 -286
  47. package/core/lib/components/global-header/global-header.scss +397 -397
  48. package/core/lib/components/header/generic-header.js +76 -76
  49. package/core/lib/components/header/generic-header.scss +99 -99
  50. package/core/lib/components/image-preview/image-preview.js +33 -33
  51. package/core/lib/components/image-wrapper/image-wrapper.js +108 -108
  52. package/core/lib/components/image-wrapper/image-wrapper.scss +12 -12
  53. package/core/lib/components/index.js +206 -206
  54. package/core/lib/components/landing/landing.js +403 -403
  55. package/core/lib/components/language-switcher/language-switcher.js +49 -49
  56. package/core/lib/components/menu-context/menu-context.js +69 -69
  57. package/core/lib/components/menu-template/menu-template.js +249 -249
  58. package/core/lib/components/menu-template/menu-template.scss +9 -9
  59. package/core/lib/components/modal-search/modal-search.js +153 -153
  60. package/core/lib/components/modal-search/modal-search.scss +78 -78
  61. package/core/lib/components/modal-wrapper/modal-manager.js +15 -15
  62. package/core/lib/components/modal-wrapper/modal-wrapper.js +108 -108
  63. package/core/lib/components/modal-wrapper/modal-wrapper.scss +13 -13
  64. package/core/lib/components/notice-board/notice-board.js +132 -132
  65. package/core/lib/components/notice-board/notice-board.scss +65 -65
  66. package/core/lib/components/page-container/page-container.js +55 -55
  67. package/core/lib/components/page-container/page-container.scss +8 -8
  68. package/core/lib/components/page-header/page-header.js +23 -23
  69. package/core/lib/components/page-header/page-header.scss +17 -17
  70. package/core/lib/components/pdf-viewer/pdf-viewer.js +56 -56
  71. package/core/lib/components/portlet-table/components/table-actions/table-actions.js +58 -58
  72. package/core/lib/components/portlet-table/components/table-actions/table-actions.scss +1 -1
  73. package/core/lib/components/portlet-table/components/table-data/table-data.js +106 -106
  74. package/core/lib/components/portlet-table/portlet-table.js +63 -63
  75. package/core/lib/components/portlet-table/portlet-table.scss +90 -90
  76. package/core/lib/components/progress-bar/progress-bar.js +58 -58
  77. package/core/lib/components/progress-bar/progress-bar.scss +15 -15
  78. package/core/lib/components/request-form/request-form.js +110 -110
  79. package/core/lib/components/root-application/root-application.js +70 -70
  80. package/core/lib/components/rupee/rupee.js +14 -14
  81. package/core/lib/components/script-input/script-input.js +169 -169
  82. package/core/lib/components/script-input/script-input.scss +8 -8
  83. package/core/lib/components/sidemenu/animations.js +51 -51
  84. package/core/lib/components/sidemenu/sidemenu.js +713 -713
  85. package/core/lib/components/sidemenu/sidemenu.scss +314 -314
  86. package/core/lib/components/spotlight-search/spotlight-search.component.js +635 -635
  87. package/core/lib/components/spotlight-search/spotlight-search.component.scss +78 -78
  88. package/core/lib/components/table-wrapper/table-wrapper.js +135 -135
  89. package/core/lib/components/table-wrapper/table-wrapper.scss +72 -72
  90. package/core/lib/components/ui_elements/Loader.js +12 -12
  91. package/core/lib/components/ui_elements/Notify.js +12 -12
  92. package/core/lib/components/ui_elements/PlaceHolder.js +33 -33
  93. package/core/lib/components/web-camera/web-camera.js +161 -161
  94. package/core/lib/components/web-camera/web-camera.scss +28 -28
  95. package/core/lib/core.md +9 -9
  96. package/core/lib/elements/Elements.md +2 -2
  97. package/core/lib/elements/basic/LoggedUserRedirect.js +21 -21
  98. package/core/lib/elements/basic/PrivateRoute.js +16 -16
  99. package/core/lib/elements/basic/button/Button.md +43 -43
  100. package/core/lib/elements/basic/button/button.js +170 -170
  101. package/core/lib/elements/basic/card/Card.md +15 -15
  102. package/core/lib/elements/basic/card/card.js +40 -40
  103. package/core/lib/elements/basic/card/card.scss +13 -13
  104. package/core/lib/elements/basic/checkbox/checkbox.js +23 -23
  105. package/core/lib/elements/basic/col/col.js +15 -15
  106. package/core/lib/elements/basic/copy-to-clipboard/Readme.md +40 -40
  107. package/core/lib/elements/basic/copy-to-clipboard/copy-to-clipboard.js +61 -61
  108. package/core/lib/elements/basic/country-phone-input/Readme.md +98 -98
  109. package/core/lib/elements/basic/country-phone-input/country-phone-input.js +81 -81
  110. package/core/lib/elements/basic/country-phone-input/phone-input.scss +75 -75
  111. package/core/lib/elements/basic/datepicker/datepicker.js +33 -33
  112. package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +203 -203
  113. package/core/lib/elements/basic/empty/empty.js +14 -14
  114. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.js +118 -118
  115. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.scss +10 -10
  116. package/core/lib/elements/basic/form/form.js +70 -70
  117. package/core/lib/elements/basic/form/form.scss +3 -3
  118. package/core/lib/elements/basic/image/image.js +45 -45
  119. package/core/lib/elements/basic/image/image.scss +17 -17
  120. package/core/lib/elements/basic/image/readme.md +26 -26
  121. package/core/lib/elements/basic/image-viewer/image-viewer.js +108 -108
  122. package/core/lib/elements/basic/image-viewer/image-viewer.scss +7 -7
  123. package/core/lib/elements/basic/input/input.js +81 -81
  124. package/core/lib/elements/basic/input/readme.md +77 -77
  125. package/core/lib/elements/basic/json-input/json-input.js +51 -51
  126. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.js +216 -216
  127. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.scss +28 -28
  128. package/core/lib/elements/basic/menu-tree/menu-tree.js +127 -127
  129. package/core/lib/elements/basic/modal/modal.js +64 -64
  130. package/core/lib/elements/basic/modal/readme.md +62 -62
  131. package/core/lib/elements/basic/popconfirm/popconfirm.js +17 -17
  132. package/core/lib/elements/basic/popover/popover.js +12 -12
  133. package/core/lib/elements/basic/radio/radio.js +18 -18
  134. package/core/lib/elements/basic/rangepicker/rangepicker.js +141 -141
  135. package/core/lib/elements/basic/rangepicker/rangepicker.scss +24 -24
  136. package/core/lib/elements/basic/rangepicker/readme.md +81 -81
  137. package/core/lib/elements/basic/reference-select/readme.md +18 -18
  138. package/core/lib/elements/basic/reference-select/reference-select.js +337 -337
  139. package/core/lib/elements/basic/row/row.js +15 -15
  140. package/core/lib/elements/basic/select/select.js +46 -46
  141. package/core/lib/elements/basic/select-box/readme.md +52 -52
  142. package/core/lib/elements/basic/select-box/select-box.js +63 -63
  143. package/core/lib/elements/basic/skeleton/readme.md +35 -35
  144. package/core/lib/elements/basic/skeleton/skeleton.js +35 -35
  145. package/core/lib/elements/basic/skeleton/skeleton.scss +53 -53
  146. package/core/lib/elements/basic/space/space.js +12 -12
  147. package/core/lib/elements/basic/switch/readme.md +29 -29
  148. package/core/lib/elements/basic/switch/switch.js +67 -67
  149. package/core/lib/elements/basic/tab/tab.js +14 -14
  150. package/core/lib/elements/basic/table/readme.md +8 -8
  151. package/core/lib/elements/basic/table/table.js +95 -95
  152. package/core/lib/elements/basic/tag/tag.js +63 -63
  153. package/core/lib/elements/basic/tag/tag.scss +2 -2
  154. package/core/lib/elements/basic/timeline/timeline.js +13 -13
  155. package/core/lib/elements/basic/title/readme.md +20 -20
  156. package/core/lib/elements/basic/title/title.js +37 -37
  157. package/core/lib/elements/basic/user-search/user-search.js +192 -192
  158. package/core/lib/elements/complex/barcode/barcode.js +27 -27
  159. package/core/lib/elements/complex/bargraph/bar-graph.js +262 -262
  160. package/core/lib/elements/complex/basic-table/basic-table.js +110 -110
  161. package/core/lib/elements/complex/basic-table/basic-table.scss +4 -4
  162. package/core/lib/elements/complex/date-display/date-display.js +37 -37
  163. package/core/lib/elements/complex/error-boundary/error-boundary.js +29 -29
  164. package/core/lib/elements/complex/google-location-input/map-container-library-load.js +92 -92
  165. package/core/lib/elements/complex/google-map/google-map.js +230 -230
  166. package/core/lib/elements/complex/google-map/google-map.scss +13 -13
  167. package/core/lib/elements/complex/line-graph/line-graph.js +108 -108
  168. package/core/lib/elements/complex/location-search-input/location-search-input.js +100 -100
  169. package/core/lib/elements/complex/pie-chart/pie-chart.js +202 -202
  170. package/core/lib/elements/complex/qr-code/qr-code.js +27 -27
  171. package/core/lib/elements/complex/qrscanner/qrscanner.js +57 -57
  172. package/core/lib/elements/complex/search-debounce/search-debounce.js +37 -37
  173. package/core/lib/elements/complex/statistic-card/dashboard-statistic-card.js +75 -75
  174. package/core/lib/elements/complex/statistic-card/statistic-card.js +28 -28
  175. package/core/lib/elements/index.js +226 -226
  176. package/core/lib/hooks/device-detect.js +25 -25
  177. package/core/lib/hooks/index.js +9 -9
  178. package/core/lib/hooks/use-location.js +33 -33
  179. package/core/lib/hooks/use-otp-timer.js +80 -80
  180. package/core/lib/hooks/use-window-size.js +34 -34
  181. package/core/lib/i18n.js +69 -69
  182. package/core/lib/index.js +106 -106
  183. package/core/lib/introduction.md +73 -73
  184. package/core/lib/js-styleguide.md +4112 -4112
  185. package/core/lib/models/actions/actions.js +127 -127
  186. package/core/lib/models/actions/components/action-detail/action-detail.js +190 -190
  187. package/core/lib/models/actions/components/custom-actions/custom-actions.js +185 -185
  188. package/core/lib/models/attachments/attachments.js +231 -231
  189. package/core/lib/models/base-loader.js +99 -99
  190. package/core/lib/models/base.js +716 -716
  191. package/core/lib/models/branches/branches.js +125 -125
  192. package/core/lib/models/checklists/checklists.js +114 -114
  193. package/core/lib/models/columns/columns.js +169 -169
  194. package/core/lib/models/columns/components/columns-add/columns-add.js +171 -171
  195. package/core/lib/models/comments/comments.js +213 -213
  196. package/core/lib/models/departments/departments.js +107 -107
  197. package/core/lib/models/financial-years/financial_years.js +127 -127
  198. package/core/lib/models/forms/components/form-creator/form-creator.js +665 -665
  199. package/core/lib/models/forms/components/form-creator/form-creator.scss +39 -39
  200. package/core/lib/models/forms/components/form-detail/form-detail.js +224 -224
  201. package/core/lib/models/forms/forms.js +121 -121
  202. package/core/lib/models/index.js +203 -203
  203. package/core/lib/models/invoice-numbers/invoice_numbers.js +204 -204
  204. package/core/lib/models/lookup-types/components/lookup-detail/lookup-detail.js +145 -145
  205. package/core/lib/models/lookup-types/lookup-types.js +113 -113
  206. package/core/lib/models/lookup-values/components/lookup-values-add/lookup-values-add.js +126 -126
  207. package/core/lib/models/lookup-values/lookup-values.js +107 -107
  208. package/core/lib/models/menu-roles/menu-roles.js +127 -127
  209. package/core/lib/models/menus/components/menu-add/menu-add.js +228 -228
  210. package/core/lib/models/menus/components/menu-detail/menu-detail.js +170 -170
  211. package/core/lib/models/menus/components/menu-list/menu-list.js +550 -550
  212. package/core/lib/models/menus/components/menu-list/menu-list.scss +5 -5
  213. package/core/lib/models/menus/components/menu-roles-add/menu-roles-add.js +183 -183
  214. package/core/lib/models/menus/menus.js +499 -499
  215. package/core/lib/models/models/components/model-detail/model-detail.js +137 -137
  216. package/core/lib/models/models/components/models.js +128 -128
  217. package/core/lib/models/modules/modules.js +204 -204
  218. package/core/lib/models/outbox/outbox.js +73 -73
  219. package/core/lib/models/pages/pages.js +107 -107
  220. package/core/lib/models/permissions/permissions.js +71 -71
  221. package/core/lib/models/process/components/process-add/process-add.js +181 -181
  222. package/core/lib/models/process/components/process-dashboard/process-dashboard.js +1068 -1068
  223. package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +66 -66
  224. package/core/lib/models/process/components/process-detail/process-detail.js +140 -140
  225. package/core/lib/models/process/components/process-timeline/process-timeline.js +139 -139
  226. package/core/lib/models/process/components/task-detail/task-detail.js +240 -240
  227. package/core/lib/models/process/components/task-detail/task-detail.scss +27 -27
  228. package/core/lib/models/process/components/task-form/task-form.js +528 -528
  229. package/core/lib/models/process/components/task-form/task-form.scss +7 -7
  230. package/core/lib/models/process/components/task-list/task-list.js +221 -221
  231. package/core/lib/models/process/components/task-list/task-list.scss +14 -14
  232. package/core/lib/models/process/components/task-overview/task-overview.js +299 -299
  233. package/core/lib/models/process/components/task-overview-legacy/task-overview-legacy.js +192 -192
  234. package/core/lib/models/process/components/task-routes/task-routes.js +45 -45
  235. package/core/lib/models/process/components/task-status/task-status.js +175 -175
  236. package/core/lib/models/process/components/task-status/task-status.scss +11 -11
  237. package/core/lib/models/process/process.js +780 -780
  238. package/core/lib/models/process-transactions/process-transactions.js +123 -123
  239. package/core/lib/models/roles/roles.js +106 -106
  240. package/core/lib/models/scripts/scripts.js +111 -111
  241. package/core/lib/models/step-transactions/step-transcations.js +147 -147
  242. package/core/lib/models/steps/components/step-add/step-add.js +261 -261
  243. package/core/lib/models/steps/components/step-detail/step-detail.js +157 -157
  244. package/core/lib/models/steps/steps.js +356 -356
  245. package/core/lib/models/user-preferences/user-preferences.js +83 -83
  246. package/core/lib/models/users/components/user-add/user-add.js +226 -226
  247. package/core/lib/models/users/users.js +119 -119
  248. package/core/lib/modules/business/launch-page/launch-page.js +29 -29
  249. package/core/lib/modules/business/launch-page/launch-page.scss +5 -5
  250. package/core/lib/modules/business/slots/slots.js +231 -231
  251. package/core/lib/modules/business/slots/slots.scss +108 -108
  252. package/core/lib/modules/forms/components/field-customizer/field-customizer.js +138 -138
  253. package/core/lib/modules/forms/components/field-selector/field-selector.js +157 -157
  254. package/core/lib/modules/forms/components/field-selector/field-selector.scss +25 -25
  255. package/core/lib/modules/forms/components/form-display/form-display.js +203 -203
  256. package/core/lib/modules/forms/components/form-display/form-display.scss +9 -9
  257. package/core/lib/modules/forms/components/tab-customizer/tab-customizer.js +124 -124
  258. package/core/lib/modules/generic/generic-add/generic-add.js +213 -213
  259. package/core/lib/modules/generic/generic-detail/generic-detail.js +199 -199
  260. package/core/lib/modules/generic/generic-edit/generic-edit.js +120 -120
  261. package/core/lib/modules/generic/generic-list/ExportReactCSV.js +414 -414
  262. package/core/lib/modules/generic/generic-list/generic-list.js +705 -705
  263. package/core/lib/modules/generic/generic-list/generic-list.scss +68 -68
  264. package/core/lib/modules/generic/generic-upload/generic-upload.js +483 -483
  265. package/core/lib/modules/generic/table-settings/table-settings.js +226 -226
  266. package/core/lib/modules/generic/table-settings/table-settings.scss +37 -37
  267. package/core/lib/modules/index.js +52 -52
  268. package/core/lib/modules/modules-routes/module-routes.js +35 -35
  269. package/core/lib/pages/change-password/change-password.js +204 -204
  270. package/core/lib/pages/change-password/change-password.scss +73 -73
  271. package/core/lib/pages/homepage/homepage.js +53 -53
  272. package/core/lib/pages/index.js +19 -19
  273. package/core/lib/pages/login/commnication-mode-selection.js +46 -46
  274. package/core/lib/pages/login/communication-mode-selection.scss +60 -60
  275. package/core/lib/pages/login/login.js +872 -872
  276. package/core/lib/pages/login/login.scss +353 -353
  277. package/core/lib/pages/login/reset-password.js +124 -124
  278. package/core/lib/pages/login/reset-password.scss +31 -31
  279. package/core/lib/pages/manage-users/manage-users.js +429 -429
  280. package/core/lib/pages/manage-users/manage-users.scss +25 -25
  281. package/core/lib/pages/profile/profile.js +247 -247
  282. package/core/lib/pages/profile/profile.scss +107 -107
  283. package/core/lib/pages/profile/theme-config.js +18 -18
  284. package/core/lib/pages/profile/themes-backup.json +310 -310
  285. package/core/lib/pages/profile/themes.json +254 -254
  286. package/core/lib/pages/register/register.js +176 -176
  287. package/core/lib/pages/register/register.scss +128 -128
  288. package/core/lib/react-styleguide.md +756 -756
  289. package/core/lib/utils/api/api.utils.js +207 -207
  290. package/core/lib/utils/api/readme.md +426 -426
  291. package/core/lib/utils/async.js +35 -35
  292. package/core/lib/utils/common/common.utils.js +237 -237
  293. package/core/lib/utils/common/readme.md +30 -30
  294. package/core/lib/utils/date/date.utils.js +295 -295
  295. package/core/lib/utils/date/readme.md +2 -2
  296. package/core/lib/utils/firebase.support.utils.js +98 -98
  297. package/core/lib/utils/firebase.utils.js +808 -808
  298. package/core/lib/utils/font-awesome.utils.js +168 -168
  299. package/core/lib/utils/form/form.utils.js +255 -255
  300. package/core/lib/utils/generic/generic.utils.js +70 -70
  301. package/core/lib/utils/http/auth.helper.js +95 -95
  302. package/core/lib/utils/http/http.utils.js +186 -186
  303. package/core/lib/utils/http/readme.md +14 -14
  304. package/core/lib/utils/index.js +43 -43
  305. package/core/lib/utils/location/location.utils.js +137 -137
  306. package/core/lib/utils/location/readme.md +18 -18
  307. package/core/lib/utils/modal.utils.js +15 -15
  308. package/core/lib/utils/notification.utils.js +34 -34
  309. package/core/lib/utils/pwa/pwa.utils.js +88 -88
  310. package/core/lib/utils/script.utils.js +235 -235
  311. package/core/lib/utils/setting.utils.js +68 -68
  312. package/core/lib/utils/upload.utils.js +29 -29
  313. package/core/models/Preference/Preferences.js +46 -46
  314. package/core/models/base/base.js +403 -403
  315. package/core/models/base-clone-loader.js +107 -107
  316. package/core/models/base-clone.js +187 -187
  317. package/core/models/base-loader.js +97 -97
  318. package/core/models/core-scripts/core-scripts.js +179 -179
  319. package/core/models/dashboard/dashboard.js +201 -201
  320. package/core/models/detail-loader.js +88 -88
  321. package/core/models/doctor/components/doctor-add/doctor-add.js +432 -432
  322. package/core/models/doctor/components/doctor-add/doctor-add.scss +32 -32
  323. package/core/models/groups.js +82 -82
  324. package/core/models/index.js +100 -100
  325. package/core/models/lookup-types/components/lookup-detail/lookup-detail.js +129 -129
  326. package/core/models/lookup-types/lookup-types.js +96 -96
  327. package/core/models/lookup-values/components/lookup-values-modal/lookup-values-modal.js +95 -95
  328. package/core/models/lookup-values/lookup-values.js +92 -92
  329. package/core/models/menu-roles/components/menu-roles-add/menu-roles-add.js +153 -153
  330. package/core/models/menu-roles/menu-roles.js +158 -158
  331. package/core/models/menus/components/menu-add/menu-add.js +288 -288
  332. package/core/models/menus/components/menu-add/menu-add.scss +31 -31
  333. package/core/models/menus/components/menu-detail/menu-detail.js +263 -263
  334. package/core/models/menus/components/menu-list/menu-list.js +392 -392
  335. package/core/models/menus/components/menu-lists/menu-lists.js +584 -584
  336. package/core/models/menus/components/menu-lists/menu-lists.scss +46 -46
  337. package/core/models/menus/menus.js +338 -338
  338. package/core/models/model-columns.js +121 -121
  339. package/core/models/models/components/model-detail/model-add.js +120 -120
  340. package/core/models/models/components/model-detail/model-detail.js +133 -133
  341. package/core/models/models/models.js +154 -154
  342. package/core/models/pages/components/page-add/page-add.js +163 -163
  343. package/core/models/pages/components/page-add/page-add.scss +30 -30
  344. package/core/models/pages/components/page-details/page-details.js +209 -209
  345. package/core/models/pages/components/page-list/page-list.js +248 -248
  346. package/core/models/pages/pages.js +142 -142
  347. package/core/models/pages.js +142 -142
  348. package/core/models/roles/components/role-add/menu-label.js +14 -14
  349. package/core/models/roles/components/role-add/menu-tree.js +127 -127
  350. package/core/models/roles/components/role-add/role-add.js +222 -222
  351. package/core/models/roles/components/role-add/role-add.scss +4 -4
  352. package/core/models/roles/components/role-list/role-list.js +406 -406
  353. package/core/models/roles/roles.js +196 -196
  354. package/core/models/staff/components/staff-add/staff-add.js +455 -455
  355. package/core/models/user-roles/components/user-roles-add/user-roles-add.js +149 -149
  356. package/core/models/user-roles/user-roles.js +113 -113
  357. package/core/models/users/components/assign-role/assign-role.js +428 -428
  358. package/core/models/users/components/assign-role/assign-role.scss +281 -281
  359. package/core/models/users/components/assign-role/avatar-props.js +45 -45
  360. package/core/models/users/components/user-add/user-add.js +847 -847
  361. package/core/models/users/components/user-add/user-edit.js +110 -110
  362. package/core/models/users/components/user-detail/user-detail.js +236 -236
  363. package/core/models/users/components/user-list/user-list.js +397 -397
  364. package/core/models/users/users.js +379 -379
  365. package/core/modules/Informations/change-info/change-info.js +618 -618
  366. package/core/modules/Informations/change-info/change-info.scss +134 -134
  367. package/core/modules/dashboard/components/dashboard-card/animations.js +64 -64
  368. package/core/modules/dashboard/components/dashboard-card/dashboard-card.js +197 -197
  369. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +430 -430
  370. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.scss +59 -59
  371. package/core/modules/dashboard/components/pop-query-dashboard/pop-query-dashboard.js +66 -66
  372. package/core/modules/generic/components/generic-add/generic-add.js +121 -121
  373. package/core/modules/generic/components/generic-add/generic-add.scss +13 -13
  374. package/core/modules/generic/components/generic-add-modal/generic-add-modal.js +125 -125
  375. package/core/modules/generic/components/generic-add-modal/generic-add-modal.scss +13 -13
  376. package/core/modules/generic/components/generic-detail/generic-detail.js +184 -184
  377. package/core/modules/generic/components/generic-detail/generic-detail.scss +25 -25
  378. package/core/modules/generic/components/generic-edit/generic-edit.js +123 -123
  379. package/core/modules/generic/components/generic-list/generic-list.js +335 -335
  380. package/core/modules/generic/components/generic-list/generic-list.scss +35 -35
  381. package/core/modules/index.js +42 -42
  382. package/core/modules/module-routes/module-routes.js +37 -37
  383. package/core/modules/reporting/components/index.js +6 -6
  384. package/core/modules/reporting/components/reporting-dashboard/README.md +316 -316
  385. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +271 -271
  386. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.scss +76 -76
  387. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +90 -90
  388. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -74
  389. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +449 -449
  390. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +199 -199
  391. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1116 -1116
  392. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +215 -215
  393. package/core/modules/reporting/components/reporting-dashboard/reporting-table.js +519 -519
  394. package/core/modules/steps/action-buttons.js +92 -92
  395. package/core/modules/steps/action-buttons.scss +62 -62
  396. package/core/modules/steps/chat-assistant.js +141 -141
  397. package/core/modules/steps/narration.js +192 -192
  398. package/core/modules/steps/openai-realtime.js +275 -275
  399. package/core/modules/steps/progress-storage.js +140 -140
  400. package/core/modules/steps/readme.md +167 -167
  401. package/core/modules/steps/steps.js +1567 -1567
  402. package/core/modules/steps/steps.scss +907 -907
  403. package/core/modules/steps/timeline.js +56 -56
  404. package/core/modules/steps/voice-navigation.js +709 -709
  405. package/core/pages/homepage-api/homepage-api.js +106 -106
  406. package/core/pages/homepage-api/homepage-api.scss +233 -233
  407. package/core/pages/homepage-api/menu-dashboard.js +169 -169
  408. package/core/pages/homepage-api/menu-dashboard.scss +11 -11
  409. package/core/translation.json +53 -53
  410. package/core/translations.json +19 -19
  411. package/core/utils/script.utils.js +129 -129
  412. package/core/utils/settings.utils.js +25 -25
  413. package/eslint.config.mjs +79 -79
  414. package/index.js +35 -35
  415. package/jest.config.js +7 -7
  416. package/jest.setup.js +1 -1
  417. package/package.json +124 -124
  418. package/tsconfig.json +26 -26
  419. package/webpack.config.js +173 -173
@@ -1,449 +1,449 @@
1
- import React, { useState, useContext } from 'react';
2
- import { Modal, Tag } from 'antd';
3
- import * as Icons from '@ant-design/icons';
4
- import { Link } from 'react-router-dom';
5
- import { GlobalContext, safeJSON, Location } from '../../../../../lib';
6
- // import { PdfViewer } from '../../../../../lib';
7
- import { CoreScripts } from '../../../../../models';
8
-
9
- /**
10
- * Utilities for rendering Reporting Dashboard display columns.
11
- *
12
- * Backward-compatibility contract for action columns:
13
- * 1. `entry.field === 'action'` is always treated as legacy action behavior.
14
- * 2. `entry.type === 'action' && entry.field !== 'action'` is treated as the new action layer.
15
- * 3. All other entries follow existing non-action render logic.
16
- */
17
-
18
- /**
19
- * @typedef {Object} ReplaceVariable
20
- * @property {string} field Field name from row data used to replace `@field;` placeholders in `redirect_link`.
21
- */
22
-
23
- /**
24
- * @typedef {Object} DisplayColumnEntry
25
- * @property {string} [field] Source field name from row data.
26
- * @property {string} [type] Supported values include `link`, `action`, `number`.
27
- * @property {string} [title] Display title.
28
- * @property {string} [tooltip] Optional tooltip text for table header.
29
- * @property {string} [color] Static text color for default text rendering.
30
- * @property {boolean} [enableColor] Enables color-based rendering using `record.color_code`.
31
- * @property {string} [columnType] When `enableColor` is true, supports `tag` and `span`.
32
- * @property {Object.<string, {icon: string, color: string, size: string}>} [displayIcons] Icon mapping keyed by row value.
33
- * @property {string} [display_name_link] Legacy action link label fallback.
34
- * @property {string} [label] New action link label fallback.
35
- * @property {string} [redirect_link] Redirect template (example: `/path/@opb_id;`).
36
- * @property {ReplaceVariable[]} [replace_variables] Placeholder replacement config for `redirect_link`.
37
- * @property {string} [component] Custom component name for `field === 'custom'`.
38
- * @property {{field: string, value: string}[]} [props] Mapping from record fields to custom component prop keys.
39
- * @property {Object} [config] Static props passed to custom component.
40
- * @property {(record: DisplayRecord) => React.ReactNode} [render] Optional custom render override.
41
- */
42
-
43
- /**
44
- * @typedef {Object.<string, any>} DisplayRecord
45
- */
46
-
47
- /**
48
- * Checks if the column entry is a legacy action configuration.
49
- *
50
- * @param {DisplayColumnEntry} entry
51
- * @returns {boolean}
52
- */
53
- export function isLegacyActionEntry(entry = {}) {
54
- return entry.field === 'action';
55
- }
56
-
57
- /**
58
- * Checks if the column entry is a new action-type configuration.
59
- *
60
- * @param {DisplayColumnEntry} entry
61
- * @returns {boolean}
62
- */
63
- export function isActionTypeEntry(entry = {}) {
64
- return entry.type === 'action' && entry.field !== 'action';
65
- }
66
-
67
- /**
68
- * Builds redirect link by replacing configured placeholders with row values.
69
- *
70
- * Placeholder format in `redirect_link` is `@field;`.
71
- * Example:
72
- * redirect_link: `/visit/@opb_id;/bill/@opno;`
73
- * replace_variables: [{ field: 'opb_id' }, { field: 'opno' }]
74
- * result: `/visit/123/bill/OP-100`
75
- *
76
- * @param {DisplayColumnEntry} entry
77
- * @param {DisplayRecord} record
78
- * @returns {string}
79
- */
80
- export function getRedirectLink(entry = {}, record = {}, CustomComponents = {}) {
81
- let redirectLink = entry.redirect_link || '';
82
-
83
- if (Array.isArray(entry.replace_variables)) {
84
- entry.replace_variables.forEach((replacement) => {
85
- const value = record[replacement.field] || '';
86
- redirectLink = redirectLink.replace(new RegExp(`@${replacement.field};`, 'g'), value);
87
- });
88
- }
89
-
90
- return redirectLink;
91
- }
92
-
93
- /**
94
- * Resolves the PDF/file location for file-based action entries.
95
- *
96
- * Supports either:
97
- * - `entry.file_location` as a direct URL/path
98
- * - `entry.file_location` as a record field name
99
- *
100
- * @param {DisplayColumnEntry} entry
101
- * @param {DisplayRecord} record
102
- * @returns {string}
103
- */
104
- export function getFileLocation(entry = {}, record = {}) {
105
- if (entry.file_location && typeof entry.file_location === 'string' && record[entry.file_location]) {
106
- return record[entry.file_location];
107
- }
108
-
109
- return record.file_location || entry.file_location || '';
110
- }
111
-
112
- /**
113
- * Resolves a value from the row when a config field points to a record key,
114
- * otherwise returns the provided literal value.
115
- *
116
- * @param {*} value
117
- * @param {DisplayRecord} record
118
- * @returns {*}
119
- */
120
- function resolveRecordValue(value, record = {}) {
121
- if (typeof value === 'string' && Object.prototype.hasOwnProperty.call(record, value)) {
122
- return record[value];
123
- }
124
-
125
- return value;
126
- }
127
-
128
- /**
129
- * Resolves action label text with backward-compatible precedence.
130
- *
131
- * Legacy action (`field === 'action'`):
132
- * - `entry.display_name_link`
133
- * - `"View"`
134
- *
135
- * New action layer (`type === 'action' && field !== 'action'`):
136
- * - `record[entry.field]`
137
- * - `entry.label`
138
- * - `entry.display_name_link`
139
- * - `"View"`
140
- *
141
- * @param {DisplayColumnEntry} entry
142
- * @param {DisplayRecord} record
143
- * @returns {string}
144
- */
145
- export function getActionLabel(entry = {}, record = {}) {
146
- // Legacy action path should stay unchanged.
147
- if (isLegacyActionEntry(entry)) {
148
- return entry.display_name_link ? entry.display_name_link : 'View';
149
- }
150
-
151
- const fieldValue = entry.field ? record[entry.field] : null;
152
- if (fieldValue !== undefined && fieldValue !== null && fieldValue !== '') {
153
- return fieldValue;
154
- }
155
-
156
- if (entry.label) {
157
- return entry.label;
158
- }
159
-
160
- if (entry.display_name_link) {
161
- return entry.display_name_link;
162
- }
163
-
164
- return 'View';
165
- }
166
-
167
- /**
168
- * Renders configured custom component cells (`field === 'custom'`).
169
- *
170
- * Each `entry.props` item maps a record field to a prop name:
171
- * `{ field: 'status_text', value: 'description' }` becomes
172
- * `LoadedComponent({ description: record.status_text })`.
173
- *
174
- * @param {Object} root0
175
- * @param {DisplayColumnEntry} root0.entry
176
- * @param {DisplayRecord} root0.record
177
- * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
178
- * @param {Function} root0.refresh
179
- * @returns {React.ReactNode}
180
- */
181
- function renderCustomComponent({ entry, record, CustomComponents, refresh }) {
182
- const componentName = entry.component;
183
- const genericComponents = CustomComponents || {};
184
-
185
- if (!componentName || !genericComponents[componentName]) {
186
- return null;
187
- }
188
-
189
- const LoadedComponent = genericComponents[componentName];
190
- const propValue = {};
191
-
192
- if (Array.isArray(entry.props)) {
193
- entry.props.forEach((values) => {
194
- const valueCreation = record[values.field];
195
- propValue[values.value] = valueCreation;
196
- });
197
- }
198
-
199
- return (
200
- <LoadedComponent
201
- {...entry.config}
202
- callback={() => {
203
- refresh();
204
- }}
205
- {...record}
206
- {...propValue}
207
- />
208
- );
209
- }
210
-
211
- /**
212
- * Renders a PDF file action inside a modal viewer.
213
- *
214
- * @param {Object} root0
215
- * @param {DisplayColumnEntry} root0.entry
216
- * @param {DisplayRecord} root0.record
217
- * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
218
- * @returns {React.ReactNode}
219
- */
220
- function FileActionLink({ entry, record, CustomComponents }) {
221
- const [isPdfVisible, setIsPdfVisible] = useState(false);
222
- const fileUrl = getFileLocation(entry, record);
223
- const actionLabel = getActionLabel(entry, record);
224
- const FileLoaderComponent = CustomComponents?.FileLoader;
225
-
226
- if (!fileUrl) {
227
- return null;
228
- }
229
-
230
- const fileLoaderProps = {
231
- url: fileUrl,
232
- type: resolveRecordValue(entry.file_type, record) || 'pdf',
233
- defaultScale: resolveRecordValue(entry.default_scale, record),
234
- viewerType: resolveRecordValue(entry.viewer_type, record),
235
- config: {
236
- requireLinuxPath: resolveRecordValue(entry.require_linux_path, record),
237
- replaceBranch: resolveRecordValue(entry.replace_branch, record),
238
- ...(entry.file_loader_config || {}),
239
- },
240
- entry,
241
- record,
242
- };
243
-
244
- return (
245
- <>
246
- {/* 1. Add the trigger link/button here */}
247
- <a
248
- onClick={(e) => {
249
- e.preventDefault();
250
- setIsPdfVisible(true);
251
- }}
252
- style={{ cursor: 'pointer' }}
253
- >
254
- {actionLabel}
255
- </a>
256
-
257
- <Modal
258
- open={isPdfVisible}
259
- onCancel={() => setIsPdfVisible(false)}
260
- footer={null}
261
- destroyOnClose
262
- width={950}
263
- style={{ top: 10 }}
264
- title={actionLabel}
265
- >
266
- {/* 2. Ensure the loader component exists */}
267
- {FileLoaderComponent ? <FileLoaderComponent {...fileLoaderProps} /> : <p>Loader not found</p>}
268
- </Modal>
269
- </>
270
- );
271
- }
272
-
273
- /**
274
- * Returns the branch access list from the signed-in user's organization details.
275
- *
276
- * `organization_details` may arrive as a JSON string, so this helper keeps the
277
- * parsing logic in one place before branch comparisons are made.
278
- *
279
- * @param {Object} user
280
- * @returns {Array}
281
- */
282
- function getAccessibleBranches(user = {}) {
283
- const orgDetails = safeJSON(user?.organization_details);
284
- return Array.isArray(orgDetails?.branch) ? orgDetails.branch : [];
285
- }
286
-
287
- /**
288
- * Resolves branch metadata used to decide whether an action link should prompt
289
- * for a branch switch before navigation.
290
- *
291
- * When an action entry includes `replace_variables` with the `index` field, the
292
- * row is treated as branch-aware content. We compare the record's branch id
293
- * against the active branch from `localStorage.db_ptr`, and also resolve whether
294
- * the user has access to the target branch.
295
- *
296
- * @param {DisplayColumnEntry} entry
297
- * @param {DisplayRecord} record
298
- * @param {Object} user
299
- * @returns {{requiresBranchSwitch: boolean, hasTargetBranchAccess: boolean}}
300
- */
301
- function getBranchNavigationState(entry = {}, record = {}, user = {}) {
302
- const branchFieldConfig = entry.replace_variables?.find((variable) => variable.field === 'index');
303
-
304
- if (!branchFieldConfig) {
305
- return { requiresBranchSwitch: false, hasTargetBranchAccess: false };
306
- }
307
-
308
- const accessibleBranches = getAccessibleBranches(user);
309
- const activeDbPtr = localStorage.getItem('db_ptr');
310
- const activeBranch = accessibleBranches.find((branch) => String(branch.dbPtr) === String(activeDbPtr));
311
- const targetBranchId = record[branchFieldConfig.field];
312
- const targetBranch = accessibleBranches.find((branch) => String(branch.branch_id) === String(targetBranchId));
313
-
314
- return {
315
- requiresBranchSwitch: Boolean(targetBranchId) && String(activeBranch?.branch_id) !== String(targetBranchId),
316
- hasTargetBranchAccess: Boolean(targetBranch),
317
- };
318
- }
319
-
320
- /**
321
- * Renders a branch-switch confirmation link for cross-branch records.
322
- *
323
- * The actual branch change is handled by the landing page via the `index`
324
- * query parameter. This link only confirms intent and blocks navigation when
325
- * the user does not have access to the target branch.
326
- *
327
- * @param {Object} root0
328
- * @param {string} root0.label
329
- * @param {string} root0.redirectLink
330
- * @param {boolean} root0.hasTargetBranchAccess
331
- * @returns {React.ReactNode}
332
- */
333
- function BranchAwareActionLink({ label, redirectLink, hasTargetBranchAccess }) {
334
- return (
335
- <a
336
- onClick={(e) => {
337
- e.preventDefault();
338
- Modal.confirm({
339
- title: 'Switch Branch?', // Adding a title makes it look more standard
340
- content: 'This record belongs to another branch. Would you like to switch branches to view the details?',
341
- onOk: () => {
342
- if (hasTargetBranchAccess) {
343
- Location.navigate({ url: redirectLink });
344
- return;
345
- }
346
-
347
- Modal.error({
348
- title: 'Access Denied',
349
- content: 'This data belongs to another branch.Would you like to switch branches to view the details?',
350
- });
351
- },
352
- });
353
- }}
354
- >
355
- {label}
356
- </a>
357
- );
358
- }
359
- /**
360
- * Renders table cell content for a configured display column.
361
- *
362
- * Render priority:
363
- * 1. `entry.render(record)` override
364
- * 2. `type === 'link'`
365
- * 3. action columns (legacy or new action layer)
366
- * 4. custom component (`field === 'custom'`)
367
- * 5. color tag/span via `record.color_code` + `enableColor`
368
- * 6. dynamic icon mapping (`displayIcons`)
369
- * 7. default text span
370
- *
371
- * @param {Object} root0
372
- * @param {DisplayColumnEntry} root0.entry
373
- * @param {DisplayRecord} root0.record
374
- * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
375
- * @param {Function} root0.refresh
376
- * @returns {React.ReactNode}
377
- */
378
- export function renderDisplayCell({ entry, record, CustomComponents, refresh }) {
379
- let textColor = 'inherit';
380
-
381
- if (entry.color) {
382
- textColor = entry.color;
383
- }
384
-
385
- if (entry.render) {
386
- return entry.render(record);
387
- }
388
-
389
- if (entry.type === 'link') {
390
- if (record[entry.field]) {
391
- return (
392
- <a href={record[entry.field]} target="_blank" rel="noopener noreferrer">
393
- View
394
- </a>
395
- );
396
- }
397
- return null;
398
- }
399
- if (isLegacyActionEntry(entry) || isActionTypeEntry(entry)) {
400
- if (entry.redirect_link_type === 'file') {
401
- return <FileActionLink entry={entry} record={record} CustomComponents={CustomComponents} />;
402
- }
403
- const { user = {} } = useContext(GlobalContext);
404
-
405
- const redirectLink = getRedirectLink(entry, record);
406
- const label = getActionLabel(entry, record);
407
- const { requiresBranchSwitch, hasTargetBranchAccess } = getBranchNavigationState(entry, record, user);
408
-
409
- if (requiresBranchSwitch) {
410
- return <BranchAwareActionLink label={label} redirectLink={redirectLink} hasTargetBranchAccess={hasTargetBranchAccess} />;
411
- }
412
-
413
- return <Link to={`${redirectLink}`}>{label}</Link>;
414
- }
415
-
416
- if (entry.field === 'custom') {
417
- return renderCustomComponent({ entry, record, CustomComponents, refresh });
418
- }
419
-
420
- if (record.color_code && entry.enableColor) {
421
- if (entry.columnType === 'tag') {
422
- return <Tag color={record.color_code}>{record[entry.field]}</Tag>;
423
- }
424
- if (entry.columnType === 'span') {
425
- return <span style={{ color: record.color_code, overflowWrap: 'break-word', WebkitLineClamp: 3 }}>{record[entry.field]}</span>;
426
- }
427
- }
428
-
429
- if (entry.displayIcons) {
430
- const fieldValue = record[entry.field]?.toString();
431
- const displayConfig = entry.displayIcons[fieldValue];
432
- if (displayConfig) {
433
- const DynamicIcon = Icons[displayConfig.icon];
434
- if (DynamicIcon) {
435
- return (
436
- <DynamicIcon
437
- style={{
438
- color: displayConfig.color,
439
- fontSize: displayConfig.size,
440
- }}
441
- />
442
- );
443
- }
444
- }
445
- return null;
446
- }
447
-
448
- return <span style={{ color: textColor, whiteSpace: 'pre-wrap', overflowWrap: 'break-word' }}>{record[entry.field]}</span>;
449
- }
1
+ import React, { useState, useContext } from 'react';
2
+ import { Modal, Tag } from 'antd';
3
+ import * as Icons from '@ant-design/icons';
4
+ import { Link } from 'react-router-dom';
5
+ import { GlobalContext, safeJSON, Location } from '../../../../../lib';
6
+ // import { PdfViewer } from '../../../../../lib';
7
+ import { CoreScripts } from '../../../../../models';
8
+
9
+ /**
10
+ * Utilities for rendering Reporting Dashboard display columns.
11
+ *
12
+ * Backward-compatibility contract for action columns:
13
+ * 1. `entry.field === 'action'` is always treated as legacy action behavior.
14
+ * 2. `entry.type === 'action' && entry.field !== 'action'` is treated as the new action layer.
15
+ * 3. All other entries follow existing non-action render logic.
16
+ */
17
+
18
+ /**
19
+ * @typedef {Object} ReplaceVariable
20
+ * @property {string} field Field name from row data used to replace `@field;` placeholders in `redirect_link`.
21
+ */
22
+
23
+ /**
24
+ * @typedef {Object} DisplayColumnEntry
25
+ * @property {string} [field] Source field name from row data.
26
+ * @property {string} [type] Supported values include `link`, `action`, `number`.
27
+ * @property {string} [title] Display title.
28
+ * @property {string} [tooltip] Optional tooltip text for table header.
29
+ * @property {string} [color] Static text color for default text rendering.
30
+ * @property {boolean} [enableColor] Enables color-based rendering using `record.color_code`.
31
+ * @property {string} [columnType] When `enableColor` is true, supports `tag` and `span`.
32
+ * @property {Object.<string, {icon: string, color: string, size: string}>} [displayIcons] Icon mapping keyed by row value.
33
+ * @property {string} [display_name_link] Legacy action link label fallback.
34
+ * @property {string} [label] New action link label fallback.
35
+ * @property {string} [redirect_link] Redirect template (example: `/path/@opb_id;`).
36
+ * @property {ReplaceVariable[]} [replace_variables] Placeholder replacement config for `redirect_link`.
37
+ * @property {string} [component] Custom component name for `field === 'custom'`.
38
+ * @property {{field: string, value: string}[]} [props] Mapping from record fields to custom component prop keys.
39
+ * @property {Object} [config] Static props passed to custom component.
40
+ * @property {(record: DisplayRecord) => React.ReactNode} [render] Optional custom render override.
41
+ */
42
+
43
+ /**
44
+ * @typedef {Object.<string, any>} DisplayRecord
45
+ */
46
+
47
+ /**
48
+ * Checks if the column entry is a legacy action configuration.
49
+ *
50
+ * @param {DisplayColumnEntry} entry
51
+ * @returns {boolean}
52
+ */
53
+ export function isLegacyActionEntry(entry = {}) {
54
+ return entry.field === 'action';
55
+ }
56
+
57
+ /**
58
+ * Checks if the column entry is a new action-type configuration.
59
+ *
60
+ * @param {DisplayColumnEntry} entry
61
+ * @returns {boolean}
62
+ */
63
+ export function isActionTypeEntry(entry = {}) {
64
+ return entry.type === 'action' && entry.field !== 'action';
65
+ }
66
+
67
+ /**
68
+ * Builds redirect link by replacing configured placeholders with row values.
69
+ *
70
+ * Placeholder format in `redirect_link` is `@field;`.
71
+ * Example:
72
+ * redirect_link: `/visit/@opb_id;/bill/@opno;`
73
+ * replace_variables: [{ field: 'opb_id' }, { field: 'opno' }]
74
+ * result: `/visit/123/bill/OP-100`
75
+ *
76
+ * @param {DisplayColumnEntry} entry
77
+ * @param {DisplayRecord} record
78
+ * @returns {string}
79
+ */
80
+ export function getRedirectLink(entry = {}, record = {}, CustomComponents = {}) {
81
+ let redirectLink = entry.redirect_link || '';
82
+
83
+ if (Array.isArray(entry.replace_variables)) {
84
+ entry.replace_variables.forEach((replacement) => {
85
+ const value = record[replacement.field] || '';
86
+ redirectLink = redirectLink.replace(new RegExp(`@${replacement.field};`, 'g'), value);
87
+ });
88
+ }
89
+
90
+ return redirectLink;
91
+ }
92
+
93
+ /**
94
+ * Resolves the PDF/file location for file-based action entries.
95
+ *
96
+ * Supports either:
97
+ * - `entry.file_location` as a direct URL/path
98
+ * - `entry.file_location` as a record field name
99
+ *
100
+ * @param {DisplayColumnEntry} entry
101
+ * @param {DisplayRecord} record
102
+ * @returns {string}
103
+ */
104
+ export function getFileLocation(entry = {}, record = {}) {
105
+ if (entry.file_location && typeof entry.file_location === 'string' && record[entry.file_location]) {
106
+ return record[entry.file_location];
107
+ }
108
+
109
+ return record.file_location || entry.file_location || '';
110
+ }
111
+
112
+ /**
113
+ * Resolves a value from the row when a config field points to a record key,
114
+ * otherwise returns the provided literal value.
115
+ *
116
+ * @param {*} value
117
+ * @param {DisplayRecord} record
118
+ * @returns {*}
119
+ */
120
+ function resolveRecordValue(value, record = {}) {
121
+ if (typeof value === 'string' && Object.prototype.hasOwnProperty.call(record, value)) {
122
+ return record[value];
123
+ }
124
+
125
+ return value;
126
+ }
127
+
128
+ /**
129
+ * Resolves action label text with backward-compatible precedence.
130
+ *
131
+ * Legacy action (`field === 'action'`):
132
+ * - `entry.display_name_link`
133
+ * - `"View"`
134
+ *
135
+ * New action layer (`type === 'action' && field !== 'action'`):
136
+ * - `record[entry.field]`
137
+ * - `entry.label`
138
+ * - `entry.display_name_link`
139
+ * - `"View"`
140
+ *
141
+ * @param {DisplayColumnEntry} entry
142
+ * @param {DisplayRecord} record
143
+ * @returns {string}
144
+ */
145
+ export function getActionLabel(entry = {}, record = {}) {
146
+ // Legacy action path should stay unchanged.
147
+ if (isLegacyActionEntry(entry)) {
148
+ return entry.display_name_link ? entry.display_name_link : 'View';
149
+ }
150
+
151
+ const fieldValue = entry.field ? record[entry.field] : null;
152
+ if (fieldValue !== undefined && fieldValue !== null && fieldValue !== '') {
153
+ return fieldValue;
154
+ }
155
+
156
+ if (entry.label) {
157
+ return entry.label;
158
+ }
159
+
160
+ if (entry.display_name_link) {
161
+ return entry.display_name_link;
162
+ }
163
+
164
+ return 'View';
165
+ }
166
+
167
+ /**
168
+ * Renders configured custom component cells (`field === 'custom'`).
169
+ *
170
+ * Each `entry.props` item maps a record field to a prop name:
171
+ * `{ field: 'status_text', value: 'description' }` becomes
172
+ * `LoadedComponent({ description: record.status_text })`.
173
+ *
174
+ * @param {Object} root0
175
+ * @param {DisplayColumnEntry} root0.entry
176
+ * @param {DisplayRecord} root0.record
177
+ * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
178
+ * @param {Function} root0.refresh
179
+ * @returns {React.ReactNode}
180
+ */
181
+ function renderCustomComponent({ entry, record, CustomComponents, refresh }) {
182
+ const componentName = entry.component;
183
+ const genericComponents = CustomComponents || {};
184
+
185
+ if (!componentName || !genericComponents[componentName]) {
186
+ return null;
187
+ }
188
+
189
+ const LoadedComponent = genericComponents[componentName];
190
+ const propValue = {};
191
+
192
+ if (Array.isArray(entry.props)) {
193
+ entry.props.forEach((values) => {
194
+ const valueCreation = record[values.field];
195
+ propValue[values.value] = valueCreation;
196
+ });
197
+ }
198
+
199
+ return (
200
+ <LoadedComponent
201
+ {...entry.config}
202
+ callback={() => {
203
+ refresh();
204
+ }}
205
+ {...record}
206
+ {...propValue}
207
+ />
208
+ );
209
+ }
210
+
211
+ /**
212
+ * Renders a PDF file action inside a modal viewer.
213
+ *
214
+ * @param {Object} root0
215
+ * @param {DisplayColumnEntry} root0.entry
216
+ * @param {DisplayRecord} root0.record
217
+ * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
218
+ * @returns {React.ReactNode}
219
+ */
220
+ function FileActionLink({ entry, record, CustomComponents }) {
221
+ const [isPdfVisible, setIsPdfVisible] = useState(false);
222
+ const fileUrl = getFileLocation(entry, record);
223
+ const actionLabel = getActionLabel(entry, record);
224
+ const FileLoaderComponent = CustomComponents?.FileLoader;
225
+
226
+ if (!fileUrl) {
227
+ return null;
228
+ }
229
+
230
+ const fileLoaderProps = {
231
+ url: fileUrl,
232
+ type: resolveRecordValue(entry.file_type, record) || 'pdf',
233
+ defaultScale: resolveRecordValue(entry.default_scale, record),
234
+ viewerType: resolveRecordValue(entry.viewer_type, record),
235
+ config: {
236
+ requireLinuxPath: resolveRecordValue(entry.require_linux_path, record),
237
+ replaceBranch: resolveRecordValue(entry.replace_branch, record),
238
+ ...(entry.file_loader_config || {}),
239
+ },
240
+ entry,
241
+ record,
242
+ };
243
+
244
+ return (
245
+ <>
246
+ {/* 1. Add the trigger link/button here */}
247
+ <a
248
+ onClick={(e) => {
249
+ e.preventDefault();
250
+ setIsPdfVisible(true);
251
+ }}
252
+ style={{ cursor: 'pointer' }}
253
+ >
254
+ {actionLabel}
255
+ </a>
256
+
257
+ <Modal
258
+ open={isPdfVisible}
259
+ onCancel={() => setIsPdfVisible(false)}
260
+ footer={null}
261
+ destroyOnClose
262
+ width={950}
263
+ style={{ top: 10 }}
264
+ title={actionLabel}
265
+ >
266
+ {/* 2. Ensure the loader component exists */}
267
+ {FileLoaderComponent ? <FileLoaderComponent {...fileLoaderProps} /> : <p>Loader not found</p>}
268
+ </Modal>
269
+ </>
270
+ );
271
+ }
272
+
273
+ /**
274
+ * Returns the branch access list from the signed-in user's organization details.
275
+ *
276
+ * `organization_details` may arrive as a JSON string, so this helper keeps the
277
+ * parsing logic in one place before branch comparisons are made.
278
+ *
279
+ * @param {Object} user
280
+ * @returns {Array}
281
+ */
282
+ function getAccessibleBranches(user = {}) {
283
+ const orgDetails = safeJSON(user?.organization_details);
284
+ return Array.isArray(orgDetails?.branch) ? orgDetails.branch : [];
285
+ }
286
+
287
+ /**
288
+ * Resolves branch metadata used to decide whether an action link should prompt
289
+ * for a branch switch before navigation.
290
+ *
291
+ * When an action entry includes `replace_variables` with the `index` field, the
292
+ * row is treated as branch-aware content. We compare the record's branch id
293
+ * against the active branch from `localStorage.db_ptr`, and also resolve whether
294
+ * the user has access to the target branch.
295
+ *
296
+ * @param {DisplayColumnEntry} entry
297
+ * @param {DisplayRecord} record
298
+ * @param {Object} user
299
+ * @returns {{requiresBranchSwitch: boolean, hasTargetBranchAccess: boolean}}
300
+ */
301
+ function getBranchNavigationState(entry = {}, record = {}, user = {}) {
302
+ const branchFieldConfig = entry.replace_variables?.find((variable) => variable.field === 'index');
303
+
304
+ if (!branchFieldConfig) {
305
+ return { requiresBranchSwitch: false, hasTargetBranchAccess: false };
306
+ }
307
+
308
+ const accessibleBranches = getAccessibleBranches(user);
309
+ const activeDbPtr = localStorage.getItem('db_ptr');
310
+ const activeBranch = accessibleBranches.find((branch) => String(branch.dbPtr) === String(activeDbPtr));
311
+ const targetBranchId = record[branchFieldConfig.field];
312
+ const targetBranch = accessibleBranches.find((branch) => String(branch.branch_id) === String(targetBranchId));
313
+
314
+ return {
315
+ requiresBranchSwitch: Boolean(targetBranchId) && String(activeBranch?.branch_id) !== String(targetBranchId),
316
+ hasTargetBranchAccess: Boolean(targetBranch),
317
+ };
318
+ }
319
+
320
+ /**
321
+ * Renders a branch-switch confirmation link for cross-branch records.
322
+ *
323
+ * The actual branch change is handled by the landing page via the `index`
324
+ * query parameter. This link only confirms intent and blocks navigation when
325
+ * the user does not have access to the target branch.
326
+ *
327
+ * @param {Object} root0
328
+ * @param {string} root0.label
329
+ * @param {string} root0.redirectLink
330
+ * @param {boolean} root0.hasTargetBranchAccess
331
+ * @returns {React.ReactNode}
332
+ */
333
+ function BranchAwareActionLink({ label, redirectLink, hasTargetBranchAccess }) {
334
+ return (
335
+ <a
336
+ onClick={(e) => {
337
+ e.preventDefault();
338
+ Modal.confirm({
339
+ title: 'Switch Branch?', // Adding a title makes it look more standard
340
+ content: 'This record belongs to another branch. Would you like to switch branches to view the details?',
341
+ onOk: () => {
342
+ if (hasTargetBranchAccess) {
343
+ Location.navigate({ url: redirectLink });
344
+ return;
345
+ }
346
+
347
+ Modal.error({
348
+ title: 'Access Denied',
349
+ content: 'This data belongs to another branch.Would you like to switch branches to view the details?',
350
+ });
351
+ },
352
+ });
353
+ }}
354
+ >
355
+ {label}
356
+ </a>
357
+ );
358
+ }
359
+ /**
360
+ * Renders table cell content for a configured display column.
361
+ *
362
+ * Render priority:
363
+ * 1. `entry.render(record)` override
364
+ * 2. `type === 'link'`
365
+ * 3. action columns (legacy or new action layer)
366
+ * 4. custom component (`field === 'custom'`)
367
+ * 5. color tag/span via `record.color_code` + `enableColor`
368
+ * 6. dynamic icon mapping (`displayIcons`)
369
+ * 7. default text span
370
+ *
371
+ * @param {Object} root0
372
+ * @param {DisplayColumnEntry} root0.entry
373
+ * @param {DisplayRecord} root0.record
374
+ * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
375
+ * @param {Function} root0.refresh
376
+ * @returns {React.ReactNode}
377
+ */
378
+ export function renderDisplayCell({ entry, record, CustomComponents, refresh }) {
379
+ let textColor = 'inherit';
380
+
381
+ if (entry.color) {
382
+ textColor = entry.color;
383
+ }
384
+
385
+ if (entry.render) {
386
+ return entry.render(record);
387
+ }
388
+
389
+ if (entry.type === 'link') {
390
+ if (record[entry.field]) {
391
+ return (
392
+ <a href={record[entry.field]} target="_blank" rel="noopener noreferrer">
393
+ View
394
+ </a>
395
+ );
396
+ }
397
+ return null;
398
+ }
399
+ if (isLegacyActionEntry(entry) || isActionTypeEntry(entry)) {
400
+ if (entry.redirect_link_type === 'file') {
401
+ return <FileActionLink entry={entry} record={record} CustomComponents={CustomComponents} />;
402
+ }
403
+ const { user = {} } = useContext(GlobalContext);
404
+
405
+ const redirectLink = getRedirectLink(entry, record);
406
+ const label = getActionLabel(entry, record);
407
+ const { requiresBranchSwitch, hasTargetBranchAccess } = getBranchNavigationState(entry, record, user);
408
+
409
+ if (requiresBranchSwitch) {
410
+ return <BranchAwareActionLink label={label} redirectLink={redirectLink} hasTargetBranchAccess={hasTargetBranchAccess} />;
411
+ }
412
+
413
+ return <Link to={`${redirectLink}`}>{label}</Link>;
414
+ }
415
+
416
+ if (entry.field === 'custom') {
417
+ return renderCustomComponent({ entry, record, CustomComponents, refresh });
418
+ }
419
+
420
+ if (record.color_code && entry.enableColor) {
421
+ if (entry.columnType === 'tag') {
422
+ return <Tag color={record.color_code}>{record[entry.field]}</Tag>;
423
+ }
424
+ if (entry.columnType === 'span') {
425
+ return <span style={{ color: record.color_code, overflowWrap: 'break-word', WebkitLineClamp: 3 }}>{record[entry.field]}</span>;
426
+ }
427
+ }
428
+
429
+ if (entry.displayIcons) {
430
+ const fieldValue = record[entry.field]?.toString();
431
+ const displayConfig = entry.displayIcons[fieldValue];
432
+ if (displayConfig) {
433
+ const DynamicIcon = Icons[displayConfig.icon];
434
+ if (DynamicIcon) {
435
+ return (
436
+ <DynamicIcon
437
+ style={{
438
+ color: displayConfig.color,
439
+ fontSize: displayConfig.size,
440
+ }}
441
+ />
442
+ );
443
+ }
444
+ }
445
+ return null;
446
+ }
447
+
448
+ return <span style={{ color: textColor, whiteSpace: 'pre-wrap', overflowWrap: 'break-word' }}>{record[entry.field]}</span>;
449
+ }