ui-soxo-bootstrap-core 2.6.40-dev.0 → 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 (417) hide show
  1. package/.babelrc +8 -8
  2. package/.github/workflows/npm-publish.yml +41 -33
  3. package/.husky/pre-commit +11 -11
  4. package/.prettierrc.json +10 -10
  5. package/DEVELOPER_GUIDE.md +323 -294
  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 -21
  16. package/core/components/landing-api/landing-api.js +707 -547
  17. package/core/components/landing-api/landing-api.scss +41 -41
  18. package/core/components/license-management/license-alert.js +97 -0
  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 +287 -344
  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 -88
  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 -34
  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 -158
  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 -310
  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/role-add.js +222 -222
  349. package/core/models/roles/components/role-add/role-add.scss +4 -4
  350. package/core/models/roles/components/role-list/role-list.js +406 -406
  351. package/core/models/roles/roles.js +196 -196
  352. package/core/models/staff/components/staff-add/staff-add.js +455 -455
  353. package/core/models/user-roles/components/user-roles-add/user-roles-add.js +149 -149
  354. package/core/models/user-roles/user-roles.js +113 -113
  355. package/core/models/users/components/assign-role/assign-role.js +428 -428
  356. package/core/models/users/components/assign-role/assign-role.scss +281 -281
  357. package/core/models/users/components/assign-role/avatar-props.js +45 -45
  358. package/core/models/users/components/user-add/user-add.js +847 -847
  359. package/core/models/users/components/user-add/user-edit.js +110 -110
  360. package/core/models/users/components/user-detail/user-detail.js +236 -236
  361. package/core/models/users/components/user-list/user-list.js +397 -397
  362. package/core/models/users/users.js +379 -379
  363. package/core/modules/Informations/change-info/change-info.js +618 -618
  364. package/core/modules/Informations/change-info/change-info.scss +134 -134
  365. package/core/modules/dashboard/components/dashboard-card/animations.js +64 -64
  366. package/core/modules/dashboard/components/dashboard-card/dashboard-card.js +197 -197
  367. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +430 -430
  368. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.scss +59 -59
  369. package/core/modules/dashboard/components/pop-query-dashboard/pop-query-dashboard.js +66 -66
  370. package/core/modules/generic/components/generic-add/generic-add.js +121 -121
  371. package/core/modules/generic/components/generic-add/generic-add.scss +13 -13
  372. package/core/modules/generic/components/generic-add-modal/generic-add-modal.js +125 -125
  373. package/core/modules/generic/components/generic-add-modal/generic-add-modal.scss +13 -13
  374. package/core/modules/generic/components/generic-detail/generic-detail.js +184 -184
  375. package/core/modules/generic/components/generic-detail/generic-detail.scss +25 -25
  376. package/core/modules/generic/components/generic-edit/generic-edit.js +123 -123
  377. package/core/modules/generic/components/generic-list/generic-list.js +335 -335
  378. package/core/modules/generic/components/generic-list/generic-list.scss +35 -35
  379. package/core/modules/index.js +42 -42
  380. package/core/modules/module-routes/module-routes.js +37 -37
  381. package/core/modules/reporting/components/index.js +6 -6
  382. package/core/modules/reporting/components/reporting-dashboard/README.md +316 -316
  383. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +271 -271
  384. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.scss +76 -76
  385. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +90 -90
  386. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -74
  387. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +449 -252
  388. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +199 -126
  389. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1116 -1096
  390. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +215 -214
  391. package/core/modules/reporting/components/reporting-dashboard/reporting-table.js +519 -0
  392. package/core/modules/steps/action-buttons.js +92 -92
  393. package/core/modules/steps/action-buttons.scss +62 -62
  394. package/core/modules/steps/chat-assistant.js +141 -141
  395. package/core/modules/steps/narration.js +192 -192
  396. package/core/modules/steps/openai-realtime.js +275 -275
  397. package/core/modules/steps/progress-storage.js +140 -140
  398. package/core/modules/steps/readme.md +167 -167
  399. package/core/modules/steps/steps.js +1567 -1567
  400. package/core/modules/steps/steps.scss +907 -907
  401. package/core/modules/steps/timeline.js +56 -56
  402. package/core/modules/steps/voice-navigation.js +709 -709
  403. package/core/pages/homepage-api/homepage-api.js +106 -106
  404. package/core/pages/homepage-api/homepage-api.scss +233 -233
  405. package/core/pages/homepage-api/menu-dashboard.js +169 -169
  406. package/core/pages/homepage-api/menu-dashboard.scss +11 -11
  407. package/core/translation.json +53 -53
  408. package/core/translations.json +19 -19
  409. package/core/utils/script.utils.js +129 -129
  410. package/core/utils/settings.utils.js +25 -25
  411. package/eslint.config.mjs +79 -79
  412. package/index.js +35 -35
  413. package/jest.config.js +7 -7
  414. package/jest.setup.js +1 -1
  415. package/package.json +124 -124
  416. package/tsconfig.json +26 -26
  417. package/webpack.config.js +173 -173
