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