tango-app-ui-manage-tickets 3.7.0-beta.6 → 3.7.0-beta.60

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 +520 -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 +489 -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 +761 -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 +494 -0
  84. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.html +4743 -0
  85. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.scss +1208 -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 +3351 -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,809 @@
1
+ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from "@angular/core";
2
+ import { ActivatedRoute, Router } from "@angular/router";
3
+ import { GlobalStateService } from "tango-app-ui-global";
4
+ import { Subject, takeUntil } from "rxjs";
5
+ import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
6
+ import { AddCsmModalComponent } from "../add-csm-modal/add-csm-modal.component";
7
+ import { TicketService } from "../../services/ticket.service";
8
+ import { ExcelService } from '../../services/excel.service';
9
+ import { CommentModelComponent } from "../comment-model/comment-model.component";
10
+ @Component({
11
+ selector: "lib-tickets",
12
+ templateUrl: "./tickets.component.html",
13
+ styleUrl: "./tickets.component.scss",
14
+ })
15
+ export class TicketsComponent implements OnInit, OnDestroy {
16
+ type = "Infra";
17
+ searchValue: any = "";
18
+ selectedTab: any = "total";
19
+ // paginationVariables
20
+ itemsPerPage = 10;
21
+ currentPage = 1;
22
+ totalItems = 0;
23
+ paginationSizes = [10, 20, 30];
24
+ pageSize = 10;
25
+ private readonly destroy$ = new Subject();
26
+ assignTicket: boolean = false;
27
+ filterByStores: any = [];
28
+ filterByinstalled: any = [];
29
+ filterByStatus: any = [];
30
+ filterByQueryType: any = [];
31
+ issueType: any = [];
32
+ sortedColumn: string;
33
+ sortDirection: number;
34
+ headerFilters: any;
35
+ userList_req: any;
36
+ userList: any = [];
37
+ dataObject: any = [];
38
+ storeList: any = [];
39
+ statusType: { text: string; id: string }[];
40
+ typeName: string;
41
+ users: any;
42
+ limit: number = 10;
43
+ offset: number = 1;
44
+ sortBy: any = -1;
45
+ sortColumName: any = "";
46
+ listArray: any = [];
47
+ tableListArray: any = [];
48
+ loading: boolean = true;
49
+ noData: boolean = false;
50
+ selectAll: any = false;
51
+ assignStores: any = [];
52
+ issueTypeList: any = [];
53
+ queryTypeList: any = [];
54
+ ClusterList: any[];
55
+ filterByCluster: any[];
56
+ showClusterFilter: boolean = false
57
+ constructor(
58
+ private cd: ChangeDetectorRef,
59
+ private router: Router,
60
+ private route: ActivatedRoute,
61
+ public gs: GlobalStateService,
62
+ private modalService: NgbModal,
63
+ private service: TicketService,
64
+ private excelservice: ExcelService,
65
+ ) { }
66
+
67
+ ngOnInit(): void {
68
+ const userData: any = JSON.parse(localStorage.getItem("user-info") || "{}");
69
+ this.users = userData;
70
+ this.route?.queryParams
71
+ ?.pipe(takeUntil(this.destroy$))
72
+ .subscribe((params) => {
73
+ this.type = params.type;
74
+ this.filterByStores = []; this.storeList = []
75
+ this.filterByinstalled = []; this.statusType = []
76
+ this.filterByStatus = []; this.userList = [];
77
+ this.issueType = []; this.issueTypeList = []
78
+ this.filterByQueryType = []; this.queryTypeList = [];
79
+ this.filterByCluster = []; this.ClusterList = []
80
+ this.dataObject = []
81
+ this.gs.manageRefreshTrigger.next(true)
82
+ this.getInitload();
83
+ this.gs.dataRangeValue?.pipe(takeUntil(this.destroy$))?.subscribe({
84
+ next: (data: any) => {
85
+ if (data) {
86
+ this.headerFilters = data;
87
+ this.userList_req = {
88
+ limit: 10000,
89
+ offset: 1,
90
+ userType: this.users.userType,
91
+ };
92
+ this.getstoreFilter();
93
+ this.getAllGroups()
94
+ }
95
+ },
96
+ });
97
+ if (this.type === "installation") {
98
+ this.typeName = "Installed By";
99
+ this.statusType = [
100
+ { text: "Onboarded", id: "onboarded" },
101
+ { text: "Paired", id: "paired" },
102
+ { text: "Installationfailed", id: "installationfailed" },
103
+ { text: "Deployed", id: "deployed" },
104
+ ];
105
+ } else {
106
+ this.typeName = "Resolved By";
107
+
108
+ if (this.users.userType === "tango" && this.type === 'infra') {
109
+ this.statusType = [
110
+ { text: "Open", id: "open" },
111
+ { text: "In Progress", id: "inprogress" },
112
+ { text: "Refresh Ticket", id: "refreshticket" },
113
+ { text: "Closed", id: "closed" },
114
+ ];
115
+ } else {
116
+ this.statusType = [
117
+ { text: "Open", id: "open" },
118
+ { text: "In Progress", id: "inprogress" },
119
+ { text: "Closed", id: "closed" },
120
+ ];
121
+ }
122
+ this.issueTypeList = [
123
+ { text: "High Count", id: "highcount" },
124
+ { text: "Low Count", id: "lowcount" },
125
+ ];
126
+ this.queryTypeList = [
127
+ { text: "Internal", id: "internal" },
128
+ { text: "External", id: "external" },
129
+ ];
130
+ }
131
+ });
132
+ }
133
+ getInitload() {
134
+ this.searchValue = "";
135
+ this.limit = 10;
136
+ this.pageSize = 10;
137
+ this.currentPage = 1;
138
+ this.offset = 1;
139
+ this.selectedTab = "total";
140
+ this.loading = true;
141
+ this.noData = false;
142
+ this.sortedColumn = '';
143
+ }
144
+ getstoreFilter() {
145
+ this.service
146
+ .getSotresList({ issueType: this.type, clientId: this.headerFilters.clients })
147
+ .pipe(takeUntil(this.destroy$))
148
+ .subscribe({
149
+ next: (res: any) => {
150
+ if (res && res.code === 200) {
151
+ this.storeList = res?.data?.data;
152
+ this.storeList.forEach((element: any) => {
153
+ element.text = element.storeId;
154
+ element.id = element.storeId;
155
+ });
156
+ if (this.users.userType === "tango") {
157
+ this.getuserlist();
158
+ } else {
159
+ if (this.type === 'installation') {
160
+ this.dataObject = [
161
+ { Description: "Store ID", Issues: this.storeList },
162
+ { Description: "Deployed Status", Issues: this.statusType },
163
+
164
+ ];
165
+ if (this.showClusterFilter) {
166
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
167
+ }
168
+ } else if (this.type === 'infra' || this.type === 'dataMismatch') {
169
+ this.dataObject = [
170
+ { Description: "Store ID", Issues: this.storeList },
171
+ { Description: "Status", Issues: this.statusType },
172
+
173
+
174
+ ];
175
+ if (this.showClusterFilter) {
176
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
177
+ }
178
+ } else if (this.type === 'mat') {
179
+ this.dataObject = [
180
+ { Description: "Status", Issues: this.statusType },
181
+
182
+
183
+ ];
184
+ if (this.showClusterFilter) {
185
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
186
+ }
187
+ }
188
+ }
189
+ this.getTable();
190
+ } else {
191
+ this.getTable();
192
+ }
193
+ },
194
+ error: (err: any) => {
195
+ this.loading = false;
196
+ this.noData = true;
197
+ this.cd.detectChanges();
198
+ },
199
+ complete: () => { },
200
+ });
201
+ }
202
+ getuserlist() {
203
+ this.service
204
+ .getUserList(this.userList_req)
205
+ .pipe(takeUntil(this.destroy$))
206
+ .subscribe((res: any) => {
207
+ if (res && res.code === 200) {
208
+ this.userList = res?.data?.result;
209
+ this.userList?.forEach((element: any) => {
210
+ element.text = element.userName;
211
+ element.id = element.email;
212
+ });
213
+ }
214
+
215
+ if (this.users.userType === "tango" && (this.type === 'installation')) {
216
+ this.dataObject = [
217
+ { Description: "Store ID", Issues: this.storeList },
218
+ { Description: "Deployed Status", Issues: this.statusType },
219
+ { Description: this.typeName, Issues: this.userList },
220
+
221
+ ];
222
+ if (this.showClusterFilter) {
223
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
224
+ }
225
+ } else if (this.users.userType === "tango" && this.type === 'infra') {
226
+ this.dataObject = [
227
+ { Description: "Store ID", Issues: this.storeList },
228
+ { Description: "Status", Issues: this.statusType },
229
+ { Description: this.typeName, Issues: this.userList },
230
+
231
+ ];
232
+ if (this.showClusterFilter) {
233
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
234
+ }
235
+ } else if (this.users.userType === "tango" && this.type === 'dataMismatch') {
236
+ this.dataObject = [
237
+ { Description: "Store ID", Issues: this.storeList },
238
+ { Description: "Query Type", Issues: this.queryTypeList },
239
+ { Description: "Status", Issues: this.statusType },
240
+
241
+ ];
242
+ if (this.showClusterFilter) {
243
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
244
+ }
245
+ } else if (this.type === 'mat') {
246
+ this.dataObject = [
247
+ { Description: "Status", Issues: this.statusType },
248
+
249
+ ];
250
+ if (this.showClusterFilter) {
251
+ this.dataObject.push({ Description: "Clusters", Issues: this.ClusterList },)
252
+ }
253
+ }
254
+ });
255
+ }
256
+ ngOnDestroy(): void {
257
+ this.destroy$.next(true);
258
+ this.destroy$.complete();
259
+ }
260
+ searchData() {
261
+ this.currentPage = 1;
262
+ this.offset = 1;
263
+ this.limit = 10;
264
+ this.getTable();
265
+ }
266
+
267
+ onSort(column: string) {
268
+ if (this.sortedColumn === column) {
269
+ this.sortDirection = this.sortDirection === 1 ? -1 : 1;
270
+ } else {
271
+ this.sortedColumn = column;
272
+ this.sortDirection = 1;
273
+ }
274
+ this.getTable();
275
+ }
276
+ exportXLSX() {
277
+ let obj: Record<string, any> = {
278
+ clientId: this.headerFilters?.clients,
279
+ fromDate: this.headerFilters?.date?.startDate,
280
+ toDate: this.headerFilters?.date?.endDate,
281
+ offset: this.offset,
282
+ limit: this.limit,
283
+ filterIssue: this.selectedTab ? this.selectedTab : "",
284
+ searchValue: this.searchValue ? this.searchValue : "",
285
+ export: true,
286
+ };
287
+ if (this.sortedColumn) {
288
+ obj.sortColumName = this.sortedColumn;
289
+ obj.sortBy = this.sortDirection;
290
+ }
291
+ if (this.filterByCluster?.length) {
292
+ obj.filterByCluster = this.filterByCluster ? this.filterByCluster : [];
293
+ }
294
+ if (this.type === "installation" || this.type === "infra") {
295
+ if (this.filterByStores?.length) {
296
+ obj.storeIdFilter = this.filterByStores ? this.filterByStores : [];
297
+ }
298
+ if (this.filterByStatus?.length) {
299
+ obj.statusFilter = this.filterByStatus ? this.filterByStatus : [];
300
+ }
301
+ if (this.filterByinstalled?.length) {
302
+ obj.userFilter = this.filterByinstalled ? this.filterByinstalled : [];
303
+ }
304
+ } else if (this.type === "mat") {
305
+ if (this.filterByStatus?.length) {
306
+ obj.statusFilter = this.filterByStatus ? this.filterByStatus : [];
307
+ }
308
+ } else {
309
+ if (this.filterByStores?.length) {
310
+ obj.filterByStores = this.filterByStores ? this.filterByStores : [];
311
+ }
312
+ if (this.filterByStatus?.length) {
313
+ obj.filterByStatus = this.filterByStatus ? this.filterByStatus : [];
314
+ }
315
+ if (this.filterByQueryType?.length) {
316
+ obj.filterByQueryType = this.filterByQueryType ? this.filterByQueryType : [];
317
+ }
318
+ if (this.filterByCluster?.length) {
319
+ obj.filterByCluster = this.filterByCluster ? this.filterByCluster : [];
320
+ }
321
+ }
322
+ if (this.type === "installation") {
323
+ this.service
324
+ .exportInstallationList(obj)
325
+ .pipe(takeUntil(this.destroy$))
326
+ .subscribe({
327
+ next: (res: any) => {
328
+ this.excelservice.saveAsExcelFile(res, 'Installation')
329
+
330
+ },
331
+ error: (err: any) => {
332
+ this.loading = false;
333
+ this.noData = true;
334
+ this.cd.detectChanges();
335
+ },
336
+ complete: () => { },
337
+ });
338
+ } else if (this.type === "infra") {
339
+ this.service
340
+ .exportInfraList(obj)
341
+ .pipe(takeUntil(this.destroy$))
342
+ .subscribe({
343
+ next: (res: any) => {
344
+
345
+ this.excelservice.saveAsExcelFile(res, 'Infra')
346
+
347
+ },
348
+ error: (err: any) => {
349
+ this.loading = false;
350
+ this.noData = true;
351
+ this.cd.detectChanges();
352
+ },
353
+ complete: () => { },
354
+ });
355
+ } else if (this.type === "mat") {
356
+ this.service
357
+ .exportMatList(obj)
358
+ .pipe(takeUntil(this.destroy$))
359
+ .subscribe({
360
+ next: (res: any) => {
361
+
362
+ this.excelservice.saveAsExcelFile(res, 'Mat')
363
+
364
+ },
365
+ error: (err: any) => {
366
+ this.loading = false;
367
+ this.noData = true;
368
+ this.cd.detectChanges();
369
+ },
370
+ complete: () => { },
371
+ });
372
+ } else if (this.type === 'dataMismatch') {
373
+ this.service
374
+ .exportDataMismatchList(obj)
375
+ .pipe(takeUntil(this.destroy$))
376
+ .subscribe({
377
+ next: (res: any) => {
378
+ this.excelservice.saveAsExcelFile(res, 'Data Mismatch')
379
+ },
380
+ error: (err: any) => {
381
+ this.loading = false;
382
+ this.noData = true;
383
+ this.cd.detectChanges();
384
+ },
385
+ complete: () => { },
386
+ });
387
+ }
388
+
389
+
390
+
391
+ }
392
+
393
+ selectedTabs(type: any) {
394
+ this.currentPage = 1;
395
+ this.offset = 1;
396
+ this.limit = 10;
397
+ if (this.type === 'dataMismatch') {
398
+ this.selectedTab = type.name.replace(/\s+/g, '').toLocaleLowerCase();
399
+ this.currentPage = 1;
400
+ this.offset = 1;
401
+ this.limit = 10;
402
+ this.pageSize = 10;
403
+ this.getTable();
404
+ this.transformName(type);
405
+ } else {
406
+ this.selectedTab = type.name;
407
+ this.currentPage = 1;
408
+ this.offset = 1;
409
+ this.limit = 10;
410
+ this.pageSize = 10;
411
+ this.getTable();
412
+ }
413
+ }
414
+ transformName(name: string): string {
415
+ return name.toLocaleLowerCase().replace(/\s+/g, '');
416
+
417
+ }
418
+ onPageChange(pageOffset: number) {
419
+ this.currentPage = Number(pageOffset);
420
+ this.offset = Number(pageOffset);
421
+ this.limit = 10;
422
+ this.getTable();
423
+ }
424
+
425
+ onPageSizeChange(pageSize: number) {
426
+ this.pageSize = Number(pageSize);
427
+ this.limit = Number(pageSize);
428
+ this.currentPage = 1;
429
+ this.offset = 1;
430
+ this.getTable();
431
+ }
432
+ selectAllStore(event: any) {
433
+ this.selectAll = event.target.checked;
434
+ this.tableListArray.forEach((obj: any) => (obj.checked = this.selectAll));
435
+ // If all checkboxes are checked, assign all ticketIds to assignStores, otherwise clear assignStores
436
+ this.assignStores = this.selectAll
437
+ ? this.tableListArray.map((obj: any) => obj.ticketId)
438
+ : [];
439
+ this.assignTicket = this.selectAll; // Update assignTicket based on selectAll state
440
+ }
441
+ getAllGroups() {
442
+ this.ClusterList = [];
443
+ if (this.headerFilters?.clients[0] && this.headerFilters?.clients[0] != '') {
444
+ this.service.getclusters({ clientId: this.headerFilters?.clients[0], group: [], city: [] }).subscribe({
445
+ next: (res: any) => {
446
+ if (res && res.code == 200) {
447
+ this.showClusterFilter = true;
448
+ this.ClusterList = res?.data?.groupData
449
+ this.ClusterList.forEach((element: any) => {
450
+ element.text = element.groupName;
451
+ element.id = element.groupName;
452
+ });
453
+ } else {
454
+ this.ClusterList = [];
455
+ }
456
+ }
457
+ })
458
+ }
459
+ }
460
+
461
+ updateCheck(event: any, ticketId: any) {
462
+ const ticket = this.tableListArray.find(
463
+ (obj: any) => obj.ticketId === ticketId
464
+ );
465
+
466
+ if (ticket) {
467
+ ticket.checked = event.target.checked;
468
+ // If the checkbox is checked, add or remove the corresponding array from the selected arrays
469
+ if (event.target.checked) {
470
+ this.assignStores.push(ticketId);
471
+ } else {
472
+ const index = this.assignStores.indexOf(ticketId);
473
+ if (index !== -1) {
474
+ this.assignStores.splice(index, 1);
475
+ }
476
+ }
477
+ // Update selectAll based on the current state of checkboxes
478
+ this.selectAll = this.tableListArray.every((obj: any) => obj.checked);
479
+ // Update assignTicket based on whether any individual ticket checkbox is checked
480
+ this.assignTicket = this.tableListArray.some((obj: any) => obj.checked);
481
+ }
482
+ }
483
+
484
+ addAssignTicket() {
485
+ const modalRef = this.modalService.open(AddCsmModalComponent, {
486
+ centered: true,
487
+ size: "md",
488
+ scrollable: true,
489
+ backdrop: "static"
490
+ });
491
+ modalRef.componentInstance.ticketId = this.assignStores;
492
+ modalRef.result.then((result) => {
493
+ if (result === "submit") {
494
+ this.searchValue = "";
495
+ this.assignStores = [];
496
+ this.selectAll = false;
497
+ this.assignTicket = false;
498
+ this.getTable();
499
+ }
500
+ });
501
+ }
502
+
503
+ applyFilters(event: any) {
504
+ if (event?.length) {
505
+ event.forEach((element: any) => {
506
+ if (element.Description === "Store ID") {
507
+ this.filterByStores = element.Issues.map((val: any) => val?.id);
508
+ }
509
+ if (this.type !== 'installation') {
510
+ if (element.Description === "Status") {
511
+ this.filterByStatus = element.Issues.map((val: any) => val?.id);
512
+ }
513
+ } if (this.type === 'installation') {
514
+ if (element.Description === "Deployed Status") {
515
+ this.filterByStatus = element.Issues.map((val: any) => val?.id);
516
+ }
517
+ }
518
+ if (this.users.userType === "tango" && (this.type === 'installation' || this.type === 'infra')) {
519
+ if (element.Description === this.typeName) {
520
+ this.filterByinstalled = element.Issues.map((val: any) => val?.id);
521
+ }
522
+ } else {
523
+ this.filterByinstalled = [];
524
+ }
525
+ if (element.Description === "Query Type") {
526
+ this.filterByQueryType = element.Issues.map((val: any) => val?.id);
527
+ }
528
+ if (element.Description === "Clusters") {
529
+ this.filterByCluster = element.Issues.map((val: any) => val?.id);
530
+ }
531
+ });
532
+ }
533
+
534
+ this.currentPage = 1;
535
+ this.offset = 1;
536
+ this.limit = 10;
537
+ this.getTable();
538
+ }
539
+
540
+ getTable() {
541
+ this.loading = true;
542
+ this.noData = false;
543
+ let obj: Record<string, any> = {
544
+ clientId: this.headerFilters?.clients,
545
+ fromDate: this.headerFilters?.date?.startDate,
546
+ toDate: this.headerFilters?.date?.endDate,
547
+ offset: this.offset,
548
+ limit: this.limit,
549
+ filterIssue: this.selectedTab ? this.selectedTab : "",
550
+ searchValue: this.searchValue ? this.searchValue : "",
551
+ export: false,
552
+ };
553
+ if (this.sortedColumn) {
554
+ if (this.type === 'dataMismatch') {
555
+ obj.sortColumnName = this.sortedColumn;
556
+ obj.sortBy = this.sortDirection;
557
+ } else {
558
+ obj.sortColumName = this.sortedColumn;
559
+ obj.sortBy = this.sortDirection;
560
+ }
561
+ }
562
+ if (this.type === "installation" || this.type === "infra") {
563
+ if (this.filterByStores?.length) {
564
+ obj.storeIdFilter = this.filterByStores ? this.filterByStores : [];
565
+ }
566
+ if (this.filterByStatus?.length) {
567
+ obj.statusFilter = this.filterByStatus ? this.filterByStatus : [];
568
+ }
569
+ if (this.filterByinstalled?.length) {
570
+ obj.userFilter = this.filterByinstalled ? this.filterByinstalled : [];
571
+ }
572
+ } else if (this.type === "mat") {
573
+ if (this.filterByStatus?.length) {
574
+ obj.statusFilter = this.filterByStatus ? this.filterByStatus : [];
575
+ }
576
+ } else {
577
+ if (this.filterByStores?.length) {
578
+ obj.filterByStores = this.filterByStores ? this.filterByStores : [];
579
+ }
580
+ if (this.filterByStatus?.length) {
581
+ obj.filterByStatus = this.filterByStatus ? this.filterByStatus : [];
582
+ }
583
+ if (this.filterByQueryType?.length) {
584
+ obj.filterByQueryType = this.filterByQueryType ? this.filterByQueryType : [];
585
+ }
586
+ }
587
+ if (this.filterByCluster?.length) {
588
+ obj.filterByCluster = this.filterByCluster ? this.filterByCluster : [];
589
+ }
590
+ if (this.type === "installation") {
591
+ this.service
592
+ .getInstallationList(obj)
593
+ .pipe(takeUntil(this.destroy$))
594
+ .subscribe({
595
+ next: (res: any) => {
596
+ if (res && res.code === 200) {
597
+ this.listArray = res.data.response;
598
+ if (res.data.result.length === 0) {
599
+ this.loading = false;
600
+ this.noData = true;
601
+ } else {
602
+ this.tableListArray = res.data.result;
603
+ this.totalItems = res.data?.count;
604
+ if (this.totalItems < 10) { this.paginationSizes = [this.totalItems] } else { this.paginationSizes = [10, 20, 30] }
605
+ this.loading = false;
606
+ this.noData = false;
607
+ this.selectAll = false;
608
+ this.assignTicket = false;
609
+ this.cd.detectChanges();
610
+ }
611
+ } else {
612
+ this.loading = false;
613
+ this.noData = true;
614
+ }
615
+ },
616
+ error: (err: any) => {
617
+ this.loading = false;
618
+ this.noData = true;
619
+ this.cd.detectChanges();
620
+ },
621
+ complete: () => { },
622
+ });
623
+ } else if (this.type === "infra") {
624
+ this.service
625
+ .getInfraList(obj)
626
+ .pipe(takeUntil(this.destroy$))
627
+ .subscribe({
628
+ next: (res: any) => {
629
+ if (res && res.code === 200) {
630
+ this.listArray = res.data.response;
631
+ if (res.data.result.length === 0) {
632
+ this.loading = false;
633
+ this.noData = true;
634
+ } else {
635
+ this.tableListArray = res.data.result;
636
+ this.totalItems = res.data?.count;
637
+ if (this.totalItems < 10) { this.paginationSizes = [this.totalItems] } else { this.paginationSizes = [10, 20, 30] }
638
+ this.loading = false;
639
+ this.noData = false;
640
+ this.selectAll = false;
641
+ this.assignTicket = false;
642
+ }
643
+ } else {
644
+ this.loading = false;
645
+ this.noData = true;
646
+ }
647
+ },
648
+ error: (err: any) => {
649
+ this.loading = false;
650
+ this.noData = true;
651
+ this.cd.detectChanges();
652
+ },
653
+ complete: () => { },
654
+ });
655
+ } else if (this.type === "mat") {
656
+ this.service
657
+ .getMatList(obj)
658
+ .pipe(takeUntil(this.destroy$))
659
+ .subscribe({
660
+ next: (res: any) => {
661
+ if (res && res.code === 200) {
662
+ this.listArray = res?.data?.response;
663
+ this.tableListArray = res?.data?.result;
664
+ this.totalItems = res.data?.count;
665
+ if (this.totalItems < 10) { this.paginationSizes = [this.totalItems] } else { this.paginationSizes = [10, 20, 30] } this.loading = false;
666
+ this.noData = false;
667
+ } else {
668
+ this.loading = false;
669
+ this.noData = true;
670
+ }
671
+ },
672
+ error: (err: any) => {
673
+ this.loading = false;
674
+ this.noData = true;
675
+ this.cd.detectChanges();
676
+ },
677
+ complete: () => { },
678
+ });
679
+ } else if (this.type === 'dataMismatch') {
680
+ this.service
681
+ .getDataMismathList(obj)
682
+ .pipe(takeUntil(this.destroy$))
683
+ .subscribe({
684
+ next: (res: any) => {
685
+ if (res && res.code === 200) {
686
+ this.listArray = res?.data?.response;
687
+ if (res.data.result.length === 0) {
688
+ this.loading = false;
689
+ this.noData = true;
690
+ } else {
691
+ this.tableListArray = res?.data?.result;
692
+ this.totalItems = res.data?.count;
693
+ if (this.totalItems < 10) { this.paginationSizes = [this.totalItems] } else { this.paginationSizes = [10, 20, 30] }
694
+ this.loading = false;
695
+ this.noData = false;
696
+ this.selectAll = false;
697
+ this.assignTicket = false;
698
+ this.cd.detectChanges();
699
+ }
700
+ } else {
701
+ this.loading = false;
702
+ this.noData = true;
703
+ }
704
+ },
705
+ error: (err: any) => {
706
+ this.loading = false;
707
+ this.noData = true;
708
+ this.cd.detectChanges();
709
+ },
710
+ complete: () => { },
711
+ });
712
+ }
713
+ }
714
+
715
+ routeToStore(storeId: any, clientId: any) {
716
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
717
+ data.store = storeId;
718
+ data.client = clientId;
719
+ localStorage.setItem("header-filters", JSON.stringify(data));
720
+ this.gs.dataRangeValue.next(data);
721
+ this.router.navigate(['/manage/stores/infra-ticket'], {
722
+ queryParams: { storeId: storeId }
723
+ });
724
+ }
725
+ routeToMat(storeId: any, clientId: any, clientName: any) {
726
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
727
+ data.store = storeId;
728
+ data.client = clientId;
729
+ data.clientName = clientName ? clientName : 'Stores';
730
+ localStorage.setItem("header-filters", JSON.stringify(data));
731
+ this.gs.dataRangeValue.next(data);
732
+ this.router.navigate(['/manage/stores/mat'], {
733
+ queryParams: { storeId: storeId }
734
+ });
735
+ }
736
+ commentModal(obj: any) {
737
+ const modalRef = this.modalService.open(CommentModelComponent, {
738
+ centered: true,
739
+ size: "md",
740
+ scrollable: true,
741
+ backdrop: "static"
742
+ });
743
+ modalRef.componentInstance.ticketId = obj.ticketId;
744
+ modalRef.result.then((result) => {
745
+ })
746
+ }
747
+
748
+ tickets(type: any, clientId: any, storeId: any, clientName: any) {
749
+ if (type === 'mat') {
750
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
751
+ data.store = storeId;
752
+ data.client = clientId;
753
+ data.clientName = clientName ? clientName : 'Stores';
754
+ localStorage.setItem("header-filters", JSON.stringify(data));
755
+ this.gs.dataRangeValue.next(data);
756
+ this.router.navigate(['/manage/stores/mat'], {
757
+ queryParams: { storeId: storeId }
758
+ });
759
+ } else {
760
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
761
+ data.store = storeId;
762
+ data.client = clientId;
763
+ data.clientName = clientName ? clientName : 'Stores';
764
+ localStorage.setItem("header-filters", JSON.stringify(data));
765
+ this.gs.dataRangeValue.next(data);
766
+ this.router.navigate(['/manage/stores/infra-ticket'], {
767
+ queryParams: { storeId: storeId, type: type }
768
+ });
769
+ }
770
+ }
771
+
772
+ clientTickets(clientId: any, storeId: any, clientName: any) {
773
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
774
+ data.store = storeId;
775
+ data.client = clientId;
776
+ data.clientName = clientName ? clientName : 'Stores';
777
+ localStorage.setItem("header-filters", JSON.stringify(data));
778
+ this.gs.dataRangeValue.next(data);
779
+ this.router.navigate(['/manage/stores']);
780
+ }
781
+ storeTickets(clientId: any, storeId: any, clientName: any) {
782
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
783
+ data.store = storeId;
784
+ data.client = clientId;
785
+ data.clientName = clientName ? clientName : 'Stores';
786
+ localStorage.setItem("header-filters", JSON.stringify(data));
787
+ this.gs.dataRangeValue.next(data);
788
+ this.router.navigate(['/manage/stores/cameras'], {
789
+ queryParams: { storeId: storeId }
790
+ });
791
+ }
792
+ userTickets(clientId: any, storeId: any) {
793
+ let data: any = JSON.parse(localStorage.getItem("header-filters") || "");
794
+ data.store = storeId;
795
+ data.client = clientId;
796
+ localStorage.setItem("header-filters", JSON.stringify(data));
797
+ this.gs.dataRangeValue.next(data);
798
+ this.router.navigate(['/manage/users']);
799
+ }
800
+
801
+ setpageSize() {
802
+ if (this.totalItems < 10) {
803
+ return this.totalItems;
804
+ } else {
805
+ return this.pageSize;
806
+ }
807
+ }
808
+
809
+ }