tango-app-ui-analyse-trax 3.9.2 → 3.9.3
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/.eslintrc.json +37 -0
- package/ng-package.json +7 -0
- package/package.json +12 -25
- package/src/lib/components/action-centre/action-centre.component.html +607 -0
- package/src/lib/components/action-centre/action-centre.component.scss +185 -0
- package/src/lib/components/action-centre/action-centre.component.spec.ts +23 -0
- package/src/lib/components/action-centre/action-centre.component.ts +279 -0
- package/src/lib/components/activity-log/activity-log.component.html +84 -0
- package/src/lib/components/activity-log/activity-log.component.scss +33 -0
- package/src/lib/components/activity-log/activity-log.component.spec.ts +23 -0
- package/src/lib/components/activity-log/activity-log.component.ts +137 -0
- package/src/lib/components/activity-log-v2/activity-log-v2.component.html +189 -0
- package/src/lib/components/activity-log-v2/activity-log-v2.component.scss +162 -0
- package/src/lib/components/activity-log-v2/activity-log-v2.component.spec.ts +23 -0
- package/src/lib/components/activity-log-v2/activity-log-v2.component.ts +517 -0
- package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.html +19 -0
- package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.scss +148 -0
- package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.spec.ts +23 -0
- package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.ts +141 -0
- package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.html +42 -0
- package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.scss +49 -0
- package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.spec.ts +23 -0
- package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.ts +22 -0
- package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.html +724 -0
- package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.scss +217 -0
- package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.spec.ts +23 -0
- package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.ts +122 -0
- package/src/lib/components/add-checklist/add-checklist.component.html +1459 -0
- package/src/lib/components/add-checklist/add-checklist.component.scss +1205 -0
- package/src/lib/components/add-checklist/add-checklist.component.spec.ts +23 -0
- package/src/lib/components/add-checklist/add-checklist.component.ts +2460 -0
- package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.html +207 -0
- package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.scss +213 -0
- package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.spec.ts +23 -0
- package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.ts +621 -0
- package/src/lib/components/add-checklist/counter/counter.component.html +43 -0
- package/src/lib/components/add-checklist/counter/counter.component.scss +49 -0
- package/src/lib/components/add-checklist/counter/counter.component.spec.ts +23 -0
- package/src/lib/components/add-checklist/counter/counter.component.ts +123 -0
- package/src/lib/components/add-multitask/add-multitask.component.html +705 -0
- package/src/lib/components/add-multitask/add-multitask.component.scss +296 -0
- package/src/lib/components/add-multitask/add-multitask.component.spec.ts +23 -0
- package/src/lib/components/add-multitask/add-multitask.component.ts +611 -0
- package/src/lib/components/add-multitask/ascending-validator.ts +13 -0
- package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.html +197 -0
- package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.scss +31 -0
- package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.spec.ts +23 -0
- package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.ts +285 -0
- package/src/lib/components/add-multitask/create-task.data.ts +374 -0
- package/src/lib/components/add-multitask/create-task.interface.ts +177 -0
- package/src/lib/components/add-multitask/unique-string-validator.ts +13 -0
- package/src/lib/components/add-multitask/whitespace-validator.ts +11 -0
- package/src/lib/components/add-task/add-task.component.html +654 -0
- package/src/lib/components/add-task/add-task.component.scss +536 -0
- package/src/lib/components/add-task/add-task.component.spec.ts +23 -0
- package/src/lib/components/add-task/add-task.component.ts +569 -0
- package/src/lib/components/add-task/ascending-validator.ts +13 -0
- package/src/lib/components/add-task/create-task.data.ts +374 -0
- package/src/lib/components/add-task/create-task.interface.ts +192 -0
- package/src/lib/components/add-task/unique-string-validator.ts +13 -0
- package/src/lib/components/add-task/whitespace-validator.ts +11 -0
- package/src/lib/components/approval-popup/approval-popup.component.html +25 -0
- package/src/lib/components/approval-popup/approval-popup.component.scss +3 -0
- package/src/lib/components/approval-popup/approval-popup.component.spec.ts +23 -0
- package/src/lib/components/approval-popup/approval-popup.component.ts +26 -0
- package/src/lib/components/checklist/checklist.component.html +330 -0
- package/src/lib/components/checklist/checklist.component.scss +112 -0
- package/src/lib/components/checklist/checklist.component.spec.ts +23 -0
- package/src/lib/components/checklist/checklist.component.ts +344 -0
- package/src/lib/components/checklist-configure/assign/assign.component.html +665 -0
- package/src/lib/components/checklist-configure/assign/assign.component.scss +219 -0
- package/src/lib/components/checklist-configure/assign/assign.component.spec.ts +23 -0
- package/src/lib/components/checklist-configure/assign/assign.component.ts +932 -0
- package/src/lib/components/checklist-configure/checklist-configure.component.html +4340 -0
- package/src/lib/components/checklist-configure/checklist-configure.component.scss +2338 -0
- package/src/lib/components/checklist-configure/checklist-configure.component.spec.ts +23 -0
- package/src/lib/components/checklist-configure/checklist-configure.component.ts +4659 -0
- package/src/lib/components/checklistlayout/checklistlayout.component.html +30 -0
- package/src/lib/components/checklistlayout/checklistlayout.component.scss +15 -0
- package/src/lib/components/checklistlayout/checklistlayout.component.spec.ts +23 -0
- package/src/lib/components/checklistlayout/checklistlayout.component.ts +47 -0
- package/src/lib/components/chip-dropdown/chip-dropdown.component.html +36 -0
- package/src/lib/components/chip-dropdown/chip-dropdown.component.scss +97 -0
- package/src/lib/components/chip-dropdown/chip-dropdown.component.spec.ts +23 -0
- package/src/lib/components/chip-dropdown/chip-dropdown.component.ts +125 -0
- package/src/lib/components/create-task/create-task.component.html +2003 -0
- package/src/lib/components/create-task/create-task.component.scss +272 -0
- package/src/lib/components/create-task/create-task.component.spec.ts +23 -0
- package/src/lib/components/create-task/create-task.component.ts +614 -0
- package/src/lib/components/create-task/create-task.data.ts +372 -0
- package/src/lib/components/create-task/create-task.interface.ts +182 -0
- package/src/lib/components/create-task/validators/ascending-validator.ts +13 -0
- package/src/lib/components/create-task/validators/unique-string-validator.ts +13 -0
- package/src/lib/components/create-task/validators/whitespace-validator.ts +11 -0
- package/src/lib/components/custom-select/custom-select.component.html +44 -0
- package/src/lib/components/custom-select/custom-select.component.scss +144 -0
- package/src/lib/components/custom-select/custom-select.component.spec.ts +23 -0
- package/src/lib/components/custom-select/custom-select.component.ts +265 -0
- package/src/lib/components/dashboard/dashboard.component.html +1076 -0
- package/src/lib/components/dashboard/dashboard.component.scss +237 -0
- package/src/lib/components/dashboard/dashboard.component.spec.ts +23 -0
- package/src/lib/components/dashboard/dashboard.component.ts +539 -0
- package/src/lib/components/dashboard-info/dashboard-info.component.html +1420 -0
- package/src/lib/components/dashboard-info/dashboard-info.component.scss +409 -0
- package/src/lib/components/dashboard-info/dashboard-info.component.spec.ts +23 -0
- package/src/lib/components/dashboard-info/dashboard-info.component.ts +772 -0
- package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.html +110 -0
- package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.scss +260 -0
- package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.spec.ts +23 -0
- package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.ts +143 -0
- package/src/lib/components/dashboard-layout/dashboard-layout.component.html +1 -0
- package/src/lib/components/dashboard-layout/dashboard-layout.component.scss +0 -0
- package/src/lib/components/dashboard-layout/dashboard-layout.component.spec.ts +23 -0
- package/src/lib/components/dashboard-layout/dashboard-layout.component.ts +10 -0
- package/src/lib/components/disabled-select/disabled-select.component.html +44 -0
- package/src/lib/components/disabled-select/disabled-select.component.scss +149 -0
- package/src/lib/components/disabled-select/disabled-select.component.spec.ts +23 -0
- package/src/lib/components/disabled-select/disabled-select.component.ts +146 -0
- package/src/lib/components/export-gallery/export-gallery.component.html +175 -0
- package/src/lib/components/export-gallery/export-gallery.component.scss +200 -0
- package/src/lib/components/export-gallery/export-gallery.component.spec.ts +23 -0
- package/src/lib/components/export-gallery/export-gallery.component.ts +263 -0
- package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.html +36 -0
- package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.scss +97 -0
- package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.ts +104 -0
- package/src/lib/components/eye-test-audit/custom-select/custom-select.component.html +44 -0
- package/src/lib/components/eye-test-audit/custom-select/custom-select.component.scss +144 -0
- package/src/lib/components/eye-test-audit/custom-select/custom-select.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/custom-select/custom-select.component.ts +265 -0
- package/src/lib/components/eye-test-audit/eye-test/eye-test.component.html +1804 -0
- package/src/lib/components/eye-test-audit/eye-test/eye-test.component.scss +806 -0
- package/src/lib/components/eye-test-audit/eye-test/eye-test.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/eye-test/eye-test.component.ts +1890 -0
- package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.html +25 -0
- package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.scss +0 -0
- package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.ts +20 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit-routing.module.ts +26 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.html +1 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.scss +0 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.ts +24 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.module.ts +44 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.html +490 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.scss +721 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.ts +1017 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.html +708 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.scss +247 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.ts +446 -0
- package/src/lib/components/eye-test-audit/group-select/group-select.component.html +44 -0
- package/src/lib/components/eye-test-audit/group-select/group-select.component.scss +144 -0
- package/src/lib/components/eye-test-audit/group-select/group-select.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/group-select/group-select.component.ts +147 -0
- package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.html +18 -0
- package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.scss +49 -0
- package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.ts +104 -0
- package/src/lib/components/eye-test-audit/select-drop/select-drop.component.html +44 -0
- package/src/lib/components/eye-test-audit/select-drop/select-drop.component.scss +144 -0
- package/src/lib/components/eye-test-audit/select-drop/select-drop.component.spec.ts +23 -0
- package/src/lib/components/eye-test-audit/select-drop/select-drop.component.ts +152 -0
- package/src/lib/components/eye-test-audit/services/eye-test-audit.service.spec.ts +16 -0
- package/src/lib/components/eye-test-audit/services/eye-test-audit.service.ts +190 -0
- package/src/lib/components/flag-layout/flag-layout.component.html +1 -0
- package/src/lib/components/flag-layout/flag-layout.component.scss +0 -0
- package/src/lib/components/flag-layout/flag-layout.component.spec.ts +23 -0
- package/src/lib/components/flag-layout/flag-layout.component.ts +10 -0
- package/src/lib/components/flags/flags.component.html +473 -0
- package/src/lib/components/flags/flags.component.scss +86 -0
- package/src/lib/components/flags/flags.component.spec.ts +23 -0
- package/src/lib/components/flags/flags.component.ts +280 -0
- package/{lib/components/flags/flags.interface.d.ts → src/lib/components/flags/flags.interface.ts} +73 -65
- package/src/lib/components/flags-info/flags-info.component.html +6012 -0
- package/src/lib/components/flags-info/flags-info.component.scss +278 -0
- package/src/lib/components/flags-info/flags-info.component.spec.ts +23 -0
- package/src/lib/components/flags-info/flags-info.component.ts +490 -0
- package/src/lib/components/flags-info/flags-info.interface.ts +441 -0
- package/src/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.html +1 -0
- package/src/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.scss +4 -0
- package/src/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.ts +78 -0
- package/src/lib/components/flags-new/flags-new.component.html +904 -0
- package/src/lib/components/flags-new/flags-new.component.scss +121 -0
- package/src/lib/components/flags-new/flags-new.component.spec.ts +23 -0
- package/src/lib/components/flags-new/flags-new.component.ts +357 -0
- package/{lib/components/flags-new/flags-new.interface.d.ts → src/lib/components/flags-new/flags-new.interface.ts} +90 -81
- package/src/lib/components/gallery/gallery.component.html +3660 -0
- package/src/lib/components/gallery/gallery.component.scss +930 -0
- package/src/lib/components/gallery/gallery.component.ts +3527 -0
- package/src/lib/components/group-select/group-select.component.html +44 -0
- package/src/lib/components/group-select/group-select.component.scss +144 -0
- package/src/lib/components/group-select/group-select.component.spec.ts +23 -0
- package/src/lib/components/group-select/group-select.component.ts +145 -0
- package/src/lib/components/image-popup/image-popup.component.html +11 -0
- package/src/lib/components/image-popup/image-popup.component.scss +5 -0
- package/src/lib/components/image-popup/image-popup.component.ts +18 -0
- package/src/lib/components/lib/custom-select/custom-select.component.html +42 -0
- package/src/lib/components/lib/custom-select/custom-select.component.scss +131 -0
- package/src/lib/components/lib/custom-select/custom-select.component.spec.ts +23 -0
- package/src/lib/components/lib/custom-select/custom-select.component.ts +151 -0
- package/src/lib/components/manage-task/manage-task.component.html +265 -0
- package/src/lib/components/manage-task/manage-task.component.scss +69 -0
- package/src/lib/components/manage-task/manage-task.component.spec.ts +23 -0
- package/src/lib/components/manage-task/manage-task.component.ts +267 -0
- package/src/lib/components/managechecklist/managechecklist.component.html +176 -0
- package/src/lib/components/managechecklist/managechecklist.component.scss +43 -0
- package/src/lib/components/managechecklist/managechecklist.component.spec.ts +23 -0
- package/src/lib/components/managechecklist/managechecklist.component.ts +176 -0
- package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.html +46 -0
- package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.scss +181 -0
- package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.spec.ts +23 -0
- package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.ts +221 -0
- package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.html +36 -0
- package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.scss +89 -0
- package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.spec.ts +23 -0
- package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.ts +118 -0
- package/src/lib/components/orders/orders.component.html +203 -0
- package/src/lib/components/orders/orders.component.scss +180 -0
- package/src/lib/components/orders/orders.component.spec.ts +25 -0
- package/src/lib/components/orders/orders.component.ts +197 -0
- package/src/lib/components/pagination/pagination.component.html +28 -0
- package/src/lib/components/pagination/pagination.component.scss +6 -0
- package/src/lib/components/pagination/pagination.component.spec.ts +23 -0
- package/src/lib/components/pagination/pagination.component.ts +54 -0
- package/src/lib/components/reactive-select/reactive-select.component.html +18 -0
- package/src/lib/components/reactive-select/reactive-select.component.scss +48 -0
- package/src/lib/components/reactive-select/reactive-select.component.spec.ts +23 -0
- package/src/lib/components/reactive-select/reactive-select.component.ts +104 -0
- package/src/lib/components/reports/date-picker/date-picker.component.html +54 -0
- package/src/lib/components/reports/date-picker/date-picker.component.scss +156 -0
- package/src/lib/components/reports/date-picker/date-picker.component.spec.ts +23 -0
- package/src/lib/components/reports/date-picker/date-picker.component.ts +60 -0
- package/src/lib/components/reports/reports.component.html +225 -0
- package/src/lib/components/reports/reports.component.scss +69 -0
- package/src/lib/components/reports/reports.component.spec.ts +23 -0
- package/src/lib/components/reports/reports.component.ts +334 -0
- package/{lib/components/reports/reports.interface.d.ts → src/lib/components/reports/reports.interface.ts} +50 -46
- package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.html +1 -0
- package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.scss +15 -0
- package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.spec.ts +23 -0
- package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.ts +31 -0
- package/src/lib/components/task/task.component.html +322 -0
- package/src/lib/components/task/task.component.scss +169 -0
- package/src/lib/components/task/task.component.spec.ts +23 -0
- package/src/lib/components/task/task.component.ts +340 -0
- package/src/lib/components/task-configure/task-configure.component.html +737 -0
- package/src/lib/components/task-configure/task-configure.component.scss +569 -0
- package/src/lib/components/task-configure/task-configure.component.spec.ts +23 -0
- package/src/lib/components/task-configure/task-configure.component.ts +1603 -0
- package/src/lib/components/task-configure/task-configure.interface.ts +138 -0
- package/src/lib/components/task-info/task-info.component.html +390 -0
- package/src/lib/components/task-info/task-info.component.scss +56 -0
- package/src/lib/components/task-info/task-info.component.spec.ts +23 -0
- package/src/lib/components/task-info/task-info.component.ts +400 -0
- package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.html +141 -0
- package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.scss +460 -0
- package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.spec.ts +23 -0
- package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.ts +202 -0
- package/src/lib/components/task-layout/task-layout.component.html +1 -0
- package/src/lib/components/task-layout/task-layout.component.scss +0 -0
- package/src/lib/components/task-layout/task-layout.component.spec.ts +23 -0
- package/src/lib/components/task-layout/task-layout.component.ts +10 -0
- package/src/lib/components/task-logs/task-logs.component.html +97 -0
- package/src/lib/components/task-logs/task-logs.component.scss +301 -0
- package/src/lib/components/task-logs/task-logs.component.spec.ts +23 -0
- package/src/lib/components/task-logs/task-logs.component.ts +80 -0
- package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.html +84 -0
- package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.scss +229 -0
- package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.spec.ts +23 -0
- package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.ts +111 -0
- package/src/lib/components/trax-store/trax-store.component.html +78 -0
- package/src/lib/components/trax-store/trax-store.component.scss +134 -0
- package/src/lib/components/trax-store/trax-store.component.spec.ts +23 -0
- package/src/lib/components/trax-store/trax-store.component.ts +172 -0
- package/src/lib/components/traxpopup/traxpopup.component.html +130 -0
- package/src/lib/components/traxpopup/traxpopup.component.scss +225 -0
- package/src/lib/components/traxpopup/traxpopup.component.spec.ts +23 -0
- package/src/lib/components/traxpopup/traxpopup.component.ts +71 -0
- package/src/lib/services/trax.service.spec.ts +16 -0
- package/src/lib/services/trax.service.ts +789 -0
- package/src/lib/tango-analyse-trax-routing.module.ts +151 -0
- package/src/lib/tango-analyse-trax.module.ts +140 -0
- package/{public-api.d.ts → src/public-api.ts} +6 -2
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2022/lib/components/action-centre/action-centre.component.mjs +0 -288
- package/esm2022/lib/components/activity-log/activity-log.component.mjs +0 -150
- package/esm2022/lib/components/activity-log-v2/activity-log-v2.component.mjs +0 -502
- package/esm2022/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.mjs +0 -114
- package/esm2022/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.mjs +0 -24
- package/esm2022/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.mjs +0 -126
- package/esm2022/lib/components/add-checklist/add-checklist.component.mjs +0 -2352
- package/esm2022/lib/components/add-checklist/checklist-popup/checklist-popup.component.mjs +0 -612
- package/esm2022/lib/components/add-checklist/counter/counter.component.mjs +0 -138
- package/esm2022/lib/components/add-multitask/add-multitask.component.mjs +0 -604
- package/esm2022/lib/components/add-multitask/ascending-validator.mjs +0 -11
- package/esm2022/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.mjs +0 -297
- package/esm2022/lib/components/add-multitask/create-task.data.mjs +0 -372
- package/esm2022/lib/components/add-multitask/create-task.interface.mjs +0 -2
- package/esm2022/lib/components/add-multitask/unique-string-validator.mjs +0 -10
- package/esm2022/lib/components/add-multitask/whitespace-validator.mjs +0 -10
- package/esm2022/lib/components/add-task/add-task.component.mjs +0 -561
- package/esm2022/lib/components/add-task/ascending-validator.mjs +0 -11
- package/esm2022/lib/components/add-task/create-task.data.mjs +0 -372
- package/esm2022/lib/components/add-task/create-task.interface.mjs +0 -2
- package/esm2022/lib/components/add-task/unique-string-validator.mjs +0 -10
- package/esm2022/lib/components/add-task/whitespace-validator.mjs +0 -10
- package/esm2022/lib/components/approval-popup/approval-popup.component.mjs +0 -30
- package/esm2022/lib/components/checklist/checklist.component.mjs +0 -327
- package/esm2022/lib/components/checklist-configure/assign/assign.component.mjs +0 -912
- package/esm2022/lib/components/checklist-configure/checklist-configure.component.mjs +0 -4161
- package/esm2022/lib/components/checklistlayout/checklistlayout.component.mjs +0 -44
- package/esm2022/lib/components/chip-dropdown/chip-dropdown.component.mjs +0 -120
- package/esm2022/lib/components/create-task/create-task.component.mjs +0 -585
- package/esm2022/lib/components/create-task/create-task.data.mjs +0 -372
- package/esm2022/lib/components/create-task/create-task.interface.mjs +0 -2
- package/esm2022/lib/components/create-task/validators/ascending-validator.mjs +0 -11
- package/esm2022/lib/components/create-task/validators/unique-string-validator.mjs +0 -10
- package/esm2022/lib/components/create-task/validators/whitespace-validator.mjs +0 -10
- package/esm2022/lib/components/custom-select/custom-select.component.mjs +0 -240
- package/esm2022/lib/components/dashboard/dashboard.component.mjs +0 -532
- package/esm2022/lib/components/dashboard-info/dashboard-info.component.mjs +0 -741
- package/esm2022/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.mjs +0 -155
- package/esm2022/lib/components/dashboard-layout/dashboard-layout.component.mjs +0 -12
- package/esm2022/lib/components/disabled-select/disabled-select.component.mjs +0 -158
- package/esm2022/lib/components/export-gallery/export-gallery.component.mjs +0 -266
- package/esm2022/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.mjs +0 -105
- package/esm2022/lib/components/eye-test-audit/custom-select/custom-select.component.mjs +0 -240
- package/esm2022/lib/components/eye-test-audit/eye-test/eye-test.component.mjs +0 -1733
- package/esm2022/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.mjs +0 -24
- package/esm2022/lib/components/eye-test-audit/eye-test-audit/eye-test-audit-routing.module.mjs +0 -34
- package/esm2022/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.mjs +0 -27
- package/esm2022/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.module.mjs +0 -71
- package/esm2022/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.mjs +0 -823
- package/esm2022/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.mjs +0 -412
- package/esm2022/lib/components/eye-test-audit/group-select/group-select.component.mjs +0 -157
- package/esm2022/lib/components/eye-test-audit/reactive-select/reactive-select.component.mjs +0 -105
- package/esm2022/lib/components/eye-test-audit/select-drop/select-drop.component.mjs +0 -162
- package/esm2022/lib/components/eye-test-audit/services/eye-test-audit.service.mjs +0 -166
- package/esm2022/lib/components/flag-layout/flag-layout.component.mjs +0 -12
- package/esm2022/lib/components/flags/flags.component.mjs +0 -263
- package/esm2022/lib/components/flags/flags.interface.mjs +0 -2
- package/esm2022/lib/components/flags-info/flags-info.component.mjs +0 -452
- package/esm2022/lib/components/flags-info/flags-info.interface.mjs +0 -2
- package/esm2022/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.mjs +0 -71
- package/esm2022/lib/components/flags-new/flags-new.component.mjs +0 -335
- package/esm2022/lib/components/flags-new/flags-new.interface.mjs +0 -2
- package/esm2022/lib/components/gallery/gallery.component.mjs +0 -3402
- package/esm2022/lib/components/group-select/group-select.component.mjs +0 -155
- package/esm2022/lib/components/image-popup/image-popup.component.mjs +0 -25
- package/esm2022/lib/components/lib/custom-select/custom-select.component.mjs +0 -158
- package/esm2022/lib/components/manage-task/manage-task.component.mjs +0 -264
- package/esm2022/lib/components/managechecklist/managechecklist.component.mjs +0 -186
- package/esm2022/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.mjs +0 -229
- package/esm2022/lib/components/multi-date-datepicker/multi-date-datepicker.component.mjs +0 -124
- package/esm2022/lib/components/orders/orders.component.mjs +0 -171
- package/esm2022/lib/components/pagination/pagination.component.mjs +0 -62
- package/esm2022/lib/components/reactive-select/reactive-select.component.mjs +0 -108
- package/esm2022/lib/components/reports/date-picker/date-picker.component.mjs +0 -60
- package/esm2022/lib/components/reports/reports.component.mjs +0 -300
- package/esm2022/lib/components/reports/reports.interface.mjs +0 -2
- package/esm2022/lib/components/tango-analyse-trax/tango-analyse-trax.component.mjs +0 -32
- package/esm2022/lib/components/task/task.component.mjs +0 -341
- package/esm2022/lib/components/task-configure/task-configure.component.mjs +0 -1532
- package/esm2022/lib/components/task-configure/task-configure.interface.mjs +0 -2
- package/esm2022/lib/components/task-info/task-info.component.mjs +0 -375
- package/esm2022/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.mjs +0 -208
- package/esm2022/lib/components/task-layout/task-layout.component.mjs +0 -12
- package/esm2022/lib/components/task-logs/task-logs.component.mjs +0 -104
- package/esm2022/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.mjs +0 -107
- package/esm2022/lib/components/trax-store/trax-store.component.mjs +0 -179
- package/esm2022/lib/components/traxpopup/traxpopup.component.mjs +0 -70
- package/esm2022/lib/services/trax.service.mjs +0 -559
- package/esm2022/lib/tango-analyse-trax-routing.module.mjs +0 -153
- package/esm2022/lib/tango-analyse-trax.module.mjs +0 -221
- package/esm2022/public-api.mjs +0 -6
- package/esm2022/tango-app-ui-analyse-trax.mjs +0 -5
- package/fesm2022/tango-app-ui-analyse-trax.mjs +0 -28896
- package/fesm2022/tango-app-ui-analyse-trax.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/action-centre/action-centre.component.d.ts +0 -68
- package/lib/components/activity-log/activity-log.component.d.ts +0 -39
- package/lib/components/activity-log-v2/activity-log-v2.component.d.ts +0 -78
- package/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.d.ts +0 -24
- package/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.d.ts +0 -9
- package/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.d.ts +0 -34
- package/lib/components/add-checklist/add-checklist.component.d.ts +0 -121
- package/lib/components/add-checklist/checklist-popup/checklist-popup.component.d.ts +0 -45
- package/lib/components/add-checklist/counter/counter.component.d.ts +0 -29
- package/lib/components/add-multitask/add-multitask.component.d.ts +0 -102
- package/lib/components/add-multitask/ascending-validator.d.ts +0 -2
- package/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.d.ts +0 -45
- package/lib/components/add-multitask/create-task.data.d.ts +0 -293
- package/lib/components/add-multitask/create-task.interface.d.ts +0 -159
- package/lib/components/add-multitask/unique-string-validator.d.ts +0 -2
- package/lib/components/add-multitask/whitespace-validator.d.ts +0 -2
- package/lib/components/add-task/add-task.component.d.ts +0 -89
- package/lib/components/add-task/ascending-validator.d.ts +0 -2
- package/lib/components/add-task/create-task.data.d.ts +0 -293
- package/lib/components/add-task/create-task.interface.d.ts +0 -161
- package/lib/components/add-task/unique-string-validator.d.ts +0 -2
- package/lib/components/add-task/whitespace-validator.d.ts +0 -2
- package/lib/components/approval-popup/approval-popup.component.d.ts +0 -14
- package/lib/components/checklist/checklist.component.d.ts +0 -40
- package/lib/components/checklist-configure/assign/assign.component.d.ts +0 -105
- package/lib/components/checklist-configure/checklist-configure.component.d.ts +0 -325
- package/lib/components/checklistlayout/checklistlayout.component.d.ts +0 -15
- package/lib/components/chip-dropdown/chip-dropdown.component.d.ts +0 -28
- package/lib/components/create-task/create-task.component.d.ts +0 -76
- package/lib/components/create-task/create-task.data.d.ts +0 -293
- package/lib/components/create-task/create-task.interface.d.ts +0 -163
- package/lib/components/create-task/validators/ascending-validator.d.ts +0 -2
- package/lib/components/create-task/validators/unique-string-validator.d.ts +0 -2
- package/lib/components/create-task/validators/whitespace-validator.d.ts +0 -2
- package/lib/components/custom-select/custom-select.component.d.ts +0 -35
- package/lib/components/dashboard/dashboard.component.d.ts +0 -80
- package/lib/components/dashboard-info/dashboard-info.component.d.ts +0 -117
- package/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.d.ts +0 -41
- package/lib/components/dashboard-layout/dashboard-layout.component.d.ts +0 -5
- package/lib/components/disabled-select/disabled-select.component.d.ts +0 -34
- package/lib/components/export-gallery/export-gallery.component.d.ts +0 -44
- package/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.d.ts +0 -26
- package/lib/components/eye-test-audit/custom-select/custom-select.component.d.ts +0 -35
- package/lib/components/eye-test-audit/eye-test/eye-test.component.d.ts +0 -218
- package/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.d.ts +0 -12
- package/lib/components/eye-test-audit/eye-test-audit/eye-test-audit-routing.module.d.ts +0 -7
- package/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.d.ts +0 -11
- package/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.module.d.ts +0 -21
- package/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.d.ts +0 -129
- package/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.d.ts +0 -86
- package/lib/components/eye-test-audit/group-select/group-select.component.d.ts +0 -33
- package/lib/components/eye-test-audit/reactive-select/reactive-select.component.d.ts +0 -32
- package/lib/components/eye-test-audit/select-drop/select-drop.component.d.ts +0 -33
- package/lib/components/eye-test-audit/services/eye-test-audit.service.d.ts +0 -47
- package/lib/components/flag-layout/flag-layout.component.d.ts +0 -5
- package/lib/components/flags/flags.component.d.ts +0 -52
- package/lib/components/flags-info/flags-info.component.d.ts +0 -73
- package/lib/components/flags-info/flags-info.interface.d.ts +0 -430
- package/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.d.ts +0 -13
- package/lib/components/flags-new/flags-new.component.d.ts +0 -60
- package/lib/components/gallery/gallery.component.d.ts +0 -261
- package/lib/components/group-select/group-select.component.d.ts +0 -33
- package/lib/components/image-popup/image-popup.component.d.ts +0 -11
- package/lib/components/lib/custom-select/custom-select.component.d.ts +0 -33
- package/lib/components/manage-task/manage-task.component.d.ts +0 -47
- package/lib/components/managechecklist/managechecklist.component.d.ts +0 -33
- package/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.d.ts +0 -40
- package/lib/components/multi-date-datepicker/multi-date-datepicker.component.d.ts +0 -27
- package/lib/components/orders/orders.component.d.ts +0 -38
- package/lib/components/pagination/pagination.component.d.ts +0 -16
- package/lib/components/reactive-select/reactive-select.component.d.ts +0 -32
- package/lib/components/reports/date-picker/date-picker.component.d.ts +0 -23
- package/lib/components/reports/reports.component.d.ts +0 -55
- package/lib/components/tango-analyse-trax/tango-analyse-trax.component.d.ts +0 -14
- package/lib/components/task/task.component.d.ts +0 -70
- package/lib/components/task-configure/task-configure.component.d.ts +0 -142
- package/lib/components/task-configure/task-configure.interface.d.ts +0 -128
- package/lib/components/task-info/task-info.component.d.ts +0 -76
- package/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.d.ts +0 -61
- package/lib/components/task-layout/task-layout.component.d.ts +0 -5
- package/lib/components/task-logs/task-logs.component.d.ts +0 -27
- package/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.d.ts +0 -26
- package/lib/components/trax-store/trax-store.component.d.ts +0 -45
- package/lib/components/traxpopup/traxpopup.component.d.ts +0 -24
- package/lib/services/trax.service.d.ts +0 -175
- package/lib/tango-analyse-trax-routing.module.d.ts +0 -7
- package/lib/tango-analyse-trax.module.d.ts +0 -68
|
@@ -0,0 +1,1603 @@
|
|
|
1
|
+
import { Component, OnDestroy, OnInit, ViewChild, ElementRef, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
3
|
+
import { TimePeriod } from 'ngx-daterangepicker-material/daterangepicker.component';
|
|
4
|
+
import { BehaviorSubject, Subject, debounceTime, distinctUntilChanged, takeUntil } from "rxjs";
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import utc from 'dayjs/plugin/utc';
|
|
7
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
8
|
+
import { GlobalStateService, PageInfoService } from 'tango-app-ui-global';
|
|
9
|
+
import { HeaderFilter, ITask, UserAssignDetails } from './task-configure.interface';
|
|
10
|
+
import { TraxService } from '../../services/trax.service';
|
|
11
|
+
import { FormArray, FormBuilder, FormControl } from '@angular/forms';
|
|
12
|
+
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
13
|
+
import { TraxStoreComponent } from '../trax-store/trax-store.component';
|
|
14
|
+
dayjs.extend(utc);
|
|
15
|
+
import * as XLSX from 'xlsx';
|
|
16
|
+
import { ToastService } from 'tango-app-ui-shared';
|
|
17
|
+
import { TraxpopupComponent } from '../traxpopup/traxpopup.component';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
dayjs.extend(customParseFormat);
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'lib-task-configure',
|
|
23
|
+
templateUrl: './task-configure.component.html',
|
|
24
|
+
styleUrl: './task-configure.component.scss'
|
|
25
|
+
})
|
|
26
|
+
export class TaskConfigureComponent implements OnInit, OnDestroy {
|
|
27
|
+
destroy$ = new Subject();
|
|
28
|
+
dayjs = dayjs
|
|
29
|
+
scheduleDate: any;
|
|
30
|
+
minDate: any = this.dayjs().format();
|
|
31
|
+
scheduleEndTime = new FormControl(this.getCurrentTime())
|
|
32
|
+
currentTaskId: string
|
|
33
|
+
headerData: HeaderFilter
|
|
34
|
+
taskDetails: ITask
|
|
35
|
+
approver = new FormControl()
|
|
36
|
+
priorityType = new FormControl('high')
|
|
37
|
+
allowedStoreLocation = new FormControl(false)
|
|
38
|
+
restrictAttendance = new FormControl(false)
|
|
39
|
+
approversList: { name: string, value: string }[]
|
|
40
|
+
assignTableApiState = new BehaviorSubject<'initial' | 'loading' | 'loaded'>('loading')
|
|
41
|
+
assignTableData: UserAssignDetails[] | null | undefined
|
|
42
|
+
itemsPerPage = 5
|
|
43
|
+
currentPage = 1
|
|
44
|
+
totalItems = 0
|
|
45
|
+
configData: any;
|
|
46
|
+
storeCoverage: boolean = true;
|
|
47
|
+
userCoverage: boolean = false;
|
|
48
|
+
reupload: boolean = false;
|
|
49
|
+
userData: any = [];
|
|
50
|
+
listofId: any;
|
|
51
|
+
excelUserData: any = [];
|
|
52
|
+
assignType: any;
|
|
53
|
+
initialLoading: boolean = true;
|
|
54
|
+
assignSingle: any; assignGroup: any;
|
|
55
|
+
singleAssign: any;
|
|
56
|
+
groupAssign:any;
|
|
57
|
+
paginationSizes = [5, 10, 20, 30]
|
|
58
|
+
pageSize = 5
|
|
59
|
+
searchInput = new FormControl('')
|
|
60
|
+
selectAllInput = new FormControl(false)
|
|
61
|
+
removedUsers = new Set()
|
|
62
|
+
added = []
|
|
63
|
+
removed = []
|
|
64
|
+
@ViewChild('file') fileInput!: ElementRef;
|
|
65
|
+
@ViewChild('file1') fileInput1!: ElementRef;
|
|
66
|
+
@ViewChild('bulkupload') bulkupload: any;
|
|
67
|
+
@ViewChild('afterValidation') afterValidation: any;
|
|
68
|
+
@ViewChild('confirmUser') confirmUser: any;
|
|
69
|
+
|
|
70
|
+
reminderRepeatSchedules: FormArray;
|
|
71
|
+
reminderRepeatScheduleOptions = [30, 45, 60, 75, 90]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
constructor(private route: ActivatedRoute, private pageInfo: PageInfoService,
|
|
75
|
+
private traxService: TraxService, private dialog: NgbModal, private toastService: ToastService, private router: Router, private cd: ChangeDetectorRef, private fb: FormBuilder) {
|
|
76
|
+
this.headerData = JSON.parse(localStorage.getItem('header-filters') as string)
|
|
77
|
+
|
|
78
|
+
this.searchInput.valueChanges.pipe(takeUntil(this.destroy$)).pipe(debounceTime(1000), distinctUntilChanged()).subscribe((val) => {
|
|
79
|
+
if (val === null || val === undefined) {
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
this.selectAllInput.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((val) => {
|
|
85
|
+
if (val === null || val === undefined) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
if (val) {
|
|
89
|
+
this.assignTableData?.forEach(val => val.checkFlag = true)
|
|
90
|
+
this.removedUsers.clear()
|
|
91
|
+
} else {
|
|
92
|
+
this.assignTableData?.forEach(val => { val.checkFlag = false, this.onUserAssignChange(val.checkFlag, val.id) })
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
this.reminderRepeatSchedules = this.fb.array([])
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
ngOnDestroy(): void {
|
|
101
|
+
this.destroy$.next(true);
|
|
102
|
+
this.destroy$.complete();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
ngOnInit(): void {
|
|
106
|
+
this.scheduleDate = { startDate: this.dayjs().format('DD-MM-YYYY'), endDate: this.dayjs().format('DD-MM-YYYY') };
|
|
107
|
+
this.setPageData()
|
|
108
|
+
this.route.queryParams
|
|
109
|
+
.pipe(takeUntil(this.destroy$))
|
|
110
|
+
.subscribe((params) => {
|
|
111
|
+
if (params?.taskId) {
|
|
112
|
+
this.currentTaskId = params.taskId
|
|
113
|
+
this.getTask(this.currentTaskId)
|
|
114
|
+
this.getClientUser();
|
|
115
|
+
this.selectInitialTab();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
setPageData() {
|
|
121
|
+
this.pageInfo.setTitle("Tasks");
|
|
122
|
+
this.pageInfo.setDescription("");
|
|
123
|
+
this.pageInfo.setBreadcrumbs([
|
|
124
|
+
{ title: "Tango Trax", path: "/manage/trax/dashboard", isActive: false, isSeparator: false },
|
|
125
|
+
{ title: "Tango Trax", path: "/manage/trax/dashboard", isActive: false, isSeparator: true }
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
getTask(id: string) {
|
|
130
|
+
this.traxService.getTaskconfig(id, this.headerData?.client!).pipe(takeUntil(this.destroy$)).subscribe({
|
|
131
|
+
next: (res: any) => {
|
|
132
|
+
if (res?.code === 200) {
|
|
133
|
+
this.configData = res?.data;
|
|
134
|
+
this.taskDetails = res.data.checkListDetails
|
|
135
|
+
this.taskDetails.assign = [];
|
|
136
|
+
// this.idList = this.configData.checkListDetails.assignedusers;
|
|
137
|
+
// this.listofId = this.configData.checkListDetails.assignedusers;
|
|
138
|
+
this.coverage = this.configData.checkListDetails.coverage;
|
|
139
|
+
this.selectRadio(this.coverage)
|
|
140
|
+
if (this.taskDetails?.scheduleDate) {
|
|
141
|
+
if (dayjs(this.taskDetails.scheduleDate).isBefore(dayjs())) {
|
|
142
|
+
this.minDate = this.dayjs(this.taskDetails.scheduleDate).format()
|
|
143
|
+
}
|
|
144
|
+
this.scheduleDate = { startDate: this.dayjs(this.taskDetails.scheduleDate).utc().format('DD-MM-YYYY'), endDate: this.dayjs(this.taskDetails.scheduleDate).utc().format('DD-MM-YYYY') };
|
|
145
|
+
}
|
|
146
|
+
if (!this.taskDetails?.removedUsers?.length) {
|
|
147
|
+
this.selectAllInput.setValue(true, { emitEvent: false })
|
|
148
|
+
}
|
|
149
|
+
if (this.taskDetails?.scheduleEndTime) {
|
|
150
|
+
this.scheduleEndTime.setValue(dayjs(this.taskDetails?.scheduleEndTime, 'hh:mm A').format('HH:mm'))
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (this.taskDetails?.approver?.length) {
|
|
154
|
+
this.approver.setValue(this.taskDetails?.approver)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (this.taskDetails?.priorityType) {
|
|
158
|
+
this.priorityType.setValue(this.taskDetails?.priorityType)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (this.taskDetails?.allowedStoreLocation === true || this.taskDetails?.allowedStoreLocation === false) {
|
|
162
|
+
this.allowedStoreLocation.setValue(this.taskDetails?.allowedStoreLocation)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (this.taskDetails?.restrictAttendance === true || this.taskDetails?.restrictAttendance === false) {
|
|
166
|
+
this.restrictAttendance.setValue(this.taskDetails?.restrictAttendance)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (this.taskDetails?.remainder?.length) {
|
|
170
|
+
this.reminderRepeatSchedules.clear()
|
|
171
|
+
this.taskDetails?.remainder.forEach((item) => {
|
|
172
|
+
this.reminderRepeatSchedules.push(this.fb.control(item))
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
selectedTab(value:any) {
|
|
182
|
+
this.tableArray = [];
|
|
183
|
+
this.assignTableData = [];
|
|
184
|
+
this.assignType = value;
|
|
185
|
+
this.currentPage = 1;
|
|
186
|
+
this.pageSize = 5;
|
|
187
|
+
this.searchInput.setValue('');
|
|
188
|
+
this.configData.checkListDetails.assign = [];
|
|
189
|
+
this.getassignDropdown();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
selectInitialTab() {
|
|
193
|
+
this.storeCoverage ? this.assignType = 'store' : this.assignType = 'user'
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
getCurrentTime(): string {
|
|
197
|
+
// const now = new Date();
|
|
198
|
+
// const hours = now.getHours().toString().padStart(2, '0');
|
|
199
|
+
// const minutes = now.getMinutes().toString().padStart(2, '0');
|
|
200
|
+
// return `${hours}:${minutes}`;
|
|
201
|
+
return '23:59';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
get dueDateFormatted(): string {
|
|
205
|
+
return this.dayjs(this.scheduleDate.startDate, 'DD-MM-YYYY')?.format('DD MMM YYYY');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
get dueTimeFormatted(): string {
|
|
209
|
+
return dayjs(this.scheduleEndTime.value, 'HH:mm').format('h:mm A');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
getClientUser() {
|
|
213
|
+
this.traxService.getClientUser(this.headerData.client).pipe(takeUntil(this.destroy$)).subscribe((res: any) => {
|
|
214
|
+
if (res && res.code == 200 && res.data.length) {
|
|
215
|
+
this.approversList = res.data.map((item: any) => { return { name: item.userName, value: item.email, role: item.role } });
|
|
216
|
+
if (!this.taskDetails?.approver?.length) {
|
|
217
|
+
let userInfo = JSON.parse(localStorage.getItem('user-info') || '{}');
|
|
218
|
+
if (userInfo?.userType == 'tango' || (userInfo?.userType == 'client' && userInfo?.role == 'user')) {
|
|
219
|
+
let userList = this.approversList.find((ele: any) => ele.role == 'superadmin');
|
|
220
|
+
if (userList) {
|
|
221
|
+
this.approver.setValue([{ name: userList.name, value: userList.value }])
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
this.approver.setValue([this.approversList.find((ele: any) => ele.value == userInfo.email)])
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this.approversList = [];
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
onSubmit(action: 'save' | 'publish') {
|
|
236
|
+
const payload: any = {
|
|
237
|
+
scheduleDate: this.dayjs(this.scheduleDate.startDate, 'DD-MM-YYYY').format('YYYY-MM-DD'),
|
|
238
|
+
scheduleEndTime: this.dayjs(this.scheduleEndTime.value, 'HH:mm').format('hh:mm A'),
|
|
239
|
+
approver: this.approver.value ?? [],
|
|
240
|
+
priorityType: this.priorityType.value,
|
|
241
|
+
allowedStoreLocation: this.allowedStoreLocation.value,
|
|
242
|
+
restrictAttendance: this.restrictAttendance.value,
|
|
243
|
+
clientId: this.headerData?.client,
|
|
244
|
+
submitType: action,
|
|
245
|
+
_id: this.taskDetails?._id,
|
|
246
|
+
removedUsers: [...this.removedUsers],
|
|
247
|
+
remainder: this.reminderRepeatSchedules?.value || [],
|
|
248
|
+
...(action === 'publish') ? { publish: true } : { publish: false },
|
|
249
|
+
assignedUsers: [...this.singleAssign, ...this.groupAssign],
|
|
250
|
+
storeCount : this.assignSingle?.length + this.groupAssign?.length,
|
|
251
|
+
coverage: this.coverage,
|
|
252
|
+
added:this.added,
|
|
253
|
+
removed:this.removed
|
|
254
|
+
}
|
|
255
|
+
if (action === 'publish') {
|
|
256
|
+
let popupcontent = {
|
|
257
|
+
displayprop: false,
|
|
258
|
+
imagesrc: `<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56" fill="none"><rect x="4" y="4" width="48" height="48" rx="24" fill="#D1FADF"/><path d="M38 27.0818V28.0018C37.9988 30.1582 37.3005 32.2565 36.0093 33.9836C34.7182 35.7108 32.9033 36.9743 30.8354 37.5857C28.7674 38.1971 26.5573 38.1237 24.5345 37.3764C22.5117 36.6291 20.7847 35.2479 19.611 33.4389C18.4373 31.6299 17.8798 29.4899 18.0217 27.3381C18.1636 25.1864 18.9972 23.1381 20.3983 21.4989C21.7994 19.8596 23.6928 18.7172 25.7962 18.242C27.8996 17.7667 30.1003 17.9842 32.07 18.8618M38 20.0018L28 30.0118L25 27.0118" stroke="#039855" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><rect x="4" y="4" width="48" height="48" rx="24" stroke="#ECFDF3" stroke-width="8"/></svg>`,
|
|
259
|
+
title: `Are you sure you want to publish ${this.taskDetails?.checkListName} task?`,
|
|
260
|
+
content: `Publishing will make this task live, and changes will take effect immediately.`,
|
|
261
|
+
buttontype: 'confirm'
|
|
262
|
+
}
|
|
263
|
+
const dialogRef = this.dialog.open(TraxpopupComponent, { centered: true, size: 'md' });
|
|
264
|
+
dialogRef.componentInstance.data = popupcontent;
|
|
265
|
+
dialogRef.result.then((res) => {
|
|
266
|
+
if (res == 'confirm') {
|
|
267
|
+
this.traxService.configTask(payload).pipe(takeUntil(this.destroy$)).subscribe({
|
|
268
|
+
next: (res: any) => {
|
|
269
|
+
if (res.code === 200) {
|
|
270
|
+
if (action) {
|
|
271
|
+
this.toastService.getSuccessToast(res?.data?.message || 'Configuration updated successfully')
|
|
272
|
+
this.router.navigate(['manage/trax/checklist/managetask'])
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
error: (err: any) => {
|
|
277
|
+
this.toastService.getErrorToast(err?.error?.error?.message || 'Something went wrong')
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
} else if (action === 'save') {
|
|
284
|
+
const dialogRef = this.dialog.open(TraxpopupComponent, { centered: true, size: 'md' });
|
|
285
|
+
dialogRef.componentInstance.data = {
|
|
286
|
+
imagesrc: `<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56" fill="none"><rect x="4" y="4" width="48" height="48" rx="24" fill="#FEF0C7"/><path d="M27.9998 24.0012V28.0012M27.9998 32.0012H28.0098M26.2898 18.8612L17.8198 33.0012C17.6451 33.3036 17.5527 33.6465 17.5518 33.9957C17.5508 34.3449 17.6413 34.6883 17.8142 34.9917C17.9871 35.2951 18.2365 35.5479 18.5375 35.725C18.8385 35.9021 19.1806 35.9973 19.5298 36.0012H36.4698C36.819 35.9973 37.1611 35.9021 37.4621 35.725C37.7631 35.5479 38.0124 35.2951 38.1854 34.9917C38.3583 34.6883 38.4488 34.3449 38.4478 33.9957C38.4468 33.6465 38.3544 33.3036 38.1798 33.0012L29.7098 18.8612C29.5315 18.5673 29.2805 18.3243 28.981 18.1557C28.6814 17.987 28.3435 17.8984 27.9998 17.8984C27.656 17.8984 27.3181 17.987 27.0186 18.1557C26.7191 18.3243 26.468 18.5673 26.2898 18.8612Z" stroke="#DC6803" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><rect x="4" y="4" width="48" height="48" rx="24" stroke="#FFFAEB" stroke-width="8"/></svg>`,
|
|
287
|
+
title: `Unsaved changes`,
|
|
288
|
+
content: `Do you want to save as draft?`,
|
|
289
|
+
buttontype: 'draft'
|
|
290
|
+
}
|
|
291
|
+
dialogRef.result.then((res) => {
|
|
292
|
+
if (res === 'confirm') {
|
|
293
|
+
this.traxService.configTask(payload).pipe(takeUntil(this.destroy$)).subscribe({
|
|
294
|
+
next: (res: any) => {
|
|
295
|
+
if (res.code === 200) {
|
|
296
|
+
if (action) {
|
|
297
|
+
this.toastService.getSuccessToast(res?.data?.message || 'Configuration updated successfully')
|
|
298
|
+
this.router.navigate(['manage/trax/checklist/managetask'])
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
error: (err: any) => {
|
|
303
|
+
this.toastService.getErrorToast(err?.error?.error?.message || 'Something went wrong')
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
detassignUpdate(action: 'save' | 'publish') {
|
|
314
|
+
const payload = {
|
|
315
|
+
"taskId": this.currentTaskId,
|
|
316
|
+
"assignedList": this.assignSingle || [],
|
|
317
|
+
"assignedGroup": this.assignGroup || [],
|
|
318
|
+
"clientId": this.headerData?.client,
|
|
319
|
+
"coverage": this.coverage
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
this.traxService.assigntaskUpdate(payload).pipe(takeUntil(this.destroy$)).subscribe({
|
|
323
|
+
next:(res:any)=> {
|
|
324
|
+
if (res && res?.code == 200) {
|
|
325
|
+
this.added = res?.data?.added;
|
|
326
|
+
this.removed = res?.data?.removed;
|
|
327
|
+
this.onSubmit(action)
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
error:(err:any)=> {
|
|
331
|
+
this.toastService.getErrorToast(err);
|
|
332
|
+
},
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
onApproveAdded(event: any) {
|
|
338
|
+
this.approver.setValue(event)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
idList: any = [];
|
|
342
|
+
|
|
343
|
+
getInitialData(data: any,change?: any) {
|
|
344
|
+
let tempId = data.map((el:any) => el?.id)
|
|
345
|
+
let res = this.storeList.filter((el: any) => tempId.includes(el?._id));
|
|
346
|
+
res.forEach((element: any) => element.isSelected = true);
|
|
347
|
+
this.taskDetails.assign = res;
|
|
348
|
+
if (this.assignType === 'store' || this.assignType === 'user') {
|
|
349
|
+
this.assignTableApiState.next('loaded')
|
|
350
|
+
// this.userDetails(),
|
|
351
|
+
// (this.assignType === 'store' && this.initialLoading) ? (this.initialLoading = false) : this.getTableData(change ? change : '');
|
|
352
|
+
this.idList = this.singleAssign;
|
|
353
|
+
} else {
|
|
354
|
+
this.idList = this.groupAssign;
|
|
355
|
+
this.userDetailsV2()
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
getTableData(change?: any) {
|
|
360
|
+
let count = 0;
|
|
361
|
+
if (this.assignSingle?.length) {
|
|
362
|
+
if (this.taskDetails.assign.length != this.assignSingle.length) {
|
|
363
|
+
count++;
|
|
364
|
+
}
|
|
365
|
+
this.taskDetails.assign.forEach((assign:any) => {
|
|
366
|
+
let findList = this.assignSingle.filter((item: any) => item.storeId == assign.storeId);
|
|
367
|
+
if (findList.length) {
|
|
368
|
+
if (findList.length > 1) {
|
|
369
|
+
count++;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
if (assign.userEmail.toLowerCase() != findList[0].userEmail.toLowerCase() && this.coverage === 'store') {
|
|
373
|
+
assign.userEmail = findList[0].userEmail;
|
|
374
|
+
assign.userName = findList[0].userName;
|
|
375
|
+
count++;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
})
|
|
380
|
+
if (count) {
|
|
381
|
+
this.upload = change ? 'upload' : 'store';
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// this.tableArray = this.assignSingle ? this.assignSingle : this.taskDetails.assign;
|
|
385
|
+
|
|
386
|
+
change ? this.tableArray = this.assignSingle : [];
|
|
387
|
+
|
|
388
|
+
if (this.upload === 'store') {
|
|
389
|
+
let table = [...this.tableArray, ...this.taskDetails.assign];
|
|
390
|
+
|
|
391
|
+
let uniqueTable = new Map();
|
|
392
|
+
|
|
393
|
+
// Convert objects to JSON strings for full comparison
|
|
394
|
+
table.forEach((item: any) => {
|
|
395
|
+
item = {
|
|
396
|
+
storeName: item?.storeName,
|
|
397
|
+
storeId: item.storeId,
|
|
398
|
+
userEmail: item.userEmail.toLowerCase(),
|
|
399
|
+
userName: item.userName,
|
|
400
|
+
_id:item._id
|
|
401
|
+
}
|
|
402
|
+
let data = {
|
|
403
|
+
_id: item._id,
|
|
404
|
+
...(this.storeCoverage)? { userEmail: item.userEmail.toLowerCase() ,storeName: item?.storeName}:{},
|
|
405
|
+
}
|
|
406
|
+
let key = JSON.stringify(data); // Convert entire object to string as a key
|
|
407
|
+
if (!uniqueTable.has(data)) {
|
|
408
|
+
uniqueTable.set(key, item); // Store the object only if it's completely unique
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
this.assignSingle = Array.from(uniqueTable.values());
|
|
412
|
+
|
|
413
|
+
this.tableArray = this.assignSingle;
|
|
414
|
+
} else if (this.upload === 'upload') {
|
|
415
|
+
this.tableArray = this.assignSingle;
|
|
416
|
+
} else {
|
|
417
|
+
this.tableArray = this.taskDetails.assign;
|
|
418
|
+
this.assignSingle = this.tableArray;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// this.tableArray?.length ? this.assignTableApiState.next('loaded') : this.assignTableApiState.next('loading');
|
|
422
|
+
this.totalItems = this.tableArray.length;
|
|
423
|
+
if(this.totalItems < 5) {
|
|
424
|
+
this.paginationSizes = [this.totalItems];
|
|
425
|
+
this.pageSize = this.totalItems;
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
this.paginationSizes = [5,10,15,20];
|
|
429
|
+
this.pageSize = 5;
|
|
430
|
+
}
|
|
431
|
+
this.assignTableApiState.next('loaded')
|
|
432
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
coverage: any = 'store';
|
|
436
|
+
|
|
437
|
+
selectRadio(data: any) {
|
|
438
|
+
this.coverage = data;
|
|
439
|
+
this.currentPage = 1;
|
|
440
|
+
this.pageSize = 5;
|
|
441
|
+
this.searchInput.setValue('');
|
|
442
|
+
this.taskDetails.assign = [];
|
|
443
|
+
this.tableArray = [];
|
|
444
|
+
this.assignTableData = [];
|
|
445
|
+
if (data === 'store') {
|
|
446
|
+
this.storeCoverage = true;
|
|
447
|
+
this.userCoverage = false;
|
|
448
|
+
} else if (data === 'user') {
|
|
449
|
+
this.userCoverage = true;
|
|
450
|
+
this.storeCoverage = false;
|
|
451
|
+
}
|
|
452
|
+
this.selectInitialTab();
|
|
453
|
+
if (this.coverage === this.configData.checkListDetails.coverage) {
|
|
454
|
+
this.singleAssign = this.configData.checkListDetails.singleAssign;
|
|
455
|
+
this.groupAssign = this.configData.checkListDetails.groupAssign;
|
|
456
|
+
setTimeout(() => {
|
|
457
|
+
this.assignType ? this.userDetails() : '';
|
|
458
|
+
}, 3000);
|
|
459
|
+
} else {
|
|
460
|
+
this.singleAssign = []; this.groupAssign = []; this.assignSingle = [], this.assignGroup = []; this.assignTableApiState.next('loading');
|
|
461
|
+
}
|
|
462
|
+
this.getassignDropdown();
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
confirmUserpopup() {
|
|
466
|
+
const dialogRef = this.dialog.open(this.confirmUser, { centered: true, backdrop: 'static' })
|
|
467
|
+
dialogRef.closed.subscribe((res: any) => {
|
|
468
|
+
if (res === 'confirm') {
|
|
469
|
+
this.validateDetails('addUser')
|
|
470
|
+
}
|
|
471
|
+
})
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
storeList: any = [];
|
|
475
|
+
searchKey: any = [];
|
|
476
|
+
|
|
477
|
+
getassignDropdown(change?:any) {
|
|
478
|
+
let data = {
|
|
479
|
+
"clientId": this.headerData?.client,
|
|
480
|
+
"coverage": this.coverage,
|
|
481
|
+
"assignType": this.assignType
|
|
482
|
+
}
|
|
483
|
+
this.storeList = [];
|
|
484
|
+
this.traxService.getassignDropdown(data).subscribe((res: any) => {
|
|
485
|
+
if (res && res.code == 200 && res.data.data.length) {
|
|
486
|
+
this.storeList = res?.data?.data;
|
|
487
|
+
if (data?.coverage === 'store') {
|
|
488
|
+
this.searchKey = ['storeName', 'clusterName']
|
|
489
|
+
} else if (data?.coverage === 'user') {
|
|
490
|
+
this.searchKey = ['userName', 'teamName']
|
|
491
|
+
}
|
|
492
|
+
!change ? this.getInitialData((this.assignType === 'store' || this.assignType === 'user') ? this.singleAssign : this.groupAssign, change ? change : '') : '';
|
|
493
|
+
this.cd.detectChanges();
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
this.storeList = [];
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
userDetailsV2(data?: any) {
|
|
502
|
+
const payload = {
|
|
503
|
+
"taskId": this.currentTaskId,
|
|
504
|
+
"idList": this.idList,
|
|
505
|
+
"coverage": this.coverage, //["cluster","store","user","teams"]
|
|
506
|
+
"clientId": this.headerData?.client,
|
|
507
|
+
"search": this.searchInput.value
|
|
508
|
+
}
|
|
509
|
+
this.assignTableApiState.next('loading')
|
|
510
|
+
this.tableArray = [];
|
|
511
|
+
this.assignTableData = [];
|
|
512
|
+
this.traxService.selecttaskChips(payload).pipe(takeUntil(this.destroy$)).subscribe({
|
|
513
|
+
next: (res: any) => {
|
|
514
|
+
if (res && res?.code === 200) {
|
|
515
|
+
this.assignTableApiState.next('loaded')
|
|
516
|
+
this.tableArray = res?.data?.uniqueArr;
|
|
517
|
+
this.assignGroup = this.tableArray;
|
|
518
|
+
this.totalItems = res?.data?.count;
|
|
519
|
+
if (this.totalItems < 5) {
|
|
520
|
+
this.paginationSizes = [this.totalItems];
|
|
521
|
+
this.pageSize = this.totalItems;
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
this.paginationSizes = [5, 10, 15, 20];
|
|
525
|
+
this.pageSize = 5;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
529
|
+
// console.log('assignTableData?.length', this.assignTableData?.length)
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
this.tableArray = [];
|
|
533
|
+
this.assignTableData = [];
|
|
534
|
+
this.assignTableApiState.next('loaded')
|
|
535
|
+
// this.showImage = true;
|
|
536
|
+
// this.tableLoading = true;
|
|
537
|
+
}
|
|
538
|
+
// this.storeCoverage ? this.getInitialData(res?.data?.storeList) : this.getInitialData(res?.data?.userList);
|
|
539
|
+
},
|
|
540
|
+
error: (err: any) => {
|
|
541
|
+
this.tableArray = [];
|
|
542
|
+
this.assignTableData = [];
|
|
543
|
+
this.assignTableApiState.next('loaded')
|
|
544
|
+
this.toastService.getErrorToast(err?.message)
|
|
545
|
+
},
|
|
546
|
+
})
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
userDetails() {
|
|
550
|
+
this.pageSize = 5;
|
|
551
|
+
this.assignTableApiState.next('loading')
|
|
552
|
+
let params = {
|
|
553
|
+
id: this.currentTaskId,
|
|
554
|
+
clientId: this.headerData?.client
|
|
555
|
+
}
|
|
556
|
+
this.traxService.gettaskUserDetailsV1(params).pipe(takeUntil(this.destroy$)).subscribe((res: any) => {
|
|
557
|
+
this.assignTableApiState.next('loaded')
|
|
558
|
+
let count = 0;
|
|
559
|
+
if (res == null) {
|
|
560
|
+
// this.showImage = true;
|
|
561
|
+
if (this.searchInput.value)
|
|
562
|
+
this.tableArray = [];
|
|
563
|
+
this.assignTableData = [];
|
|
564
|
+
}
|
|
565
|
+
if (res && res.code == 200) {
|
|
566
|
+
this.assignTableApiState.next('loaded')
|
|
567
|
+
if (this.storeCoverage) {
|
|
568
|
+
this.tableArray = res.data.userDetails.filter((el: any) => el?.clusterName == '' && el?.storeId != '');
|
|
569
|
+
this.assignGroup = res.data.userDetails.filter((el: any) => el?.clusterName !== '');
|
|
570
|
+
} else if (this.userCoverage) {
|
|
571
|
+
this.tableArray = res.data.userDetails.filter((el: any) => el?.teamName == '' && el?.userName != '');
|
|
572
|
+
this.assignGroup = res.data.userDetails.filter((el: any) => el?.teamName !== '');
|
|
573
|
+
}
|
|
574
|
+
this.assignSingle = this.tableArray;
|
|
575
|
+
this.totalItems = this.tableArray.length;
|
|
576
|
+
// this.totalItems = res.data.count;
|
|
577
|
+
if(this.totalItems < 5) {
|
|
578
|
+
this.paginationSizes = [this.totalItems];
|
|
579
|
+
this.pageSize = this.totalItems;
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
this.paginationSizes = [5,10,15,20];
|
|
583
|
+
this.pageSize = 5;
|
|
584
|
+
}
|
|
585
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
586
|
+
this.assignTableData ? this.assignTableApiState.next('loaded') : this.assignTableApiState.next('loading')
|
|
587
|
+
|
|
588
|
+
// this.getInitialData();
|
|
589
|
+
}
|
|
590
|
+
})
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
sortColumn: any;
|
|
595
|
+
sortBy: any = -1;
|
|
596
|
+
|
|
597
|
+
sortData(value: any) {
|
|
598
|
+
this.sortColumn = value;
|
|
599
|
+
this.sortBy *= -1;
|
|
600
|
+
const sortBy = parseInt(this.sortBy, 10) === -1 ? -1 : 1;
|
|
601
|
+
this.tableArray.sort((a: any, b: any) => {
|
|
602
|
+
// if (a[this.sortColumn] == null || b[this.sortColumn] == null) return 0;
|
|
603
|
+
// if (typeof a[this.sortColumn] === 'string' && typeof b[this.sortColumn] === 'string') {
|
|
604
|
+
return sortBy * (a[this.sortColumn] || '').localeCompare(b[this.sortColumn] || '');
|
|
605
|
+
// }
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
getAssignTable(): void {
|
|
612
|
+
this.assignTableApiState.next('loading')
|
|
613
|
+
const query: Record<string, any> = {
|
|
614
|
+
"clientId": this.headerData?.client,
|
|
615
|
+
"limit": this.pageSize,
|
|
616
|
+
"offset": this.currentPage > 0 ? this.currentPage - 1 : 0,
|
|
617
|
+
"search": this.searchInput.value,
|
|
618
|
+
"taskId": this.currentTaskId
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
this.traxService.getTaskUserDetails(query).pipe(takeUntil(this.destroy$)).subscribe({
|
|
623
|
+
next: (res: any) => {
|
|
624
|
+
this.assignTableApiState.next('loaded')
|
|
625
|
+
if (res?.data?.count) {
|
|
626
|
+
this.totalItems = res.data.count
|
|
627
|
+
} else {
|
|
628
|
+
this.totalItems = 0
|
|
629
|
+
}
|
|
630
|
+
if (res?.data?.users) {
|
|
631
|
+
this.assignTableData = res.data.users
|
|
632
|
+
} else {
|
|
633
|
+
this.assignTableData = []
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
error: (e) => {
|
|
637
|
+
this.assignTableApiState.next('loaded')
|
|
638
|
+
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
onPageSizeChange(pageSize: any) {
|
|
644
|
+
this.currentPage = 1;
|
|
645
|
+
this.itemsPerPage = pageSize;
|
|
646
|
+
this.pageSize = pageSize;
|
|
647
|
+
this.assignTableData = [];
|
|
648
|
+
|
|
649
|
+
if (this.searchInput.value) {
|
|
650
|
+
this.totalItems = this.searchTable.length;
|
|
651
|
+
if (this.totalItems < 5) {
|
|
652
|
+
this.paginationSizes = [this.totalItems];
|
|
653
|
+
this.pageSize = this.totalItems;
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
this.paginationSizes = [5, 10, 15, 20];
|
|
657
|
+
// this.size = 5;
|
|
658
|
+
}
|
|
659
|
+
this.assignTableData = this.searchTable.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
660
|
+
// this.assignTableData ? this.tableLoading = false : this.tableLoading = true;
|
|
661
|
+
|
|
662
|
+
} else {
|
|
663
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
664
|
+
// this.assignTableData ? this.tableLoading = false : this.tableLoading = true;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
onPageChange(pageOffset: any) {
|
|
669
|
+
this.currentPage = pageOffset
|
|
670
|
+
this.assignTableData = [];
|
|
671
|
+
|
|
672
|
+
if (this.searchInput.value) {
|
|
673
|
+
// this.searchTableData();
|
|
674
|
+
this.totalItems = this.searchTable.length;
|
|
675
|
+
if(this.totalItems < 5) {
|
|
676
|
+
this.paginationSizes = [this.totalItems];
|
|
677
|
+
this.pageSize = this.totalItems;
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
this.paginationSizes = [5,10,15,20];
|
|
681
|
+
this.pageSize = 5;
|
|
682
|
+
}
|
|
683
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
684
|
+
// this.tableData ? this.tableLoading = false : this.tableLoading = true;
|
|
685
|
+
} else {
|
|
686
|
+
this.assignTableData = this.tableArray.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
687
|
+
// this.tableData ? this.tableLoading = false : this.tableLoading = true;
|
|
688
|
+
}
|
|
689
|
+
// this.assignTableData ? this.tableLoading = false : this.tableLoading = true;
|
|
690
|
+
// this.getAssignTable()
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
searchTable: any;
|
|
694
|
+
searchTableData() {
|
|
695
|
+
this.assignTableData = [];
|
|
696
|
+
this.pageSize = 5;
|
|
697
|
+
this.currentPage = 1;
|
|
698
|
+
// this.tableLoading = true;
|
|
699
|
+
let searchField: any = ['storeName', 'userName', 'userEmail', 'clusterName', 'teamName'];
|
|
700
|
+
if (!this.searchInput.value) {
|
|
701
|
+
(this.assignType === 'store' || this.assignType === 'user') ? (this.singleAssign = this.idList,this.getTableData()) : (this.groupAssign = this.idList,this.userDetailsV2());
|
|
702
|
+
} else {
|
|
703
|
+
const searchData = this.searchInput.value.toLowerCase();
|
|
704
|
+
const searchTerm = searchData.split(',').map((el: any) => el.trim());
|
|
705
|
+
this.searchTable = this.tableArray?.filter((item: any) =>
|
|
706
|
+
searchField.some((field: any) => searchTerm.some((term: any) => item[field]?.toLowerCase().includes(term))));
|
|
707
|
+
this.totalItems = this.searchTable.length;
|
|
708
|
+
if (this.totalItems < 5) {
|
|
709
|
+
this.paginationSizes = [this.totalItems];
|
|
710
|
+
this.pageSize = this.totalItems;
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
this.paginationSizes = [5, 10, 15, 20];
|
|
714
|
+
this.pageSize = 5;
|
|
715
|
+
}
|
|
716
|
+
this.assignTableData = this.searchTable.slice((this.currentPage * this.pageSize) - this.pageSize, this.currentPage * this.pageSize);
|
|
717
|
+
}
|
|
718
|
+
this.assignTableData ? this.assignTableApiState.next('loaded') : this.assignTableApiState.next('loading');
|
|
719
|
+
|
|
720
|
+
// let params = {
|
|
721
|
+
// offset: 0,
|
|
722
|
+
// limit: this.size,
|
|
723
|
+
// search: this.tableFilter,
|
|
724
|
+
// id: this.checklistId,
|
|
725
|
+
// clientId:this.clientId
|
|
726
|
+
// }
|
|
727
|
+
// if (this.tableFilter.length) {
|
|
728
|
+
// this.SopService.getUserDetails(params).pipe(takeUntil(this.detach)).subscribe((res: any) => {
|
|
729
|
+
// this.tableLoading = false;
|
|
730
|
+
// if (res == null) {
|
|
731
|
+
// this.showImage = true;
|
|
732
|
+
// if (this.tableFilter.length)
|
|
733
|
+
// this.showImage = false;
|
|
734
|
+
// this.tableData = [];
|
|
735
|
+
// }
|
|
736
|
+
// if (res && res.code == 200) {
|
|
737
|
+
// this.showImage = false;
|
|
738
|
+
// this.tableData = res.data.users;
|
|
739
|
+
// this.recordsCount = this.tableData.length;
|
|
740
|
+
// this.recordsTotal = res.data.count;
|
|
741
|
+
// let count = 0 ;
|
|
742
|
+
// if(this.recordsTotal < 5) {
|
|
743
|
+
// this.paginationSize = [this.recordsTotal]
|
|
744
|
+
// this.size = this.recordsTotal;
|
|
745
|
+
// }
|
|
746
|
+
// else {
|
|
747
|
+
// this.paginationSize = [5,10,15,20]
|
|
748
|
+
// this.size = 5;
|
|
749
|
+
// }
|
|
750
|
+
// this.tableData.forEach((item:any) =>{
|
|
751
|
+
// if(item.checkFlag && !this.configData.checkListDetails.assignedUsers.includes(item.id) && !this.removeUsers.includes(item.id))
|
|
752
|
+
// this.configData.checkListDetails.assignedUsers.push(item.id);
|
|
753
|
+
|
|
754
|
+
// if (this.configData.checkListDetails.assignedUsers.includes(item.id)) {
|
|
755
|
+
// count +=1;
|
|
756
|
+
// }
|
|
757
|
+
// })
|
|
758
|
+
// if (count == this.recordsCount) {
|
|
759
|
+
// this.selectAll = true;
|
|
760
|
+
// }
|
|
761
|
+
// else {
|
|
762
|
+
// this.selectAll = false
|
|
763
|
+
// }
|
|
764
|
+
// }
|
|
765
|
+
// })
|
|
766
|
+
// }
|
|
767
|
+
// else {
|
|
768
|
+
// this.userDetails();
|
|
769
|
+
// }
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
dropDown: boolean = false;
|
|
773
|
+
openDropdown(event: any) {
|
|
774
|
+
this.dropDown = !this.dropDown;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
bulkuploadModel() {
|
|
778
|
+
this.dropDown = false;
|
|
779
|
+
this.dialog.open(this.bulkupload, {
|
|
780
|
+
centered: true, backdrop: 'static'
|
|
781
|
+
})
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
excelError: any;
|
|
785
|
+
|
|
786
|
+
afterUplload(data?: any) {
|
|
787
|
+
this.excelError = data;
|
|
788
|
+
this.dialog.open(this.afterValidation, { centered: true, backdrop: 'static' })
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
onUserAssignChange(event: boolean, id: string) {
|
|
792
|
+
if (!event) {
|
|
793
|
+
this.removedUsers.add(id)
|
|
794
|
+
} else {
|
|
795
|
+
this.removedUsers.delete(id)
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
downloadTemplateV2() {
|
|
800
|
+
let excelData: any = [];
|
|
801
|
+
if (this.storeCoverage) {
|
|
802
|
+
if (this.tableArray == null || !this.tableArray?.length) {
|
|
803
|
+
if (this.assignType === 'store') {
|
|
804
|
+
excelData.push({
|
|
805
|
+
storeName: '',
|
|
806
|
+
userName: '',
|
|
807
|
+
userEmail: '',
|
|
808
|
+
userPhone: '',
|
|
809
|
+
city:''
|
|
810
|
+
})
|
|
811
|
+
} else {
|
|
812
|
+
excelData.push({
|
|
813
|
+
storeName: '',
|
|
814
|
+
userName: '',
|
|
815
|
+
userEmail: '',
|
|
816
|
+
clusterName: '',
|
|
817
|
+
userPhone: '',
|
|
818
|
+
city:''
|
|
819
|
+
})
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (this.tableArray && this.tableArray?.length) {
|
|
823
|
+
this.tableArray.forEach((item: any) => {
|
|
824
|
+
if (this.assignType === 'store') {
|
|
825
|
+
excelData.push({
|
|
826
|
+
storeName: item.storeName,
|
|
827
|
+
userName: item.userName,
|
|
828
|
+
userEmail: item.userEmail,
|
|
829
|
+
userPhone: item.userPhone,
|
|
830
|
+
city:item.city
|
|
831
|
+
})
|
|
832
|
+
} else {
|
|
833
|
+
excelData.push({
|
|
834
|
+
storeName: item.storeName,
|
|
835
|
+
userName: item.userName,
|
|
836
|
+
userEmail: item.userEmail,
|
|
837
|
+
clusterName: item.clusterName,
|
|
838
|
+
userPhone: item.userPhone,
|
|
839
|
+
city:item.city
|
|
840
|
+
})
|
|
841
|
+
}
|
|
842
|
+
})
|
|
843
|
+
}
|
|
844
|
+
} else if (this.userCoverage) {
|
|
845
|
+
if (this.tableArray == null || !this.tableArray?.length) {
|
|
846
|
+
if (this.assignType === 'user') {
|
|
847
|
+
excelData.push({
|
|
848
|
+
userName: '',
|
|
849
|
+
userEmail: '',
|
|
850
|
+
userPhone: '',
|
|
851
|
+
})
|
|
852
|
+
} else {
|
|
853
|
+
excelData.push({
|
|
854
|
+
userName: '',
|
|
855
|
+
userEmail: '',
|
|
856
|
+
teamName: '',
|
|
857
|
+
userPhone: '',
|
|
858
|
+
})
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
if (this.tableArray && this.tableArray?.length) {
|
|
862
|
+
this.tableArray.forEach((item: any) => {
|
|
863
|
+
if (this.assignType === 'user') {
|
|
864
|
+
excelData.push({
|
|
865
|
+
userName: item.userName,
|
|
866
|
+
userEmail: item.userEmail,
|
|
867
|
+
userPhone: item.userPhone,
|
|
868
|
+
})
|
|
869
|
+
} else {
|
|
870
|
+
excelData.push({
|
|
871
|
+
userName: item.userName,
|
|
872
|
+
userEmail: item.userEmail,
|
|
873
|
+
teamName: item.teamName,
|
|
874
|
+
userPhone: item.userPhone,
|
|
875
|
+
})
|
|
876
|
+
}
|
|
877
|
+
})
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
this.traxService.exportAsExcelFile(excelData, `CheckList_${this.assignType}_`);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
downloadTemplate() {
|
|
884
|
+
let params = {
|
|
885
|
+
limit: 10000,
|
|
886
|
+
offset: 0,
|
|
887
|
+
taskId: this.currentTaskId,
|
|
888
|
+
search: this.searchInput.value,
|
|
889
|
+
clientId: this.headerData.client,
|
|
890
|
+
}
|
|
891
|
+
this.traxService.getTaskUserDetails(params).pipe(takeUntil(this.destroy$)).subscribe((res: any) => {
|
|
892
|
+
let excelData: any = [];
|
|
893
|
+
if (this.storeCoverage) {
|
|
894
|
+
if (res == null) {
|
|
895
|
+
excelData.push({
|
|
896
|
+
storeName: '',
|
|
897
|
+
clusterName: '',
|
|
898
|
+
userEmail: '',
|
|
899
|
+
userName: '',
|
|
900
|
+
userPhone: '',
|
|
901
|
+
city: ''
|
|
902
|
+
})
|
|
903
|
+
}
|
|
904
|
+
if (res && res.code == 200) {
|
|
905
|
+
res.data.users.forEach((item: any) => {
|
|
906
|
+
excelData.push({
|
|
907
|
+
storeName: item.storeName,
|
|
908
|
+
clusterName: item.clusterName,
|
|
909
|
+
userEmail: item.userEmail,
|
|
910
|
+
userName: item.userName,
|
|
911
|
+
userPhone: item.userPhone,
|
|
912
|
+
city: item.city
|
|
913
|
+
})
|
|
914
|
+
})
|
|
915
|
+
}
|
|
916
|
+
} else if (this.userCoverage) {
|
|
917
|
+
if (res == null) {
|
|
918
|
+
excelData.push({
|
|
919
|
+
// storeName: '',
|
|
920
|
+
teamName: '',
|
|
921
|
+
userEmail: '',
|
|
922
|
+
userName: '',
|
|
923
|
+
userPhone: '',
|
|
924
|
+
city:''
|
|
925
|
+
})
|
|
926
|
+
}
|
|
927
|
+
if (res && res?.code == 200) {
|
|
928
|
+
res?.data?.users.forEach((item: any) => {
|
|
929
|
+
excelData.push({
|
|
930
|
+
// storeName: item.storeName,
|
|
931
|
+
teamName: item.teamName,
|
|
932
|
+
userEmail: item.userEmail,
|
|
933
|
+
userName: item.userName,
|
|
934
|
+
userPhone: item.userPhone,
|
|
935
|
+
city:item.city
|
|
936
|
+
})
|
|
937
|
+
})
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
this.traxService.exportAsExcelFile(excelData, 'Task_Userlist_');
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
updateAssign(event: any) {
|
|
945
|
+
this.upload = '';
|
|
946
|
+
this.currentPage = 1;
|
|
947
|
+
// if (this.taskDetails) {
|
|
948
|
+
this.taskDetails.assign = event;
|
|
949
|
+
const assigneduser = event.map((el: any) => {
|
|
950
|
+
return {id: el?._id,type: el?.type}
|
|
951
|
+
})
|
|
952
|
+
// this.idList = event.map((el: any) => {
|
|
953
|
+
// return el?._id
|
|
954
|
+
// })
|
|
955
|
+
this.idList = assigneduser;
|
|
956
|
+
this.searchInput.setValue('');
|
|
957
|
+
(this.assignType === 'store' || this.assignType === 'user') ? (this.singleAssign = this.idList,this.getTableData()) : (this.groupAssign = this.idList,this.userDetailsV2(event));
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
removedChip(event: any) {
|
|
961
|
+
this.tableArray = this.tableArray.filter((item:any) => !event.includes(item._id))
|
|
962
|
+
this.taskDetails.assign = this.taskDetails.assign.filter((item: any) => !event.includes(item._id))
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
tableArray: any = [];
|
|
966
|
+
excelData: any;
|
|
967
|
+
showUser: boolean = false;
|
|
968
|
+
showTeam: boolean = false;
|
|
969
|
+
showStore: boolean = false;
|
|
970
|
+
showCluster: boolean = false;
|
|
971
|
+
|
|
972
|
+
onFileUpload(event: any, reupload?: any) {
|
|
973
|
+
this.validatedStore = [];
|
|
974
|
+
this.validatedUser = [];
|
|
975
|
+
this.validatedCluster = [];
|
|
976
|
+
this.validatedTeam = [];
|
|
977
|
+
this.newUser = [];
|
|
978
|
+
this.inactiveStores = [];
|
|
979
|
+
this.showUser = false;
|
|
980
|
+
this.showTeam = false;
|
|
981
|
+
this.showStore = false;
|
|
982
|
+
this.showCluster = false;
|
|
983
|
+
this.showInactive = false;
|
|
984
|
+
this.currentPage = 1;
|
|
985
|
+
this.reupload = false;
|
|
986
|
+
this.upload = 'upload';
|
|
987
|
+
this.userData = this.excelUserData = [];
|
|
988
|
+
let data: any;
|
|
989
|
+
const target: DataTransfer = <DataTransfer>(event.target);
|
|
990
|
+
let isExcelFile = !!target.files[0].name.match(/(.xls|.xlsx)/);
|
|
991
|
+
let error: any = [];
|
|
992
|
+
let ValidationError: boolean = false;
|
|
993
|
+
if (isExcelFile) {
|
|
994
|
+
const reader: FileReader = new FileReader();
|
|
995
|
+
reader.readAsBinaryString(target.files[0]);
|
|
996
|
+
reader.onload = (e: any) => {
|
|
997
|
+
const bstr: string = e.target.result;
|
|
998
|
+
const wb: XLSX.WorkBook = XLSX.read(bstr, { type: 'binary' });
|
|
999
|
+
const wsname: string = wb.SheetNames[0];
|
|
1000
|
+
const ws: XLSX.WorkSheet = wb.Sheets[wsname];
|
|
1001
|
+
data = XLSX.utils.sheet_to_json(ws);
|
|
1002
|
+
this.excelData = data;
|
|
1003
|
+
if(!data.length || (data.some((item: any) => 'clusterName' in item || 'teamName' in item))) {
|
|
1004
|
+
this.toastService.getErrorToast('Please Upload a Valid file.')
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
const requiredKeys = this.storeCoverage ? ['storeName','userName', 'userEmail'] : ['userName', 'userEmail']; // Must always be present
|
|
1009
|
+
const optionalKeys = this.storeCoverage ? ['userPhone', 'city'] : ['userPhone', 'city'];
|
|
1010
|
+
|
|
1011
|
+
const isValid = data.some((item: any) => {
|
|
1012
|
+
const keys = Object.keys(item);
|
|
1013
|
+
const hasRequiredKeys = requiredKeys.every(key => keys.includes(key));
|
|
1014
|
+
const allKeysAreAllowed = keys.every(key =>
|
|
1015
|
+
requiredKeys.includes(key) || optionalKeys.includes(key)
|
|
1016
|
+
);
|
|
1017
|
+
return hasRequiredKeys && allKeysAreAllowed;
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
if (!isValid) {
|
|
1021
|
+
this.toastService.getErrorToast('Please Upload a Valid file.');
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
data = data.filter((item:any) => {
|
|
1026
|
+
return ((item?.storeName && item?.storeName.trim() != '' && item?.storeName.trim() != null) || (item?.userName && item?.userName.trim() != '' && item?.userName.trim() != null) || (item?.userEmail && item?.userEmail.trim() != '' && item?.userEmail.trim() != null))
|
|
1027
|
+
})
|
|
1028
|
+
|
|
1029
|
+
data.forEach((element: any, index: any) => {
|
|
1030
|
+
if (element?.userEmail) {
|
|
1031
|
+
element.userEmail = element?.userEmail.replace(/\s/g,'');
|
|
1032
|
+
}
|
|
1033
|
+
if (this.storeCoverage) {
|
|
1034
|
+
if ((element.storeName && element.storeName.trim() == '') || element.storeName == null) {
|
|
1035
|
+
error.push(`Invalid StoreName - A${index+2}`)
|
|
1036
|
+
}
|
|
1037
|
+
if ((element.userName && element.userName.trim() == '') || element.userName == null) {
|
|
1038
|
+
error.push(`Invalid UserName - B${index+2}`)
|
|
1039
|
+
}
|
|
1040
|
+
if ((element.userEmail && element.userEmail.trim() == '') || element.userEmail == null) {
|
|
1041
|
+
error.push(`Invalid userEmail - C${index+2}`)
|
|
1042
|
+
}
|
|
1043
|
+
if (element?.userEmail && !element.userEmail.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/)) {
|
|
1044
|
+
error.push(`Invalid userEmail - C${index+2}`)
|
|
1045
|
+
}
|
|
1046
|
+
if (element.clusterName) {
|
|
1047
|
+
if (element.clusterName.trim() == '' || element.clusterName == null) { error.push(`Invalid clusterName - D${index + 2}`) }
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
} else if (this.userCoverage && !element?.storeName) {
|
|
1051
|
+
if ((element.userName && element.userName.trim() == '') || element.userName == null) {
|
|
1052
|
+
error.push(`Invalid UserName - A${index+2}`)
|
|
1053
|
+
}
|
|
1054
|
+
if ((element.userEmail && element.userEmail.trim() == '') || element.userEmail == null) {
|
|
1055
|
+
error.push(`Invalid userEmail - B${index+2}`)
|
|
1056
|
+
}
|
|
1057
|
+
if (element?.userEmail && !element.userEmail.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/)) {
|
|
1058
|
+
error.push(`Invalid userEmail - B${index+2}`)
|
|
1059
|
+
}
|
|
1060
|
+
if (element.teamName) {
|
|
1061
|
+
if (element.teamName.trim() == '' || element.teamName == null) { error.push(`Invalid teamName - C${index + 2}`) }
|
|
1062
|
+
}
|
|
1063
|
+
} else {
|
|
1064
|
+
this.toastService.getErrorToast('Please upload a valid file.')
|
|
1065
|
+
ValidationError = true;
|
|
1066
|
+
}
|
|
1067
|
+
if (this.storeCoverage) {
|
|
1068
|
+
if (this.assignType === 'store') {
|
|
1069
|
+
this.userData.push({
|
|
1070
|
+
storeName: element?.storeName?.trim(),
|
|
1071
|
+
userName: element?.userName?.trim(),
|
|
1072
|
+
userEmail: element?.userEmail?.toLowerCase()?.trim(),
|
|
1073
|
+
userPhone: element?.userPhone,
|
|
1074
|
+
// checkFlag: element?.check ? element.check : false,
|
|
1075
|
+
city: element?.city,
|
|
1076
|
+
type:'store'
|
|
1077
|
+
})
|
|
1078
|
+
} else {
|
|
1079
|
+
this.userData.push({
|
|
1080
|
+
storeName: element?.storeName?.trim(),
|
|
1081
|
+
userName: element?.userName?.trim(),
|
|
1082
|
+
userEmail: element?.userEmail?.toLowerCase()?.trim(),
|
|
1083
|
+
clusterName: element?.clusterName,
|
|
1084
|
+
userPhone: element?.userPhone,
|
|
1085
|
+
// checkFlag: element?.check ? element.check : false,
|
|
1086
|
+
city: element?.city,
|
|
1087
|
+
type:'cluster'
|
|
1088
|
+
})
|
|
1089
|
+
}
|
|
1090
|
+
} else if (this.userCoverage) {
|
|
1091
|
+
if (this.assignType === 'user') {
|
|
1092
|
+
this.userData.push({
|
|
1093
|
+
userName: element?.userName?.trim(),
|
|
1094
|
+
userEmail: element?.userEmail?.toLowerCase()?.trim(),
|
|
1095
|
+
userPhone: element?.userPhone,
|
|
1096
|
+
// checkFlag: element?.check ? element.check : false,
|
|
1097
|
+
type:'user'
|
|
1098
|
+
})
|
|
1099
|
+
} else {
|
|
1100
|
+
this.userData.push({
|
|
1101
|
+
userName: element?.userName?.trim(),
|
|
1102
|
+
userEmail: element?.userEmail?.toLowerCase()?.trim(),
|
|
1103
|
+
teamName: element?.teamName,
|
|
1104
|
+
userPhone: element?.userPhone,
|
|
1105
|
+
// checkFlag: element?.check ? element.check : false,
|
|
1106
|
+
type: 'teams'
|
|
1107
|
+
})
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
})
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
if (error.length) {
|
|
1114
|
+
this.dialog.dismissAll();
|
|
1115
|
+
const popupcontent = {
|
|
1116
|
+
displayprop: false,
|
|
1117
|
+
imagesrc: `<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56" fill="none"><rect x="4" y="4" width="48" height="48" rx="24" fill="#FEF0C7"/><path d="M27.9998 24.0012V28.0012M27.9998 32.0012H28.0098M26.2898 18.8612L17.8198 33.0012C17.6451 33.3036 17.5527 33.6465 17.5518 33.9957C17.5508 34.3449 17.6413 34.6883 17.8142 34.9917C17.9871 35.2951 18.2365 35.5479 18.5375 35.725C18.8385 35.9021 19.1806 35.9973 19.5298 36.0012H36.4698C36.819 35.9973 37.1611 35.9021 37.4621 35.725C37.7631 35.5479 38.0124 35.2951 38.1854 34.9917C38.3583 34.6883 38.4488 34.3449 38.4478 33.9957C38.4468 33.6465 38.3544 33.3036 38.1798 33.0012L29.7098 18.8612C29.5315 18.5673 29.2805 18.3243 28.981 18.1557C28.6814 17.987 28.3435 17.8984 27.9998 17.8984C27.656 17.8984 27.3181 17.987 27.0186 18.1557C26.7191 18.3243 26.468 18.5673 26.2898 18.8612Z" stroke="#DC6803" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><rect x="4" y="4" width="48" height="48" rx="24" stroke="#FFFAEB" stroke-width="8"/></svg>`,
|
|
1118
|
+
title: `Invalid details!`,
|
|
1119
|
+
content: `Please provide correct and complete store information.`,
|
|
1120
|
+
buttontype: 'error',
|
|
1121
|
+
error:error
|
|
1122
|
+
}
|
|
1123
|
+
this.afterUplload(popupcontent)
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
!ValidationError ? this.afterUplload() : '';
|
|
1128
|
+
}
|
|
1129
|
+
if(this.fileInput) {
|
|
1130
|
+
this.fileInput.nativeElement.value = '';
|
|
1131
|
+
}
|
|
1132
|
+
if(this.fileInput1) {
|
|
1133
|
+
this.fileInput1.nativeElement.value = '';
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
else {
|
|
1138
|
+
if(this.fileInput) {
|
|
1139
|
+
this.fileInput.nativeElement.value = '';
|
|
1140
|
+
}
|
|
1141
|
+
if(this.fileInput1) {
|
|
1142
|
+
this.fileInput1.nativeElement.value = '';
|
|
1143
|
+
}
|
|
1144
|
+
this.toastService.getErrorToast('Please Upload a Excel file.');
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
upload: any = 'upload';
|
|
1149
|
+
validatedStore: any = [];
|
|
1150
|
+
validatedUser: any = [];
|
|
1151
|
+
validatedCluster: any = [];
|
|
1152
|
+
validatedTeam: any = [];
|
|
1153
|
+
newUser: any = [];
|
|
1154
|
+
inactiveStores: any = [];
|
|
1155
|
+
showInactive: any= false ;
|
|
1156
|
+
|
|
1157
|
+
validateDetails(addUser?:any) {
|
|
1158
|
+
let params:any = {
|
|
1159
|
+
taskId: this.currentTaskId,
|
|
1160
|
+
// assignUsers: this.userData,
|
|
1161
|
+
assignedUsers: this.userData,
|
|
1162
|
+
clientId: this.headerData?.client,
|
|
1163
|
+
coverage: this.coverage
|
|
1164
|
+
}
|
|
1165
|
+
addUser ? params.addUser = true : '';
|
|
1166
|
+
this.traxService.taskvalidateUserv1(params).pipe(takeUntil(this.destroy$)).subscribe({
|
|
1167
|
+
next: (res: any) => {
|
|
1168
|
+
if (res && res?.code == 200) {
|
|
1169
|
+
if (this.upload === 'store') {
|
|
1170
|
+
this.tableArray.unshift(...res?.data?.data);
|
|
1171
|
+
this.configData.checkListDetails.assign = this.tableArray;
|
|
1172
|
+
let data = this.tableArray.map((el:any) => {
|
|
1173
|
+
return { id: el?._id, type: el?.type }
|
|
1174
|
+
})
|
|
1175
|
+
this.idList = data;
|
|
1176
|
+
this.singleAssign = this.idList;
|
|
1177
|
+
this.getTableData();
|
|
1178
|
+
this.assignType === 'user' ? this.getassignDropdown('change') : '';
|
|
1179
|
+
} else {
|
|
1180
|
+
this.tableArray = [];
|
|
1181
|
+
|
|
1182
|
+
this.assignTableApiState.next('loading')
|
|
1183
|
+
this.tableArray = res?.data?.data;
|
|
1184
|
+
this.assignSingle = res?.data?.data;
|
|
1185
|
+
this.configData.checkListDetails.assign = this.tableArray;
|
|
1186
|
+
let data = res?.data?.data.map((el:any) => {
|
|
1187
|
+
return { id: el?._id, type: el?.type }
|
|
1188
|
+
})
|
|
1189
|
+
this.idList = data;
|
|
1190
|
+
this.singleAssign = this.idList;
|
|
1191
|
+
this.assignTableApiState.next('loaded')
|
|
1192
|
+
this.getTableData();
|
|
1193
|
+
this.assignType === 'user' ? this.getassignDropdown('change') : '';
|
|
1194
|
+
}
|
|
1195
|
+
this.dialog.dismissAll();
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
error: (err: any) => {
|
|
1199
|
+
if (err?.error?.error && err?.error?.code == 400) {
|
|
1200
|
+
let errorData = err?.error?.error;
|
|
1201
|
+
this.excelData = errorData?.data;
|
|
1202
|
+
this.userData = errorData?.data;
|
|
1203
|
+
if (errorData.existEmail?.length) {
|
|
1204
|
+
this.toastService.getErrorToast(`Already ${errorData.existEmail.toString()} assigned to another client`)
|
|
1205
|
+
}else if (errorData.store?.length && !errorData.existEmail?.length) {
|
|
1206
|
+
this.validatedStore = errorData?.store;
|
|
1207
|
+
this.showStore = true;
|
|
1208
|
+
this.afterUplload();
|
|
1209
|
+
}else if (errorData.store?.length && errorData.existEmail?.length) {
|
|
1210
|
+
!errorData?.inActiveStores?.length ? this.dialog.dismissAll() : '';
|
|
1211
|
+
this.toastService.getErrorToast(`Already ${errorData.store.toString()} assigned to another client`)
|
|
1212
|
+
}else if (errorData?.inActiveStores?.length) {
|
|
1213
|
+
this.inactiveStores = errorData?.inActiveStores;
|
|
1214
|
+
this.showInactive = true;
|
|
1215
|
+
this.afterUplload();
|
|
1216
|
+
}else if (errorData?.user?.length && !errorData?.existEmail?.length) {
|
|
1217
|
+
this.validatedUser = errorData.user;
|
|
1218
|
+
this.showUser = true;
|
|
1219
|
+
if (this.upload === 'store') {
|
|
1220
|
+
this.confirmUserpopup();
|
|
1221
|
+
} else {
|
|
1222
|
+
this.afterUplload();
|
|
1223
|
+
}
|
|
1224
|
+
}else if (errorData?.user?.length && errorData?.existEmail?.length) {
|
|
1225
|
+
this.dialog.dismissAll();
|
|
1226
|
+
this.toastService.getErrorToast(`Already ${errorData?.user.toString()} assigned to another client`)
|
|
1227
|
+
}
|
|
1228
|
+
if (errorData?.duplicates?.length) {
|
|
1229
|
+
this.dialog.dismissAll();
|
|
1230
|
+
this.toastService.getErrorToast(`${errorData?.duplicates?.toString()} - ${errorData?.message}`)
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1234
|
+
})
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
Reupload() {
|
|
1238
|
+
// this.dialog.dismissAll();
|
|
1239
|
+
this.validatedStore = [];
|
|
1240
|
+
this.validatedUser = [];
|
|
1241
|
+
this.validatedCluster = [];
|
|
1242
|
+
this.validatedTeam = [];
|
|
1243
|
+
this.newUser = [];
|
|
1244
|
+
this.inactiveStores = [];
|
|
1245
|
+
this.showUser = false;
|
|
1246
|
+
this.showTeam = false;
|
|
1247
|
+
this.showStore = false;
|
|
1248
|
+
this.showCluster = false;
|
|
1249
|
+
this.showInactive = false;
|
|
1250
|
+
if(this.fileInput) {
|
|
1251
|
+
this.fileInput.nativeElement.value = '';
|
|
1252
|
+
}
|
|
1253
|
+
if(this.fileInput1) {
|
|
1254
|
+
this.fileInput1.nativeElement.value = '';
|
|
1255
|
+
}
|
|
1256
|
+
let ele = document.getElementById('kt_account_team_size_select_2');
|
|
1257
|
+
ele?.click();
|
|
1258
|
+
this.cd.detectChanges();
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
closeactivepopup() {
|
|
1262
|
+
this.dialog.dismissAll();
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// onFileUpload(event: any) {
|
|
1266
|
+
// //Empty sheet validation ---done
|
|
1267
|
+
// //empty field validation for storeName, userName, userEmail, city. I
|
|
1268
|
+
// // validate user email
|
|
1269
|
+
// // Email unique for store
|
|
1270
|
+
// // Email unique for username
|
|
1271
|
+
// const target: DataTransfer = <DataTransfer>(event.target);
|
|
1272
|
+
// // let isExcelFile = !!target.files[0].name.match(/(.xls|.xlsx)/);
|
|
1273
|
+
|
|
1274
|
+
// const reader: FileReader = new FileReader();
|
|
1275
|
+
// reader.readAsBinaryString(target.files[0]);
|
|
1276
|
+
// reader.onload = (e: any) => {
|
|
1277
|
+
// const bstr: string = e.target.result;
|
|
1278
|
+
// const wb: XLSX.WorkBook = XLSX.read(bstr, { type: 'binary' });
|
|
1279
|
+
// const wsname: string = wb.SheetNames[0];
|
|
1280
|
+
// const ws: XLSX.WorkSheet = wb.Sheets[wsname];
|
|
1281
|
+
|
|
1282
|
+
// const jsonWithPosition: any[] = [];
|
|
1283
|
+
|
|
1284
|
+
// const range = XLSX.utils.decode_range(ws['!ref'] || '');
|
|
1285
|
+
|
|
1286
|
+
// const headers: string[] = [];
|
|
1287
|
+
// for (let C = range.s.c; C <= range.e.c; ++C) {
|
|
1288
|
+
// const cellAddress = XLSX.utils.encode_cell({ r: range.s.r, c: C });
|
|
1289
|
+
// const header = ws[cellAddress]?.v || `Column${C + 1}`;
|
|
1290
|
+
// headers.push(header);
|
|
1291
|
+
// }
|
|
1292
|
+
|
|
1293
|
+
// for (let R = range.s.r + 1; R <= range.e.r; ++R) {
|
|
1294
|
+
// const rowData: any = { row: R + 1 };
|
|
1295
|
+
|
|
1296
|
+
// for (let C = range.s.c; C <= range.e.c; ++C) {
|
|
1297
|
+
// const cellAddress = XLSX.utils.encode_cell({ r: R, c: C });
|
|
1298
|
+
// const cell = ws[cellAddress];
|
|
1299
|
+
// const header = headers[C - range.s.c];
|
|
1300
|
+
|
|
1301
|
+
// rowData[header] = cell?.v || "";
|
|
1302
|
+
// rowData[`column_${header}`] = XLSX.utils.encode_col(C);
|
|
1303
|
+
// }
|
|
1304
|
+
|
|
1305
|
+
// jsonWithPosition.push(rowData);
|
|
1306
|
+
// }
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
// const filteredData = jsonWithPosition.filter(row => {
|
|
1310
|
+
// const keys = Object.keys(row).filter(key => !key.startsWith('column_') && key !== 'row');
|
|
1311
|
+
// return keys.some(key => row[key].trim() !== undefined && row[key].trim() !== null && row[key].trim() !== "");
|
|
1312
|
+
// });
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
// if (!filteredData.length) {
|
|
1316
|
+
// return this.toastService.getErrorToast(`Please enter valid details`)
|
|
1317
|
+
// }
|
|
1318
|
+
|
|
1319
|
+
// const emptyKeys: any[] = []
|
|
1320
|
+
// const invalidEmails: any[] = []
|
|
1321
|
+
|
|
1322
|
+
// filteredData.forEach((row) => {
|
|
1323
|
+
// const keys = Object.keys(row).filter(key => !key.startsWith('column_') && key !== 'row')
|
|
1324
|
+
|
|
1325
|
+
// keys.forEach((key) => {
|
|
1326
|
+
// if (key === 'userEmail') {
|
|
1327
|
+
// const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1328
|
+
// const isValidMail = emailRegex.test(row['userEmail']);
|
|
1329
|
+
// if (!isValidMail) invalidEmails.push(row[`column_${key}`] + row.row)
|
|
1330
|
+
// }
|
|
1331
|
+
// if (!row[key] && (key === 'storeName' || key === 'userEmail' || key === 'userName')) emptyKeys.push(row[`column_${key}`] + row.row)
|
|
1332
|
+
// })
|
|
1333
|
+
// })
|
|
1334
|
+
|
|
1335
|
+
// if (emptyKeys.length) {
|
|
1336
|
+
// return this.toastService.getErrorToast(`Please fill the cells ${emptyKeys.join(', ')}`)
|
|
1337
|
+
// }
|
|
1338
|
+
|
|
1339
|
+
// if (invalidEmails.length) {
|
|
1340
|
+
// return this.toastService.getErrorToast(`Please enter valid emails at ${invalidEmails.join(', ')}`)
|
|
1341
|
+
// }
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
// const groupedByEmail = filteredData.reduce((acc, item) => {
|
|
1345
|
+
// if (!acc[item.userEmail]) {
|
|
1346
|
+
// acc[item.userEmail] = [];
|
|
1347
|
+
// }
|
|
1348
|
+
// acc[item.userEmail].push(item.storeName);
|
|
1349
|
+
// return acc;
|
|
1350
|
+
// }, {} as Record<string, string[]>);
|
|
1351
|
+
|
|
1352
|
+
// const uniqueResult = Object.entries(groupedByEmail).map(([email, storeNames]) => {
|
|
1353
|
+
// const uniqueStoreNames = new Set<string>(storeNames as string);
|
|
1354
|
+
// return {
|
|
1355
|
+
// userEmail: email,
|
|
1356
|
+
// isStoreNameUnique: uniqueStoreNames.size === (storeNames as Array<string>).length,
|
|
1357
|
+
// storeNames: Array.from(uniqueStoreNames),
|
|
1358
|
+
// };
|
|
1359
|
+
// });
|
|
1360
|
+
|
|
1361
|
+
// const notUnique = uniqueResult.filter((item) => !item.isStoreNameUnique).map((item) => item.userEmail)
|
|
1362
|
+
|
|
1363
|
+
// if (notUnique.length) {
|
|
1364
|
+
// return this.toastService.getErrorToast(`${notUnique.join(', ')} should be unique for store name`)
|
|
1365
|
+
// }
|
|
1366
|
+
|
|
1367
|
+
// this.fileInput.nativeElement.value = ''
|
|
1368
|
+
// event.target.value = ''
|
|
1369
|
+
|
|
1370
|
+
// const assignList = filteredData.map((data) => {
|
|
1371
|
+
// return {
|
|
1372
|
+
// storeName: data.storeName,
|
|
1373
|
+
// userEmail: data.userEmail,
|
|
1374
|
+
// userName: data.userName,
|
|
1375
|
+
// userPhone: data?.userPhone,
|
|
1376
|
+
// city: data?.city
|
|
1377
|
+
// }
|
|
1378
|
+
// })
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
// const payload = {
|
|
1382
|
+
// id: this.currentTaskId,
|
|
1383
|
+
// uploadUser: true,
|
|
1384
|
+
// clientId: this.headerData.client,
|
|
1385
|
+
// assignedUsers: assignList
|
|
1386
|
+
// }
|
|
1387
|
+
|
|
1388
|
+
// this.uploadAssigneesList(payload).subscribe({
|
|
1389
|
+
// next: (res: any) => {
|
|
1390
|
+
// if (res?.data?.validate) {
|
|
1391
|
+
// this.getAssignTable()
|
|
1392
|
+
// }
|
|
1393
|
+
// if (res?.data?.user?.length) {
|
|
1394
|
+
// const popupcontent = {
|
|
1395
|
+
// displayprop: false,
|
|
1396
|
+
// imagesrc: '<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56" fill="none"><rect x="4" y="4" width="48" height="48" rx="24" fill="#FEF0C7"/><path d="M27.9998 24.0012V28.0012M27.9998 32.0012H28.0098M26.2898 18.8612L17.8198 33.0012C17.6451 33.3036 17.5527 33.6465 17.5518 33.9957C17.5508 34.3449 17.6413 34.6883 17.8142 34.9917C17.9871 35.2951 18.2365 35.5479 18.5375 35.725C18.8385 35.9021 19.1806 35.9973 19.5298 36.0012H36.4698C36.819 35.9973 37.1611 35.9021 37.4621 35.725C37.7631 35.5479 38.0124 35.2951 38.1854 34.9917C38.3583 34.6883 38.4488 34.3449 38.4478 33.9957C38.4468 33.6465 38.3544 33.3036 38.1798 33.0012L29.7098 18.8612C29.5315 18.5673 29.2805 18.3243 28.981 18.1557C28.6814 17.987 28.3435 17.8984 27.9998 17.8984C27.656 17.8984 27.3181 17.987 27.0186 18.1557C26.7191 18.3243 26.468 18.5673 26.2898 18.8612Z" stroke="#DC6803" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><rect x="4" y="4" width="48" height="48" rx="24" stroke="#FFFAEB" stroke-width="8"/></svg>',
|
|
1397
|
+
// title: `Invite new users added in CSV`,
|
|
1398
|
+
// content: `This CSV contains new users. Invite users by sending mail to them`,
|
|
1399
|
+
// buttontype: 'Invite',
|
|
1400
|
+
// user: res.data.user
|
|
1401
|
+
// }
|
|
1402
|
+
// const dialogRef = this.dialog.open(TraxpopupComponent, {
|
|
1403
|
+
// centered: true, size: 'md'
|
|
1404
|
+
// });
|
|
1405
|
+
// dialogRef.componentInstance.data = popupcontent;
|
|
1406
|
+
// dialogRef.result.then((result) => {
|
|
1407
|
+
// if (result.message === 'confirm') {
|
|
1408
|
+
// const payload = {
|
|
1409
|
+
// id: this.currentTaskId,
|
|
1410
|
+
// uploadUser: true,
|
|
1411
|
+
// clientId: this.headerData.client,
|
|
1412
|
+
// assignedUsers: assignList
|
|
1413
|
+
// }
|
|
1414
|
+
// this.uploadAssigneesList(payload, { addUser: true }).pipe(takeUntil(this.destroy$)).subscribe({
|
|
1415
|
+
// next: (res) => {
|
|
1416
|
+
// this.getAssignTable()
|
|
1417
|
+
// }
|
|
1418
|
+
// })
|
|
1419
|
+
// }
|
|
1420
|
+
|
|
1421
|
+
// });
|
|
1422
|
+
// }
|
|
1423
|
+
// if (res?.data?.store?.length) {
|
|
1424
|
+
// function formatMessages(messages: any[]): string {
|
|
1425
|
+
// const groupedMessages: Record<string, string[]> = {};
|
|
1426
|
+
|
|
1427
|
+
// messages.forEach(({ store, message }) => {
|
|
1428
|
+
// if (!groupedMessages[store]) {
|
|
1429
|
+
// groupedMessages[store] = [];
|
|
1430
|
+
// }
|
|
1431
|
+
// groupedMessages[store].push(message);
|
|
1432
|
+
// });
|
|
1433
|
+
|
|
1434
|
+
// const formattedMessages = Object.entries(groupedMessages).map(([store, msgs]) => {
|
|
1435
|
+
// return `${msgs.join(', ')} in ${store}`;
|
|
1436
|
+
// });
|
|
1437
|
+
|
|
1438
|
+
// return formattedMessages.join(', ');
|
|
1439
|
+
// }
|
|
1440
|
+
// this.toastService.getErrorToast(formatMessages(res?.data?.store))
|
|
1441
|
+
// }
|
|
1442
|
+
// },
|
|
1443
|
+
// error: (err) => {
|
|
1444
|
+
// this.toastService.getErrorToast(err?.error?.error || 'Something went wrong')
|
|
1445
|
+
// }
|
|
1446
|
+
// })
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
// }
|
|
1450
|
+
// }
|
|
1451
|
+
|
|
1452
|
+
addStoreComponent() {
|
|
1453
|
+
const dialogRef = this.dialog.open(TraxStoreComponent, {
|
|
1454
|
+
centered: true, size: 'md'
|
|
1455
|
+
});
|
|
1456
|
+
|
|
1457
|
+
dialogRef.componentInstance.data = {
|
|
1458
|
+
checklistId: this.currentTaskId,
|
|
1459
|
+
obj: {
|
|
1460
|
+
checkListId: this.currentTaskId,
|
|
1461
|
+
clientId: this.headerData.client,
|
|
1462
|
+
},
|
|
1463
|
+
coverage: this.coverage,
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
dialogRef.result.then((res) => {
|
|
1467
|
+
if(res) {
|
|
1468
|
+
this.userData = res;
|
|
1469
|
+
this.upload = 'store';
|
|
1470
|
+
this.validateDetails();
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
// dialogRef.result.then((res) => {
|
|
1475
|
+
// if (res) {
|
|
1476
|
+
// const payload = {
|
|
1477
|
+
// id: this.currentTaskId,
|
|
1478
|
+
// uploadUser: true,
|
|
1479
|
+
// clientId: this.headerData.client,
|
|
1480
|
+
// assignedUsers: res
|
|
1481
|
+
// }
|
|
1482
|
+
|
|
1483
|
+
// this.uploadAssigneesList(payload, { delete: false }).pipe(takeUntil(this.destroy$)).subscribe({
|
|
1484
|
+
// next: (res1: any) => {
|
|
1485
|
+
// if (res1.code === 200) {
|
|
1486
|
+
// if (res1?.data?.user?.length) {
|
|
1487
|
+
// const popupcontent = {
|
|
1488
|
+
// displayprop: false,
|
|
1489
|
+
// imagesrc: '<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56" fill="none"><rect x="4" y="4" width="48" height="48" rx="24" fill="#FEF0C7"/><path d="M27.9998 24.0012V28.0012M27.9998 32.0012H28.0098M26.2898 18.8612L17.8198 33.0012C17.6451 33.3036 17.5527 33.6465 17.5518 33.9957C17.5508 34.3449 17.6413 34.6883 17.8142 34.9917C17.9871 35.2951 18.2365 35.5479 18.5375 35.725C18.8385 35.9021 19.1806 35.9973 19.5298 36.0012H36.4698C36.819 35.9973 37.1611 35.9021 37.4621 35.725C37.7631 35.5479 38.0124 35.2951 38.1854 34.9917C38.3583 34.6883 38.4488 34.3449 38.4478 33.9957C38.4468 33.6465 38.3544 33.3036 38.1798 33.0012L29.7098 18.8612C29.5315 18.5673 29.2805 18.3243 28.981 18.1557C28.6814 17.987 28.3435 17.8984 27.9998 17.8984C27.656 17.8984 27.3181 17.987 27.0186 18.1557C26.7191 18.3243 26.468 18.5673 26.2898 18.8612Z" stroke="#DC6803" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><rect x="4" y="4" width="48" height="48" rx="24" stroke="#FFFAEB" stroke-width="8"/></svg>',
|
|
1490
|
+
// title: `Invite new users added in CSV`,
|
|
1491
|
+
// content: `This CSV contains new users. Invite users by sending mail to them`,
|
|
1492
|
+
// buttontype: 'Invite',
|
|
1493
|
+
// user: res1.data.user
|
|
1494
|
+
// }
|
|
1495
|
+
// const dialogRef = this.dialog.open(TraxpopupComponent, {
|
|
1496
|
+
// centered: true, size: 'md'
|
|
1497
|
+
// });
|
|
1498
|
+
// dialogRef.componentInstance.data = popupcontent;
|
|
1499
|
+
// dialogRef.result.then((result) => {
|
|
1500
|
+
// if (result.message === 'confirm') {
|
|
1501
|
+
// const payload = {
|
|
1502
|
+
// id: this.currentTaskId,
|
|
1503
|
+
// uploadUser: true,
|
|
1504
|
+
// clientId: this.headerData.client,
|
|
1505
|
+
// assignedUsers: res
|
|
1506
|
+
// }
|
|
1507
|
+
// this.uploadAssigneesList(payload, { delete: false, addUser: true }).pipe(takeUntil(this.destroy$)).subscribe({
|
|
1508
|
+
// next: (res) => {
|
|
1509
|
+
// this.getAssignTable()
|
|
1510
|
+
// }
|
|
1511
|
+
// })
|
|
1512
|
+
// }
|
|
1513
|
+
|
|
1514
|
+
// });
|
|
1515
|
+
// } else {
|
|
1516
|
+
// this.getAssignTable()
|
|
1517
|
+
// }
|
|
1518
|
+
|
|
1519
|
+
// }
|
|
1520
|
+
// },
|
|
1521
|
+
// error: (err) => {
|
|
1522
|
+
// this.toastService.getErrorToast(err.error.error)
|
|
1523
|
+
// }
|
|
1524
|
+
// })
|
|
1525
|
+
|
|
1526
|
+
// }
|
|
1527
|
+
// })
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
getStoreCounts(data: any) {
|
|
1531
|
+
if (this.storeCoverage) {
|
|
1532
|
+
const uniqueStoreNames = new Set(data.map((item:any) => item.storeName));
|
|
1533
|
+
return uniqueStoreNames.size;
|
|
1534
|
+
} else if (this.userCoverage) {
|
|
1535
|
+
const uniqueUserNames = new Set(data.map((item:any) => item.userName));
|
|
1536
|
+
return uniqueUserNames.size;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
uploadAssigneesList(payload: any, extraArgs?: any) {
|
|
1541
|
+
const reqPayload = {
|
|
1542
|
+
...payload,
|
|
1543
|
+
...extraArgs
|
|
1544
|
+
}
|
|
1545
|
+
return this.traxService.uploadTaskAssignees(reqPayload)
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
getFormControlFromArray(index: number): FormControl {
|
|
1549
|
+
return this.reminderRepeatSchedules.at(index) as FormControl;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
addMoreSchedules() {
|
|
1553
|
+
const scheduleValue = this.reminderRepeatScheduleOptions.filter((val) => !this.reminderRepeatSchedules?.value.includes(val))
|
|
1554
|
+
if (this.reminderRepeatSchedules.length < 3) {
|
|
1555
|
+
this.reminderRepeatSchedules.push(this.fb.control(scheduleValue[0]))
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
disableScheduleOption(option: number) {
|
|
1560
|
+
return this.reminderRepeatSchedules.value.includes(option)
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
enableReminder(event: any) {
|
|
1564
|
+
if (event.target.checked) {
|
|
1565
|
+
this.reminderRepeatSchedules.clear()
|
|
1566
|
+
this.reminderRepeatSchedules.push(this.fb.control(this.reminderRepeatScheduleOptions[0]))
|
|
1567
|
+
} else {
|
|
1568
|
+
this.reminderRepeatSchedules.clear()
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
onDragLeave(event: DragEvent) {
|
|
1573
|
+
event.preventDefault();
|
|
1574
|
+
(event.target as HTMLElement).classList.remove('drag-over');
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
onDragOver(event: DragEvent) {
|
|
1578
|
+
event.preventDefault();
|
|
1579
|
+
event.stopPropagation();
|
|
1580
|
+
// Add a visual effect to indicate drag is over the area
|
|
1581
|
+
(event.target as HTMLElement).classList.add('drag-over');
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
onDrop(event: DragEvent) {
|
|
1585
|
+
event.preventDefault();
|
|
1586
|
+
(event.target as HTMLElement).classList.remove('drag-over');
|
|
1587
|
+
|
|
1588
|
+
if (event.dataTransfer?.files.length) {
|
|
1589
|
+
const file = event.dataTransfer.files[0];
|
|
1590
|
+
const fileInputElement = this.fileInput.nativeElement;
|
|
1591
|
+
|
|
1592
|
+
// Manually set the file to the input
|
|
1593
|
+
const dataTransfer = new DataTransfer();
|
|
1594
|
+
dataTransfer.items.add(file);
|
|
1595
|
+
fileInputElement.files = dataTransfer.files;
|
|
1596
|
+
|
|
1597
|
+
// Trigger the change event manually
|
|
1598
|
+
fileInputElement.dispatchEvent(new Event('change'));
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
}
|