ui-soxo-bootstrap-core 2.4.24

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 (429) hide show
  1. package/.babelrc +9 -0
  2. package/.github/workflows/npm-publish.yml +33 -0
  3. package/.husky/pre-commit +12 -0
  4. package/.prettierrc.json +11 -0
  5. package/babel.config.js +3 -0
  6. package/core/assets/images/vector.png +0 -0
  7. package/core/components/component-loader/component-loader.js +125 -0
  8. package/core/components/component-wrapper/component-wrapper.js +122 -0
  9. package/core/components/extra-info/extra-info-details.js +172 -0
  10. package/core/components/extra-info/extra-info-details.scss +27 -0
  11. package/core/components/extra-info/extra-info.js +134 -0
  12. package/core/components/index.js +18 -0
  13. package/core/components/landing-api/landing-api.js +492 -0
  14. package/core/components/landing-api/landing-api.scss +19 -0
  15. package/core/components/menu-template-api/menu-template-api.js +321 -0
  16. package/core/components/root-application-api/root-application-api.js +174 -0
  17. package/core/components/root-application-api/root-application.api.scss +0 -0
  18. package/core/index.js +14 -0
  19. package/core/lib/Store.js +363 -0
  20. package/core/lib/assets/Tick-icon.png +0 -0
  21. package/core/lib/assets/blue-slate-theme.png +0 -0
  22. package/core/lib/assets/dark-theme.png +0 -0
  23. package/core/lib/assets/deep-purple-theme.png +0 -0
  24. package/core/lib/assets/light-theme.png +0 -0
  25. package/core/lib/assets/nura-theme.png +0 -0
  26. package/core/lib/assets/plant.png +0 -0
  27. package/core/lib/assets/welcome-image.png +0 -0
  28. package/core/lib/assets/white-haze-theme.png +0 -0
  29. package/core/lib/components/application-bootstrap/application-bootstrap.js +115 -0
  30. package/core/lib/components/application-bootstrap/application-bootstrap.scss +0 -0
  31. package/core/lib/components/approval-form/approval-form.js +280 -0
  32. package/core/lib/components/approval-form/approval-form.scss +184 -0
  33. package/core/lib/components/approval-list/approval-list.js +143 -0
  34. package/core/lib/components/approval-list/approval-list.scss +3 -0
  35. package/core/lib/components/approval-list/components/request-card/request-card.js +43 -0
  36. package/core/lib/components/approval-list/components/request-card/request-card.scss +31 -0
  37. package/core/lib/components/camera/camera.js +231 -0
  38. package/core/lib/components/camera/camera.scss +86 -0
  39. package/core/lib/components/comment-block/comment-block.js +139 -0
  40. package/core/lib/components/comment-block/comment-block.scss +3 -0
  41. package/core/lib/components/confirm-modal/confirm-modal.js +82 -0
  42. package/core/lib/components/confirm-modal/confirm-modal.scss +3 -0
  43. package/core/lib/components/consent/consent.js +67 -0
  44. package/core/lib/components/consent/consent.scss +0 -0
  45. package/core/lib/components/consent/pdf-signature.js +299 -0
  46. package/core/lib/components/consent/signature-pad.js +90 -0
  47. package/core/lib/components/consent/signature-pad.scss +14 -0
  48. package/core/lib/components/file-upload/file-upload.js +133 -0
  49. package/core/lib/components/finger-print-reader/finger-print-reader.js +296 -0
  50. package/core/lib/components/finger-print-reader/finger-print-reader.scss +47 -0
  51. package/core/lib/components/finger-print-search/finger-print-search.js +200 -0
  52. package/core/lib/components/finger-print-search/finger-print-search.scss +47 -0
  53. package/core/lib/components/global-header/animations.js +18 -0
  54. package/core/lib/components/global-header/global-header.js +413 -0
  55. package/core/lib/components/global-header/global-header.scss +369 -0
  56. package/core/lib/components/header/generic-header.js +76 -0
  57. package/core/lib/components/header/generic-header.scss +99 -0
  58. package/core/lib/components/image-preview/image-preview.js +33 -0
  59. package/core/lib/components/image-wrapper/image-wrapper.js +108 -0
  60. package/core/lib/components/image-wrapper/image-wrapper.scss +13 -0
  61. package/core/lib/components/index.js +203 -0
  62. package/core/lib/components/landing/landing.js +404 -0
  63. package/core/lib/components/landing/landing.scss +0 -0
  64. package/core/lib/components/language-switcher/language-switcher.js +50 -0
  65. package/core/lib/components/menu-context/menu-context.js +70 -0
  66. package/core/lib/components/menu-template/menu-template.js +250 -0
  67. package/core/lib/components/menu-template/menu-template.scss +9 -0
  68. package/core/lib/components/modal-search/modal-search.js +153 -0
  69. package/core/lib/components/modal-search/modal-search.scss +79 -0
  70. package/core/lib/components/modal-wrapper/modal-manager.js +16 -0
  71. package/core/lib/components/modal-wrapper/modal-wrapper.js +108 -0
  72. package/core/lib/components/modal-wrapper/modal-wrapper.scss +14 -0
  73. package/core/lib/components/notice-board/notice-board.js +132 -0
  74. package/core/lib/components/notice-board/notice-board.scss +65 -0
  75. package/core/lib/components/page-container/page-container.js +55 -0
  76. package/core/lib/components/page-container/page-container.scss +8 -0
  77. package/core/lib/components/page-header/page-header.js +23 -0
  78. package/core/lib/components/page-header/page-header.scss +18 -0
  79. package/core/lib/components/pdf-viewer/pdf-viewer.js +56 -0
  80. package/core/lib/components/portlet-table/components/table-actions/table-actions.js +58 -0
  81. package/core/lib/components/portlet-table/components/table-actions/table-actions.scss +1 -0
  82. package/core/lib/components/portlet-table/components/table-data/table-data.js +107 -0
  83. package/core/lib/components/portlet-table/components/table-data/table-data.scss +0 -0
  84. package/core/lib/components/portlet-table/portlet-table.js +63 -0
  85. package/core/lib/components/portlet-table/portlet-table.scss +90 -0
  86. package/core/lib/components/progress-bar/progress-bar.js +58 -0
  87. package/core/lib/components/progress-bar/progress-bar.scss +15 -0
  88. package/core/lib/components/request-form/request-form.js +110 -0
  89. package/core/lib/components/request-form/request-form.scss +0 -0
  90. package/core/lib/components/root-application/root-application.js +70 -0
  91. package/core/lib/components/rupee/rupee.js +14 -0
  92. package/core/lib/components/script-input/script-input.js +169 -0
  93. package/core/lib/components/script-input/script-input.scss +8 -0
  94. package/core/lib/components/sidemenu/animations.js +52 -0
  95. package/core/lib/components/sidemenu/sidemenu.js +617 -0
  96. package/core/lib/components/sidemenu/sidemenu.scss +264 -0
  97. package/core/lib/components/spotlight-search/spotlight-search.component.js +636 -0
  98. package/core/lib/components/spotlight-search/spotlight-search.component.scss +78 -0
  99. package/core/lib/components/table-wrapper/table-wrapper.js +136 -0
  100. package/core/lib/components/table-wrapper/table-wrapper.scss +72 -0
  101. package/core/lib/components/ui_elements/Loader.js +13 -0
  102. package/core/lib/components/ui_elements/Notify.js +13 -0
  103. package/core/lib/components/ui_elements/PlaceHolder.js +34 -0
  104. package/core/lib/components/web-camera/web-camera.js +162 -0
  105. package/core/lib/components/web-camera/web-camera.scss +28 -0
  106. package/core/lib/core.md +9 -0
  107. package/core/lib/elements/Elements.md +3 -0
  108. package/core/lib/elements/basic/LoggedUserRedirect.js +21 -0
  109. package/core/lib/elements/basic/PrivateRoute.js +16 -0
  110. package/core/lib/elements/basic/button/Button.md +43 -0
  111. package/core/lib/elements/basic/button/button.js +170 -0
  112. package/core/lib/elements/basic/button/button.scss +0 -0
  113. package/core/lib/elements/basic/card/Card.md +15 -0
  114. package/core/lib/elements/basic/card/card.js +40 -0
  115. package/core/lib/elements/basic/card/card.scss +14 -0
  116. package/core/lib/elements/basic/checkbox/checkbox.js +23 -0
  117. package/core/lib/elements/basic/col/col.js +16 -0
  118. package/core/lib/elements/basic/copy-to-clipboard/Readme.md +40 -0
  119. package/core/lib/elements/basic/copy-to-clipboard/copy-to-clipboard.js +62 -0
  120. package/core/lib/elements/basic/country-phone-input/Readme.md +98 -0
  121. package/core/lib/elements/basic/country-phone-input/country-phone-input.js +107 -0
  122. package/core/lib/elements/basic/country-phone-input/phone-input.scss +62 -0
  123. package/core/lib/elements/basic/datepicker/datepicker.js +33 -0
  124. package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +61 -0
  125. package/core/lib/elements/basic/empty/empty.js +15 -0
  126. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.js +118 -0
  127. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.scss +10 -0
  128. package/core/lib/elements/basic/form/Readme.md +0 -0
  129. package/core/lib/elements/basic/form/form.js +70 -0
  130. package/core/lib/elements/basic/form/form.scss +4 -0
  131. package/core/lib/elements/basic/image/image.js +45 -0
  132. package/core/lib/elements/basic/image/image.scss +17 -0
  133. package/core/lib/elements/basic/image/readme.md +26 -0
  134. package/core/lib/elements/basic/image-viewer/image-viewer.js +109 -0
  135. package/core/lib/elements/basic/image-viewer/image-viewer.scss +8 -0
  136. package/core/lib/elements/basic/input/input.js +81 -0
  137. package/core/lib/elements/basic/input/readme.md +77 -0
  138. package/core/lib/elements/basic/json-input/json-input.js +51 -0
  139. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.js +216 -0
  140. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.scss +28 -0
  141. package/core/lib/elements/basic/modal/modal.js +64 -0
  142. package/core/lib/elements/basic/modal/readme.md +62 -0
  143. package/core/lib/elements/basic/popconfirm/popconfirm.js +18 -0
  144. package/core/lib/elements/basic/popover/popover.js +13 -0
  145. package/core/lib/elements/basic/radio/radio.js +18 -0
  146. package/core/lib/elements/basic/rangepicker/rangepicker.js +51 -0
  147. package/core/lib/elements/basic/rangepicker/rangepicker.scss +18 -0
  148. package/core/lib/elements/basic/rangepicker/readme.md +82 -0
  149. package/core/lib/elements/basic/reference-select/readme.md +19 -0
  150. package/core/lib/elements/basic/reference-select/reference-select.js +337 -0
  151. package/core/lib/elements/basic/row/row.js +16 -0
  152. package/core/lib/elements/basic/select/select.js +47 -0
  153. package/core/lib/elements/basic/select-box/readme.md +53 -0
  154. package/core/lib/elements/basic/select-box/select-box.js +63 -0
  155. package/core/lib/elements/basic/skeleton/readme.md +35 -0
  156. package/core/lib/elements/basic/skeleton/skeleton.js +36 -0
  157. package/core/lib/elements/basic/skeleton/skeleton.scss +53 -0
  158. package/core/lib/elements/basic/space/space.js +13 -0
  159. package/core/lib/elements/basic/switch/readme.md +29 -0
  160. package/core/lib/elements/basic/switch/switch.js +58 -0
  161. package/core/lib/elements/basic/tab/tab.js +15 -0
  162. package/core/lib/elements/basic/table/readme.md +9 -0
  163. package/core/lib/elements/basic/table/table.js +100 -0
  164. package/core/lib/elements/basic/table/table.scss +0 -0
  165. package/core/lib/elements/basic/tag/tag.js +63 -0
  166. package/core/lib/elements/basic/tag/tag.scss +3 -0
  167. package/core/lib/elements/basic/timeline/timeline.js +14 -0
  168. package/core/lib/elements/basic/title/readme.md +20 -0
  169. package/core/lib/elements/basic/title/title.js +38 -0
  170. package/core/lib/elements/basic/title/title.scss +0 -0
  171. package/core/lib/elements/basic/user-search/user-search.js +192 -0
  172. package/core/lib/elements/complex/barcode/barcode.js +27 -0
  173. package/core/lib/elements/complex/bargraph/bar-graph.js +262 -0
  174. package/core/lib/elements/complex/basic-table/basic-table.js +111 -0
  175. package/core/lib/elements/complex/basic-table/basic-table.scss +4 -0
  176. package/core/lib/elements/complex/date-display/date-display.js +37 -0
  177. package/core/lib/elements/complex/error-boundary/error-boundary.js +29 -0
  178. package/core/lib/elements/complex/google-location-input/map-container-library-load.js +93 -0
  179. package/core/lib/elements/complex/google-map/google-map.js +230 -0
  180. package/core/lib/elements/complex/google-map/google-map.scss +13 -0
  181. package/core/lib/elements/complex/line-graph/line-graph.js +108 -0
  182. package/core/lib/elements/complex/location-search-input/location-search-input.js +100 -0
  183. package/core/lib/elements/complex/maps/maps.js +0 -0
  184. package/core/lib/elements/complex/pie-chart/pie-chart.js +203 -0
  185. package/core/lib/elements/complex/qr-code/qr-code.js +27 -0
  186. package/core/lib/elements/complex/qrscanner/qrscanner.js +57 -0
  187. package/core/lib/elements/complex/search-debounce/search-debounce.js +37 -0
  188. package/core/lib/elements/complex/statistic-card/dashboard-statistic-card.js +76 -0
  189. package/core/lib/elements/complex/statistic-card/statistic-card.js +28 -0
  190. package/core/lib/elements/index.js +226 -0
  191. package/core/lib/hooks/device-detect.js +26 -0
  192. package/core/lib/hooks/index.js +19 -0
  193. package/core/lib/hooks/use-location.js +33 -0
  194. package/core/lib/hooks/use-window-size.js +34 -0
  195. package/core/lib/i18n.js +70 -0
  196. package/core/lib/index.js +106 -0
  197. package/core/lib/introduction.md +74 -0
  198. package/core/lib/js-styleguide.md +4112 -0
  199. package/core/lib/models/actions/actions.js +128 -0
  200. package/core/lib/models/actions/components/action-detail/action-detail.js +190 -0
  201. package/core/lib/models/actions/components/action-detail/action-detail.scss +0 -0
  202. package/core/lib/models/actions/components/custom-actions/custom-actions.js +186 -0
  203. package/core/lib/models/actions/components/custom-actions/custom-actions.scss +0 -0
  204. package/core/lib/models/attachments/attachments.js +231 -0
  205. package/core/lib/models/base-loader.js +99 -0
  206. package/core/lib/models/base.js +716 -0
  207. package/core/lib/models/branches/branches.js +125 -0
  208. package/core/lib/models/checklists/checklists.js +115 -0
  209. package/core/lib/models/columns/columns.js +169 -0
  210. package/core/lib/models/columns/components/columns-add/columns-add.js +172 -0
  211. package/core/lib/models/columns/components/columns-add/columns-add.scss +0 -0
  212. package/core/lib/models/comments/comments.js +213 -0
  213. package/core/lib/models/departments/departments.js +107 -0
  214. package/core/lib/models/financial-years/financial_years.js +127 -0
  215. package/core/lib/models/forms/components/form-creator/form-creator.js +624 -0
  216. package/core/lib/models/forms/components/form-creator/form-creator.scss +30 -0
  217. package/core/lib/models/forms/components/form-detail/form-detail.js +224 -0
  218. package/core/lib/models/forms/components/form-detail/form-detail.scss +0 -0
  219. package/core/lib/models/forms/forms.js +122 -0
  220. package/core/lib/models/index.js +203 -0
  221. package/core/lib/models/invoice-numbers/invoice_numbers.js +204 -0
  222. package/core/lib/models/lookup-types/components/lookup-detail/lookup-detail.js +145 -0
  223. package/core/lib/models/lookup-types/components/lookup-detail/lookup-detail.scss +0 -0
  224. package/core/lib/models/lookup-types/lookup-types.js +113 -0
  225. package/core/lib/models/lookup-values/components/lookup-values-add/lookup-values-add.js +126 -0
  226. package/core/lib/models/lookup-values/components/lookup-values-add/lookup-values-add.scss +0 -0
  227. package/core/lib/models/lookup-values/lookup-values.js +107 -0
  228. package/core/lib/models/menu-roles/menu-roles.js +127 -0
  229. package/core/lib/models/menus/components/menu-add/menu-add.js +228 -0
  230. package/core/lib/models/menus/components/menu-add/menu-add.scss +0 -0
  231. package/core/lib/models/menus/components/menu-detail/menu-detail.js +170 -0
  232. package/core/lib/models/menus/components/menu-detail/menu-detail.scss +0 -0
  233. package/core/lib/models/menus/components/menu-list/menu-list.js +593 -0
  234. package/core/lib/models/menus/components/menu-list/menu-list.scss +6 -0
  235. package/core/lib/models/menus/components/menu-roles-add/menu-roles-add.js +183 -0
  236. package/core/lib/models/menus/components/menu-roles-add/menu-roles-add.scss +0 -0
  237. package/core/lib/models/menus/menus.js +499 -0
  238. package/core/lib/models/models/components/model-detail/model-detail.js +137 -0
  239. package/core/lib/models/models/components/model-detail/model-detail.scss +0 -0
  240. package/core/lib/models/models/components/models.js +128 -0
  241. package/core/lib/models/modules/modules.js +204 -0
  242. package/core/lib/models/outbox/outbox.js +73 -0
  243. package/core/lib/models/pages/pages.js +107 -0
  244. package/core/lib/models/permissions/permissions.js +71 -0
  245. package/core/lib/models/process/components/process-add/process-add.js +181 -0
  246. package/core/lib/models/process/components/process-add/process-add.scss +0 -0
  247. package/core/lib/models/process/components/process-dashboard/process-dashboard.js +602 -0
  248. package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +62 -0
  249. package/core/lib/models/process/components/process-detail/process-detail.js +140 -0
  250. package/core/lib/models/process/components/process-detail/process-detail.scss +0 -0
  251. package/core/lib/models/process/components/process-timeline/process-timeline.js +140 -0
  252. package/core/lib/models/process/components/task-detail/task-detail.js +240 -0
  253. package/core/lib/models/process/components/task-detail/task-detail.scss +27 -0
  254. package/core/lib/models/process/components/task-form/task-form.js +529 -0
  255. package/core/lib/models/process/components/task-form/task-form.scss +7 -0
  256. package/core/lib/models/process/components/task-list/task-list.js +221 -0
  257. package/core/lib/models/process/components/task-list/task-list.scss +14 -0
  258. package/core/lib/models/process/components/task-overview/task-overview.js +300 -0
  259. package/core/lib/models/process/components/task-overview/task-overview.scss +0 -0
  260. package/core/lib/models/process/components/task-overview-legacy/task-overview-legacy.js +192 -0
  261. package/core/lib/models/process/components/task-overview-legacy/task-overview.scss +0 -0
  262. package/core/lib/models/process/components/task-routes/task-routes.js +45 -0
  263. package/core/lib/models/process/components/task-status/task-status.js +176 -0
  264. package/core/lib/models/process/components/task-status/task-status.scss +11 -0
  265. package/core/lib/models/process/process.js +781 -0
  266. package/core/lib/models/process-transactions/process-transactions.js +124 -0
  267. package/core/lib/models/roles/roles.js +106 -0
  268. package/core/lib/models/scripts/scripts.js +111 -0
  269. package/core/lib/models/step-transactions/step-transcations.js +148 -0
  270. package/core/lib/models/steps/components/step-add/step-add.js +261 -0
  271. package/core/lib/models/steps/components/step-add/step-add.scss +0 -0
  272. package/core/lib/models/steps/components/step-detail/step-detail.js +157 -0
  273. package/core/lib/models/steps/components/step-detail/step-detail.scss +0 -0
  274. package/core/lib/models/steps/steps.js +357 -0
  275. package/core/lib/models/user-preferences/user-preferences.js +83 -0
  276. package/core/lib/models/users/components/user-add/user-add.js +226 -0
  277. package/core/lib/models/users/components/user-add/user-add.scss +0 -0
  278. package/core/lib/models/users/users.js +120 -0
  279. package/core/lib/modules/business/launch-page/launch-page.js +29 -0
  280. package/core/lib/modules/business/launch-page/launch-page.scss +6 -0
  281. package/core/lib/modules/business/slots/slots.js +231 -0
  282. package/core/lib/modules/business/slots/slots.scss +108 -0
  283. package/core/lib/modules/forms/components/field-customizer/field-customizer.js +139 -0
  284. package/core/lib/modules/forms/components/field-customizer/field-customizer.scss +0 -0
  285. package/core/lib/modules/forms/components/field-selector/field-selector.js +157 -0
  286. package/core/lib/modules/forms/components/field-selector/field-selector.scss +25 -0
  287. package/core/lib/modules/forms/components/form-display/form-display.js +203 -0
  288. package/core/lib/modules/forms/components/form-display/form-display.scss +9 -0
  289. package/core/lib/modules/forms/components/tab-customizer/tab-customizer.js +125 -0
  290. package/core/lib/modules/forms/components/tab-customizer/tab-customizer.scss +0 -0
  291. package/core/lib/modules/generic/generic-add/generic-add.js +213 -0
  292. package/core/lib/modules/generic/generic-add/generic-add.scss +0 -0
  293. package/core/lib/modules/generic/generic-detail/generic-detail.js +199 -0
  294. package/core/lib/modules/generic/generic-detail/generic-detail.scss +0 -0
  295. package/core/lib/modules/generic/generic-edit/generic-edit.js +120 -0
  296. package/core/lib/modules/generic/generic-edit/generic-edit.scss +0 -0
  297. package/core/lib/modules/generic/generic-list/ExportReactCSV.js +62 -0
  298. package/core/lib/modules/generic/generic-list/generic-list.js +705 -0
  299. package/core/lib/modules/generic/generic-list/generic-list.scss +34 -0
  300. package/core/lib/modules/generic/generic-upload/generic-upload.js +484 -0
  301. package/core/lib/modules/generic/generic-upload/generic-upload.scss +0 -0
  302. package/core/lib/modules/generic/table-settings/table-settings.js +226 -0
  303. package/core/lib/modules/generic/table-settings/table-settings.scss +37 -0
  304. package/core/lib/modules/index.js +52 -0
  305. package/core/lib/modules/modules-routes/module-routes.js +35 -0
  306. package/core/lib/modules/modules-routes/module-routes.scss +0 -0
  307. package/core/lib/pages/change-password/change-password.js +211 -0
  308. package/core/lib/pages/change-password/change-password.scss +76 -0
  309. package/core/lib/pages/homepage/homepage.js +53 -0
  310. package/core/lib/pages/index.js +20 -0
  311. package/core/lib/pages/login/login.js +617 -0
  312. package/core/lib/pages/login/login.scss +346 -0
  313. package/core/lib/pages/manage-users/manage-users.js +429 -0
  314. package/core/lib/pages/manage-users/manage-users.scss +26 -0
  315. package/core/lib/pages/profile/profile.js +247 -0
  316. package/core/lib/pages/profile/profile.scss +107 -0
  317. package/core/lib/pages/profile/theme-config.js +18 -0
  318. package/core/lib/pages/profile/themes-backup.json +311 -0
  319. package/core/lib/pages/profile/themes.json +254 -0
  320. package/core/lib/pages/register/register.js +177 -0
  321. package/core/lib/pages/register/register.scss +128 -0
  322. package/core/lib/react-styleguide.md +757 -0
  323. package/core/lib/utils/api/api.utils.js +188 -0
  324. package/core/lib/utils/api/readme.md +426 -0
  325. package/core/lib/utils/async.js +36 -0
  326. package/core/lib/utils/common/common.utils.js +123 -0
  327. package/core/lib/utils/common/readme.md +30 -0
  328. package/core/lib/utils/date/date.utils.js +295 -0
  329. package/core/lib/utils/date/readme.md +2 -0
  330. package/core/lib/utils/firebase.support.utils.js +99 -0
  331. package/core/lib/utils/firebase.utils.js +808 -0
  332. package/core/lib/utils/form/Form.md +0 -0
  333. package/core/lib/utils/form/form.utils.js +256 -0
  334. package/core/lib/utils/generic/generic.utils.js +69 -0
  335. package/core/lib/utils/http/auth.helper.js +95 -0
  336. package/core/lib/utils/http/http.utils.js +157 -0
  337. package/core/lib/utils/http/readme.md +14 -0
  338. package/core/lib/utils/index.js +46 -0
  339. package/core/lib/utils/location/location.utils.js +137 -0
  340. package/core/lib/utils/location/readme.md +18 -0
  341. package/core/lib/utils/modal.utils.js +16 -0
  342. package/core/lib/utils/notification.utils.js +35 -0
  343. package/core/lib/utils/pwa/pwa.utils.js +88 -0
  344. package/core/lib/utils/script.utils.js +235 -0
  345. package/core/lib/utils/setting.utils.js +69 -0
  346. package/core/lib/utils/upload.utils.js +30 -0
  347. package/core/models/Preference/Preferences.js +46 -0
  348. package/core/models/base/base.js +399 -0
  349. package/core/models/base-clone-loader.js +107 -0
  350. package/core/models/base-clone.js +187 -0
  351. package/core/models/base-loader.js +97 -0
  352. package/core/models/core-scripts/core-scripts.js +150 -0
  353. package/core/models/dashboard/dashboard.js +187 -0
  354. package/core/models/detail-loader.js +88 -0
  355. package/core/models/groups.js +82 -0
  356. package/core/models/index.js +94 -0
  357. package/core/models/lookup-types/components/lookup-detail/lookup-detail.js +129 -0
  358. package/core/models/lookup-types/lookup-types.js +96 -0
  359. package/core/models/lookup-values/components/lookup-values-modal/lookup-values-modal.js +95 -0
  360. package/core/models/lookup-values/components/lookup-values-modal/lookup-values-modal.scss +0 -0
  361. package/core/models/lookup-values/lookup-values.js +92 -0
  362. package/core/models/menu-roles/components/menu-roles-add/menu-roles-add.js +153 -0
  363. package/core/models/menu-roles/components/menu-roles-add/menu-roles-add.scss +0 -0
  364. package/core/models/menu-roles/menu-roles.js +158 -0
  365. package/core/models/menus/components/menu-add/menu-add.js +325 -0
  366. package/core/models/menus/components/menu-add/menu-add.scss +31 -0
  367. package/core/models/menus/components/menu-detail/menu-detail.js +263 -0
  368. package/core/models/menus/components/menu-list/menu-list.js +392 -0
  369. package/core/models/menus/components/menu-lists/menu-lists.js +429 -0
  370. package/core/models/menus/components/menu-lists/menu-lists.scss +41 -0
  371. package/core/models/menus/menus.js +291 -0
  372. package/core/models/model-columns.js +121 -0
  373. package/core/models/models/components/model-detail/model-add.js +120 -0
  374. package/core/models/models/components/model-detail/model-detail.js +133 -0
  375. package/core/models/models/components/model-detail/model-detail.scss +0 -0
  376. package/core/models/models/models.js +154 -0
  377. package/core/models/pages/components/page-add/page-add.js +163 -0
  378. package/core/models/pages/components/page-add/page-add.scss +31 -0
  379. package/core/models/pages/components/page-details/page-details.js +210 -0
  380. package/core/models/pages/components/page-list/page-list.js +248 -0
  381. package/core/models/pages/pages.js +142 -0
  382. package/core/models/pages/pages.scss +0 -0
  383. package/core/models/pages.js +142 -0
  384. package/core/models/roles/components/role-add/role-add.js +248 -0
  385. package/core/models/roles/components/role-list/role-list.js +408 -0
  386. package/core/models/roles/roles.js +188 -0
  387. package/core/models/user-roles/components/user-roles-add/user-roles-add.js +149 -0
  388. package/core/models/user-roles/components/user-roles-add/user-roles-add.scss +0 -0
  389. package/core/models/user-roles/user-roles.js +99 -0
  390. package/core/models/users/components/user-add/user-add.js +458 -0
  391. package/core/models/users/components/user-detail/user-detail.js +236 -0
  392. package/core/models/users/components/user-detail/user-detail.scss +0 -0
  393. package/core/models/users/components/user-list/user-list.js +397 -0
  394. package/core/models/users/users.js +185 -0
  395. package/core/modules/Informations/change-info/change-info.js +618 -0
  396. package/core/modules/Informations/change-info/change-info.scss +135 -0
  397. package/core/modules/dashboard/components/dashboard-card/animations.js +65 -0
  398. package/core/modules/dashboard/components/dashboard-card/dashboard-card.js +197 -0
  399. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +430 -0
  400. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.scss +60 -0
  401. package/core/modules/dashboard/components/pop-query-dashboard/pop-query-dashboard.js +66 -0
  402. package/core/modules/generic/components/generic-add/generic-add.js +121 -0
  403. package/core/modules/generic/components/generic-add/generic-add.scss +13 -0
  404. package/core/modules/generic/components/generic-add-modal/generic-add-modal.js +125 -0
  405. package/core/modules/generic/components/generic-add-modal/generic-add-modal.scss +13 -0
  406. package/core/modules/generic/components/generic-detail/generic-detail.js +184 -0
  407. package/core/modules/generic/components/generic-detail/generic-detail.scss +25 -0
  408. package/core/modules/generic/components/generic-edit/generic-edit.js +123 -0
  409. package/core/modules/generic/components/generic-edit/generic-edit.scss +0 -0
  410. package/core/modules/generic/components/generic-list/generic-list.js +335 -0
  411. package/core/modules/generic/components/generic-list/generic-list.scss +35 -0
  412. package/core/modules/index.js +54 -0
  413. package/core/modules/module-routes/module-routes.js +37 -0
  414. package/core/modules/module-routes/module-routes.scss +0 -0
  415. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1101 -0
  416. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +171 -0
  417. package/core/pages/homepage-api/homepage-api.js +106 -0
  418. package/core/pages/homepage-api/homepage-api.scss +234 -0
  419. package/core/pages/homepage-api/menu-dashboard.js +169 -0
  420. package/core/pages/homepage-api/menu-dashboard.scss +12 -0
  421. package/core/translation.json +54 -0
  422. package/core/translations.json +20 -0
  423. package/core/utils/script.utils.js +130 -0
  424. package/core/utils/settings.utils.js +26 -0
  425. package/eslint.config.mjs +79 -0
  426. package/index.js +36 -0
  427. package/package.json +118 -0
  428. package/tsconfig.json +27 -0
  429. package/webpack.config.js +174 -0
