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.
Files changed (470) hide show
  1. package/.eslintrc.json +37 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +12 -25
  4. package/src/lib/components/action-centre/action-centre.component.html +607 -0
  5. package/src/lib/components/action-centre/action-centre.component.scss +185 -0
  6. package/src/lib/components/action-centre/action-centre.component.spec.ts +23 -0
  7. package/src/lib/components/action-centre/action-centre.component.ts +279 -0
  8. package/src/lib/components/activity-log/activity-log.component.html +84 -0
  9. package/src/lib/components/activity-log/activity-log.component.scss +33 -0
  10. package/src/lib/components/activity-log/activity-log.component.spec.ts +23 -0
  11. package/src/lib/components/activity-log/activity-log.component.ts +137 -0
  12. package/src/lib/components/activity-log-v2/activity-log-v2.component.html +189 -0
  13. package/src/lib/components/activity-log-v2/activity-log-v2.component.scss +162 -0
  14. package/src/lib/components/activity-log-v2/activity-log-v2.component.spec.ts +23 -0
  15. package/src/lib/components/activity-log-v2/activity-log-v2.component.ts +517 -0
  16. package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.html +19 -0
  17. package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.scss +148 -0
  18. package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.spec.ts +23 -0
  19. package/src/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.ts +141 -0
  20. package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.html +42 -0
  21. package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.scss +49 -0
  22. package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.spec.ts +23 -0
  23. package/src/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.ts +22 -0
  24. package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.html +724 -0
  25. package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.scss +217 -0
  26. package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.spec.ts +23 -0
  27. package/src/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.ts +122 -0
  28. package/src/lib/components/add-checklist/add-checklist.component.html +1459 -0
  29. package/src/lib/components/add-checklist/add-checklist.component.scss +1205 -0
  30. package/src/lib/components/add-checklist/add-checklist.component.spec.ts +23 -0
  31. package/src/lib/components/add-checklist/add-checklist.component.ts +2460 -0
  32. package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.html +207 -0
  33. package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.scss +213 -0
  34. package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.spec.ts +23 -0
  35. package/src/lib/components/add-checklist/checklist-popup/checklist-popup.component.ts +621 -0
  36. package/src/lib/components/add-checklist/counter/counter.component.html +43 -0
  37. package/src/lib/components/add-checklist/counter/counter.component.scss +49 -0
  38. package/src/lib/components/add-checklist/counter/counter.component.spec.ts +23 -0
  39. package/src/lib/components/add-checklist/counter/counter.component.ts +123 -0
  40. package/src/lib/components/add-multitask/add-multitask.component.html +705 -0
  41. package/src/lib/components/add-multitask/add-multitask.component.scss +296 -0
  42. package/src/lib/components/add-multitask/add-multitask.component.spec.ts +23 -0
  43. package/src/lib/components/add-multitask/add-multitask.component.ts +611 -0
  44. package/src/lib/components/add-multitask/ascending-validator.ts +13 -0
  45. package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.html +197 -0
  46. package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.scss +31 -0
  47. package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.spec.ts +23 -0
  48. package/src/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.ts +285 -0
  49. package/src/lib/components/add-multitask/create-task.data.ts +374 -0
  50. package/src/lib/components/add-multitask/create-task.interface.ts +177 -0
  51. package/src/lib/components/add-multitask/unique-string-validator.ts +13 -0
  52. package/src/lib/components/add-multitask/whitespace-validator.ts +11 -0
  53. package/src/lib/components/add-task/add-task.component.html +654 -0
  54. package/src/lib/components/add-task/add-task.component.scss +536 -0
  55. package/src/lib/components/add-task/add-task.component.spec.ts +23 -0
  56. package/src/lib/components/add-task/add-task.component.ts +569 -0
  57. package/src/lib/components/add-task/ascending-validator.ts +13 -0
  58. package/src/lib/components/add-task/create-task.data.ts +374 -0
  59. package/src/lib/components/add-task/create-task.interface.ts +192 -0
  60. package/src/lib/components/add-task/unique-string-validator.ts +13 -0
  61. package/src/lib/components/add-task/whitespace-validator.ts +11 -0
  62. package/src/lib/components/approval-popup/approval-popup.component.html +25 -0
  63. package/src/lib/components/approval-popup/approval-popup.component.scss +3 -0
  64. package/src/lib/components/approval-popup/approval-popup.component.spec.ts +23 -0
  65. package/src/lib/components/approval-popup/approval-popup.component.ts +26 -0
  66. package/src/lib/components/checklist/checklist.component.html +330 -0
  67. package/src/lib/components/checklist/checklist.component.scss +112 -0
  68. package/src/lib/components/checklist/checklist.component.spec.ts +23 -0
  69. package/src/lib/components/checklist/checklist.component.ts +344 -0
  70. package/src/lib/components/checklist-configure/assign/assign.component.html +665 -0
  71. package/src/lib/components/checklist-configure/assign/assign.component.scss +219 -0
  72. package/src/lib/components/checklist-configure/assign/assign.component.spec.ts +23 -0
  73. package/src/lib/components/checklist-configure/assign/assign.component.ts +932 -0
  74. package/src/lib/components/checklist-configure/checklist-configure.component.html +4340 -0
  75. package/src/lib/components/checklist-configure/checklist-configure.component.scss +2338 -0
  76. package/src/lib/components/checklist-configure/checklist-configure.component.spec.ts +23 -0
  77. package/src/lib/components/checklist-configure/checklist-configure.component.ts +4659 -0
  78. package/src/lib/components/checklistlayout/checklistlayout.component.html +30 -0
  79. package/src/lib/components/checklistlayout/checklistlayout.component.scss +15 -0
  80. package/src/lib/components/checklistlayout/checklistlayout.component.spec.ts +23 -0
  81. package/src/lib/components/checklistlayout/checklistlayout.component.ts +47 -0
  82. package/src/lib/components/chip-dropdown/chip-dropdown.component.html +36 -0
  83. package/src/lib/components/chip-dropdown/chip-dropdown.component.scss +97 -0
  84. package/src/lib/components/chip-dropdown/chip-dropdown.component.spec.ts +23 -0
  85. package/src/lib/components/chip-dropdown/chip-dropdown.component.ts +125 -0
  86. package/src/lib/components/create-task/create-task.component.html +2003 -0
  87. package/src/lib/components/create-task/create-task.component.scss +272 -0
  88. package/src/lib/components/create-task/create-task.component.spec.ts +23 -0
  89. package/src/lib/components/create-task/create-task.component.ts +614 -0
  90. package/src/lib/components/create-task/create-task.data.ts +372 -0
  91. package/src/lib/components/create-task/create-task.interface.ts +182 -0
  92. package/src/lib/components/create-task/validators/ascending-validator.ts +13 -0
  93. package/src/lib/components/create-task/validators/unique-string-validator.ts +13 -0
  94. package/src/lib/components/create-task/validators/whitespace-validator.ts +11 -0
  95. package/src/lib/components/custom-select/custom-select.component.html +44 -0
  96. package/src/lib/components/custom-select/custom-select.component.scss +144 -0
  97. package/src/lib/components/custom-select/custom-select.component.spec.ts +23 -0
  98. package/src/lib/components/custom-select/custom-select.component.ts +265 -0
  99. package/src/lib/components/dashboard/dashboard.component.html +1076 -0
  100. package/src/lib/components/dashboard/dashboard.component.scss +237 -0
  101. package/src/lib/components/dashboard/dashboard.component.spec.ts +23 -0
  102. package/src/lib/components/dashboard/dashboard.component.ts +539 -0
  103. package/src/lib/components/dashboard-info/dashboard-info.component.html +1420 -0
  104. package/src/lib/components/dashboard-info/dashboard-info.component.scss +409 -0
  105. package/src/lib/components/dashboard-info/dashboard-info.component.spec.ts +23 -0
  106. package/src/lib/components/dashboard-info/dashboard-info.component.ts +772 -0
  107. package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.html +110 -0
  108. package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.scss +260 -0
  109. package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.spec.ts +23 -0
  110. package/src/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.ts +143 -0
  111. package/src/lib/components/dashboard-layout/dashboard-layout.component.html +1 -0
  112. package/src/lib/components/dashboard-layout/dashboard-layout.component.scss +0 -0
  113. package/src/lib/components/dashboard-layout/dashboard-layout.component.spec.ts +23 -0
  114. package/src/lib/components/dashboard-layout/dashboard-layout.component.ts +10 -0
  115. package/src/lib/components/disabled-select/disabled-select.component.html +44 -0
  116. package/src/lib/components/disabled-select/disabled-select.component.scss +149 -0
  117. package/src/lib/components/disabled-select/disabled-select.component.spec.ts +23 -0
  118. package/src/lib/components/disabled-select/disabled-select.component.ts +146 -0
  119. package/src/lib/components/export-gallery/export-gallery.component.html +175 -0
  120. package/src/lib/components/export-gallery/export-gallery.component.scss +200 -0
  121. package/src/lib/components/export-gallery/export-gallery.component.spec.ts +23 -0
  122. package/src/lib/components/export-gallery/export-gallery.component.ts +263 -0
  123. package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.html +36 -0
  124. package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.scss +97 -0
  125. package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.spec.ts +23 -0
  126. package/src/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.ts +104 -0
  127. package/src/lib/components/eye-test-audit/custom-select/custom-select.component.html +44 -0
  128. package/src/lib/components/eye-test-audit/custom-select/custom-select.component.scss +144 -0
  129. package/src/lib/components/eye-test-audit/custom-select/custom-select.component.spec.ts +23 -0
  130. package/src/lib/components/eye-test-audit/custom-select/custom-select.component.ts +265 -0
  131. package/src/lib/components/eye-test-audit/eye-test/eye-test.component.html +1804 -0
  132. package/src/lib/components/eye-test-audit/eye-test/eye-test.component.scss +806 -0
  133. package/src/lib/components/eye-test-audit/eye-test/eye-test.component.spec.ts +23 -0
  134. package/src/lib/components/eye-test-audit/eye-test/eye-test.component.ts +1890 -0
  135. package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.html +25 -0
  136. package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.scss +0 -0
  137. package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.spec.ts +23 -0
  138. package/src/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.ts +20 -0
  139. package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit-routing.module.ts +26 -0
  140. package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.html +1 -0
  141. package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.scss +0 -0
  142. package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.spec.ts +23 -0
  143. package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.ts +24 -0
  144. package/src/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.module.ts +44 -0
  145. package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.html +490 -0
  146. package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.scss +721 -0
  147. package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.spec.ts +23 -0
  148. package/src/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.ts +1017 -0
  149. package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.html +708 -0
  150. package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.scss +247 -0
  151. package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.spec.ts +23 -0
  152. package/src/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.ts +446 -0
  153. package/src/lib/components/eye-test-audit/group-select/group-select.component.html +44 -0
  154. package/src/lib/components/eye-test-audit/group-select/group-select.component.scss +144 -0
  155. package/src/lib/components/eye-test-audit/group-select/group-select.component.spec.ts +23 -0
  156. package/src/lib/components/eye-test-audit/group-select/group-select.component.ts +147 -0
  157. package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.html +18 -0
  158. package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.scss +49 -0
  159. package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.spec.ts +23 -0
  160. package/src/lib/components/eye-test-audit/reactive-select/reactive-select.component.ts +104 -0
  161. package/src/lib/components/eye-test-audit/select-drop/select-drop.component.html +44 -0
  162. package/src/lib/components/eye-test-audit/select-drop/select-drop.component.scss +144 -0
  163. package/src/lib/components/eye-test-audit/select-drop/select-drop.component.spec.ts +23 -0
  164. package/src/lib/components/eye-test-audit/select-drop/select-drop.component.ts +152 -0
  165. package/src/lib/components/eye-test-audit/services/eye-test-audit.service.spec.ts +16 -0
  166. package/src/lib/components/eye-test-audit/services/eye-test-audit.service.ts +190 -0
  167. package/src/lib/components/flag-layout/flag-layout.component.html +1 -0
  168. package/src/lib/components/flag-layout/flag-layout.component.scss +0 -0
  169. package/src/lib/components/flag-layout/flag-layout.component.spec.ts +23 -0
  170. package/src/lib/components/flag-layout/flag-layout.component.ts +10 -0
  171. package/src/lib/components/flags/flags.component.html +473 -0
  172. package/src/lib/components/flags/flags.component.scss +86 -0
  173. package/src/lib/components/flags/flags.component.spec.ts +23 -0
  174. package/src/lib/components/flags/flags.component.ts +280 -0
  175. package/{lib/components/flags/flags.interface.d.ts → src/lib/components/flags/flags.interface.ts} +73 -65
  176. package/src/lib/components/flags-info/flags-info.component.html +6012 -0
  177. package/src/lib/components/flags-info/flags-info.component.scss +278 -0
  178. package/src/lib/components/flags-info/flags-info.component.spec.ts +23 -0
  179. package/src/lib/components/flags-info/flags-info.component.ts +490 -0
  180. package/src/lib/components/flags-info/flags-info.interface.ts +441 -0
  181. package/src/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.html +1 -0
  182. package/src/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.scss +4 -0
  183. package/src/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.ts +78 -0
  184. package/src/lib/components/flags-new/flags-new.component.html +904 -0
  185. package/src/lib/components/flags-new/flags-new.component.scss +121 -0
  186. package/src/lib/components/flags-new/flags-new.component.spec.ts +23 -0
  187. package/src/lib/components/flags-new/flags-new.component.ts +357 -0
  188. package/{lib/components/flags-new/flags-new.interface.d.ts → src/lib/components/flags-new/flags-new.interface.ts} +90 -81
  189. package/src/lib/components/gallery/gallery.component.html +3660 -0
  190. package/src/lib/components/gallery/gallery.component.scss +930 -0
  191. package/src/lib/components/gallery/gallery.component.ts +3527 -0
  192. package/src/lib/components/group-select/group-select.component.html +44 -0
  193. package/src/lib/components/group-select/group-select.component.scss +144 -0
  194. package/src/lib/components/group-select/group-select.component.spec.ts +23 -0
  195. package/src/lib/components/group-select/group-select.component.ts +145 -0
  196. package/src/lib/components/image-popup/image-popup.component.html +11 -0
  197. package/src/lib/components/image-popup/image-popup.component.scss +5 -0
  198. package/src/lib/components/image-popup/image-popup.component.ts +18 -0
  199. package/src/lib/components/lib/custom-select/custom-select.component.html +42 -0
  200. package/src/lib/components/lib/custom-select/custom-select.component.scss +131 -0
  201. package/src/lib/components/lib/custom-select/custom-select.component.spec.ts +23 -0
  202. package/src/lib/components/lib/custom-select/custom-select.component.ts +151 -0
  203. package/src/lib/components/manage-task/manage-task.component.html +265 -0
  204. package/src/lib/components/manage-task/manage-task.component.scss +69 -0
  205. package/src/lib/components/manage-task/manage-task.component.spec.ts +23 -0
  206. package/src/lib/components/manage-task/manage-task.component.ts +267 -0
  207. package/src/lib/components/managechecklist/managechecklist.component.html +176 -0
  208. package/src/lib/components/managechecklist/managechecklist.component.scss +43 -0
  209. package/src/lib/components/managechecklist/managechecklist.component.spec.ts +23 -0
  210. package/src/lib/components/managechecklist/managechecklist.component.ts +176 -0
  211. package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.html +46 -0
  212. package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.scss +181 -0
  213. package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.spec.ts +23 -0
  214. package/src/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.ts +221 -0
  215. package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.html +36 -0
  216. package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.scss +89 -0
  217. package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.spec.ts +23 -0
  218. package/src/lib/components/multi-date-datepicker/multi-date-datepicker.component.ts +118 -0
  219. package/src/lib/components/orders/orders.component.html +203 -0
  220. package/src/lib/components/orders/orders.component.scss +180 -0
  221. package/src/lib/components/orders/orders.component.spec.ts +25 -0
  222. package/src/lib/components/orders/orders.component.ts +197 -0
  223. package/src/lib/components/pagination/pagination.component.html +28 -0
  224. package/src/lib/components/pagination/pagination.component.scss +6 -0
  225. package/src/lib/components/pagination/pagination.component.spec.ts +23 -0
  226. package/src/lib/components/pagination/pagination.component.ts +54 -0
  227. package/src/lib/components/reactive-select/reactive-select.component.html +18 -0
  228. package/src/lib/components/reactive-select/reactive-select.component.scss +48 -0
  229. package/src/lib/components/reactive-select/reactive-select.component.spec.ts +23 -0
  230. package/src/lib/components/reactive-select/reactive-select.component.ts +104 -0
  231. package/src/lib/components/reports/date-picker/date-picker.component.html +54 -0
  232. package/src/lib/components/reports/date-picker/date-picker.component.scss +156 -0
  233. package/src/lib/components/reports/date-picker/date-picker.component.spec.ts +23 -0
  234. package/src/lib/components/reports/date-picker/date-picker.component.ts +60 -0
  235. package/src/lib/components/reports/reports.component.html +225 -0
  236. package/src/lib/components/reports/reports.component.scss +69 -0
  237. package/src/lib/components/reports/reports.component.spec.ts +23 -0
  238. package/src/lib/components/reports/reports.component.ts +334 -0
  239. package/{lib/components/reports/reports.interface.d.ts → src/lib/components/reports/reports.interface.ts} +50 -46
  240. package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.html +1 -0
  241. package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.scss +15 -0
  242. package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.spec.ts +23 -0
  243. package/src/lib/components/tango-analyse-trax/tango-analyse-trax.component.ts +31 -0
  244. package/src/lib/components/task/task.component.html +322 -0
  245. package/src/lib/components/task/task.component.scss +169 -0
  246. package/src/lib/components/task/task.component.spec.ts +23 -0
  247. package/src/lib/components/task/task.component.ts +340 -0
  248. package/src/lib/components/task-configure/task-configure.component.html +737 -0
  249. package/src/lib/components/task-configure/task-configure.component.scss +569 -0
  250. package/src/lib/components/task-configure/task-configure.component.spec.ts +23 -0
  251. package/src/lib/components/task-configure/task-configure.component.ts +1603 -0
  252. package/src/lib/components/task-configure/task-configure.interface.ts +138 -0
  253. package/src/lib/components/task-info/task-info.component.html +390 -0
  254. package/src/lib/components/task-info/task-info.component.scss +56 -0
  255. package/src/lib/components/task-info/task-info.component.spec.ts +23 -0
  256. package/src/lib/components/task-info/task-info.component.ts +400 -0
  257. package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.html +141 -0
  258. package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.scss +460 -0
  259. package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.spec.ts +23 -0
  260. package/src/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.ts +202 -0
  261. package/src/lib/components/task-layout/task-layout.component.html +1 -0
  262. package/src/lib/components/task-layout/task-layout.component.scss +0 -0
  263. package/src/lib/components/task-layout/task-layout.component.spec.ts +23 -0
  264. package/src/lib/components/task-layout/task-layout.component.ts +10 -0
  265. package/src/lib/components/task-logs/task-logs.component.html +97 -0
  266. package/src/lib/components/task-logs/task-logs.component.scss +301 -0
  267. package/src/lib/components/task-logs/task-logs.component.spec.ts +23 -0
  268. package/src/lib/components/task-logs/task-logs.component.ts +80 -0
  269. package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.html +84 -0
  270. package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.scss +229 -0
  271. package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.spec.ts +23 -0
  272. package/src/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.ts +111 -0
  273. package/src/lib/components/trax-store/trax-store.component.html +78 -0
  274. package/src/lib/components/trax-store/trax-store.component.scss +134 -0
  275. package/src/lib/components/trax-store/trax-store.component.spec.ts +23 -0
  276. package/src/lib/components/trax-store/trax-store.component.ts +172 -0
  277. package/src/lib/components/traxpopup/traxpopup.component.html +130 -0
  278. package/src/lib/components/traxpopup/traxpopup.component.scss +225 -0
  279. package/src/lib/components/traxpopup/traxpopup.component.spec.ts +23 -0
  280. package/src/lib/components/traxpopup/traxpopup.component.ts +71 -0
  281. package/src/lib/services/trax.service.spec.ts +16 -0
  282. package/src/lib/services/trax.service.ts +789 -0
  283. package/src/lib/tango-analyse-trax-routing.module.ts +151 -0
  284. package/src/lib/tango-analyse-trax.module.ts +140 -0
  285. package/{public-api.d.ts → src/public-api.ts} +6 -2
  286. package/tsconfig.lib.json +14 -0
  287. package/tsconfig.lib.prod.json +10 -0
  288. package/tsconfig.spec.json +14 -0
  289. package/esm2022/lib/components/action-centre/action-centre.component.mjs +0 -288
  290. package/esm2022/lib/components/activity-log/activity-log.component.mjs +0 -150
  291. package/esm2022/lib/components/activity-log-v2/activity-log-v2.component.mjs +0 -502
  292. package/esm2022/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.mjs +0 -114
  293. package/esm2022/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.mjs +0 -24
  294. package/esm2022/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.mjs +0 -126
  295. package/esm2022/lib/components/add-checklist/add-checklist.component.mjs +0 -2352
  296. package/esm2022/lib/components/add-checklist/checklist-popup/checklist-popup.component.mjs +0 -612
  297. package/esm2022/lib/components/add-checklist/counter/counter.component.mjs +0 -138
  298. package/esm2022/lib/components/add-multitask/add-multitask.component.mjs +0 -604
  299. package/esm2022/lib/components/add-multitask/ascending-validator.mjs +0 -11
  300. package/esm2022/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.mjs +0 -297
  301. package/esm2022/lib/components/add-multitask/create-task.data.mjs +0 -372
  302. package/esm2022/lib/components/add-multitask/create-task.interface.mjs +0 -2
  303. package/esm2022/lib/components/add-multitask/unique-string-validator.mjs +0 -10
  304. package/esm2022/lib/components/add-multitask/whitespace-validator.mjs +0 -10
  305. package/esm2022/lib/components/add-task/add-task.component.mjs +0 -561
  306. package/esm2022/lib/components/add-task/ascending-validator.mjs +0 -11
  307. package/esm2022/lib/components/add-task/create-task.data.mjs +0 -372
  308. package/esm2022/lib/components/add-task/create-task.interface.mjs +0 -2
  309. package/esm2022/lib/components/add-task/unique-string-validator.mjs +0 -10
  310. package/esm2022/lib/components/add-task/whitespace-validator.mjs +0 -10
  311. package/esm2022/lib/components/approval-popup/approval-popup.component.mjs +0 -30
  312. package/esm2022/lib/components/checklist/checklist.component.mjs +0 -327
  313. package/esm2022/lib/components/checklist-configure/assign/assign.component.mjs +0 -912
  314. package/esm2022/lib/components/checklist-configure/checklist-configure.component.mjs +0 -4161
  315. package/esm2022/lib/components/checklistlayout/checklistlayout.component.mjs +0 -44
  316. package/esm2022/lib/components/chip-dropdown/chip-dropdown.component.mjs +0 -120
  317. package/esm2022/lib/components/create-task/create-task.component.mjs +0 -585
  318. package/esm2022/lib/components/create-task/create-task.data.mjs +0 -372
  319. package/esm2022/lib/components/create-task/create-task.interface.mjs +0 -2
  320. package/esm2022/lib/components/create-task/validators/ascending-validator.mjs +0 -11
  321. package/esm2022/lib/components/create-task/validators/unique-string-validator.mjs +0 -10
  322. package/esm2022/lib/components/create-task/validators/whitespace-validator.mjs +0 -10
  323. package/esm2022/lib/components/custom-select/custom-select.component.mjs +0 -240
  324. package/esm2022/lib/components/dashboard/dashboard.component.mjs +0 -532
  325. package/esm2022/lib/components/dashboard-info/dashboard-info.component.mjs +0 -741
  326. package/esm2022/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.mjs +0 -155
  327. package/esm2022/lib/components/dashboard-layout/dashboard-layout.component.mjs +0 -12
  328. package/esm2022/lib/components/disabled-select/disabled-select.component.mjs +0 -158
  329. package/esm2022/lib/components/export-gallery/export-gallery.component.mjs +0 -266
  330. package/esm2022/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.mjs +0 -105
  331. package/esm2022/lib/components/eye-test-audit/custom-select/custom-select.component.mjs +0 -240
  332. package/esm2022/lib/components/eye-test-audit/eye-test/eye-test.component.mjs +0 -1733
  333. package/esm2022/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.mjs +0 -24
  334. package/esm2022/lib/components/eye-test-audit/eye-test-audit/eye-test-audit-routing.module.mjs +0 -34
  335. package/esm2022/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.mjs +0 -27
  336. package/esm2022/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.module.mjs +0 -71
  337. package/esm2022/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.mjs +0 -823
  338. package/esm2022/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.mjs +0 -412
  339. package/esm2022/lib/components/eye-test-audit/group-select/group-select.component.mjs +0 -157
  340. package/esm2022/lib/components/eye-test-audit/reactive-select/reactive-select.component.mjs +0 -105
  341. package/esm2022/lib/components/eye-test-audit/select-drop/select-drop.component.mjs +0 -162
  342. package/esm2022/lib/components/eye-test-audit/services/eye-test-audit.service.mjs +0 -166
  343. package/esm2022/lib/components/flag-layout/flag-layout.component.mjs +0 -12
  344. package/esm2022/lib/components/flags/flags.component.mjs +0 -263
  345. package/esm2022/lib/components/flags/flags.interface.mjs +0 -2
  346. package/esm2022/lib/components/flags-info/flags-info.component.mjs +0 -452
  347. package/esm2022/lib/components/flags-info/flags-info.interface.mjs +0 -2
  348. package/esm2022/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.mjs +0 -71
  349. package/esm2022/lib/components/flags-new/flags-new.component.mjs +0 -335
  350. package/esm2022/lib/components/flags-new/flags-new.interface.mjs +0 -2
  351. package/esm2022/lib/components/gallery/gallery.component.mjs +0 -3402
  352. package/esm2022/lib/components/group-select/group-select.component.mjs +0 -155
  353. package/esm2022/lib/components/image-popup/image-popup.component.mjs +0 -25
  354. package/esm2022/lib/components/lib/custom-select/custom-select.component.mjs +0 -158
  355. package/esm2022/lib/components/manage-task/manage-task.component.mjs +0 -264
  356. package/esm2022/lib/components/managechecklist/managechecklist.component.mjs +0 -186
  357. package/esm2022/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.mjs +0 -229
  358. package/esm2022/lib/components/multi-date-datepicker/multi-date-datepicker.component.mjs +0 -124
  359. package/esm2022/lib/components/orders/orders.component.mjs +0 -171
  360. package/esm2022/lib/components/pagination/pagination.component.mjs +0 -62
  361. package/esm2022/lib/components/reactive-select/reactive-select.component.mjs +0 -108
  362. package/esm2022/lib/components/reports/date-picker/date-picker.component.mjs +0 -60
  363. package/esm2022/lib/components/reports/reports.component.mjs +0 -300
  364. package/esm2022/lib/components/reports/reports.interface.mjs +0 -2
  365. package/esm2022/lib/components/tango-analyse-trax/tango-analyse-trax.component.mjs +0 -32
  366. package/esm2022/lib/components/task/task.component.mjs +0 -341
  367. package/esm2022/lib/components/task-configure/task-configure.component.mjs +0 -1532
  368. package/esm2022/lib/components/task-configure/task-configure.interface.mjs +0 -2
  369. package/esm2022/lib/components/task-info/task-info.component.mjs +0 -375
  370. package/esm2022/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.mjs +0 -208
  371. package/esm2022/lib/components/task-layout/task-layout.component.mjs +0 -12
  372. package/esm2022/lib/components/task-logs/task-logs.component.mjs +0 -104
  373. package/esm2022/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.mjs +0 -107
  374. package/esm2022/lib/components/trax-store/trax-store.component.mjs +0 -179
  375. package/esm2022/lib/components/traxpopup/traxpopup.component.mjs +0 -70
  376. package/esm2022/lib/services/trax.service.mjs +0 -559
  377. package/esm2022/lib/tango-analyse-trax-routing.module.mjs +0 -153
  378. package/esm2022/lib/tango-analyse-trax.module.mjs +0 -221
  379. package/esm2022/public-api.mjs +0 -6
  380. package/esm2022/tango-app-ui-analyse-trax.mjs +0 -5
  381. package/fesm2022/tango-app-ui-analyse-trax.mjs +0 -28896
  382. package/fesm2022/tango-app-ui-analyse-trax.mjs.map +0 -1
  383. package/index.d.ts +0 -5
  384. package/lib/components/action-centre/action-centre.component.d.ts +0 -68
  385. package/lib/components/activity-log/activity-log.component.d.ts +0 -39
  386. package/lib/components/activity-log-v2/activity-log-v2.component.d.ts +0 -78
  387. package/lib/components/activity-log-v2/log-view-popup/date-range-picker/date-range-picker.component.d.ts +0 -24
  388. package/lib/components/activity-log-v2/log-view-popup/store-user-dropdown/store-user-dropdown.component.d.ts +0 -9
  389. package/lib/components/activity-log-v2/log-view-popup/view-action/view-action.component.d.ts +0 -34
  390. package/lib/components/add-checklist/add-checklist.component.d.ts +0 -121
  391. package/lib/components/add-checklist/checklist-popup/checklist-popup.component.d.ts +0 -45
  392. package/lib/components/add-checklist/counter/counter.component.d.ts +0 -29
  393. package/lib/components/add-multitask/add-multitask.component.d.ts +0 -102
  394. package/lib/components/add-multitask/ascending-validator.d.ts +0 -2
  395. package/lib/components/add-multitask/bulkcreationmodel/bulkcreationmodel.component.d.ts +0 -45
  396. package/lib/components/add-multitask/create-task.data.d.ts +0 -293
  397. package/lib/components/add-multitask/create-task.interface.d.ts +0 -159
  398. package/lib/components/add-multitask/unique-string-validator.d.ts +0 -2
  399. package/lib/components/add-multitask/whitespace-validator.d.ts +0 -2
  400. package/lib/components/add-task/add-task.component.d.ts +0 -89
  401. package/lib/components/add-task/ascending-validator.d.ts +0 -2
  402. package/lib/components/add-task/create-task.data.d.ts +0 -293
  403. package/lib/components/add-task/create-task.interface.d.ts +0 -161
  404. package/lib/components/add-task/unique-string-validator.d.ts +0 -2
  405. package/lib/components/add-task/whitespace-validator.d.ts +0 -2
  406. package/lib/components/approval-popup/approval-popup.component.d.ts +0 -14
  407. package/lib/components/checklist/checklist.component.d.ts +0 -40
  408. package/lib/components/checklist-configure/assign/assign.component.d.ts +0 -105
  409. package/lib/components/checklist-configure/checklist-configure.component.d.ts +0 -325
  410. package/lib/components/checklistlayout/checklistlayout.component.d.ts +0 -15
  411. package/lib/components/chip-dropdown/chip-dropdown.component.d.ts +0 -28
  412. package/lib/components/create-task/create-task.component.d.ts +0 -76
  413. package/lib/components/create-task/create-task.data.d.ts +0 -293
  414. package/lib/components/create-task/create-task.interface.d.ts +0 -163
  415. package/lib/components/create-task/validators/ascending-validator.d.ts +0 -2
  416. package/lib/components/create-task/validators/unique-string-validator.d.ts +0 -2
  417. package/lib/components/create-task/validators/whitespace-validator.d.ts +0 -2
  418. package/lib/components/custom-select/custom-select.component.d.ts +0 -35
  419. package/lib/components/dashboard/dashboard.component.d.ts +0 -80
  420. package/lib/components/dashboard-info/dashboard-info.component.d.ts +0 -117
  421. package/lib/components/dashboard-info/monthlyperformance-datepicker/monthlyperformance-datepicker.component.d.ts +0 -41
  422. package/lib/components/dashboard-layout/dashboard-layout.component.d.ts +0 -5
  423. package/lib/components/disabled-select/disabled-select.component.d.ts +0 -34
  424. package/lib/components/export-gallery/export-gallery.component.d.ts +0 -44
  425. package/lib/components/eye-test-audit/chip-dropdown/chip-dropdown.component.d.ts +0 -26
  426. package/lib/components/eye-test-audit/custom-select/custom-select.component.d.ts +0 -35
  427. package/lib/components/eye-test-audit/eye-test/eye-test.component.d.ts +0 -218
  428. package/lib/components/eye-test-audit/eye-test/send-alert/send-alert.component.d.ts +0 -12
  429. package/lib/components/eye-test-audit/eye-test-audit/eye-test-audit-routing.module.d.ts +0 -7
  430. package/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.component.d.ts +0 -11
  431. package/lib/components/eye-test-audit/eye-test-audit/eye-test-audit.module.d.ts +0 -21
  432. package/lib/components/eye-test-audit/eye-test-audit/settings-audit/settings-audit.component.d.ts +0 -129
  433. package/lib/components/eye-test-audit/eye-test-audit/start-audit/start-audit.component.d.ts +0 -86
  434. package/lib/components/eye-test-audit/group-select/group-select.component.d.ts +0 -33
  435. package/lib/components/eye-test-audit/reactive-select/reactive-select.component.d.ts +0 -32
  436. package/lib/components/eye-test-audit/select-drop/select-drop.component.d.ts +0 -33
  437. package/lib/components/eye-test-audit/services/eye-test-audit.service.d.ts +0 -47
  438. package/lib/components/flag-layout/flag-layout.component.d.ts +0 -5
  439. package/lib/components/flags/flags.component.d.ts +0 -52
  440. package/lib/components/flags-info/flags-info.component.d.ts +0 -73
  441. package/lib/components/flags-info/flags-info.interface.d.ts +0 -430
  442. package/lib/components/flags-info/unattended-pie-chart/unattended-pie-chart.component.d.ts +0 -13
  443. package/lib/components/flags-new/flags-new.component.d.ts +0 -60
  444. package/lib/components/gallery/gallery.component.d.ts +0 -261
  445. package/lib/components/group-select/group-select.component.d.ts +0 -33
  446. package/lib/components/image-popup/image-popup.component.d.ts +0 -11
  447. package/lib/components/lib/custom-select/custom-select.component.d.ts +0 -33
  448. package/lib/components/manage-task/manage-task.component.d.ts +0 -47
  449. package/lib/components/managechecklist/managechecklist.component.d.ts +0 -33
  450. package/lib/components/multi-chip-dropdown/multi-chip-dropdown.component.d.ts +0 -40
  451. package/lib/components/multi-date-datepicker/multi-date-datepicker.component.d.ts +0 -27
  452. package/lib/components/orders/orders.component.d.ts +0 -38
  453. package/lib/components/pagination/pagination.component.d.ts +0 -16
  454. package/lib/components/reactive-select/reactive-select.component.d.ts +0 -32
  455. package/lib/components/reports/date-picker/date-picker.component.d.ts +0 -23
  456. package/lib/components/reports/reports.component.d.ts +0 -55
  457. package/lib/components/tango-analyse-trax/tango-analyse-trax.component.d.ts +0 -14
  458. package/lib/components/task/task.component.d.ts +0 -70
  459. package/lib/components/task-configure/task-configure.component.d.ts +0 -142
  460. package/lib/components/task-configure/task-configure.interface.d.ts +0 -128
  461. package/lib/components/task-info/task-info.component.d.ts +0 -76
  462. package/lib/components/task-info/taskinfo-edit/taskinfo-edit.component.d.ts +0 -61
  463. package/lib/components/task-layout/task-layout.component.d.ts +0 -5
  464. package/lib/components/task-logs/task-logs.component.d.ts +0 -27
  465. package/lib/components/trax-run-ai-popup/trax-run-ai-popup.component.d.ts +0 -26
  466. package/lib/components/trax-store/trax-store.component.d.ts +0 -45
  467. package/lib/components/traxpopup/traxpopup.component.d.ts +0 -24
  468. package/lib/services/trax.service.d.ts +0 -175
  469. package/lib/tango-analyse-trax-routing.module.d.ts +0 -7
  470. package/lib/tango-analyse-trax.module.d.ts +0 -68
