ui-soxo-bootstrap-core 2.6.5 → 2.6.6
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 +33 -33
- package/.husky/pre-commit +11 -11
- package/.prettierrc.json +10 -10
- 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 +20 -20
- package/core/components/landing-api/landing-api.js +492 -492
- package/core/components/landing-api/landing-api.scss +19 -19
- 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 +365 -365
- 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 +413 -413
- package/core/lib/components/global-header/global-header.scss +369 -369
- 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 +578 -578
- package/core/lib/components/sidemenu/sidemenu.scss +277 -277
- 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 +106 -106
- package/core/lib/elements/basic/country-phone-input/phone-input.scss +61 -61
- package/core/lib/elements/basic/datepicker/datepicker.js +33 -33
- package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +136 -136
- 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 +114 -114
- 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 +100 -100
- 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 +624 -624
- package/core/lib/models/forms/components/form-creator/form-creator.scss +30 -29
- 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 +593 -593
- 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 +601 -601
- package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +62 -62
- 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 +62 -62
- package/core/lib/modules/generic/generic-list/generic-list.js +705 -705
- package/core/lib/modules/generic/generic-list/generic-list.scss +34 -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 +201 -201
- 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 +864 -864
- package/core/lib/pages/login/login.scss +344 -344
- package/core/lib/pages/login/reset-password.js +125 -125
- package/core/lib/pages/login/reset-password.scss +22 -22
- 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 +211 -211
- 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 +223 -223
- 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/form/form.utils.js +255 -255
- package/core/lib/utils/generic/generic.utils.js +69 -69
- package/core/lib/utils/http/auth.helper.js +95 -95
- package/core/lib/utils/http/http.utils.js +158 -158
- package/core/lib/utils/http/readme.md +14 -14
- package/core/lib/utils/index.js +40 -40
- 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 +150 -150
- 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 +427 -427
- 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 +585 -585
- package/core/models/menus/components/menu-lists/menu-lists.scss +46 -46
- package/core/models/menus/menus.js +310 -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 +312 -312
- package/core/models/roles/components/role-add/role-add.scss +4 -4
- package/core/models/roles/components/role-list/role-list.js +386 -386
- package/core/models/roles/roles.js +196 -196
- package/core/models/staff/components/staff-add/staff-add.js +467 -467
- 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 +406 -406
- 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 +856 -856
- package/core/models/users/components/user-add/user-edit.js +106 -106
- 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 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +74 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +252 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +126 -0
- package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +880 -1206
- package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +171 -171
- package/core/modules/steps/action-buttons.js +74 -76
- package/core/modules/steps/action-buttons.scss +44 -15
- package/core/modules/steps/steps.js +348 -346
- package/core/modules/steps/steps.scss +357 -159
- package/core/modules/steps/timeline.js +56 -54
- 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 +123 -123
- package/tsconfig.json +26 -26
- package/webpack.config.js +173 -173
|
@@ -1,618 +1,618 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* @author Sneha
|
|
4
|
-
*
|
|
5
|
-
* The component used to change information
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React, { useState, useContext, useEffect } from 'react';
|
|
11
|
-
|
|
12
|
-
import { Steps, message } from 'antd';
|
|
13
|
-
|
|
14
|
-
import './change-info.scss';
|
|
15
|
-
|
|
16
|
-
import { GlobalContext, FormCreator, Card,Button } from '../../../lib';
|
|
17
|
-
|
|
18
|
-
import { CoreScripts, Preferences } from '../../../models';
|
|
19
|
-
|
|
20
|
-
import PropTypes from 'prop-types';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param root0
|
|
25
|
-
* @param root0.reportId
|
|
26
|
-
* @param root0.preferenceId
|
|
27
|
-
* @returns {*}
|
|
28
|
-
*/
|
|
29
|
-
function ChangeInfo({ reportId, preferenceId }) {
|
|
30
|
-
//Representing steps
|
|
31
|
-
|
|
32
|
-
// Track the curren //Representing steps
|
|
33
|
-
const { Step } = Steps;
|
|
34
|
-
|
|
35
|
-
// Track the current step in the process
|
|
36
|
-
const [currentStep, setCurrentStep] = useState(0);
|
|
37
|
-
|
|
38
|
-
// Store details returned by coreScript
|
|
39
|
-
const [paramterData, setParameterData] = useState([]);
|
|
40
|
-
|
|
41
|
-
// Store title
|
|
42
|
-
const [displayColumns, setdisplayColumns] = useState([]);
|
|
43
|
-
|
|
44
|
-
// Store titles
|
|
45
|
-
const [titleData, setTitleData] = useState();
|
|
46
|
-
|
|
47
|
-
// Loading state
|
|
48
|
-
const [loading, setLoading] = useState(true);
|
|
49
|
-
|
|
50
|
-
// Store patients list
|
|
51
|
-
const [information, setInformation] = useState([]);
|
|
52
|
-
|
|
53
|
-
// Store selected patients
|
|
54
|
-
const [selectedInformation, setSelectedInformation] = useState([]);
|
|
55
|
-
|
|
56
|
-
// Retrieve global context data
|
|
57
|
-
const { CustomModels = {} } = useContext(GlobalContext);
|
|
58
|
-
|
|
59
|
-
const [titleContents, setTitleContents] = useState([]);
|
|
60
|
-
|
|
61
|
-
/** Next step */
|
|
62
|
-
const next = () => {
|
|
63
|
-
setCurrentStep(currentStep + 1);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/** Previous step*/
|
|
67
|
-
function prev() {
|
|
68
|
-
//If currentstage is 2, beacuse we don't need setSelectedPatients there
|
|
69
|
-
if (currentStep === 2) {
|
|
70
|
-
// Clear selected patients when going back from step 2
|
|
71
|
-
setSelectedInformation([]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
setCurrentStep(currentStep - 1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Fetch patient details when the component mountsGo back to the previous step
|
|
79
|
-
*/
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
/**Get information */
|
|
82
|
-
getInformation();
|
|
83
|
-
}, []);
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Function to fetch patient details from the backend
|
|
87
|
-
*/
|
|
88
|
-
const getInformation = async () => {
|
|
89
|
-
//CoreScript Id
|
|
90
|
-
let id = reportId.selectId;
|
|
91
|
-
|
|
92
|
-
//Getting records from coreScripts corresponding to the id
|
|
93
|
-
CoreScripts.getRecord({ id }).then(({ result }) => {
|
|
94
|
-
// Prepare input parameters for the form
|
|
95
|
-
prepareInputParameters(result.input_parameters);
|
|
96
|
-
|
|
97
|
-
// Set details from the fetched data
|
|
98
|
-
setdisplayColumns(JSON.parse(result.display_columns));
|
|
99
|
-
|
|
100
|
-
/**Fetching data from otherdetails */
|
|
101
|
-
let otherDetails = JSON.parse(result.other_details1);
|
|
102
|
-
|
|
103
|
-
/**Setting title datas */
|
|
104
|
-
setTitleData(otherDetails);
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Prepare input parameters for the form
|
|
110
|
-
* @param {object} inputParameters
|
|
111
|
-
*/
|
|
112
|
-
const prepareInputParameters = async (inputParameters) => {
|
|
113
|
-
setLoading(true);
|
|
114
|
-
|
|
115
|
-
// Parse input parameters
|
|
116
|
-
let parameters = JSON.parse(inputParameters);
|
|
117
|
-
|
|
118
|
-
// Map and set form content based on parameters and URL params
|
|
119
|
-
parameters = await parameters.map((record) => {
|
|
120
|
-
if (['reference-select', 'reference-search'].indexOf(record.type) !== -1) {
|
|
121
|
-
/**Get custom model based on the model name */
|
|
122
|
-
let model = CustomModels[record.modelName];
|
|
123
|
-
|
|
124
|
-
return { ...record, model };
|
|
125
|
-
} else {
|
|
126
|
-
return { ...record };
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
setLoading(false);
|
|
131
|
-
|
|
132
|
-
// Set details with prepared parameters
|
|
133
|
-
setParameterData([...parameters]);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Handle form submission
|
|
138
|
-
* @param {Object} values
|
|
139
|
-
*/
|
|
140
|
-
const handleFormSubmit = async (values) => {
|
|
141
|
-
//ID
|
|
142
|
-
let id;
|
|
143
|
-
|
|
144
|
-
//Formbody
|
|
145
|
-
let formBody;
|
|
146
|
-
|
|
147
|
-
//If there is selectedPatients we need to update the patient details
|
|
148
|
-
if (currentStep === 2) {
|
|
149
|
-
//CoreScript Id for updation
|
|
150
|
-
id = reportId.editId;
|
|
151
|
-
|
|
152
|
-
//Defining formbody
|
|
153
|
-
formBody = {
|
|
154
|
-
body: {
|
|
155
|
-
// Values for replacing
|
|
156
|
-
values,
|
|
157
|
-
|
|
158
|
-
selectedData: selectedInformation,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
//Getting coreScript data for updation
|
|
163
|
-
await CoreScripts.getUserDetailsLisitng(id, formBody).then((result) => {
|
|
164
|
-
// let resultDetails = result;
|
|
165
|
-
|
|
166
|
-
//If there is data and message is suceess
|
|
167
|
-
if (result && result.message === 'sucess') {
|
|
168
|
-
// Update information list
|
|
169
|
-
setInformation(result);
|
|
170
|
-
|
|
171
|
-
message.success(result.message);
|
|
172
|
-
|
|
173
|
-
// Clear selectedData and reset to the first step
|
|
174
|
-
setSelectedInformation([]);
|
|
175
|
-
|
|
176
|
-
//Setting step back to init
|
|
177
|
-
setCurrentStep(0);
|
|
178
|
-
} else {
|
|
179
|
-
message.warning(result.message);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
setLoading(false);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
/**Else */
|
|
187
|
-
}
|
|
188
|
-
} else {
|
|
189
|
-
/**If there is selectedInformation we need to update the patient details */
|
|
190
|
-
formBody = { body: values };
|
|
191
|
-
|
|
192
|
-
/**Id for getting coreScrpt data */
|
|
193
|
-
id = reportId.selectId;
|
|
194
|
-
|
|
195
|
-
//Getting coreScript data for getting
|
|
196
|
-
await CoreScripts.getReportingLisitng(id, formBody).then((result) => {
|
|
197
|
-
let resultDetails = result[0] || (result?.result && result?.result[0]);
|
|
198
|
-
|
|
199
|
-
if (resultDetails) {
|
|
200
|
-
// Update information list
|
|
201
|
-
setInformation(resultDetails);
|
|
202
|
-
|
|
203
|
-
// Proceed to the next step
|
|
204
|
-
next();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
setLoading(false);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
setLoading(true);
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
*
|
|
216
|
-
* @param {*} newTitleContents
|
|
217
|
-
*/
|
|
218
|
-
const handleTitleContentsUpdate = (newTitleContents) => {
|
|
219
|
-
setTitleContents(newTitleContents);
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Handle patient selection
|
|
225
|
-
* @param {Array} selected
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
*
|
|
230
|
-
* @param selected
|
|
231
|
-
*/
|
|
232
|
-
const handlePatientSelection = (selected) => {
|
|
233
|
-
// Update selected patients
|
|
234
|
-
setSelectedInformation(selected);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Render through each stages
|
|
239
|
-
*
|
|
240
|
-
* @param {number} step
|
|
241
|
-
* @returns {JSX.Element} The rendered component corresponding to the current step.
|
|
242
|
-
*/
|
|
243
|
-
const renderSwitch = (step) => {
|
|
244
|
-
switch (step) {
|
|
245
|
-
case 0:
|
|
246
|
-
return (
|
|
247
|
-
<InitialContent
|
|
248
|
-
selectedInformation={selectedInformation}
|
|
249
|
-
next={next}
|
|
250
|
-
prev={prev}
|
|
251
|
-
fields={paramterData}
|
|
252
|
-
selectedData={null}
|
|
253
|
-
currentStep={currentStep}
|
|
254
|
-
preferenceId={preferenceId}
|
|
255
|
-
titleData={titleData}
|
|
256
|
-
onSubmit={handleFormSubmit}
|
|
257
|
-
onTitleContentsUpdate={handleTitleContentsUpdate}
|
|
258
|
-
/>
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
case 1:
|
|
262
|
-
return <GuestDetails next={next} prev={prev} displayColumns={displayColumns} information={information} onSelect={handlePatientSelection} titleData={titleData} />;
|
|
263
|
-
|
|
264
|
-
case 2:
|
|
265
|
-
return (
|
|
266
|
-
<>
|
|
267
|
-
<div className="change-info-container">
|
|
268
|
-
<div className="change-infoheader">{titleContents && titleContents.heading ? titleContents.heading : 'Current information'}</div>
|
|
269
|
-
|
|
270
|
-
{/*Looping through selected data */}
|
|
271
|
-
{selectedInformation.map((patient, index) => (
|
|
272
|
-
<div key={index} className="info-items">
|
|
273
|
-
{/** Matching the selected data with the display columns */}
|
|
274
|
-
{displayColumns.map((detail, idx) => {
|
|
275
|
-
//Display columns fieild
|
|
276
|
-
const fieldName = detail.field;
|
|
277
|
-
|
|
278
|
-
//MAatchined values
|
|
279
|
-
const fieldValue = patient[fieldName];
|
|
280
|
-
|
|
281
|
-
return (
|
|
282
|
-
<div key={idx} className="info-field">
|
|
283
|
-
<span>{detail.title}:</span>
|
|
284
|
-
|
|
285
|
-
<span className="value">{fieldValue !== undefined ? fieldValue : 'N/A'}</span>
|
|
286
|
-
|
|
287
|
-
{/** Selected data */}
|
|
288
|
-
{patient.selected && <span className="selected">(selected)</span>}
|
|
289
|
-
</div>
|
|
290
|
-
);
|
|
291
|
-
})}
|
|
292
|
-
</div>
|
|
293
|
-
))}
|
|
294
|
-
|
|
295
|
-
</div>
|
|
296
|
-
<p>{titleContents?.notes}</p>
|
|
297
|
-
|
|
298
|
-
<p>{selectedInformation[0]?.message}</p>
|
|
299
|
-
<InitialContent
|
|
300
|
-
next={next}
|
|
301
|
-
prev={prev}
|
|
302
|
-
selectedInformation={selectedInformation}
|
|
303
|
-
fields={null}
|
|
304
|
-
currentStep={currentStep}
|
|
305
|
-
selectedData={selectedInformation}
|
|
306
|
-
onSubmit={handleFormSubmit}
|
|
307
|
-
preferenceId={preferenceId}
|
|
308
|
-
onTitleContentsUpdate={handleTitleContentsUpdate}
|
|
309
|
-
/>
|
|
310
|
-
</>
|
|
311
|
-
);
|
|
312
|
-
|
|
313
|
-
default:
|
|
314
|
-
return (
|
|
315
|
-
<InitialContent
|
|
316
|
-
selectedInformation={selectedInformation}
|
|
317
|
-
next={next}
|
|
318
|
-
fields={paramterData}
|
|
319
|
-
loading={loading}
|
|
320
|
-
currentStep={currentStep}
|
|
321
|
-
onSubmit={handleFormSubmit}
|
|
322
|
-
onTitleContentsUpdate={handleTitleContentsUpdate}
|
|
323
|
-
/>
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
return (
|
|
329
|
-
<Card className="change-profile-head">
|
|
330
|
-
|
|
331
|
-
<Card className="change-profile">
|
|
332
|
-
<Steps size="small" current={currentStep}>
|
|
333
|
-
<Step title="Enter" />
|
|
334
|
-
|
|
335
|
-
<Step title="Edit" />
|
|
336
|
-
|
|
337
|
-
<Step title="Select" />
|
|
338
|
-
</Steps>
|
|
339
|
-
</Card>
|
|
340
|
-
|
|
341
|
-
<FormContent renderSwitch={renderSwitch} currentStep={currentStep} />
|
|
342
|
-
</Card>
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// Define PropTypes for the component
|
|
347
|
-
ChangeInfo.propTypes = {
|
|
348
|
-
reportId: PropTypes.object,
|
|
349
|
-
preferenceId: PropTypes.number,
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
export default ChangeInfo;
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
*
|
|
356
|
-
* @param root0
|
|
357
|
-
* @param root0.renderSwitch
|
|
358
|
-
* @param root0.currentStep
|
|
359
|
-
* @returns {JSX.Element} JSX content
|
|
360
|
-
*/
|
|
361
|
-
function FormContent({ renderSwitch, currentStep }) {
|
|
362
|
-
return (
|
|
363
|
-
/* Rebder formConetent */
|
|
364
|
-
<Card className="formcreator card">{renderSwitch(currentStep)}</Card>
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
FormContent.propTypes = {
|
|
369
|
-
renderSwitch: PropTypes.func.isRequired,
|
|
370
|
-
currentStep: PropTypes.number,
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* @param {Object}root0
|
|
375
|
-
* @param root0.next
|
|
376
|
-
* @param root0.prev
|
|
377
|
-
* @param root0.fields
|
|
378
|
-
* @param root0.selectedInformation
|
|
379
|
-
* @param root0.titleData
|
|
380
|
-
* @param root0.onSubmit
|
|
381
|
-
* @param root0.selectedData
|
|
382
|
-
* @param root0.currentStep
|
|
383
|
-
* @param root0.preferenceId
|
|
384
|
-
* @param root0.onTitleContentsUpdate
|
|
385
|
-
* @returns {JSX.Element} JSX content
|
|
386
|
-
*/
|
|
387
|
-
function InitialContent({ selectedInformation, next, prev, fields, onSubmit, selectedData, currentStep, preferenceId, titleData, onTitleContentsUpdate }) {
|
|
388
|
-
/** @type {string} */
|
|
389
|
-
|
|
390
|
-
let formLayout = 'inline';
|
|
391
|
-
|
|
392
|
-
// Store preferences
|
|
393
|
-
const [preference, setPreference] = useState({});
|
|
394
|
-
|
|
395
|
-
const [titleContents, setTitleContents] = useState([]);
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Fetch patient details if selected data exists.
|
|
399
|
-
* @param {*}
|
|
400
|
-
* @returns {*}
|
|
401
|
-
*/
|
|
402
|
-
useEffect(() => {
|
|
403
|
-
/**Cheaking if there is selectedData */
|
|
404
|
-
if (selectedData && selectedData.length > 0) {
|
|
405
|
-
getPatientDetail();
|
|
406
|
-
}
|
|
407
|
-
}, []);
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Get details
|
|
411
|
-
*/
|
|
412
|
-
const getPatientDetail = async () => {
|
|
413
|
-
/** Defining preference id*/
|
|
414
|
-
let id = preferenceId;
|
|
415
|
-
|
|
416
|
-
Preferences.fillCustomInputData({ id }).then((result) => {
|
|
417
|
-
setPreference(result.fields);
|
|
418
|
-
|
|
419
|
-
setTitleContents(result)
|
|
420
|
-
|
|
421
|
-
// Update the parent with titleContents
|
|
422
|
-
if (onTitleContentsUpdate) {
|
|
423
|
-
onTitleContentsUpdate(result);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return result;
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
// Preferences.getRecord({ id }).then(({ result }) => {
|
|
430
|
-
// let data = JSON.parse(result.scope_value);
|
|
431
|
-
|
|
432
|
-
// setPreference(data.fields);
|
|
433
|
-
|
|
434
|
-
// return result;
|
|
435
|
-
// });
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Render the form based on the details or preferences fetched
|
|
440
|
-
*
|
|
441
|
-
* @returns
|
|
442
|
-
*/
|
|
443
|
-
const renderForm = () => {
|
|
444
|
-
if ((fields && fields.length > 0) || (preference && preference.length > 0)) {
|
|
445
|
-
return (
|
|
446
|
-
<FormCreator
|
|
447
|
-
selectedInformation={selectedInformation}
|
|
448
|
-
layout={formLayout}
|
|
449
|
-
initialValues={{ layout: formLayout }}
|
|
450
|
-
styles={{ paddingRight: '15px', alignItems: 'center' }}
|
|
451
|
-
fields={fields ? fields : preference}
|
|
452
|
-
modelIndex="requestId"
|
|
453
|
-
model={{ fields: fields ? fields : preference }}
|
|
454
|
-
onSubmit={onSubmit}
|
|
455
|
-
/>
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
return (
|
|
461
|
-
<div>
|
|
462
|
-
{/* We use this page for step 0 and 1 but we need this part only for 0 */}
|
|
463
|
-
{currentStep === 0 && titleData && (
|
|
464
|
-
<div>
|
|
465
|
-
<h4>{titleData.title}</h4>
|
|
466
|
-
|
|
467
|
-
<p>{titleData.description}</p>
|
|
468
|
-
|
|
469
|
-
<p>{titleData.message}</p>
|
|
470
|
-
</div>
|
|
471
|
-
)}
|
|
472
|
-
|
|
473
|
-
{renderForm()}
|
|
474
|
-
|
|
475
|
-
<div>
|
|
476
|
-
{/* We use this page for step 0 and 2 but we need bacck button all stages except 0 */}
|
|
477
|
-
{currentStep !== 0 && (
|
|
478
|
-
<Button type="default" onClick={prev} style={{ marginTop: '20px', marginRight: '10px' }}>
|
|
479
|
-
Back
|
|
480
|
-
</Button>
|
|
481
|
-
)}
|
|
482
|
-
|
|
483
|
-
{/* We use this page for step 0 and 2 but we need this part only for 2 */}
|
|
484
|
-
{currentStep === 1 && (
|
|
485
|
-
<Button type="primary" onClick={next} style={{ marginTop: '20px', marginLeft: '10px' }}>
|
|
486
|
-
Next
|
|
487
|
-
</Button>
|
|
488
|
-
)}
|
|
489
|
-
</div>
|
|
490
|
-
</div>
|
|
491
|
-
);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
InitialContent.propTypes = {
|
|
495
|
-
next: PropTypes.func.isRequired,
|
|
496
|
-
prev: PropTypes.func.isRequired,
|
|
497
|
-
fields: PropTypes.array,
|
|
498
|
-
onSubmit: PropTypes.func.isRequired,
|
|
499
|
-
selectedData: PropTypes.array,
|
|
500
|
-
selectedInformation: PropTypes.array.selectedInformation,
|
|
501
|
-
currentStep: PropTypes.number.isRequired,
|
|
502
|
-
preferenceId: PropTypes.number.isRequired,
|
|
503
|
-
titleData: PropTypes.shape({
|
|
504
|
-
title: PropTypes.title,
|
|
505
|
-
description: PropTypes.description,
|
|
506
|
-
message: PropTypes.message,
|
|
507
|
-
}),
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* Handles the step where users select patients
|
|
512
|
-
* @param root0
|
|
513
|
-
* @param root0.next
|
|
514
|
-
* @param root0.prev
|
|
515
|
-
* @param root0.information
|
|
516
|
-
* @param root0.onSelect
|
|
517
|
-
* @param root0.displayColumns
|
|
518
|
-
* @param root0.titleData
|
|
519
|
-
* @returns {JSX.Element} The rendered component corresponding to the data
|
|
520
|
-
* Render renderAdditionalInfo
|
|
521
|
-
*/
|
|
522
|
-
function GuestDetails({ next, prev, information, onSelect, displayColumns, titleData }) {
|
|
523
|
-
// Track selected patients
|
|
524
|
-
const [selectedInformation, setSelectedInformation] = useState([]);
|
|
525
|
-
|
|
526
|
-
// Track selected checkbox
|
|
527
|
-
const [selectedCheckbox, setSelectedCheckbox] = useState();
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
*
|
|
531
|
-
* @param {*} patient
|
|
532
|
-
* @param {*} isChecked
|
|
533
|
-
* @param {*} index
|
|
534
|
-
*/
|
|
535
|
-
const handleCheckboxChange = (patient, isChecked, index) => {
|
|
536
|
-
/**Cheaking if it is cheaked */
|
|
537
|
-
if (isChecked) {
|
|
538
|
-
// Set the selected checkbox by index
|
|
539
|
-
setSelectedCheckbox(index);
|
|
540
|
-
|
|
541
|
-
// Set the selectedInformation to only the current patient
|
|
542
|
-
setSelectedInformation([patient]);
|
|
543
|
-
|
|
544
|
-
// Trigger the onSelect function with the updated selection
|
|
545
|
-
onSelect([patient]);
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Render renderAdditionalInfo
|
|
551
|
-
* @param {Array} data
|
|
552
|
-
* @returns {object} displayColumns
|
|
553
|
-
*/
|
|
554
|
-
const renderAdditionalInfo = (data) => {
|
|
555
|
-
/* Matching selected data with the display columns */
|
|
556
|
-
return displayColumns.map((detail, index) => {
|
|
557
|
-
const fieldName = detail.field;
|
|
558
|
-
|
|
559
|
-
return (
|
|
560
|
-
<div key={index} className="selected-info-item">
|
|
561
|
-
<span className="selected-info-field">{detail.title}:</span>
|
|
562
|
-
|
|
563
|
-
<span className="selected-value">{data[fieldName] || 'N/A'}</span>
|
|
564
|
-
</div>
|
|
565
|
-
);
|
|
566
|
-
});
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
return (
|
|
570
|
-
<div className='middle-class'>
|
|
571
|
-
<div className='content'><h3>{titleData?.content}</h3></div>
|
|
572
|
-
<div>
|
|
573
|
-
{/* If the coreScript data contains data */}
|
|
574
|
-
{information && information.length > 0 ? (
|
|
575
|
-
information.map((data, index) => (
|
|
576
|
-
<Card className="change-info card" key={index} style={{ marginBottom: '10px' }}>
|
|
577
|
-
<div className="change-info-details">
|
|
578
|
-
<div className="change-info-patient-info">
|
|
579
|
-
<input
|
|
580
|
-
type="radio"
|
|
581
|
-
className="patient-radio"
|
|
582
|
-
checked={selectedCheckbox === index}
|
|
583
|
-
onChange={(e) => handleCheckboxChange(data, e.target.checked, index)}
|
|
584
|
-
/>
|
|
585
|
-
</div>
|
|
586
|
-
|
|
587
|
-
<div className="additional-info">{renderAdditionalInfo(data)}</div>
|
|
588
|
-
</div>
|
|
589
|
-
</Card>
|
|
590
|
-
))
|
|
591
|
-
) : (
|
|
592
|
-
<p>No patient data available</p>
|
|
593
|
-
)}
|
|
594
|
-
</div>
|
|
595
|
-
<Button type="default" onClick={prev}>
|
|
596
|
-
Back
|
|
597
|
-
</Button>
|
|
598
|
-
|
|
599
|
-
<Button
|
|
600
|
-
type="primary"
|
|
601
|
-
onClick={next}
|
|
602
|
-
style={{ marginTop: '20px', marginLeft: '10px' }}
|
|
603
|
-
// Disable button if no patients are selected
|
|
604
|
-
disabled={selectedInformation.length === 0}
|
|
605
|
-
>
|
|
606
|
-
Edit Details
|
|
607
|
-
</Button>
|
|
608
|
-
</div>
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
GuestDetails.propTypes = {
|
|
613
|
-
next: PropTypes.func.isRequired,
|
|
614
|
-
prev: PropTypes.func.isRequired,
|
|
615
|
-
onSelect: PropTypes.array,
|
|
616
|
-
displayColumns: PropTypes.object,
|
|
617
|
-
information: PropTypes.array,
|
|
618
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* @author Sneha
|
|
4
|
+
*
|
|
5
|
+
* The component used to change information
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React, { useState, useContext, useEffect } from 'react';
|
|
11
|
+
|
|
12
|
+
import { Steps, message } from 'antd';
|
|
13
|
+
|
|
14
|
+
import './change-info.scss';
|
|
15
|
+
|
|
16
|
+
import { GlobalContext, FormCreator, Card,Button } from '../../../lib';
|
|
17
|
+
|
|
18
|
+
import { CoreScripts, Preferences } from '../../../models';
|
|
19
|
+
|
|
20
|
+
import PropTypes from 'prop-types';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param root0
|
|
25
|
+
* @param root0.reportId
|
|
26
|
+
* @param root0.preferenceId
|
|
27
|
+
* @returns {*}
|
|
28
|
+
*/
|
|
29
|
+
function ChangeInfo({ reportId, preferenceId }) {
|
|
30
|
+
//Representing steps
|
|
31
|
+
|
|
32
|
+
// Track the curren //Representing steps
|
|
33
|
+
const { Step } = Steps;
|
|
34
|
+
|
|
35
|
+
// Track the current step in the process
|
|
36
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
37
|
+
|
|
38
|
+
// Store details returned by coreScript
|
|
39
|
+
const [paramterData, setParameterData] = useState([]);
|
|
40
|
+
|
|
41
|
+
// Store title
|
|
42
|
+
const [displayColumns, setdisplayColumns] = useState([]);
|
|
43
|
+
|
|
44
|
+
// Store titles
|
|
45
|
+
const [titleData, setTitleData] = useState();
|
|
46
|
+
|
|
47
|
+
// Loading state
|
|
48
|
+
const [loading, setLoading] = useState(true);
|
|
49
|
+
|
|
50
|
+
// Store patients list
|
|
51
|
+
const [information, setInformation] = useState([]);
|
|
52
|
+
|
|
53
|
+
// Store selected patients
|
|
54
|
+
const [selectedInformation, setSelectedInformation] = useState([]);
|
|
55
|
+
|
|
56
|
+
// Retrieve global context data
|
|
57
|
+
const { CustomModels = {} } = useContext(GlobalContext);
|
|
58
|
+
|
|
59
|
+
const [titleContents, setTitleContents] = useState([]);
|
|
60
|
+
|
|
61
|
+
/** Next step */
|
|
62
|
+
const next = () => {
|
|
63
|
+
setCurrentStep(currentStep + 1);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Previous step*/
|
|
67
|
+
function prev() {
|
|
68
|
+
//If currentstage is 2, beacuse we don't need setSelectedPatients there
|
|
69
|
+
if (currentStep === 2) {
|
|
70
|
+
// Clear selected patients when going back from step 2
|
|
71
|
+
setSelectedInformation([]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setCurrentStep(currentStep - 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Fetch patient details when the component mountsGo back to the previous step
|
|
79
|
+
*/
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
/**Get information */
|
|
82
|
+
getInformation();
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Function to fetch patient details from the backend
|
|
87
|
+
*/
|
|
88
|
+
const getInformation = async () => {
|
|
89
|
+
//CoreScript Id
|
|
90
|
+
let id = reportId.selectId;
|
|
91
|
+
|
|
92
|
+
//Getting records from coreScripts corresponding to the id
|
|
93
|
+
CoreScripts.getRecord({ id }).then(({ result }) => {
|
|
94
|
+
// Prepare input parameters for the form
|
|
95
|
+
prepareInputParameters(result.input_parameters);
|
|
96
|
+
|
|
97
|
+
// Set details from the fetched data
|
|
98
|
+
setdisplayColumns(JSON.parse(result.display_columns));
|
|
99
|
+
|
|
100
|
+
/**Fetching data from otherdetails */
|
|
101
|
+
let otherDetails = JSON.parse(result.other_details1);
|
|
102
|
+
|
|
103
|
+
/**Setting title datas */
|
|
104
|
+
setTitleData(otherDetails);
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Prepare input parameters for the form
|
|
110
|
+
* @param {object} inputParameters
|
|
111
|
+
*/
|
|
112
|
+
const prepareInputParameters = async (inputParameters) => {
|
|
113
|
+
setLoading(true);
|
|
114
|
+
|
|
115
|
+
// Parse input parameters
|
|
116
|
+
let parameters = JSON.parse(inputParameters);
|
|
117
|
+
|
|
118
|
+
// Map and set form content based on parameters and URL params
|
|
119
|
+
parameters = await parameters.map((record) => {
|
|
120
|
+
if (['reference-select', 'reference-search'].indexOf(record.type) !== -1) {
|
|
121
|
+
/**Get custom model based on the model name */
|
|
122
|
+
let model = CustomModels[record.modelName];
|
|
123
|
+
|
|
124
|
+
return { ...record, model };
|
|
125
|
+
} else {
|
|
126
|
+
return { ...record };
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
setLoading(false);
|
|
131
|
+
|
|
132
|
+
// Set details with prepared parameters
|
|
133
|
+
setParameterData([...parameters]);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Handle form submission
|
|
138
|
+
* @param {Object} values
|
|
139
|
+
*/
|
|
140
|
+
const handleFormSubmit = async (values) => {
|
|
141
|
+
//ID
|
|
142
|
+
let id;
|
|
143
|
+
|
|
144
|
+
//Formbody
|
|
145
|
+
let formBody;
|
|
146
|
+
|
|
147
|
+
//If there is selectedPatients we need to update the patient details
|
|
148
|
+
if (currentStep === 2) {
|
|
149
|
+
//CoreScript Id for updation
|
|
150
|
+
id = reportId.editId;
|
|
151
|
+
|
|
152
|
+
//Defining formbody
|
|
153
|
+
formBody = {
|
|
154
|
+
body: {
|
|
155
|
+
// Values for replacing
|
|
156
|
+
values,
|
|
157
|
+
|
|
158
|
+
selectedData: selectedInformation,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
//Getting coreScript data for updation
|
|
163
|
+
await CoreScripts.getUserDetailsLisitng(id, formBody).then((result) => {
|
|
164
|
+
// let resultDetails = result;
|
|
165
|
+
|
|
166
|
+
//If there is data and message is suceess
|
|
167
|
+
if (result && result.message === 'sucess') {
|
|
168
|
+
// Update information list
|
|
169
|
+
setInformation(result);
|
|
170
|
+
|
|
171
|
+
message.success(result.message);
|
|
172
|
+
|
|
173
|
+
// Clear selectedData and reset to the first step
|
|
174
|
+
setSelectedInformation([]);
|
|
175
|
+
|
|
176
|
+
//Setting step back to init
|
|
177
|
+
setCurrentStep(0);
|
|
178
|
+
} else {
|
|
179
|
+
message.warning(result.message);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
setLoading(false);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
{
|
|
186
|
+
/**Else */
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
/**If there is selectedInformation we need to update the patient details */
|
|
190
|
+
formBody = { body: values };
|
|
191
|
+
|
|
192
|
+
/**Id for getting coreScrpt data */
|
|
193
|
+
id = reportId.selectId;
|
|
194
|
+
|
|
195
|
+
//Getting coreScript data for getting
|
|
196
|
+
await CoreScripts.getReportingLisitng(id, formBody).then((result) => {
|
|
197
|
+
let resultDetails = result[0] || (result?.result && result?.result[0]);
|
|
198
|
+
|
|
199
|
+
if (resultDetails) {
|
|
200
|
+
// Update information list
|
|
201
|
+
setInformation(resultDetails);
|
|
202
|
+
|
|
203
|
+
// Proceed to the next step
|
|
204
|
+
next();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
setLoading(false);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
setLoading(true);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
*
|
|
216
|
+
* @param {*} newTitleContents
|
|
217
|
+
*/
|
|
218
|
+
const handleTitleContentsUpdate = (newTitleContents) => {
|
|
219
|
+
setTitleContents(newTitleContents);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Handle patient selection
|
|
225
|
+
* @param {Array} selected
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
*
|
|
230
|
+
* @param selected
|
|
231
|
+
*/
|
|
232
|
+
const handlePatientSelection = (selected) => {
|
|
233
|
+
// Update selected patients
|
|
234
|
+
setSelectedInformation(selected);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Render through each stages
|
|
239
|
+
*
|
|
240
|
+
* @param {number} step
|
|
241
|
+
* @returns {JSX.Element} The rendered component corresponding to the current step.
|
|
242
|
+
*/
|
|
243
|
+
const renderSwitch = (step) => {
|
|
244
|
+
switch (step) {
|
|
245
|
+
case 0:
|
|
246
|
+
return (
|
|
247
|
+
<InitialContent
|
|
248
|
+
selectedInformation={selectedInformation}
|
|
249
|
+
next={next}
|
|
250
|
+
prev={prev}
|
|
251
|
+
fields={paramterData}
|
|
252
|
+
selectedData={null}
|
|
253
|
+
currentStep={currentStep}
|
|
254
|
+
preferenceId={preferenceId}
|
|
255
|
+
titleData={titleData}
|
|
256
|
+
onSubmit={handleFormSubmit}
|
|
257
|
+
onTitleContentsUpdate={handleTitleContentsUpdate}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
case 1:
|
|
262
|
+
return <GuestDetails next={next} prev={prev} displayColumns={displayColumns} information={information} onSelect={handlePatientSelection} titleData={titleData} />;
|
|
263
|
+
|
|
264
|
+
case 2:
|
|
265
|
+
return (
|
|
266
|
+
<>
|
|
267
|
+
<div className="change-info-container">
|
|
268
|
+
<div className="change-infoheader">{titleContents && titleContents.heading ? titleContents.heading : 'Current information'}</div>
|
|
269
|
+
|
|
270
|
+
{/*Looping through selected data */}
|
|
271
|
+
{selectedInformation.map((patient, index) => (
|
|
272
|
+
<div key={index} className="info-items">
|
|
273
|
+
{/** Matching the selected data with the display columns */}
|
|
274
|
+
{displayColumns.map((detail, idx) => {
|
|
275
|
+
//Display columns fieild
|
|
276
|
+
const fieldName = detail.field;
|
|
277
|
+
|
|
278
|
+
//MAatchined values
|
|
279
|
+
const fieldValue = patient[fieldName];
|
|
280
|
+
|
|
281
|
+
return (
|
|
282
|
+
<div key={idx} className="info-field">
|
|
283
|
+
<span>{detail.title}:</span>
|
|
284
|
+
|
|
285
|
+
<span className="value">{fieldValue !== undefined ? fieldValue : 'N/A'}</span>
|
|
286
|
+
|
|
287
|
+
{/** Selected data */}
|
|
288
|
+
{patient.selected && <span className="selected">(selected)</span>}
|
|
289
|
+
</div>
|
|
290
|
+
);
|
|
291
|
+
})}
|
|
292
|
+
</div>
|
|
293
|
+
))}
|
|
294
|
+
|
|
295
|
+
</div>
|
|
296
|
+
<p>{titleContents?.notes}</p>
|
|
297
|
+
|
|
298
|
+
<p>{selectedInformation[0]?.message}</p>
|
|
299
|
+
<InitialContent
|
|
300
|
+
next={next}
|
|
301
|
+
prev={prev}
|
|
302
|
+
selectedInformation={selectedInformation}
|
|
303
|
+
fields={null}
|
|
304
|
+
currentStep={currentStep}
|
|
305
|
+
selectedData={selectedInformation}
|
|
306
|
+
onSubmit={handleFormSubmit}
|
|
307
|
+
preferenceId={preferenceId}
|
|
308
|
+
onTitleContentsUpdate={handleTitleContentsUpdate}
|
|
309
|
+
/>
|
|
310
|
+
</>
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
default:
|
|
314
|
+
return (
|
|
315
|
+
<InitialContent
|
|
316
|
+
selectedInformation={selectedInformation}
|
|
317
|
+
next={next}
|
|
318
|
+
fields={paramterData}
|
|
319
|
+
loading={loading}
|
|
320
|
+
currentStep={currentStep}
|
|
321
|
+
onSubmit={handleFormSubmit}
|
|
322
|
+
onTitleContentsUpdate={handleTitleContentsUpdate}
|
|
323
|
+
/>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
return (
|
|
329
|
+
<Card className="change-profile-head">
|
|
330
|
+
|
|
331
|
+
<Card className="change-profile">
|
|
332
|
+
<Steps size="small" current={currentStep}>
|
|
333
|
+
<Step title="Enter" />
|
|
334
|
+
|
|
335
|
+
<Step title="Edit" />
|
|
336
|
+
|
|
337
|
+
<Step title="Select" />
|
|
338
|
+
</Steps>
|
|
339
|
+
</Card>
|
|
340
|
+
|
|
341
|
+
<FormContent renderSwitch={renderSwitch} currentStep={currentStep} />
|
|
342
|
+
</Card>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Define PropTypes for the component
|
|
347
|
+
ChangeInfo.propTypes = {
|
|
348
|
+
reportId: PropTypes.object,
|
|
349
|
+
preferenceId: PropTypes.number,
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export default ChangeInfo;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
*
|
|
356
|
+
* @param root0
|
|
357
|
+
* @param root0.renderSwitch
|
|
358
|
+
* @param root0.currentStep
|
|
359
|
+
* @returns {JSX.Element} JSX content
|
|
360
|
+
*/
|
|
361
|
+
function FormContent({ renderSwitch, currentStep }) {
|
|
362
|
+
return (
|
|
363
|
+
/* Rebder formConetent */
|
|
364
|
+
<Card className="formcreator card">{renderSwitch(currentStep)}</Card>
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
FormContent.propTypes = {
|
|
369
|
+
renderSwitch: PropTypes.func.isRequired,
|
|
370
|
+
currentStep: PropTypes.number,
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @param {Object}root0
|
|
375
|
+
* @param root0.next
|
|
376
|
+
* @param root0.prev
|
|
377
|
+
* @param root0.fields
|
|
378
|
+
* @param root0.selectedInformation
|
|
379
|
+
* @param root0.titleData
|
|
380
|
+
* @param root0.onSubmit
|
|
381
|
+
* @param root0.selectedData
|
|
382
|
+
* @param root0.currentStep
|
|
383
|
+
* @param root0.preferenceId
|
|
384
|
+
* @param root0.onTitleContentsUpdate
|
|
385
|
+
* @returns {JSX.Element} JSX content
|
|
386
|
+
*/
|
|
387
|
+
function InitialContent({ selectedInformation, next, prev, fields, onSubmit, selectedData, currentStep, preferenceId, titleData, onTitleContentsUpdate }) {
|
|
388
|
+
/** @type {string} */
|
|
389
|
+
|
|
390
|
+
let formLayout = 'inline';
|
|
391
|
+
|
|
392
|
+
// Store preferences
|
|
393
|
+
const [preference, setPreference] = useState({});
|
|
394
|
+
|
|
395
|
+
const [titleContents, setTitleContents] = useState([]);
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Fetch patient details if selected data exists.
|
|
399
|
+
* @param {*}
|
|
400
|
+
* @returns {*}
|
|
401
|
+
*/
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
/**Cheaking if there is selectedData */
|
|
404
|
+
if (selectedData && selectedData.length > 0) {
|
|
405
|
+
getPatientDetail();
|
|
406
|
+
}
|
|
407
|
+
}, []);
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Get details
|
|
411
|
+
*/
|
|
412
|
+
const getPatientDetail = async () => {
|
|
413
|
+
/** Defining preference id*/
|
|
414
|
+
let id = preferenceId;
|
|
415
|
+
|
|
416
|
+
Preferences.fillCustomInputData({ id }).then((result) => {
|
|
417
|
+
setPreference(result.fields);
|
|
418
|
+
|
|
419
|
+
setTitleContents(result)
|
|
420
|
+
|
|
421
|
+
// Update the parent with titleContents
|
|
422
|
+
if (onTitleContentsUpdate) {
|
|
423
|
+
onTitleContentsUpdate(result);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return result;
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// Preferences.getRecord({ id }).then(({ result }) => {
|
|
430
|
+
// let data = JSON.parse(result.scope_value);
|
|
431
|
+
|
|
432
|
+
// setPreference(data.fields);
|
|
433
|
+
|
|
434
|
+
// return result;
|
|
435
|
+
// });
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Render the form based on the details or preferences fetched
|
|
440
|
+
*
|
|
441
|
+
* @returns
|
|
442
|
+
*/
|
|
443
|
+
const renderForm = () => {
|
|
444
|
+
if ((fields && fields.length > 0) || (preference && preference.length > 0)) {
|
|
445
|
+
return (
|
|
446
|
+
<FormCreator
|
|
447
|
+
selectedInformation={selectedInformation}
|
|
448
|
+
layout={formLayout}
|
|
449
|
+
initialValues={{ layout: formLayout }}
|
|
450
|
+
styles={{ paddingRight: '15px', alignItems: 'center' }}
|
|
451
|
+
fields={fields ? fields : preference}
|
|
452
|
+
modelIndex="requestId"
|
|
453
|
+
model={{ fields: fields ? fields : preference }}
|
|
454
|
+
onSubmit={onSubmit}
|
|
455
|
+
/>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
return (
|
|
461
|
+
<div>
|
|
462
|
+
{/* We use this page for step 0 and 1 but we need this part only for 0 */}
|
|
463
|
+
{currentStep === 0 && titleData && (
|
|
464
|
+
<div>
|
|
465
|
+
<h4>{titleData.title}</h4>
|
|
466
|
+
|
|
467
|
+
<p>{titleData.description}</p>
|
|
468
|
+
|
|
469
|
+
<p>{titleData.message}</p>
|
|
470
|
+
</div>
|
|
471
|
+
)}
|
|
472
|
+
|
|
473
|
+
{renderForm()}
|
|
474
|
+
|
|
475
|
+
<div>
|
|
476
|
+
{/* We use this page for step 0 and 2 but we need bacck button all stages except 0 */}
|
|
477
|
+
{currentStep !== 0 && (
|
|
478
|
+
<Button type="default" onClick={prev} style={{ marginTop: '20px', marginRight: '10px' }}>
|
|
479
|
+
Back
|
|
480
|
+
</Button>
|
|
481
|
+
)}
|
|
482
|
+
|
|
483
|
+
{/* We use this page for step 0 and 2 but we need this part only for 2 */}
|
|
484
|
+
{currentStep === 1 && (
|
|
485
|
+
<Button type="primary" onClick={next} style={{ marginTop: '20px', marginLeft: '10px' }}>
|
|
486
|
+
Next
|
|
487
|
+
</Button>
|
|
488
|
+
)}
|
|
489
|
+
</div>
|
|
490
|
+
</div>
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
InitialContent.propTypes = {
|
|
495
|
+
next: PropTypes.func.isRequired,
|
|
496
|
+
prev: PropTypes.func.isRequired,
|
|
497
|
+
fields: PropTypes.array,
|
|
498
|
+
onSubmit: PropTypes.func.isRequired,
|
|
499
|
+
selectedData: PropTypes.array,
|
|
500
|
+
selectedInformation: PropTypes.array.selectedInformation,
|
|
501
|
+
currentStep: PropTypes.number.isRequired,
|
|
502
|
+
preferenceId: PropTypes.number.isRequired,
|
|
503
|
+
titleData: PropTypes.shape({
|
|
504
|
+
title: PropTypes.title,
|
|
505
|
+
description: PropTypes.description,
|
|
506
|
+
message: PropTypes.message,
|
|
507
|
+
}),
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Handles the step where users select patients
|
|
512
|
+
* @param root0
|
|
513
|
+
* @param root0.next
|
|
514
|
+
* @param root0.prev
|
|
515
|
+
* @param root0.information
|
|
516
|
+
* @param root0.onSelect
|
|
517
|
+
* @param root0.displayColumns
|
|
518
|
+
* @param root0.titleData
|
|
519
|
+
* @returns {JSX.Element} The rendered component corresponding to the data
|
|
520
|
+
* Render renderAdditionalInfo
|
|
521
|
+
*/
|
|
522
|
+
function GuestDetails({ next, prev, information, onSelect, displayColumns, titleData }) {
|
|
523
|
+
// Track selected patients
|
|
524
|
+
const [selectedInformation, setSelectedInformation] = useState([]);
|
|
525
|
+
|
|
526
|
+
// Track selected checkbox
|
|
527
|
+
const [selectedCheckbox, setSelectedCheckbox] = useState();
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
*
|
|
531
|
+
* @param {*} patient
|
|
532
|
+
* @param {*} isChecked
|
|
533
|
+
* @param {*} index
|
|
534
|
+
*/
|
|
535
|
+
const handleCheckboxChange = (patient, isChecked, index) => {
|
|
536
|
+
/**Cheaking if it is cheaked */
|
|
537
|
+
if (isChecked) {
|
|
538
|
+
// Set the selected checkbox by index
|
|
539
|
+
setSelectedCheckbox(index);
|
|
540
|
+
|
|
541
|
+
// Set the selectedInformation to only the current patient
|
|
542
|
+
setSelectedInformation([patient]);
|
|
543
|
+
|
|
544
|
+
// Trigger the onSelect function with the updated selection
|
|
545
|
+
onSelect([patient]);
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Render renderAdditionalInfo
|
|
551
|
+
* @param {Array} data
|
|
552
|
+
* @returns {object} displayColumns
|
|
553
|
+
*/
|
|
554
|
+
const renderAdditionalInfo = (data) => {
|
|
555
|
+
/* Matching selected data with the display columns */
|
|
556
|
+
return displayColumns.map((detail, index) => {
|
|
557
|
+
const fieldName = detail.field;
|
|
558
|
+
|
|
559
|
+
return (
|
|
560
|
+
<div key={index} className="selected-info-item">
|
|
561
|
+
<span className="selected-info-field">{detail.title}:</span>
|
|
562
|
+
|
|
563
|
+
<span className="selected-value">{data[fieldName] || 'N/A'}</span>
|
|
564
|
+
</div>
|
|
565
|
+
);
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
return (
|
|
570
|
+
<div className='middle-class'>
|
|
571
|
+
<div className='content'><h3>{titleData?.content}</h3></div>
|
|
572
|
+
<div>
|
|
573
|
+
{/* If the coreScript data contains data */}
|
|
574
|
+
{information && information.length > 0 ? (
|
|
575
|
+
information.map((data, index) => (
|
|
576
|
+
<Card className="change-info card" key={index} style={{ marginBottom: '10px' }}>
|
|
577
|
+
<div className="change-info-details">
|
|
578
|
+
<div className="change-info-patient-info">
|
|
579
|
+
<input
|
|
580
|
+
type="radio"
|
|
581
|
+
className="patient-radio"
|
|
582
|
+
checked={selectedCheckbox === index}
|
|
583
|
+
onChange={(e) => handleCheckboxChange(data, e.target.checked, index)}
|
|
584
|
+
/>
|
|
585
|
+
</div>
|
|
586
|
+
|
|
587
|
+
<div className="additional-info">{renderAdditionalInfo(data)}</div>
|
|
588
|
+
</div>
|
|
589
|
+
</Card>
|
|
590
|
+
))
|
|
591
|
+
) : (
|
|
592
|
+
<p>No patient data available</p>
|
|
593
|
+
)}
|
|
594
|
+
</div>
|
|
595
|
+
<Button type="default" onClick={prev}>
|
|
596
|
+
Back
|
|
597
|
+
</Button>
|
|
598
|
+
|
|
599
|
+
<Button
|
|
600
|
+
type="primary"
|
|
601
|
+
onClick={next}
|
|
602
|
+
style={{ marginTop: '20px', marginLeft: '10px' }}
|
|
603
|
+
// Disable button if no patients are selected
|
|
604
|
+
disabled={selectedInformation.length === 0}
|
|
605
|
+
>
|
|
606
|
+
Edit Details
|
|
607
|
+
</Button>
|
|
608
|
+
</div>
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
GuestDetails.propTypes = {
|
|
613
|
+
next: PropTypes.func.isRequired,
|
|
614
|
+
prev: PropTypes.func.isRequired,
|
|
615
|
+
onSelect: PropTypes.array,
|
|
616
|
+
displayColumns: PropTypes.object,
|
|
617
|
+
information: PropTypes.array,
|
|
618
|
+
};
|