tango-app-ui-manage-tickets 3.7.0-beta.15 → 3.7.0-beta.16

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