@@ -1,547 +1,707 @@
1
- import { useContext, useEffect, useRef, useState } from 'react';
2
-
3
- import { Route, Switch } from 'react-router-dom';
4
-
5
- import { Skeleton } from 'antd';
6
-
7
- import { Card, ChangePassword, GlobalContext, GlobalHeader, ModuleRoutes, Profile, SettingsUtil, SpotlightSearch, useTranslation } from '../../lib';
8
-
9
- import './landing-api.scss';
10
-
11
- import HomePageAPI from '../../pages/homepage-api/homepage-api';
12
-
13
- import MenuTemplate from '../menu-template-api/menu-template-api';
14
-
15
- import ReportingDashboard from '../../modules/reporting/components/reporting-dashboard/reporting-dashboard';
16
-
17
- import PropTypes from 'prop-types';
18
-
19
- import { CoreScripts, MenusAPI } from '../../models';
20
-
21
- const motivatingMessages = [
22
- 'Setting things up for a great start...',
23
- 'Good things are loading. Stay with us.',
24
- 'Almost there. Preparing your workspace.',
25
- 'You are one moment away from your dashboard.',
26
- 'Getting everything ready for you.',
27
- 'Great care takes a second. Loading now.',
28
- ];
29
-
30
- function getRandomMessage(previousMessage = '') {
31
- const options = motivatingMessages.filter((message) => message !== previousMessage);
32
-
33
- if (!options.length) {
34
- return motivatingMessages[0];
35
- }
36
-
37
- const randomIndex = Math.floor(Math.random() * options.length);
38
- return options[randomIndex];
39
- }
40
-
41
- /**
42
- * Landing API
43
- *
44
- * @param {*} param0
45
- * @returns
46
- */
47
- export default function LandingApi({ history, CustomComponents, CustomModels, appSettings, transitionPending = false, onHomeReady, ...props }) {
48
- const [loader, setLoader] = useState(false);
49
-
50
- // const [modules, setModules] = useState([]);
51
-
52
- const [connected] = useState();
53
-
54
- const { dispatch, user = {} } = useContext(GlobalContext);
55
-
56
- const [allModules, setAllModules] = useState();
57
- const homeReadyNotifiedRef = useRef(false);
58
- const messageIntervalRef = useRef(null);
59
-
60
- const [meta, setMeta] = useState({});
61
- const [loadingMessage, setLoadingMessage] = useState('');
62
-
63
- // const [reports, setReports] = useState([]);
64
-
65
- var config = {};
66
-
67
- // Variable decides the control of homepage
68
- // #TODO This is a temporary fix - Homemage
69
-
70
- let disableHomepage = false;
71
-
72
- if (process.env.REACT_APP_DISABLEHOMEPAGE) {
73
- disableHomepage = JSON.parse(process.env.REACT_APP_DISABLEHOMEPAGE);
74
- }
75
-
76
- // useEffect(() => {
77
-
78
- // // Initialize the menus for the logged in user
79
- // initializeUserMenus();
80
-
81
- // }, [selectedBranch]);
82
-
83
- //These change is done to fix when refreshing the report menu missing, but it removed because,makes another issue, ie there is continuos loading occurs for 2 times
84
- // useEffect(() => {
85
-
86
- // if (loader) {
87
- // initializeUserMenus();
88
- // }
89
- // }, [loader]);
90
-
91
- useEffect(() => {
92
- // Initialize the menus for the logged in user
93
- initializeUserMenus();
94
- }, []);
95
-
96
- useEffect(() => {
97
- if (!transitionPending) {
98
- homeReadyNotifiedRef.current = false;
99
- return;
100
- }
101
-
102
- if (!loader && allModules && !homeReadyNotifiedRef.current) {
103
- homeReadyNotifiedRef.current = true;
104
- if (typeof onHomeReady === 'function') {
105
- onHomeReady();
106
- }
107
- }
108
- }, [transitionPending, loader, allModules, onHomeReady]);
109
-
110
- useEffect(() => {
111
- if (!loader) {
112
- setLoadingMessage('');
113
-
114
- if (messageIntervalRef.current) {
115
- clearInterval(messageIntervalRef.current);
116
- messageIntervalRef.current = null;
117
- }
118
-
119
- return;
120
- }
121
-
122
- setLoadingMessage((previousMessage) => getRandomMessage(previousMessage));
123
-
124
- messageIntervalRef.current = setInterval(() => {
125
- setLoadingMessage((previousMessage) => getRandomMessage(previousMessage));
126
- }, 2200);
127
-
128
- return () => {
129
- if (messageIntervalRef.current) {
130
- clearInterval(messageIntervalRef.current);
131
- messageIntervalRef.current = null;
132
- }
133
- };
134
- }, [loader]);
135
-
136
- /**
137
- * Initialize the user menus
138
- */
139
- async function initializeUserMenus() {
140
- // need to find what implement, with a login who has the respective value ("wug_custreportids")
141
- const report = await loadScripts(user);
142
-
143
- await loadMenus(report);
144
- }
145
-
146
- // const keyMap = {
147
- // moveUp: 'Shift+B',
148
- // spotlight: 'Shift+F'
149
- // }
150
-
151
- let coreModules;
152
-
153
- // Reports length
154
- let reportMenus = [];
155
-
156
- /**
157
- *
158
- *
159
- * @param reports
160
- */
161
- async function loadMenus(reports) {
162
- setLoader(true);
163
-
164
- // setReports(report)
165
-
166
- const result = await MenusAPI.getMenus(user);
167
-
168
- // console.log(result);
169
-
170
- if (result && Array.isArray(result.result) && result.result.length) {
171
- // setModules(result.result);
172
- // result.result.map((ele) => {
173
- // let languageString = JSON.parse(ele.attributes)
174
- // console.log('language_string', languageString);
175
- // if (languageString && languageString.languages) {
176
- // const language = i18n.language;
177
- // i18n.addResourceBundle(language, 'translation', languageString.languages[i18n.language]);
178
- // }
179
- // })
180
- }
181
- // Check if the 'settings' property exists in the 'result' object
182
- if (result.result.settings) {
183
- // Dispatch an action to update the settings in the store
184
- dispatch({ type: 'settings', payload: result.result.settings });
185
- }
186
-
187
- // Reports length
188
- if (reports.length) {
189
- reportMenus = [
190
- {
191
- page: { path: 'ManageReports', identifier: null },
192
- path: '/manage-reports',
193
- caption: 'Reports',
194
- sub_menus: reports,
195
- },
196
- ];
197
- }
198
-
199
- coreModules = [
200
- {
201
- caption: 'Preferences',
202
- sub_menus: [
203
- {
204
- path: '/change-password',
205
- caption: 'Change Password',
206
- },
207
- ],
208
- },
209
- ];
210
-
211
- /**If there is roles assigned to the user */
212
- // for matria
213
- const useCoreMenus = process.env.REACT_APP_USE_CORE_MENUS === 'true';
214
- if (useCoreMenus) {
215
- if (result && result.result && reportMenus) {
216
- setAllModules([...result.result, ...reportMenus, ...coreModules]);
217
- } else {
218
- //If there is no roles assigned to the user
219
- setAllModules([...coreModules]);
220
- }
221
- } else {
222
- // for nura
223
- if (result && result.result.menus && reportMenus) {
224
- setAllModules([...result.result.menus, ...reportMenus, ...coreModules]);
225
- } else {
226
- //If there is no roles assigned to the user
227
- setAllModules([...coreModules]);
228
- }
229
- }
230
- setLoader(false);
231
- }
232
-
233
- /**
234
- * Load the scripts
235
- *
236
- * @param {*} user
237
- * @returns
238
- */
239
- const loadScripts = async (user) => {
240
- if (user.user_group && user.user_group.wug_custreportids && user.user_group.wug_custreportids !== '') {
241
- // Saving the report ids to a variable
242
- let reportIds = user.user_group.wug_custreportids;
243
-
244
- var reportIdKeys = reportIds.split(',');
245
-
246
- const reports = await Promise.all(reportIdKeys.map((id) => CoreScripts.getReportMenu({ id })));
247
-
248
- let filtered = reports
249
- .filter((record) => record.active === 'Y')
250
- .map((result) => {
251
- return {
252
- ...result,
253
- };
254
- });
255
-
256
- // setReports(filtered);
257
-
258
- return filtered;
259
- } else {
260
- return [];
261
- }
262
- };
263
-
264
- // setAllModules([...modules, ...reportMenus, ...coreModules])
265
-
266
- // let coreModules = [];
267
-
268
- // // Reports length
269
- // let reportMenus = []
270
-
271
- // // Reports length
272
- // if (reports.length) {
273
-
274
- // reportMenus = [{
275
- // page: { path: "ManageReports", identifier: null },
276
- // path: '/manage-reports',
277
- // caption: 'Reports',
278
- // sub_menus: reports
279
- // }]
280
- // }
281
-
282
- return (
283
- <section className="landing">
284
- {/* <HotKeys focused={true} attach={window} keyMap={keyMap} handlers={handlers}> */}
285
-
286
- <GlobalHeader
287
- loading={loader}
288
- appSettings={appSettings}
289
- meta={meta}
290
- isConnected={connected}
291
- reload={initializeUserMenus}
292
- modules={allModules}
293
- user={user}
294
- history={history}
295
- >
296
- {loader ? (
297
- <Card className="skeleton-card">
298
- <div className="skeleton-wrapper">
299
- <Skeleton paragraph={{ rows: 4 }} />
300
- <p className="motivating-text">{loadingMessage}</p>
301
- </div>
302
- </Card>
303
- ) : (
304
- <>
305
- {/* <Switch> */}
306
-
307
- {/* Homepage */}
308
- {!disableHomepage ? <Route exact key={'home'} path={'/'} render={(props) => <HomePageAPI config={config} {...props} />} /> : null}
309
- {/* Homepage Ends */}
310
-
311
- <Route exact key={'profile'} path={'/profile'} render={(props) => <Profile {...props} />} />
312
-
313
- <Route path={'/menus/:id'} render={() => <ModuleRoutes model={MenusAPI} />} />
314
-
315
- {/* <Switch> */}
316
- {/* Modules and Menus */}
317
- <DefineRoute
318
- menus={allModules}
319
- CustomComponents={CustomComponents}
320
- CustomModels={CustomModels}
321
- settings={appSettings}
322
- callback={(props) => {
323
- setMeta({
324
- ...props,
325
- });
326
- }}
327
- />
328
-
329
- {/* <Route path={'/users'} render={() => <ModuleRoutes model={UsersAPI} />} /> */}
330
-
331
- <Route path={'/reports/:id'} render={(props) => <ReportingDashboard CustomComponents={CustomComponents} {...props} />} />
332
-
333
- <Route exact key={'change-password'} path={'/change-password'} render={(props) => <ChangePassword {...props} />} />
334
-
335
- {/* </Switch> */}
336
- </>
337
- )}
338
- </GlobalHeader>
339
-
340
- {/* </HotKeys> */}
341
-
342
- <SpotlightSearch config={props.searchConfig} ref={(elem) => SettingsUtil.registerModal(elem)} />
343
- </section>
344
- );
345
- }
346
-
347
- /**
348
- * Define PropTypes for the component
349
- */
350
- LandingApi.propTypes = {
351
- history: PropTypes.history,
352
- CustomModels: PropTypes.object,
353
- appSettings: PropTypes.object,
354
- props: PropTypes.array,
355
- };
356
-
357
- /**
358
- *
359
- *
360
- * @param {*} param0
361
- * @returns
362
- */
363
- function DefineRoute({ menus, CustomComponents, CustomModels, settings, callback }) {
364
- const [routes, setRoutes] = useState([]);
365
-
366
- const [languageString, setLanguagestring] = useState({});
367
-
368
- const { i18n } = useTranslation();
369
-
370
- useEffect(() => {
371
- buildRoutes(menus);
372
- }, []);
373
-
374
- /**
375
- *
376
- * @param menus
377
- */
378
- async function buildRoutes(menus) {
379
- let dynamicRoutes = prepareRoutes(menus);
380
-
381
- // console.log(dynamicRoutes);
382
-
383
- SettingsUtil.registerMenus(dynamicRoutes);
384
-
385
- // Prepare the language bundle
386
- prepareLanguageBundle({ menus: dynamicRoutes });
387
-
388
- setRoutes(dynamicRoutes);
389
- }
390
-
391
- let dynamic = [];
392
-
393
- /**
394
- * Prepare the routes
395
- *
396
- * @param {*} menus
397
- * @returns
398
- */
399
- function prepareRoutes(menus) {
400
- if (menus && menus.length) {
401
- menus.forEach((menu) => {
402
- dynamic.push(menu);
403
-
404
- if (menu.sub_menus && menu.sub_menus.length) {
405
- return prepareRoutes(menu.sub_menus);
406
- }
407
- });
408
- }
409
-
410
- return dynamic;
411
- }
412
-
413
- /**
414
- * Prepare the language bundle that accepts the menus and prepares the bundle
415
- *
416
- * @param {*} param0
417
- */
418
- function prepareLanguageBundle({ menus }) {
419
- let languageString = {};
420
-
421
- const language = i18n.language;
422
-
423
- // Load the language String from each
424
- menus.forEach((menu) => {
425
- if (menu.attributes) {
426
- // try {
427
- // Menu Attributes
428
- let attributes = JSON.parse(menu.attributes);
429
-
430
- if (attributes && attributes.languages) {
431
- let keys = Object.keys(attributes.languages);
432
-
433
- keys.forEach((key) => {
434
- // languageString = {
435
- // [key]:{
436
- // ...attributes.languages[key]
437
- // }
438
-
439
- // }
440
-
441
- languageString[key] = {
442
- ...languageString[key],
443
- ...attributes.languages[key],
444
- };
445
-
446
- // languageString = {
447
- // [key]:{
448
- // ...attributes.languages[key]
449
- // }
450
-
451
- // }
452
-
453
- i18n.addResourceBundle(key, 'translation', languageString[key]);
454
- });
455
-
456
- setLanguagestring(languageString);
457
-
458
- // languageString = {
459
-
460
- // ...languageString,
461
- // [menu.name]:{
462
- // ...attributes.languages
463
- // }
464
-
465
- // }
466
-
467
- // Object.keys(languageString).forEach((key)=>{
468
-
469
- // i18n.addResourceBundle(key, 'translation', languageString[key]);
470
-
471
- // })
472
- }
473
- // } catch (error) {
474
-
475
- // console.log(error);
476
-
477
- // }
478
- }
479
- });
480
-
481
- i18n.addResourceBundle(language, 'translation', languageString[i18n.language]);
482
- }
483
-
484
- /**
485
- * Print the route
486
- *
487
- * @param {*} menu
488
- * @param {*} index
489
- * @param {*} CustomComponents
490
- * @param {*} CustomModels
491
- * @param {*} callback
492
- * @returns
493
- */
494
- function printRoute(menu, index, CustomComponents, CustomModels, callback) {
495
- // From the path we remove any query parameters that exist in the url
496
- //
497
- let paths = [];
498
-
499
- //There will be path for normal menus
500
- if (menu?.path) {
501
- paths = menu.path.split('?');
502
- } else if (Array.isArray(menu?.sub_menus)) {
503
- for (const subMenu of menu.sub_menus) {
504
- if (subMenu?.path) {
505
- paths = subMenu.path.split('?');
506
- break;
507
- }
508
- }
509
- }
510
-
511
- // Find the route path
512
- let path = paths[0];
513
-
514
- return (
515
- <Route
516
- exact
517
- key={index}
518
- path={path}
519
- render={(props) => {
520
- return (
521
- <MenuTemplate
522
- menu={menu}
523
- {...menu.attributes}
524
- {...props}
525
- CustomModels={CustomModels}
526
- CustomComponents={CustomComponents}
527
- settings={settings}
528
- callback={(props) => {
529
- callback(props);
530
- }}
531
- />
532
- );
533
- }}
534
- />
535
- );
536
- }
537
-
538
- return (
539
- <>
540
- <Switch>
541
- {routes.map((menu, index) => {
542
- return printRoute(menu, index, CustomComponents, CustomModels, callback);
543
- })}
544
- </Switch>
545
- </>
546
- );
547
- }
1
+ import { useContext, useEffect, useRef, useState } from 'react';
2
+
3
+ import { Route, Switch } from 'react-router-dom';
4
+
5
+ import { Skeleton, message, Modal } from 'antd';
6
+
7
+ import {
8
+ GlobalHeader,
9
+ ChangePassword,
10
+ useTranslation,
11
+ GlobalContext,
12
+ ModuleRoutes,
13
+ SpotlightSearch,
14
+ SettingsUtil,
15
+ Profile,
16
+ Card,
17
+ safeJSON,
18
+ } from '../../lib';
19
+
20
+ import './landing-api.scss';
21
+
22
+ import HomePageAPI from '../../pages/homepage-api/homepage-api';
23
+
24
+ import MenuTemplate from '../menu-template-api/menu-template-api';
25
+
26
+ import ReportingDashboard from '../../modules/reporting/components/reporting-dashboard/reporting-dashboard';
27
+
28
+ import PropTypes from 'prop-types';
29
+
30
+ import { CoreScripts, MenusAPI } from '../../models';
31
+
32
+ const motivatingMessages = [
33
+ 'Setting things up for a great start...',
34
+ 'Good things are loading. Stay with us.',
35
+ 'Almost there. Preparing your workspace.',
36
+ 'You are one moment away from your dashboard.',
37
+ 'Getting everything ready for you.',
38
+ 'Great care takes a second. Loading now.',
39
+ ];
40
+
41
+ function getRandomMessage(previousMessage = '') {
42
+ const options = motivatingMessages.filter((message) => message !== previousMessage);
43
+
44
+ if (!options.length) {
45
+ return motivatingMessages[0];
46
+ }
47
+
48
+ const randomIndex = Math.floor(Math.random() * options.length);
49
+ return options[randomIndex];
50
+ }
51
+
52
+ /**
53
+ * Landing API
54
+ *
55
+ * @param {*} param0
56
+ * @returns
57
+ */
58
+ export default function LandingApi({ history, CustomComponents, CustomModels, appSettings, transitionPending = false, onHomeReady, ...props }) {
59
+ const [loader, setLoader] = useState(false);
60
+ // const [modules, setModules] = useState([]);
61
+
62
+ const [connected] = useState();
63
+
64
+ const { dispatch, user = {} } = useContext(GlobalContext);
65
+
66
+ const [allModules, setAllModules] = useState();
67
+ const homeReadyNotifiedRef = useRef(false);
68
+ const messageIntervalRef = useRef(null);
69
+
70
+ const [meta, setMeta] = useState({});
71
+ const [loadingMessage, setLoadingMessage] = useState('');
72
+ const [licenseData, setLicenseData] = useState(null);
73
+
74
+ const [licAlert, setLicAlert] = useState(false);
75
+ // License data state
76
+
77
+ // const [reports, setReports] = useState([]);
78
+
79
+ var config = {};
80
+
81
+ //fetch license summary
82
+ // const fetchSummary = async () => {
83
+ // try {
84
+ // const res = await MenusAPI.getSummary();
85
+ // if (res?.data) {
86
+ // setLicenseData(res?.data);
87
+ // setLicAlert(true);
88
+ // } else {
89
+ // setLicenseData(null);
90
+ // setLicAlert(false);
91
+ // }
92
+ // } catch (err) {
93
+ // console.error(err);
94
+ // }
95
+ // };
96
+
97
+ // Variable decides the control of homepage
98
+ // #TODO This is a temporary fix - Homemage
99
+
100
+ let disableHomepage = false;
101
+
102
+ if (process.env.REACT_APP_DISABLEHOMEPAGE) {
103
+ disableHomepage = JSON.parse(process.env.REACT_APP_DISABLEHOMEPAGE);
104
+ }
105
+
106
+ /**
107
+ * Normalizes the user's branch access list from `organization_details`.
108
+ *
109
+ * The API can return `organization_details` as a JSON string, so we always
110
+ * parse it through `safeJSON` before reading the branch collection.
111
+ *
112
+ * @returns {Array} List of branches the current user can access.
113
+ */
114
+ const getAccessibleBranches = () => {
115
+ const orgDetails = safeJSON(user?.organization_details);
116
+ return Array.isArray(orgDetails?.branch) ? orgDetails.branch : [];
117
+ };
118
+
119
+ /**
120
+ * Resolves the currently selected branch record using the persisted db pointer.
121
+ *
122
+ * @param {Array} branches
123
+ * @returns {Object|null}
124
+ */
125
+ const getCurrentBranchRecord = (branches) => {
126
+ const currentDbPtr = localStorage.getItem('db_ptr');
127
+ return branches.find((branch) => String(branch.dbPtr) === String(currentDbPtr)) || null;
128
+ };
129
+
130
+ /**
131
+ * Resolves the target branch from the URL `index` query parameter.
132
+ *
133
+ * @param {Array} branches
134
+ * @param {string|null} branchId
135
+ * @returns {Object|null}
136
+ */
137
+ const getBranchRecordById = (branches, branchId) => {
138
+ return branches.find((branch) => String(branch.branch_id) === String(branchId)) || null;
139
+ };
140
+
141
+ /**
142
+ * Persists branch-specific auth data after a successful switch.
143
+ *
144
+ * @param {Object} tokenBundle
145
+ * @param {string} dbPtr
146
+ */
147
+ const persistBranchSession = (tokenBundle, dbPtr) => {
148
+ const accessToken = tokenBundle?.access_token;
149
+ const refreshToken = tokenBundle?.refresh_token;
150
+
151
+ if (accessToken) localStorage.setItem('access_token', accessToken);
152
+ if (refreshToken) localStorage.setItem('refresh_token', refreshToken);
153
+ if (dbPtr) localStorage.setItem('db_ptr', dbPtr);
154
+ };
155
+
156
+ const fetchSummary = async () => {
157
+ try {
158
+ const res = await MenusAPI.getSummary();
159
+ if (res?.data) {
160
+ setLicenseData(res?.data);
161
+ setLicAlert(true);
162
+ } else {
163
+ setLicenseData(null);
164
+ setLicAlert(false);
165
+ }
166
+ } catch (err) {
167
+ console.error(err);
168
+ }
169
+ };
170
+ // useEffect(() => {
171
+
172
+ // // Initialize the menus for the logged in user
173
+ // initializeUserMenus();
174
+
175
+ // }, [selectedBranch]);
176
+
177
+ //These change is done to fix when refreshing the report menu missing, but it removed because,makes another issue, ie there is continuos loading occurs for 2 times
178
+ // useEffect(() => {
179
+
180
+ // if (loader) {
181
+ // initializeUserMenus();
182
+ // }
183
+ // }, [loader]);
184
+
185
+ /**
186
+ * Synchronizes the active branch with the `index` query parameter.
187
+ *
188
+ * Flow:
189
+ * 1. Read the target branch id from the URL.
190
+ * 2. Compare it against the branch represented by the current `db_ptr`.
191
+ * 3. Switch branch only when the user has access and the branch actually differs.
192
+ * 4. Refresh auth/profile state and reload menus for the new branch context.
193
+ */
194
+ useEffect(() => {
195
+ const handleUrlBranchSwitch = async () => {
196
+ const searchParams = new URLSearchParams(history.location.search);
197
+ const urlDbPtr = searchParams.get('index');
198
+ if (!urlDbPtr) return;
199
+
200
+ const accessibleBranches = getAccessibleBranches();
201
+ const currentBranch = getCurrentBranchRecord(accessibleBranches);
202
+ const targetBranch = getBranchRecordById(accessibleBranches, urlDbPtr);
203
+
204
+ if (!targetBranch || String(currentBranch?.branch_id) === String(urlDbPtr)) return;
205
+
206
+ setLoader(true);
207
+
208
+ try {
209
+ const switchResult = await MenusAPI.switchBranch(
210
+ {
211
+ firm_id: targetBranch.firm_ptr,
212
+ branch_id: targetBranch.branch_id,
213
+ },
214
+ targetBranch.dbPtr
215
+ );
216
+
217
+ if (!switchResult?.success) {
218
+ Modal.error({
219
+ title: 'Branch Switch Failed',
220
+ content: switchResult?.message || 'An error occurred while attempting to switch branches.',
221
+ });
222
+ return;
223
+ }
224
+
225
+ persistBranchSession(switchResult?.token, targetBranch.dbPtr);
226
+ window.dispatchEvent(new CustomEvent('branchChanged', { detail: targetBranch.dbPtr }));
227
+
228
+ const accessToken = switchResult?.token?.access_token;
229
+ const profileResult = await MenusAPI.getProfile(accessToken);
230
+ const updatedUser = { ...profileResult, loggedCheckDone: true };
231
+
232
+ dispatch({ type: 'user', payload: updatedUser });
233
+ localStorage.setItem('userInfo', JSON.stringify(updatedUser));
234
+
235
+ await initializeUserMenus();
236
+ } catch (error) {
237
+ console.error('Auto branch switch failed:', error);
238
+ } finally {
239
+ setLoader(false);
240
+ }
241
+ };
242
+
243
+ if (user?.id && history?.location) handleUrlBranchSwitch();
244
+ }, [history?.location?.search, user?.id]);
245
+
246
+ useEffect(() => {
247
+ // Initialize the menus for the logged in user
248
+ initializeUserMenus();
249
+ }, []);
250
+
251
+ useEffect(() => {
252
+ if (!transitionPending) {
253
+ homeReadyNotifiedRef.current = false;
254
+ return;
255
+ }
256
+
257
+ if (!loader && allModules && !homeReadyNotifiedRef.current) {
258
+ homeReadyNotifiedRef.current = true;
259
+ if (typeof onHomeReady === 'function') {
260
+ onHomeReady();
261
+ }
262
+ }
263
+ }, [transitionPending, loader, allModules, onHomeReady]);
264
+
265
+ useEffect(() => {
266
+ if (!loader) {
267
+ setLoadingMessage('');
268
+
269
+ if (messageIntervalRef.current) {
270
+ clearInterval(messageIntervalRef.current);
271
+ messageIntervalRef.current = null;
272
+ }
273
+
274
+ return;
275
+ }
276
+
277
+ setLoadingMessage((previousMessage) => getRandomMessage(previousMessage));
278
+
279
+ messageIntervalRef.current = setInterval(() => {
280
+ setLoadingMessage((previousMessage) => getRandomMessage(previousMessage));
281
+ }, 2200);
282
+
283
+ return () => {
284
+ if (messageIntervalRef.current) {
285
+ clearInterval(messageIntervalRef.current);
286
+ messageIntervalRef.current = null;
287
+ }
288
+ };
289
+ }, [loader]);
290
+
291
+ /**
292
+ * Initialize the user menus
293
+ */
294
+ async function initializeUserMenus() {
295
+ // need to find what implement, with a login who has the respective value ("wug_custreportids")
296
+
297
+ const report = await loadScripts(user);
298
+
299
+ await loadMenus(report);
300
+ // fetch license summary
301
+ fetchSummary();
302
+ }
303
+
304
+ // const keyMap = {
305
+ // moveUp: 'Shift+B',
306
+ // spotlight: 'Shift+F'
307
+ // }
308
+
309
+ let coreModules;
310
+
311
+ // Reports length
312
+ let reportMenus = [];
313
+
314
+ /**
315
+ *
316
+ *
317
+ * @param reports
318
+ */
319
+ async function loadMenus(reports) {
320
+ setLoader(true);
321
+
322
+ // setReports(report)
323
+ fetchSummary();
324
+ const result = await MenusAPI.getMenus(user);
325
+
326
+ // console.log(result);
327
+
328
+ if (result && Array.isArray(result.result) && result.result.length) {
329
+ // setModules(result.result);
330
+ // result.result.map((ele) => {
331
+ // let languageString = JSON.parse(ele.attributes)
332
+ // console.log('language_string', languageString);
333
+ // if (languageString && languageString.languages) {
334
+ // const language = i18n.language;
335
+ // i18n.addResourceBundle(language, 'translation', languageString.languages[i18n.language]);
336
+ // }
337
+ // })
338
+ }
339
+ // Check if the 'settings' property exists in the 'result' object
340
+ if (result.result.settings) {
341
+ // Dispatch an action to update the settings in the store
342
+ dispatch({ type: 'settings', payload: result.result.settings });
343
+ }
344
+
345
+ // Reports length
346
+ if (reports.length) {
347
+ reportMenus = [
348
+ {
349
+ page: { path: 'ManageReports', identifier: null },
350
+ path: '/manage-reports',
351
+ caption: 'Reports',
352
+ sub_menus: reports,
353
+ },
354
+ ];
355
+ }
356
+
357
+ coreModules = [
358
+ {
359
+ caption: 'Preferences',
360
+ sub_menus: [
361
+ {
362
+ path: '/change-password',
363
+ caption: 'Change Password',
364
+ },
365
+ ],
366
+ },
367
+ ];
368
+
369
+ /**If there is roles assigned to the user */
370
+ // for matria
371
+ const useCoreMenus = process.env.REACT_APP_USE_CORE_MENUS === 'true';
372
+ if (useCoreMenus) {
373
+ if (result && result.result && reportMenus) {
374
+ setAllModules([...result.result, ...reportMenus, ...coreModules]);
375
+ } else {
376
+ //If there is no roles assigned to the user
377
+ setAllModules([...coreModules]);
378
+ }
379
+ } else {
380
+ // for nura
381
+ if (result && result.result.menus && reportMenus) {
382
+ setAllModules([...result.result.menus, ...reportMenus, ...coreModules]);
383
+ } else {
384
+ //If there is no roles assigned to the user
385
+ setAllModules([...coreModules]);
386
+ }
387
+ }
388
+ setLoader(false);
389
+ }
390
+
391
+ /**
392
+ * Load the scripts
393
+ *
394
+ * @param {*} user
395
+ * @returns
396
+ */
397
+ const loadScripts = async (user) => {
398
+ if (user.user_group && user.user_group.wug_custreportids && user.user_group.wug_custreportids !== '') {
399
+ // Saving the report ids to a variable
400
+ let reportIds = user.user_group.wug_custreportids;
401
+
402
+ var reportIdKeys = reportIds.split(',');
403
+
404
+ const reports = await Promise.all(reportIdKeys.map((id) => CoreScripts.getReportMenu({ id })));
405
+
406
+ let filtered = reports
407
+ .filter((record) => record.active === 'Y')
408
+ .map((result) => {
409
+ return {
410
+ ...result,
411
+ };
412
+ });
413
+
414
+ // setReports(filtered);
415
+
416
+ return filtered;
417
+ } else {
418
+ return [];
419
+ }
420
+ };
421
+
422
+ // setAllModules([...modules, ...reportMenus, ...coreModules])
423
+
424
+ // let coreModules = [];
425
+
426
+ // // Reports length
427
+ // let reportMenus = []
428
+
429
+ // // Reports length
430
+ // if (reports.length) {
431
+
432
+ // reportMenus = [{
433
+ // page: { path: "ManageReports", identifier: null },
434
+ // path: '/manage-reports',
435
+ // caption: 'Reports',
436
+ // sub_menus: reports
437
+ // }]
438
+ // }
439
+
440
+ return (
441
+ <section className="landing">
442
+ {/* <HotKeys focused={true} attach={window} keyMap={keyMap} handlers={handlers}> */}
443
+
444
+ <GlobalHeader
445
+ loading={loader}
446
+ appSettings={appSettings}
447
+ meta={meta}
448
+ isConnected={connected}
449
+ reload={initializeUserMenus}
450
+ modules={allModules}
451
+ user={user}
452
+ history={history}
453
+ licenseData={licenseData}
454
+ licAlert={licAlert}
455
+ >
456
+ {loader ? (
457
+ <Card className="skeleton-card">
458
+ <div className="skeleton-wrapper">
459
+ <Skeleton paragraph={{ rows: 4 }} />
460
+ <p className="motivating-text">{loadingMessage}</p>
461
+ </div>
462
+ </Card>
463
+ ) : (
464
+ <>
465
+ {/* <Switch> */}
466
+
467
+ {/* Homepage */}
468
+ {!disableHomepage ? <Route exact key={'home'} path={'/'} render={(props) => <HomePageAPI config={config} {...props} />} /> : null}
469
+ {/* Homepage Ends */}
470
+
471
+ <Route exact key={'profile'} path={'/profile'} render={(props) => <Profile {...props} />} />
472
+
473
+ <Route path={'/menus/:id'} render={() => <ModuleRoutes model={MenusAPI} />} />
474
+
475
+ {/* <Switch> */}
476
+ {/* Modules and Menus */}
477
+ <DefineRoute
478
+ menus={allModules}
479
+ CustomComponents={CustomComponents}
480
+ CustomModels={CustomModels}
481
+ settings={appSettings}
482
+ callback={(props) => {
483
+ setMeta({
484
+ ...props,
485
+ });
486
+ }}
487
+ />
488
+
489
+ {/* <Route path={'/users'} render={() => <ModuleRoutes model={UsersAPI} />} /> */}
490
+
491
+ <Route path={'/reports/:id'} render={(props) => <ReportingDashboard CustomComponents={CustomComponents} {...props} />} />
492
+
493
+ <Route exact key={'change-password'} path={'/change-password'} render={(props) => <ChangePassword {...props} />} />
494
+
495
+ {/* </Switch> */}
496
+ </>
497
+ )}
498
+ </GlobalHeader>
499
+
500
+ {/* </HotKeys> */}
501
+
502
+ <SpotlightSearch config={props.searchConfig} ref={(elem) => SettingsUtil.registerModal(elem)} />
503
+ </section>
504
+ );
505
+ }
506
+
507
+ /**
508
+ * Define PropTypes for the component
509
+ */
510
+ LandingApi.propTypes = {
511
+ history: PropTypes.history,
512
+ CustomModels: PropTypes.object,
513
+ appSettings: PropTypes.object,
514
+ props: PropTypes.array,
515
+ };
516
+
517
+ /**
518
+ *
519
+ *
520
+ * @param {*} param0
521
+ * @returns
522
+ */
523
+ function DefineRoute({ menus, CustomComponents, CustomModels, settings, callback }) {
524
+ const [routes, setRoutes] = useState([]);
525
+
526
+ const [languageString, setLanguagestring] = useState({});
527
+
528
+ const { i18n } = useTranslation();
529
+
530
+ useEffect(() => {
531
+ buildRoutes(menus);
532
+ }, []);
533
+
534
+ /**
535
+ *
536
+ * @param menus
537
+ */
538
+ async function buildRoutes(menus) {
539
+ let dynamicRoutes = prepareRoutes(menus);
540
+
541
+ // console.log(dynamicRoutes);
542
+
543
+ SettingsUtil.registerMenus(dynamicRoutes);
544
+
545
+ // Prepare the language bundle
546
+ prepareLanguageBundle({ menus: dynamicRoutes });
547
+
548
+ setRoutes(dynamicRoutes);
549
+ }
550
+
551
+ let dynamic = [];
552
+
553
+ /**
554
+ * Prepare the routes
555
+ *
556
+ * @param {*} menus
557
+ * @returns
558
+ */
559
+ function prepareRoutes(menus) {
560
+ if (menus && menus.length) {
561
+ menus.forEach((menu) => {
562
+ dynamic.push(menu);
563
+
564
+ if (menu.sub_menus && menu.sub_menus.length) {
565
+ return prepareRoutes(menu.sub_menus);
566
+ }
567
+ });
568
+ }
569
+
570
+ return dynamic;
571
+ }
572
+
573
+ /**
574
+ * Prepare the language bundle that accepts the menus and prepares the bundle
575
+ *
576
+ * @param {*} param0
577
+ */
578
+ function prepareLanguageBundle({ menus }) {
579
+ let languageString = {};
580
+
581
+ const language = i18n.language;
582
+
583
+ // Load the language String from each
584
+ menus.forEach((menu) => {
585
+ if (menu.attributes) {
586
+ // try {
587
+ // Menu Attributes
588
+ let attributes = JSON.parse(menu.attributes);
589
+
590
+ if (attributes && attributes.languages) {
591
+ let keys = Object.keys(attributes.languages);
592
+
593
+ keys.forEach((key) => {
594
+ // languageString = {
595
+ // [key]:{
596
+ // ...attributes.languages[key]
597
+ // }
598
+
599
+ // }
600
+
601
+ languageString[key] = {
602
+ ...languageString[key],
603
+ ...attributes.languages[key],
604
+ };
605
+
606
+ // languageString = {
607
+ // [key]:{
608
+ // ...attributes.languages[key]
609
+ // }
610
+
611
+ // }
612
+
613
+ i18n.addResourceBundle(key, 'translation', languageString[key]);
614
+ });
615
+
616
+ setLanguagestring(languageString);
617
+
618
+ // languageString = {
619
+
620
+ // ...languageString,
621
+ // [menu.name]:{
622
+ // ...attributes.languages
623
+ // }
624
+
625
+ // }
626
+
627
+ // Object.keys(languageString).forEach((key)=>{
628
+
629
+ // i18n.addResourceBundle(key, 'translation', languageString[key]);
630
+
631
+ // })
632
+ }
633
+ // } catch (error) {
634
+
635
+ // console.log(error);
636
+
637
+ // }
638
+ }
639
+ });
640
+
641
+ i18n.addResourceBundle(language, 'translation', languageString[i18n.language]);
642
+ }
643
+
644
+ /**
645
+ * Print the route
646
+ *
647
+ * @param {*} menu
648
+ * @param {*} index
649
+ * @param {*} CustomComponents
650
+ * @param {*} CustomModels
651
+ * @param {*} callback
652
+ * @returns
653
+ */
654
+ function printRoute(menu, index, CustomComponents, CustomModels, callback) {
655
+ // From the path we remove any query parameters that exist in the url
656
+ //
657
+ let paths = [];
658
+
659
+ //There will be path for normal menus
660
+ if (menu?.path) {
661
+ paths = menu.path.split('?');
662
+ } else if (Array.isArray(menu?.sub_menus)) {
663
+ for (const subMenu of menu.sub_menus) {
664
+ if (subMenu?.path) {
665
+ paths = subMenu.path.split('?');
666
+ break;
667
+ }
668
+ }
669
+ }
670
+
671
+ // Find the route path
672
+ let path = paths[0];
673
+
674
+ return (
675
+ <Route
676
+ exact
677
+ key={index}
678
+ path={path}
679
+ render={(props) => {
680
+ return (
681
+ <MenuTemplate
682
+ menu={menu}
683
+ {...menu.attributes}
684
+ {...props}
685
+ CustomModels={CustomModels}
686
+ CustomComponents={CustomComponents}
687
+ settings={settings}
688
+ callback={(props) => {
689
+ callback(props);
690
+ }}
691
+ />
692
+ );
693
+ }}
694
+ />
695
+ );
696
+ }
697
+
698
+ return (
699
+ <>
700
+ <Switch>
701
+ {routes.map((menu, index) => {
702
+ return printRoute(menu, index, CustomComponents, CustomModels, callback);
703
+ })}
704
+ </Switch>
705
+ </>
706
+ );
707
+ }