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

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