tango-app-ui-manage-tickets 3.7.0-beta.7 → 3.7.0-beta.70

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 (147) 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/add-csm-modal/add-csm-modal.component.html +32 -0
  5. package/src/lib/components/add-csm-modal/add-csm-modal.component.scss +14 -0
  6. package/src/lib/components/add-csm-modal/add-csm-modal.component.spec.ts +23 -0
  7. package/src/lib/components/add-csm-modal/add-csm-modal.component.ts +94 -0
  8. package/src/lib/components/audit-log/audit-log.component.html +1 -0
  9. package/src/lib/components/audit-log/audit-log.component.scss +0 -0
  10. package/src/lib/components/audit-log/audit-log.component.spec.ts +23 -0
  11. package/src/lib/components/audit-log/audit-log.component.ts +10 -0
  12. package/src/lib/components/audit-mapping-list/audit-mapping-list.component.html +234 -0
  13. package/src/lib/components/audit-mapping-list/audit-mapping-list.component.scss +186 -0
  14. package/src/lib/components/audit-mapping-list/audit-mapping-list.component.spec.ts +23 -0
  15. package/src/lib/components/audit-mapping-list/audit-mapping-list.component.ts +536 -0
  16. package/src/lib/components/audit-metrics/audit-metrics.component.html +345 -0
  17. package/src/lib/components/audit-metrics/audit-metrics.component.scss +34 -0
  18. package/src/lib/components/audit-metrics/audit-metrics.component.spec.ts +23 -0
  19. package/src/lib/components/audit-metrics/audit-metrics.component.ts +292 -0
  20. package/src/lib/components/audit-report-popup/audit-report-popup.component.html +111 -0
  21. package/src/lib/components/audit-report-popup/audit-report-popup.component.scss +101 -0
  22. package/src/lib/components/audit-report-popup/audit-report-popup.component.spec.ts +23 -0
  23. package/src/lib/components/audit-report-popup/audit-report-popup.component.ts +397 -0
  24. package/src/lib/components/audit-retag/audit-retag.component.html +129 -0
  25. package/src/lib/components/audit-retag/audit-retag.component.scss +146 -0
  26. package/src/lib/components/audit-retag/audit-retag.component.spec.ts +23 -0
  27. package/src/lib/components/audit-retag/audit-retag.component.ts +497 -0
  28. package/src/lib/components/comment-model/comment-model.component.html +24 -0
  29. package/src/lib/components/comment-model/comment-model.component.scss +20 -0
  30. package/src/lib/components/comment-model/comment-model.component.spec.ts +23 -0
  31. package/src/lib/components/comment-model/comment-model.component.ts +53 -0
  32. package/src/lib/components/count/count.component.html +54 -0
  33. package/src/lib/components/count/count.component.scss +14 -0
  34. package/src/lib/components/count/count.component.spec.ts +23 -0
  35. package/src/lib/components/count/count.component.ts +82 -0
  36. package/src/lib/components/custom-select/custom-select.component.html +134 -0
  37. package/src/lib/components/custom-select/custom-select.component.scss +204 -0
  38. package/src/lib/components/custom-select/custom-select.component.spec.ts +23 -0
  39. package/src/lib/components/custom-select/custom-select.component.ts +189 -0
  40. package/src/lib/components/filter-options/filter-options.component.html +51 -0
  41. package/src/lib/components/filter-options/filter-options.component.scss +102 -0
  42. package/src/lib/components/filter-options/filter-options.component.spec.ts +23 -0
  43. package/src/lib/components/filter-options/filter-options.component.ts +38 -0
  44. package/src/lib/components/footfall-dic/footfall-dic.component.html +1275 -0
  45. package/src/lib/components/footfall-dic/footfall-dic.component.scss +273 -0
  46. package/src/lib/components/footfall-dic/footfall-dic.component.spec.ts +23 -0
  47. package/src/lib/components/footfall-dic/footfall-dic.component.ts +1206 -0
  48. package/src/lib/components/footfall-dicview/footfall-dicview.component.html +1136 -0
  49. package/src/lib/components/footfall-dicview/footfall-dicview.component.scss +416 -0
  50. package/src/lib/components/footfall-dicview/footfall-dicview.component.spec.ts +23 -0
  51. package/src/lib/components/footfall-dicview/footfall-dicview.component.ts +1168 -0
  52. package/src/lib/components/footfall-popup/footfall-popup.component.html +61 -0
  53. package/src/lib/components/footfall-popup/footfall-popup.component.scss +20 -0
  54. package/src/lib/components/footfall-popup/footfall-popup.component.spec.ts +23 -0
  55. package/src/lib/components/footfall-popup/footfall-popup.component.ts +12 -0
  56. package/src/lib/components/group-select/group-select.component.html +44 -0
  57. package/src/lib/components/group-select/group-select.component.scss +144 -0
  58. package/src/lib/components/group-select/group-select.component.spec.ts +23 -0
  59. package/src/lib/components/group-select/group-select.component.ts +145 -0
  60. package/src/lib/components/re-trigger/re-trigger.component.html +53 -0
  61. package/src/lib/components/re-trigger/re-trigger.component.scss +16 -0
  62. package/src/lib/components/re-trigger/re-trigger.component.spec.ts +23 -0
  63. package/src/lib/components/re-trigger/re-trigger.component.ts +96 -0
  64. package/src/lib/components/reactive-select/reactive-select.component.html +18 -0
  65. package/src/lib/components/reactive-select/reactive-select.component.scss +52 -0
  66. package/src/lib/components/reactive-select/reactive-select.component.spec.ts +23 -0
  67. package/src/lib/components/reactive-select/reactive-select.component.ts +104 -0
  68. package/src/lib/components/remove-audit/remove-audit.component.html +38 -0
  69. package/src/lib/components/remove-audit/remove-audit.component.scss +27 -0
  70. package/src/lib/components/remove-audit/remove-audit.component.spec.ts +23 -0
  71. package/src/lib/components/remove-audit/remove-audit.component.ts +81 -0
  72. package/src/lib/components/start-audit/start-audit.component.html +174 -0
  73. package/src/lib/components/start-audit/start-audit.component.scss +185 -0
  74. package/src/lib/components/start-audit/start-audit.component.spec.ts +23 -0
  75. package/src/lib/components/start-audit/start-audit.component.ts +772 -0
  76. package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.html +43 -0
  77. package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.scss +35 -0
  78. package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.spec.ts +23 -0
  79. package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.ts +118 -0
  80. package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.html +386 -0
  81. package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.scss +87 -0
  82. package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.spec.ts +23 -0
  83. package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.ts +493 -0
  84. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.html +3751 -0
  85. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.scss +1240 -0
  86. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.spec.ts +23 -0
  87. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.ts +2863 -0
  88. package/src/lib/components/ticketclosepopup/ticketclosepopup.component.html +100 -0
  89. package/src/lib/components/ticketclosepopup/ticketclosepopup.component.scss +34 -0
  90. package/src/lib/components/ticketclosepopup/ticketclosepopup.component.spec.ts +23 -0
  91. package/src/lib/components/ticketclosepopup/ticketclosepopup.component.ts +48 -0
  92. package/src/lib/components/tickets/tickets.component.html +451 -0
  93. package/src/lib/components/tickets/tickets.component.scss +131 -0
  94. package/src/lib/components/tickets/tickets.component.spec.ts +23 -0
  95. package/src/lib/components/tickets/tickets.component.ts +809 -0
  96. package/src/lib/components/viewcategory/viewcategory.component.html +38 -0
  97. package/src/lib/components/viewcategory/viewcategory.component.scss +29 -0
  98. package/src/lib/components/viewcategory/viewcategory.component.spec.ts +23 -0
  99. package/src/lib/components/viewcategory/viewcategory.component.ts +79 -0
  100. package/src/lib/services/audit.service.spec.ts +16 -0
  101. package/src/lib/services/audit.service.ts +98 -0
  102. package/src/lib/services/excel.service.ts +48 -0
  103. package/src/lib/services/ticket.service.spec.ts +16 -0
  104. package/src/lib/services/ticket.service.ts +501 -0
  105. package/src/lib/services/timer.service.spec.ts +16 -0
  106. package/src/lib/services/timer.service.ts +92 -0
  107. package/src/lib/tango-manage-tickets-routing.module.ts +37 -0
  108. package/src/lib/tango-manage-tickets.module.ts +68 -0
  109. package/{public-api.d.ts → src/public-api.ts} +8 -2
  110. package/tsconfig.lib.json +14 -0
  111. package/tsconfig.lib.prod.json +10 -0
  112. package/tsconfig.spec.json +14 -0
  113. package/esm2022/lib/components/add-csm-modal/add-csm-modal.component.mjs +0 -98
  114. package/esm2022/lib/components/audit-log/audit-log.component.mjs +0 -11
  115. package/esm2022/lib/components/audit-metrics/audit-metrics.component.mjs +0 -298
  116. package/esm2022/lib/components/comment-model/comment-model.component.mjs +0 -58
  117. package/esm2022/lib/components/count/count.component.mjs +0 -89
  118. package/esm2022/lib/components/footfall-dic/footfall-dic.component.mjs +0 -894
  119. package/esm2022/lib/components/group-select/group-select.component.mjs +0 -155
  120. package/esm2022/lib/components/re-trigger/re-trigger.component.mjs +0 -96
  121. package/esm2022/lib/components/reactive-select/reactive-select.component.mjs +0 -108
  122. package/esm2022/lib/components/tango-manage-tickets/tango-manage-tickets.component.mjs +0 -127
  123. package/esm2022/lib/components/tickets/tickets.component.mjs +0 -793
  124. package/esm2022/lib/services/excel.service.mjs +0 -45
  125. package/esm2022/lib/services/ticket.service.mjs +0 -158
  126. package/esm2022/lib/tango-manage-tickets-routing.module.mjs +0 -24
  127. package/esm2022/lib/tango-manage-tickets.module.mjs +0 -54
  128. package/esm2022/public-api.mjs +0 -6
  129. package/esm2022/tango-app-ui-manage-tickets.mjs +0 -5
  130. package/fesm2022/tango-app-ui-manage-tickets.mjs +0 -2914
  131. package/fesm2022/tango-app-ui-manage-tickets.mjs.map +0 -1
  132. package/index.d.ts +0 -5
  133. package/lib/components/add-csm-modal/add-csm-modal.component.d.ts +0 -30
  134. package/lib/components/audit-log/audit-log.component.d.ts +0 -5
  135. package/lib/components/audit-metrics/audit-metrics.component.d.ts +0 -59
  136. package/lib/components/comment-model/comment-model.component.d.ts +0 -17
  137. package/lib/components/count/count.component.d.ts +0 -23
  138. package/lib/components/footfall-dic/footfall-dic.component.d.ts +0 -130
  139. package/lib/components/group-select/group-select.component.d.ts +0 -33
  140. package/lib/components/re-trigger/re-trigger.component.d.ts +0 -32
  141. package/lib/components/reactive-select/reactive-select.component.d.ts +0 -32
  142. package/lib/components/tango-manage-tickets/tango-manage-tickets.component.d.ts +0 -27
  143. package/lib/components/tickets/tickets.component.d.ts +0 -84
  144. package/lib/services/excel.service.d.ts +0 -10
  145. package/lib/services/ticket.service.d.ts +0 -49
  146. package/lib/tango-manage-tickets-routing.module.d.ts +0 -7
  147. package/lib/tango-manage-tickets.module.d.ts +0 -21