@@ -0,0 +1,3527 @@
1
+ import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, HostListener, OnDestroy, OnInit, ViewChild } from '@angular/core';
2
+ import { FormBuilder, FormGroup } from '@angular/forms';
3
+ import dayjs, { Dayjs } from "dayjs";
4
+ import utc from 'dayjs/plugin/utc';
5
+ dayjs.extend(utc);
6
+ import { TimePeriod } from 'ngx-daterangepicker-material/daterangepicker.component';
7
+ import { GlobalStateService, PageInfoService } from 'tango-app-ui-global';
8
+ import { TraxService } from '../../services/trax.service';
9
+ import { Subject, debounceTime, distinctUntilChanged, filter, takeUntil } from "rxjs";
10
+ import { ActivatedRoute, Router } from '@angular/router';
11
+ import { ToastService } from 'tango-app-ui-shared';
12
+ import { Location, formatDate } from '@angular/common';
13
+ import { ExportGalleryComponent } from '../export-gallery/export-gallery.component';
14
+ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
15
+ import { AddTaskComponent } from '../add-task/add-task.component';
16
+ import { TaskLogsComponent } from '../task-logs/task-logs.component';
17
+ import { ApprovalPopupComponent } from '../approval-popup/approval-popup.component';
18
+ import { ImagePopupComponent } from '../image-popup/image-popup.component';
19
+ import { interval, Subscription } from 'rxjs';
20
+ import { switchMap } from 'rxjs/operators';
21
+
22
+ import { BulkcreationmodelComponent } from '../add-multitask/bulkcreationmodel/bulkcreationmodel.component';
23
+ import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
24
+
25
+ @Component({
26
+ selector: 'lib-gallery',
27
+ templateUrl: './gallery.component.html',
28
+ styleUrl: './gallery.component.scss'
29
+ })
30
+ export class GalleryComponent implements OnInit, OnDestroy, AfterViewInit {
31
+ isFullscreen: boolean = false;
32
+ fullscreenVideoElement: HTMLVideoElement | null = null;
33
+ dayjs = dayjs
34
+ notifyCount = 0
35
+ selectedDateRange: any = {};
36
+ isCustomDate = (m: dayjs.Dayjs) => {
37
+ const isValidDate = m > this.dayjs();
38
+ return isValidDate ? 'invalid-date' : false;
39
+ }
40
+ galleryForm: FormGroup
41
+ type: any = [{ value: 'checklist', label: 'Checklist' },
42
+ { value: 'task', label: 'Task' },
43
+ { value: 'aiChecklist', label: 'AI Checklist' }
44
+ ]
45
+ filtertype: any = [{ value: 'Clusters', label: 'Clusters' },
46
+ { value: 'Teams', label: 'Teams' }
47
+ ]
48
+ checklists: any = []
49
+ answerType = [
50
+ { label: 'All Answer Type', value: 'all' },
51
+ { label: 'Descriptive Answer', value: 'descriptive' },
52
+ { label: 'A/B Question', value: 'yes/no' },
53
+ { label: 'Multiple Choice Question - Single Answer', value: 'multiplechoicesingle' },
54
+ { label: 'Multiple Choice Question - Multiple Answer', value: 'multiplechoicemultiple' },
55
+ { label: 'Capture Image as answer', value: 'image' },
56
+ { label: 'Capture Image with Description', value: 'descriptiveImage' },
57
+ { label: 'Capture video as answer', value: 'video' },
58
+ { label: 'Capture Multiple Image', value: 'multipleImage' },
59
+ { label: 'Date As Answer', value: 'date' },
60
+ { label: 'Time As Answer', value: 'time' },
61
+ { label: 'Linear Scale', value: 'linearscale' },
62
+ { label: 'Dropdown as an answer', value: 'dropdown' },
63
+ { label: 'Capture Image/Video as Answer', value: 'image/video' }
64
+ ]
65
+ headerFilters: any = {};
66
+ storeList: any[] = []
67
+ private destroy$ = new Subject();
68
+ checklistData: any = {}
69
+ stores: any = [];
70
+ groups: any = [];
71
+ teams: any = [];
72
+ items: any;
73
+ paginatedItems: any;
74
+ itemsPerPage = 10;
75
+ currentPage = 1;
76
+ totalItems = 0;
77
+ viewChecklistsData: any;
78
+ loading: boolean = true;
79
+ noData: boolean = false;
80
+ viewloading: boolean = true;
81
+ viewnoData: boolean = false;
82
+ offset: any = 1;
83
+ limit: any = 1;
84
+ paginationSizes = [1]
85
+ totalCount: any;
86
+ viewChecklistsoptions: any = {};
87
+ mobileusageData: any;
88
+ mobileusageDataList: any = []
89
+ selectAll: any
90
+ storeOpencloseView: any;
91
+ queryParams: any;
92
+ customerunattendedData: any;
93
+ sectionName: any = 'all';
94
+ questionName: any = 'all';
95
+ clientData: any;
96
+ checklistName: any = '';
97
+ ClusterList: any = [];
98
+ TeamsList: any = [];
99
+ userList: any = [];
100
+ environment: any;
101
+ showflag: boolean = true;
102
+ selectedSection: any = []
103
+ tempselectedSection: any = []
104
+ showmulti: boolean = true;
105
+ showsingle: boolean = false
106
+ showfilter: boolean = false
107
+ previewType: any = 'image';
108
+ checkListDescription: any = ''
109
+ answerFilter: any = []
110
+ approvalStatus: boolean = false
111
+ allapprovalStatus: boolean = false
112
+ category: string = 'all'
113
+ videoChecklist = ['customerunattended', 'staffleftinthemiddle', 'remoteoptometrist', 'eyetest', 'cleaning', 'scrum', 'suspiciousactivity']
114
+ imageChecklist = ['mobileusagedetection', 'uniformdetection', 'storehygienemonitoring', 'customertrial', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter','tvcompliance','cameratampering','staffgrouping','employeeCount']
115
+ boximageChecklist = ['queuealert', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection']
116
+ combinedChecklist = [...this.videoChecklist, ...this.imageChecklist, ...this.boximageChecklist, 'storeopenandclose']
117
+ pdfExportTypes: any = ['custom', 'task', 'storeopenandclose', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter','tvcompliance','cameratampering','queuealert','boxalert','staffgrouping']
118
+ csvExportTypes: any = ['custom', 'task', 'storeopenandclose', 'cleaning', 'scrum', 'inventorycount', 'carsattended', 'numberplateinfo', 'outsidebusinesshoursqueuetracking', 'halfshutter','tvcompliance','cameratampering','boxalert','queuealert','staffgrouping','employeeCount']
119
+ queueAlertView: any;
120
+ viewImage: any;
121
+ zoneList: any = [];
122
+ approveFilter: any = 'all'
123
+ userDetails: any
124
+ timeoutId: any;
125
+ selectedStores: any = [];
126
+ selectedUsers: any = [];
127
+ inputDataTask: any;
128
+ otherTaskData: any
129
+ selectAllTask: boolean = false
130
+ totalrecordcount: number = 0
131
+ selectedRecordCount: number = 0
132
+ refImage: any[] = [];
133
+ exportConfig: any;
134
+ activeDiv?:string;
135
+ constructor(private fb: FormBuilder, public gs: GlobalStateService, private traxService: TraxService, private cd: ChangeDetectorRef, private modalService: NgbModal,
136
+ private route: ActivatedRoute, private router: Router, private toastService: ToastService, private location: Location, private pageInfo: PageInfoService, private sanitizer: DomSanitizer
137
+ ) {
138
+ this.route?.queryParams
139
+ ?.pipe(takeUntil(this.destroy$))
140
+ .subscribe((params) => {
141
+ this.queryParams = params;
142
+ if (this.queryParams && this.queryParams.ChecklistDate) {
143
+ this.selectedDateRange = {
144
+ startDate: this.queryParams.ChecklistDate ? this.dayjs(this.queryParams.ChecklistDate).format('DD-MM-YYYY') : this.dayjs().subtract(1, 'day').format('DD-MM-YYYY'),
145
+ endDate: this.queryParams.ChecklistDate ? this.dayjs(this.queryParams.ChecklistDate).format('DD-MM-YYYY') : this.dayjs().subtract(1, 'day').format('DD-MM-YYYY')
146
+ }
147
+ this.gs.dataRangeValue.pipe(takeUntil(this.destroy$)).subscribe({
148
+ next: (data: any) => {
149
+ if (data?.client) {
150
+ this.headerFilters = data;
151
+ this.getAllStores();
152
+ } else {
153
+ let userinfo = JSON.parse(localStorage.getItem("user-info") || "")
154
+ if (userinfo && userinfo?.clientId) {
155
+ this.headerFilters.client = userinfo?.clientId
156
+ this.getAllStores();
157
+ }
158
+ }
159
+ },
160
+ });
161
+ if (this.queryParams.viewRedo) {
162
+ this.galleryForm.get("viewRedo")?.setValue(true)
163
+ }
164
+ } else {
165
+ this.selectedDateRange = {
166
+ startDate: this.dayjs().subtract(1, 'day').format('DD-MM-YYYY'),
167
+ endDate: this.dayjs().subtract(1, 'day').format('DD-MM-YYYY')
168
+ }
169
+ }
170
+ })
171
+ this.gs.environment.pipe(takeUntil(this.destroy$)).subscribe((env) => {
172
+ if (env) {
173
+ this.environment = env
174
+ }
175
+ })
176
+ }
177
+ ngAfterViewInit(): void {
178
+ if (this.headerFilters.client === "464") {
179
+ this.requestPermission()
180
+ this.checkNotifications()
181
+ }
182
+ }
183
+ checktodayDate(checklistDate: any) {
184
+ const givenDate = checklistDate;
185
+ const isSameDate = dayjs().isSame(dayjs(givenDate), 'day');
186
+
187
+ return isSameDate
188
+ }
189
+ ngOnDestroy(): void {
190
+ if (this.timeoutId) {
191
+ clearTimeout(this.timeoutId);
192
+ this.timeoutId = null;
193
+ }
194
+ this.destroy$.next(true);
195
+ this.destroy$.complete();
196
+ }
197
+
198
+ requestPermission() {
199
+ if ('Notification' in window) {
200
+ Notification.requestPermission().then(permission => {
201
+ // console.log(permission)
202
+ // if (permission === 'granted') {
203
+ // setTimeout(() => this.notify(), 1000); // short delay helps in some browsers
204
+ // }
205
+ });
206
+ } else {
207
+ console.error('Browser does not support notifications.');
208
+ }
209
+ }
210
+ notify(data: any) {
211
+ for (let element of data) {
212
+ if (Notification.permission === 'granted') {
213
+ this.pageInfo.updateTitle('⚠️ Vehicle Detection');
214
+
215
+ this.cd.detectChanges();
216
+ const notification = new Notification(`🚗 Vehicle Detection on slot ${element?.slotNo}`, {
217
+ body: ` Detection occurred at ${element.captureTime}`,
218
+ icon: './assets/tango/layout/tango-fav.png' // Optional
219
+ });
220
+ // console.log(notification)
221
+ notification.onshow = () => console.log('Notification shown');
222
+ notification.onclick = () => {
223
+ // console.log('Notification clicked');
224
+
225
+ this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
226
+ this.router.navigate(['/manage/trax/gallery'],
227
+ {
228
+ queryParams: {
229
+ ChecklistDate: dayjs().format('YYYY-MM-DD'),
230
+ checklistType: "ai",
231
+ sourceCheckList_id: "vehicle_check_in",
232
+ },
233
+ relativeTo: this.route,
234
+ queryParamsHandling: 'merge',
235
+ }
236
+ )
237
+ })
238
+ notification.close();
239
+ };
240
+ notification.onerror = (e) => console.error('Notification error', e);
241
+ notification.onclose = () => {
242
+ this.pageInfo.updateTitle('Gallery');
243
+
244
+ };
245
+ }
246
+ }
247
+ }
248
+ refreshnow() {
249
+ this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
250
+ this.router.navigate(['/manage/trax/gallery'],
251
+ {
252
+ queryParams: {
253
+ ChecklistDate: dayjs().format('YYYY-MM-DD'),
254
+ checklistType: "ai",
255
+ sourceCheckList_id: "vehicle_check_in",
256
+ },
257
+ relativeTo: this.route,
258
+ queryParamsHandling: 'merge',
259
+ }
260
+ )
261
+ })
262
+ }
263
+
264
+ ngOnInit(): void {
265
+ this.createForm();
266
+ this.setPageData();
267
+ this.userDetails = JSON.parse(localStorage.getItem("user-info") || "")
268
+ if (this.queryParams.coverage === 'user') {
269
+ this.galleryForm.get("filtertype")?.setValue('Teams')
270
+ }
271
+ if (this.queryParams.coverage === 'stores') {
272
+ this.galleryForm.get("filtertype")?.setValue('Clusters')
273
+ }
274
+ if(this.queryParams.filterType) {
275
+ this.galleryForm.get('type')?.setValue(this.queryParams.filterType)
276
+ }
277
+ this.gs.dataRangeValue.pipe(takeUntil(this.destroy$)).subscribe({
278
+ next: (data: any) => {
279
+ if (data?.client) {
280
+ this.headerFilters = data;
281
+ if (!this.queryParams.ChecklistDate && this.headerFilters.client && (this.headerFilters?.client === "459" || this.headerFilters?.client === "464")) {
282
+ this.selectedDateRange = {
283
+ startDate: this.dayjs().format('DD-MM-YYYY'),
284
+ endDate: this.dayjs().format('DD-MM-YYYY')
285
+ }
286
+ this.galleryForm.get('fromDate')?.setValue(dayjs(this.selectedDateRange.startDate, 'DD-MM-YYYY').format('YYYY-MM-DD'))
287
+ this.galleryForm.get('toDate')?.setValue(dayjs(this.selectedDateRange.endDate, 'DD-MM-YYYY').format('YYYY-MM-DD'))
288
+ }
289
+ this.clientDetails();
290
+ this.getAllGroups();
291
+ this.getAllStores();
292
+ this.getAllUsers();
293
+ this.getAllTeams();
294
+ } else {
295
+ let userinfo = JSON.parse(localStorage.getItem("user-info") || "")
296
+ if (userinfo && userinfo?.clientId) {
297
+ this.headerFilters.client = userinfo?.clientId
298
+
299
+ if (!this.queryParams.ChecklistDate && this.headerFilters.client && (this.headerFilters?.client === "459" || this.headerFilters?.client === "464")) {
300
+ this.selectedDateRange = {
301
+ startDate: this.dayjs().format('DD-MM-YYYY'),
302
+ endDate: this.dayjs().format('DD-MM-YYYY')
303
+ }
304
+ this.galleryForm.get('fromDate')?.setValue(dayjs(this.selectedDateRange.startDate, 'DD-MM-YYYY').format('YYYY-MM-DD'))
305
+ this.galleryForm.get('toDate')?.setValue(dayjs(this.selectedDateRange.endDate, 'DD-MM-YYYY').format('YYYY-MM-DD'))
306
+ }
307
+ this.clientDetails();
308
+ this.getAllGroups();
309
+ this.getAllStores();
310
+ this.getAllUsers();
311
+ this.getAllTeams();
312
+ }
313
+ }
314
+
315
+
316
+
317
+ },
318
+ });
319
+ }
320
+
321
+
322
+
323
+ checkNotifications() {
324
+ this.traxService.checkNotificationCount(this.headerFilters.client).subscribe({
325
+ next: (res: any) => {
326
+ clearTimeout(this.timeoutId)
327
+ if (res && res.code == 200 && res.data.length > 0) {
328
+ this.notifyCount = this.notifyCount + res.data.length;
329
+ this.cd.detectChanges();
330
+ this.notify(res.data);
331
+ }
332
+
333
+ // Schedule the next call
334
+ this.timeoutId = setTimeout(() => this.checkNotifications(), 10000);
335
+ },
336
+ error: (err) => {
337
+ console.error('Error:', err);
338
+ this.requestPermission();
339
+
340
+ // Retry even on error
341
+ setTimeout(() => this.checkNotifications(), 10000);
342
+ }
343
+ });
344
+ }
345
+ setPageData() {
346
+ this.pageInfo.updateTitle('Gallery');
347
+ this.pageInfo.setDescription("");
348
+ this.pageInfo.setBreadcrumbs([
349
+ { title: "Tango Trax", path: "/manage/trax/dashboard", isActive: false, isSeparator: false },
350
+ { title: "Tango Trax", path: "/manage/trax/dashboard", isActive: false, isSeparator: true },
351
+ ]);
352
+
353
+ }
354
+ getAllGroups() {
355
+ this.traxService.getclusters({ clientId: this.headerFilters.client, group: [], city: [] }).subscribe({
356
+ next: (res: any) => {
357
+ if (res && res.code == 200) {
358
+ this.ClusterList = res.data.groupData
359
+ } else {
360
+ this.ClusterList = []
361
+ }
362
+ }
363
+ })
364
+ }
365
+ getAllTeams() {
366
+ this.traxService.getAllTeams(this.headerFilters.client).subscribe({
367
+ next: (res: any) => {
368
+ if (res && res.code == 200) {
369
+ this.TeamsList = res.data
370
+ } else {
371
+ this.TeamsList = []
372
+ }
373
+ }
374
+ })
375
+ }
376
+ clientDetails() {
377
+ this.traxService.getclient({ clientId: this.headerFilters.client }).subscribe({
378
+ next: (res: any) => {
379
+ if (res && res.code == 200) {
380
+ this.clientData = res.data.result
381
+ }
382
+ }
383
+ })
384
+ }
385
+
386
+ onfilterChange(val: any){
387
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
388
+ next: (res: any) => {
389
+ if (res && res.code == 200) {
390
+ this.storeList = res.data.storesData;
391
+ this.stores = res.data.storesData
392
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
393
+ }
394
+ }
395
+ })
396
+ }
397
+
398
+ redoChanged(event: any) {
399
+ if (event.target.checked) {
400
+ this.galleryForm.get("viewRedo")?.setValue(true)
401
+ } else {
402
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
403
+ next: (res: any) => {
404
+ if (res && res.code == 200) {
405
+ this.storeList = res.data.storesData;
406
+ this.stores = res.data.storesData
407
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
408
+ }
409
+ }
410
+ })
411
+ this.galleryForm.get("viewRedo")?.setValue(false)
412
+ }
413
+
414
+ }
415
+
416
+ flagChanged(event: any) {
417
+ if (event.target.checked) {
418
+ this.galleryForm.get("viewFlag")?.setValue(true)
419
+ } else {
420
+ this.galleryForm.get("viewFlag")?.setValue(false)
421
+ }
422
+ }
423
+ onchecklistreset() {
424
+ this.selectedStores = [];
425
+ this.selectedUsers = [];
426
+ this.totalrecordcount = 0;
427
+ this.selectedRecordCount = 0
428
+ this.selectAllTask = false
429
+
430
+ this.galleryForm.get("filter")?.setValue('')
431
+ this.answerFilter = []
432
+ this.showmulti = true
433
+ this.showsingle = false
434
+ if (this.galleryForm.value.type === 'checklist') {
435
+ this.getChecklistQA(false);
436
+ } else {
437
+ this.getTaskQA(this.galleryForm.value.type)
438
+ }
439
+
440
+ }
441
+
442
+ resetValidation() {
443
+ this.isCustomDate = (m: dayjs.Dayjs) => {
444
+ // Check if the given date is before yesterday
445
+ return m.isAfter(this.dayjs(), 'day') ? 'invalid-date' : false;
446
+ };
447
+ }
448
+
449
+ onStartDateChange(event: any) {
450
+ if (this.dayjs(event.startDate).isValid()) {
451
+ let clientinfo = JSON.parse(localStorage.getItem("client-details") || "")
452
+ let userinfo = JSON.parse(localStorage.getItem("user-info") || "")
453
+ if (clientinfo || userinfo) {
454
+ if (clientinfo?.traxDateRange === 7 || userinfo?.traxDateRange === 7) {
455
+ this.isCustomDate = (m: dayjs.Dayjs) => {
456
+ const isValidDate =
457
+ m > this.dayjs() || m > this.dayjs(event.startDate.add(2, "days"));
458
+ return isValidDate ? "invalid-date" : false;
459
+ };
460
+ } else {
461
+ this.isCustomDate = (m: dayjs.Dayjs) => {
462
+ const isValidDate =
463
+ m > this.dayjs() || m > this.dayjs(event.startDate.add(30, "days"));
464
+ return isValidDate ? "invalid-date" : false;
465
+ }
466
+ }
467
+ }
468
+
469
+ }
470
+ // this.getAllCheckLists(false)
471
+ }
472
+ selectAllStore(event: any) {
473
+ if (event.target.checked) {
474
+ this.selectAll = event.target.checked;
475
+ this.mobileusageDataList.forEach((obj: any) => (obj.checked = this.selectAll));
476
+ let store = this.mobileusageDataList.filter((el: any) => el.checked)
477
+ const change = JSON.parse(JSON.stringify(store))
478
+ this.galleryForm.get('storeList')?.setValue(change)
479
+ } else {
480
+ this.galleryForm.get('zoneList')?.setValue([])
481
+ this.selectAll = false
482
+ this.mobileusageDataList.forEach((obj: any) => (obj.checked = this.selectAll));
483
+ this.galleryForm.get('storeList')?.setValue([])
484
+ }
485
+ }
486
+ updateCheck(event: any, storedata: any) {
487
+ this.mobileusageDataList.forEach((ele: any) => {
488
+ if (ele.storeId === storedata.storeId) {
489
+ ele.checked = event.target.checked;
490
+ }
491
+ });
492
+ let store = this.mobileusageDataList.filter((data: any) => data.checked);
493
+ const change = JSON.parse(JSON.stringify(store))
494
+
495
+ this.galleryForm.get('storeList')?.setValue(change)
496
+ this.galleryForm.get('zoneList')?.setValue([])
497
+ this.cd.detectChanges()
498
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
499
+
500
+ }
501
+ createForm() {
502
+ this.galleryForm = this.fb.group({
503
+ fromDate: [dayjs(this.selectedDateRange.startDate, "DD-MM-YYYY").format("YYYY-MM-DD")],
504
+ toDate: [dayjs(this.selectedDateRange.endDate, "DD-MM-YYYY").format('YYYY-MM-DD')],
505
+ type: 'checklist',
506
+ filtertype: 'Clusters',
507
+ checklistName: '',
508
+ storeList: [this.stores],
509
+ userList: [this.userList],
510
+ answerType: ['all'],
511
+ viewFlag: [false],
512
+ viewRedo: [false],
513
+ checkListType: "custom",
514
+ sourceCheckList_id: "",
515
+ ClusterList: [this.groups],
516
+ TeamsList: [this.TeamsList],
517
+ checkListDescription: "",
518
+ filter: "",
519
+ zoneList: [this.zoneList]
520
+ })
521
+ // console.log(this.galleryForm.value)
522
+
523
+ }
524
+
525
+ datechange(event: TimePeriod) {
526
+ if (!event.endDate || !event.startDate) {
527
+ return
528
+ }
529
+ this.removeQueryParams()
530
+ this.resetValidation();
531
+ this.galleryForm.get('fromDate')?.setValue(event.startDate.format('YYYY-MM-DD'))
532
+ this.galleryForm.get('toDate')?.setValue(event.endDate.format('YYYY-MM-DD'))
533
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
534
+ next: (res: any) => {
535
+ if (res && res.code == 200) {
536
+ this.storeList = res.data.storesData;
537
+ this.stores = res.data.storesData
538
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
539
+ if (this.queryParams.checklistType == 'task' || this.galleryForm.value.type === 'task') {
540
+ this.getAllTasks(false)
541
+ } else {
542
+ this.getAllCheckLists(false);
543
+ }
544
+ }
545
+ },
546
+ error: (err) => {
547
+ if (this.queryParams.checklistType == 'task' || this.galleryForm.value.type === 'task') {
548
+ this.getAllTasks(false)
549
+ } else {
550
+ this.getAllCheckLists(false);
551
+ }
552
+ }
553
+ })
554
+
555
+ }
556
+ getAllUsers() {
557
+ let teamsList = this.galleryForm.value.TeamsList.map((data: any) => data.teamName)
558
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
559
+ next: (res: any) => {
560
+ if (res && res.code == 200) {
561
+ if (this.queryParams.userEmail) {
562
+ let getuser = res.data.filter((ele: any) => ele.userEmail === this.queryParams.userEmail)
563
+ this.userList = getuser;
564
+ this.galleryForm.get('userList')?.setValue(this.userList)
565
+ if (this.queryParams.checklistType == 'task') {
566
+ this.getAllTasks(true)
567
+ } else {
568
+ this.getAllCheckLists(true);
569
+ }
570
+ } else {
571
+ this.userList = res.data;
572
+ this.galleryForm.get('userList')?.setValue(this.userList)
573
+ if ((this.queryParams.storeId)) {
574
+ this.galleryForm.get('userList')?.setValue([])
575
+ this.galleryForm.get('filtertype')?.setValue('Clusters')
576
+ }
577
+ if (this.queryParams.checklistType == 'task') {
578
+ this.getAllTasks(true)
579
+ } else {
580
+ this.getAllCheckLists(true);
581
+ }
582
+ }
583
+ }
584
+ }
585
+ })
586
+
587
+
588
+
589
+
590
+ }
591
+ getAllStores() {
592
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
593
+ next: (res: any) => {
594
+ if (res && res.code == 200) {
595
+ this.storeList = res.data.storesData;
596
+ if (this.queryParams.storeId) {
597
+ this.galleryForm.get('userList')?.setValue([])
598
+ this.storeList = res.data.storesData;
599
+ let getstore = this.storeList.filter((ele: any) => ele.storeId === this.queryParams.storeId)
600
+ this.stores = getstore
601
+ this.galleryForm.get('storeList')?.setValue(this.stores)
602
+
603
+ if (this.queryParams.checklistType == 'task') {
604
+ this.getAllTasks(true)
605
+ } else {
606
+ this.getAllCheckLists(true);
607
+ }
608
+ } else if (this.queryParams.userEmail) {
609
+ this.galleryForm.get('storeList')?.setValue([])
610
+ this.galleryForm.get('filtertype')?.setValue('Teams')
611
+ } else {
612
+ this.stores = res.data.storesData
613
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
614
+ if (this.queryParams.checklistType == 'task') {
615
+ this.getAllTasks(true)
616
+ } else {
617
+ this.getAllCheckLists(true);
618
+ }
619
+ }
620
+ } else {
621
+ this.storeList = [];
622
+ this.viewloading = false;
623
+ this.viewnoData = true,
624
+ this.loading = false;
625
+ this.noData = true;
626
+
627
+ }
628
+ },
629
+ error: (err) => {
630
+
631
+ this.storeList = [];
632
+ this.viewloading = false;
633
+ this.viewnoData = true,
634
+ this.loading = false;
635
+ this.noData = true;
636
+
637
+ },
638
+ });
639
+ }
640
+
641
+ getAllCheckLists(type: any) {
642
+ let stores = this.stores?.map((data: any) => data.storeId)
643
+ const payload = {
644
+ fromDate: this.galleryForm.get('fromDate')?.value,
645
+ toDate: this.galleryForm.get('toDate')?.value,
646
+ storeId: stores,
647
+ clientId: this.headerFilters?.client,
648
+ sortColumnName: "checkListName",
649
+ type:this.galleryForm.get('type')?.value,
650
+ sortBy: 1
651
+ }
652
+ this.traxService.getChecklists(payload).subscribe({
653
+ next: (res: any) => {
654
+ if (res && res.code == 200) {
655
+ this.checklists = res.data.checklistData
656
+
657
+
658
+ setTimeout(() => {
659
+ if (this.queryParams.sourceCheckList_id && this.queryParams.checklistType) {
660
+ this.galleryForm.get('sourceCheckList_id')?.setValue(this.queryParams.sourceCheckList_id)
661
+ this.galleryForm.get('checkListType')?.setValue(this.queryParams.checklistType)
662
+ if(payload?.type) {
663
+ this.galleryForm.get('type')?.setValue(payload?.type)
664
+ }
665
+ else {
666
+ this.galleryForm.get('type')?.setValue('checklist')
667
+ }
668
+ this.getchecklistDetails();
669
+
670
+ let getchecklist = this.checklists.filter((ele: any) => ele.sourceCheckList_id === this.queryParams.sourceCheckList_id)
671
+ if (getchecklist && getchecklist.length > 0) {
672
+ if (getchecklist[0].checkListType === "AI") {
673
+ this.showflag = false
674
+ }
675
+ this.galleryForm.get('checklistName')?.setValue(getchecklist[0]?.checkListName)
676
+ this.galleryForm.get('checkListDescription')?.setValue(getchecklist[0]?.checkListDescription)
677
+ this.checklistName = getchecklist[0]?.checkListName
678
+ }
679
+ if (this.queryParams.checklistType === 'storeopenandclose') {
680
+ this.select = 'storeopenandclose'
681
+ this.storeOpencloselist(false)
682
+ } else if (this.boximageChecklist.includes(this.queryParams.checklistType)) {
683
+ this.select = this.queryParams.checklistType
684
+ this.queuealertlist(false)
685
+ } else if (this.videoChecklist.includes(this.queryParams.checklistType)) {
686
+ this.select = this.queryParams.checklistType;
687
+ this.customerunattendedlist(false)
688
+ } else if (this.imageChecklist.includes(this.queryParams.checklistType)) {
689
+ this.select = this.queryParams.checklistType;
690
+ this.getmobileUsageDatalist(false)
691
+ }
692
+
693
+ } else {
694
+
695
+ if (this.galleryForm.value && this.galleryForm.value.checkListType != '') {
696
+ this.galleryForm.get('checkListType')?.setValue(this.galleryForm.value.checkListType)
697
+ } else {
698
+ this.galleryForm.get('checkListType')?.setValue(this.checklists[0]?.checkListType)
699
+ }
700
+ if (this.galleryForm.value && this.galleryForm.value.checklistName != '') {
701
+ let getchecklist = this.checklists.filter((ele: any) => ele.checkListName === this.galleryForm.value.checklistName)
702
+ if (getchecklist && getchecklist.length > 0) {
703
+ if (getchecklist[0].checkListType === "AI") {
704
+ this.showflag = false
705
+ }
706
+ this.galleryForm.get('filtertype')?.setValue(getchecklist[0]?.coverage === 'user' ? "Teams" : "Clusters")
707
+ this.coverageData(getchecklist[0]?.coverage)
708
+
709
+ this.galleryForm.get('checkListType')?.setValue(getchecklist[0]?.checkListType)
710
+ this.galleryForm.get('checklistName')?.setValue(getchecklist[0]?.checkListName)
711
+ this.checklistName = this.galleryForm.value.checklistName
712
+ this.galleryForm.get('sourceCheckList_id')?.setValue(getchecklist[0]?.sourceCheckList_id)
713
+ this.galleryForm.get('checkListDescription')?.setValue(getchecklist[0]?.checkListDescription)
714
+ } else {
715
+ this.galleryForm.get('filtertype')?.setValue(this.checklists[0]?.coverage === 'user' ? "Teams" : "Clusters")
716
+ this.coverageData(this.checklists[0]?.coverage)
717
+
718
+ this.galleryForm.get('checkListType')?.setValue(this.checklists[0]?.checkListType)
719
+ this.galleryForm.get('checklistName')?.setValue(this.checklists[0]?.checkListName)
720
+ this.galleryForm.get('checkListDescription')?.setValue(this.checklists[0]?.checkListDescription)
721
+
722
+ this.checklistName = this.checklists[0]?.checkListName
723
+ let getchecklist = this.checklists.filter((ele: any) => ele.checkListName === this.galleryForm.value.checklistName)
724
+ if (getchecklist && getchecklist.length > 0) {
725
+ if (getchecklist[0].checkListType === "AI") {
726
+ this.showflag = false
727
+ }
728
+ this.checkListDescription = getchecklist[0]?.checkListDescription
729
+ this.galleryForm.get('checkListDescription')?.setValue(getchecklist[0]?.checkListDescription)
730
+ this.galleryForm.get('sourceCheckList_id')?.setValue(getchecklist[0]?.sourceCheckList_id)
731
+ }
732
+
733
+ }
734
+ this.getchecklistDetails();
735
+
736
+ } else {
737
+
738
+ this.galleryForm.get('filtertype')?.setValue(this.checklists[0]?.coverage === 'user' ? "Teams" : "Clusters")
739
+ this.coverageData(this.checklists[0]?.coverage)
740
+ this.galleryForm.get('checkListType')?.setValue(this.checklists[0]?.checkListType)
741
+ if (this.checklists[0].checkListType === "AI") {
742
+ this.showflag = false
743
+ }
744
+ this.galleryForm.get('checklistName')?.setValue(this.checklists[0]?.checkListName)
745
+ this.galleryForm.get('checkListDescription')?.setValue(this.checklists[0]?.checkListDescription)
746
+ this.checklistName = this.checklists[0]?.checkListName
747
+ let getchecklist = this.checklists.filter((ele: any) => ele.checkListName === this.galleryForm.value.checklistName)
748
+ if (getchecklist && getchecklist.length > 0) {
749
+ this.checkListDescription = getchecklist[0]?.checkListDescription
750
+
751
+ this.galleryForm.get('sourceCheckList_id')?.setValue(getchecklist[0]?.sourceCheckList_id)
752
+ }
753
+ }
754
+
755
+ }
756
+ this.cd.detectChanges()
757
+
758
+ if (this.galleryForm.value.sourceCheckList_id === 'storeopenandclose') {
759
+ this.select = 'storeopenandclose'
760
+ this.storeOpencloselist(false)
761
+ } else if (this.boximageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
762
+ this.galleryForm.get('zoneList')?.setValue([])
763
+ this.select = this.galleryForm.value.sourceCheckList_id
764
+ this.queuealertlist(false)
765
+ } else if (this.imageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
766
+ this.select = this.galleryForm.value.sourceCheckList_id;
767
+ this.getmobileUsageDatalist(false)
768
+ } else if (this.videoChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
769
+ this.select = this.galleryForm.value.sourceCheckList_id;
770
+ this.customerunattendedlist(false)
771
+ } else {
772
+ this.select = this.galleryForm.value.type === 'checklist' ? "custom" : this.galleryForm.value.type;
773
+ if (type) {
774
+ // console.log(this.galleryForm.value)
775
+ if (this.galleryForm.value.type === 'checklist') {
776
+ if (this.galleryForm.value.filtertype === 'Clusters') {
777
+ this.galleryForm.get('userList')?.setValue([])
778
+ this.storeListdropdown();
779
+ } else {
780
+ // console.log("0000000000000000000")
781
+ this.galleryForm.get('storeList')?.setValue([])
782
+ this.userListdropdown();
783
+ }
784
+ } else {
785
+ this.storeListdropdownTask();
786
+ }
787
+ }
788
+ }
789
+ }, 0);
790
+ this.cd.detectChanges()
791
+ } else {
792
+ this.checklists = [];
793
+ this.galleryForm.get('checklistName')?.setValue('')
794
+ this.viewloading = false;
795
+ this.viewnoData = true;
796
+ this.loading = false;
797
+ this.noData = true
798
+ this.cd.detectChanges()
799
+ }
800
+
801
+ },
802
+ error: () => {
803
+ this.checklists = [];
804
+ },
805
+ });
806
+ }
807
+ removeQueryParams() {
808
+ this.queryParams = {}
809
+ const urlWithoutParams = this.location.path().split('?')[0];
810
+ this.location.replaceState(urlWithoutParams);
811
+ }
812
+ onTeamsSelect(event: any) {
813
+ this.galleryForm.get('TeamsList')?.setValue(event)
814
+ let teamsList = event.map((data: any) => data.teamName)
815
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
816
+ next: (res: any) => {
817
+ if (res && res.code == 200) {
818
+ this.userList = res.data;
819
+ this.galleryForm.get('userList')?.setValue(this.userList)
820
+ }
821
+ }
822
+ })
823
+ }
824
+ ongroupSelect(event: any) {
825
+ this.removeQueryParams()
826
+ this.galleryForm.get('ClusterList')?.setValue(event)
827
+ this.groups = event.map((el: any) => el.groupName)
828
+ // this.getAllStores()
829
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
830
+ next: (res: any) => {
831
+ if (res && res.code == 200) {
832
+ this.storeList = res.data.storesData;
833
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
834
+ }
835
+ }
836
+ })
837
+ this.cd.detectChanges();
838
+ }
839
+ filterChange(event: any) {
840
+ this.removeQueryParams()
841
+ if (event === 'Teams') {
842
+ this.galleryForm.get('stores')?.setValue([])
843
+ let teamsList = this.galleryForm.value.TeamsList.map((data: any) => data.teamName)
844
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
845
+ next: (res: any) => {
846
+ if (res && res.code == 200) {
847
+ this.userList = res.data
848
+ this.galleryForm.get('userList')?.setValue(res.data)
849
+ }
850
+ }
851
+ })
852
+ } else {
853
+ this.galleryForm.get('userList')?.setValue([])
854
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
855
+ next: (res: any) => {
856
+ if (res && res.code == 200) {
857
+ this.storeList = res.data.storesData
858
+ this.galleryForm.get('storeList')?.setValue(res.data.storesData)
859
+ }
860
+ }
861
+ })
862
+ }
863
+ this.galleryForm.get('filtertype')?.setValue(event)
864
+ }
865
+ onzoneSelect(event: any) {
866
+ this.removeQueryParams()
867
+ this.galleryForm.get('zoneList')?.setValue(event)
868
+ }
869
+ approveFilterChange(event: any) {
870
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
871
+ next: (res: any) => {
872
+ if (res && res.code == 200) {
873
+ this.storeList = res.data.storesData
874
+ this.galleryForm.get('storeList')?.setValue(res.data.storesData)
875
+ }
876
+ }
877
+ })
878
+ }
879
+ onStoreSelect(event: any) {
880
+ this.removeQueryParams()
881
+ this.galleryForm.get('zoneList')?.setValue([])
882
+ this.galleryForm.get('storeList')?.setValue(event)
883
+
884
+ this.mobileusageDataList.forEach((store: any) => {
885
+ const isStoreSelected = event.some((selectedStore: any) => selectedStore.storeId === store.storeId);
886
+ if (isStoreSelected) {
887
+ store.checked = true;
888
+ } else {
889
+ store.checked = false;
890
+ }
891
+ });
892
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
893
+ if (this.select === 'queuealert') {
894
+ this.getzonetlist()
895
+ }
896
+ this.cd.detectChanges();
897
+ }
898
+
899
+ onUserSelect(event: any) {
900
+ this.removeQueryParams()
901
+ this.galleryForm.get('userList')?.setValue(event)
902
+ this.cd.detectChanges();
903
+ }
904
+
905
+
906
+ storeListdropdownTask() {
907
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
908
+ next: (res: any) => {
909
+ if (res && res.code == 200) {
910
+ let stores = res.data.storesData.map((data: any) => data.storeId)
911
+ let obj = {
912
+ "fromDate": this.galleryForm.value.fromDate,
913
+ "toDate": this.galleryForm.value.toDate,
914
+ "ChecklistType": this.galleryForm.value.type, // ["custom", "AI"]
915
+ "checklistName": this.galleryForm.value.checklistName,
916
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
917
+ "storeId": stores,
918
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
919
+ "viewFlag": this.galleryForm.value.viewFlag,//[true, false]
920
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
921
+ "filter": this.galleryForm.value.filter,
922
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : ""
923
+
924
+ }
925
+ this.traxService.getQuestions(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
926
+ next: (res: any) => {
927
+ if (res && res.code === 200) {
928
+ this.stores = res.data.storesDetails
929
+ this.storeList = res.data.storesDetails
930
+ this.gettaskQA(false);
931
+ } else {
932
+ this.gettaskQA(false);
933
+ }
934
+ }
935
+ })
936
+ }
937
+ }
938
+ })
939
+ }
940
+
941
+ userListdropdownTask() {
942
+ let teamsList = this.galleryForm.value.TeamsList.map((data: any) => data.teamName)
943
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
944
+ next: (res: any) => {
945
+ if (res && res.code == 200) {
946
+ this.galleryForm.get('userList')?.setValue(res.data)
947
+ let users = res.data.map((data: any) => data.userEmail)
948
+ let obj = {
949
+ "fromDate": this.galleryForm.value.fromDate,
950
+ "toDate": this.galleryForm.value.toDate,
951
+ "ChecklistType": this.galleryForm.value.checkListType, // ["custom", "AI"]
952
+ "checklistName": this.galleryForm.value.checklistName,
953
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
954
+ "filtertype": this.galleryForm.value.filtertype,
955
+ "storeId": [],
956
+ "userEmail": users,
957
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
958
+ "viewFlag": this.galleryForm.value.viewFlag,//[true, false]
959
+ "viewRedo": this.galleryForm.value.viewRedo,//[true, false]
960
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : "",
961
+ "filter": this.galleryForm.value.filter,
962
+ }
963
+ this.traxService.getQuestions(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
964
+ next: (res: any) => {
965
+ if (res && res.code === 200) {
966
+ this.userList = res.data.storesDetails
967
+ this.galleryForm.get('userList')?.setValue(this.userList)
968
+ this.galleryForm.get('storeList')?.setValue([])
969
+ this.storeList = []
970
+ this.gettaskQA(false);
971
+ } else {
972
+ this.gettaskQA(false);
973
+ }
974
+ }
975
+ })
976
+ }
977
+ }
978
+ })
979
+ }
980
+ userListdropdown() {
981
+ let teamsList = this.galleryForm.value.TeamsList.map((data: any) => data.teamName)
982
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
983
+ next: (res: any) => {
984
+ if (res && res.code == 200) {
985
+ let users = res.data.map((data: any) => data.userEmail)
986
+ let obj = {
987
+ "fromDate": this.galleryForm.value.fromDate,
988
+ "toDate": this.galleryForm.value.toDate,
989
+ "ChecklistType": this.galleryForm.value.checkListType, // ["custom", "AI"]
990
+ "checklistName": this.galleryForm.value.checklistName,
991
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
992
+ "filtertype": this.galleryForm.value.filtertype,
993
+ "storeId": [],
994
+ "userEmail": users,
995
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
996
+ "viewFlag": this.galleryForm.value.viewFlag,//[true, false]
997
+ "viewRedo": this.galleryForm.value.viewRedo,//[true, false]
998
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : "",
999
+ "filter": this.galleryForm.value.filter,
1000
+ }
1001
+ this.traxService.getchecklist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1002
+ next: (res: any) => {
1003
+ if (res && res.code === 200) {
1004
+ this.userList = res.data.storesDetails
1005
+ // console.log("-----", this.userList)
1006
+ // this.galleryForm.get('userList')?.setValue(this.userList)
1007
+ //hided becoz while select single user and apply its applied all user to the list
1008
+ this.galleryForm.get('storeList')?.setValue([])
1009
+ this.storeList = []
1010
+ this.getChecklistQA(false);
1011
+ } else {
1012
+ this.getChecklistQA(false);
1013
+ }
1014
+ }
1015
+ })
1016
+ }
1017
+ }
1018
+ })
1019
+ }
1020
+ storeListdropdown() {
1021
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
1022
+ next: (res: any) => {
1023
+ if (res && res.code == 200) {
1024
+ let stores = res.data.storesData.map((data: any) => data.storeId)
1025
+ let obj = {
1026
+ "fromDate": this.galleryForm.value.fromDate,
1027
+ "toDate": this.galleryForm.value.toDate,
1028
+ "ChecklistType": this.galleryForm.value.checkListType, // ["custom", "AI"]
1029
+ "checklistName": this.galleryForm.value.checklistName,
1030
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
1031
+ "filtertype": this.galleryForm.value.filtertype,
1032
+ "storeId": this.galleryForm.value.filtertype === 'Clusters' ? stores : [],
1033
+ "userEmail": [],
1034
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
1035
+ "viewFlag": this.galleryForm.value.viewFlag,//[true, false]
1036
+ "viewRedo": this.galleryForm.value.viewRedo,//[true, false]
1037
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : "",
1038
+ "filter": this.galleryForm.value.filter,
1039
+ "approveFilter": this.approveFilter
1040
+ }
1041
+ this.traxService.getchecklist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1042
+ next: (res: any) => {
1043
+ if (res && res.code === 200) {
1044
+ this.stores = res.data.storesDetails
1045
+ this.storeList = res.data.storesDetails
1046
+ // this.galleryForm.get('storeList')?.setValue(this.stores)
1047
+ this.getChecklistQA(false);
1048
+ } else {
1049
+ this.getChecklistQA(false);
1050
+ }
1051
+ }
1052
+ })
1053
+ }
1054
+ }
1055
+ })
1056
+ }
1057
+ select = 'custom'
1058
+ onSubmit() {
1059
+ if (this.headerFilters.client === "464") {
1060
+ this.requestPermission()
1061
+ }
1062
+ this.offset = 1
1063
+ this.checklistName = this.galleryForm.value.checklistName
1064
+ this.checkListDescription = this.galleryForm.value.checkListDescription
1065
+ this.showmulti = true;
1066
+ this.showsingle = false
1067
+ this.answerFilter = []
1068
+ this.selectedStores = [];
1069
+ this.selectedUsers = [];
1070
+ if (this.galleryForm.value.sourceCheckList_id === 'storeopenandclose') {
1071
+ this.select = 'storeopenandclose'
1072
+ this.getchecklistDetails();
1073
+ this.storeOpencloselist(false)
1074
+ } else if (this.boximageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1075
+ this.select = this.galleryForm.value.sourceCheckList_id
1076
+ this.getchecklistDetails()
1077
+ this.queuealertlist(false)
1078
+ } else if (this.imageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1079
+ this.select = this.galleryForm.value.sourceCheckList_id;
1080
+ this.getchecklistDetails()
1081
+ this.getmobileUsageDatalist(false)
1082
+ } else if (this.videoChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1083
+ this.select = this.galleryForm.value.sourceCheckList_id;
1084
+ this.customerunattendedlist(false)
1085
+ } else if (this.galleryForm.value.sourceCheckList_id === 'customertrial') {
1086
+ this.select = 'customertrial';
1087
+ this.getcustomertriallist()
1088
+ } else {
1089
+ this.select = this.galleryForm.value.type === 'checklist' ? "custom" : this.galleryForm.value.type;
1090
+ if (this.galleryForm.value.type === 'checklist') {
1091
+ if (this.galleryForm.value.filtertype === 'Clusters') {
1092
+ this.galleryForm.get('userList')?.setValue([])
1093
+ this.storeListdropdown();
1094
+ } else {
1095
+ this.galleryForm.get('storeList')?.setValue([])
1096
+ this.userListdropdown();
1097
+ }
1098
+ } else {
1099
+ if (this.galleryForm.value.filtertype === 'Clusters') {
1100
+ this.galleryForm.get('userList')?.setValue([])
1101
+ this.storeListdropdownTask();
1102
+ } else {
1103
+ this.galleryForm.get('storeList')?.setValue([])
1104
+ this.userListdropdownTask();
1105
+ }
1106
+ }
1107
+ }
1108
+ }
1109
+
1110
+ show: number = 0;
1111
+ accordian(index: any) {
1112
+ if (this.show == index) {
1113
+ this.show = -1;
1114
+ } else {
1115
+ this.show = index;
1116
+ }
1117
+ }
1118
+ getzonetlist() {
1119
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1120
+ let zone = this.galleryForm.value.zoneList?.length ? this.galleryForm.value.zoneList.map((data: any) => data.value) : []
1121
+ let obj = {
1122
+ "fromDate": this.galleryForm.value.fromDate,
1123
+ "toDate": this.galleryForm.value.toDate,
1124
+ "storeId": stores,
1125
+ "clientId": this.headerFilters.client,
1126
+ "ChecklistType": this.select,
1127
+ "offset": 0,
1128
+ "limit": 10000,
1129
+ "viewImage": false,
1130
+ "category": zone
1131
+ }
1132
+ this.traxService.queuealertlist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1133
+ next: (res: any) => {
1134
+ if (res && res.code === 200) {
1135
+ this.mobileusageDataList = res.data.data
1136
+ this.mobileusageDataList.forEach((store: any) => {
1137
+ store.checked = true;
1138
+ });
1139
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
1140
+ this.zoneList = res.data.zones
1141
+ this.galleryForm.get('zoneList')?.setValue(res.data.selectedzones)
1142
+ }
1143
+ }
1144
+ })
1145
+
1146
+ }
1147
+ queuealertlist(type: any) {
1148
+ this.loading = true;
1149
+ this.noData = false;
1150
+ this.viewloading = true;
1151
+ this.viewnoData = false;
1152
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1153
+ let zone = this.galleryForm.value.zoneList?.length ? this.galleryForm.value.zoneList.map((data: any) => data.value) : []
1154
+ let obj = {
1155
+ "fromDate": this.galleryForm.value.fromDate,
1156
+ "toDate": this.galleryForm.value.toDate,
1157
+ "storeId": stores,
1158
+ "clientId": this.headerFilters.client,
1159
+ "ChecklistType": this.select,
1160
+ "offset": 0,
1161
+ "limit": 10000,
1162
+ "viewImage": false,
1163
+ "category": zone
1164
+ }
1165
+ this.traxService.queuealertlist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1166
+ next: (res: any) => {
1167
+ if (res && res.code === 200) {
1168
+ this.mobileusageDataList = res.data.data
1169
+ this.zoneList = res.data.zones
1170
+ this.galleryForm.get('zoneList')?.setValue(res.data.selectedzones)
1171
+ this.stores = []
1172
+ this.mobileusageDataList.forEach((element: any) => {
1173
+ element.checked = true
1174
+ this.stores.push({
1175
+ storeId: element.storeId,
1176
+ storeName: element.storeName
1177
+ })
1178
+ });
1179
+
1180
+ this.stores = this.stores
1181
+ this.galleryForm.get('storeList')?.setValue(this.stores)
1182
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
1183
+ this.loading = false;
1184
+ this.noData = false
1185
+ this.viewloading = false;
1186
+ this.viewnoData = false;
1187
+ this.queuealertview()
1188
+
1189
+
1190
+ } else {
1191
+ this.loading = false;
1192
+ this.noData = true;
1193
+ this.viewloading = false;
1194
+ this.viewnoData = true;
1195
+
1196
+ }
1197
+ }
1198
+ })
1199
+ }
1200
+
1201
+ storeOpencloselist(type: any) {
1202
+ this.loading = true;
1203
+ this.noData = false;
1204
+ this.viewloading = true;
1205
+ this.viewnoData = false;
1206
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1207
+ let obj = {
1208
+ "fromDate": this.galleryForm.value.fromDate,
1209
+ "toDate": this.galleryForm.value.toDate,
1210
+ "storeId": stores,
1211
+ "clientId": this.headerFilters.client,
1212
+ "ChecklistType": this.select,
1213
+ "offset": 0,
1214
+ "limit": 10000,
1215
+ "viewImage": false,
1216
+ "category": this.category
1217
+ }
1218
+ this.traxService.storeOpencloselist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1219
+ next: (res: any) => {
1220
+ if (res && res.code === 200) {
1221
+ this.mobileusageDataList = res.data.storeopenandcloseData
1222
+ this.stores = []
1223
+ this.mobileusageDataList.forEach((element: any) => {
1224
+ element.checked = true
1225
+ this.stores.push({
1226
+ storeId: element.storeId,
1227
+ storeName: element.storeName
1228
+ })
1229
+ });
1230
+
1231
+ this.stores = this.stores
1232
+ this.galleryForm.get('storeList')?.setValue(this.stores)
1233
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
1234
+ this.loading = false;
1235
+ this.noData = false
1236
+ this.viewloading = false;
1237
+ this.viewnoData = false;
1238
+ this.storeOpencloseview()
1239
+
1240
+
1241
+ } else {
1242
+ this.loading = false;
1243
+ this.noData = true;
1244
+ this.viewloading = false;
1245
+ this.viewnoData = true;
1246
+
1247
+ }
1248
+ }
1249
+ })
1250
+ }
1251
+ queuealertview() {
1252
+ this.loading = true;
1253
+ this.noData = false;
1254
+ this.limit = 1
1255
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1256
+ let zones = this.galleryForm.value.zoneList?.length ? this.galleryForm.value.zoneList.map((data: any) => data.value) : []
1257
+ let obj = {
1258
+ "fromDate": this.galleryForm.value.fromDate,
1259
+ "toDate": this.galleryForm.value.toDate,
1260
+ "storeId": stores,
1261
+ "clientId": this.headerFilters.client,
1262
+ "ChecklistType": this.select,
1263
+ "offset": (this.offset - 1),
1264
+ "limit": this.limit,
1265
+ "viewImage": true,
1266
+ "category": zones,
1267
+ }
1268
+ this.viewloading = true;
1269
+ this.viewnoData = false;
1270
+ this.limit = 1
1271
+ this.paginationSizes = [1]
1272
+ this.traxService.queuealertlist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1273
+ next: (res: any) => {
1274
+ if (res && res.code === 200) {
1275
+ this.queueAlertView = res.data.data
1276
+ this.zoneList = res.data.zones
1277
+ this.galleryForm.get('zoneList')?.setValue(res.data.selectedzones)
1278
+ this.queueAlertView.forEach((element: any) => {
1279
+ element.dateString = dayjs(element.dateString).format('DD-MM-YYYY')
1280
+ });
1281
+ this.totalCount = res.data.total_count
1282
+ this.viewloading = false;
1283
+ this.viewnoData = false
1284
+ this.loading = false;
1285
+ this.noData = false;
1286
+ } else {
1287
+ this.viewloading = false;
1288
+ this.viewnoData = true
1289
+ this.loading = false;
1290
+ this.noData = false;
1291
+
1292
+ }
1293
+ }
1294
+ })
1295
+ }
1296
+
1297
+
1298
+
1299
+ storeOpencloseview() {
1300
+ this.loading = true;
1301
+ this.noData = false;
1302
+ this.limit = 10
1303
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1304
+ let obj = {
1305
+ "fromDate": this.galleryForm.value.fromDate,
1306
+ "toDate": this.galleryForm.value.toDate,
1307
+ "storeId": stores,
1308
+ "clientId": this.headerFilters.client,
1309
+ "ChecklistType": this.select,
1310
+ "offset": (this.offset - 1),
1311
+ "limit": this.limit,
1312
+ "viewImage": true,
1313
+ "category": this.category
1314
+
1315
+ }
1316
+ this.viewloading = true;
1317
+ this.viewnoData = false;
1318
+ this.limit = 10;
1319
+ this.paginationSizes = [10];
1320
+ this.traxService.storeOpencloselist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1321
+ next: (res: any) => {
1322
+ if (res && res.code === 200) {
1323
+ this.storeOpencloseView = res.data.storeopenandcloseData
1324
+
1325
+ this.storeOpencloseView.forEach((element: any) => {
1326
+ element.dateString = dayjs(element.dateString).format('DD-MM-YYYY')
1327
+ });
1328
+ this.totalCount = res.data.total_count
1329
+ this.viewloading = false;
1330
+ this.viewnoData = false
1331
+ this.loading = false;
1332
+ this.noData = false;
1333
+ } else {
1334
+ this.viewloading = false;
1335
+ this.viewnoData = true
1336
+ this.loading = false;
1337
+ this.noData = false;
1338
+
1339
+ }
1340
+ }
1341
+ })
1342
+ }
1343
+
1344
+
1345
+ coverageData(coverage: any) {
1346
+ if (coverage === 'store') {
1347
+ this.galleryForm.get('userList')?.setValue([])
1348
+ this.galleryForm.get('filtertype')?.setValue('Clusters')
1349
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
1350
+ next: (res: any) => {
1351
+ if (res && res.code == 200) {
1352
+ this.storeList = res.data.storesData;
1353
+ this.stores = res.data.storesData
1354
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
1355
+ }
1356
+ }
1357
+ })
1358
+ } else {
1359
+ this.galleryForm.get('stores')?.setValue([])
1360
+ this.galleryForm.get('filtertype')?.setValue('Teams')
1361
+ let teamsList = this.galleryForm.value.TeamsList.map((data: any) => data.teamName)
1362
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
1363
+ next: (res: any) => {
1364
+ if (res && res.code == 200) {
1365
+ this.userList = res.data;
1366
+ this.galleryForm.get('userList')?.setValue(this.userList)
1367
+ }
1368
+ }
1369
+ })
1370
+ }
1371
+ }
1372
+
1373
+ checklistNamechange(event: any, type: any) {
1374
+ this.removeQueryParams()
1375
+ if (event.checkListType === "AI") {
1376
+ this.showflag = false
1377
+ } else {
1378
+ this.galleryForm.get('checkListType')?.setValue(event.checkListType)
1379
+ this.showflag = true
1380
+ }
1381
+ this.galleryForm.get('sourceCheckList_id')?.setValue(event?.sourceCheckList_id)
1382
+ this.galleryForm.get('checklistName')?.setValue(event?.checkListName)
1383
+ this.galleryForm.get('checkListDescription')?.setValue(event?.checkListDescription)
1384
+
1385
+ if (event && event.coverage === 'store') {
1386
+ this.galleryForm.get('userList')?.setValue([])
1387
+ this.galleryForm.get('filtertype')?.setValue('Clusters')
1388
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
1389
+ next: (res: any) => {
1390
+ if (res && res.code == 200) {
1391
+ this.storeList = res.data.storesData;
1392
+ this.stores = res.data.storesData
1393
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
1394
+ }
1395
+ }
1396
+ })
1397
+ } else {
1398
+ this.galleryForm.get('stores')?.setValue([])
1399
+ this.galleryForm.get('filtertype')?.setValue('Teams')
1400
+ let teamsList = this.galleryForm.value.TeamsList.map((data: any) => data.teamName)
1401
+ this.traxService.getusers({ clientId: this.headerFilters.client, teams: teamsList }).subscribe({
1402
+ next: (res: any) => {
1403
+ if (res && res.code == 200) {
1404
+ this.userList = res.data;
1405
+ this.galleryForm.get('userList')?.setValue(this.userList)
1406
+ }
1407
+ }
1408
+ })
1409
+ }
1410
+
1411
+ }
1412
+
1413
+
1414
+ customerunattendedlist(type: any) {
1415
+ this.loading = true;
1416
+ this.noData = false;
1417
+ this.viewloading = true;
1418
+ this.viewnoData = false
1419
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1420
+ let obj = {
1421
+ "date": this.galleryForm.value.fromDate,
1422
+ "fromDate": this.galleryForm.value.fromDate,
1423
+ "toDate": this.galleryForm.value.toDate,
1424
+ "storeId": stores,
1425
+ "clientId": this.headerFilters.client,
1426
+ "ChecklistType": this.select,
1427
+ "viewImage": false,
1428
+ "limit": 10,
1429
+ "offset": 0,
1430
+ "category": this.category
1431
+ }
1432
+ this.traxService.getcustomerunattendedlist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1433
+ next: (res: any) => {
1434
+ if (res && res.code === 200) {
1435
+ this.mobileusageDataList = res.data.data;
1436
+ this.stores = [];
1437
+ this.mobileusageDataList.forEach((element: any) => {
1438
+ element.checked = true
1439
+ this.stores.push({
1440
+ storeId: element.storeId,
1441
+ storeName: element.storeName
1442
+ })
1443
+ });
1444
+ this.totalCount = res.data.total_count
1445
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
1446
+ this.stores = this.stores
1447
+ this.galleryForm.get('storeList')?.setValue(this.stores)
1448
+ this.loading = false;
1449
+ this.noData = false
1450
+ this.getcustomerunattendedview()
1451
+ } else {
1452
+ this.loading = false;
1453
+ this.noData = true;
1454
+ this.viewloading = false;
1455
+ this.viewnoData = true
1456
+
1457
+ }
1458
+ }
1459
+ })
1460
+ }
1461
+ selectedExport = false
1462
+ selectedQuestion(event: any, section: any, Question: any) {
1463
+ if (event.target.checked) {
1464
+ if (this.tempselectedSection.length == 0) {
1465
+ let questions: any = []
1466
+ let answer: any = []
1467
+ answer.push(Question.answerType)
1468
+ questions.push(Question.qname.replace(/\n/g, " "))
1469
+ let response = {
1470
+ sectionName: section.sectionName,
1471
+ questions: questions,
1472
+ answerType: answer
1473
+ }
1474
+ this.tempselectedSection.push(response)
1475
+ } else {
1476
+ let sectionExists = this.tempselectedSection.filter((data: any) => data.sectionName === section.sectionName)
1477
+ if (sectionExists.length > 0) {
1478
+ this.tempselectedSection.map((data: any) => {
1479
+ if (data.sectionName === section.sectionName) {
1480
+ data.questions.push(Question.qname.replace(/\n/g, " "))
1481
+ data.answerType.push(Question.answerType)
1482
+ }
1483
+ })
1484
+ } else {
1485
+ let questions: any = []
1486
+ let answer: any = []
1487
+
1488
+
1489
+ answer.push(Question.answerType)
1490
+
1491
+ questions.push(Question.qname.replace(/\n/g, " "))
1492
+ let response = {
1493
+ sectionName: section.sectionName,
1494
+ questions: questions,
1495
+ answerType: answer
1496
+ }
1497
+ this.tempselectedSection.push(response)
1498
+ }
1499
+
1500
+ }
1501
+ this.checklistData.map((sec: any) => {
1502
+ if (sec.sectionName == section.sectionName) {
1503
+ sec.questions.map((ques: any) => {
1504
+ if (ques.qname === Question.qname.replace(/\n/g, " ")) {
1505
+ ques.checked = true
1506
+ }
1507
+ })
1508
+ }
1509
+ })
1510
+ this.cd.detectChanges()
1511
+ } else {
1512
+
1513
+ this.tempselectedSection.map((data: any) => {
1514
+ if (data.sectionName == section.sectionName) {
1515
+ data.questions = data.questions.filter((ele: any) => ele != Question.qname.replace(/\n/g, " "))
1516
+ data.answerType = data.answerType.filter((ele: any) => ele != Question.answerType)
1517
+
1518
+ }
1519
+ })
1520
+ this.tempselectedSection = this.tempselectedSection.filter((ele: any) => ele.questions.length > 0)
1521
+ }
1522
+
1523
+
1524
+ this.selectedExport = this.tempselectedSection.length > 0;
1525
+ }
1526
+ getcustomertriallist() {
1527
+ this.loading = true;
1528
+ this.noData = false;
1529
+ this.viewloading = true;
1530
+ this.viewnoData = false;
1531
+ this.mobileusageDataList = [{ storeId: "59-147", storeName: "Birkenstock Dubai Hills", detections: "20" }];
1532
+ this.mobileusageDataList.forEach((element: any) => {
1533
+ element.checked = true
1534
+ this.stores.push({
1535
+ storeId: element.storeId,
1536
+ storeName: element.storeName
1537
+ })
1538
+ });
1539
+
1540
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
1541
+ this.stores = this.stores
1542
+ this.mobileusageData =
1543
+ [{
1544
+ storeName: "Birkenstock Dubai Hills",
1545
+ imageUrl: [
1546
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_10_09_59_000_24_01_2025_false.gif",
1547
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_10_09_59_000_24_01_2025_false.gif",
1548
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_10_40_32_000_24_01_2025_false.gif",
1549
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_10_50_43_000_24_01_2025_false.gif",
1550
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_11_00_54_000_24_01_2025_false.gif",
1551
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_11_11_05_000_24_01_2025_false.gif",
1552
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_11_21_16_000_24_01_2025_false.gif",
1553
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_11_21_19_000_25_01_2025_1737789185.gif",
1554
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_12_42_44_000_24_01_2025_false.gif",
1555
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_12_42_50_000_25_01_2025_1737794349.gif",
1556
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_13_03_07_000_24_01_2025_false.gif",
1557
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_13_23_28_000_24_01_2025_1737710283.gif",
1558
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_13_33_47_000_25_01_2025_1737797588.gif",
1559
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_14_44_57_000_24_01_2025_false.gif",
1560
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_18_59_40_000_24_01_2025_1737730286.gif",
1561
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_20_10_59_000_24_01_2025_1737734773.gif",
1562
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_20_21_10_000_24_01_2025_1737735241.gif",
1563
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_21_12_07_000_24_01_2025_1737738233.gif",
1564
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_21_42_41_000_24_01_2025_1737740509.gif",
1565
+ "trail/59-147/b1c5b15c0133dec0c45640d923fda221_22_23_27_000_24_01_2025_1737742412.gif",
1566
+ ]
1567
+ }]
1568
+ this.loading = false;
1569
+ this.noData = false
1570
+ this.viewloading = false;
1571
+ this.viewnoData = false
1572
+ this.totalCount = 1
1573
+ }
1574
+ getmobileUsageDatalist(type: any) {
1575
+ this.loading = true;
1576
+ this.noData = false;
1577
+ this.viewloading = true;
1578
+ this.viewnoData = false;
1579
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1580
+ let obj = {
1581
+ "date": this.galleryForm.value.fromDate,
1582
+ "fromDate": this.galleryForm.value.fromDate,
1583
+ "toDate": this.galleryForm.value.toDate,
1584
+ "storeId": stores,
1585
+ "clientId": this.headerFilters.client,
1586
+ "ChecklistType": this.select,
1587
+ "viewImage": false,
1588
+ "offset": (this.offset - 1),
1589
+ "limit": this.limit,
1590
+ "category": this.category
1591
+ }
1592
+ this.traxService.getMobUsagelist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1593
+ next: (res: any) => {
1594
+ if (res && res.code === 200) {
1595
+ this.mobileusageDataList = res.data.data;
1596
+ this.stores = []
1597
+ this.mobileusageDataList.forEach((element: any) => {
1598
+ element.checked = true
1599
+ this.stores.push({
1600
+ storeId: element.storeId,
1601
+ storeName: element.storeName
1602
+ })
1603
+ });
1604
+ this.totalCount = res.data.total_count
1605
+ this.selectAll = this.mobileusageDataList.every((obj: any) => obj.checked);
1606
+ this.stores = this.stores
1607
+ this.galleryForm.get('storeList')?.setValue(this.stores)
1608
+ this.loading = false;
1609
+ this.noData = false
1610
+ this.getmobileUsageDataview()
1611
+ } else {
1612
+ this.loading = false;
1613
+ this.noData = true;
1614
+ this.viewnoData = true;
1615
+ this.viewloading = false
1616
+
1617
+ }
1618
+ }
1619
+ })
1620
+ }
1621
+ onreset() {
1622
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
1623
+ next: (res: any) => {
1624
+ if (res && res.code == 200) {
1625
+ this.storeList = res.data.storesData;
1626
+ this.stores = res.data.storesData
1627
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
1628
+ this.offset = 1
1629
+ if (this.galleryForm.value.sourceCheckList_id === 'storeopenandclose') {
1630
+ this.select = 'storeopenandclose'
1631
+ this.storeOpencloselist(false)
1632
+ } else if (this.boximageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1633
+ this.galleryForm.get('zoneList')?.setValue([])
1634
+ this.select = this.galleryForm.value.sourceCheckList_id
1635
+ this.queuealertlist(false)
1636
+ } else if (this.imageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1637
+ this.select = this.galleryForm.value.sourceCheckList_id;
1638
+ this.getmobileUsageDatalist(false)
1639
+ } else if (this.videoChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1640
+ this.select = this.galleryForm.value.sourceCheckList_id;
1641
+ this.customerunattendedlist(false)
1642
+ } else {
1643
+ this.select = this.galleryForm.value.type === 'checklist' ? "custom" : "";
1644
+ if (this.galleryForm.value.filtertype === 'Clusters') {
1645
+ this.storeListdropdown();
1646
+ } else {
1647
+ this.userListdropdown();
1648
+ }
1649
+ }
1650
+
1651
+ } else {
1652
+ this.storeList = [];
1653
+ }
1654
+ },
1655
+ error: () => {
1656
+ this.storeList = [];
1657
+ },
1658
+ });
1659
+
1660
+ }
1661
+ onview() {
1662
+ this.offset = 1;
1663
+ if (this.galleryForm.value.sourceCheckList_id === 'storeopenandclose') {
1664
+ this.select = 'storeopenandclose'
1665
+ this.storeOpencloseview()
1666
+ } else if (this.boximageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1667
+ this.select = this.galleryForm.value.sourceCheckList_id
1668
+ this.queuealertview()
1669
+ } else if (this.imageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1670
+ this.select = this.galleryForm.value.sourceCheckList_id;
1671
+ this.getmobileUsageDataview()
1672
+ } else if (this.videoChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
1673
+ this.select = this.galleryForm.value.sourceCheckList_id;
1674
+ this.getcustomerunattendedview()
1675
+ }
1676
+ }
1677
+ getcustomerunattendedview() {
1678
+
1679
+ this.viewloading = true;
1680
+ this.viewnoData = false;
1681
+ this.limit = 1
1682
+ this.paginationSizes = [1]
1683
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1684
+ let obj = {
1685
+ "date": this.galleryForm.value.fromDate,
1686
+ "fromDate": this.galleryForm.value.fromDate,
1687
+ "toDate": this.galleryForm.value.toDate,
1688
+ "storeId": stores,
1689
+ "clientId": this.headerFilters.client,
1690
+ "ChecklistType": this.select,
1691
+ "viewImage": true,
1692
+ "offset": (this.offset - 1),
1693
+ "limit": this.limit,
1694
+ "category": this.category
1695
+ }
1696
+
1697
+ this.traxService.getcustomerunattendedlist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1698
+ next: (res: any) => {
1699
+ if (res && res.code === 200) {
1700
+ this.customerunattendedData = res.data.data
1701
+ this.viewloading = false;
1702
+ this.viewnoData = false
1703
+ this.totalCount = res.data.total_count
1704
+ } else {
1705
+ this.viewloading = false;
1706
+ this.viewnoData = true;
1707
+
1708
+ }
1709
+ }
1710
+ })
1711
+ }
1712
+ getmobileUsageDataview() {
1713
+ this.viewloading = true;
1714
+ this.viewnoData = false;
1715
+ this.limit = 10
1716
+ this.paginationSizes = [10]
1717
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1718
+ let obj = {
1719
+ "fromDate": this.galleryForm.value.fromDate,
1720
+ "toDate": this.galleryForm.value.toDate,
1721
+ "date": this.galleryForm.value.fromDate,
1722
+ "storeId": stores,
1723
+ "clientId": this.headerFilters.client,
1724
+ "ChecklistType": this.select,
1725
+ "viewImage": true,
1726
+ "offset": (this.offset - 1),
1727
+ "limit": this.limit,
1728
+ "category": this.category
1729
+ }
1730
+
1731
+ this.traxService.getMobUsagelist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
1732
+ next: (res: any) => {
1733
+ if (res && res.code === 200) {
1734
+ this.mobileusageData = res.data.data
1735
+ this.viewloading = false;
1736
+ this.viewnoData = false
1737
+ this.totalCount = res.data.total_count
1738
+ } else {
1739
+ this.viewloading = false;
1740
+ this.viewnoData = true
1741
+
1742
+ }
1743
+ }
1744
+ })
1745
+ }
1746
+ getfilterCount() {
1747
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1748
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
1749
+ let payload = {
1750
+ "fromDate": this.galleryForm.value.fromDate,
1751
+ "toDate": this.galleryForm.value.toDate,
1752
+ "filtertype": this.galleryForm.value.filtertype,
1753
+ "storeId": stores,
1754
+ "userEmail": users,
1755
+ "answerType": this.selectedSection[0].answerType[0],
1756
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
1757
+ "ChecklistType": "custom",
1758
+ "questions": this.selectedSection[0].questions[0]
1759
+ }
1760
+ this.traxService.getAnswercount(payload)?.pipe(takeUntil(this.destroy$))?.subscribe({
1761
+ next: (res: any) => {
1762
+ if (res && res.code === 200) {
1763
+ this.answerFilter = res.data.answersCount
1764
+ } else {
1765
+ this.answerFilter = []
1766
+ }
1767
+ }
1768
+ })
1769
+ }
1770
+
1771
+
1772
+
1773
+
1774
+
1775
+
1776
+
1777
+
1778
+
1779
+
1780
+ createMultipleTask(type: any) {
1781
+ // console.log(this.selectedStores, this.selectedUsers)
1782
+
1783
+ const isCluster = this.galleryForm.value.filtertype === 'Clusters';
1784
+ const isRedo = type === 'redo';
1785
+
1786
+ const filterFn = (ele: any) =>
1787
+ (isRedo ? !ele.redo && this.checktodayDate(ele.date_string) : ele.taskId === null);
1788
+
1789
+ if (isCluster) {
1790
+ this.selectedStores = this.selectedStores.filter(filterFn);
1791
+ } else {
1792
+ this.selectedUsers = this.selectedUsers.filter(filterFn);
1793
+ }
1794
+
1795
+ // console.log(this.selectedStores, this.selectedUsers)
1796
+ const modalRef = this.modalService.open(BulkcreationmodelComponent, {
1797
+ centered: true,
1798
+ size: "lg",
1799
+ windowClass: 'my-own-styles',
1800
+ backdrop: 'static',
1801
+ keyboard: false
1802
+
1803
+ });
1804
+ modalRef.componentInstance.type = type
1805
+ modalRef.componentInstance.filtertype = this.galleryForm.value.filtertype
1806
+ if(this.inputDataTask.multiQuestionReferenceImage && this.inputDataTask.multiQuestionReferenceImage.length){
1807
+ this.inputDataTask.questionReferenceImage = this.inputDataTask.multiQuestionReferenceImage.map((item:any) => item.imageURL);
1808
+ } else {
1809
+ if(this.inputDataTask.questionReferenceImage && this.inputDataTask.questionReferenceImage != '' && this.inputDataTask.referenceImage != null){
1810
+ this.inputDataTask.questionReferenceImage = [this.inputDataTask.questionReferenceImage?.referenceImage]
1811
+ }
1812
+ }
1813
+ this.inputDataTask?.answers.forEach((ans: any) => {
1814
+ if(!['yes/no', 'multiplechoicesingle', 'multiplechoicemultiple', 'dropdown'].includes(this.inputDataTask.answerType)){
1815
+ if(ans?.multiReferenceImage && ans?.multiReferenceImage.length){
1816
+ ans.referenceImage = ans.multiReferenceImage.map((item:any) => item.imageURL);
1817
+ }else{
1818
+ if (ans?.referenceImage && ans?.referenceImage != '' && ans?.referenceImage != null) {
1819
+ ans.referenceImage = [ans?.referenceImage]
1820
+ }
1821
+ }
1822
+ }
1823
+ // if (ans?.referenceImage && ans?.referenceImage != '' && ans?.referenceImage != null) {
1824
+ // ans.referenceImage = [ans?.referenceImage]
1825
+ // }
1826
+ });
1827
+ modalRef.componentInstance.taskDetails = {
1828
+ sections: [
1829
+ {
1830
+ "id": "",
1831
+ "name": "",
1832
+ "questions": [this.inputDataTask]
1833
+ }
1834
+ ]
1835
+
1836
+ };
1837
+ modalRef.componentInstance.sourceCheckList_id = this.galleryForm.value.sourceCheckList_id
1838
+ modalRef.componentInstance.payload = {
1839
+ coverage: this.galleryForm.value.filtertype === 'Teams' ? "user" : "store",
1840
+ selectedStores: this.selectedStores,
1841
+ selectedUsers: this.selectedUsers,
1842
+ operationtype: this.galleryForm.value.type,
1843
+ inputData: this.inputDataTask,
1844
+ sectionInfo: this.otherTaskData.sectionInfo,
1845
+ refImage: this.refImage,
1846
+ checklistName: this.galleryForm.value.checklistName,
1847
+ };
1848
+ // console.log(this.selectedStores.length)
1849
+ modalRef.result.then((result) => {
1850
+ // console.log("&&&&&&&", result)
1851
+ if (result === 'submit') {
1852
+ // console.log("************")
1853
+ this.selectedStores = [];
1854
+ this.selectedUsers = [];
1855
+ this.selectAllTask = false
1856
+ this.showsingle = false;
1857
+ this.showmulti = true;
1858
+ if (this.galleryForm.value.type === 'checklist') {
1859
+ this.getChecklistQA(false);
1860
+ } else {
1861
+ this.getTaskQA(this.galleryForm.value.type)
1862
+ }
1863
+ }
1864
+ })
1865
+ }
1866
+
1867
+
1868
+
1869
+
1870
+ selectedAllTask(event: any, checklist: any, data: any, checklistInfo: any, sectionInfo: any) {
1871
+ // console.log(data)
1872
+ // console.log(" selectedAllTask 11 =>")
1873
+ let answer: any = []
1874
+ answer = data.userAnswer.map((data: any) => data.answer)
1875
+ // console.log(answer)
1876
+ if (event.target.checked) {
1877
+ this.selectAllTask = event.target.checked;
1878
+
1879
+
1880
+ this.inputDataTask = data
1881
+ this.refImage = [...this.refImage, ...answer]
1882
+ // console.log(this.refImage)
1883
+ this.otherTaskData = {
1884
+ sectionInfo: sectionInfo,
1885
+ }
1886
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
1887
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
1888
+ this.viewChecklistsoptions = {
1889
+ "fromDate": this.galleryForm.value.fromDate,
1890
+ "toDate": this.galleryForm.value.toDate,
1891
+ "ChecklistType": this.galleryForm.value.type==='task'?this.galleryForm.value.type:this.galleryForm.value.checkListType, // ["checklist", "task"]
1892
+ "checklistName": this.galleryForm.value.checklistName,
1893
+ "filtertype": this.galleryForm.value.filtertype,
1894
+ "storeId": stores,
1895
+ "userEmail": users,
1896
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
1897
+ "offset": 0,
1898
+ "limit": 10000,
1899
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
1900
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
1901
+ "viewFlag": this.galleryForm.value.viewFlag,
1902
+ "viewRedo": this.galleryForm.value.viewRedo,//[true, false]
1903
+ "questions": this.selectedSection,
1904
+ "filter": this.galleryForm.value.filter,
1905
+ "approveFilter": this.approveFilter,
1906
+ }
1907
+
1908
+ this.traxService.getallchecklist(this.viewChecklistsoptions)?.pipe(takeUntil(this.destroy$))?.subscribe({
1909
+ next: (res: any) => {
1910
+ if (res && res.code === 200) {
1911
+ this.totalrecordcount = res.data.storesDetails.length
1912
+ this.selectedRecordCount = res.data.storesDetails.length
1913
+ res.data.storesDetails.forEach((ele: any) => {
1914
+ if (!ele.approvalStatus) {
1915
+ if (!ele.redo || !ele.taskId) {
1916
+ if (this.galleryForm.value.filtertype === 'Clusters') {
1917
+ this.selectedStores.push({
1918
+ storeName: ele.storeName,
1919
+ storeId: ele.store_id,
1920
+ userEmail: ele.userEmail,
1921
+ checklistId: ele.checklistId,
1922
+ section_id: ele.section_id,
1923
+ uniqueNo: data.uniqueNo,
1924
+ userName: ele.userName,
1925
+ date_string: ele.date_string,
1926
+ taskId: ele.taskId ? ele.taskId : null,
1927
+ redo: ele.redo
1928
+ })
1929
+ } else {
1930
+ this.selectedUsers.push({
1931
+ userEmail: ele.userEmail,
1932
+ checklistId: ele.checklistId,
1933
+ section_id: ele.section_id,
1934
+ uniqueNo: data.uniqueNo,
1935
+ userName: ele.userName,
1936
+ date_string: ele.date_string,
1937
+ taskId: ele.taskId ? ele.taskId : null,
1938
+ redo: ele.redo
1939
+ })
1940
+ }
1941
+ }
1942
+ }
1943
+
1944
+ this.viewChecklistsData.checklistAnswers.map((details: any) => {
1945
+
1946
+ if (res.data.storesDetails.filter((ele: any) => ele.userEmail === details.storeProfile?.userEmail).length > 0) {
1947
+ details.questionAnswer[0].questions[0].checked = true
1948
+ }
1949
+ })
1950
+ })
1951
+ }
1952
+ }
1953
+ })
1954
+
1955
+
1956
+
1957
+
1958
+ } else {
1959
+ this.selectAllTask = false
1960
+ this.selectedRecordCount = 0
1961
+ this.viewChecklistsData.checklistAnswers.map((details: any) => {
1962
+ details.questionAnswer[0].questions[0].checked = false
1963
+ })
1964
+ // console.log(this.selectedStores)
1965
+ this.refImage = this.refImage.filter((data) => data.answer)
1966
+ if (this.galleryForm.value.filtertype === 'Clusters') {
1967
+ this.selectedStores = []
1968
+ } else {
1969
+ this.selectedUsers = []
1970
+ }
1971
+ }
1972
+
1973
+ }
1974
+
1975
+
1976
+
1977
+ selectmultiTask(event: any, checklist: any, data: any, checklistInfo: any, sectionInfo: any) {
1978
+ // console.log(sectionInfo)
1979
+ // console.log(" selectmultiTask 11 =>")
1980
+ let answer: any = []
1981
+ answer = data.userAnswer.map((data: any) => data.answer)
1982
+ // console.log(answer)
1983
+ if (event.target.checked) {
1984
+ this.inputDataTask = data
1985
+ this.refImage = [...this.refImage, ...answer]
1986
+ // console.log(this.refImage)
1987
+ this.otherTaskData = {
1988
+ sectionInfo: sectionInfo,
1989
+ }
1990
+ if (this.galleryForm.value.filtertype === 'Clusters') {
1991
+ // console.log(checklist.checklistInfo)
1992
+ this.selectedStores.push({
1993
+ section_id: sectionInfo.section_id,
1994
+ storeId: checklist.storeProfile.store_id,
1995
+ storeName: checklist.storeProfile.storeName,
1996
+ checklistId: checklistInfo.checklistId,
1997
+ userEmail: checklist.checklistInfo.userEmail,
1998
+ uniqueNo: data.uniqueNo,
1999
+ taskId: data.taskId ? data.taskId : null,
2000
+ redo: data.redo,
2001
+ date_string: dayjs(checklist.checklistInfo.date, "DD MMM YYYY").format("YYYY-MM-DD")
2002
+ })
2003
+ } else {
2004
+ this.selectedUsers.push({
2005
+ section_id: sectionInfo.section_id,
2006
+ userEmail: checklist.checklistInfo.userEmail,
2007
+ userName: checklist.checklistInfo.submittedBy,
2008
+ checklistId: checklistInfo.checklistId,
2009
+ uniqueNo: data.uniqueNo,
2010
+ taskId: data.taskId ? data.taskId : null,
2011
+ redo: data.redo,
2012
+ date_string: dayjs(checklist.checklistInfo.date, "DD MMM YYYY").format("YYYY-MM-DD")
2013
+ })
2014
+ }
2015
+
2016
+
2017
+ } else {
2018
+ this.refImage = this.refImage.filter((data) => data.answer)
2019
+ if (this.galleryForm.value.filtertype === 'Clusters') {
2020
+ this.selectedStores = this.selectedStores.filter((data: any) => data.checklistId != checklistInfo.checklistId)
2021
+ } else {
2022
+ this.selectedUsers = this.selectedUsers.filter((data: any) => data.checklistId != checklistInfo.checklistId)
2023
+ }
2024
+ // console.log(checklistInfo.checklistId)
2025
+ // console.log(this.selectedStores)
2026
+ }
2027
+ this.selectedRecordCount = this.galleryForm.value.filtertype === 'Clusters'
2028
+ ? this.selectedStores.length
2029
+ : this.selectedUsers.length;
2030
+
2031
+ this.selectAllTask = this.totalrecordcount === this.selectedRecordCount;
2032
+ // console.log(this.selectedRecordCount, this.totalrecordcount)
2033
+ }
2034
+ selectsinglequestion() {
2035
+ this.selectedStores = [];
2036
+ this.selectedUsers = [];
2037
+ this.totalrecordcount = 0;
2038
+ this.selectedRecordCount = 0
2039
+ this.selectAllTask = false
2040
+ this.selectedSection = this.tempselectedSection
2041
+ if (this.questionscount(this.selectedSection) == 0 || this.questionscount(this.selectedSection) > 1) {
2042
+ this.showsingle = false;
2043
+ this.showmulti = true
2044
+ } else if (this.questionscount(this.selectedSection) == 1) {
2045
+ this.showsingle = true;
2046
+ this.showmulti = false
2047
+
2048
+ if (this.selectedSection[0].answerType[0] === "yes/no" || this.selectedSection[0].answerType[0] === "multiplechoicesingle" || this.selectedSection[0].answerType[0] === "multiplechoicemultiple" || this.selectedSection[0].answerType[0] === "dropdown") {
2049
+ this.showfilter = true;
2050
+ this.getfilterCount()
2051
+ } else {
2052
+ this.showfilter = false
2053
+ }
2054
+
2055
+ }
2056
+ this.offset = 1;
2057
+ this.viewloading = true;
2058
+ this.viewnoData = false;
2059
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2060
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2061
+ if (this.galleryForm.value.type === 'checklist') {
2062
+ let obj = {
2063
+ "fromDate": this.galleryForm.value.fromDate,
2064
+ "toDate": this.galleryForm.value.toDate,
2065
+ "ChecklistType": this.galleryForm.value.checkListType, // ["custom", "AI"]
2066
+ "checklistName": this.galleryForm.value.checklistName,
2067
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2068
+ "filtertype": this.galleryForm.value.filtertype,
2069
+ "storeId": stores,
2070
+ "userEmail": users,
2071
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2072
+ "viewFlag": this.galleryForm.value.viewFlag, //[true, false]
2073
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2074
+ "filter": this.galleryForm.value.filter,
2075
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : "",
2076
+ "approveFilter": this.approveFilter
2077
+ }
2078
+ this.traxService.getchecklist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
2079
+ next: (res: any) => {
2080
+ if (res && res.code === 200) {
2081
+ // this.checklistData = res?.data.checklistQuestions;
2082
+ this.loading = false;
2083
+ this.noData = false;
2084
+ if (this.galleryForm.value.filtertype === 'Clusters') {
2085
+ this.galleryForm.get('storeList')?.setValue(res?.data?.storesDetails)
2086
+ } else {
2087
+ this.galleryForm.get('userList')?.setValue(res?.data?.storesDetails)
2088
+ }
2089
+ this.viewChecklists("all", "all")
2090
+ } else {
2091
+ this.checklistData = [];
2092
+ this.viewChecklistsData = [];
2093
+ this.loading = false;
2094
+ this.noData = true;
2095
+ this.viewloading = false;
2096
+ this.viewnoData = true;
2097
+
2098
+ }
2099
+ }
2100
+ })
2101
+ } else {
2102
+ let obj = {
2103
+ "fromDate": this.galleryForm.value.fromDate,
2104
+ "toDate": this.galleryForm.value.toDate,
2105
+ "ChecklistType": this.galleryForm.value.type, // ["custom", "AI"]
2106
+ "checklistName": this.galleryForm.value.checklistName,
2107
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2108
+ "filtertype": this.galleryForm.value.filtertype,
2109
+ "storeId": stores,
2110
+ "userEmail": users,
2111
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2112
+ "viewFlag": this.galleryForm.value.viewFlag,//[true, false]
2113
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2114
+ "filter": this.galleryForm.value.filter,
2115
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : ""
2116
+
2117
+ }
2118
+ this.traxService.getQuestions(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
2119
+ next: (res: any) => {
2120
+ if (res && res.code === 200) {
2121
+ // this.checklistData = res?.data.checklistQuestions;
2122
+ this.loading = false;
2123
+ this.noData = false;
2124
+ if (this.galleryForm.value.filtertype === 'Clusters') {
2125
+ this.galleryForm.get('storeList')?.setValue(res?.data?.storesDetails)
2126
+ } else {
2127
+ this.galleryForm.get('userList')?.setValue(res?.data?.storesDetails)
2128
+ }
2129
+ this.viewTaskList("all", "all")
2130
+ } else {
2131
+ this.checklistData = [];
2132
+ this.viewChecklistsData = [];
2133
+ this.loading = false;
2134
+ this.noData = true;
2135
+ this.viewloading = false;
2136
+ this.viewnoData = true;
2137
+
2138
+ }
2139
+ }
2140
+ })
2141
+ }
2142
+ }
2143
+ appoveChecklist() {
2144
+ const modalRef = this.modalService.open(ApprovalPopupComponent, { centered: true, size: 'md', });
2145
+ modalRef.componentInstance.type = this.galleryForm.value.type;
2146
+ modalRef.componentInstance.checkListName = this.galleryForm.value.checklistName;
2147
+ modalRef.result.then((result) => {
2148
+ if (result == 'submit') {
2149
+
2150
+ if (this.galleryForm.value.filtertype === 'Clusters') {
2151
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2152
+ if (stores.length == 0) {
2153
+ this.toastService.getErrorToast("Please select atleast one store")
2154
+ return
2155
+ }
2156
+ } else {
2157
+ let user = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2158
+ if (user.length == 0) {
2159
+ this.toastService.getErrorToast("Please select atleast one user")
2160
+ return
2161
+ }
2162
+ }
2163
+
2164
+
2165
+
2166
+ if (this.galleryForm.value.type == 'checklist') {
2167
+ this.checklistApprove()
2168
+ } else {
2169
+ this.ApproveTask()
2170
+
2171
+ }
2172
+ }
2173
+ })
2174
+ }
2175
+ checklistApprove() {
2176
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2177
+ let user = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2178
+ let payload = {
2179
+ "clientId": this.headerFilters.client,
2180
+ "fromDate": this.galleryForm.value.fromDate,
2181
+ "toDate": this.galleryForm.value.toDate,
2182
+ "storeId": stores,
2183
+ "userEmail": user,
2184
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
2185
+ "filtertype": this.galleryForm.value.filtertype,
2186
+ }
2187
+ this.traxService.approvechecklist(payload)?.pipe(takeUntil(this.destroy$))?.subscribe({
2188
+ next: (res: any) => {
2189
+ if (res && res.code === 200) {
2190
+ this.approvalstatus()
2191
+ if (this.galleryForm.value.type === 'checklist') {
2192
+ this.getChecklistQA(false);
2193
+ } else {
2194
+ this.getTaskQA(this.galleryForm.value.type)
2195
+ }
2196
+ this.toastService.getSuccessToast(`<div><span class="me-8" >${res.message}</span></div>`)
2197
+ }
2198
+ }, error: (err) => {
2199
+ this.toastService.getErrorToast(err?.error?.error)
2200
+ }
2201
+ })
2202
+ }
2203
+
2204
+
2205
+ ApproveTask() {
2206
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2207
+ let user = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2208
+ let payload = {
2209
+ "fromDate": this.galleryForm.value.fromDate,
2210
+ "toDate": this.galleryForm.value.toDate,
2211
+ "storeId": stores,
2212
+ "userEmail": user,
2213
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
2214
+ "clientId": this.headerFilters.client,
2215
+ "filtertype": this.galleryForm.value.filtertype,
2216
+ }
2217
+ this.traxService.approvetask(payload)?.pipe(takeUntil(this.destroy$))?.subscribe({
2218
+ next: (res: any) => {
2219
+ if (res && res.code === 200) {
2220
+ this.toastService.getSuccessToast(`<div><span class="me-8" >${res.message}</span></div>`)
2221
+ this.approvalstatus()
2222
+ if (this.galleryForm.value.type === 'checklist') {
2223
+ this.getChecklistQA(false);
2224
+ } else {
2225
+ this.getTaskQA(this.galleryForm.value.type)
2226
+ }
2227
+ }
2228
+ }, error: (err) => {
2229
+ this.toastService.getErrorToast(err?.error?.error)
2230
+ }
2231
+ })
2232
+
2233
+
2234
+
2235
+ }
2236
+
2237
+ getChecklistQA(type: any) {
2238
+ this.selectedSection = []
2239
+ this.tempselectedSection = []
2240
+ this.loading = true;
2241
+ this.noData = false
2242
+ this.viewloading = true;
2243
+ this.viewnoData = false;
2244
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2245
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2246
+ let obj = {
2247
+ "fromDate": this.galleryForm.value.fromDate,
2248
+ "toDate": this.galleryForm.value.toDate,
2249
+ "ChecklistType": this.galleryForm.value.checkListType, // ["custom", "AI"]
2250
+ "checklistName": this.galleryForm.value.checklistName,
2251
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2252
+ "filtertype": this.galleryForm.value.filtertype,
2253
+ "userEmail": users,
2254
+ "storeId": stores,
2255
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2256
+ "viewFlag": this.galleryForm.value.viewFlag, //[true, false]
2257
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2258
+ "filter": this.galleryForm.value.filter,
2259
+ "approveFilter": this.approveFilter,
2260
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : ""
2261
+ }
2262
+ this.traxService.getchecklist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
2263
+ next: (res: any) => {
2264
+ if (res && res.code === 200) {
2265
+ this.checklistData = res?.data.checklistQuestions;
2266
+ this.loading = false;
2267
+ this.noData = false;
2268
+ const targetField = this.galleryForm.value.filtertype === 'Clusters' ? 'storeList' : 'userList';
2269
+ this.galleryForm.get(targetField)?.setValue(res?.data?.storesDetails);
2270
+ this.viewChecklists("all", "all")
2271
+ } else {
2272
+ this.checklistData = [];
2273
+ this.viewChecklistsData = [];
2274
+ this.loading = false;
2275
+ this.noData = true;
2276
+ this.viewloading = false;
2277
+ this.viewnoData = true;
2278
+
2279
+ }
2280
+ }
2281
+ })
2282
+ }
2283
+ gettaskQA(type: any) {
2284
+ this.selectedSection = []
2285
+ this.tempselectedSection = []
2286
+
2287
+ this.loading = true;
2288
+ this.noData = false
2289
+ this.viewloading = true;
2290
+ this.viewnoData = false;
2291
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2292
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2293
+ let obj = {
2294
+ "fromDate": this.galleryForm.value.fromDate,
2295
+ "toDate": this.galleryForm.value.toDate,
2296
+ "ChecklistType": this.galleryForm.value.type, // ["custom", "AI"]
2297
+ "checklistName": this.galleryForm.value.checklistName,
2298
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2299
+ "filtertype": this.galleryForm.value.filtertype,
2300
+ "userEmail": users,
2301
+ "storeId": stores,
2302
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2303
+ "viewFlag": this.galleryForm.value.viewFlag, //[true, false]
2304
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2305
+ "filter": this.galleryForm.value.filter,
2306
+ "approveFilter": this.approveFilter,
2307
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : ""
2308
+ }
2309
+ this.traxService.getQuestions(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
2310
+ next: (res: any) => {
2311
+ if (res && res.code === 200) {
2312
+ this.checklistData = res?.data.checklistQuestions;
2313
+ this.loading = false;
2314
+ this.noData = false;
2315
+ if (this.galleryForm.value.filtertype === 'Clusters') {
2316
+ this.galleryForm.get('storeList')?.setValue(res?.data?.storesDetails)
2317
+ } else {
2318
+ this.galleryForm.get('userList')?.setValue(res?.data?.storesDetails)
2319
+ }
2320
+ this.viewTaskList("all", "all")
2321
+ } else {
2322
+ this.checklistData = [];
2323
+ this.viewChecklistsData = [];
2324
+ this.loading = false;
2325
+ this.noData = true;
2326
+ this.viewloading = false;
2327
+ this.viewnoData = true;
2328
+
2329
+ }
2330
+ }
2331
+ })
2332
+ }
2333
+
2334
+
2335
+ viewTaskList(sectionName: any, questionName: any) {
2336
+ this.selectedExport = false;
2337
+ this.sectionName = sectionName;
2338
+ this.questionName = questionName
2339
+
2340
+ this.limit = 1;
2341
+ this.paginationSizes = [1];
2342
+ if (this.selectedSection.length > 0) {
2343
+ this.limit = 10,
2344
+ this.paginationSizes = [10];
2345
+ }
2346
+ this.viewloading = true;
2347
+ this.viewnoData = false
2348
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2349
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2350
+ this.viewChecklistsoptions = {
2351
+ "fromDate": this.galleryForm.value.fromDate,
2352
+ "toDate": this.galleryForm.value.toDate,
2353
+ "ChecklistType": this.galleryForm.value.type, // ["checklist", "task"]
2354
+ "checklistName": this.galleryForm.value.checklistName,
2355
+ "filtertype": this.galleryForm.value.filtertype,
2356
+ "userEmail": users,
2357
+ "storeId": stores,
2358
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2359
+ "offset": (this.offset - 1),
2360
+ "limit": this.limit,
2361
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2362
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
2363
+ "viewFlag": this.galleryForm.value.viewFlag,
2364
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2365
+ "questions": this.selectedSection,
2366
+ "filter": this.galleryForm.value.filter,
2367
+ "approveFilter": this.approveFilter,
2368
+ }
2369
+ this.traxService.getAnswers(this.viewChecklistsoptions)?.pipe(takeUntil(this.destroy$))?.subscribe({
2370
+ next: (res: any) => {
2371
+ if (res && res.code === 200) {
2372
+ this.approvalstatus()
2373
+ this.viewChecklistsData = res.data;
2374
+ if (this.showsingle) {
2375
+ let loopingData = this.galleryForm.value.filtertype === 'Clusters' ? this.selectedStores : this.selectedUsers
2376
+ this.viewChecklistsData.checklistAnswers.map((details: any) => {
2377
+ if (loopingData.filter((ele: any) => ele.userEmail === details.storeProfile?.userEmail).length > 0) {
2378
+ details.questionAnswer[0].questions[0].checked = true
2379
+ }
2380
+ })
2381
+ }
2382
+ this.totalCount = this.viewChecklistsData.total_count
2383
+ this.viewloading = false;
2384
+ this.viewnoData = false
2385
+ } else {
2386
+ this.viewChecklistsData = []
2387
+ this.viewloading = false;
2388
+ this.viewnoData = true
2389
+
2390
+ }
2391
+ }
2392
+ })
2393
+ }
2394
+
2395
+ viewChecklists(sectionName: any, questionName: any) {
2396
+ // this.selectedSection = []
2397
+ this.selectedExport = false;
2398
+ this.sectionName = sectionName;
2399
+ this.questionName = questionName
2400
+
2401
+ this.limit = 1;
2402
+ this.paginationSizes = [1];
2403
+ if (this.selectedSection.length > 0) {
2404
+ this.limit = 10,
2405
+ this.paginationSizes = [10];
2406
+ }
2407
+ this.viewloading = true;
2408
+ this.viewnoData = false
2409
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2410
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2411
+ this.viewChecklistsoptions = {
2412
+ "fromDate": this.galleryForm.value.fromDate,
2413
+ "toDate": this.galleryForm.value.toDate,
2414
+ "ChecklistType": this.galleryForm.value.checkListType, // ["checklist", "task"]
2415
+ "checklistName": this.galleryForm.value.checklistName,
2416
+ "filtertype": this.galleryForm.value.filtertype,
2417
+ "storeId": stores,
2418
+ "userEmail": users,
2419
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2420
+ "offset": (this.offset - 1),
2421
+ "limit": this.limit,
2422
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2423
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
2424
+ "viewFlag": this.galleryForm.value.viewFlag,
2425
+ "viewRedo": this.galleryForm.value.viewRedo,//[true, false]
2426
+ "questions": this.selectedSection,
2427
+ "filter": this.galleryForm.value.filter,
2428
+ "approveFilter": this.approveFilter,
2429
+ }
2430
+ this.traxService.viewChecklists(this.viewChecklistsoptions)?.pipe(takeUntil(this.destroy$))?.subscribe({
2431
+ next: (res: any) => {
2432
+ if (res && res.code === 200) {
2433
+ this.approvalstatus()
2434
+ this.viewChecklistsData = res.data;
2435
+ if (this.showsingle) {
2436
+ let loopingData = this.galleryForm.value.filtertype === 'Clusters' ? this.selectedStores : this.selectedUsers
2437
+ this.viewChecklistsData.checklistAnswers.map((details: any) => {
2438
+ if (loopingData.filter((ele: any) => ele.userEmail === details.storeProfile?.userEmail).length > 0) {
2439
+ details.questionAnswer[0].questions[0].checked = true
2440
+ }
2441
+ })
2442
+ }
2443
+ this.totalCount = this.viewChecklistsData.total_count
2444
+ this.viewloading = false;
2445
+ this.viewnoData = false
2446
+ } else {
2447
+ this.viewChecklistsData = []
2448
+ this.viewloading = false;
2449
+ this.viewnoData = true
2450
+
2451
+ }
2452
+ }
2453
+ })
2454
+ }
2455
+
2456
+
2457
+ taskCreate() { }
2458
+
2459
+ showsidenav: boolean = true;
2460
+ sidenav() {
2461
+ this.showsidenav = !this.showsidenav;
2462
+ }
2463
+
2464
+ onPageChange(page: number) {
2465
+ this.currentPage = page;
2466
+ }
2467
+
2468
+
2469
+ checkAIchecklist() {
2470
+ if (this.combinedChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2471
+ return false;
2472
+ }
2473
+ return true;
2474
+ }
2475
+
2476
+ onPageChangeview(pageOffset: number) {
2477
+ this.offset = pageOffset;
2478
+ if (this.galleryForm.value.sourceCheckList_id === 'storeopenandclose') {
2479
+ this.storeOpencloseview()
2480
+ } if (this.boximageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2481
+ this.queuealertview()
2482
+ } else if (this.imageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2483
+ this.select = this.galleryForm.value.sourceCheckList_id;
2484
+ this.getmobileUsageDataview()
2485
+ } else if (this.videoChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2486
+ this.select = this.galleryForm.value.sourceCheckList_id;
2487
+ this.getcustomerunattendedview()
2488
+ } else {
2489
+ if (this.galleryForm.value.type === 'checklist') {
2490
+ this.viewChecklists('', '');
2491
+ } else {
2492
+ this.viewTaskList("all", "all")
2493
+ }
2494
+ }
2495
+ window.scrollTo({ top: 30, behavior: 'smooth' });
2496
+
2497
+ }
2498
+
2499
+
2500
+ onPageSizeChange(pageSize: number) {
2501
+ this.limit = pageSize;
2502
+ this.offset = 1;
2503
+ if (this.galleryForm.value.sourceCheckList_id === 'storeopenandclose') {
2504
+ this.storeOpencloseview()
2505
+ } else if (this.boximageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2506
+ this.queuealertview()
2507
+ } else if (this.imageChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2508
+ this.getmobileUsageDataview()
2509
+ } else if (this.videoChecklist.includes(this.galleryForm.value.sourceCheckList_id)) {
2510
+ this.customerunattendedlist(false)
2511
+ } else {
2512
+ if (this.galleryForm.value.type === 'checklist') {
2513
+ this.viewChecklists('', '');
2514
+ } else {
2515
+ this.viewTaskList("all", "all")
2516
+ }
2517
+ }
2518
+
2519
+
2520
+ }
2521
+
2522
+ @HostListener('document:click', ['$event'])
2523
+ onClick(event: MouseEvent): void {
2524
+ this.exportShow = false;
2525
+ }
2526
+ exportShow = false;
2527
+ exportLabel: string = 'Export';
2528
+ exportDet(event: Event): void {
2529
+ event.stopPropagation();
2530
+ this.exportShow = !this.exportShow;
2531
+ }
2532
+ questionscount(data: any) {
2533
+ let count = 0
2534
+ data.forEach((element: any) => {
2535
+ count = count + element.questions.length
2536
+
2537
+ });
2538
+ return count;
2539
+ }
2540
+ setExportAsPPT(type: any, fileType: any): void {
2541
+ this.exportLabel = type; // Update the label text
2542
+ this.exportShow = false; // Close the export menu after selection
2543
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2544
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2545
+
2546
+ if (fileType === 'ppt') {
2547
+ let start = dayjs(this.galleryForm.value.fromDate);
2548
+ let end = dayjs(this.galleryForm.value.toDate);
2549
+ const difference = end.diff(start, 'days');
2550
+
2551
+ if (difference === 2 && this.questionscount(this.selectedSection) > 1) {
2552
+ this.toastService.getErrorToast(`Please select maximum of 1 question only`)
2553
+ return
2554
+ }
2555
+ if (difference === 1 && this.questionscount(this.selectedSection) > 3) {
2556
+ this.toastService.getErrorToast(`Please select maximum of 3 question only`)
2557
+ return
2558
+ }
2559
+ if (difference === 0 && this.questionscount(this.selectedSection) > 3) {
2560
+ this.toastService.getErrorToast(`Please select maximum of 3 question only`)
2561
+ return
2562
+ }
2563
+ this.exportLabel = 'Export'
2564
+ }
2565
+
2566
+ let payload = {
2567
+ "downloadInsertFrom": "gallery",
2568
+ "fromDate": this.galleryForm.value.fromDate,
2569
+ "toDate": this.galleryForm.value.toDate,
2570
+ "checkListType": this.select,
2571
+ "checklistId": [],
2572
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
2573
+ "checklistName": this.galleryForm.value.checklistName,
2574
+ "answerType": this.galleryForm.value.answerType,
2575
+ "fileType": fileType,
2576
+ "storeIds": stores,
2577
+ "userEmailList": users,
2578
+ "clientId": this.headerFilters.client,
2579
+ "questions": this.selectedSection,
2580
+ "previewType": this.previewType,
2581
+ "viewFlag": this.galleryForm.value.viewFlag,
2582
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2583
+ "insertType": this.galleryForm.value.type == 'aiChecklist' ? 'checklist' : this.galleryForm.value.type,
2584
+ "filter": this.galleryForm.value.filter,
2585
+ "approveFilter": this.approveFilter,
2586
+ "filtertype": this.galleryForm.value.filtertype,
2587
+ "aiFilter": this.category || '',
2588
+ }
2589
+ let clientinfo = JSON.parse(localStorage.getItem("client-details") || "")
2590
+ let userinfo = JSON.parse(localStorage.getItem("user-info") || "")
2591
+ if (this.select === 'custom' || this.select === 'task') {
2592
+ if ((clientinfo?.traxDateRange === 7 || userinfo?.traxDateRange === 7) && type === 'Export as CSV' || type === 'Export as PPT' || type === 'Export as ZIP') {
2593
+ const modalRef = this.modalService.open(ExportGalleryComponent, {
2594
+ centered: true,
2595
+ size: "lg",
2596
+ scrollable: true,
2597
+ backdrop: 'static',
2598
+ windowClass: "custom-height-modal" // <-- Add a custom class here
2599
+ });
2600
+ modalRef.componentInstance.type = type;
2601
+ modalRef.componentInstance.payload = payload;
2602
+
2603
+ modalRef.result.then((result) => {
2604
+ if (result) {
2605
+ if (result === "success") {
2606
+ this.toastService.getSuccessToast(`<div><span class="me-8" >Downloading your reports</span><a href="notifications/alerts?tab=download" style="color:#99c3ff; text-decoration:underline; cursor:pointer" >View</a></div>`)
2607
+ } else if (result === "error") {
2608
+ this.toastService.getErrorToast(`Something went wrong !`)
2609
+ }
2610
+ this.exportLabel = 'Export'
2611
+ }
2612
+ })
2613
+ } else {
2614
+ this.traxService.reportTableExport(payload)?.pipe(takeUntil(this.destroy$))?.subscribe({
2615
+ next: (res: any) => {
2616
+ if (res && res.code === 200) {
2617
+ this.toastService.getSuccessToast(`<div><span class="me-8" >Downloading your reports</span><a href="notifications/alerts?tab=download" style="color:#99c3ff; text-decoration:underline; cursor:pointer" >View</a></div>`)
2618
+ } else {
2619
+ this.toastService.getErrorToast(`Something went wrong !`)
2620
+ }
2621
+ this.exportLabel = 'Export'
2622
+ }
2623
+ })
2624
+ }
2625
+ } else if (
2626
+ [
2627
+ 'scrum',
2628
+ 'cleaning',
2629
+ 'storeopenandclose',
2630
+ 'inventorycount',
2631
+ 'carsattended',
2632
+ 'numberplateinfo',
2633
+ 'vehicle_check_in',
2634
+ 'outsidebusinesshoursqueuetracking',
2635
+ 'halfshutter',
2636
+ 'tvcompliance',
2637
+ 'cameratampering',
2638
+ 'staffgrouping',
2639
+ 'employeeCount',
2640
+ 'queuealert',
2641
+ 'uniformdetection',
2642
+ 'mobileusagedetection',
2643
+ 'storehygienemonitoring',
2644
+ 'boxalert'
2645
+ ].includes(this.select)) {
2646
+
2647
+ if (this.select != 'storeopenandclose') {
2648
+ this.previewType = 'video'
2649
+ }
2650
+
2651
+ this.traxService.aichecklistExport(payload)?.pipe(takeUntil(this.destroy$))?.subscribe({
2652
+ next: (res: any) => {
2653
+ if (res && res.code === 200) {
2654
+ this.toastService.getSuccessToast(`<div><span class="me-8" >Downloading your reports</span><a href="notifications/alerts?tab=download" style="color:#99c3ff; text-decoration:underline; cursor:pointer" >View</a></div>`)
2655
+ } else {
2656
+ this.toastService.getErrorToast(`Something went wrong !`)
2657
+ }
2658
+ this.exportLabel = 'Export'
2659
+ }
2660
+ })
2661
+ }
2662
+ }
2663
+
2664
+ typeChange(event: any) {
2665
+ if(event == 'checklist') {
2666
+ this.showflag = true;
2667
+ }
2668
+ this.removeQueryParams()
2669
+ this.galleryForm.get('type')?.setValue(event)
2670
+ this.galleryForm.get('answerType')?.setValue("all");
2671
+ this.showsingle = false;
2672
+ this.showmulti = true;
2673
+ this.answerFilter = []
2674
+ if (event === 'task') {
2675
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
2676
+ next: (res: any) => {
2677
+ if (res && res.code == 200) {
2678
+ this.storeList = res.data.storesData;
2679
+ this.stores = res.data.storesData
2680
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
2681
+ this.getAllTasks(false)
2682
+
2683
+ }
2684
+ }
2685
+ })
2686
+ } else {
2687
+ this.galleryForm.get('checkListType')?.setValue('custom')
2688
+ this.traxService.getStoreslist({ clientId: this.headerFilters.client, clusters: this.groups, city: [] }).subscribe({
2689
+ next: (res: any) => {
2690
+ if (res && res.code == 200) {
2691
+ this.storeList = res.data.storesData;
2692
+ this.stores = res.data.storesData
2693
+ this.galleryForm.get('storeList')?.setValue(this.storeList)
2694
+ this.getAllCheckLists(true)
2695
+ }
2696
+ }
2697
+ })
2698
+ }
2699
+
2700
+ }
2701
+
2702
+
2703
+ getAllTasks(type: any) {
2704
+ let stores = this.stores?.map((data: any) => data.storeId)
2705
+ const payload = {
2706
+ fromDate: this.galleryForm.get('fromDate')?.value,
2707
+ toDate: this.galleryForm.get('toDate')?.value,
2708
+ storeId: stores,
2709
+ clientId: this.headerFilters?.client,
2710
+ sortColumnName: "checkListName",
2711
+ sortBy: 1
2712
+ }
2713
+ this.traxService.getTaskList(payload).subscribe({
2714
+ next: (res: any) => {
2715
+ if (res && res.code == 200) {
2716
+ this.checklists = res.data.checklistData
2717
+
2718
+ setTimeout(() => {
2719
+ if (this.queryParams.sourceCheckList_id && this.queryParams.checklistType == 'task') {
2720
+ this.galleryForm.get('sourceCheckList_id')?.setValue(this.queryParams.sourceCheckList_id)
2721
+ this.galleryForm.get('type')?.setValue('task')
2722
+ this.galleryForm.get('checkListType')?.setValue(this.queryParams.checklistType)
2723
+ let getchecklist = this.checklists.filter((ele: any) => ele.sourceCheckList_id === this.queryParams.sourceCheckList_id)
2724
+
2725
+ if (getchecklist && getchecklist.length > 0) {
2726
+ this.galleryForm.get('checklistName')?.setValue(getchecklist[0]?.checkListName)
2727
+ this.galleryForm.get('checkListDescription')?.setValue(getchecklist[0]?.checkListDescription)
2728
+ this.checklistName = getchecklist[0]?.checkListName
2729
+ }
2730
+ // this.removeQueryParams()
2731
+ } else {
2732
+ this.galleryForm.get('checklistName')?.setValue(this.checklists[0]?.checkListName)
2733
+ this.galleryForm.get('sourceCheckList_id')?.setValue(this.checklists[0]?.sourceCheckList_id)
2734
+ }
2735
+ if (type) {
2736
+ this.gettaskQA(false);
2737
+ }
2738
+ }, 0)
2739
+ } else {
2740
+ this.checklists = []
2741
+ }
2742
+ }
2743
+ })
2744
+ }
2745
+
2746
+ getTaskQA(type: any) {
2747
+ this.selectedSection = []
2748
+ this.tempselectedSection = []
2749
+
2750
+ this.loading = true;
2751
+ this.noData = false
2752
+ this.viewloading = true;
2753
+ this.viewnoData = false;
2754
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2755
+ let user = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2756
+ let obj = {
2757
+ "fromDate": this.galleryForm.value.fromDate,
2758
+ "toDate": this.galleryForm.value.toDate,
2759
+ "ChecklistType": this.galleryForm.value.type, // ["custom", "AI"]
2760
+ "checklistName": this.galleryForm.value.checklistName,
2761
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2762
+ "storeId": stores,
2763
+ "userEmail": user,
2764
+ "filtertype": this.galleryForm.value.filtertype,
2765
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2766
+ "viewFlag": this.galleryForm.value.viewFlag, //[true, false]
2767
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2768
+ "filter": this.galleryForm.value.filter,
2769
+ "approveFilter": this.approveFilter,
2770
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : ""
2771
+ }
2772
+ this.traxService.getQuestions(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
2773
+ next: (res: any) => {
2774
+ if (res && res.code === 200) {
2775
+ this.checklistData = res?.data.checklistQuestions;
2776
+ this.loading = false;
2777
+ this.noData = false;
2778
+ if (this.galleryForm.value.filtertype === 'Clusters') {
2779
+ this.galleryForm.get('storeList')?.setValue(res?.data?.storesDetails)
2780
+ } else {
2781
+ this.galleryForm.get('userList')?.setValue(res?.data?.storesDetails)
2782
+ }
2783
+ this.viewTaskList("all", "all")
2784
+ } else {
2785
+ this.checklistData = [];
2786
+ this.viewChecklistsData = [];
2787
+ this.loading = false;
2788
+ this.noData = true;
2789
+ this.viewloading = false;
2790
+ this.viewnoData = true;
2791
+
2792
+ }
2793
+ }
2794
+ })
2795
+ }
2796
+ viewTasks(sectionName: any, questionName: any) {
2797
+ // this.selectedSection = []
2798
+ this.selectedExport = false;
2799
+ this.sectionName = sectionName;
2800
+ this.questionName = questionName
2801
+
2802
+ this.limit = 1;
2803
+ this.paginationSizes = [1];
2804
+ if (this.selectedSection.length > 0) {
2805
+ this.limit = 10,
2806
+ this.paginationSizes = [10];
2807
+ }
2808
+ this.viewloading = true;
2809
+ this.viewnoData = false
2810
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2811
+ this.viewChecklistsoptions = {
2812
+ "fromDate": this.galleryForm.value.fromDate,
2813
+ "toDate": this.galleryForm.value.toDate,
2814
+ "ChecklistType": this.galleryForm.value.checkListType, // ["checklist", "task"]
2815
+ "checklistName": this.galleryForm.value.checklistName,
2816
+ "storeId": stores,
2817
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
2818
+ "offset": (this.offset - 1),
2819
+ "limit": this.limit,
2820
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2821
+ "sourceCheckList_id": this.galleryForm.value.sourceCheckList_id,
2822
+ "viewFlag": this.galleryForm.value.viewFlag,
2823
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
2824
+ "questions": this.selectedSection,
2825
+ "filter": this.galleryForm.value.filter,
2826
+ "approveFilter": this.approveFilter,
2827
+ }
2828
+ this.traxService.viewChecklists(this.viewChecklistsoptions)?.pipe(takeUntil(this.destroy$))?.subscribe({
2829
+ next: (res: any) => {
2830
+ if (res && res.code === 200) {
2831
+ this.viewChecklistsData = res.data;
2832
+ if (this.showsingle) {
2833
+ let loopingData = this.galleryForm.value.filtertype === 'Clusters' ? this.selectedStores : this.selectedUsers
2834
+ this.viewChecklistsData.checklistAnswers.map((details: any) => {
2835
+ if (loopingData.filter((ele: any) => ele.userEmail === details.storeProfile?.userEmail).length > 0) {
2836
+ details.questionAnswer[0].questions[0].checked = true
2837
+ }
2838
+ })
2839
+ }
2840
+ this.totalCount = this.viewChecklistsData.total_count
2841
+ this.viewloading = false;
2842
+ this.viewnoData = false
2843
+ } else {
2844
+ this.viewChecklistsData = []
2845
+ this.viewloading = false;
2846
+ this.viewnoData = true
2847
+
2848
+ }
2849
+ }
2850
+ })
2851
+ }
2852
+
2853
+
2854
+ taskredirect(question: any, storeProfile: any, checklistInfo: any) {
2855
+ if (storeProfile?.store_id && storeProfile?.store_id != '') {
2856
+ this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
2857
+ //question.taskDate ? question.taskDate : checklistInfo.date as per gowri told
2858
+ this.router.navigate(['/manage/trax/gallery'],
2859
+ {
2860
+ queryParams: {
2861
+ ChecklistDate: dayjs(checklistInfo.date).format('YYYY-MM-DD'),
2862
+ storeId: storeProfile?.store_id,
2863
+ checklistType: "task",
2864
+ sourceCheckList_id: question.taskId,
2865
+ },
2866
+ relativeTo: this.route,
2867
+ queryParamsHandling: 'merge',
2868
+ }
2869
+ )
2870
+ })
2871
+ } else {
2872
+ this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
2873
+ this.router.navigate(['/manage/trax/gallery'],
2874
+ {
2875
+ queryParams: {
2876
+ ChecklistDate: dayjs(checklistInfo.date).format('YYYY-MM-DD'),
2877
+ userEmail: storeProfile?.userEmail,
2878
+ checklistType: "task",
2879
+ sourceCheckList_id: question.taskId,
2880
+ },
2881
+ relativeTo: this.route,
2882
+ queryParamsHandling: 'merge',
2883
+ }
2884
+ )
2885
+ })
2886
+ }
2887
+ }
2888
+
2889
+
2890
+ ViewInDetails(data: any, checklistInfo: any, storeProfile: any, section: any) {
2891
+ const modalRef = this.modalService.open(TaskLogsComponent, { centered: true, size: 'lg', });
2892
+ modalRef.componentInstance.operationtype = this.galleryForm.value.type;
2893
+ modalRef.componentInstance.sourceCheckList_id = this.galleryForm.value.sourceCheckList_id;
2894
+ modalRef.componentInstance.inputData = data;
2895
+ modalRef.componentInstance.checklistInfo = checklistInfo;
2896
+ modalRef.componentInstance.storeProfile = storeProfile;
2897
+ modalRef.componentInstance.sectionInfo = section;
2898
+
2899
+ }
2900
+
2901
+ addTask(type: any, data: any, checklistInfo: any, storeProfile: any, section: any,divId?:string, userAnswerItem?: any) {
2902
+ this.activeDiv = divId;
2903
+ // if(data.answerType ==="multiplechoicesingle"||data.answerType ==="multiplechoicemultiple"){
2904
+ // data.answers = []
2905
+ // }
2906
+ if(data.multiQuestionReferenceImage && data.multiQuestionReferenceImage.length){
2907
+ data.questionReferenceImage = data.multiQuestionReferenceImage.map((item:any) => item.imageURL);
2908
+ }else{
2909
+ data.questionReferenceImage = [data.questionReferenceImage];
2910
+ }
2911
+
2912
+ const modalRef = this.modalService.open(AddTaskComponent, {
2913
+ backdrop: 'static',
2914
+ centered: true, size: 'lg',
2915
+ });
2916
+ modalRef.componentInstance.type = type;
2917
+ modalRef.componentInstance.operationtype = this.galleryForm.value.type;
2918
+ modalRef.componentInstance.sourceCheckList_id = this.galleryForm.value.sourceCheckList_id;
2919
+ modalRef.componentInstance.inputData = data;
2920
+ modalRef.componentInstance.checklistInfo = checklistInfo;
2921
+ modalRef.componentInstance.storeProfile = storeProfile;
2922
+ modalRef.componentInstance.sectionInfo = section;
2923
+ modalRef.componentInstance.userAnswerItem = userAnswerItem;
2924
+
2925
+
2926
+ data?.answers.forEach((ans: any) => {
2927
+ if(ans?.multiRreferenceImage && ans?.multiRreferenceImage.length){
2928
+ ans.referenceImage = ans.multiQuestionReferenceImage.map((item:any) => item.imageURL);
2929
+ }else{
2930
+ if (ans?.referenceImage && ans?.referenceImage != '' && ans?.referenceImage != null) {
2931
+ ans.referenceImage = [ans?.referenceImage]
2932
+ }
2933
+ }
2934
+ });
2935
+ modalRef.componentInstance.taskDetails = {
2936
+ sections: [
2937
+ {
2938
+ "id": "",
2939
+ "name": "",
2940
+ "questions": [data]
2941
+ }
2942
+ ]
2943
+
2944
+ };
2945
+
2946
+ modalRef.result.then((result) => {
2947
+ this.selectedStores = [];
2948
+ this.selectedUsers = [];
2949
+ if (result == 'submit') {
2950
+ if (this.galleryForm.value.type === 'checklist') {
2951
+ this.getChecklistQA(false);
2952
+ } else {
2953
+ this.getTaskQA(this.galleryForm.value.type)
2954
+ }
2955
+ } else {
2956
+ data.questionReferenceImage = ''
2957
+ }
2958
+ })
2959
+ }
2960
+ checkallapproved() {
2961
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
2962
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
2963
+ let input = {
2964
+ "fromDate": this.galleryForm.value.fromDate,
2965
+ "toDate": this.galleryForm.value.toDate,
2966
+ "storeId": stores,
2967
+ "userEmail": users,
2968
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
2969
+ "ChecklistType": "custom",
2970
+ "type": this.galleryForm.value.type,
2971
+ "filtertype": this.galleryForm.value.filtertype,
2972
+ }
2973
+ if (this.galleryForm.value.type === 'checklist') {
2974
+ this.traxService.Allapprovalstatuschecklist(input).subscribe({
2975
+ next: (res: any) => {
2976
+ if (res && res.code == 200) {
2977
+ this.allapprovalStatus = false
2978
+ } else {
2979
+ this.allapprovalStatus = true
2980
+ }
2981
+
2982
+ this.scrollToActiveDiv();
2983
+ }
2984
+ })
2985
+ } else {
2986
+ this.traxService.Allapprovalstatustask(input).subscribe({
2987
+ next: (res: any) => {
2988
+ if (res && res.code == 200) {
2989
+ this.allapprovalStatus = false
2990
+ } else {
2991
+ this.allapprovalStatus = true
2992
+ }
2993
+ this.scrollToActiveDiv();
2994
+ }
2995
+ })
2996
+ }
2997
+
2998
+
2999
+ }
3000
+ approvalstatus() {
3001
+ this.checkallapproved()
3002
+ let stores = this.galleryForm.value.storeList.map((data: any) => data.storeId)
3003
+ let users = this.galleryForm.value.userList.map((data: any) => data.userEmail)
3004
+ let input = {
3005
+ "fromDate": this.galleryForm.value.fromDate,
3006
+ "toDate": this.galleryForm.value.toDate,
3007
+ "storeId": stores,
3008
+ "userEmail": users,
3009
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
3010
+ "ChecklistType": "custom",
3011
+ "type": this.galleryForm.value.type,
3012
+ "filtertype": this.galleryForm.value.filtertype,
3013
+ }
3014
+ if (this.galleryForm.value.type === 'checklist') {
3015
+ this.traxService.approvalstatuschecklist(input).subscribe({
3016
+ next: (res: any) => {
3017
+ if (res && res.code == 200) {
3018
+ this.approvalStatus = false
3019
+ } else {
3020
+ this.approvalStatus = true
3021
+ }
3022
+ }
3023
+ })
3024
+ } else {
3025
+ this.traxService.approvalstatustask(input).subscribe({
3026
+ next: (res: any) => {
3027
+ if (res && res.code == 200) {
3028
+ this.approvalStatus = false
3029
+ } else {
3030
+ this.approvalStatus = true
3031
+ }
3032
+ }
3033
+ })
3034
+ }
3035
+
3036
+
3037
+ }
3038
+
3039
+ onApproveChecklistClick(): void {
3040
+ this.appoveChecklist();
3041
+ }
3042
+ taskTab(task: any) {
3043
+
3044
+
3045
+ this.galleryForm.get('filter')?.setValue(task.key)
3046
+ this.loading = true;
3047
+ this.noData = false
3048
+ this.viewloading = true;
3049
+ this.viewnoData = false;
3050
+ let obj = {
3051
+ "fromDate": this.galleryForm.value.fromDate,
3052
+ "toDate": this.galleryForm.value.toDate,
3053
+ "ChecklistType": this.galleryForm.value.checkListType, // ["custom", "AI"]
3054
+ "checklistName": this.galleryForm.value.checklistName,
3055
+ "checklistId": this.galleryForm.value.sourceCheckList_id,
3056
+ "storeId": task.stores,
3057
+ "answerType": this.galleryForm.value.answerType, //["descriptive","yes/no","multiplechoicesingle","multiplechoicemultiple","image","video","descriptiveImage","multipleImage"]
3058
+ "viewFlag": this.galleryForm.value.viewFlag, //[true, false]
3059
+ "viewRedo": this.galleryForm.value.viewRedo, //[true, false]
3060
+ "filter": this.galleryForm.value.filter,
3061
+ "approveFilter": this.approveFilter,
3062
+ "filtertype": this.galleryForm.value.filtertype,
3063
+ "questions": this.selectedSection.length > 0 && this.selectedSection[0].questions.length > 0 ? this.selectedSection[0].questions[0] : ""
3064
+ }
3065
+ this.traxService.getchecklist(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
3066
+ next: (res: any) => {
3067
+ if (res && res.code === 200) {
3068
+ // this.checklistData = res?.data.checklistQuestions;
3069
+ this.loading = false;
3070
+ this.noData = false;
3071
+ if (this.galleryForm.value.filtertype === 'Clusters') {
3072
+ this.galleryForm.get('storeList')?.setValue(res?.data?.storesDetails)
3073
+ } else {
3074
+ this.galleryForm.get('userList')?.setValue(res?.data?.storesDetails)
3075
+ }
3076
+ this.viewChecklists("all", "all")
3077
+ } else {
3078
+ this.checklistData = [];
3079
+ this.viewChecklistsData = [];
3080
+ this.loading = false;
3081
+ this.noData = true;
3082
+ this.viewloading = false;
3083
+ this.viewnoData = true;
3084
+
3085
+ }
3086
+ }
3087
+ })
3088
+
3089
+ }
3090
+ categoryChange() {
3091
+ this.customerunattendedlist(false)
3092
+ }
3093
+
3094
+ @ViewChild('zoomPopup') zoomPopup: ElementRef;
3095
+ openModel(data: any) {
3096
+ const modalRef = this.modalService.open(this.zoomPopup, { centered: true, size: 'xl' });
3097
+ this.viewImage = data;
3098
+ }
3099
+ getGridColumns(length: number): string {
3100
+ if (length === 1) return '1fr';
3101
+ if (length === 2 || length === 4 || length === 3) return 'repeat(2, 1fr)';
3102
+ if (length === 5 || length === 6) return 'repeat(3, 1fr)';
3103
+ // if (length === 7 || length === 8) return 'repeat(4, 1fr)';
3104
+ // if (length <= 10) return 'repeat(5, 1fr)';
3105
+ return 'repeat(3, 1fr)';
3106
+ }
3107
+
3108
+ getGridRowHeight(length: number): string {
3109
+ if (length <= 2) return '450px';
3110
+ return '220px';
3111
+ }
3112
+ hasReferenceImages(question: any): boolean {
3113
+ return question?.answers?.some((a: any) => {
3114
+ const ref = a.referenceImage;
3115
+ return (
3116
+ (Array.isArray(ref) && ref.length > 0) ||
3117
+ (typeof ref === 'string' && ref.trim() !== '')
3118
+ );
3119
+ });
3120
+ }
3121
+
3122
+ hasChecklistReferenceImages(question: any): boolean {
3123
+ return question?.answers?.some((a: any) => {
3124
+ const ref = a.referenceImage;
3125
+ return (
3126
+ (Array.isArray(ref) && ref.length > 0) ||
3127
+ (typeof ref === 'string' && ref.trim() !== '')
3128
+ );
3129
+ });
3130
+ }
3131
+
3132
+
3133
+ hasQuestionReferenceImages(question: any): boolean {
3134
+ return question.questionReferenceImage?.length > 0 &&
3135
+ question.questionReferenceImage[0] !== '';
3136
+ }
3137
+
3138
+ isValidImage(item: any): boolean {
3139
+ return item && item !== '' && item !== null;
3140
+ }
3141
+ selectedImageUrl: any = '';
3142
+ selectedImageName: string = '';
3143
+ currentImageIndex: number = 0;
3144
+ imageList: string[] = [];
3145
+ imageNameList: string[] = [];
3146
+ openSnapPopup(item: any, snapType: 'open' | 'close'): void {
3147
+ const dateStr = formatDate(item.dateString, 'dd-MM-yyyy', 'en-US');
3148
+ const url = `${this.environment.TraxOpenclosechecklistCDN}${item.storeId}/${dateStr}/operation_snaps/${snapType}.jpeg`;
3149
+ const modalRef = this.modalService.open(ImagePopupComponent, { centered: true, size: 'xl' });
3150
+ modalRef.componentInstance.imageUrl = url;
3151
+ modalRef.componentInstance.caption = snapType === 'open' ? 'Opening Snap' : 'Closing Snap';
3152
+ }
3153
+ openImagePopup1(images: string[], index: number) {
3154
+ this.imageList = images;
3155
+ this.currentImageIndex = index;
3156
+ this.selectedImageUrl = this.imageList;
3157
+ const modal: any = new (window as any).bootstrap.Modal(
3158
+ document.getElementById('imageModal1')
3159
+ );
3160
+ modal.show();
3161
+ }
3162
+
3163
+ openImagePreview(imageUrl: string, caption: string = '') {
3164
+ const modalRef = this.modalService.open(ImagePopupComponent, { centered: true, size: 'xl' });
3165
+ modalRef.componentInstance.imageUrl = imageUrl;
3166
+ modalRef.componentInstance.caption = caption;
3167
+ }
3168
+ openImagePopup(images: string[], names: string[], index: number): void {
3169
+ this.imageList = images;
3170
+ this.imageNameList = names;
3171
+ this.currentImageIndex = index;
3172
+
3173
+ this.selectedImageUrl = this.imageList[this.currentImageIndex];
3174
+ this.selectedImageName = this.imageNameList[this.currentImageIndex];
3175
+ // console.log("12321313", this.imageList, index)
3176
+ const modal: any = new (window as any).bootstrap.Modal(
3177
+ document.getElementById('imageModal')
3178
+ );
3179
+ modal.show();
3180
+ }
3181
+
3182
+ navigateImage(direction: 'prev' | 'next'): void {
3183
+ if (direction === 'prev' && this.currentImageIndex > 0) {
3184
+ this.currentImageIndex--;
3185
+ } else if (direction === 'next' && this.currentImageIndex < this.imageList.length - 1) {
3186
+ this.currentImageIndex++;
3187
+ }
3188
+
3189
+ this.selectedImageUrl = this.imageList[this.currentImageIndex];
3190
+ this.selectedImageName = this.imageNameList[this.currentImageIndex];
3191
+
3192
+ }
3193
+
3194
+ getImageUrls(userAnswers: any[]): string[] {
3195
+ // return userAnswers.map(a => this.environment.TraxAnswerCDN + a.answer);
3196
+ // ? this.sanitizeUrl(this.environment.traxRunAiCDN + a.runAIAnswer)
3197
+ return userAnswers.map(a => a.runAIAnswer
3198
+ ? this.environment.traxRunAiCDN + a.runAIAnswer
3199
+ : this.environment.TraxAnswerCDN + a.answer
3200
+ ).filter(url => url);
3201
+ }
3202
+
3203
+ getImageNames(userAnswers: any[]): string[] {
3204
+ return userAnswers.map(a => a.answer);
3205
+ }
3206
+
3207
+ getRefchecklistImageUrls(userAnswers: any[]): string[] {
3208
+ return userAnswers.map(a => this.environment.TraxAnswerCDN + a.referenceImage);
3209
+ }
3210
+
3211
+ getRefchecklistImageNames(userAnswers: any[]): string[] {
3212
+ return userAnswers.map(a => a.referenceImage);
3213
+ }
3214
+
3215
+ getQustRefchecklistImageUrls(userAnswers: any[]): string[] {
3216
+ return userAnswers.map(a => this.environment.TraxAnswerCDN + a.questionReferenceImage);
3217
+ }
3218
+
3219
+ getQustRefchecklistImageNames(userAnswers: any[]): string[] {
3220
+ return userAnswers.map(a => a.questionReferenceImage);
3221
+ }
3222
+ getRefImageUrls(userAnswers: any[]): string[] {
3223
+ return userAnswers.map(a => this.environment.TraxAnswerCDN + a);
3224
+ }
3225
+
3226
+ getRefImageNames(userAnswers: any[]): string[] {
3227
+ return userAnswers.map(a => a);
3228
+ }
3229
+
3230
+ downloadVideo(fileName: string) {
3231
+ const url = this.environment.TraxAnswerCDN + fileName;
3232
+ const a = document.createElement('a');
3233
+ a.href = url;
3234
+ a.download = fileName.split('/').pop() || 'video.mp4'; // extract file name
3235
+ document.body.appendChild(a);
3236
+ a.click();
3237
+ document.body.removeChild(a);
3238
+ }
3239
+
3240
+ hasMultiQuestionReferenceImages(question: any): boolean {
3241
+ return question.multiQuestionReferenceImage?.length > 0;
3242
+ }
3243
+
3244
+ getMultiRefImageUrls(userAnswers: any[]): string[] {
3245
+ return userAnswers.map(a => this.environment.TraxAnswerCDN + a.imageURL);
3246
+ }
3247
+
3248
+ getValidationImageUrls(item: any): string[] {
3249
+ if (!Array.isArray(item?.validationImage)) return [];
3250
+ return item.validationImage.map((img: string, i: number) => {
3251
+ const aiImage = item?.runAIData?.[i]?.answerImage;
3252
+ return aiImage
3253
+ ? this.environment.traxRunAiCDN + aiImage
3254
+ : this.environment.TraxAnswerCDN + img;
3255
+ });
3256
+ }
3257
+
3258
+ getValidationImageNames(item: any): string[] {
3259
+ return Array.isArray(item?.validationImage) ? item.validationImage.slice() : [];
3260
+ }
3261
+
3262
+ openMultiImagePopup(images: string[], names: string[], index: number): void {
3263
+ this.imageList = images;
3264
+ this.imageNameList = names;
3265
+ this.currentImageIndex = index;
3266
+
3267
+ this.selectedImageUrl = this.imageList[this.currentImageIndex];
3268
+ this.selectedImageName = this.imageNameList[this.currentImageIndex];
3269
+ // console.log("12321313", this.imageList, index)
3270
+ const modal: any = new (window as any).bootstrap.Modal(
3271
+ document.getElementById('imageModal')
3272
+ );
3273
+ modal.show();
3274
+ }
3275
+
3276
+ hasMultiReferenceImages(question: any): boolean {
3277
+ return question.multiReferenceImage?.length > 0;
3278
+ }
3279
+
3280
+ hasImageMultiReferenceImages(question: any): boolean {
3281
+ return question?.answers?.some((a: any) => {
3282
+ const ref = a.multiReferenceImage;
3283
+ return (
3284
+ (Array.isArray(ref) && ref.length > 0) ||
3285
+ (typeof ref === 'string' && ref.trim() !== '')
3286
+ );
3287
+ });
3288
+ }
3289
+
3290
+ hasImageAnswer(question: any): boolean {
3291
+ return question?.userAnswer?.some((a: any) => {
3292
+ const ref = a.answer;
3293
+ return (
3294
+ (Array.isArray(ref) && ref.length > 0) ||
3295
+ (typeof ref === 'string' && ref.trim() !== '')
3296
+ );
3297
+ });
3298
+ }
3299
+
3300
+ isVideoAnswer(url: string, item?: any): boolean {
3301
+ if (!url || typeof url !== 'string') return false;
3302
+ if (item?.mediaType === 'video' || item?.type === 'video') return true;
3303
+ const videoExtensions = ['.mp4', '.webm', '.mov', '.ogg', '.m4v', '.avi', '.wmv'];
3304
+ const urlPath = url.split('?')[0].toLowerCase();
3305
+ return videoExtensions.some(ext => urlPath.endsWith(ext));
3306
+ }
3307
+
3308
+ getImageAnswers(question: any): any[] {
3309
+ return (question?.userAnswer || []).filter((item: any) =>
3310
+ item?.answer && !this.isVideoAnswer(item.answer || item.runAIAnswer, item)
3311
+ );
3312
+ }
3313
+
3314
+ getVideoAnswers(question: any): any[] {
3315
+ return (question?.userAnswer || []).filter((item: any) =>
3316
+ item?.answer && this.isVideoAnswer(item.answer || item.runAIAnswer, item)
3317
+ );
3318
+ }
3319
+
3320
+ checkDetectionStatus(runAIData?: any[]): { keyPresent: boolean; keyValue: boolean } {
3321
+ let keyPresent = false;
3322
+ let keyValue = false;
3323
+
3324
+ if (!Array.isArray(runAIData)) {
3325
+ return { keyPresent, keyValue };
3326
+ }
3327
+
3328
+ for (let i = 0; i < runAIData.length; i++) {
3329
+ if (runAIData[i]?.lableName === 'detectionStatus') {
3330
+ keyPresent = true;
3331
+ keyValue = runAIData[i]?.value?.toString().toLowerCase() === 'true';
3332
+ return { keyPresent, keyValue };
3333
+ }
3334
+
3335
+ if(runAIData[i]?.results?.length) {
3336
+ runAIData[i]?.results.forEach((data:any,i:number) => {
3337
+ if(data?.lableName === 'detectionStatus') {
3338
+ keyPresent = true;
3339
+ keyValue = data?.value?.toString().toLowerCase() === 'true';
3340
+ return { keyPresent, keyValue };
3341
+ }
3342
+ })
3343
+ }
3344
+ }
3345
+ return { keyPresent, keyValue }; // No detectionStatus found
3346
+ }
3347
+
3348
+ isAnswerRedoDone(question: any, item: any): boolean {
3349
+ if (!question?.answers?.length || !item) {
3350
+ return false;
3351
+ }
3352
+ const matched = question.answers.find(
3353
+ (ans: any) => ans?.answer === item?.answer,
3354
+ );
3355
+ return !!matched?.redo;
3356
+ }
3357
+
3358
+ sanitizeUrl(url: string): SafeUrl {
3359
+ // Encode special characters in the URL
3360
+ // const encodedUrl = encodeURI(url);
3361
+
3362
+ // const encodedUrl = encodeURI(url).replace(/\?/g, '%3F');
3363
+ // return this.sanitizer.bypassSecurityTrustUrl(encodedUrl);
3364
+
3365
+ try {
3366
+ const parts = url.split('/');
3367
+ const domain = parts.slice(0, 3).join('/');
3368
+ const path = parts.slice(3).map(p => encodeURIComponent(p)).join('/');
3369
+ const encodedUrl = `${domain}/${path}`;
3370
+
3371
+ return this.sanitizer.bypassSecurityTrustUrl(encodedUrl);
3372
+ } catch (e) {
3373
+ return this.sanitizer.bypassSecurityTrustUrl(url);
3374
+ }
3375
+ }
3376
+
3377
+ multiImageCheckDetectionStatus(userAnswers?: any[]): { keyPresent: boolean; keyValue: boolean } {
3378
+ let keyPresent = false;
3379
+ let keyValue = false;
3380
+
3381
+ if (!Array.isArray(userAnswers)) {
3382
+ return { keyPresent, keyValue };
3383
+ }
3384
+
3385
+ for (const item of userAnswers) {
3386
+ if (item.runAIData && Array.isArray(item.runAIData)) {
3387
+ for (const entry of item.runAIData) {
3388
+ if (entry.lableName === 'detectionStatus') {
3389
+ keyPresent = true;
3390
+ if (entry.value === 'False') {
3391
+ keyValue = false;
3392
+ return { keyPresent, keyValue };
3393
+ } else if (entry.value === 'True') {
3394
+ keyValue = true;
3395
+ }
3396
+ }
3397
+ if(entry?.results?.length) {
3398
+ entry?.results.forEach((runAI:any) => {
3399
+ if(runAI.lableName === 'detectionStatus') {
3400
+ keyPresent = true;
3401
+ if (entry.value === 'False') {
3402
+ keyValue = false;
3403
+ return { keyPresent, keyValue };
3404
+ } else if (entry.value === 'True') {
3405
+ keyValue = true;
3406
+ }
3407
+ }
3408
+ })
3409
+ }
3410
+ }
3411
+ }
3412
+ }
3413
+
3414
+ // for (let i = 0; i < userAnswers.length; i++) {
3415
+ // if(Array.isArray(userAnswers[i].runAIData)){
3416
+ // let runAIDatas = userAnswers[i].runAIData;
3417
+ // for (let j = 0; j < runAIDatas.length; j++) {
3418
+ // if (runAIDatas[j]?.lableName === 'detectionStatus') {
3419
+ // keyPresent = true;
3420
+ // keyValue = runAIDatas[j]?.value?.toString().toLowerCase() === 'false';
3421
+ // return { keyPresent, keyValue };
3422
+ // }
3423
+ // }
3424
+ // }
3425
+ // }
3426
+ return { keyPresent, keyValue }; // No detectionStatus found
3427
+ }
3428
+
3429
+ getchecklistDetails() {
3430
+ let obj = {
3431
+ "clientId": this.headerFilters.client,
3432
+ "checklistType": this.galleryForm.value.sourceCheckList_id,
3433
+ }
3434
+ this.traxService.getChecklistDetailsV1(obj)?.pipe(takeUntil(this.destroy$))?.subscribe({
3435
+ next: (res: any) => {
3436
+ if (res && res.code === 200) {
3437
+ this.exportConfig = res.data[0].aiConfig.exportConfig;
3438
+ } else { }
3439
+ }
3440
+ })
3441
+ }
3442
+ // Fullscreen video orientation issue fix
3443
+ @HostListener('document:fullscreenchange')
3444
+ onFullscreenChange() {
3445
+ const fsElement = document.fullscreenElement;
3446
+ if (fsElement && fsElement?.tagName === 'VIDEO') {
3447
+ this.isFullscreen = true;
3448
+ this.fullscreenVideoElement = fsElement as HTMLVideoElement;
3449
+ } else {
3450
+ this.isFullscreen = false;
3451
+ this.fullscreenVideoElement = null;
3452
+ }
3453
+ }
3454
+
3455
+ isVideoFullscreen(videoElement: HTMLVideoElement | null | undefined): boolean {
3456
+ if (!videoElement || !this.isFullscreen || !this.fullscreenVideoElement) {
3457
+ return false;
3458
+ }
3459
+ return this.fullscreenVideoElement === videoElement;
3460
+ }
3461
+ cameraView(storeId:any){
3462
+
3463
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
3464
+ data.store = storeId;
3465
+ localStorage.setItem("header-filters", JSON.stringify(data));
3466
+ this.gs.dataRangeValue.next(data);
3467
+ this.router.navigate(["/manage/stores/cameras"], {
3468
+ queryParams: { storeId: storeId},
3469
+ });
3470
+ }
3471
+
3472
+ scrollToActiveDiv(){
3473
+ if(this.activeDiv){
3474
+ const el = document.getElementById(this.activeDiv);
3475
+ el?.scrollIntoView({ behavior: 'instant', block: 'center' });
3476
+ }
3477
+ }
3478
+
3479
+ compliance(question:any) {
3480
+ let data:any = JSON.parse(JSON.stringify(question));
3481
+ if(['image'].includes(data.answerType) && data.userAnswer.length) {
3482
+ let compliance = 0;
3483
+ if(data.userAnswer?.[0]?.runAIData) {
3484
+ const { keyPresent, keyValue } = this.checkDetectionStatus(data.userAnswer[0].runAIData);
3485
+ if (keyPresent) {
3486
+ compliance = keyValue
3487
+ ? data.answers?.[0]?.matchedCount
3488
+ : data.answers?.[0]?.notMatchedCount;
3489
+ }
3490
+ }
3491
+ data.userAnswer.forEach((ele:any) => {
3492
+ ele.complianceScore = compliance;
3493
+ });
3494
+ }
3495
+ if(['image/video'].includes(data.answerType) && data.userAnswer.length) {
3496
+ let compliance = 0;
3497
+ data.userAnswer = data.userAnswer.filter((ele:any) => ele.answerType == 'image')
3498
+ const allHaveRunAI = data.userAnswer.every((ele:any) => ele?.runAIData);
3499
+ if (allHaveRunAI && data.answers?.[0]?.runAI && data.answers?.[0]?.runAIFeatures?.length) {
3500
+ const { keyPresent, keyValue } = this.multiImageCheckDetectionStatus(data.userAnswer);
3501
+ if (keyPresent) {
3502
+ compliance = keyValue
3503
+ ? data.answers?.[0]?.matchedCount
3504
+ : data.answers?.[0]?.notMatchedCount;
3505
+ }
3506
+ }
3507
+ data.userAnswer.forEach((ele:any) => {
3508
+ ele.complianceScore = compliance;
3509
+ });
3510
+ }
3511
+ const scores = data?.userAnswer?.map((ele: any) => ele?.complianceScore ?? 0) ?? [];
3512
+ return scores.length ? Math.max(...scores) : 0;
3513
+ }
3514
+
3515
+ getSectionCompliance(sectionName:any) {
3516
+ let findSection:any;
3517
+ this.viewChecklistsData?.checklistAnswers?.forEach((ele: any) => {
3518
+ findSection = ele?.questionAnswer?.find(
3519
+ (section: any) => section.sectionName === sectionName,
3520
+ );
3521
+ });
3522
+ if (findSection && findSection?.answers_complianceScore) {
3523
+ return `(${findSection.userAnswer_complianceScore}/${findSection.answers_complianceScore})`;
3524
+ }
3525
+
3526
+ }
3527
+ }