vc-create-dashboard 3.0.84 → 3.0.85
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/esm2022/lib/configurations.mjs +7 -0
- package/esm2022/lib/create-dashboard-container/categories/categories-config.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/categories/categories.component.mjs +212 -0
- package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.mjs +350 -0
- package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets/widget.interface.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets.module.mjs +47 -0
- package/esm2022/lib/create-dashboard-container/constants/assets.constant.mjs +37 -0
- package/esm2022/lib/create-dashboard-container/create-dashboard-config.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/create-dashboard.component.mjs +1601 -0
- package/esm2022/lib/create-dashboard-container/create-dashboard.module.mjs +127 -0
- package/esm2022/lib/create-dashboard-container/directives/directives.module.mjs +24 -0
- package/esm2022/lib/create-dashboard-container/directives/scroll-in-view.directive.mjs +36 -0
- package/esm2022/lib/create-dashboard-container/form-group/form-group.component.mjs +153 -0
- package/esm2022/lib/create-dashboard-container/frequency/frequency.component.mjs +309 -0
- package/esm2022/lib/create-dashboard-container/interfaces/widget-data-model.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/pipes/filter.pipe.mjs +30 -0
- package/esm2022/lib/create-dashboard-container/pipes/search-program.pipe.mjs +37 -0
- package/esm2022/lib/create-dashboard-container/pipes/search.pipe.mjs +25 -0
- package/esm2022/lib/create-dashboard-container/pipes/text-count.pipe.mjs +18 -0
- package/esm2022/lib/create-dashboard-container/program-list/constant.mjs +31 -0
- package/esm2022/lib/create-dashboard-container/program-list/information-block/information-block.component.mjs +13 -0
- package/esm2022/lib/create-dashboard-container/program-list/interfaces/list-item.interface.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/program-list/list-container/list-container.component.mjs +50 -0
- package/esm2022/lib/create-dashboard-container/program-list/pipes/check-selected-items.pipes.mjs +23 -0
- package/esm2022/lib/create-dashboard-container/program-list/program-list/program-list.component.mjs +294 -0
- package/esm2022/lib/create-dashboard-container/program-list/program-list.module.mjs +60 -0
- package/esm2022/lib/create-dashboard-container/program-list/services/list-utils.service.mjs +27 -0
- package/esm2022/lib/create-dashboard-container/program-list/services/program-list-api.service.mjs +28 -0
- package/esm2022/lib/create-dashboard-container/responsibility-center/responsibility-center.component.mjs +224 -0
- package/esm2022/lib/create-dashboard-container/risk-categories/risk-categories-config.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/risk-categories/risk-categories.component.mjs +206 -0
- package/esm2022/lib/create-dashboard-container/services/configure-widgets.service.mjs +233 -0
- package/esm2022/lib/create-dashboard-container/services/create-dashboard.service.mjs +227 -0
- package/esm2022/lib/create-dashboard-container/services/pagination.service.mjs +28 -0
- package/esm2022/lib/create-dashboard-container/user-list/user-list.component.mjs +440 -0
- package/esm2022/lib/create-dashboard-container/user-list/user-list.config.mjs +2 -0
- package/esm2022/lib/create-dashboard-container/utils/dashboard-edit.utils.mjs +181 -0
- package/esm2022/lib/create-dashboard.service.mjs +14 -0
- package/esm2022/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.mjs +52 -0
- package/esm2022/lib/ui-kit/dashboard-footer/dashboard-footer-config.mjs +2 -0
- package/esm2022/lib/ui-kit/dashboard-footer/dashboard-footer.module.mjs +32 -0
- package/esm2022/lib/ui-kit/dialog/dialog-config.mjs +7 -0
- package/esm2022/lib/ui-kit/dialog/dialog-injector.mjs +17 -0
- package/esm2022/lib/ui-kit/dialog/dialog-ref.mjs +11 -0
- package/esm2022/lib/ui-kit/dialog/dialog.component.mjs +96 -0
- package/esm2022/lib/ui-kit/dialog/dialog.module.mjs +20 -0
- package/esm2022/lib/ui-kit/dialog/dialog.service.mjs +56 -0
- package/esm2022/lib/ui-kit/dialog/insertion.directive.mjs +17 -0
- package/esm2022/lib/ui-kit/floating-bar/floating-bar.component.mjs +57 -0
- package/esm2022/lib/ui-kit/floating-bar/floating-bar.module.mjs +32 -0
- package/esm2022/lib/ui-kit/formgroup/click-outside.directive.mjs +30 -0
- package/esm2022/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.mjs +29 -0
- package/esm2022/lib/ui-kit/formgroup/cs-radio/cs-radio.component.mjs +34 -0
- package/esm2022/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.mjs +14 -0
- package/esm2022/lib/ui-kit/formgroup/cs-select/cs-select.component.mjs +119 -0
- package/esm2022/lib/ui-kit/formgroup/cs-switch/cs-switch.component.mjs +39 -0
- package/esm2022/lib/ui-kit/formgroup/formgroup.module.mjs +55 -0
- package/esm2022/lib/ui-kit/formgroup/pipes/pascal.pipe.mjs +19 -0
- package/esm2022/lib/ui-kit/formgroup/pipes/searchMultiSelect.pipe.mjs +24 -0
- package/esm2022/lib/ui-kit/loaders/loaders.module.mjs +24 -0
- package/esm2022/lib/ui-kit/loaders/table-loader/table-loader.component.mjs +18 -0
- package/esm2022/lib/ui-kit/no-data/no-data.component.mjs +47 -0
- package/esm2022/lib/ui-kit/no-data/no-data.module.mjs +18 -0
- package/esm2022/lib/ui-kit/pagination/pagination.component.mjs +130 -0
- package/esm2022/lib/ui-kit/pagination/pagination.module.mjs +18 -0
- package/esm2022/lib/ui-kit/popover/popover.component.mjs +129 -0
- package/esm2022/lib/ui-kit/popover/popover.directive.mjs +93 -0
- package/esm2022/lib/ui-kit/popover/popover.module.mjs +21 -0
- package/esm2022/lib/ui-kit/popover/popover.service.mjs +23 -0
- package/esm2022/lib/ui-kit/select/cs-option/cs-option.component.mjs +41 -0
- package/esm2022/lib/ui-kit/select/cs-select/cs-select.component.mjs +107 -0
- package/esm2022/lib/ui-kit/select/safe-html.pipe.mjs +21 -0
- package/esm2022/lib/ui-kit/select/select.module.mjs +21 -0
- package/esm2022/lib/ui-kit/services/cs-select.service.mjs +16 -0
- package/esm2022/lib/ui-kit/smiley-dialog/smiley-dialog.component.mjs +52 -0
- package/esm2022/lib/ui-kit/smiley-dialog/smiley-dialog.module.mjs +18 -0
- package/esm2022/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.mjs +46 -0
- package/esm2022/lib/ui-kit/snack-bar/snack-bar.module.mjs +18 -0
- package/esm2022/lib/ui-kit/snack-bar/snack-bar.service.mjs +23 -0
- package/esm2022/lib/ui-kit/tooltip/tooltip.directive.mjs +168 -0
- package/esm2022/lib/ui-kit/tooltip/tooltip.module.mjs +18 -0
- package/esm2022/lib/ui-kit/v-loader/loader/loader.component.mjs +24 -0
- package/esm2022/lib/ui-kit/v-loader/loader-inline/loader-inline.component.mjs +24 -0
- package/esm2022/lib/ui-kit/v-loader/v-loader.module.mjs +19 -0
- package/esm2022/public-api.mjs +10 -0
- package/esm2022/vc-create-dashboard.mjs +5 -0
- package/fesm2022/vc-create-dashboard.mjs +6616 -0
- package/fesm2022/vc-create-dashboard.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/configurations.d.ts +4 -0
- package/lib/create-dashboard-container/categories/categories-config.d.ts +18 -0
- package/lib/create-dashboard-container/categories/categories.component.d.ts +66 -0
- package/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.d.ts +113 -0
- package/lib/create-dashboard-container/configure-widgets/configure-widgets/widget.interface.d.ts +9 -0
- package/lib/create-dashboard-container/configure-widgets/configure-widgets.module.d.ts +14 -0
- package/lib/create-dashboard-container/constants/assets.constant.d.ts +35 -0
- package/lib/create-dashboard-container/create-dashboard-config.d.ts +18 -0
- package/lib/create-dashboard-container/create-dashboard.component.d.ts +219 -0
- package/lib/create-dashboard-container/create-dashboard.module.d.ts +37 -0
- package/lib/create-dashboard-container/directives/directives.module.d.ts +8 -0
- package/lib/create-dashboard-container/directives/scroll-in-view.directive.d.ts +12 -0
- package/lib/create-dashboard-container/form-group/form-group.component.d.ts +48 -0
- package/lib/create-dashboard-container/frequency/frequency.component.d.ts +39 -0
- package/{src/lib/create-dashboard-container/interfaces/widget-data-model.ts → lib/create-dashboard-container/interfaces/widget-data-model.d.ts} +1 -1
- package/lib/create-dashboard-container/pipes/filter.pipe.d.ts +7 -0
- package/lib/create-dashboard-container/pipes/search-program.pipe.d.ts +7 -0
- package/lib/create-dashboard-container/pipes/search.pipe.d.ts +7 -0
- package/lib/create-dashboard-container/pipes/text-count.pipe.d.ts +7 -0
- package/lib/create-dashboard-container/program-list/constant.d.ts +24 -0
- package/lib/create-dashboard-container/program-list/information-block/information-block.component.d.ts +6 -0
- package/lib/create-dashboard-container/program-list/interfaces/list-item.interface.d.ts +5 -0
- package/lib/create-dashboard-container/program-list/list-container/list-container.component.d.ts +9 -0
- package/lib/create-dashboard-container/program-list/pipes/check-selected-items.pipes.d.ts +7 -0
- package/lib/create-dashboard-container/program-list/program-list/program-list.component.d.ts +119 -0
- package/lib/create-dashboard-container/program-list/program-list.module.d.ts +17 -0
- package/lib/create-dashboard-container/program-list/services/list-utils.service.d.ts +7 -0
- package/lib/create-dashboard-container/program-list/services/program-list-api.service.d.ts +12 -0
- package/lib/create-dashboard-container/responsibility-center/responsibility-center.component.d.ts +70 -0
- package/lib/create-dashboard-container/risk-categories/risk-categories-config.d.ts +18 -0
- package/lib/create-dashboard-container/risk-categories/risk-categories.component.d.ts +66 -0
- package/lib/create-dashboard-container/services/configure-widgets.service.d.ts +21 -0
- package/lib/create-dashboard-container/services/create-dashboard.service.d.ts +80 -0
- package/lib/create-dashboard-container/services/pagination.service.d.ts +12 -0
- package/lib/create-dashboard-container/user-list/user-list.component.d.ts +123 -0
- package/{src/lib/create-dashboard-container/user-list/user-list.config.ts → lib/create-dashboard-container/user-list/user-list.config.d.ts} +6 -6
- package/lib/create-dashboard-container/utils/dashboard-edit.utils.d.ts +16 -0
- package/lib/create-dashboard.service.d.ts +6 -0
- package/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.d.ts +17 -0
- package/lib/ui-kit/dashboard-footer/dashboard-footer-config.d.ts +11 -0
- package/lib/ui-kit/dashboard-footer/dashboard-footer.module.d.ts +10 -0
- package/lib/ui-kit/dialog/dialog-config.d.ts +6 -0
- package/lib/ui-kit/dialog/dialog-injector.d.ts +7 -0
- package/lib/ui-kit/dialog/dialog-ref.d.ts +7 -0
- package/lib/ui-kit/dialog/dialog.component.d.ts +33 -0
- package/lib/ui-kit/dialog/dialog.module.d.ts +9 -0
- package/lib/ui-kit/dialog/dialog.service.d.ts +17 -0
- package/lib/ui-kit/dialog/insertion.directive.d.ts +8 -0
- package/lib/ui-kit/floating-bar/floating-bar.component.d.ts +20 -0
- package/lib/ui-kit/floating-bar/floating-bar.module.d.ts +10 -0
- package/lib/ui-kit/formgroup/click-outside.directive.d.ts +10 -0
- package/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.d.ts +13 -0
- package/lib/ui-kit/formgroup/cs-radio/cs-radio.component.d.ts +15 -0
- package/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.d.ts +8 -0
- package/lib/ui-kit/formgroup/cs-select/cs-select.component.d.ts +36 -0
- package/lib/ui-kit/formgroup/cs-switch/cs-switch.component.d.ts +15 -0
- package/lib/ui-kit/formgroup/formgroup.module.d.ts +17 -0
- package/lib/ui-kit/formgroup/pipes/pascal.pipe.d.ts +7 -0
- package/lib/ui-kit/formgroup/pipes/searchMultiSelect.pipe.d.ts +7 -0
- package/lib/ui-kit/loaders/loaders.module.d.ts +8 -0
- package/lib/ui-kit/loaders/table-loader/table-loader.component.d.ts +9 -0
- package/lib/ui-kit/no-data/no-data.component.d.ts +19 -0
- package/lib/ui-kit/no-data/no-data.module.d.ts +8 -0
- package/lib/ui-kit/pagination/pagination.component.d.ts +21 -0
- package/lib/ui-kit/pagination/pagination.module.d.ts +8 -0
- package/lib/ui-kit/popover/popover.component.d.ts +28 -0
- package/lib/ui-kit/popover/popover.directive.d.ts +17 -0
- package/lib/ui-kit/popover/popover.module.d.ts +9 -0
- package/lib/ui-kit/popover/popover.service.d.ts +13 -0
- package/lib/ui-kit/select/cs-option/cs-option.component.d.ts +16 -0
- package/lib/ui-kit/select/cs-select/cs-select.component.d.ts +32 -0
- package/lib/ui-kit/select/safe-html.pipe.d.ts +10 -0
- package/lib/ui-kit/select/select.module.d.ts +11 -0
- package/lib/ui-kit/services/cs-select.service.d.ts +7 -0
- package/lib/ui-kit/smiley-dialog/smiley-dialog.component.d.ts +17 -0
- package/lib/ui-kit/smiley-dialog/smiley-dialog.module.d.ts +8 -0
- package/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.d.ts +17 -0
- package/lib/ui-kit/snack-bar/snack-bar.module.d.ts +8 -0
- package/lib/ui-kit/snack-bar/snack-bar.service.d.ts +9 -0
- package/lib/ui-kit/tooltip/tooltip.directive.d.ts +28 -0
- package/lib/ui-kit/tooltip/tooltip.module.d.ts +8 -0
- package/lib/ui-kit/v-loader/loader/loader.component.d.ts +11 -0
- package/lib/ui-kit/v-loader/loader-inline/loader-inline.component.d.ts +11 -0
- package/lib/ui-kit/v-loader/v-loader.module.d.ts +9 -0
- package/package.json +25 -11
- package/public-api.d.ts +3 -0
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/categoryList.ts +0 -23
- package/src/lib/configurations.ts +0 -8
- package/src/lib/create-dashboard-container/categories/categories-config.ts +0 -18
- package/src/lib/create-dashboard-container/categories/categories.component.html +0 -150
- package/src/lib/create-dashboard-container/categories/categories.component.less +0 -252
- package/src/lib/create-dashboard-container/categories/categories.component.spec.ts +0 -43
- package/src/lib/create-dashboard-container/categories/categories.component.ts +0 -220
- package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.html +0 -141
- package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.less +0 -381
- package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.spec.ts +0 -48
- package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.ts +0 -392
- package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/widget.interface.ts +0 -9
- package/src/lib/create-dashboard-container/configure-widgets/configure-widgets.module.ts +0 -30
- package/src/lib/create-dashboard-container/constants/assets.constant.ts +0 -37
- package/src/lib/create-dashboard-container/create-dashboard-config.ts +0 -24
- package/src/lib/create-dashboard-container/create-dashboard-mockData.ts +0 -341
- package/src/lib/create-dashboard-container/create-dashboard.component.html +0 -660
- package/src/lib/create-dashboard-container/create-dashboard.component.less +0 -1579
- package/src/lib/create-dashboard-container/create-dashboard.component.ts +0 -1886
- package/src/lib/create-dashboard-container/create-dashboard.module.ts +0 -76
- package/src/lib/create-dashboard-container/directives/directives.module.ts +0 -18
- package/src/lib/create-dashboard-container/directives/scroll-in-view.directive.ts +0 -28
- package/src/lib/create-dashboard-container/form-group/form-group.component.html +0 -288
- package/src/lib/create-dashboard-container/form-group/form-group.component.less +0 -450
- package/src/lib/create-dashboard-container/form-group/form-group.component.spec.ts +0 -90
- package/src/lib/create-dashboard-container/form-group/form-group.component.ts +0 -163
- package/src/lib/create-dashboard-container/frequency/frequency.component.html +0 -61
- package/src/lib/create-dashboard-container/frequency/frequency.component.less +0 -183
- package/src/lib/create-dashboard-container/frequency/frequency.component.spec.ts +0 -120
- package/src/lib/create-dashboard-container/frequency/frequency.component.ts +0 -303
- package/src/lib/create-dashboard-container/pipes/filter.pipe.ts +0 -25
- package/src/lib/create-dashboard-container/pipes/search-program.pipe.ts +0 -31
- package/src/lib/create-dashboard-container/pipes/search.pipe.ts +0 -23
- package/src/lib/create-dashboard-container/pipes/text-count.pipe.spec.ts +0 -8
- package/src/lib/create-dashboard-container/pipes/text-count.pipe.ts +0 -14
- package/src/lib/create-dashboard-container/program-list/constant.ts +0 -36
- package/src/lib/create-dashboard-container/program-list/information-block/information-block.component.html +0 -9
- package/src/lib/create-dashboard-container/program-list/information-block/information-block.component.less +0 -63
- package/src/lib/create-dashboard-container/program-list/information-block/information-block.component.ts +0 -15
- package/src/lib/create-dashboard-container/program-list/interfaces/data-source.interface.ts +0 -6
- package/src/lib/create-dashboard-container/program-list/interfaces/list-item.interface.ts +0 -8
- package/src/lib/create-dashboard-container/program-list/interfaces/selection-predicate.interface.ts +0 -4
- package/src/lib/create-dashboard-container/program-list/list-container/list-container.component.less +0 -57
- package/src/lib/create-dashboard-container/program-list/list-container/list-container.component.ts +0 -30
- package/src/lib/create-dashboard-container/program-list/pipes/check-selected-items.pipes.ts +0 -19
- package/src/lib/create-dashboard-container/program-list/program-list/program-list.component.html +0 -158
- package/src/lib/create-dashboard-container/program-list/program-list/program-list.component.less +0 -679
- package/src/lib/create-dashboard-container/program-list/program-list/program-list.component.ts +0 -342
- package/src/lib/create-dashboard-container/program-list/program-list.module.ts +0 -36
- package/src/lib/create-dashboard-container/program-list/services/list-utils.service.ts +0 -22
- package/src/lib/create-dashboard-container/program-list/services/program-list-api.service.ts +0 -24
- package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.html +0 -70
- package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.less +0 -181
- package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.spec.ts +0 -41
- package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.ts +0 -154
- package/src/lib/create-dashboard-container/risk-categories/risk-categories-config.ts +0 -18
- package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.html +0 -152
- package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.less +0 -230
- package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.spec.ts +0 -39
- package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.ts +0 -209
- package/src/lib/create-dashboard-container/services/auth.service.ts +0 -27
- package/src/lib/create-dashboard-container/services/configure-widgets.service.spec.ts +0 -19
- package/src/lib/create-dashboard-container/services/configure-widgets.service.ts +0 -235
- package/src/lib/create-dashboard-container/services/create-dashboard.service.spec.ts +0 -19
- package/src/lib/create-dashboard-container/services/create-dashboard.service.ts +0 -287
- package/src/lib/create-dashboard-container/services/pagination.service.spec.ts +0 -16
- package/src/lib/create-dashboard-container/services/pagination.service.ts +0 -25
- package/src/lib/create-dashboard-container/services/urlConfig.service.ts +0 -21
- package/src/lib/create-dashboard-container/user-list/user-list.component.html +0 -358
- package/src/lib/create-dashboard-container/user-list/user-list.component.less +0 -451
- package/src/lib/create-dashboard-container/user-list/user-list.component.spec.ts +0 -153
- package/src/lib/create-dashboard-container/user-list/user-list.component.ts +0 -472
- package/src/lib/create-dashboard-container/utils/dashboard-edit.utils.ts +0 -235
- package/src/lib/create-dashboard.service.ts +0 -8
- package/src/lib/ui-kit/action-dialog/access-capability/access-capability.component.html +0 -22
- package/src/lib/ui-kit/action-dialog/access-capability/access-capability.component.less +0 -218
- package/src/lib/ui-kit/action-dialog/access-capability/access-capability.component.ts +0 -30
- package/src/lib/ui-kit/action-dialog/action-dialog.module.ts +0 -53
- package/src/lib/ui-kit/action-dialog/active/active.component.html +0 -25
- package/src/lib/ui-kit/action-dialog/active/active.component.less +0 -168
- package/src/lib/ui-kit/action-dialog/active/active.component.ts +0 -31
- package/src/lib/ui-kit/action-dialog/assesment-confirmation/assesment-confirmation.component.html +0 -18
- package/src/lib/ui-kit/action-dialog/assesment-confirmation/assesment-confirmation.component.less +0 -98
- package/src/lib/ui-kit/action-dialog/assesment-confirmation/assesment-confirmation.component.ts +0 -18
- package/src/lib/ui-kit/action-dialog/confirmation/confirmation.component.html +0 -20
- package/src/lib/ui-kit/action-dialog/confirmation/confirmation.component.less +0 -325
- package/src/lib/ui-kit/action-dialog/confirmation/confirmation.component.ts +0 -26
- package/src/lib/ui-kit/action-dialog/delete/delete.component.html +0 -24
- package/src/lib/ui-kit/action-dialog/delete/delete.component.less +0 -240
- package/src/lib/ui-kit/action-dialog/delete/delete.component.ts +0 -22
- package/src/lib/ui-kit/action-dialog/error/error.component.html +0 -20
- package/src/lib/ui-kit/action-dialog/error/error.component.less +0 -103
- package/src/lib/ui-kit/action-dialog/error/error.component.ts +0 -18
- package/src/lib/ui-kit/action-dialog/inactive/inactive.component.html +0 -25
- package/src/lib/ui-kit/action-dialog/inactive/inactive.component.less +0 -167
- package/src/lib/ui-kit/action-dialog/inactive/inactive.component.ts +0 -29
- package/src/lib/ui-kit/action-dialog/link/link.component.html +0 -57
- package/src/lib/ui-kit/action-dialog/link/link.component.less +0 -222
- package/src/lib/ui-kit/action-dialog/link/link.component.ts +0 -18
- package/src/lib/ui-kit/action-dialog/move/move.component.html +0 -43
- package/src/lib/ui-kit/action-dialog/move/move.component.less +0 -157
- package/src/lib/ui-kit/action-dialog/move/move.component.ts +0 -25
- package/src/lib/ui-kit/action-dialog/my-rating/my-rating.component.html +0 -19
- package/src/lib/ui-kit/action-dialog/my-rating/my-rating.component.less +0 -97
- package/src/lib/ui-kit/action-dialog/my-rating/my-rating.component.ts +0 -18
- package/src/lib/ui-kit/action-dialog/upload/upload.component.html +0 -19
- package/src/lib/ui-kit/action-dialog/upload/upload.component.less +0 -97
- package/src/lib/ui-kit/action-dialog/upload/upload.component.ts +0 -12
- package/src/lib/ui-kit/chart/bar/bar.component.html +0 -28
- package/src/lib/ui-kit/chart/bar/bar.component.less +0 -13
- package/src/lib/ui-kit/chart/bar/bar.component.ts +0 -44
- package/src/lib/ui-kit/chart/chart.module.ts +0 -12
- package/src/lib/ui-kit/chart/pipes/segmenter.pipe.ts +0 -28
- package/src/lib/ui-kit/chart/pipes/x-calculator.pipe.ts +0 -22
- package/src/lib/ui-kit/circle-progresss/circle/circle.component.html +0 -37
- package/src/lib/ui-kit/circle-progresss/circle/circle.component.less +0 -1448
- package/src/lib/ui-kit/circle-progresss/circle/circle.component.ts +0 -19
- package/src/lib/ui-kit/circle-progresss/circle-progresss.module.ts +0 -10
- package/src/lib/ui-kit/click-outside/click-outside.directive.ts +0 -16
- package/src/lib/ui-kit/click-outside/click-outside.module.ts +0 -16
- package/src/lib/ui-kit/color-palette/color-palette.component.html +0 -110
- package/src/lib/ui-kit/color-palette/color-palette.component.less +0 -54
- package/src/lib/ui-kit/color-palette/color-palette.component.ts +0 -28
- package/src/lib/ui-kit/color-palette/color-palette.module.ts +0 -10
- package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.html +0 -37
- package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.less +0 -335
- package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.spec.ts +0 -25
- package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.ts +0 -44
- package/src/lib/ui-kit/dashboard-footer/dashboard-footer-config.ts +0 -11
- package/src/lib/ui-kit/dashboard-footer/dashboard-footer.module.ts +0 -22
- package/src/lib/ui-kit/dialog/dialog-config.ts +0 -6
- package/src/lib/ui-kit/dialog/dialog-injector.ts +0 -18
- package/src/lib/ui-kit/dialog/dialog-ref.ts +0 -12
- package/src/lib/ui-kit/dialog/dialog.component.css +0 -89
- package/src/lib/ui-kit/dialog/dialog.component.html +0 -27
- package/src/lib/ui-kit/dialog/dialog.component.ts +0 -112
- package/src/lib/ui-kit/dialog/dialog.module.ts +0 -11
- package/src/lib/ui-kit/dialog/dialog.service.ts +0 -57
- package/src/lib/ui-kit/dialog/insertion.directive.ts +0 -8
- package/src/lib/ui-kit/floating-bar/floating-bar.component.html +0 -42
- package/src/lib/ui-kit/floating-bar/floating-bar.component.less +0 -355
- package/src/lib/ui-kit/floating-bar/floating-bar.component.spec.ts +0 -25
- package/src/lib/ui-kit/floating-bar/floating-bar.component.ts +0 -40
- package/src/lib/ui-kit/floating-bar/floating-bar.module.ts +0 -22
- package/src/lib/ui-kit/formgroup/click-outside.directive.ts +0 -16
- package/src/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.html +0 -11
- package/src/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.less +0 -102
- package/src/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.ts +0 -19
- package/src/lib/ui-kit/formgroup/cs-radio/cs-radio.component.html +0 -11
- package/src/lib/ui-kit/formgroup/cs-radio/cs-radio.component.less +0 -125
- package/src/lib/ui-kit/formgroup/cs-radio/cs-radio.component.ts +0 -21
- package/src/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.html +0 -4
- package/src/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.less +0 -0
- package/src/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.ts +0 -12
- package/src/lib/ui-kit/formgroup/cs-select/cs-select.component.html +0 -78
- package/src/lib/ui-kit/formgroup/cs-select/cs-select.component.less +0 -259
- package/src/lib/ui-kit/formgroup/cs-select/cs-select.component.ts +0 -92
- package/src/lib/ui-kit/formgroup/cs-switch/cs-switch.component.html +0 -30
- package/src/lib/ui-kit/formgroup/cs-switch/cs-switch.component.less +0 -103
- package/src/lib/ui-kit/formgroup/cs-switch/cs-switch.component.ts +0 -23
- package/src/lib/ui-kit/formgroup/formgroup.module.ts +0 -35
- package/src/lib/ui-kit/formgroup/pipes/pascal.pipe.ts +0 -13
- package/src/lib/ui-kit/formgroup/pipes/searchMultiSelect.pipe.ts +0 -18
- package/src/lib/ui-kit/line-loader/line-loader.component.html +0 -3
- package/src/lib/ui-kit/line-loader/line-loader.component.less +0 -34
- package/src/lib/ui-kit/line-loader/line-loader.component.ts +0 -14
- package/src/lib/ui-kit/line-loader/line-loader.module.ts +0 -10
- package/src/lib/ui-kit/loaders/loaders.module.ts +0 -18
- package/src/lib/ui-kit/loaders/table-loader/table-loader.component.html +0 -17
- package/src/lib/ui-kit/loaders/table-loader/table-loader.component.less +0 -136
- package/src/lib/ui-kit/loaders/table-loader/table-loader.component.ts +0 -17
- package/src/lib/ui-kit/longpress/longpress.directive.ts +0 -28
- package/src/lib/ui-kit/longpress/longpress.module.ts +0 -10
- package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.html +0 -51
- package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.less +0 -367
- package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.spec.ts +0 -24
- package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.ts +0 -141
- package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.html +0 -9
- package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.less +0 -105
- package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.spec.ts +0 -27
- package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.ts +0 -24
- package/src/lib/ui-kit/multi-select/multi-select.module.ts +0 -24
- package/src/lib/ui-kit/multi-select/multi-select.service.ts +0 -10
- package/src/lib/ui-kit/no-data/no-data.component.html +0 -14
- package/src/lib/ui-kit/no-data/no-data.component.less +0 -86
- package/src/lib/ui-kit/no-data/no-data.component.ts +0 -26
- package/src/lib/ui-kit/no-data/no-data.module.ts +0 -10
- package/src/lib/ui-kit/pagination/pagination.component.html +0 -11
- package/src/lib/ui-kit/pagination/pagination.component.less +0 -72
- package/src/lib/ui-kit/pagination/pagination.component.spec.ts +0 -25
- package/src/lib/ui-kit/pagination/pagination.component.ts +0 -138
- package/src/lib/ui-kit/pagination/pagination.module.ts +0 -10
- package/src/lib/ui-kit/pipes/pipes.module.ts +0 -10
- package/src/lib/ui-kit/pipes/safeHTML.pipe.ts +0 -12
- package/src/lib/ui-kit/pipes/trim.pipe.ts +0 -10
- package/src/lib/ui-kit/popover/popover.component.html +0 -6
- package/src/lib/ui-kit/popover/popover.component.less +0 -20
- package/src/lib/ui-kit/popover/popover.component.ts +0 -127
- package/src/lib/ui-kit/popover/popover.directive.ts +0 -72
- package/src/lib/ui-kit/popover/popover.module.ts +0 -13
- package/src/lib/ui-kit/popover/popover.service.ts +0 -17
- package/src/lib/ui-kit/ripple/ripple.directive.ts +0 -36
- package/src/lib/ui-kit/ripple/ripple.module.ts +0 -10
- package/src/lib/ui-kit/select/cs-option/cs-option.component.html +0 -8
- package/src/lib/ui-kit/select/cs-option/cs-option.component.less +0 -49
- package/src/lib/ui-kit/select/cs-option/cs-option.component.ts +0 -31
- package/src/lib/ui-kit/select/cs-select/cs-select.component.html +0 -16
- package/src/lib/ui-kit/select/cs-select/cs-select.component.less +0 -142
- package/src/lib/ui-kit/select/cs-select/cs-select.component.ts +0 -98
- package/src/lib/ui-kit/select/safe-html.pipe.ts +0 -13
- package/src/lib/ui-kit/select/select.module.ts +0 -13
- package/src/lib/ui-kit/services/cs-select.service.ts +0 -10
- package/src/lib/ui-kit/smiley-dialog/smiley-dialog.component.html +0 -30
- package/src/lib/ui-kit/smiley-dialog/smiley-dialog.component.less +0 -442
- package/src/lib/ui-kit/smiley-dialog/smiley-dialog.component.ts +0 -40
- package/src/lib/ui-kit/smiley-dialog/smiley-dialog.module.ts +0 -11
- package/src/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.html +0 -10
- package/src/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.less +0 -110
- package/src/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.ts +0 -42
- package/src/lib/ui-kit/snack-bar/snack-bar.module.ts +0 -10
- package/src/lib/ui-kit/snack-bar/snack-bar.service.ts +0 -18
- package/src/lib/ui-kit/time-filter/time-filter.component.html +0 -126
- package/src/lib/ui-kit/time-filter/time-filter.component.less +0 -482
- package/src/lib/ui-kit/time-filter/time-filter.component.ts +0 -284
- package/src/lib/ui-kit/time-filter/time-filter.module.ts +0 -10
- package/src/lib/ui-kit/tooltip/tooltip.directive.ts +0 -150
- package/src/lib/ui-kit/tooltip/tooltip.module.ts +0 -10
- package/src/lib/ui-kit/v-loader/loader/loader.component.html +0 -6
- package/src/lib/ui-kit/v-loader/loader/loader.component.less +0 -52
- package/src/lib/ui-kit/v-loader/loader/loader.component.ts +0 -22
- package/src/lib/ui-kit/v-loader/loader-inline/loader-inline.component.html +0 -6
- package/src/lib/ui-kit/v-loader/loader-inline/loader-inline.component.less +0 -52
- package/src/lib/ui-kit/v-loader/loader-inline/loader-inline.component.ts +0 -22
- package/src/lib/ui-kit/v-loader/v-loader.module.ts +0 -11
- package/src/public-api.ts +0 -11
- package/src/test.ts +0 -28
- package/tsconfig.lib.json +0 -20
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,1886 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectorRef,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
HostListener,
|
|
7
|
-
Input,
|
|
8
|
-
OnChanges,
|
|
9
|
-
OnInit,
|
|
10
|
-
Output,
|
|
11
|
-
SimpleChanges,
|
|
12
|
-
ViewChild,
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import { EditorConfig } from '@vcomply/editor';
|
|
15
|
-
import { DatePickerComponent, IDatePickerConfig } from 'ng2-date-picker';
|
|
16
|
-
import { CreateDashboardService } from './services/create-dashboard.service';
|
|
17
|
-
import { PaginationService } from './services/pagination.service';
|
|
18
|
-
import { UserListConfiguration } from './user-list/user-list.config';
|
|
19
|
-
import { CreateDashboardForm } from './create-dashboard-config';
|
|
20
|
-
import { SnackBarService } from '../ui-kit/snack-bar/snack-bar.service';
|
|
21
|
-
|
|
22
|
-
import dayjs from 'dayjs';
|
|
23
|
-
import { forkJoin, Observable } from 'rxjs';
|
|
24
|
-
import { finalize, map } from 'rxjs/operators';
|
|
25
|
-
import { PopoverService } from '../ui-kit/popover/popover.service';
|
|
26
|
-
import { TextCountPipe } from './pipes/text-count.pipe';
|
|
27
|
-
import { ASSETS } from './constants/assets.constant';
|
|
28
|
-
import { PROGRAM_LIST_API } from './program-list/constant';
|
|
29
|
-
import { ListItem } from './program-list/interfaces/list-item.interface';
|
|
30
|
-
import {
|
|
31
|
-
buildProgramSelectionMapFromCategories,
|
|
32
|
-
extractCategoryIdsFromDashboard,
|
|
33
|
-
extractProgramIdsFromDashboard,
|
|
34
|
-
extractRcIdsFromDashboard,
|
|
35
|
-
filterActiveWidgets,
|
|
36
|
-
flattenProgramSelectionMap,
|
|
37
|
-
getEditDashboardCdid,
|
|
38
|
-
getSelectedProgramsMap,
|
|
39
|
-
hasProgramSelectionInMap,
|
|
40
|
-
normalizeIdArray,
|
|
41
|
-
normalizeProgramCategories,
|
|
42
|
-
normalizeProgramSelectionMap,
|
|
43
|
-
parseSailsProgramList,
|
|
44
|
-
} from './utils/dashboard-edit.utils';
|
|
45
|
-
|
|
46
|
-
@Component({
|
|
47
|
-
selector: 'app-create-dashboard',
|
|
48
|
-
templateUrl: './create-dashboard.component.html',
|
|
49
|
-
styleUrls: ['./create-dashboard.component.less'],
|
|
50
|
-
providers: [TextCountPipe],
|
|
51
|
-
})
|
|
52
|
-
export class CreateDashboardComponent implements OnInit, OnChanges {
|
|
53
|
-
@Input() feature: any;
|
|
54
|
-
activeSelector = '';
|
|
55
|
-
disabled = false;
|
|
56
|
-
@Input() mode = 'CREATE';
|
|
57
|
-
@Input() dashboardId = '';
|
|
58
|
-
@Input() dashboardDetails: any = null; // for edit dashboard
|
|
59
|
-
/** API dashboard object from createDashboard response (used when navigating after create). */
|
|
60
|
-
private createdDashboard: any = null;
|
|
61
|
-
/** True after CREATE API succeeds; widget save should emit `created` for app redirect. */
|
|
62
|
-
private redirectAfterCreate = false;
|
|
63
|
-
@Output() close = new EventEmitter();
|
|
64
|
-
@Input() createdBy = 0;
|
|
65
|
-
@ViewChild('fromDatePicker') fromDatePicker!: DatePickerComponent;
|
|
66
|
-
@ViewChild('toDatePicker') toDatePicker!: DatePickerComponent;
|
|
67
|
-
animation = true;
|
|
68
|
-
@Input() configureWidget = false;
|
|
69
|
-
ASSETS: any = ASSETS;
|
|
70
|
-
|
|
71
|
-
totalPages = 1;
|
|
72
|
-
totalList = 1;
|
|
73
|
-
usersList: any[] = [];
|
|
74
|
-
vLoader = true;
|
|
75
|
-
userListLoaded = false;
|
|
76
|
-
groupListLoaded = false;
|
|
77
|
-
rcListLoaded = false;
|
|
78
|
-
hideToDate = false;
|
|
79
|
-
listDetails: UserListConfiguration = {
|
|
80
|
-
selectedUsersList: [],
|
|
81
|
-
selectedGroupList: [],
|
|
82
|
-
nonRemovableUsersList: [],
|
|
83
|
-
displayElementKey: 'member_name',
|
|
84
|
-
displayGroupKey: 'group_name',
|
|
85
|
-
groupIdkey: 'group_id',
|
|
86
|
-
elementIdKey: 'member_id',
|
|
87
|
-
tooltipKey: 'member_email',
|
|
88
|
-
};
|
|
89
|
-
dashboardDescription: EditorConfig = {
|
|
90
|
-
placeholder: 'Description (Max limit: 250 characters)',
|
|
91
|
-
mode: 'prime',
|
|
92
|
-
id: 'description',
|
|
93
|
-
};
|
|
94
|
-
responsibilityCategoriesTree: any = {
|
|
95
|
-
regulations: {
|
|
96
|
-
list: [],
|
|
97
|
-
selectedList: [],
|
|
98
|
-
},
|
|
99
|
-
standards: {
|
|
100
|
-
list: [],
|
|
101
|
-
selectedList: [],
|
|
102
|
-
},
|
|
103
|
-
internalControls: {
|
|
104
|
-
list: [],
|
|
105
|
-
selectedList: [],
|
|
106
|
-
},
|
|
107
|
-
others: {
|
|
108
|
-
list: [],
|
|
109
|
-
selectedList: [],
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
allComplianceCategories: any[] = [];
|
|
113
|
-
allRiskCategories: any[] = [];
|
|
114
|
-
showRiskCategory = false;
|
|
115
|
-
showCriteria = true;
|
|
116
|
-
|
|
117
|
-
dashboardForm: CreateDashboardForm = {
|
|
118
|
-
dashboardName: '',
|
|
119
|
-
dashboardDescriptionText: '',
|
|
120
|
-
selectedViewers: [],
|
|
121
|
-
selectedGroup: [],
|
|
122
|
-
selectedFromDate: undefined,
|
|
123
|
-
selectedToDate: undefined,
|
|
124
|
-
selectedResponsibilityCenters: [],
|
|
125
|
-
selectedResponsibilityCategories: [],
|
|
126
|
-
selectedRiskCategories: [],
|
|
127
|
-
displayCriteria: 'or',
|
|
128
|
-
configureWidget: [],
|
|
129
|
-
frequencyDetails: '',
|
|
130
|
-
selectedFrequencyType: '',
|
|
131
|
-
selectedFrequencies: [0],
|
|
132
|
-
frequencyMessage: '',
|
|
133
|
-
frequencyDate: 1,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
openConfigureWidgets = false;
|
|
137
|
-
selectedWidgets: any = [];
|
|
138
|
-
displayedWidgets: any = [];
|
|
139
|
-
|
|
140
|
-
responsibilityCentersList: any[] = [];
|
|
141
|
-
datePickerOverlay = false;
|
|
142
|
-
dayNames = [
|
|
143
|
-
'Monday',
|
|
144
|
-
'Tuesday',
|
|
145
|
-
'Wednesday',
|
|
146
|
-
'Thursday',
|
|
147
|
-
'Friday',
|
|
148
|
-
'Saturday',
|
|
149
|
-
'Sunday',
|
|
150
|
-
];
|
|
151
|
-
monthNames = [
|
|
152
|
-
'January',
|
|
153
|
-
'February',
|
|
154
|
-
'March',
|
|
155
|
-
'April',
|
|
156
|
-
'May',
|
|
157
|
-
'June',
|
|
158
|
-
'July',
|
|
159
|
-
'August',
|
|
160
|
-
'September',
|
|
161
|
-
'October',
|
|
162
|
-
'November',
|
|
163
|
-
'December',
|
|
164
|
-
];
|
|
165
|
-
quarters = [
|
|
166
|
-
'January, April, July, October',
|
|
167
|
-
'February, May, August, November',
|
|
168
|
-
'March, June, September, December',
|
|
169
|
-
];
|
|
170
|
-
|
|
171
|
-
showRiskWidgets = false;
|
|
172
|
-
showComplianceWidgets = false;
|
|
173
|
-
isManageRisk: boolean = false;
|
|
174
|
-
|
|
175
|
-
riskCategoryList = {
|
|
176
|
-
strategic: {
|
|
177
|
-
list: [],
|
|
178
|
-
selectedList: [],
|
|
179
|
-
},
|
|
180
|
-
operational: {
|
|
181
|
-
list: [],
|
|
182
|
-
selectedList: [],
|
|
183
|
-
},
|
|
184
|
-
compliance: {
|
|
185
|
-
list: [],
|
|
186
|
-
selectedList: [],
|
|
187
|
-
},
|
|
188
|
-
others: {
|
|
189
|
-
list: [],
|
|
190
|
-
selectedList: [],
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
programListUrl: any = PROGRAM_LIST_API;
|
|
194
|
-
|
|
195
|
-
fromDatePickerConfig: IDatePickerConfig = {
|
|
196
|
-
min: this.getCurrentDate(),
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
toDatePickerConfig: IDatePickerConfig = {};
|
|
200
|
-
|
|
201
|
-
isSmiley!: boolean;
|
|
202
|
-
smileyMessage: string = '';
|
|
203
|
-
groupList: any;
|
|
204
|
-
groupsEnabled: boolean = true;
|
|
205
|
-
totalgroups: any;
|
|
206
|
-
@ViewChild('fromDatePicker', { read: ElementRef, static: false })
|
|
207
|
-
fromDatePickerPopup!: ElementRef;
|
|
208
|
-
@ViewChild('toDatePicker', { read: ElementRef, static: false })
|
|
209
|
-
toDatePickerPopup!: ElementRef;
|
|
210
|
-
openedDatePicker: string = '';
|
|
211
|
-
selectedPrograms: any = {};
|
|
212
|
-
allProgamSelected: any[] = [];
|
|
213
|
-
private pendingEditRcIds: number[] = [];
|
|
214
|
-
private pendingEditRcEntries: any[] = [];
|
|
215
|
-
private editFormHydrated = false;
|
|
216
|
-
/** Tracks in-flight EDIT hydration HTTP calls; loader stays on until zero. */
|
|
217
|
-
private editHydrationCount = 0;
|
|
218
|
-
|
|
219
|
-
constructor(
|
|
220
|
-
private createDashboardService: CreateDashboardService,
|
|
221
|
-
private paginationService: PaginationService,
|
|
222
|
-
private cdr: ChangeDetectorRef,
|
|
223
|
-
private snackBar: SnackBarService,
|
|
224
|
-
public popoverService: PopoverService,
|
|
225
|
-
private textCount: TextCountPipe
|
|
226
|
-
) {}
|
|
227
|
-
|
|
228
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
229
|
-
if (this.createdBy) {
|
|
230
|
-
this.listDetails.nonRemovableUsersList.push(this.createdBy);
|
|
231
|
-
}
|
|
232
|
-
if (
|
|
233
|
-
this.mode === 'EDIT' &&
|
|
234
|
-
changes['dashboardDetails']?.currentValue &&
|
|
235
|
-
this.rcListLoaded &&
|
|
236
|
-
this.userListLoaded &&
|
|
237
|
-
this.groupListLoaded
|
|
238
|
-
) {
|
|
239
|
-
this.hydrateEditForm();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@HostListener('document:keydown.escape', ['$event']) onKeydownHandler(
|
|
244
|
-
event: KeyboardEvent
|
|
245
|
-
) {
|
|
246
|
-
this.close.emit({ mode: 'discard' });
|
|
247
|
-
this.isSmiley = false;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
ngOnInit(): void {
|
|
251
|
-
this.animateContainer();
|
|
252
|
-
this.getRCList();
|
|
253
|
-
this.checkWhetherAllListsLoaded();
|
|
254
|
-
this.getUsersList('');
|
|
255
|
-
this.getGroupList();
|
|
256
|
-
this.getUserInfo();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
animateContainer() {
|
|
260
|
-
this.animation = true;
|
|
261
|
-
setTimeout(() => {
|
|
262
|
-
this.animation = false;
|
|
263
|
-
}, 300);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
getUserInfo(){
|
|
267
|
-
this.createDashboardService.getUserInformation().subscribe(
|
|
268
|
-
(res: any) => {
|
|
269
|
-
this.setPermission(res?.roleActions);
|
|
270
|
-
const quickLink = res.quick_link;
|
|
271
|
-
if (quickLink.risk) {
|
|
272
|
-
this.showRiskCategory = true;
|
|
273
|
-
} else {
|
|
274
|
-
this.showRiskCategory = false;
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
(error) => {
|
|
278
|
-
console.error(error);
|
|
279
|
-
}
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Displays the listing pages the left side of policy form to set and edit the dropdown fields values
|
|
285
|
-
* @param type holds name of particular list is to be displayed
|
|
286
|
-
* @param event contains boolean value to display the list or not
|
|
287
|
-
*/
|
|
288
|
-
activateSelector(type: any, event: boolean) {
|
|
289
|
-
if (type == 'frequency' || this.activeSelector == 'frequency') {
|
|
290
|
-
this.showCriteria = false;
|
|
291
|
-
setTimeout(() => {
|
|
292
|
-
this.showCriteria = true;
|
|
293
|
-
}, 1);
|
|
294
|
-
}
|
|
295
|
-
if (type === 'responsibilityCategories' && event) {
|
|
296
|
-
this.syncProgramSelectionMapFromForm();
|
|
297
|
-
this.ensureProgramSelectionMapForList();
|
|
298
|
-
}
|
|
299
|
-
this.activeSelector = event ? type : '';
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
onProgramSelectionChange(items: ListItem[]): void {
|
|
303
|
-
this.selectedPrograms = items;
|
|
304
|
-
this.allProgamSelected = ([] as any).concat(...Object.values(items));
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
selectCategory(): void {
|
|
308
|
-
this.dashboardForm.selectedResponsibilityCategories =
|
|
309
|
-
normalizeProgramCategories(this.allProgamSelected);
|
|
310
|
-
this.applyResponsibilityCategoryWidgetFilters();
|
|
311
|
-
this.activateSelector('', false);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
checkDefaultProgramOnRemove(event: any) {
|
|
315
|
-
this.allProgamSelected = this.allProgamSelected.filter(
|
|
316
|
-
(program: any) => program?.id !== event?.id
|
|
317
|
-
);
|
|
318
|
-
this.removeProgram(event);
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
removeProgram(program: any): void {
|
|
323
|
-
const keys = Object.keys(this.selectedPrograms);
|
|
324
|
-
keys.forEach((key: any) => {
|
|
325
|
-
const index = this.selectedPrograms[key].findIndex(
|
|
326
|
-
(item: any) => item?.id === program?.id
|
|
327
|
-
);
|
|
328
|
-
if (index !== -1) {
|
|
329
|
-
this.selectedPrograms[key].splice(index, 1);
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
private syncProgramSelectionMapFromForm(): void {
|
|
335
|
-
if (hasProgramSelectionInMap(this.selectedPrograms)) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
const flat =
|
|
339
|
-
this.allProgamSelected?.length > 0
|
|
340
|
-
? this.allProgamSelected
|
|
341
|
-
: this.dashboardForm.selectedResponsibilityCategories ?? [];
|
|
342
|
-
const fromForm = buildProgramSelectionMapFromCategories(
|
|
343
|
-
flat,
|
|
344
|
-
this.allComplianceCategories
|
|
345
|
-
);
|
|
346
|
-
if (hasProgramSelectionInMap(fromForm)) {
|
|
347
|
-
this.applyProgramSelectionMap(fromForm);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
private hydrateProgramsFromDashboardData(data: any): boolean {
|
|
352
|
-
if (!data) {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
const programsRaw = data?.programs ?? data?.programId ?? data?.programIds;
|
|
356
|
-
if (
|
|
357
|
-
Array.isArray(programsRaw) &&
|
|
358
|
-
programsRaw.length &&
|
|
359
|
-
typeof programsRaw[0] === 'object'
|
|
360
|
-
) {
|
|
361
|
-
const chips = programsRaw.map((p: any) => ({
|
|
362
|
-
id: p?.id ?? p?.programId,
|
|
363
|
-
category_id: p?.id ?? p?.programId,
|
|
364
|
-
name: p?.name ?? p?.item_name,
|
|
365
|
-
item_name: p?.name ?? p?.item_name,
|
|
366
|
-
programId: p?.id ?? p?.programId,
|
|
367
|
-
}));
|
|
368
|
-
this.allProgamSelected = normalizeProgramCategories(chips);
|
|
369
|
-
this.dashboardForm.selectedResponsibilityCategories = [
|
|
370
|
-
...this.allProgamSelected,
|
|
371
|
-
];
|
|
372
|
-
const map = buildProgramSelectionMapFromCategories(
|
|
373
|
-
chips,
|
|
374
|
-
this.allComplianceCategories
|
|
375
|
-
);
|
|
376
|
-
if (Object.keys(map).length) {
|
|
377
|
-
this.selectedPrograms = map;
|
|
378
|
-
}
|
|
379
|
-
return true;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
const program = data?.program ?? {};
|
|
383
|
-
const selectedMap = getSelectedProgramsMap(data);
|
|
384
|
-
if (selectedMap && hasProgramSelectionInMap(selectedMap)) {
|
|
385
|
-
this.applyProgramSelectionMap(selectedMap);
|
|
386
|
-
return true;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const allPrograms = program?.all_programs;
|
|
390
|
-
if (Array.isArray(allPrograms) && allPrograms.length) {
|
|
391
|
-
if (typeof allPrograms[0] === 'object') {
|
|
392
|
-
const map = buildProgramSelectionMapFromCategories(
|
|
393
|
-
allPrograms,
|
|
394
|
-
this.allComplianceCategories
|
|
395
|
-
);
|
|
396
|
-
if (hasProgramSelectionInMap(map)) {
|
|
397
|
-
this.applyProgramSelectionMap(map);
|
|
398
|
-
return true;
|
|
399
|
-
}
|
|
400
|
-
this.allProgamSelected = normalizeProgramCategories(allPrograms);
|
|
401
|
-
this.dashboardForm.selectedResponsibilityCategories = [
|
|
402
|
-
...this.allProgamSelected,
|
|
403
|
-
];
|
|
404
|
-
return this.allProgamSelected.length > 0;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const categoryIds = extractCategoryIdsFromDashboard(data);
|
|
409
|
-
if (categoryIds.length) {
|
|
410
|
-
const stubs = categoryIds.map((id) => ({
|
|
411
|
-
category_id: id,
|
|
412
|
-
id,
|
|
413
|
-
item_name: `Category ${id}`,
|
|
414
|
-
}));
|
|
415
|
-
this.allProgamSelected = normalizeProgramCategories(stubs);
|
|
416
|
-
this.dashboardForm.selectedResponsibilityCategories = [
|
|
417
|
-
...this.allProgamSelected,
|
|
418
|
-
];
|
|
419
|
-
return true;
|
|
420
|
-
}
|
|
421
|
-
return false;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
private applyFlatProgramCategories(categories: any[]): void {
|
|
425
|
-
if (!categories?.length) {
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
this.allProgamSelected = normalizeProgramCategories(categories);
|
|
429
|
-
this.dashboardForm.selectedResponsibilityCategories = [
|
|
430
|
-
...this.allProgamSelected,
|
|
431
|
-
];
|
|
432
|
-
const map = buildProgramSelectionMapFromCategories(
|
|
433
|
-
categories,
|
|
434
|
-
this.allComplianceCategories
|
|
435
|
-
);
|
|
436
|
-
if (hasProgramSelectionInMap(map)) {
|
|
437
|
-
this.selectedPrograms = map;
|
|
438
|
-
}
|
|
439
|
-
this.cdr.detectChanges();
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
private applyResponsibilityCategoryWidgetFilters(): void {
|
|
443
|
-
if (this.dashboardForm.selectedResponsibilityCenters.length !== 0) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
if (this.dashboardForm.selectedResponsibilityCategories.length === 0) {
|
|
447
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
448
|
-
(element: any) => element.module_name != 'COMPLIANCE'
|
|
449
|
-
);
|
|
450
|
-
} else if (this.dashboardForm.selectedRiskCategories.length === 0) {
|
|
451
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
452
|
-
(element: any) => element.module_name != 'RISK'
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
openFromDatePicker() {
|
|
458
|
-
this.openedDatePicker = 'FROM_DATE';
|
|
459
|
-
|
|
460
|
-
this.fromDatePicker?.api?.open();
|
|
461
|
-
this.datePickerOverlay = true;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
openToDatePicker() {
|
|
465
|
-
this.openedDatePicker = 'TO_DATE';
|
|
466
|
-
|
|
467
|
-
this.toDatePicker?.api?.open();
|
|
468
|
-
|
|
469
|
-
this.datePickerOverlay = true;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
closeFromDatePicker() {
|
|
473
|
-
this.fromDatePicker?.api?.close();
|
|
474
|
-
if (!this.dashboardForm.selectedFromDate) {
|
|
475
|
-
this.dashboardForm.selectedToDate = undefined;
|
|
476
|
-
this.hideToDate = true;
|
|
477
|
-
setTimeout(() => {
|
|
478
|
-
this.hideToDate = false;
|
|
479
|
-
}, 20);
|
|
480
|
-
this.fromDatePicker.api.close();
|
|
481
|
-
this.datePickerOverlay = false;
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
let minToDate = this.setToDate(this.dashboardForm.selectedFromDate);
|
|
485
|
-
this.toDatePickerConfig = { min: minToDate };
|
|
486
|
-
|
|
487
|
-
const fromDate = new Date(minToDate.split('-').reverse().join('-'));
|
|
488
|
-
const toDate = new Date(this.dashboardForm.selectedToDate);
|
|
489
|
-
const inValidDate = fromDate >= toDate ? true : false;
|
|
490
|
-
if (inValidDate) {
|
|
491
|
-
this.dashboardForm.selectedToDate = undefined;
|
|
492
|
-
this.hideToDate = true;
|
|
493
|
-
setTimeout(() => {
|
|
494
|
-
this.hideToDate = false;
|
|
495
|
-
}, 20);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
this.datePickerOverlay = false;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
closeToDatePicker() {
|
|
502
|
-
this.toDatePicker?.api?.close();
|
|
503
|
-
this.datePickerOverlay = false;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
animateImage() {
|
|
507
|
-
const circleImage = document.getElementsByClassName('image');
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
saveFrequency(eventValues: any) {
|
|
511
|
-
this.dashboardForm.selectedFrequencyType = eventValues.frequencyType;
|
|
512
|
-
this.dashboardForm.selectedFrequencies = eventValues.frequencies;
|
|
513
|
-
this.dashboardForm.frequencyMessage = eventValues.frequencyString;
|
|
514
|
-
this.dashboardForm.frequencyDate = eventValues.selectedDate;
|
|
515
|
-
this.activateSelector('', false);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
getCurrentDate() {
|
|
519
|
-
let today = new Date();
|
|
520
|
-
return dayjs(today).format('DD-MM-YYYY');
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
setToDate(data: string) {
|
|
524
|
-
let today = new Date(data);
|
|
525
|
-
return dayjs(today).format('DD-MM-YYYY');
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
getFromDate(data: string) {
|
|
529
|
-
let today = new Date(data);
|
|
530
|
-
return (
|
|
531
|
-
today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear()
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* @param data - the date you want to format
|
|
537
|
-
* @returns Date string in YYYY-MM-DD format, e.g. 2026-05-19
|
|
538
|
-
*/
|
|
539
|
-
getDateFormate(data: string) {
|
|
540
|
-
return dayjs(data).format('YYYY-MM-DD');
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
configureDashboard() {
|
|
545
|
-
let fieldsStatus = this.validateDashboard();
|
|
546
|
-
if (!fieldsStatus) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
this.vLoader = true;
|
|
550
|
-
this.onSubmitDashboard();
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* Get users list by making api call and pre selects all admins by adding to viewers
|
|
558
|
-
* @param url contains query params for organization users api
|
|
559
|
-
*/
|
|
560
|
-
getUsersList(url: any) {
|
|
561
|
-
this.createDashboardService.getAllUsers().subscribe((res: any) => {
|
|
562
|
-
this.usersList = res;
|
|
563
|
-
this.userListLoaded = true;
|
|
564
|
-
|
|
565
|
-
if (this.mode === 'EDIT') {
|
|
566
|
-
} else {
|
|
567
|
-
this.dashboardForm.selectedViewers = this.setList(
|
|
568
|
-
this.usersList,
|
|
569
|
-
[this.createdBy],
|
|
570
|
-
'member_id'
|
|
571
|
-
);
|
|
572
|
-
this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
|
|
573
|
-
this.vLoader = false;
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
getGroupList() {
|
|
579
|
-
this.createDashboardService.getAllGroups().subscribe((res: any) => {
|
|
580
|
-
this.totalgroups = res.total_items;
|
|
581
|
-
this.groupList = res.data;
|
|
582
|
-
this.groupListLoaded = true;
|
|
583
|
-
if (this.mode === 'EDIT') {
|
|
584
|
-
} else {
|
|
585
|
-
this.dashboardForm.selectedGroup = this.setList(
|
|
586
|
-
this.groupList,
|
|
587
|
-
[this.createdBy],
|
|
588
|
-
'group_id'
|
|
589
|
-
);
|
|
590
|
-
this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
|
|
591
|
-
this.vLoader = false;
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* It is to ensure whether all required lists on Policy from is loaded from the api call or not
|
|
599
|
-
*/
|
|
600
|
-
checkWhetherAllListsLoaded() {
|
|
601
|
-
// Category trees are no longer eagerly loaded here; these flags were never flipped and blocked EDIT indefinitely.
|
|
602
|
-
if (this.rcListLoaded && this.userListLoaded && this.groupListLoaded) {
|
|
603
|
-
if (this.mode === 'EDIT') {
|
|
604
|
-
this.hydrateEditForm();
|
|
605
|
-
} else {
|
|
606
|
-
this.vLoader = false;
|
|
607
|
-
}
|
|
608
|
-
} else {
|
|
609
|
-
setTimeout(() => {
|
|
610
|
-
this.checkWhetherAllListsLoaded();
|
|
611
|
-
}, 300);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
setSelectedWidgets(data: any) {
|
|
616
|
-
if (this.mode === 'CREATE') {
|
|
617
|
-
const widgetsArray: any = [];
|
|
618
|
-
data.forEach((element: any) => {
|
|
619
|
-
let obj: any = {};
|
|
620
|
-
obj.module_name = element.module;
|
|
621
|
-
obj.widget_name = element.title;
|
|
622
|
-
obj.widget_code = element.id;
|
|
623
|
-
obj.sub_widgets = [];
|
|
624
|
-
obj.state = 'ACTIVE';
|
|
625
|
-
if (element.subWidgets.length > 0) {
|
|
626
|
-
element.subWidgets.forEach((subWidget: any) => {
|
|
627
|
-
let subWidgetObject: any = {};
|
|
628
|
-
subWidgetObject.widget_name = subWidget.title;
|
|
629
|
-
subWidgetObject.widget_code = subWidget.id;
|
|
630
|
-
subWidgetObject.state = subWidget.value ? 'ACTIVE' : 'INACTIVE';
|
|
631
|
-
obj.sub_widgets.push(Object.assign(subWidgetObject));
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
widgetsArray.push(obj);
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
this.dashboardForm.configureWidget = widgetsArray;
|
|
638
|
-
} else if (this.mode === 'EDIT') {
|
|
639
|
-
const widgetsArray: any = [];
|
|
640
|
-
|
|
641
|
-
data.forEach((element: any) => {
|
|
642
|
-
if (
|
|
643
|
-
!this.extractWidgetCodes(this.dashboardForm.configureWidget).includes(
|
|
644
|
-
element.id
|
|
645
|
-
)
|
|
646
|
-
) {
|
|
647
|
-
let obj: any = {};
|
|
648
|
-
obj.module_name = element.module;
|
|
649
|
-
obj._id = '';
|
|
650
|
-
obj.widget_name = element.title;
|
|
651
|
-
obj.widget_code = element.id;
|
|
652
|
-
obj.sub_widgets = [];
|
|
653
|
-
obj.state = 'ACTIVE';
|
|
654
|
-
if (element.subWidgets.length > 0) {
|
|
655
|
-
element.subWidgets.forEach((subWidget: any) => {
|
|
656
|
-
let subWidgetObject: any = {};
|
|
657
|
-
subWidgetObject._id = '';
|
|
658
|
-
subWidgetObject.widget_name = subWidget.title;
|
|
659
|
-
subWidgetObject.widget_code = subWidget.id;
|
|
660
|
-
subWidgetObject.state = subWidget.value ? 'ACTIVE' : 'INACTIVE';
|
|
661
|
-
obj.sub_widgets.push(subWidgetObject);
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
this.dashboardForm.configureWidget.push(obj);
|
|
665
|
-
} else {
|
|
666
|
-
const index = this.selectedWidgets.findIndex(
|
|
667
|
-
(ele: any) => ele.widget_code == element.id
|
|
668
|
-
);
|
|
669
|
-
if (index != -1) {
|
|
670
|
-
this.selectedWidgets[index].state = 'ACTIVE';
|
|
671
|
-
if (this.selectedWidgets[index].sub_widgets.length > 0) {
|
|
672
|
-
this.selectedWidgets[index].sub_widgets.forEach(
|
|
673
|
-
(subWidgetData: any) => {
|
|
674
|
-
const elementIndex = element.subWidgets.findIndex(
|
|
675
|
-
(ele: any) => ele.id == subWidgetData.widget_code
|
|
676
|
-
);
|
|
677
|
-
if (elementIndex != -1) {
|
|
678
|
-
subWidgetData.state = element.subWidgets[elementIndex].value
|
|
679
|
-
? 'ACTIVE'
|
|
680
|
-
: 'INACTIVE';
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
this.dashboardForm.configureWidget.forEach((savedWidget: any) => {
|
|
689
|
-
const index = data.findIndex(
|
|
690
|
-
(dataElement: any) => dataElement.id == savedWidget.widget_code
|
|
691
|
-
);
|
|
692
|
-
if (index == -1) {
|
|
693
|
-
savedWidget.state = 'INACTIVE';
|
|
694
|
-
if (savedWidget.sub_widgets.length > 0) {
|
|
695
|
-
savedWidget.sub_widgets.forEach((saveSubWidget: any) => {
|
|
696
|
-
saveSubWidget.state = 'INACTIVE';
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
this.selectedWidgets = data;
|
|
703
|
-
this.openConfigureWidgets = false;
|
|
704
|
-
this.submitDashboard();
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
extractWidgetCodes(widgets: any[]) {
|
|
708
|
-
const widgetCodes: any[] = [];
|
|
709
|
-
|
|
710
|
-
widgets?.forEach((widget: any) => {
|
|
711
|
-
if (widget?.widget_code) {
|
|
712
|
-
widgetCodes.push(widget?.widget_code);
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
|
|
716
|
-
return widgetCodes;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
closeConfigureWidgets(event: boolean) {
|
|
720
|
-
this.openConfigureWidgets = event;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* Filter list user's list based on pagination by making api call
|
|
725
|
-
* @param event specifies a boolean value to call api
|
|
726
|
-
*/
|
|
727
|
-
paginationFilter(event: any) {
|
|
728
|
-
if (event) {
|
|
729
|
-
this.getUsersList({
|
|
730
|
-
p:
|
|
731
|
-
this.paginationService.currentPage === 1
|
|
732
|
-
? ''
|
|
733
|
-
: this.paginationService.currentPage,
|
|
734
|
-
type: 'all_except_executive',
|
|
735
|
-
q: !this.paginationService.searchValue
|
|
736
|
-
? ''
|
|
737
|
-
: this.paginationService.searchValue,
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
getRCList() {
|
|
743
|
-
this.createDashboardService.getResponsibilityCenterList().subscribe(
|
|
744
|
-
(res: any) => {
|
|
745
|
-
this.responsibilityCentersList = this.normalizeRcList(res);
|
|
746
|
-
this.rcListLoaded = true;
|
|
747
|
-
this.applyPendingResponsibilityCenters();
|
|
748
|
-
if (this.mode === 'EDIT') {
|
|
749
|
-
const ids = this.responsibilityCentersList.filter((rc: any) => this.dashboardDetails?.responsibilityCenters.includes(rc.rcid)).map((rc: any) => rc.item_id);
|
|
750
|
-
this.saveSelectedList('rc', ids);
|
|
751
|
-
}
|
|
752
|
-
},
|
|
753
|
-
(err: any) => {
|
|
754
|
-
console.error(err);
|
|
755
|
-
this.rcListLoaded = true;
|
|
756
|
-
this.applyPendingResponsibilityCenters();
|
|
757
|
-
}
|
|
758
|
-
);
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* #### Description
|
|
762
|
-
*
|
|
763
|
-
* Returns the unique array of object based on unique key
|
|
764
|
-
* @param array
|
|
765
|
-
* @param key
|
|
766
|
-
* @returns
|
|
767
|
-
*/
|
|
768
|
-
uniqueByProp(array: any, key: string) {
|
|
769
|
-
return Array.from(
|
|
770
|
-
array
|
|
771
|
-
.reduce(
|
|
772
|
-
(acc: any, item: any) => (
|
|
773
|
-
item && item[key] && acc.set(item[key], item), acc
|
|
774
|
-
),
|
|
775
|
-
new Map()
|
|
776
|
-
)
|
|
777
|
-
.values()
|
|
778
|
-
);
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
saveSelectedList(type: string, selectedItems: any) {
|
|
782
|
-
switch (type) {
|
|
783
|
-
case 'rc':
|
|
784
|
-
this.dashboardForm.selectedResponsibilityCenters = this.setList(
|
|
785
|
-
this.responsibilityCentersList,
|
|
786
|
-
selectedItems,
|
|
787
|
-
'item_id'
|
|
788
|
-
);
|
|
789
|
-
if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
|
|
790
|
-
if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
|
|
791
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
792
|
-
(element: any) => element.module_name != 'COMPLIANCE'
|
|
793
|
-
);
|
|
794
|
-
} else if (this.dashboardForm.selectedRiskCategories.length == 0) {
|
|
795
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
796
|
-
(element: any) => element.module_name != 'RISK'
|
|
797
|
-
);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
break;
|
|
801
|
-
case 'whoCanView':
|
|
802
|
-
this.dashboardForm.selectedViewers = this.uniqueByProp(
|
|
803
|
-
selectedItems?.users,
|
|
804
|
-
'member_id'
|
|
805
|
-
);
|
|
806
|
-
this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
|
|
807
|
-
this.dashboardForm.selectedGroup = this.uniqueByProp(
|
|
808
|
-
selectedItems?.groups,
|
|
809
|
-
'group_id'
|
|
810
|
-
);
|
|
811
|
-
this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
|
|
812
|
-
break;
|
|
813
|
-
case 'responsibilityCategories':
|
|
814
|
-
this.dashboardForm.selectedResponsibilityCategories =
|
|
815
|
-
normalizeProgramCategories(
|
|
816
|
-
Array.isArray(selectedItems)
|
|
817
|
-
? selectedItems
|
|
818
|
-
: flattenProgramSelectionMap(selectedItems ?? {})
|
|
819
|
-
);
|
|
820
|
-
this.applyResponsibilityCategoryWidgetFilters();
|
|
821
|
-
break;
|
|
822
|
-
case 'riskCategory':
|
|
823
|
-
this.dashboardForm.selectedRiskCategories = selectedItems;
|
|
824
|
-
if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
|
|
825
|
-
if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
|
|
826
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
827
|
-
(element: any) => element.module_name != 'COMPLIANCE'
|
|
828
|
-
);
|
|
829
|
-
} else if (this.dashboardForm.selectedRiskCategories.length == 0) {
|
|
830
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
831
|
-
(element: any) => element.module_name != 'RISK'
|
|
832
|
-
);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
break;
|
|
836
|
-
}
|
|
837
|
-
this.activateSelector('', false);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
remove(type: any, event: any, removeIndex?: any) {
|
|
841
|
-
switch (type) {
|
|
842
|
-
case 'rc':
|
|
843
|
-
const rcIndex =
|
|
844
|
-
this.dashboardForm.selectedResponsibilityCenters.findIndex(
|
|
845
|
-
(rc: any) => rc.rc_id == event.rc_id
|
|
846
|
-
);
|
|
847
|
-
if (rcIndex !== -1) {
|
|
848
|
-
const parentRc: any =
|
|
849
|
-
this.dashboardForm.selectedResponsibilityCenters[rcIndex];
|
|
850
|
-
this.dashboardForm.selectedResponsibilityCenters.splice(rcIndex, 1);
|
|
851
|
-
|
|
852
|
-
if (parentRc?.item_child_ids?.length > 0) {
|
|
853
|
-
parentRc.item_child_ids.forEach((childElement: any) => {
|
|
854
|
-
const removeIndex =
|
|
855
|
-
this.dashboardForm.selectedResponsibilityCenters.findIndex(
|
|
856
|
-
(removeElement: any) => removeElement.rc_id == childElement
|
|
857
|
-
);
|
|
858
|
-
this.dashboardForm.selectedResponsibilityCenters.splice(
|
|
859
|
-
removeIndex,
|
|
860
|
-
1
|
|
861
|
-
);
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
|
|
866
|
-
if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
|
|
867
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
868
|
-
(element: any) => element.module_name != 'COMPLIANCE'
|
|
869
|
-
);
|
|
870
|
-
} else if (this.dashboardForm.selectedRiskCategories.length == 0) {
|
|
871
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
872
|
-
(element: any) => element.module_name != 'RISK'
|
|
873
|
-
);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
break;
|
|
877
|
-
|
|
878
|
-
case 'whoCanView':
|
|
879
|
-
const reviewerIndex = this.dashboardForm.selectedViewers.findIndex(
|
|
880
|
-
(viewer: any) => viewer.member_id == event.member_id
|
|
881
|
-
);
|
|
882
|
-
this.dashboardForm.selectedViewers.splice(reviewerIndex, 1);
|
|
883
|
-
break;
|
|
884
|
-
case 'whoCanViewGroup':
|
|
885
|
-
const groups = this.dashboardForm.selectedGroup.findIndex(
|
|
886
|
-
(ele: any) => ele?.group_id == event?.group_id
|
|
887
|
-
);
|
|
888
|
-
this.dashboardForm.selectedGroup.splice(groups, 1);
|
|
889
|
-
break;
|
|
890
|
-
case 'responsibilityCategories':
|
|
891
|
-
this.checkDefaultProgramOnRemove(event);
|
|
892
|
-
break;
|
|
893
|
-
|
|
894
|
-
case 'riskCategory':
|
|
895
|
-
const riskCategoryIndex =
|
|
896
|
-
this.dashboardForm.selectedRiskCategories.findIndex(
|
|
897
|
-
(riskCategory: any) => riskCategory.category_id == event.category_id
|
|
898
|
-
);
|
|
899
|
-
if (riskCategoryIndex !== -1) {
|
|
900
|
-
const parent: any =
|
|
901
|
-
this.dashboardForm.selectedRiskCategories[riskCategoryIndex];
|
|
902
|
-
this.dashboardForm.selectedRiskCategories.splice(
|
|
903
|
-
riskCategoryIndex,
|
|
904
|
-
1
|
|
905
|
-
);
|
|
906
|
-
if (parent?.child_cat_ids?.length > 0) {
|
|
907
|
-
parent.child_cat_ids.forEach((childElement: any) => {
|
|
908
|
-
const removeIndex =
|
|
909
|
-
this.dashboardForm.selectedRiskCategories.findIndex(
|
|
910
|
-
(removeElement: any) =>
|
|
911
|
-
removeElement.category_id == childElement
|
|
912
|
-
);
|
|
913
|
-
this.dashboardForm.selectedRiskCategories.splice(removeIndex, 1);
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
this.dashboardForm.selectedRiskCategories.splice(riskCategoryIndex, 1);
|
|
918
|
-
if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
|
|
919
|
-
if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
|
|
920
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
921
|
-
(element: any) => element.module_name != 'COMPLIANCE'
|
|
922
|
-
);
|
|
923
|
-
} else if (this.dashboardForm.selectedRiskCategories.length == 0) {
|
|
924
|
-
this.selectedWidgets = this.selectedWidgets.filter(
|
|
925
|
-
(element: any) => element.module_name != 'RISK'
|
|
926
|
-
);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
setList(list: any[], ids: any[], key: string) {
|
|
934
|
-
return this.setListByIds(list, ids, [key]);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
private setListByIds(list: any[], ids: any[], keys: string[]) {
|
|
938
|
-
const data: any[] = [];
|
|
939
|
-
if (!Array.isArray(list) || !Array.isArray(ids)) {
|
|
940
|
-
return data;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
ids.forEach((id: any) => {
|
|
944
|
-
const targetId =id;
|
|
945
|
-
for (const key of keys) {
|
|
946
|
-
const index = list.findIndex(
|
|
947
|
-
(listElement: any) =>
|
|
948
|
-
listElement?.[key] === targetId
|
|
949
|
-
);
|
|
950
|
-
|
|
951
|
-
if (index !== -1) {
|
|
952
|
-
|
|
953
|
-
data.push(list[index]);
|
|
954
|
-
break;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
});
|
|
958
|
-
return data;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
private flattenRcTree(nodes: any): any[] {
|
|
962
|
-
const flat: any[] = [];
|
|
963
|
-
const walk = (arr: any[]) => {
|
|
964
|
-
(arr ?? []).forEach((node) => {
|
|
965
|
-
if (!node || typeof node !== 'object') {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
flat.push(node);
|
|
969
|
-
if (Array.isArray(node.children)) {
|
|
970
|
-
walk(node.children);
|
|
971
|
-
}
|
|
972
|
-
if (Array.isArray(node.items)) {
|
|
973
|
-
walk(node.items);
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
};
|
|
977
|
-
|
|
978
|
-
if (Array.isArray(nodes)) {
|
|
979
|
-
walk(nodes);
|
|
980
|
-
return flat.length ? flat : nodes;
|
|
981
|
-
}
|
|
982
|
-
if (Array.isArray(nodes?.data)) {
|
|
983
|
-
walk(nodes.data);
|
|
984
|
-
return flat;
|
|
985
|
-
}
|
|
986
|
-
return [];
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
private normalizeRcList(list: any): any[] {
|
|
990
|
-
const items = this.flattenRcTree(list);
|
|
991
|
-
return items.map((rc: any) => ({
|
|
992
|
-
...rc,
|
|
993
|
-
rcid: rc?.rcid ?? rc?.rc_id ?? rc?.item_id,
|
|
994
|
-
item_id: rc?.item_id ?? rc?.rc_id ?? rc?.rcid,
|
|
995
|
-
item_name:
|
|
996
|
-
rc?.item_name ??
|
|
997
|
-
rc?.item_name_string ??
|
|
998
|
-
(Array.isArray(rc?.rc_name) ? rc.rc_name.join(' < ') : rc?.rc_name) ??
|
|
999
|
-
'',
|
|
1000
|
-
}));
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
private resolveRcFromTree(tree: any[], ids: number[]): any[] {
|
|
1004
|
-
if (!ids.length || !tree.length) {
|
|
1005
|
-
return [];
|
|
1006
|
-
}
|
|
1007
|
-
const selected: any[] = [];
|
|
1008
|
-
const seen = new Set<number>();
|
|
1009
|
-
|
|
1010
|
-
ids.forEach((id) => {
|
|
1011
|
-
const targetId = Number(id);
|
|
1012
|
-
const match = tree.find(
|
|
1013
|
-
(rc) =>
|
|
1014
|
-
Number(rc?.item_id) === targetId ||
|
|
1015
|
-
Number(rc?.rc_id) === targetId ||
|
|
1016
|
-
Number(rc?.rcid) === targetId ||
|
|
1017
|
-
Number(rc?.id) === targetId ||
|
|
1018
|
-
rc?.item_child_ids?.some((childId: any) => Number(childId) === targetId) ||
|
|
1019
|
-
rc?.item_parent_ids?.some((parentId: any) => Number(parentId) === targetId)
|
|
1020
|
-
);
|
|
1021
|
-
if (!match) {
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
const key = Number(match?.item_id ?? match?.rc_id ?? match?.rcid ?? id);
|
|
1025
|
-
if (!seen.has(key)) {
|
|
1026
|
-
seen.add(key);
|
|
1027
|
-
selected.push(match);
|
|
1028
|
-
}
|
|
1029
|
-
});
|
|
1030
|
-
return selected;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
private applyPreresolvedRcEntries(): boolean {
|
|
1034
|
-
if (!this.pendingEditRcEntries?.length) {
|
|
1035
|
-
return false;
|
|
1036
|
-
}
|
|
1037
|
-
const tree = this.responsibilityCentersList ?? [];
|
|
1038
|
-
const selected = this.pendingEditRcEntries.map((entry) => {
|
|
1039
|
-
const rcid = Number(entry?.rcid ?? entry?.rc_id ?? entry?.item_id);
|
|
1040
|
-
const fromTree =
|
|
1041
|
-
tree.find((rc) => Number(rc?.item_id) === rcid) ??
|
|
1042
|
-
tree.find((rc) => Number(rc?.rcid) === rcid) ??
|
|
1043
|
-
tree.find((rc) => Number(rc?.rc_id) === rcid);
|
|
1044
|
-
return fromTree ? { ...fromTree } : { ...entry };
|
|
1045
|
-
});
|
|
1046
|
-
this.dashboardForm.selectedResponsibilityCenters = selected;
|
|
1047
|
-
this.pendingEditRcIds = selected.map((rc) =>
|
|
1048
|
-
Number(rc?.rcid ?? rc?.rc_id ?? rc?.item_id)
|
|
1049
|
-
);
|
|
1050
|
-
return true;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
private applyPendingResponsibilityCenters(): void {
|
|
1054
|
-
if (this.applyPreresolvedRcEntries()) {
|
|
1055
|
-
this.cdr.detectChanges();
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
if (!this.rcListLoaded || !this.pendingEditRcIds.length) {
|
|
1059
|
-
return;
|
|
1060
|
-
}
|
|
1061
|
-
let selected = this.setListByIds(
|
|
1062
|
-
this.responsibilityCentersList,
|
|
1063
|
-
this.pendingEditRcIds,
|
|
1064
|
-
['item_id', 'rcid', 'rc_id', 'id']
|
|
1065
|
-
);
|
|
1066
|
-
if (selected.length < this.pendingEditRcIds.length) {
|
|
1067
|
-
selected = this.resolveRcFromTree(
|
|
1068
|
-
this.responsibilityCentersList,
|
|
1069
|
-
this.pendingEditRcIds
|
|
1070
|
-
);
|
|
1071
|
-
}
|
|
1072
|
-
this.dashboardForm.selectedResponsibilityCenters = selected;
|
|
1073
|
-
this.cdr.detectChanges();
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
private beginEditHydration(): void {
|
|
1077
|
-
if (this.mode !== 'EDIT') {
|
|
1078
|
-
return;
|
|
1079
|
-
}
|
|
1080
|
-
this.editHydrationCount++;
|
|
1081
|
-
this.vLoader = true;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
private finishEditHydration(): void {
|
|
1085
|
-
if (this.mode !== 'EDIT') {
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
this.editHydrationCount = Math.max(0, this.editHydrationCount - 1);
|
|
1089
|
-
if (this.editHydrationCount === 0) {
|
|
1090
|
-
this.vLoader = false;
|
|
1091
|
-
this.cdr.detectChanges();
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
private tryCompleteEditHydration(): void {
|
|
1096
|
-
if (this.mode === 'EDIT' && this.editHydrationCount === 0) {
|
|
1097
|
-
this.vLoader = false;
|
|
1098
|
-
this.cdr.detectChanges();
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
private wrapEditRequest<T>(
|
|
1103
|
-
request$: Observable<T>,
|
|
1104
|
-
onNext: (value: T) => void
|
|
1105
|
-
): void {
|
|
1106
|
-
if (this.mode === 'EDIT') {
|
|
1107
|
-
this.beginEditHydration();
|
|
1108
|
-
}
|
|
1109
|
-
request$
|
|
1110
|
-
.pipe(finalize(() => this.finishEditHydration()))
|
|
1111
|
-
.subscribe({
|
|
1112
|
-
next: onNext,
|
|
1113
|
-
error: (err) => console.error(err),
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
private syncProgramsForEdit(data: any): void {
|
|
1118
|
-
if (!data) {
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
this.hydrateProgramsFromDashboardData(data);
|
|
1122
|
-
this.applyProgramsFromDashboardIds(
|
|
1123
|
-
extractProgramIdsFromDashboard(data),
|
|
1124
|
-
extractCategoryIdsFromDashboard(data),
|
|
1125
|
-
getSelectedProgramsMap(data),
|
|
1126
|
-
data?.program
|
|
1127
|
-
);
|
|
1128
|
-
const categoryIds = extractCategoryIdsFromDashboard(data);
|
|
1129
|
-
if (categoryIds.length) {
|
|
1130
|
-
const fromCompliance = this.setList(
|
|
1131
|
-
this.allComplianceCategories,
|
|
1132
|
-
categoryIds,
|
|
1133
|
-
'category_id'
|
|
1134
|
-
);
|
|
1135
|
-
if (fromCompliance.length && !this.allProgamSelected.length) {
|
|
1136
|
-
this.applyFlatProgramCategories(fromCompliance);
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
if (
|
|
1140
|
-
!this.allProgamSelected.length &&
|
|
1141
|
-
this.dashboardForm.selectedResponsibilityCategories.length
|
|
1142
|
-
) {
|
|
1143
|
-
this.allProgamSelected = [
|
|
1144
|
-
...this.dashboardForm.selectedResponsibilityCategories,
|
|
1145
|
-
];
|
|
1146
|
-
}
|
|
1147
|
-
this.syncProgramSelectionMapFromForm();
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
private applyProgramsFromDashboardIds(
|
|
1151
|
-
programIds: number[],
|
|
1152
|
-
categoryIds: number[],
|
|
1153
|
-
selectedProgramsMap?: Record<string, any[]>,
|
|
1154
|
-
programPayload?: { all_programs?: any[]; selected_programs?: any }
|
|
1155
|
-
): void {
|
|
1156
|
-
if (categoryIds.length) {
|
|
1157
|
-
this.loadProgramsForEdit(
|
|
1158
|
-
programIds,
|
|
1159
|
-
categoryIds,
|
|
1160
|
-
selectedProgramsMap,
|
|
1161
|
-
programPayload
|
|
1162
|
-
);
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
if (programIds.length) {
|
|
1166
|
-
this.resolveProgramIdsForEdit(programIds);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
private ensureProgramSelectionMapForList(): void {
|
|
1171
|
-
if (hasProgramSelectionInMap(this.selectedPrograms)) {
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
const categoryIds = normalizeIdArray(
|
|
1175
|
-
this.dashboardForm.selectedResponsibilityCategories?.map(
|
|
1176
|
-
(c: any) => c?.category_id ?? c?.id
|
|
1177
|
-
) ?? []
|
|
1178
|
-
);
|
|
1179
|
-
const programIds = [
|
|
1180
|
-
...new Set(
|
|
1181
|
-
(this.dashboardForm.selectedResponsibilityCategories ?? []).map(
|
|
1182
|
-
(c: any) => Number(c?.programId ?? c?.program_id ?? c?.parentId)
|
|
1183
|
-
)
|
|
1184
|
-
),
|
|
1185
|
-
].filter((id) => !Number.isNaN(id));
|
|
1186
|
-
if (programIds.length || categoryIds.length) {
|
|
1187
|
-
this.loadProgramsForEdit(programIds, categoryIds);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
private applyProgramSelectionMap(map: Record<string, any[]>): void {
|
|
1192
|
-
const normalized = normalizeProgramSelectionMap(map);
|
|
1193
|
-
if (!normalized) {
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
this.selectedPrograms = normalized;
|
|
1197
|
-
this.allProgamSelected = flattenProgramSelectionMap(this.selectedPrograms);
|
|
1198
|
-
this.dashboardForm.selectedResponsibilityCategories =
|
|
1199
|
-
normalizeProgramCategories(this.allProgamSelected);
|
|
1200
|
-
this.cdr.detectChanges();
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
private categoryMatchesId(cat: any, categoryIdSet: Set<number>): boolean {
|
|
1204
|
-
const id = Number(cat?.id);
|
|
1205
|
-
const categoryId = Number(cat?.category_id);
|
|
1206
|
-
return (
|
|
1207
|
-
(!Number.isNaN(id) && categoryIdSet.has(id)) ||
|
|
1208
|
-
(!Number.isNaN(categoryId) && categoryIdSet.has(categoryId))
|
|
1209
|
-
);
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
private loadProgramsForEdit(
|
|
1213
|
-
programIds: number[],
|
|
1214
|
-
categoryIds: number[] = [],
|
|
1215
|
-
selectedProgramsMap?: Record<string, any[]>,
|
|
1216
|
-
programPayload?: { all_programs?: any[]; selected_programs?: any }
|
|
1217
|
-
): void {
|
|
1218
|
-
if (
|
|
1219
|
-
selectedProgramsMap &&
|
|
1220
|
-
typeof selectedProgramsMap === 'object' &&
|
|
1221
|
-
!Array.isArray(selectedProgramsMap) &&
|
|
1222
|
-
hasProgramSelectionInMap(selectedProgramsMap)
|
|
1223
|
-
) {
|
|
1224
|
-
this.applyProgramSelectionMap(selectedProgramsMap);
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
if (
|
|
1229
|
-
programPayload &&
|
|
1230
|
-
this.hydrateProgramsFromDashboardData({ program: programPayload })
|
|
1231
|
-
) {
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
if (!programIds.length && !categoryIds.length) {
|
|
1236
|
-
return;
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
const completeProgramHydration = () => this.finishEditHydration();
|
|
1240
|
-
if (this.mode === 'EDIT') {
|
|
1241
|
-
this.beginEditHydration();
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
this.createDashboardService.getSailsProgramList().subscribe({
|
|
1245
|
-
next: (res: any) => {
|
|
1246
|
-
const programs = parseSailsProgramList(res);
|
|
1247
|
-
const relevantPrograms =
|
|
1248
|
-
programIds.length > 0
|
|
1249
|
-
? programs.filter((p: any) => programIds.includes(Number(p?.id)))
|
|
1250
|
-
: programs;
|
|
1251
|
-
|
|
1252
|
-
if (!categoryIds.length) {
|
|
1253
|
-
if (programIds.length) {
|
|
1254
|
-
this.resolveProgramIdsForEdit(programIds, programs);
|
|
1255
|
-
}
|
|
1256
|
-
completeProgramHydration();
|
|
1257
|
-
return;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
const categoryIdSet = new Set(categoryIds);
|
|
1261
|
-
const programsToFetch =
|
|
1262
|
-
relevantPrograms.length > 0 ? relevantPrograms : programs;
|
|
1263
|
-
|
|
1264
|
-
if (!programsToFetch.length) {
|
|
1265
|
-
completeProgramHydration();
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
const categoryRequests = programsToFetch.map((program: any) =>
|
|
1270
|
-
this.createDashboardService.getProgramCategories(program.id).pipe(
|
|
1271
|
-
map((catRes: any) => ({
|
|
1272
|
-
program,
|
|
1273
|
-
categories: catRes?.data?.categories ?? catRes?.categories ?? [],
|
|
1274
|
-
}))
|
|
1275
|
-
)
|
|
1276
|
-
);
|
|
1277
|
-
forkJoin(categoryRequests)
|
|
1278
|
-
.pipe(finalize(() => completeProgramHydration()))
|
|
1279
|
-
.subscribe({
|
|
1280
|
-
next: (rawResults: unknown) => {
|
|
1281
|
-
const results = rawResults as Array<{
|
|
1282
|
-
program: any;
|
|
1283
|
-
categories: any[];
|
|
1284
|
-
}>;
|
|
1285
|
-
const map: Record<string, any[]> = {};
|
|
1286
|
-
results.forEach(({ program, categories }) => {
|
|
1287
|
-
const selected = (categories ?? []).filter((cat: any) =>
|
|
1288
|
-
this.categoryMatchesId(cat, categoryIdSet)
|
|
1289
|
-
);
|
|
1290
|
-
if (selected.length) {
|
|
1291
|
-
map[String(program.id)] = selected;
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
if (hasProgramSelectionInMap(map)) {
|
|
1295
|
-
this.applyProgramSelectionMap(map);
|
|
1296
|
-
} else if (this.allProgamSelected.length) {
|
|
1297
|
-
this.syncProgramSelectionMapFromForm();
|
|
1298
|
-
}
|
|
1299
|
-
},
|
|
1300
|
-
error: (err) => console.error(err),
|
|
1301
|
-
});
|
|
1302
|
-
},
|
|
1303
|
-
error: (err) => {
|
|
1304
|
-
console.error(err);
|
|
1305
|
-
completeProgramHydration();
|
|
1306
|
-
},
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
/** Custom dashboards often store program ids only — resolve names for form chips. */
|
|
1311
|
-
private resolveProgramIdsForEdit(
|
|
1312
|
-
programIds: number[],
|
|
1313
|
-
programsFromList?: any[]
|
|
1314
|
-
): void {
|
|
1315
|
-
if (!programIds.length) {
|
|
1316
|
-
return;
|
|
1317
|
-
}
|
|
1318
|
-
const apply = (programs: any[]) => {
|
|
1319
|
-
const matched = programs.filter((p: any) =>
|
|
1320
|
-
programIds.includes(Number(p?.id))
|
|
1321
|
-
);
|
|
1322
|
-
if (!matched.length) {
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
const chips = matched.map((p: any) => ({
|
|
1326
|
-
id: p.id,
|
|
1327
|
-
category_id: p.id,
|
|
1328
|
-
name: p.name,
|
|
1329
|
-
item_name: p.name,
|
|
1330
|
-
programId: p.id,
|
|
1331
|
-
}));
|
|
1332
|
-
this.allProgamSelected = normalizeProgramCategories(chips);
|
|
1333
|
-
this.dashboardForm.selectedResponsibilityCategories = [
|
|
1334
|
-
...this.allProgamSelected,
|
|
1335
|
-
];
|
|
1336
|
-
const map: Record<string, any[]> = {};
|
|
1337
|
-
matched.forEach((p: any) => {
|
|
1338
|
-
map[String(p.id)] = [];
|
|
1339
|
-
});
|
|
1340
|
-
this.selectedPrograms = map;
|
|
1341
|
-
this.cdr.detectChanges();
|
|
1342
|
-
};
|
|
1343
|
-
|
|
1344
|
-
if (programsFromList?.length) {
|
|
1345
|
-
apply(programsFromList);
|
|
1346
|
-
return;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
if (this.mode === 'EDIT') {
|
|
1350
|
-
this.beginEditHydration();
|
|
1351
|
-
}
|
|
1352
|
-
this.createDashboardService
|
|
1353
|
-
.getSailsProgramList()
|
|
1354
|
-
.pipe(finalize(() => this.finishEditHydration()))
|
|
1355
|
-
.subscribe({
|
|
1356
|
-
next: (res: any) => {
|
|
1357
|
-
apply(parseSailsProgramList(res));
|
|
1358
|
-
},
|
|
1359
|
-
error: (err) => console.error(err),
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
private buildEditDashboardData(): any {
|
|
1364
|
-
const row = this.dashboardDetails ?? {};
|
|
1365
|
-
const core = row?.dashboard_details ?? row?.dashboard ?? row;
|
|
1366
|
-
const programSource =
|
|
1367
|
-
core?.programs
|
|
1368
|
-
const rcSource =
|
|
1369
|
-
core?.responsibilityCenters
|
|
1370
|
-
|
|
1371
|
-
return {
|
|
1372
|
-
...row,
|
|
1373
|
-
...core,
|
|
1374
|
-
cdid: core?.cdid ?? row?.cdid,
|
|
1375
|
-
dashboard_name: core?.name ?? row?.dashboard_name,
|
|
1376
|
-
name: core?.name ?? row?.dashboard_name,
|
|
1377
|
-
description: core?.description ?? row?.description,
|
|
1378
|
-
viewers: core?.viewers ?? row?.viewers,
|
|
1379
|
-
visible_to_users: core?.visible_to_users ?? row?.visible_to_users,
|
|
1380
|
-
visible_to_groups: core?.visible_to_groups ?? row?.visible_to_groups,
|
|
1381
|
-
programs: programSource,
|
|
1382
|
-
programId: extractProgramIdsFromDashboard({
|
|
1383
|
-
programs: programSource,
|
|
1384
|
-
program: core?.program ?? row?.program,
|
|
1385
|
-
}),
|
|
1386
|
-
responsibility_category:
|
|
1387
|
-
core?.responsibility_category ??
|
|
1388
|
-
row?.responsibility_category ??
|
|
1389
|
-
core?.responsibilityCategory ??
|
|
1390
|
-
[],
|
|
1391
|
-
rcId: core.rcId,
|
|
1392
|
-
selectedRcEntries:
|
|
1393
|
-
row?.selectedRcEntries ??
|
|
1394
|
-
core?.selectedRcEntries ??
|
|
1395
|
-
[],
|
|
1396
|
-
responsibilityCenters: rcSource,
|
|
1397
|
-
responsibility_center: rcSource,
|
|
1398
|
-
responsibilityCenterId: core.rcId,
|
|
1399
|
-
program: core?.program ?? row?.program,
|
|
1400
|
-
timeframe:
|
|
1401
|
-
core?.timeframe ??
|
|
1402
|
-
(row?.time_frame_from || row?.time_frame_to
|
|
1403
|
-
? { from: row?.time_frame_from, to: row?.time_frame_to }
|
|
1404
|
-
: undefined),
|
|
1405
|
-
time_frame_from:
|
|
1406
|
-
core?.timeframe?.from ??
|
|
1407
|
-
core?.timeframe?.start_date ??
|
|
1408
|
-
row?.time_frame_from,
|
|
1409
|
-
time_frame_to:
|
|
1410
|
-
core?.timeframe?.to ?? core?.timeframe?.end_date ?? row?.time_frame_to,
|
|
1411
|
-
created_by: core?.createdBy ?? core?.created_by ?? row?.created_by,
|
|
1412
|
-
createdBy: core?.createdBy ?? core?.created_by ?? row?.createdBy,
|
|
1413
|
-
};
|
|
1414
|
-
}
|
|
1415
|
-
submitted = false;
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* Returns id's from a particular list elements
|
|
1419
|
-
* @param list actual selected list
|
|
1420
|
-
* @param key contains key to extract id from the list
|
|
1421
|
-
*/
|
|
1422
|
-
returnIds(list: any[], key: string) {
|
|
1423
|
-
return list?.map((ele) => {
|
|
1424
|
-
if (ele[key]) {
|
|
1425
|
-
return ele[key];
|
|
1426
|
-
}
|
|
1427
|
-
});
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
/**
|
|
1431
|
-
* Validates the data submitted on create dashboard form
|
|
1432
|
-
*/
|
|
1433
|
-
validateDashboard() {
|
|
1434
|
-
setTimeout(() => {
|
|
1435
|
-
this.submitted = true;
|
|
1436
|
-
}, 100);
|
|
1437
|
-
const event = this.dashboardForm.dashboardName;
|
|
1438
|
-
const re = / |<br>/g;
|
|
1439
|
-
this.dashboardForm.dashboardName = event.replace(re, '').trim();
|
|
1440
|
-
const description = this.dashboardForm.dashboardDescriptionText;
|
|
1441
|
-
this.dashboardForm.dashboardDescriptionText = description
|
|
1442
|
-
.replace(re, '')
|
|
1443
|
-
.trim();
|
|
1444
|
-
if (
|
|
1445
|
-
!this.dashboardForm.dashboardName ||
|
|
1446
|
-
this.dashboardForm.dashboardName.trim() == '' ||
|
|
1447
|
-
this.dashboardForm.dashboardName.length > 30 ||
|
|
1448
|
-
this.textCount.transform(this.dashboardForm?.dashboardDescriptionText) >
|
|
1449
|
-
250 ||
|
|
1450
|
-
(this.dashboardForm?.selectedFromDate &&
|
|
1451
|
-
!this.dashboardForm?.selectedToDate) ||
|
|
1452
|
-
(this.dashboardForm.selectedResponsibilityCenters.length == 0)
|
|
1453
|
-
) {
|
|
1454
|
-
return false;
|
|
1455
|
-
}
|
|
1456
|
-
return true;
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
/**
|
|
1460
|
-
* Makes an api call to create a dashboad
|
|
1461
|
-
* @param dashboard contains dashboardForm data
|
|
1462
|
-
*/
|
|
1463
|
-
submitDashboard() {
|
|
1464
|
-
this.submitted = false;
|
|
1465
|
-
const valid = this.validateDashboard();
|
|
1466
|
-
if (!valid) {
|
|
1467
|
-
return false;
|
|
1468
|
-
}
|
|
1469
|
-
this.vLoader = true;
|
|
1470
|
-
const dashboard = this.dashboardForm;
|
|
1471
|
-
const payload: any = {
|
|
1472
|
-
viewer: {
|
|
1473
|
-
userId: this.returnIds(dashboard.selectedViewers, 'uid'),
|
|
1474
|
-
userGroupId: this.returnIds(dashboard.selectedGroup, 'ugid'),
|
|
1475
|
-
},
|
|
1476
|
-
|
|
1477
|
-
widget_details: dashboard.configureWidget,
|
|
1478
|
-
dashboard_id: this.dashboardId,
|
|
1479
|
-
};
|
|
1480
|
-
|
|
1481
|
-
this.createDashboardService.saveWidgetDetails(payload).subscribe({
|
|
1482
|
-
next: (res: any) => {
|
|
1483
|
-
// saveWidgetDetails can return freshest bridge id; merge it for redirect.
|
|
1484
|
-
const widgetPayload = res?.data ?? res ?? {};
|
|
1485
|
-
this.createdDashboard = {
|
|
1486
|
-
...(this.createdDashboard ?? {}),
|
|
1487
|
-
...(widgetPayload?.dashboard ?? {}),
|
|
1488
|
-
cddid:
|
|
1489
|
-
this.createdDashboard?.cddid ??
|
|
1490
|
-
widgetPayload?.cddid ??
|
|
1491
|
-
widgetPayload?.cdid ??
|
|
1492
|
-
widgetPayload?.dashboard_bridge_id,
|
|
1493
|
-
cdid:
|
|
1494
|
-
this.createdDashboard?.cdid ??
|
|
1495
|
-
widgetPayload?.cdid ??
|
|
1496
|
-
widgetPayload?.cddid ??
|
|
1497
|
-
widgetPayload?.dashboard_bridge_id,
|
|
1498
|
-
dashboard_bridge_id:
|
|
1499
|
-
this.createdDashboard?.dashboard_bridge_id ??
|
|
1500
|
-
widgetPayload?.dashboard_bridge_id ??
|
|
1501
|
-
widgetPayload?.dashboardBridgeId,
|
|
1502
|
-
dashboardBridgeId:
|
|
1503
|
-
this.createdDashboard?.dashboardBridgeId ??
|
|
1504
|
-
widgetPayload?.dashboardBridgeId ??
|
|
1505
|
-
widgetPayload?.dashboard_bridge_id,
|
|
1506
|
-
};
|
|
1507
|
-
this.dashboardId = this.getCreatedDashboardCdid();
|
|
1508
|
-
this.vLoader = false;
|
|
1509
|
-
this.isSmiley = true;
|
|
1510
|
-
this.smileyMessage = this.mode === 'EDIT' ? 'The dashboard has been updated.' : 'The dashboard has been created.';
|
|
1511
|
-
setTimeout(() => {
|
|
1512
|
-
this.isSmiley = false;
|
|
1513
|
-
const cdid = this.getCreatedDashboardCdid();
|
|
1514
|
-
const closeMode = this.redirectAfterCreate
|
|
1515
|
-
? 'created'
|
|
1516
|
-
: this.mode === 'EDIT'
|
|
1517
|
-
? 'updated'
|
|
1518
|
-
: 'created';
|
|
1519
|
-
this.redirectAfterCreate = false;
|
|
1520
|
-
this.close.emit({
|
|
1521
|
-
mode: closeMode,
|
|
1522
|
-
id: cdid,
|
|
1523
|
-
cdid,
|
|
1524
|
-
dashboardBridgeId:
|
|
1525
|
-
this.createdDashboard?.dashboard_bridge_id ??
|
|
1526
|
-
this.createdDashboard?.dashboardBridgeId,
|
|
1527
|
-
dashboard: this.createdDashboard,
|
|
1528
|
-
});
|
|
1529
|
-
}, 3000);
|
|
1530
|
-
},
|
|
1531
|
-
error: (error: any) => {
|
|
1532
|
-
console.error('saveWidgetDetails error =>', error);
|
|
1533
|
-
this.snackBar.show(error.error.statusMessage, 'alert');
|
|
1534
|
-
this.vLoader = false;
|
|
1535
|
-
}
|
|
1536
|
-
})
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
closeContainer(message: string) {
|
|
1542
|
-
this.close.emit(message);
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
onSubmitDashboard() {
|
|
1546
|
-
const dashboard = this.dashboardForm;
|
|
1547
|
-
const payload: any = {
|
|
1548
|
-
dashboard_name: dashboard.dashboardName,
|
|
1549
|
-
description: [
|
|
1550
|
-
{
|
|
1551
|
-
content: dashboard.dashboardDescriptionText,
|
|
1552
|
-
attachments: [],
|
|
1553
|
-
},
|
|
1554
|
-
],
|
|
1555
|
-
visible_to_users: this.returnIds(dashboard.selectedViewers, 'uid'),
|
|
1556
|
-
visible_to_groups: this.returnIds(dashboard.selectedGroup, 'ugid'),
|
|
1557
|
-
responsibility_center: this.returnIds(
|
|
1558
|
-
dashboard.selectedResponsibilityCenters,
|
|
1559
|
-
'rcid'
|
|
1560
|
-
),
|
|
1561
|
-
responsibility_category: this.returnIds(
|
|
1562
|
-
dashboard.selectedResponsibilityCategories,
|
|
1563
|
-
'category_id'
|
|
1564
|
-
),
|
|
1565
|
-
risk_category: this.returnIds(
|
|
1566
|
-
dashboard.selectedRiskCategories,
|
|
1567
|
-
'category_id'
|
|
1568
|
-
),
|
|
1569
|
-
display_criteria:
|
|
1570
|
-
dashboard.displayCriteria === 'and'
|
|
1571
|
-
? 'BOTH_RC_AND_CATEGORY'
|
|
1572
|
-
: 'RC_OR_CATEGORY',
|
|
1573
|
-
|
|
1574
|
-
widget_details: dashboard.configureWidget,
|
|
1575
|
-
program: {
|
|
1576
|
-
all_programs: this.allProgamSelected,
|
|
1577
|
-
selected_programs: this.selectedPrograms,
|
|
1578
|
-
},
|
|
1579
|
-
timeframe: {
|
|
1580
|
-
start_date: dashboard.selectedFromDate
|
|
1581
|
-
? this.getDateFormate(dashboard?.selectedFromDate)
|
|
1582
|
-
: '',
|
|
1583
|
-
end_date: dashboard.selectedToDate
|
|
1584
|
-
? this.getDateFormate(dashboard?.selectedToDate)
|
|
1585
|
-
: '',
|
|
1586
|
-
},
|
|
1587
|
-
|
|
1588
|
-
};
|
|
1589
|
-
const createDashboardPayload = this.createDashboardService.buildPayload(payload);
|
|
1590
|
-
this.saveDashboard(createDashboardPayload);
|
|
1591
|
-
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
saveDashboard(payload: any) {
|
|
1595
|
-
let apiCall = this.createDashboardService.createDashboard(payload);
|
|
1596
|
-
if(this.mode === 'EDIT') {
|
|
1597
|
-
apiCall = this.createDashboardService.updateDashboard(payload, this.dashboardDetails?.recordId);
|
|
1598
|
-
}
|
|
1599
|
-
apiCall.subscribe({
|
|
1600
|
-
next: (res: any) => {
|
|
1601
|
-
const wasCreate = this.mode === 'CREATE';
|
|
1602
|
-
this.createdDashboard = res?.data?.dashboard ?? null;
|
|
1603
|
-
this.dashboardDetails = this.createdDashboard
|
|
1604
|
-
this.dashboardId = this.getCreatedDashboardCdid();
|
|
1605
|
-
this.dashboardDetails['recordId'] = this.createdDashboard?.id
|
|
1606
|
-
this.vLoader = false;
|
|
1607
|
-
this.openConfigureWidgets = true;
|
|
1608
|
-
this.showComplianceWidgets = false;
|
|
1609
|
-
if (wasCreate) {
|
|
1610
|
-
this.redirectAfterCreate = true;
|
|
1611
|
-
}
|
|
1612
|
-
this.mode = 'EDIT'
|
|
1613
|
-
|
|
1614
|
-
},
|
|
1615
|
-
error: (error: any) => {
|
|
1616
|
-
this.vLoader = false;
|
|
1617
|
-
if(error.status == 422) {
|
|
1618
|
-
this.snackBar.show(
|
|
1619
|
-
error.error.statusMessage,
|
|
1620
|
-
'alert'
|
|
1621
|
-
); }
|
|
1622
|
-
}
|
|
1623
|
-
})
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
private getCreatedDashboardCdid(): string {
|
|
1627
|
-
const dash = this.createdDashboard;
|
|
1628
|
-
const cdid =
|
|
1629
|
-
dash?.cddid ??
|
|
1630
|
-
dash?.cdid ??
|
|
1631
|
-
dash?.cdId ??
|
|
1632
|
-
dash?.dashboard_bridge_id ??
|
|
1633
|
-
dash?.dashboardBridgeId ??
|
|
1634
|
-
dash?.dashboard?.dashboard_bridge_id ??
|
|
1635
|
-
this.dashboardId;
|
|
1636
|
-
return cdid != null && cdid !== '' ? String(cdid) : '';
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
private hydrateEditForm(): void {
|
|
1640
|
-
if (this.editFormHydrated) {
|
|
1641
|
-
return;
|
|
1642
|
-
}
|
|
1643
|
-
this.editFormHydrated = true;
|
|
1644
|
-
this.editDashboard();
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
private applyWidgetsFromGetWidgetsResponse(widgets: {
|
|
1648
|
-
widgetArr: any[];
|
|
1649
|
-
allWidgetsArray: any[];
|
|
1650
|
-
}): void {
|
|
1651
|
-
const savedWidgets = filterActiveWidgets(widgets?.widgetArr ?? []);
|
|
1652
|
-
const catalogWidgets = widgets?.allWidgetsArray?.length
|
|
1653
|
-
? widgets.allWidgetsArray
|
|
1654
|
-
: savedWidgets;
|
|
1655
|
-
this.dashboardForm.configureWidget = savedWidgets;
|
|
1656
|
-
this.selectedWidgets = [...savedWidgets];
|
|
1657
|
-
this.displayedWidgets = [...catalogWidgets];
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
/** EDIT mode only: GET getWidgets?dashboardId={cdid} */
|
|
1661
|
-
private loadEditModeWidgets(cdid: string): void {
|
|
1662
|
-
if (this.mode !== 'EDIT' || !cdid) {
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
this.wrapEditRequest(
|
|
1666
|
-
this.createDashboardService.fetchCustomDashboardWidgetDetails(cdid),
|
|
1667
|
-
(widgets) => {
|
|
1668
|
-
this.applyWidgetsFromGetWidgetsResponse(widgets);
|
|
1669
|
-
this.cdr.detectChanges();
|
|
1670
|
-
}
|
|
1671
|
-
);
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
editDashboard() {
|
|
1675
|
-
this.vLoader = true;
|
|
1676
|
-
if (this.mode === 'EDIT') {
|
|
1677
|
-
this.editHydrationCount = 0;
|
|
1678
|
-
}
|
|
1679
|
-
const data = this.buildEditDashboardData();
|
|
1680
|
-
this.pendingEditRcEntries =
|
|
1681
|
-
data?.selectedRcEntries ??
|
|
1682
|
-
this.dashboardDetails?.selectedRcEntries ??
|
|
1683
|
-
[];
|
|
1684
|
-
const editCdid = getEditDashboardCdid(
|
|
1685
|
-
data,
|
|
1686
|
-
this.dashboardDetails,
|
|
1687
|
-
this.dashboardId
|
|
1688
|
-
);
|
|
1689
|
-
|
|
1690
|
-
this.listDetails.nonRemovableUsersList = [
|
|
1691
|
-
data?.createdBy ?? data?.created_by,
|
|
1692
|
-
].filter((x) => x != null);
|
|
1693
|
-
this.populateDashboardForm(data);
|
|
1694
|
-
|
|
1695
|
-
if (this.mode === 'EDIT' && editCdid) {
|
|
1696
|
-
this.loadEditModeWidgets(editCdid);
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
this.tryCompleteEditHydration();
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
populateDashboardForm(data: any) {
|
|
1703
|
-
try {
|
|
1704
|
-
const descriptionBlock = Array.isArray(data?.description)
|
|
1705
|
-
? data.description[0]
|
|
1706
|
-
: null;
|
|
1707
|
-
const descriptionText =
|
|
1708
|
-
descriptionBlock?.content ??
|
|
1709
|
-
(typeof data?.description === 'string' ? data.description : '') ??
|
|
1710
|
-
data?.dashboardDescriptionText ??
|
|
1711
|
-
'';
|
|
1712
|
-
|
|
1713
|
-
const visibleUsers = data?.visible_to_users ?? data?.viewers?.userId ?? [];
|
|
1714
|
-
const visibleUserIds = data?.viewers?.userId ?? [];
|
|
1715
|
-
const visibleGroups = data?.viewers?.userGroupId ?? [];
|
|
1716
|
-
const visibleGroupIds = data?.viewers?.userGroupId ?? [];
|
|
1717
|
-
this.pendingEditRcEntries =
|
|
1718
|
-
data?.selectedRcEntries ??
|
|
1719
|
-
this.dashboardDetails?.selectedRcEntries ??
|
|
1720
|
-
[];
|
|
1721
|
-
this.pendingEditRcIds = extractRcIdsFromDashboard(data);
|
|
1722
|
-
this.applyPreresolvedRcEntries();
|
|
1723
|
-
const riskCategories = data?.risk_category ?? [];
|
|
1724
|
-
const riskCategoryIds = (riskCategories ?? []).map((risk: any) =>
|
|
1725
|
-
typeof risk === 'object' ? risk?.category_id ?? risk?.id : risk
|
|
1726
|
-
);
|
|
1727
|
-
const startDate =
|
|
1728
|
-
data?.timeframe?.start_date ??
|
|
1729
|
-
data?.timeframe?.from ??
|
|
1730
|
-
data?.time_frame_from;
|
|
1731
|
-
const endDate =
|
|
1732
|
-
data?.timeframe?.end_date ??
|
|
1733
|
-
data?.timeframe?.to ??
|
|
1734
|
-
data?.time_frame_to;
|
|
1735
|
-
this.dashboardForm.dashboardName =
|
|
1736
|
-
data?.dashboard_name ?? data?.name ?? '';
|
|
1737
|
-
this.dashboardForm.dashboardDescriptionText = descriptionText;
|
|
1738
|
-
this.dashboardForm.selectedViewers = this.setListByIds(
|
|
1739
|
-
this.usersList,
|
|
1740
|
-
visibleUserIds,
|
|
1741
|
-
['member_id', 'uid', 'id']
|
|
1742
|
-
);
|
|
1743
|
-
this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
|
|
1744
|
-
this.dashboardForm.selectedGroup = this.setListByIds(
|
|
1745
|
-
this.groupList,
|
|
1746
|
-
visibleGroupIds,
|
|
1747
|
-
['group_id', 'ugid', 'id']
|
|
1748
|
-
);
|
|
1749
|
-
this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
|
|
1750
|
-
this.applyPendingResponsibilityCenters();
|
|
1751
|
-
this.syncProgramsForEdit(data);
|
|
1752
|
-
this.dashboardForm.selectedRiskCategories =
|
|
1753
|
-
this.setList(
|
|
1754
|
-
this.allRiskCategories,
|
|
1755
|
-
riskCategoryIds,
|
|
1756
|
-
'category_id'
|
|
1757
|
-
);
|
|
1758
|
-
this.dashboardForm.displayCriteria =
|
|
1759
|
-
data?.display_criteria === 'BOTH_RC_AND_CATEGORY' ? 'and' : 'or';
|
|
1760
|
-
this.dashboardForm.selectedFromDate = startDate
|
|
1761
|
-
? new Date(startDate)
|
|
1762
|
-
: undefined;
|
|
1763
|
-
this.dashboardForm.selectedToDate = endDate
|
|
1764
|
-
? new Date(endDate)
|
|
1765
|
-
: undefined;
|
|
1766
|
-
if (this.mode !== 'EDIT') {
|
|
1767
|
-
this.vLoader = false;
|
|
1768
|
-
const widgetDetailsRaw =
|
|
1769
|
-
data?.widget_details ?? data?.widgets ?? [];
|
|
1770
|
-
const widgetDetails = Array.isArray(widgetDetailsRaw)
|
|
1771
|
-
? widgetDetailsRaw
|
|
1772
|
-
: [];
|
|
1773
|
-
const allWidgetsRaw = data?.all_widgets ?? widgetDetails;
|
|
1774
|
-
const allWidgets = Array.isArray(allWidgetsRaw) ? allWidgetsRaw : [];
|
|
1775
|
-
this.dashboardForm.configureWidget = widgetDetails;
|
|
1776
|
-
this.selectedWidgets =
|
|
1777
|
-
widgetDetails.length > 0 ? [...new Set(widgetDetails)] : [];
|
|
1778
|
-
this.displayedWidgets =
|
|
1779
|
-
allWidgets.length > 0 ? [...new Set(allWidgets)] : [];
|
|
1780
|
-
}
|
|
1781
|
-
if (startDate) {
|
|
1782
|
-
const minToDate = this.setToDate(startDate);
|
|
1783
|
-
this.toDatePickerConfig = { min: minToDate };
|
|
1784
|
-
}
|
|
1785
|
-
this.hideToDate = true;
|
|
1786
|
-
setTimeout(() => {
|
|
1787
|
-
this.hideToDate = false;
|
|
1788
|
-
}, 20);
|
|
1789
|
-
this.cdr.detectChanges();
|
|
1790
|
-
} catch (error) {
|
|
1791
|
-
console.error('populate dashboard error =>', error);
|
|
1792
|
-
this.vLoader = false;
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
ngAfterViewChecked() {
|
|
1798
|
-
//your code to update the model
|
|
1799
|
-
this.cdr.detectChanges();
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
setPermission(roleActions: any) {
|
|
1803
|
-
let ifExistRisk = roleActions?.find((el: any) => el.moduleName == 'risk');
|
|
1804
|
-
ifExistRisk?.subModule?.forEach((module: any) => {
|
|
1805
|
-
module?.permissions?.forEach((permission: any) => {
|
|
1806
|
-
switch (permission?.code) {
|
|
1807
|
-
case 'RRMR': {
|
|
1808
|
-
if (permission?.defaultPermission == 1 || permission?.enable == 1) {
|
|
1809
|
-
this.isManageRisk = true;
|
|
1810
|
-
}
|
|
1811
|
-
break;
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
});
|
|
1815
|
-
});
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
getElementClassName(el: any): string {
|
|
1819
|
-
if (!el) return '';
|
|
1820
|
-
if (typeof el?.className === 'string') return el?.className;
|
|
1821
|
-
if (typeof el?.className === 'object' && 'baseVal' in el?.className) {
|
|
1822
|
-
return el?.className?.baseVal;
|
|
1823
|
-
}
|
|
1824
|
-
return '';
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
@HostListener('document:click', ['$event'])
|
|
1828
|
-
documentClick(event: any): void {
|
|
1829
|
-
const targetElement = event?.target as Element;
|
|
1830
|
-
const fromDateInputElement =
|
|
1831
|
-
document.getElementById(this.openedDatePicker.toLowerCase()) || null;
|
|
1832
|
-
const datePickerCalendarContainer = document.getElementsByClassName(
|
|
1833
|
-
'dp-day-calendar-container'
|
|
1834
|
-
)[0];
|
|
1835
|
-
const monthYearElement = document.querySelector(
|
|
1836
|
-
'.dp-month-calendar-container'
|
|
1837
|
-
);
|
|
1838
|
-
const isNotMonthYearElement = !monthYearElement?.contains(targetElement);
|
|
1839
|
-
|
|
1840
|
-
const openedElement =
|
|
1841
|
-
this.openedDatePicker === 'FROM_DATE'
|
|
1842
|
-
? this.fromDatePickerPopup
|
|
1843
|
-
: this.toDatePickerPopup;
|
|
1844
|
-
const isOutsideFromDateInput =
|
|
1845
|
-
!openedElement?.nativeElement?.contains(targetElement);
|
|
1846
|
-
const isNotFromDateElement = event?.target !== fromDateInputElement;
|
|
1847
|
-
const isNotInsideCalendar =
|
|
1848
|
-
!datePickerCalendarContainer?.contains(targetElement);
|
|
1849
|
-
const selectedDatePicker =
|
|
1850
|
-
this.openedDatePicker === 'FROM_DATE'
|
|
1851
|
-
? this.fromDatePicker
|
|
1852
|
-
: this.toDatePicker;
|
|
1853
|
-
|
|
1854
|
-
const className = this.getElementClassName(targetElement);
|
|
1855
|
-
const isNotCalendarMonth = !className?.includes('dp-calendar-month');
|
|
1856
|
-
|
|
1857
|
-
if (
|
|
1858
|
-
isOutsideFromDateInput &&
|
|
1859
|
-
isNotFromDateElement &&
|
|
1860
|
-
isNotInsideCalendar &&
|
|
1861
|
-
isNotCalendarMonth &&
|
|
1862
|
-
isNotMonthYearElement &&
|
|
1863
|
-
datePickerCalendarContainer
|
|
1864
|
-
) {
|
|
1865
|
-
this.documentClickListener(
|
|
1866
|
-
event.target,
|
|
1867
|
-
openedElement,
|
|
1868
|
-
selectedDatePicker
|
|
1869
|
-
);
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
documentClickListener(
|
|
1874
|
-
target: any,
|
|
1875
|
-
openedElements: ElementRef,
|
|
1876
|
-
selectedDatePicker: any
|
|
1877
|
-
): void {
|
|
1878
|
-
if (
|
|
1879
|
-
!openedElements?.nativeElement?.contains(target) &&
|
|
1880
|
-
selectedDatePicker?.areCalendarsShown
|
|
1881
|
-
) {
|
|
1882
|
-
selectedDatePicker?.api?.close();
|
|
1883
|
-
this.datePickerOverlay = false;
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
}
|