@@ -0,0 +1,1206 @@
1
+ import {
2
+ ChangeDetectorRef,
3
+ Component,
4
+ OnDestroy,
5
+ OnInit,
6
+ ElementRef,
7
+ ViewChild,
8
+ } from "@angular/core";
9
+ import { Subject, takeUntil } from "rxjs";
10
+ import { GlobalStateService } from "tango-app-ui-global";
11
+ import { TicketService } from "../../services/ticket.service";
12
+ import { ToastService } from "tango-app-ui-shared";
13
+ import { ExcelService } from "../../services/excel.service";
14
+ import { FormBuilder, FormControl } from "@angular/forms";
15
+ import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
16
+ import { Router } from "@angular/router";
17
+
18
+ @Component({
19
+ selector: "lib-footfall-dic",
20
+ templateUrl: "./footfall-dic.component.html",
21
+ styleUrl: "./footfall-dic.component.scss",
22
+ })
23
+ export class FootfallDicComponent implements OnInit, OnDestroy {
24
+ searchValue: any;
25
+ loading: boolean = false;
26
+ noData: boolean = false;
27
+ sortedColumn: any = "";
28
+ sortDirection: any = 1;
29
+ sortedColumn1: any = "";
30
+ sortDirection1: any = 1;
31
+ footfallView: boolean = true;
32
+ headerFilters: any;
33
+ footfallList_req: any;
34
+ form: any;
35
+ selectedRevopsType: FormControl;
36
+ revopsTypeArray: any = [
37
+ { value: "", label: "All" },
38
+ { value: "duplicateImages", label: "Duplicates" },
39
+ { value: "employee", label: "Employee/Staff" },
40
+ { value: "houseKeeping", label: "House Keeping" },
41
+ { value: "junk", label: "Junk" },
42
+ ];
43
+ type: any = [
44
+ { value: "open", label: "Open" },
45
+ { value: "closed", label: "Closed" },
46
+ ];
47
+ // selectedStatus: FormControl;
48
+
49
+ pendingArray: any = [
50
+ // { value: "", label: "All" },
51
+ { value: "pending", label: "Pending" },
52
+ { value: "approved", label: "Approved" },
53
+ { value: "rejected", label: "Rejected" },
54
+ ];
55
+ actionStatus: FormControl;
56
+ filterForm: any;
57
+
58
+ ticketData: any = {
59
+ ticketName: "Footfall Directory",
60
+ ticketId: "TE_INF_F5645G4534A24",
61
+ storeName: "LKST98 | RK Salai, Mylapore, Chennai, Tamil Nadu, India",
62
+ status: "Open",
63
+ date: "04 Sep 2023",
64
+ footfall: {
65
+ total: 100,
66
+ duplicates: 10,
67
+ employee: 2,
68
+ houseKeeping: 1,
69
+ junk:1,
70
+ },
71
+ duplicates: [
72
+ { url: "assets/img1.jpg" },
73
+ { url: "assets/img2.jpg" },
74
+ { url: "assets/img3.jpg" },
75
+ ],
76
+ };
77
+ selectedStores: any[] = [];
78
+ allSelected: boolean = false;
79
+ stores: any[] = [];
80
+ private readonly destroy$ = new Subject();
81
+
82
+ constructor(
83
+ private gs: GlobalStateService,
84
+ private ticketService: TicketService,
85
+ private cd: ChangeDetectorRef,
86
+ private router: Router,
87
+ private toast: ToastService,
88
+ private modalService: NgbModal,
89
+ private excelservice: ExcelService,
90
+ private fb: FormBuilder
91
+ ) {}
92
+
93
+ ngOnDestroy(): void {
94
+ this.destroy$.next(true);
95
+ this.destroy$.complete();
96
+ }
97
+ ngOnInit(): void {
98
+ this.footfallView = true;
99
+
100
+ this.selectedRevopsType = new FormControl("");
101
+ this.filterForm = this.fb.group({
102
+ selectedStatus: new FormControl("open"),
103
+ actionStatus: new FormControl("pending"),
104
+ ClusterList: new FormControl([]),
105
+ });
106
+
107
+ this.form = this.fb.group({
108
+ selectedRevopsType: this.selectedRevopsType,
109
+ });
110
+ this.gs.dataRangeValue?.pipe(takeUntil(this.destroy$))?.subscribe({
111
+ next: (data: any) => {
112
+ if (data) {
113
+ this.headerFilters = data;
114
+ this.footfallList_req = {
115
+ client: this.headerFilters.clients.toString(),
116
+ fromDate: this.headerFilters?.date?.startDate,
117
+ toDate: this.headerFilters?.date?.endDate,
118
+ };
119
+ this.getTicketSummary('store');
120
+ this.getTicketList();
121
+ }
122
+ },
123
+ });
124
+ }
125
+ getFootfallSummaryData: any;
126
+ getTicketSummary(type:any) {
127
+ this.ticketService
128
+ .getTicketSummaryApi(
129
+ this.footfallList_req.client,
130
+ this.footfallList_req.fromDate,
131
+ this.footfallList_req.toDate,
132
+ type
133
+ )
134
+ .pipe(takeUntil(this.destroy$))
135
+ .subscribe({
136
+ next: (res: any) => {
137
+ if (res && res?.data && res?.data?.result) {
138
+ this.getFootfallSummaryData = res?.data?.result;
139
+ } else {
140
+ this.getFootfallSummaryData = [];
141
+ }
142
+ },
143
+ error: (err: any) => {
144
+ this.getFootfallSummaryData = [];
145
+ },
146
+ complete: () => {
147
+ this.getFootfallSummaryData.length === 0;
148
+ },
149
+ });
150
+ this.cd.detectChanges();
151
+ }
152
+ offset = 0;
153
+ limit = 10;
154
+ isExport: any = false;
155
+ footfallListData: any;
156
+ totalItems: any;
157
+ paginationSizes = [10, 20, 30];
158
+ getTicketList() {
159
+ this.loading = true;
160
+ this.searchValue = this.searchValue?.trim() || "";
161
+ this.offset = this.offset || 1;
162
+ this.limit = this.limit || 10;
163
+ this.isExport = false;
164
+ this.ticketService
165
+ .getTicketListOldApi(
166
+ this.footfallList_req.client,
167
+ this.footfallList_req.fromDate,
168
+ this.footfallList_req.toDate,
169
+ this.searchValue,
170
+ this.limit,
171
+ this.offset,
172
+ this.isExport,
173
+ this.sortedColumn,
174
+ this.sortDirection
175
+ )
176
+ .pipe(takeUntil(this.destroy$))
177
+ .subscribe({
178
+ next: (res: any) => {
179
+ if (res && res.code === 200) {
180
+ this.noData = false;
181
+ this.loading = false;
182
+ this.footfallListData = res?.data?.result;
183
+
184
+ this.totalItems = res?.data?.count;
185
+ if (this.totalItems < 10) {
186
+ this.paginationSizes = [this.totalItems];
187
+ } else {
188
+ this.paginationSizes = [10, 20, 30];
189
+ }
190
+ } else {
191
+ this.noData = true;
192
+ this.loading = false;
193
+ this.footfallListData = [];
194
+ }
195
+ this.cd.detectChanges();
196
+ },
197
+ error: (err: any) => {
198
+ this.noData = true;
199
+ this.loading = false;
200
+ },
201
+ complete: () => {
202
+ this.loading = false;
203
+ },
204
+ });
205
+ }
206
+
207
+ currentPage: any = 1;
208
+ pageSize: any = 10;
209
+ onPageChange(pageOffset: number) {
210
+ this.currentPage = Number(pageOffset);
211
+ this.offset = Number(pageOffset);
212
+ // this.limit = 10;
213
+ this.getTicketList();
214
+ }
215
+
216
+ onPageSizeChange(pageSize: number) {
217
+ this.pageSize = Number(pageSize);
218
+ this.limit = Number(pageSize);
219
+ this.currentPage = 1;
220
+ this.offset = 1;
221
+ this.getTicketList();
222
+ }
223
+
224
+ setpageSize() {
225
+ if (this.totalItems < 10) {
226
+ return this.totalItems;
227
+ } else {
228
+ return this.pageSize;
229
+ }
230
+ }
231
+ searchData() {
232
+ this.currentPage = 1;
233
+ this.offset = 1;
234
+ this.limit = 10;
235
+ this.getTicketList();
236
+ }
237
+
238
+ exportXLSX() {
239
+ this.searchValue = this.searchValue?.trim() || "";
240
+ this.offset = 1;
241
+ this.limit = 10000;
242
+ this.isExport = true;
243
+ this.ticketService
244
+ .getTicketListExportOldApi(
245
+ this.footfallList_req.client,
246
+ this.footfallList_req.fromDate,
247
+ this.footfallList_req.toDate,
248
+ this.searchValue,
249
+ this.limit,
250
+ this.offset,
251
+ this.isExport,
252
+ this.sortedColumn,
253
+ this.sortDirection
254
+ )
255
+ .pipe(takeUntil(this.destroy$))
256
+ .subscribe({
257
+ next: (res: any) => {
258
+ this.excelservice.saveAsExcelFile(res, "footfall directory ticket ");
259
+ },
260
+ error: (err: any) => {
261
+ this.toast.getErrorToast(
262
+ "Error exporting data:" + err.error ? err.error : err.message
263
+ );
264
+ },
265
+ });
266
+ }
267
+
268
+ onSort(column: string) {
269
+ if (this.sortedColumn === column) {
270
+ this.sortDirection = this.sortDirection === 1 ? -1 : 1;
271
+ } else {
272
+ this.sortedColumn = column;
273
+ this.sortDirection = 1;
274
+ }
275
+ this.getTicketList();
276
+ }
277
+ storeCount: any;
278
+
279
+ searchStoresData() {
280
+ this.getStores();
281
+ }
282
+
283
+ StoresSearchValue: any = "";
284
+ sortOrderStores: any;
285
+
286
+ sortValue(column: string) {
287
+ if (this.sortedColumn1 === column) {
288
+ this.sortedColumn1 = this.sortDirection1 === 1 ? -1 : 1;
289
+ } else {
290
+ this.sortedColumn1 = column;
291
+ this.sortDirection1 = 1;
292
+ }
293
+ this.getStores();
294
+ }
295
+ getStores() {
296
+ this.ticketService
297
+ .getTaggedStoresApi(
298
+ this.footfallList_req.client,
299
+ this.footfallList_req.fromDate,
300
+ this.footfallList_req.toDate,
301
+ this.StoresSearchValue,
302
+ this.groups,
303
+ this.sortDirection1
304
+ )
305
+ .pipe(takeUntil(this.destroy$))
306
+ .subscribe({
307
+ next: (res: any) => {
308
+ if (res && res.code === 200) {
309
+ if (res?.data?.result?.length) {
310
+ this.stores = res?.data?.result;
311
+ this.storeCount = res.data?.count || 0;
312
+ } else {
313
+ this.stores = [];
314
+ this.storeCount = 0;
315
+ }
316
+ } else {
317
+ this.stores = [];
318
+ this.storeCount = 0;
319
+ }
320
+ this.cd.detectChanges();
321
+ },
322
+ error: (err: any) => {
323
+ this.stores = [];
324
+ this.storeCount = 0;
325
+ },
326
+ complete: () => {},
327
+ });
328
+ }
329
+ getTaggedStoresData: any;
330
+
331
+ typeChange(event: any) {
332
+ this.filterForm.get("selectedStatus")?.setValue(event || null);
333
+ }
334
+
335
+ pendingChange(event: any) {
336
+ this.filterForm.get("actionStatus")?.setValue(event || null);
337
+ }
338
+
339
+ RevopsTypeChange(event: any) {
340
+ const selectedType = event ?? "";
341
+ this.footfalloffset = 1;
342
+ if (selectedType === "") {
343
+ this.footfalllimit = 1;
344
+ this.footfallcurrentPage = 1;
345
+ } else {
346
+ this.footfalllimit = 10;
347
+ }
348
+ this.form.get("selectedRevopsType")?.setValue(selectedType);
349
+ this.allSelectValue = false;
350
+ // Clear selected lists
351
+ this.selectedEmployeeImagesList = [];
352
+ this.selectedHousekeepingImagesList = [];
353
+ this.selectedDuplicateImagesList = [];
354
+ this.selectedJunkImagesList
355
+ this.cd.detectChanges();
356
+ // Reset counts
357
+ this.employeeACCount = "";
358
+ this.houseKeepingACCount = "";
359
+ this.junkACCount =""
360
+ this.duplicateACCount = "";
361
+ this.dataStoreView();
362
+ }
363
+
364
+ footfalloffset = 1;
365
+ footfalllimit = 1;
366
+ footfallTicketsData: any = [];
367
+ storeIdValue: any;
368
+
369
+ dataReset() {
370
+ this.selectedStores = [];
371
+ this.allSelected = false;
372
+ this.StoresSearchValue = "";
373
+ this.getStores();
374
+ this.form.get("selectedRevopsType")?.setValue("");
375
+ this.filterForm.get("selectedStatus")?.setValue("open");
376
+ this.filterForm.get("actionStatus")?.setValue("pending");
377
+ this.dataStoreView();
378
+ }
379
+ dataApply() {
380
+ this.footfalloffset = 1;
381
+ if (this.selectedRevopsType.value === "") {
382
+ this.footfallcurrentPage = 1;
383
+ this.footfalllimit = 1;
384
+ } else {
385
+ this.footfalllimit = 10;
386
+ }
387
+ this.allSelectValue = false;
388
+ this.dataStoreView();
389
+ }
390
+ imageUrl: any;
391
+ dataIndexId: any;
392
+ dateString: any;
393
+ footfallNoData = false;
394
+ footfallLoading = true;
395
+ private lastSelectedTicket: any = null;
396
+
397
+ hasInitialStoreSynced = false;
398
+
399
+ addStoreIfNotExists(store: any) {
400
+ if (this.hasInitialStoreSynced) return;
401
+
402
+ const storeId = store?.storeId;
403
+ if (storeId && !this.selectedStores.includes(storeId)) {
404
+ this.selectedStores.push(storeId);
405
+ }
406
+
407
+ this.hasInitialStoreSynced = true;
408
+ this.allSelected = this.selectedStores.length === this.stores.length;
409
+ }
410
+ selecteValues: any;
411
+ selectedStatus: any;
412
+ dataStoreView(data?: any) {
413
+ this.ticketService.setFootfallData(data);
414
+ this.router.navigate(["/manage/tickets/list"], {
415
+ queryParams: {
416
+ type: "footfall",
417
+ client: this.footfallList_req.client,
418
+ },
419
+ });
420
+ return;
421
+ // this.getAllGroups();
422
+ // this.footfallTicketsData = [];
423
+ // this.footfallNoData = false;
424
+ // this.footfallLoading = true;
425
+ // const ticket = data?._source ? data : this.lastSelectedTicket;
426
+
427
+ // if (!ticket || !ticket._source) {
428
+ // this.footfallLoading = false;
429
+ // this.footfallNoData = true;
430
+ // this.toast.getErrorToast("No ticket data available");
431
+ // return;
432
+ // }
433
+
434
+ // this.lastSelectedTicket = ticket;
435
+ // this.addStoreIfNotExists(ticket._source);
436
+ // this.dataIndexId = ticket._id || "";
437
+ // this.dateString = ticket._source.dateString || "";
438
+ // this.imageUrl = this.ticketService?.footfallCDN;
439
+ // this.storeIdValue = this.selectedStores;
440
+ // const revopsType = this.form.get("selectedRevopsType")?.value;
441
+ // const selectedStatus = (this.selectedStatus =
442
+ // this.filterForm.get("selectedStatus")?.value);
443
+ // const actionStatus = (this.selecteValues =
444
+ // this.filterForm.get("actionStatus")?.value);
445
+
446
+ // const storeId = this.storeIdValue;
447
+ // const fromDate = this.footfallList_req.fromDate;
448
+ // const toDate = this.footfallList_req.toDate;
449
+ // const offset = this.footfalloffset;
450
+ // const limit =
451
+ // revopsType === "" ? this.footfalllimit : (this.footfalllimit = 10);
452
+
453
+ // this.ticketService
454
+ // .getTicketsApi(
455
+ // storeId,
456
+ // fromDate,
457
+ // toDate,
458
+ // revopsType,
459
+ // selectedStatus,
460
+ // actionStatus,
461
+ // offset,
462
+ // limit
463
+ // )
464
+ // .pipe(takeUntil(this.destroy$))
465
+ // .subscribe({
466
+ // next: (res: any) => {
467
+ // if (res && res.code === 200) {
468
+ // if (res?.data?.result?.length === 0) {
469
+ // this.footfallTicketsData = [];
470
+ // this.footfallView = true;
471
+ // this.footfallNoData = true;
472
+ // this.footfallLoading = false;
473
+ // this.toast.getErrorToast(
474
+ // "No data found for the selected filters"
475
+ // );
476
+ // } else {
477
+ // this.footfallTicketsData = res?.data?.result ?? [];
478
+ // this.totalItemsFootfall = res?.data?.count;
479
+ // if (this.footfalllimit === 1) {
480
+ // this.paginationSizes = [1];
481
+ // this.pageSizeFootfall = 1;
482
+ // } else {
483
+ // const limit =
484
+ // this.totalItemsFootfall < 10 ? this.totalItemsFootfall : 10;
485
+ // this.paginationSizes = [limit];
486
+ // this.pageSizeFootfall = limit;
487
+ // }
488
+ // this.footfallView = false;
489
+ // this.footfallNoData = false;
490
+ // this.footfallLoading = false;
491
+ // }
492
+ // } else {
493
+ // this.footfallTicketsData = [];
494
+ // this.footfallView = false;
495
+ // this.footfallNoData = true;
496
+ // this.footfallLoading = false;
497
+ // }
498
+ // },
499
+ // error: () => {
500
+ // this.footfallTicketsData = [];
501
+ // this.footfallView = false;
502
+ // this.footfallNoData = true;
503
+ // this.footfallLoading = false;
504
+ // },
505
+ // complete: () => {
506
+ // this.cd.detectChanges();
507
+ // },
508
+ // });
509
+ }
510
+
511
+ isCollapsed = false;
512
+
513
+ toggleSidebar() {
514
+ this.isCollapsed = !this.isCollapsed;
515
+ }
516
+ matchedType: any;
517
+
518
+ matchedArray: any = [{ value: "all", label: "matched: All" }];
519
+ onFilterApply() {
520
+ this.getStores();
521
+ if (this.selectedRevopsType.value === "") this.footfalllimit = 1;
522
+ else this.footfalllimit = 10;
523
+ this.dataStoreView();
524
+ }
525
+ pageSizeFootfall: any = 1;
526
+ footfallcurrentPage: any = 1;
527
+ onFootfallPageChange(pageOffset: number) {
528
+ this.footfallcurrentPage = Number(pageOffset);
529
+ this.footfalloffset = Number(pageOffset);
530
+ this.footfalllimit = 1;
531
+ this.cancel();
532
+ this.dataStoreView();
533
+ }
534
+
535
+ onFootfallPageSizeChange(pageSize: number) {
536
+ this.footfalllimit = Number(pageSize);
537
+ this.pageSizeFootfall = Number(pageSize);
538
+ this.footfallcurrentPage = 1;
539
+ this.footfalloffset = 1;
540
+ this.dataStoreView();
541
+ }
542
+ totalItemsFootfall: any;
543
+ setFootfallpageSize() {
544
+ if (this.footfalllimit === 1) {
545
+ if (this.totalItemsFootfall < 1) {
546
+ return this.totalItemsFootfall;
547
+ } else {
548
+ return this.pageSizeFootfall;
549
+ }
550
+ } else {
551
+ if (this.totalItemsFootfall < 10) {
552
+ return this.totalItemsFootfall;
553
+ } else {
554
+ return this.pageSizeFootfall;
555
+ }
556
+ }
557
+ }
558
+
559
+ footfallMulticurrentPage: any = 1;
560
+ onFootfallMultiPageChange(pageOffset: number) {
561
+ this.footfallMulticurrentPage = Number(pageOffset);
562
+ this.footfalloffset = Number(pageOffset);
563
+ this.footfalllimit = 10;
564
+ this.allSelectValue = false;
565
+ this.cancel();
566
+ this.dataStoreView();
567
+ }
568
+
569
+ onFootfallMultiPageSizeChange(pageSize: number) {
570
+ this.footfalllimit = Number(pageSize);
571
+ this.pageSizeFootfall = Number(pageSize);
572
+ this.footfallMulticurrentPage = 1;
573
+ this.footfalloffset = 1;
574
+
575
+ this.dataStoreView();
576
+ }
577
+ toggleStoreSelection(store: any) {
578
+ const storeId = store?.storeId;
579
+ if (!storeId) return;
580
+
581
+ const index = this.selectedStores.indexOf(storeId);
582
+
583
+ if (index > -1) {
584
+ this.selectedStores.splice(index, 1);
585
+ } else {
586
+ this.selectedStores.push(storeId);
587
+ }
588
+
589
+ this.allSelected = this.selectedStores.length === this.stores.length;
590
+ }
591
+
592
+ toggleSelectAll() {
593
+ const visibleStoreIds = this.filteredStores.map((s) => s.storeId);
594
+
595
+ if (this.allSelected) {
596
+ // Remove only the visible ones
597
+ this.selectedStores = this.selectedStores.filter(
598
+ (id) => !visibleStoreIds.includes(id)
599
+ );
600
+ } else {
601
+ // Add only those that are not already selected
602
+ const newIds = visibleStoreIds.filter(
603
+ (id) => !this.selectedStores.includes(id)
604
+ );
605
+ this.selectedStores = [...this.selectedStores, ...newIds];
606
+ }
607
+
608
+ this.allSelected = this.selectedStores.length === this.stores.length;
609
+ }
610
+
611
+ isSelected(store: any): boolean {
612
+ return this.selectedStores.includes(store.storeId);
613
+ }
614
+
615
+ imgtoggleSelectAll() {
616
+ this.allSelected = !this.allSelected;
617
+ this.ticketData.duplicates.forEach((img: any) => {
618
+ img.selected = this.allSelected;
619
+ });
620
+ }
621
+
622
+ selectedImagesList: any[] = [];
623
+
624
+ selectedDuplicateImagesList: any[] = [];
625
+ selectedHousekeepingImagesList: any[] = [];
626
+ selectedEmployeeImagesList: any[] = [];
627
+ selectedJunkImagesList: any[] = [];
628
+ junkACCount: any;
629
+ houseKeepingACCount: any;
630
+ employeeACCount: any;
631
+ duplicateACCount: any;
632
+
633
+ cloneWithoutSelected(obj: any) {
634
+ const { ...rest } = obj;
635
+ return rest;
636
+ }
637
+
638
+ allSelectValue = false;
639
+
640
+ cloneWithoutSelected1(data: any): any {
641
+ const { __parent, ...rest } = data;
642
+ return { ...rest };
643
+ }
644
+
645
+ onImageCheckboxChange1(data: any, category: string, parentOriginal?: any) {
646
+ let selectedList: any;
647
+
648
+ if (category === "duplicate") {
649
+ parentOriginal = parentOriginal || data.__parent;
650
+
651
+ const existingOriginal = this.selectedDuplicateImagesList.find(
652
+ (item: any) => item.tempId === parentOriginal?.tempId
653
+ );
654
+
655
+ if (data.selected) {
656
+ if (existingOriginal) {
657
+ const alreadyExists = existingOriginal.data?.some(
658
+ (dup: any) => dup.tempId === data.tempId
659
+ );
660
+ if (!alreadyExists) {
661
+ existingOriginal.data.push(this.cloneWithoutSelected1(data));
662
+ }
663
+ } else {
664
+ this.selectedDuplicateImagesList.push({
665
+ tempId: parentOriginal?.tempId,
666
+ filePath: parentOriginal?.filePath,
667
+ entryTime: parentOriginal?.entryTime,
668
+ exitTime: parentOriginal?.exitTime,
669
+ timeRange: parentOriginal?.timeRange,
670
+ data: [this.cloneWithoutSelected1(data)],
671
+ });
672
+ }
673
+ } else {
674
+ if (existingOriginal) {
675
+ existingOriginal.data = existingOriginal.data.filter(
676
+ (d: any) => d.tempId !== data.tempId
677
+ );
678
+
679
+ if (existingOriginal.data.length === 0) {
680
+ this.selectedDuplicateImagesList =
681
+ this.selectedDuplicateImagesList.filter(
682
+ (o: any) => o.tempId !== parentOriginal?.tempId
683
+ );
684
+ }
685
+ }
686
+ }
687
+
688
+ this.duplicateACCount = this.selectedDuplicateImagesList.reduce(
689
+ (sum: number, orig: any) => sum + orig.data.length,
690
+ 0
691
+ );
692
+ }
693
+
694
+ if (category === "employee") {
695
+ selectedList = this.selectedEmployeeImagesList;
696
+ } else if (category === "houseKeeping") {
697
+ selectedList = this.selectedHousekeepingImagesList;
698
+ } else if(category === "junk"){
699
+ selectedList = this.selectedJunkImagesList;
700
+ }
701
+
702
+ if (category !== "duplicate") {
703
+ if (data.selected) {
704
+ const alreadyExists = selectedList.some(
705
+ (item: any) => item.tempId === data.tempId
706
+ );
707
+ if (!alreadyExists) {
708
+ selectedList.push(data);
709
+ }
710
+ } else {
711
+ const index = selectedList.findIndex(
712
+ (item: any) => item.tempId === data.tempId
713
+ );
714
+ if (index !== -1) {
715
+ selectedList.splice(index, 1);
716
+ }
717
+ }
718
+
719
+ this.employeeACCount = this.selectedEmployeeImagesList.length;
720
+ this.houseKeepingACCount = this.selectedHousekeepingImagesList.length;
721
+ this.junkACCount = this.selectedJunkImagesList.length;
722
+ }
723
+
724
+ // 🔒 Disable other checkboxes if one type is selected
725
+ const totalSelected =
726
+ this.duplicateACCount + this.employeeACCount + this.houseKeepingACCount + this.junkACCount;
727
+
728
+ if (totalSelected > 0) {
729
+ this.checkedValue = false;
730
+ } else {
731
+ this.checkedValue = true;
732
+ }
733
+
734
+ this.cd.detectChanges(); // To update the template
735
+ this.allSelectValue = this.areAllCheckboxesSelected();
736
+ }
737
+
738
+ selectAllValue() {
739
+ this.allSelectValue = !this.allSelectValue;
740
+ this.checkedValue = !this.allSelectValue;
741
+
742
+ this.selectedEmployeeImagesList = [];
743
+ this.selectedHousekeepingImagesList = [];
744
+ this.selectedDuplicateImagesList = [];
745
+ this.selectedJunkImagesList =[];
746
+
747
+ for (const ticket of this.footfallTicketsData) {
748
+ const source = ticket._source;
749
+
750
+ // ✅ Employee
751
+ if (Array.isArray(source.employee)) {
752
+ source.employee.forEach((img: any) => {
753
+ img.selected = this.allSelectValue;
754
+ if (
755
+ this.allSelectValue &&
756
+ !this.selectedEmployeeImagesList.some(
757
+ (e) => e.tempId === img.tempId
758
+ )
759
+ ) {
760
+ this.selectedEmployeeImagesList.push(img);
761
+ }
762
+ });
763
+ }
764
+ // ✅ Junk
765
+ if (Array.isArray(source.junk)) {
766
+ source.junk.forEach((img: any) => {
767
+ img.selected = this.allSelectValue;
768
+ if (
769
+ this.allSelectValue &&
770
+ !this.selectedJunkImagesList.some(
771
+ (e) => e.tempId === img.tempId
772
+ )
773
+ ) {
774
+ this.selectedJunkImagesList.push(img);
775
+ }
776
+ });
777
+ }
778
+ // ✅ Housekeeping
779
+ if (Array.isArray(source.houseKeeping)) {
780
+ source.houseKeeping.forEach((emp: any) => {
781
+ emp.selected = this.allSelectValue;
782
+ if (
783
+ this.allSelectValue &&
784
+ !this.selectedHousekeepingImagesList.some(
785
+ (e) => e.tempId === emp.tempId
786
+ )
787
+ ) {
788
+ this.selectedHousekeepingImagesList.push(emp);
789
+ }
790
+ });
791
+ }
792
+
793
+ // ✅ Duplicate
794
+ if (Array.isArray(source.duplicateImages)) {
795
+ source.duplicateImages.forEach((original: any) => {
796
+ if (Array.isArray(original.data)) {
797
+ original.data.forEach((dup: any) => {
798
+ dup.selected = this.allSelectValue;
799
+ dup.__parent = original; // ✅ Needed for uncheck
800
+ });
801
+
802
+ if (this.allSelectValue && original.data.length > 0) {
803
+ const existing = this.selectedDuplicateImagesList.find(
804
+ (o: any) => o.tempId === original.tempId
805
+ );
806
+
807
+ if (!existing) {
808
+ this.selectedDuplicateImagesList.push({
809
+ tempId: original.tempId,
810
+ filePath: original.filePath,
811
+ entryTime: original.entryTime,
812
+ exitTime: original.exitTime,
813
+ timeRange: original.timeRange,
814
+ data: original.data.map((d: any) =>
815
+ this.cloneWithoutSelected1(d)
816
+ ),
817
+ });
818
+ }
819
+ }
820
+ }
821
+ });
822
+ }
823
+ }
824
+ this.houseKeepingACCount = this.selectedHousekeepingImagesList.length;
825
+ this.employeeACCount = this.selectedEmployeeImagesList.length;
826
+ this.junkACCount = this.selectedHousekeepingImagesList.length;
827
+ this.duplicateACCount = this.selectedDuplicateImagesList.reduce(
828
+ (sum: number, orig: any) => sum + orig.data.length,
829
+ 0
830
+ );
831
+ }
832
+
833
+ areAllCheckboxesSelected(): boolean {
834
+ for (const ticket of this.footfallTicketsData) {
835
+ const source = ticket._source;
836
+
837
+ if (source.employee?.some((img: any) => !img.selected)) return false;
838
+ if (source.houseKeeping?.some((img: any) => !img.selected)) return false;
839
+ if(source.junk?.some((img: any) => !img.selected)) return false;
840
+ if (
841
+ source.duplicateImages?.some((original: any) =>
842
+ original.data?.some((dup: any) => !dup.selected)
843
+ )
844
+ )
845
+ return false;
846
+ }
847
+ return true;
848
+ }
849
+ checkedValue = true;
850
+
851
+ onImageCheckboxChange(data: any, category: string, parentOriginal?: any) {
852
+ let selectedList;
853
+
854
+ switch (category) {
855
+ case "duplicate":
856
+ // Ensure selectedDuplicateImagesList is an array of ORIGINALS with selected children
857
+ const existingOriginal = this.selectedDuplicateImagesList.find(
858
+ (item: any) => item.tempId === parentOriginal?.tempId
859
+ );
860
+
861
+ if (data.selected) {
862
+ if (existingOriginal) {
863
+ const alreadyExists = existingOriginal.data?.some(
864
+ (dup: any) => dup.tempId === data.tempId
865
+ );
866
+ if (!alreadyExists) {
867
+ existingOriginal.data.push(this.cloneWithoutSelected(data)); // ✅ no 'selected' key
868
+ }
869
+ } else {
870
+ this.selectedDuplicateImagesList.push({
871
+ tempId: parentOriginal?.tempId,
872
+ filePath: parentOriginal?.filePath,
873
+ entryTime: parentOriginal?.entryTime,
874
+ exitTime: parentOriginal?.exitTime,
875
+ timeRange: parentOriginal?.timeRange,
876
+ data: [this.cloneWithoutSelected(data)], // ✅
877
+ });
878
+ }
879
+ } else {
880
+ // Remove from selected duplicates
881
+ if (existingOriginal) {
882
+ existingOriginal.data = existingOriginal.data.filter(
883
+ (d: any) => d.tempId !== data.tempId
884
+ );
885
+
886
+ // Remove the whole original if no duplicates are left
887
+ if (existingOriginal.data.length === 0) {
888
+ this.selectedDuplicateImagesList =
889
+ this.selectedDuplicateImagesList.filter(
890
+ (o: any) => o.tempId !== parentOriginal?.tempId
891
+ );
892
+ }
893
+ }
894
+ }
895
+
896
+ // Count only from selected duplicates
897
+ this.duplicateACCount = this.selectedDuplicateImagesList.reduce(
898
+ (sum: number, orig: any) => sum + orig.data.length,
899
+ 0
900
+ );
901
+ return;
902
+
903
+ case "houseKeeping":
904
+ selectedList = this.selectedHousekeepingImagesList;
905
+ break;
906
+
907
+ case "employee":
908
+ selectedList = this.selectedEmployeeImagesList;
909
+ break;
910
+ case "junk":
911
+ selectedList = this.selectedJunkImagesList;
912
+ break;
913
+ default:
914
+ return;
915
+
916
+ }
917
+
918
+ // Unchanged logic for employee and housekeeping
919
+ selectedList = selectedList || [];
920
+ if (data.selected) {
921
+ const alreadyExists =
922
+ Array.isArray(selectedList) &&
923
+ selectedList.some((item: any) => item.tempId === data.tempId);
924
+ if (!alreadyExists) {
925
+ selectedList.push(data);
926
+ }
927
+ } else {
928
+ const updated = Array.isArray(selectedList)
929
+ ? selectedList.filter((item: any) => item.tempId !== data.tempId)
930
+ : [];
931
+
932
+ if (category === "houseKeeping") {
933
+ this.selectedHousekeepingImagesList = updated;
934
+ } else if (category === "employee") {
935
+ this.selectedEmployeeImagesList = updated;
936
+ } else if(category === "junk"){
937
+ this.selectedJunkImagesList = updated;
938
+ }
939
+ }
940
+ this.houseKeepingACCount = this.selectedHousekeepingImagesList?.length || 0;
941
+ this.employeeACCount = this.selectedEmployeeImagesList.length || 0;
942
+ this.junkACCount = this.selectedJunkImagesList.length || 0;
943
+ }
944
+
945
+ commentText: any;
946
+ submitValue(status: string = "approved", category: string = "duplicate") {
947
+ // Step 1: Validate based on current category
948
+ let selectedList;
949
+ switch (category) {
950
+ case "duplicate":
951
+ selectedList = this.selectedDuplicateImagesList;
952
+ break;
953
+ case "houseKeeping":
954
+ selectedList = this.selectedHousekeepingImagesList;
955
+ break;
956
+ case "employee":
957
+ selectedList = this.selectedEmployeeImagesList;
958
+ break;
959
+ case "junk":
960
+ selectedList = this.selectedJunkImagesList;
961
+ break;
962
+ default:
963
+ return;
964
+ }
965
+
966
+ if (selectedList.length === 0) {
967
+ this.toast.getErrorToast("Please select at least one image");
968
+ return;
969
+ }
970
+
971
+ // Replace selected → isChecked before sending
972
+ const transformedList = selectedList.map((item) => {
973
+ const { selected, ...rest } = item;
974
+ return { ...rest, isChecked: true };
975
+ });
976
+
977
+ // Step 2: Build full payload
978
+ const payload: any[] = [];
979
+
980
+ for (const ticket of this.footfallTicketsData) {
981
+ const source = ticket._source;
982
+
983
+ const singlePayload: any = {
984
+ _id: ticket._id,
985
+ comments: this.commentText || "",
986
+ dateString: source.dateString || this.dateString,
987
+
988
+ employeeStatus:
989
+ category === "employee" ? status : source.employeeStatus,
990
+ houseKeepingStatus:
991
+ category === "houseKeeping" ? status : source.houseKeepingStatus,
992
+ junkStatus:
993
+ category === "junk" ? status : source.junkStatus,
994
+ duplicateStatus:
995
+ category === "duplicate" ? status : source.duplicateStatus,
996
+ };
997
+
998
+ if (category === "employee") {
999
+ singlePayload.employee = transformedList;
1000
+ singlePayload.employeeACCount = this.employeeACCount
1001
+ ? this.employeeACCount
1002
+ : 0;
1003
+ }
1004
+
1005
+ if (category === "houseKeeping") {
1006
+ singlePayload.houseKeeping = transformedList;
1007
+ singlePayload.houseKeepingACCount = this.houseKeepingACCount
1008
+ ? this.houseKeepingACCount
1009
+ : 0;
1010
+ }
1011
+ if(category === "junk"){
1012
+ singlePayload.junk = transformedList;
1013
+ singlePayload.junkACCount = this.junkACCount
1014
+ ? this.junkACCount
1015
+ : 0;
1016
+
1017
+ }
1018
+ if (category === "duplicate") {
1019
+ singlePayload.duplicateImages = transformedList;
1020
+ singlePayload.duplicateACCount = this.duplicateACCount
1021
+ ? this.duplicateACCount
1022
+ : 0;
1023
+ }
1024
+
1025
+ payload.push(singlePayload);
1026
+ }
1027
+ // Step 3: Set status based on current category
1028
+ switch (category) {
1029
+ case "duplicate":
1030
+ payload.forEach((item) => (item.duplicateStatus = status));
1031
+ break;
1032
+ case "houseKeeping":
1033
+ payload.forEach((item) => (item.houseKeepingStatus = status));
1034
+ break;
1035
+ case "employee":
1036
+ payload.forEach((item) => (item.employeeStatus = status));
1037
+ break;
1038
+ case "junk":
1039
+ payload.forEach((item) => (item.junkStatus = status));
1040
+ break;
1041
+ }
1042
+
1043
+ // Step 4: Submit the payload
1044
+ this.ticketService
1045
+ .getUpdateStatusApi({ data: payload })
1046
+ .pipe(takeUntil(this.destroy$))
1047
+ .subscribe({
1048
+ next: (res: any) => {
1049
+ if (res && res.code === 200) {
1050
+ this.toast.getSuccessToast(
1051
+ res?.message || "Ticket updated successfully"
1052
+ );
1053
+ // this.selectedStores =[];
1054
+ // this.allSelected = false;
1055
+ // this.allSelectValue =false;
1056
+ this.footfalloffset = 1;
1057
+ this.dataStoreView();
1058
+ this.cancel();
1059
+ } else {
1060
+ this.toast.getErrorToast("Failed to update ticket");
1061
+ }
1062
+ },
1063
+ error: (err: any) => {
1064
+ const msg =
1065
+ err.error.error ||
1066
+ err.error ||
1067
+ err?.error?.message ||
1068
+ err.message ||
1069
+ "Unknown error";
1070
+ this.toast.getErrorToast("Error updating ticket: " + msg);
1071
+
1072
+ this.allSelected = false;
1073
+ this.allSelectValue = false;
1074
+ },
1075
+ });
1076
+ }
1077
+ searchTerm: any = "";
1078
+ get filteredStores() {
1079
+ if (!this.searchTerm?.trim()) return this.stores;
1080
+
1081
+ const term = this.searchTerm.toLowerCase();
1082
+ return this.stores.filter((store) =>
1083
+ store?.storeName?.toLowerCase().includes(term)
1084
+ );
1085
+ }
1086
+ onImageError(event: any): void {
1087
+ event.target.src = "assets/images/fallback-image.png"; // or any default image path
1088
+ }
1089
+ backToNavigation() {
1090
+ this.selectedStores = [];
1091
+ this.allSelected = false;
1092
+ this.allSelectValue = false;
1093
+ this.hasInitialStoreSynced = false;
1094
+ this.footfallView = true;
1095
+ this.cancel();
1096
+ this.ClusterList = [];
1097
+ // this.groups =[];
1098
+ // this.filterForm.get('ClusterList')?.setValue('')
1099
+ this.form.get("selectedRevopsType")?.setValue("");
1100
+ this.filterForm.get("selectedStatus")?.setValue("open");
1101
+ this.filterForm.get("actionStatus")?.setValue("pending");
1102
+ this.getTicketSummary('store');
1103
+ this.getTicketList();
1104
+ }
1105
+ @ViewChild("zoomPopup") zoomPopup: ElementRef;
1106
+ popupvalue: any;
1107
+ popupType: any;
1108
+ popupOpen(type: any, value: any) {
1109
+ const modalRef = this.modalService.open(this.zoomPopup, {
1110
+ centered: true,
1111
+ size: "md",
1112
+ backdrop: "static", // Prevent closing on outside click
1113
+ keyboard: false, // Prevent closing on ESC key
1114
+ });
1115
+ this.popupType = type;
1116
+ if (value === "duplicateImages") {
1117
+ this.popupvalue = "duplicate";
1118
+ } else {
1119
+ this.popupvalue = value;
1120
+ }
1121
+ }
1122
+ cancel() {
1123
+ // this.allSelected = false;
1124
+ // this.allSelectValue = false;
1125
+ if (this.selectedRevopsType?.value !== "") this.allSelectValue = false;
1126
+ // Clear all selected flags from the data
1127
+ for (const ticket of this.footfallTicketsData) {
1128
+ const source = ticket._source;
1129
+
1130
+ source.employee?.forEach((img: any) => (img.selected = false));
1131
+ source.houseKeeping?.forEach((img: any) => (img.selected = false));
1132
+ source.junk?.forEach((img: any) => (img.selected = false));
1133
+ source.duplicateImages?.forEach((original: any) => {
1134
+ original.data?.forEach((dup: any) => (dup.selected = false));
1135
+ });
1136
+ }
1137
+ this.clear();
1138
+
1139
+ // this.checkedValue = true;
1140
+ }
1141
+ clear() {
1142
+ this.modalService.dismissAll();
1143
+ this.selectedEmployeeImagesList = [];
1144
+ this.selectedHousekeepingImagesList = [];
1145
+ this.selectedDuplicateImagesList = [];
1146
+ this.selectedJunkImagesList = [];
1147
+ // Reset counts
1148
+ this.employeeACCount = "";
1149
+ this.houseKeepingACCount = "";
1150
+ this.duplicateACCount = "";
1151
+ this.junkACCount =""
1152
+ }
1153
+ ClusterList: any = [];
1154
+ getAllGroups() {
1155
+ this.ClusterList = [];
1156
+ // this.groups =[];
1157
+
1158
+ this.ticketService
1159
+ .getclusters({ clientId: this.headerFilters.client, group: [], city: [] })
1160
+ .subscribe({
1161
+ next: (res: any) => {
1162
+ if (res && res.code == 200) {
1163
+ this.ClusterList = res?.data?.groupData;
1164
+ this.getStores();
1165
+ } else {
1166
+ this.ClusterList = [];
1167
+ }
1168
+ },
1169
+ });
1170
+ }
1171
+ groups: any = [];
1172
+ ongroupSelect(event: any) {
1173
+ this.selectedStores = [];
1174
+ this.allSelected = false;
1175
+ this.allSelectValue = false;
1176
+ this.filterForm.get("ClusterList")?.setValue(event);
1177
+ this.groups = event.map((el: any) => el.groupName);
1178
+ }
1179
+ // isSubmitDisabled(): boolean {
1180
+ // switch (this.selectedRevopsType?.value) {
1181
+ // case 'employee':
1182
+ // return this.employeeACCount === 0;
1183
+ // case 'houseKeeping':
1184
+ // return this.houseKeepingACCount === 0;
1185
+ // case 'duplicate':
1186
+ // return this.duplicateACCount === 0;
1187
+ // default:
1188
+ // return true;
1189
+ // }
1190
+ // }
1191
+ getFormattedEntryTime(entryTime: string): string {
1192
+ if (!entryTime) return "-";
1193
+ const [hours, minutes, seconds] = entryTime.split(":").map(Number);
1194
+ const date = new Date();
1195
+ date.setHours(hours, minutes, seconds);
1196
+ return date.toLocaleTimeString("en-US", {
1197
+ hour: "2-digit",
1198
+ minute: "2-digit",
1199
+ // second: '2-digit',
1200
+ hour12: true,
1201
+ });
1202
+ }
1203
+ showSelectAllBox() {
1204
+ this.filterForm.get("actionStatus")?.setValue("pending");
1205
+ }
1206
+ }