@@ -0,0 +1,1101 @@
1
+ import React, { useState, useEffect, useContext, useRef } from 'react';
2
+
3
+ import { Table, Skeleton, Input, Tag, Modal, message, Pagination } from 'antd';
4
+
5
+ import { QrcodeOutlined } from '@ant-design/icons';
6
+
7
+ import * as Icons from '@ant-design/icons';
8
+
9
+ import { Location, FormCreator, GlobalContext, ExportReactCSV, getExportData, Card, TableComponent, QrScanner } from './../../../../lib/';
10
+
11
+ import { CoreScripts } from './../../../../models/';
12
+
13
+ import moment from 'moment-timezone';
14
+
15
+ import Button from '../../../../lib/elements/basic/button/button';
16
+
17
+ import { Link } from 'react-router-dom';
18
+
19
+ import './reporting-dashboard.scss';
20
+
21
+ // import MenuDashBoard from '../../../../pages/homepage-api/menu-dashboard';
22
+ import MenuDashBoardComponent from '../../../../lib/elements/basic/menu-dashboard/menu-dashboard';
23
+ import { useHistory } from 'react-router-dom';
24
+ // import { isPdfFile } from 'pdfjs-dist';
25
+
26
+ var genericComponents = require('./../../../../lib');
27
+
28
+ const { Search } = Input;
29
+
30
+ /**
31
+ * ReportingDashboard component renders the dashboard and handles patient details,
32
+ * configuration, and form layout for generating reports.
33
+ *
34
+ * @param {Object} props - The component's props.
35
+ * @param {Object} props.match - The match object containing the URL parameters.
36
+ * @param {Object} props.CustomComponents - Custom components for rendering.
37
+ * @param {string} props.reportId - The report ID.
38
+ * @param {boolean} props.isFixedIndex - Determines if the index is fixed.
39
+ * @param {Array<string>} props.dashBoardIds - The list of dashboard IDs.
40
+ *
41
+ * @returns {JSX.Element} The rendered ReportingDashboard component.
42
+ */
43
+ export default function ReportingDashboard({
44
+ match,
45
+ scope,
46
+ CustomComponents,
47
+ reportId,
48
+ isFixedIndex,
49
+ dashBoardIds,
50
+ barcodeFilterKey,
51
+ showScanner,
52
+ dbPtr,
53
+ }) {
54
+ const [config, setConfig] = useState({});
55
+
56
+ // State to manage the layout of the form
57
+ const [formLayout, setFormLayout] = useState('inline');
58
+
59
+ const [loading, setLoading] = useState(true);
60
+
61
+ const [cardLoading, setCardLoading] = useState(true);
62
+
63
+ const [dashboardVisible, setDashBoardVisible] = useState(false);
64
+
65
+ const [formContents, setformContents] = useState({});
66
+
67
+ const scriptId = useRef(null);
68
+
69
+ //In case of reports from core_script , there will be id from params
70
+ // In case of normal menu we need to take id from props
71
+ let id = reportId ? reportId : match.params.id;
72
+
73
+ const { CustomModels = {} } = useContext(GlobalContext);
74
+
75
+ const [details, setDetails] = useState([]);
76
+
77
+ const [columns, setColumns] = useState([]); // To set columns
78
+
79
+ const [summaryColumns, setSummaryColumns] = useState([]);
80
+
81
+ const [patients, setPatients] = useState([]); //Patients list array
82
+
83
+ const urlParams = Location.search();
84
+
85
+ // Pagination
86
+ const [pagination, setPagination] = useState({
87
+ current: 1,
88
+ pageSize: 20,
89
+ total: 0,
90
+ });
91
+
92
+ // Settings db pointer
93
+ if (!dbPtr) dbPtr = localStorage.db_ptr;
94
+
95
+ /**
96
+ * Fetches patient details from the server and updates the relevant state.
97
+ * This includes input parameters, columns, summary columns, and configuration.
98
+ *
99
+ * @returns {Promise<void>} A promise that resolves when the patient details have been fetched and the state has been updated.
100
+ */
101
+ async function getPatientDetails(idOverride) {
102
+ setPatients([]);
103
+ const fetchId = idOverride || id;
104
+ await CoreScripts.getRecord({ id: fetchId, dbPtr }).then(async ({ result }) => {
105
+ await prepareInputParameters(result);
106
+ setColumns(JSON.parse(result.display_columns));
107
+
108
+ if (result.summary_columns) {
109
+ setSummaryColumns(JSON.parse(result.summary_columns));
110
+ }
111
+
112
+ setConfig({ ...result });
113
+ });
114
+ }
115
+
116
+ // useEffect(() => {
117
+ // if (!dashboardVisible) {
118
+ // refresh(false);
119
+ // }
120
+ // }, [dashboardVisible]);
121
+
122
+ /**
123
+ *
124
+ *
125
+ * Manage initial render
126
+ */
127
+
128
+ useEffect(() => {
129
+ getPatientDetails();
130
+ }, []);
131
+
132
+ /**
133
+ * Effect hook that triggers the `getPatientDetails` function
134
+ * whenever the `match.params.id` value changes.
135
+ *
136
+ * @returns {void} This hook does not return anything.
137
+ */
138
+ // useEffect(() => {
139
+ // getPatientDetails();
140
+ // }, [match.params.id]);
141
+
142
+ let parameters;
143
+
144
+ /**
145
+ * Some parameters would need binding with the model
146
+ *
147
+ * @param {*} inputParameters Input parameters from the report configuration.
148
+ */
149
+
150
+ //Prepare input parameters by mapping default values and binding models if needed
151
+ async function prepareInputParameters(record) {
152
+ setLoading(true);
153
+ let urlParams = Location.search();
154
+
155
+ // If script id exist set into variable
156
+ if (urlParams.script_id) scriptId.current = urlParams.script_id;
157
+
158
+ let otherDetails = record.other_details1 ? JSON.parse(record.other_details1) : null;
159
+ parameters = JSON.parse(record.input_parameters);
160
+
161
+ let formContent = {};
162
+
163
+ parameters = await parameters.map((record) => {
164
+ // Only if the url params does have a matching value ,
165
+ // we should not consider the default value
166
+
167
+ if (urlParams[record.field]) {
168
+ if (record.type === 'date') {
169
+ formContent[record.field] = moment.utc(urlParams[record.field]);
170
+ }
171
+
172
+ // return formContent;
173
+ } else {
174
+ // let StartDate, EndDate;
175
+ switch (record.default) {
176
+ case 'startOfDay':
177
+ formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE).startOf('day');
178
+ break;
179
+
180
+ case 'endOfDay':
181
+ formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE).endOf('day');
182
+ break;
183
+
184
+ case 'startOfWeek':
185
+ formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE).startOf('week');
186
+ break;
187
+
188
+ case 'endOfWeek':
189
+ formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE).endOf('week');
190
+ break;
191
+
192
+ case 'currentDate':
193
+ formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE);
194
+ break;
195
+
196
+ default:
197
+ break;
198
+ }
199
+ }
200
+
201
+ // If it is a date field and still no value, set it to today's date
202
+ if (record.type === 'date' && !formContent[record.field]) {
203
+ formContent[record.field] = moment().tz(process.env.REACT_APP_TIMEZONE);
204
+ }
205
+
206
+ if (['reference-select', 'reference-search', 'select'].indexOf(record.type) !== -1) {
207
+ // let model = "";
208
+ let model = CustomModels[record.modelName];
209
+
210
+ return {
211
+ ...record,
212
+ model,
213
+ required: record.required,
214
+ };
215
+ } else {
216
+ return {
217
+ ...record,
218
+ required: true,
219
+ };
220
+ }
221
+ });
222
+ // Update form content state
223
+ setformContents(formContent);
224
+
225
+ // Trigger form submission
226
+ onFinish(formContent, null, record.input_parameters);
227
+
228
+ setLoading(false);
229
+
230
+ // Check if input parameters are enabled or disabled in otherDetails
231
+ if (otherDetails?.isDisableInputParameters) {
232
+ // If enabled, clear the details array
233
+ setDetails([]);
234
+ } else {
235
+ //// Filter the array "parameters" and keep only elements where "type" is present (truthy)
236
+ //Keep only parameters that have a "type" → used for UI display
237
+ let filter = parameters.filter((ele) => ele.type);
238
+ // Update the "details" state with the filtered results
239
+
240
+ setDetails([...filter]);
241
+ }
242
+ }
243
+
244
+ // Refresh patient details.
245
+
246
+ function refresh() {
247
+ getPatientDetails();
248
+ }
249
+
250
+ const fetchReportData = async (id, values, dbPtr, pagination) => {
251
+ const { current, pageSize } = pagination || {};
252
+ // If card script id is exist load that id otherwise load id
253
+ const coreScriptId = scriptId.current ? scriptId.current : id;
254
+
255
+ setLoading(true);
256
+ try {
257
+ // Prepare payload for backend: format only here
258
+ const formattedValues = {};
259
+ Object.keys(values).forEach((key) => {
260
+ const val = values[key];
261
+ formattedValues[key] = moment.isMoment(val) ? val.format('YYYY-MM-DD') : val;
262
+ });
263
+ // Pagination Data
264
+ const paginationData = {
265
+ page: pagination.current || 1,
266
+ limit: pagination.pageSize || 10,
267
+ };
268
+ // Combine form data + pagination
269
+ let formBody = {
270
+ body: {
271
+ ...formattedValues,
272
+ ...paginationData,
273
+ },
274
+ };
275
+ // Optional override if `scope` exists
276
+ if (scope) {
277
+ formBody = { body: { ...scope, ...paginationData } };
278
+ }
279
+ // Fetch result
280
+ const result = await CoreScripts.getReportingLisitng(coreScriptId, formBody, dbPtr);
281
+ // Handle both result formats
282
+ let resultDetails = result[0];
283
+ if (result?.result && result?.result[0]) {
284
+ resultDetails = result.result[0];
285
+ }
286
+
287
+ // Update patients
288
+ setPatients(resultDetails || []);
289
+
290
+ if (result.length) {
291
+ // Set Pgination data into URL
292
+ Location.search({ ...Location.search(), current, pageSize });
293
+
294
+ setPagination((prev) => ({
295
+ ...prev,
296
+ current: pagination.current,
297
+ pageSize: pagination.pageSize,
298
+ total: resultDetails?.[0]?.TotalCount ?? pagination?.total,
299
+ }));
300
+ }
301
+ } catch (error) {
302
+ console.error('Error fetching report data:', error);
303
+ } finally {
304
+ // Always runs, success or error
305
+ setLoading(false);
306
+ }
307
+ };
308
+
309
+ // Handle Submit
310
+ const handleSubmit = (values) => {
311
+ const { pageSize } = pagination;
312
+ const resetPage = 1;
313
+
314
+ // Reset script id on Submit
315
+ scriptId.current = null;
316
+
317
+ // Get current query params
318
+ const currentUrlParams = Location.search();
319
+ const { script_id, selected_card, ...cleanParams } = currentUrlParams;
320
+
321
+ // Construct new query string
322
+ const newParams = new URLSearchParams({
323
+ ...cleanParams,
324
+ current: resetPage,
325
+ pageSize,
326
+ });
327
+
328
+ // Replace URL
329
+ const newUrl = `${window.location.pathname}?${newParams.toString()}`;
330
+ window.history.replaceState({}, '', newUrl);
331
+
332
+ // Trigger submit handler
333
+ onFinish(values, resetPage);
334
+ };
335
+
336
+ /**
337
+ *
338
+ * @param {*} values
339
+ */
340
+
341
+ const onFinish = async (values, resetPage, inputParamsString) => {
342
+ setLoading(true);
343
+ setCardLoading(true);
344
+ // // Check if the dashboard is visible and both start and end values are provided
345
+ // If true, proceed with hiding the dashboard by setting dashboardVisible to false
346
+ if (dashboardVisible && values.start && values.end) {
347
+ setDashBoardVisible((prev) => {
348
+ if (!prev) return prev; // Prevent unnecessary updates
349
+
350
+ return false;
351
+ });
352
+ }
353
+ const paramsString = inputParamsString || (config.input_parameters ? config.input_parameters : null);
354
+ // Cheacking if there is data and making the data url friendly, ie, if there is date in url
355
+ if (paramsString) {
356
+ let urlsToUpdate = {};
357
+
358
+ let parameterValue = JSON.parse(paramsString);
359
+
360
+ // Variable to store/update the form initial Values
361
+
362
+ let formContent = {};
363
+
364
+ parameters = parameterValue.map((parameter) => {
365
+ //Getting url friendly value by matching the url values and input_parameter values
366
+ let value = values[parameter.field];
367
+
368
+ // Keep Moment object in state for picker
369
+ if (parameter.type === 'date' && value) {
370
+ formContent[parameter.field] = value.isValid ? value : moment(value); // ensure Moment
371
+ // Format for URL
372
+ urlsToUpdate[parameter.field] = moment(value).format('YYYY-MM-DD');
373
+ } else {
374
+ formContent[parameter.field] = value;
375
+ if (parameter.type) {
376
+ urlsToUpdate[parameter.field] = value;
377
+ }
378
+ }
379
+
380
+ return parameter;
381
+ });
382
+
383
+ // Remove keys with undefined, null, or empty string values
384
+ const filteredParams = Object.fromEntries(
385
+ Object.entries(urlsToUpdate).filter(([_, value]) => value !== undefined && value !== null && value !== '')
386
+ );
387
+
388
+ setformContents(formContent);
389
+ Location.search({ ...Location.search(), ...filteredParams });
390
+ }
391
+
392
+ // Reset Pagination Data
393
+ const latestUrlParams = Location.search();
394
+ const paginationData = {
395
+ current: resetPage || Number(latestUrlParams.current) || 1,
396
+ pageSize: Number(latestUrlParams.pageSize) || pagination.pageSize,
397
+ };
398
+
399
+ // Call API
400
+ try {
401
+ await fetchReportData(id, values, dbPtr, paginationData);
402
+ } finally {
403
+ setLoading(false);
404
+ setCardLoading(false);
405
+ }
406
+ };
407
+
408
+ // Pagination Handler
409
+ const handlePagination = async (newPagination) => {
410
+ try {
411
+ await fetchReportData(id, formContents, dbPtr, newPagination);
412
+ } finally {
413
+ setLoading(false);
414
+ setCardLoading(false);
415
+ }
416
+ };
417
+
418
+ let model = {
419
+ fields: details,
420
+ };
421
+
422
+ return (
423
+ <Card className="reporting-dashboard card card-shadow">
424
+ {/** If dashBoardIds exist and contain elements, render MenuDashBoard*/}
425
+
426
+ {/* Page Header */}
427
+ {/* <div className="page-header">
428
+ <div>
429
+ <Title style={{ marginBottom: '0px' }} level={4}>
430
+ {config.caption || 'Report'}
431
+ </Title>
432
+ </div>
433
+
434
+ <div className="right">
435
+ <div className="date-and-fltr">
436
+ <Button onClick={refresh} type="secondary" size={'small'}>
437
+ <ReloadOutlined />
438
+ </Button>
439
+ </div>
440
+ </div>
441
+ </div> */}
442
+ {/* Page Header Ends */}
443
+ {dashBoardIds?.length > 0 ? (
444
+ <MenuDashBoardComponent
445
+ dashBoardIds={dashBoardIds} //Pass the available dashboard IDs to the componen
446
+ activeId={Number(urlParams?.selected_card || 0)}
447
+ callback={(record) => {
448
+ const selectedCard = record?.id;
449
+ if (record.other_details) {
450
+ // Convert the other_details string to a JSON object
451
+ let json = JSON.parse(record.other_details);
452
+ const newScriptId = json.script_id;
453
+
454
+ scriptId.current = newScriptId;
455
+
456
+ // Reset Pagination on card click
457
+ setPagination((prev) => ({
458
+ ...prev,
459
+ current: 1,
460
+ total: 0,
461
+ }));
462
+
463
+ //Update URL
464
+ Location.search({
465
+ ...Location.search(),
466
+ current: 1,
467
+ pageSize: pagination.pageSize,
468
+ script_id: newScriptId,
469
+ selected_card: selectedCard,
470
+ });
471
+
472
+ // menudashBoardVisible = true;
473
+ // Show the dashboard component
474
+ setDashBoardVisible(true);
475
+ // Fetch and update patient details based on the selected item
476
+ getPatientDetails(newScriptId);
477
+ // setDashBoard(true);
478
+ }
479
+ }}
480
+ ></MenuDashBoardComponent>
481
+ ) : null}
482
+
483
+ {/* Content Below */}
484
+ {loading ? (
485
+ <>
486
+ <Skeleton active />
487
+ </>
488
+ ) : (
489
+ <>
490
+ <div>
491
+ {/* <Card className="form-card" style={{ padding: '10px 10px' }}> */}
492
+ {details && details[0] && !loading ? (
493
+ <FormCreator
494
+ {...formLayout}
495
+ layout={formLayout}
496
+ initialValues={{
497
+ layout: formLayout,
498
+ }}
499
+ styles={{ paddingRight: '15px', alignItems: 'center' }}
500
+ fields={details}
501
+ formContent={formContents}
502
+ // formContent={{ [model]: {} }}
503
+ modelIndex="requestId"
504
+ model={model}
505
+ onSubmit={handleSubmit}
506
+ callback={() => {
507
+ // history.goBack();
508
+ }}
509
+ />
510
+ ) : null}
511
+ {/* </Card> */}
512
+ </div>
513
+
514
+ {/** GuestList component start*/}
515
+ <GuestList
516
+ patients={patients}
517
+ columns={columns}
518
+ summaryColumns={summaryColumns}
519
+ isFixedIndex={isFixedIndex}
520
+ showScanner={showScanner}
521
+ barcodeFilterKey={barcodeFilterKey}
522
+ CustomComponents={{ ...CustomComponents, ...genericComponents }}
523
+ refresh={refresh}
524
+ config={config}
525
+ loading={cardLoading}
526
+ pagination={pagination}
527
+ handlePagination={handlePagination}
528
+ />
529
+ {/** GuestList component end*/}
530
+ </>
531
+ )}
532
+ </Card>
533
+ );
534
+ }
535
+
536
+ /**
537
+ *
538
+ * @param root0
539
+ * @param root0.patients
540
+ * @param root0.CustomComponents
541
+ * @param root0.summaryColumns
542
+ * @param root0.refresh
543
+ * @param root0.isFixedIndex
544
+ * @returns {*}
545
+ */
546
+ //Renders a table displaying a list of patients with dynamic columns
547
+ function GuestList({
548
+ patients,
549
+ columns,
550
+ loading,
551
+ CustomComponents,
552
+ refresh,
553
+ isFixedIndex,
554
+ barcodeFilterKey,
555
+ showScanner,
556
+ config,
557
+ pagination,
558
+ handlePagination,
559
+ }) {
560
+ var [query, setQuery] = useState('');
561
+ const [exportData, setExportData] = useState({});
562
+
563
+ // const [data, setData] = useState([]);
564
+
565
+ //visibility of the QR scanner modal.
566
+ const [isScannerVisible, setScannerVisible] = useState(false);
567
+
568
+ // Stores the patients filtered specifically by QR scan match.
569
+ const [filteredPatients, setFilteredPatients] = useState([]); // Show all initially
570
+
571
+ // patient object to redirect to upon successful QR scan.
572
+ const [redirectPatient, setRedirectPatient] = useState(null);
573
+
574
+ let history = useHistory();
575
+
576
+ const { isMobile, dispatch } = useContext(GlobalContext);
577
+
578
+ const getRedirectLink = (entry, record) => {
579
+ let redirectLink = entry.redirect_link;
580
+ if (entry.replace_variables) {
581
+ entry.replace_variables.forEach((replacement) => {
582
+ const value = record[replacement.field] || '';
583
+ redirectLink = redirectLink.replace(new RegExp(`@${replacement.field};`, 'g'), value);
584
+ });
585
+ }
586
+ return redirectLink;
587
+ };
588
+
589
+ // const [view, setView] = useState(isMobile ? true : false); //Need to check this condition
590
+ const cols = [
591
+ ...[
592
+ {
593
+ title: '#',
594
+ dataIndex: 'index',
595
+ render: (value, item, index) => index + 1,
596
+ key: 'ColumnIndex',
597
+ fixed: isFixedIndex ? 'left' : null,
598
+ },
599
+ ],
600
+ ...columns.map((entry) => {
601
+ // if (entry.sort) {
602
+ // return {
603
+ // render: (record) => {
604
+
605
+ // if (entry.render) {
606
+
607
+ // return entry.render(record);
608
+ // } else {
609
+ // return record[entry.dataIndex]
610
+ // }
611
+ // },
612
+ // title: entry.title,
613
+ // key: entry.field,
614
+ // sorter: (a, b) => entry.sort(a, b),
615
+ // sortDirections: ['ascend', 'descend', 'ascend'],
616
+ // };
617
+ // } else {
618
+ return {
619
+ render: (record) => {
620
+ let textColor = 'inherit';
621
+
622
+ if (entry.color) {
623
+ textColor = entry.color;
624
+ }
625
+ /** We can have x types of components that is to be rendered here */
626
+
627
+ /**1. Column Data */
628
+
629
+ /**2. Action */
630
+
631
+ /**3. Custom Component - In future . */
632
+
633
+ if (entry.render) {
634
+ return entry.render(record);
635
+
636
+ // The type of component can be differentiated by type/ we can also reuse
637
+ // any field present in the columns to avoid any additional field
638
+ } else if (entry.type === 'link') {
639
+ //Cheacking type of action to be done ie,If it contains a type then it will match with the record
640
+ // for example initally we are implementing it for a type link
641
+ // ie, we will return a link in query with the field as link and type link in display_columns
642
+ //So here we match the field returned by query with the type in display_columns
643
+
644
+ if (record[entry.field]) {
645
+ return (
646
+ <a href={record[entry.field]} target="_blank" rel="noopener noreferrer">
647
+ View
648
+ </a>
649
+ );
650
+ }
651
+ } else if (entry.field === 'action') {
652
+ let redirectLink = entry.redirect_link;
653
+
654
+ // The variables to be replaced can be maintained
655
+ // as a configuration in the entry or the column configuration
656
+
657
+ // We iterate through all the variables that are present in the configuration
658
+ // and replace the link to generate the final link
659
+
660
+ entry.replace_variables.forEach((replacement) => {
661
+ redirectLink = redirectLink.replace(new RegExp('@' + replacement.field + ';', 'g'), record[replacement.field]);
662
+ });
663
+
664
+ return <Link to={`${redirectLink}`}>View</Link>;
665
+ } else if (entry.field === 'custom') {
666
+ // Make all the components in modules available for use in custom column of core script
667
+ // var genericComponents = require('./../../../../../../../nura-api-new/nura-desk/src/modules');
668
+ var genericComponents = CustomComponents;
669
+
670
+ // Arrive the component name
671
+ let componentName = entry.component;
672
+
673
+ let LoadedComponent = null;
674
+ // If there is custom components mensioned in the display_columns,
675
+ // then matching the custom components with the generic components
676
+ if (componentName) {
677
+ if (componentName && genericComponents[componentName]) {
678
+ LoadedComponent = genericComponents[componentName];
679
+ }
680
+ }
681
+
682
+ let propValue = {};
683
+ // If there is props value
684
+ if (entry.props) {
685
+ // Looping the props from the props mensioned in display_columns,
686
+ // Matching the field of record props field with the and return the
687
+ entry.props.forEach((values) => {
688
+ // Matching the fields of record with the props field
689
+ let valueCreation = record[values.field];
690
+ // Returning the values of field matched by fields
691
+ propValue[values.value] = valueCreation;
692
+ });
693
+ }
694
+
695
+ return (
696
+ <LoadedComponent
697
+ // Configuration will define
698
+ {...entry.config}
699
+ callback={() => {
700
+ refresh();
701
+ }}
702
+ // record={record}
703
+
704
+ {...record}
705
+ // assigning the props
706
+ {...propValue}
707
+ />
708
+ );
709
+ } else {
710
+ // Check if both `color_code` exists in the record and `enableColor` is true
711
+ if (record.color_code && entry.enableColor) {
712
+ // If the column type is 'tag', render the field inside an Ant Design <Tag> with color
713
+ if (entry.columnType === 'tag') {
714
+ return <Tag color={record.color_code}>{record[entry.field]}</Tag>;
715
+
716
+ // If the column type is 'span', render the field inside a <span> with inline color style
717
+ } else if (entry.columnType === 'span') {
718
+ return <span style={{ color: record.color_code }}>{record[entry.field]}</span>;
719
+ }
720
+ } else {
721
+ /**
722
+ * This code dynamically displays icons based on data and a configuration
723
+ * When a column's configuration includes a displayIcons JSON, the code will check the corresponding data field.
724
+ * If the field's value (e.g., "Pending") matches a key in that JSON,
725
+ * the system will display the specified icon with its defined color and size.
726
+ */
727
+ if (entry.displayIcons) {
728
+ // Get the field value
729
+ const fieldValue = record[entry.field]?.toString();
730
+
731
+ // Get the configuration for the icon from the JSON.
732
+ const displayConfig = entry.displayIcons[fieldValue];
733
+ if (displayConfig) {
734
+ // Look up the actual component from our iconMap using the name from the JSON.
735
+ const DynamicIcon = Icons[displayConfig.icon];
736
+ // If a component is found, render it with the specified color and size.
737
+ if (DynamicIcon) {
738
+ return (
739
+ <DynamicIcon
740
+ style={{
741
+ color: displayConfig.color,
742
+ fontSize: displayConfig.size,
743
+ }}
744
+ />
745
+ );
746
+ }
747
+ }
748
+ } else {
749
+ //If the value is neither 'Y' nor 'N', return the actual field value
750
+ return <span style={{ color: textColor }}>{record[entry.field]}</span>;
751
+ }
752
+ }
753
+ }
754
+ },
755
+ field: entry.field,
756
+ title: entry.title,
757
+ key: entry.field,
758
+ fixed: entry.isFixedColumn ? entry.isFixedColumn : null, // Conditionally setting the 'fixed' key to 'left' if 'isColumnStatic' is true; otherwise, setting it to null.
759
+ // Check if filtering is enabled and patients is an array
760
+ filters:
761
+ entry.isFilterEnabled && Array.isArray(patients)
762
+ ? [...new Set(patients.map((item) => item[entry.field]).filter(Boolean))].map((value) => ({ text: value, value }))
763
+ : null,
764
+ // Apply the filter only if it's enabled for the column
765
+ onFilter: entry.isFilterEnabled ? (value, record) => record[entry.field] === value : null,
766
+ //If sorting is enabled for this entry, provide a sorter function
767
+ sorter: entry.isSortingEnabled ? (a, b) => String(a[entry.field]).localeCompare(String(b[entry.field])) : null,
768
+
769
+ // Apply the filter search
770
+ filterSearch: entry.isFilterEnabled ? entry.isFilterEnabled : false,
771
+ exportDefinition: (record) => {
772
+ //Custom components should not be downloaded
773
+ // return entry.field === 'custom' ? null : record[entry.field];
774
+ if (entry.field === 'custom') {
775
+ // Find the field key in props that corresponds to 'description'
776
+ const description = entry.props?.find((p) => p.value === 'description')?.field;
777
+
778
+ // Return the value from record.props if it exists
779
+ return description && record[description] ? record[description] : null;
780
+ }
781
+
782
+ return record[entry.field];
783
+ },
784
+ // Add align property based on column type
785
+ align: entry.type === 'number' ? 'right' : 'left',
786
+ };
787
+ // }
788
+ }),
789
+ // ...[
790
+ // {
791
+ // title: '',
792
+ // key: 'action',
793
+ // render: (text, record) => {
794
+ // let detail = model.slice(0, model.length - 1);
795
+
796
+ // return (
797
+ // <Space size="middle">
798
+ // {!schema.hideView && !actions.length ? <Link to={`/${city}/${model}/${text.id}`}>View</Link> : null}
799
+
800
+ // {actions.map((action) => (
801
+ // <Link to={action.url(record)}>{action.caption}</Link>
802
+ // ))}
803
+ // </Space>
804
+ // );
805
+ // },
806
+ // },
807
+ // ],
808
+
809
+ // ...[
810
+ // {
811
+ // title: '',
812
+ // key: 'action',
813
+ // render: (text, record) => {
814
+ // let detail = model.slice(0, model.length - 1);
815
+
816
+ // return (
817
+ // <Link to={`${menu.path.replace(':id',visitid)}?op_no=${OpNo}`}>
818
+ // <Button size={'small'}>
819
+ // <PlayCircleOutlined />
820
+ // Go to Menu
821
+ // </Button>
822
+ // </Link>
823
+ // );
824
+ // },
825
+ // },
826
+ // ],
827
+ ];
828
+
829
+ /**
830
+ *
831
+ * @param {*} result
832
+ */
833
+
834
+ // function changeView(result) {
835
+ // setView(result);
836
+ // }
837
+
838
+ /**
839
+ *
840
+ * @param {*} event
841
+ */
842
+
843
+ function onSearch(event) {
844
+ setQuery(event.target.value);
845
+ }
846
+
847
+ /**
848
+ *
849
+ */
850
+
851
+ useEffect(() => {
852
+ //Cheaking if there is patient data exists
853
+ if (patients) {
854
+ let data = patients?.map((entry) => {
855
+ entry.rowIndex = entry.opb_id;
856
+
857
+ entry.dispatch = dispatch;
858
+
859
+ return entry;
860
+ });
861
+
862
+ // setData(data);
863
+
864
+ // Define export data
865
+ let exportDatas = getExportData(patients, cols);
866
+
867
+ if (exportDatas.exportDataColumns.length && exportDatas.exportDataHeaders.length) {
868
+ setExportData({ exportDatas });
869
+ }
870
+ }
871
+ }, [patients]);
872
+
873
+ let filtered;
874
+
875
+ if (patients) {
876
+ filtered = patients.filter((record) => {
877
+ if (query) {
878
+ // Keys
879
+ let keys = Object.keys(record);
880
+
881
+ let flag = false;
882
+
883
+ keys.forEach((key) => {
884
+ let ele = record[key];
885
+
886
+ if (ele && typeof ele === 'string' && ele.toLowerCase().indexOf(query.toLowerCase()) !== -1) {
887
+ flag = true;
888
+ }
889
+ });
890
+
891
+ /**Will return flag */
892
+ return flag;
893
+ } else {
894
+ return true;
895
+ }
896
+ });
897
+ }
898
+
899
+ /**
900
+ * Checks for a match in the filtered patient list based on a scanned code,
901
+ * updates the relevant state if a match is found, and redirects to the
902
+ * patient's detail page. Displays a warning if no match is found.
903
+ *
904
+ * @param {string} code - The scanned code to match against a specific field of each patient.
905
+ */
906
+
907
+ const handleScanSuccess = (code) => {
908
+ // Filters patients based on the scanned code and the selected barcode key(using attributes 'barcodeFilterKey')
909
+ const matched = filtered.filter((patient) => patient[barcodeFilterKey] === code);
910
+
911
+ if (matched.length) {
912
+ const patient = matched[0];
913
+ setFilteredPatients(matched);
914
+ setRedirectPatient(matched);
915
+ message.success(`Match found for ${code}, redirecting...`);
916
+
917
+ const actionColumn = columns.find((col) => col.field === 'action');
918
+ if (actionColumn) {
919
+ const redirectLink = getRedirectLink(actionColumn, patient);
920
+ // history.push(redirectLink);
921
+ window.location.href = redirectLink;
922
+ }
923
+ } else {
924
+ Modal.warning({
925
+ title: 'No matching records.',
926
+ content: `No match for scanned code: ${code}`,
927
+ });
928
+ }
929
+ };
930
+
931
+ return (
932
+ <>
933
+ <div className="table-header">
934
+ <div className="table-left">
935
+ {/* shwoing caption is not correct so this commented */}
936
+ {/* <span className="menu-caption">{config.caption}</span> */}
937
+ <Search placeholder="Enter Search Value" allowClear onChange={onSearch} />
938
+ {/* <p className="size-hint">{patients.length} records.</p> */}
939
+ </div>
940
+
941
+ <div className="table-right">
942
+ {/* QR Scan start */}
943
+ {showScanner ? (
944
+ <Button size="small" type="primary" icon={<QrcodeOutlined />} onClick={() => setScannerVisible(true)}>
945
+ Scan QR
946
+ </Button>
947
+ ) : null}
948
+
949
+ <Modal open={isScannerVisible} title="Scan QR Code" footer={null} onCancel={() => setScannerVisible(false)} destroyOnClose>
950
+ <QrScanner onScanSuccess={handleScanSuccess} onClose={() => setScannerVisible(false)} />
951
+ </Modal>
952
+
953
+ <div>
954
+ {/* QR Scan End */}
955
+ {/*table data export to csc component*/}
956
+ {exportData.exportDatas && (
957
+ <ExportReactCSV
958
+ title={config.caption}
959
+ headers={exportData.exportDatas.exportDataHeaders}
960
+ csvData={exportData.exportDatas.exportDataColumns}
961
+ />
962
+ )}
963
+ </div>
964
+ </div>
965
+ </div>
966
+
967
+ <div>
968
+ {/* {view ? (
969
+ <>
970
+ <CardList dataSource={data} columns={columns} />
971
+ </>
972
+ ) : (
973
+ <> */}
974
+ <Card>
975
+ {loading ? (
976
+ <>
977
+ <Skeleton active paragraph={{ rows: 6 }} />
978
+ </>
979
+ ) : (
980
+ <TableComponent
981
+ size="small"
982
+ scroll={{ x: true }}
983
+ rowKey={(record) => record.OpNo}
984
+ dataSource={filtered ? filtered : patients} // In case if there is no filtered values we can use patient data
985
+ columns={cols}
986
+ pagination={false}
987
+ // title={config.caption}
988
+ summary={(pageData) => {
989
+ // Variable to save the summary data
990
+ let summary = {};
991
+
992
+ let summaryColumns = [
993
+ { field: 'opb_amt', title: 'Amount' },
994
+ { field: 'opb_netamt', title: 'Net Amount' },
995
+ ];
996
+
997
+ let tableColumns = cols;
998
+
999
+ // Creating a copy of columns to append the summary configuration that is needed to set
1000
+ tableColumns.forEach((record, index) => {
1001
+ summaryColumns.forEach((inner) => {
1002
+ if (record.field === inner.field) {
1003
+ tableColumns[index].summary = inner;
1004
+ }
1005
+ });
1006
+ });
1007
+
1008
+ // Initialize
1009
+ summaryColumns.map((item) => {
1010
+ return (summary[item.field] = 0);
1011
+ });
1012
+
1013
+ // Find the total
1014
+ summaryColumns.map((item) => {
1015
+ pageData.forEach((entry) => {
1016
+ return (summary[item.field] = summary[item.field] + entry[item.field]);
1017
+ });
1018
+ });
1019
+
1020
+ return (
1021
+ <>
1022
+ <Table.Summary.Row>
1023
+ {tableColumns.map((column, key) => {
1024
+ return <Table.Summary.Cell key={key}>{column.summary ? <>{summary[column.summary.field]}</> : null}</Table.Summary.Cell>;
1025
+ })}
1026
+ </Table.Summary.Row>
1027
+ </>
1028
+ );
1029
+ }}
1030
+ />
1031
+ )}
1032
+
1033
+ {/* Pagination aligned to the right */}
1034
+ <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 8 }}>
1035
+ <Pagination
1036
+ showSizeChanger
1037
+ current={pagination.current}
1038
+ pageSize={pagination.pageSize}
1039
+ total={pagination.total}
1040
+ pageSizeOptions={[20, 30, 50, 100]}
1041
+ onChange={(page, pageSize) => handlePagination({ current: page, pageSize })}
1042
+ />
1043
+ </div>
1044
+
1045
+ {/*If patient data exists show the number else to 0 */}
1046
+ <p className="size-hint">{patients ? patients.length : 0} records. </p>
1047
+ </Card>
1048
+ {/* </> */}
1049
+ {/* )} */}
1050
+ </div>
1051
+ </>
1052
+ );
1053
+ }
1054
+
1055
+ // //Mobile view card Section
1056
+ // function CardList({ dataSource, url }) {
1057
+ // const { user = {}, dispatch } = useContext(GlobalContext);
1058
+
1059
+ // function onClick(item) {
1060
+ // Location.navigate({
1061
+ // url: `/lab-detail/${item.BillID}`,
1062
+ // });
1063
+
1064
+ // dispatch({ type: 'index', payload: item.rowIndex });
1065
+ // }
1066
+
1067
+ // return dataSource.map((item, index) => {
1068
+ // // to={`/lab-detail/${item.BillID}`}
1069
+ // return (
1070
+ // <div
1071
+ // key={index}
1072
+ // className="report-item"
1073
+ // onClick={() => {
1074
+ // onClick(item);
1075
+ // }}
1076
+ // >
1077
+ // <GuestCard record={item} />
1078
+ // </div>
1079
+ // );
1080
+ // });
1081
+ // }
1082
+
1083
+ // function GuestCard({ record }) {
1084
+ // return (
1085
+ // <Card className="card vehicle-card">
1086
+ // <div className="card">
1087
+ // <h2 className="title">{record.PName}</h2>
1088
+
1089
+ // <h4 className="values">{record.OpNo}</h4>
1090
+
1091
+ // <h3 className="values">{record.Test}</h3>
1092
+
1093
+ // <h3 className="values">Primary Result : {record.PrimaryResult || 'Pending'}</h3>
1094
+
1095
+ // <Text type="secondary">{record.Mobile}</Text>
1096
+
1097
+ // <h4 className="values">{record.Date}</h4>
1098
+ // </div>
1099
+ // </Card>
1100
+ // );
1101
+ // }