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

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 +3344 -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,761 @@
1
+ import { Component, OnInit, HostListener, ViewChild, viewChild, OnDestroy, ChangeDetectorRef } from '@angular/core';
2
+ import { ActivatedRoute, Route, Router } from '@angular/router';
3
+ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
4
+ import { Observable, Subject, timer, Subscription } from 'rxjs';
5
+ import { AuditService } from '../../services/audit.service';
6
+ import { ToastService } from 'tango-app-ui-shared';
7
+ import { NgxSpinnerService } from 'ngx-spinner';
8
+ import { RemoveAuditComponent } from '../remove-audit/remove-audit.component';
9
+ import * as LZString from 'lz-string';
10
+ import { ExcelService } from '../../services/excel.service';
11
+ import { takeUntil } from 'rxjs';
12
+ import { TimerService } from '../../services/timer.service';
13
+ import { ViewcategoryComponent } from '../viewcategory/viewcategory.component';
14
+
15
+ @Component({
16
+ selector: 'lib-start-audit',
17
+ templateUrl: './start-audit.component.html',
18
+ styleUrl: './start-audit.component.scss'
19
+ })
20
+ export class StartAuditComponent implements OnInit, OnDestroy {
21
+ junkimage: any;
22
+ employeimage: any;
23
+ filedetails: any = {};
24
+ datareason: any;
25
+ limit: any = 500;
26
+ nextId: any = ''
27
+ spinnerstart = true
28
+ submitted: boolean = false;
29
+ auditId: any;
30
+ customercount = 0;
31
+ junkcount = 0;
32
+ employeecount = 0;
33
+ demographic: any;
34
+ id: any = '';
35
+ queueName: any = '';
36
+ auditmappingdata: any;
37
+ totalfile: any = 0;
38
+ auditLoading = true;
39
+ badge = false;
40
+ imagelist: any = "./assets/tango/Images/loading-img.png"
41
+ selected: any = [];
42
+ selectedType: any;
43
+ auditLoading1 = true;
44
+ Nodata = false;
45
+ counter: any = 1;
46
+ clickedImages: boolean[] = [];
47
+ @ViewChild('confirmDraft') confirmDraft: any;
48
+ @ViewChild('confirmerror') confirmerror: any;
49
+ Errormsg: any;
50
+ storedetails: any;
51
+ openmodel: boolean = false;
52
+ private readonly destroy$ = new Subject();
53
+ getBack: boolean = false;
54
+ category: any = []
55
+ @HostListener("window:scroll", [])
56
+ onScroll(): void {
57
+ if ('totalfiles' in sessionStorage) {
58
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
59
+ if (filedata?.filedetails?.nextToken) {
60
+ if (Math.ceil(window.innerHeight + window.scrollY) >= document.body.scrollHeight) {//this condition failed when the browser inspect screen open in horizontal
61
+ if (this.spinnerstart) {
62
+ this.spinnerService.show();
63
+ this.getMapping('nextId')
64
+ }
65
+ }
66
+ }
67
+ } else {
68
+ var result: any = window.confirm("Something Went Wrong. Please clear browser cache or Use incognito window")
69
+ if (result) {
70
+ console.log("OK button clicked!");
71
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
72
+ } else {
73
+ console.log("Alert closed without clicking OK");
74
+ }
75
+ }
76
+ }
77
+
78
+ @HostListener('window:keydown', ['$event'])
79
+ handleKeyPress(event: KeyboardEvent) {
80
+ if (this.openmodel) return;
81
+ // if (event.key === 'g' || event.code === 'KeyG') {
82
+ // var group = this.auditmappingdata.filter((data: any) => data.selected === true)
83
+ // if (group.length > 0) {
84
+ // if (group.length == 1) {
85
+ // this.toastr.getErrorToast('Please Select multiple file then add to Group')
86
+ // } else {
87
+ // let dummyarray = group.shift()
88
+ // var groupimages: any = []
89
+ // group.forEach((data: any) => {
90
+ // this.auditmappingdata.splice(this.auditmappingdata.findIndex(({ img_name }: { img_name: string }) => img_name == data.img_name), 1);
91
+ // groupimages.push(data.mappedid[0])
92
+ // })
93
+ // this.demographic = this.auditmappingdata.filter((data: any) => data.demographic === 'd').length;
94
+ // dummyarray.count = dummyarray.count + groupimages.length
95
+ // dummyarray.selected = false
96
+ // dummyarray.demographic = ''
97
+ // dummyarray.mappedid = [...dummyarray.mappedid, ...groupimages]
98
+ // const jsonString = JSON.stringify(this.auditmappingdata);
99
+ // const compressedData = LZString.compress(jsonString);
100
+ // sessionStorage.setItem('audit', compressedData)
101
+ // }
102
+
103
+ // // this.initial_data_loading()
104
+ // } else {
105
+ // this.toastr.getErrorToast('Please Select file then add to Group')
106
+ // }
107
+ // }
108
+ const pressed = (event.key || '').toLowerCase();
109
+ const matched = this.category.find((m: any) => {
110
+ if (!m.key) return false;
111
+ const mapKey = m.key.toLowerCase();
112
+ // match by event.key (preferred) OR by event.code like 'KeyJ'
113
+ return pressed === mapKey || event.code === `Key${mapKey.toUpperCase()}`;
114
+ });
115
+ console.log(matched)
116
+ if (!matched) return
117
+ if (matched) {
118
+ var newData = this.auditmappingdata.filter((data: any) => data.selected === true)
119
+ if (newData.length > 0) {
120
+ var oldData = JSON.parse(sessionStorage.getItem(matched?.type) || '{}')
121
+ if (Number(oldData.length) > 0) {
122
+ newData = [...oldData, ...newData]
123
+ } else {
124
+ newData = newData
125
+ }
126
+ this.category.map((data: any) => {
127
+ if (data.type === matched?.type) {
128
+ data.count = newData.length
129
+ }
130
+ })
131
+ sessionStorage.setItem(matched?.type, JSON.stringify(newData))
132
+ this.auditmappingdata = this.auditmappingdata.filter((data: any) => data.selected === false)
133
+ const jsonString = JSON.stringify(this.auditmappingdata);
134
+ const compressedData = LZString.compress(jsonString);
135
+ sessionStorage.setItem('audit', compressedData)
136
+ this.toastr.getSuccessToast(`${matched?.type} Added Succesfully!`);
137
+ } else {
138
+ this.toastr.getErrorToast(`Please Select file then add to ${matched?.type} `)
139
+ }
140
+
141
+ }
142
+
143
+ }
144
+
145
+ constructor(
146
+ private excel: ExcelService,
147
+ private auditservice: AuditService,
148
+ private toastr: ToastService,
149
+ private router: Router, private cd: ChangeDetectorRef,
150
+ private modalService: NgbModal, private timerService: TimerService,
151
+ private spinnerService: NgxSpinnerService, private route: ActivatedRoute
152
+ ) {
153
+ this.selectedType = this.route.snapshot.paramMap.get('type')
154
+ }
155
+ destroy = new Subject();
156
+ showDialog = false;
157
+ timePassed: number = 0;
158
+ subscription: Subscription | null = null;
159
+ formattedTime: string = '00:00:00';
160
+
161
+ notice = 'session expired';
162
+ showNotice = false;
163
+ rxjsTimer: Subscription[] = [];
164
+
165
+ ngOnInit(): void {
166
+
167
+ this.getAuditConfig()
168
+ if ('user-info' in localStorage) {
169
+ var user = JSON.parse(localStorage.getItem('user-info') || '{}')
170
+ this.id = user._id
171
+ }
172
+ if ('audit' in sessionStorage) {
173
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
174
+ const decompressedData = LZString.decompress(stringifydata);
175
+ var auditdata = JSON.parse(decompressedData || '{}')
176
+ if (auditdata.length > 0) {
177
+ this.auditmappingdata = auditdata;
178
+ this.customercount = this.auditmappingdata.length
179
+ }
180
+ this.auditLoading = false;
181
+ this.setTimer();
182
+ } else {
183
+ var filedata
184
+ if ('totalfiles' in sessionStorage) {
185
+ filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
186
+ this.getMapping()
187
+ }
188
+ }
189
+ }
190
+
191
+ setTimer() {
192
+ this.subscription = this.timerService.getTimePassed().subscribe(time => {
193
+ this.timePassed = time;
194
+ this.formattedTime = this.timerService.formatTime(time);
195
+ this.cd.detectChanges();
196
+ });
197
+ this.timerService.startTimer();
198
+ document.addEventListener('mousemove', this.handleGlobalMouseEvent);
199
+ document.addEventListener('click', this.handleGlobalMouseEvent);
200
+ document.addEventListener('mouseenter', this.handleGlobalMouseEvent);
201
+ document.addEventListener('scroll', this.handleGlobalMouseEvent);
202
+ }
203
+
204
+ handleGlobalMouseEvent = (): void => {
205
+ this.timerService.startTimer();
206
+ }
207
+
208
+
209
+ ngOnDestroy(): void {
210
+ this.destroy$.next(true);
211
+ this.destroy$.complete();
212
+ document.removeEventListener('mousemove', this.handleGlobalMouseEvent);
213
+ document.removeEventListener('click', this.handleGlobalMouseEvent);
214
+ document.removeEventListener('mouseenter', this.handleGlobalMouseEvent);
215
+ document.removeEventListener('scroll', this.handleGlobalMouseEvent);
216
+ this.timerService.clearTimer()
217
+ }
218
+
219
+ initial_data_loading() {
220
+ if ('audit' in sessionStorage) {
221
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
222
+ const decompressedData = LZString.decompress(stringifydata);
223
+ var auditdata = JSON.parse(decompressedData || '{}')
224
+ if (auditdata.length > 0) {
225
+ this.auditmappingdata = auditdata;
226
+ this.demographic = this.auditmappingdata.filter((data: any) => data.demographic === 'd').length;
227
+ this.customercount = this.auditmappingdata.length
228
+ this.auditLoading = false;
229
+ } else {
230
+ this.auditmappingdata = []
231
+ this.customercount = 0
232
+ }
233
+ }
234
+
235
+
236
+ this.category.map((data: any) => {
237
+ var count = JSON.parse(sessionStorage.getItem(data.type) || '{}')
238
+ data.count = count?.length
239
+ })
240
+ if ('retag' in sessionStorage) {
241
+ var retagiamge = JSON.parse(sessionStorage.getItem('retag') || '[]')
242
+ if (retagiamge.length > 0) {
243
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
244
+ const decompressedData = LZString.decompress(stringifydata);
245
+ var customer = JSON.parse(decompressedData || '{}')
246
+ customer = [...customer, ...retagiamge]
247
+ const jsonString = JSON.stringify(this.auditmappingdata);
248
+ const compressedData = LZString.compress(jsonString);
249
+ sessionStorage.setItem('audit', compressedData)
250
+ sessionStorage.removeItem('retag')
251
+ }
252
+ }
253
+ if ('totalfiles' in sessionStorage) {
254
+ var files = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
255
+ this.totalfile = files?.totalfiles
256
+ this.filedetails = files?.filedetails
257
+ this.storedetails = files?.storedetails
258
+ }
259
+ }
260
+ toggleImage(img_name: any) {
261
+ this.selected.push(img_name)
262
+ this.auditmappingdata.map((data: any) => {
263
+
264
+ if (data.img_name == img_name) {
265
+ if (data.mappedid.length == 1) {
266
+ data.selected = !data.selected
267
+ } else {
268
+ data.dropped = !data.dropped
269
+ }
270
+ }
271
+ })
272
+ }
273
+ getAuditConfig() {
274
+
275
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
276
+ this.auditservice.getAuditconfig(filedata?.filedetails?.clientId).pipe(takeUntil(this.destroy$)).subscribe({
277
+ next: (res: any) => {
278
+ if (res && res?.code == 200) {
279
+ console.log(res.data.footfallDirectoryConfigs.taggingLimitation)
280
+ this.category = res.data.footfallDirectoryConfigs.taggingLimitation
281
+ this.category.map((data:any)=>{
282
+ if(data?.type in sessionStorage){
283
+
284
+ }else{
285
+ sessionStorage.setItem(data.type, JSON.stringify([]))
286
+ }
287
+ })
288
+ this.initial_data_loading()
289
+
290
+ }
291
+ }
292
+ })
293
+ }
294
+ getMapping(nextId?: any) {
295
+ this.auditLoading = true;
296
+ this.spinnerstart = false
297
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
298
+ console.log("--->", filedata)
299
+ let payload = {
300
+ storeId: filedata?.filedetails?.storeId,
301
+ limit: this.limit,
302
+ nextId: filedata?.filedetails?.nextToken ? filedata?.filedetails?.nextToken : '',
303
+ Date: filedata?.filedetails?.Date,
304
+ count:filedata?.totalfiles
305
+ }
306
+
307
+
308
+ this.auditservice.getAuditMapping(payload).pipe(takeUntil(this.destroy$)).subscribe({
309
+ next: (res: any) => {
310
+ if (res && res?.code == 200) {
311
+ this.storedetails = res?.data;
312
+ setTimeout(() => {
313
+ if (res?.data?.file?.nextToken) {
314
+ this.getMapping(res?.data?.file?.nextToken)
315
+ }
316
+ }, 100)
317
+ if (res?.data?.isDraft) {
318
+ sessionStorage.setItem('timeSpent', JSON.stringify(res?.data?.timeSpent));
319
+ this.spinnerstart = false;
320
+
321
+ this.category.map((data: any) => {
322
+
323
+ let filterData = res?.data?.result.filter((x: any) => x.type === data.type)
324
+ console.log("🚀 ~ StartAuditComponent ~ getMapping ~ filterData:", filterData)
325
+ sessionStorage.setItem(data.type, JSON.stringify(filterData[0].value))
326
+ })
327
+ let customerData = res?.data?.result.filter((x: any) => x.type === 'customer')
328
+ console.log("🚀 ~ StartAuditComponent ~ getMapping ~ customerData:", customerData)
329
+ this.auditmappingdata = customerData[0].value
330
+ const jsonString = JSON.stringify(customerData[0].value);
331
+ const compressedData = LZString.compress(jsonString);
332
+ sessionStorage.setItem('audit', compressedData)
333
+
334
+
335
+ this.totalfile = res?.data?.count;
336
+ this.filedetails = res?.data?.file;
337
+
338
+
339
+ this.category.map((data: any) => {
340
+ console.log("🚀 ~ StartAuditComponent ~ getMapping ~ data.type:", data.type)
341
+ var count = JSON.parse(sessionStorage.getItem(data.type) || '{}')
342
+ data.count = count?.length
343
+ })
344
+
345
+ if (res?.data?.result?.retag_image?.length > 0) {
346
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
347
+ const decompressedData = LZString.decompress(stringifydata);
348
+ var customer = JSON.parse(decompressedData || '{}')
349
+ customer = [...customer, ...res.data.result.retag_image]
350
+ this.auditmappingdata = customer;
351
+ const jsonString = JSON.stringify(customer);
352
+ const compressedData = LZString.compress(jsonString);
353
+ sessionStorage.setItem('audit', compressedData)
354
+ }
355
+
356
+ var totalfiles = {
357
+ "storedetails": {
358
+ "storeName": res?.data?.storeName,
359
+ "address": res?.data?.address
360
+ },
361
+ "totalfiles": this.storedetails?.count,
362
+ "auditId": res?.data.file?.auditId,
363
+ "filedetails": {
364
+ "storeId": this.storedetails?.file?.storeId,
365
+ "Date": res?.data?.file?.Date,
366
+ "userId": res?.data?.file?.userId,
367
+ "clientId": res?.data?.file?.clientId,
368
+ }
369
+ }
370
+ sessionStorage.setItem('totalfiles', JSON.stringify(totalfiles))
371
+ this.auditLoading = false;
372
+ this.setTimer();
373
+ } else {
374
+ this.spinnerstart = false
375
+ this.spinnerService.hide();
376
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
377
+ if (filedata?.filedetails?.nextToken) {
378
+ this.auditLoading = false;
379
+ this.auditId = res.data.file?.auditId;
380
+ this.totalfile = res?.data?.count;
381
+ this.filedetails = res?.data?.file;
382
+ this.filedetails.zoneName = res?.data?.file?.zoneName;
383
+ if ('audit' in sessionStorage) {
384
+ if (this.auditmappingdata?.length > 0) {
385
+ this.auditmappingdata = [...this.auditmappingdata, ...res?.data?.result]
386
+ this.customercount = this.auditmappingdata?.length
387
+ }
388
+ }
389
+ } else {
390
+ this.auditLoading = false;
391
+ this.auditLoading1 = false;
392
+ this.filedetails = res?.data?.file;
393
+ this.auditId = res.data.file?.auditId;
394
+ this.auditmappingdata = res?.data?.result;
395
+ this.totalfile = res?.data?.count;
396
+ this.filedetails.queueName = this.queueName;
397
+ this.filedetails.zoneName = res?.data?.file?.zoneName;
398
+ }
399
+ const jsonString = JSON.stringify(this.auditmappingdata);
400
+ const compressedData = LZString.compress(jsonString);
401
+ sessionStorage.setItem('audit', compressedData)
402
+ let obj = {
403
+ totalfiles: this.totalfile,
404
+ filedetails: this.filedetails,
405
+ auditId: this.auditId,
406
+
407
+ storedetails: {
408
+ "storeName": res?.data?.storeName,
409
+ "address": res?.data?.address
410
+ },
411
+ }
412
+ sessionStorage.setItem('totalfiles', JSON.stringify(obj))
413
+ this.spinnerstart = true
414
+ this.setTimer();
415
+ }
416
+
417
+ } else if (!res || res.code == 204) {
418
+ if (this.counter < 6) {
419
+ this.counter = this.counter + 1;
420
+ this.getMapping()
421
+ this.showDialog = true;
422
+ } else {
423
+ this.auditLoading = false;
424
+ if (!nextId) { this.Nodata = true } else { }
425
+ this.submitted = true;
426
+ this.destroy.next(true);
427
+ this.destroy.complete();
428
+ this.showNotice = true;
429
+ }
430
+ }
431
+
432
+ },
433
+ error: (err: any) => {
434
+ console.log(err)
435
+ if (err?.status == 404) {
436
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
437
+ if (filedata.filedetails && filedata.filedetails.nextToken) {
438
+ delete filedata.filedetails.nextToken;
439
+ sessionStorage.setItem('totalfiles', JSON.stringify(filedata));
440
+ this.getMapping('')
441
+ }
442
+ } else {
443
+ this.toastr.getErrorToast(err?.error?.message)
444
+ }
445
+ }
446
+ })
447
+ }
448
+
449
+ removeaudit(data: any) {
450
+ const modalRef = this.modalService.open(RemoveAuditComponent, {
451
+ size: 'lg',
452
+ centered: true,
453
+ backdrop: 'static',
454
+ keyboard: false
455
+ })
456
+ modalRef.componentInstance.data = data,
457
+ modalRef.closed.subscribe((res: any) => {
458
+ if (res && res?.reload) {
459
+ this.initial_data_loading()
460
+ }
461
+ })
462
+ }
463
+ allowDrop(event: any) {
464
+ event.preventDefault();
465
+ }
466
+
467
+ dragImage(event: any) {
468
+ event.dataTransfer.setData('text/plain', event.target.id);
469
+ }
470
+
471
+ dropImage(event: any) {
472
+ event.preventDefault();
473
+ const draggedImageId = event.dataTransfer.getData('text/plain');
474
+ const draggedImage = document.getElementById(draggedImageId);
475
+ event.target.appendChild(draggedImage);
476
+ const dropZone = event.target;
477
+ this.auditmappingdata.map((data: any, index: number) => {
478
+ if (data.img_name == dropZone.id) {
479
+ if (data.mappedid.length > 0) {
480
+ var findone = this.auditmappingdata.filter((data: any) => data.img_name == draggedImageId)
481
+ console.log(findone)
482
+ if (findone.length > 0) {
483
+ data.count = data.count + findone[0].count
484
+ data.mappedid = [...data.mappedid, ...findone[0].mappedid]
485
+ }
486
+ if ('duplicate' in sessionStorage) {
487
+ let filedata = JSON.parse(sessionStorage.getItem('duplicate') || '{}')
488
+ filedata = [...filedata, ...findone[0].mappedid]
489
+ sessionStorage.setItem('duplicate', JSON.stringify(filedata))
490
+ } else {
491
+ sessionStorage.setItem('duplicate', JSON.stringify(findone))
492
+ let filedata = JSON.parse(sessionStorage.getItem('duplicate') || '{}')
493
+ console.log("🚀 ~ StartAuditComponent ~ dropImage ~ filedata:", filedata)
494
+
495
+ }
496
+ this.category.map((data: any) => {
497
+ var count = JSON.parse(sessionStorage.getItem(data.type) || '{}')
498
+ data.count = count?.length
499
+ })
500
+ } else {
501
+ data.count = data.count + 1,
502
+ data.mappedid.push(draggedImageId)
503
+ }
504
+ }
505
+ })
506
+
507
+
508
+
509
+ this.auditmappingdata.splice(this.auditmappingdata.findIndex(({ img_name }: { img_name: string }) => img_name == draggedImageId), 1);
510
+ this.auditmappingdata.map((data: any) => data.selected = false)
511
+ const jsonString = JSON.stringify(this.auditmappingdata);
512
+ const compressedData = LZString.compress(jsonString);
513
+ sessionStorage.setItem('audit', compressedData)
514
+ }
515
+
516
+ dragStart(event: DragEvent) {
517
+ const target = event.target as HTMLImageElement;
518
+ event.dataTransfer?.setData('text/plain', target.id);
519
+ }
520
+
521
+ Reviewdata() {
522
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
523
+ if (filedata?.filedetails?.nextToken) {
524
+ this.toastr.getErrorToast('Scroll Down to bottom load the files before Move to Next page!');
525
+ } else {
526
+ this.submitted = true;
527
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
528
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
529
+ const decompressedData = LZString.decompress(stringifydata);
530
+ var customer = JSON.parse(decompressedData || '{}')
531
+ let storedData = [
532
+ {
533
+ type: "customer",
534
+ value: customer ? customer : [],
535
+ }
536
+ ]
537
+
538
+ this.category.map((data: any) => {
539
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '[]');
540
+ storedData.push({
541
+ type: data.type,
542
+ value: sessionvalue&&sessionvalue.length>0 ? sessionvalue : []
543
+ })
544
+ })
545
+ console.log("🚀 ~ StartAuditComponent ~ Reviewdata ~ storedData:", storedData)
546
+ var inserobj: any = {
547
+ userCommands: this.datareason ? this.datareason : "",
548
+ customerCount: customer ? customer?.length : 0,
549
+ storeId: totalfile?.filedetails?.storeId,
550
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails.auditId,
551
+ fileDate: totalfile?.filedetails?.Date,
552
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
553
+ retagCount: 0,
554
+ timeSpent: this.timePassed,
555
+ retagImage: [],
556
+ draftedData: storedData
557
+ }
558
+ console.log("🚀 ~ StartAuditComponent ~ Reviewdata ~ inserobj:", inserobj)
559
+ this.auditservice.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe({
560
+ next: (res: any) => {
561
+ if (res && res?.code == 200) {
562
+ this.submitted = false;
563
+ this.router.navigate(["/manage/tickets/mapping-list"])
564
+ } if (res && res.code == 203) {
565
+ this.Errormsg = res.message
566
+ const modalRef = this.modalService.open(this.confirmerror, { centered: true })
567
+ modalRef.result.then((result) => {
568
+ if (result.isConfirmed) {
569
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
570
+ }
571
+ })
572
+ }
573
+ },
574
+ error: (err: any) => {
575
+ if (err?.code == 400 || err?.code == 204 || err?.code == 404 || err?.code == 500) {
576
+ this.Errormsg = err.message
577
+ const modalRef = this.modalService.open(this.confirmerror, { centered: true })
578
+ modalRef.result.then((result) => {
579
+ if (result.isConfirmed) {
580
+ this.submitted = true;
581
+ }
582
+ })
583
+ }
584
+ }
585
+ })
586
+ }
587
+
588
+ }
589
+
590
+ viewcategory(data: any) {
591
+ const modalRef = this.modalService.open(ViewcategoryComponent, {
592
+ size: 'lg',
593
+ centered: true,
594
+ backdrop: 'static',
595
+ keyboard: false
596
+ })
597
+ modalRef.componentInstance.data = data
598
+ modalRef.componentInstance.imageList = data,
599
+ modalRef.closed.subscribe((res: any) => {
600
+ if (res && res?.reload) {
601
+ this.initial_data_loading()
602
+ }
603
+ })
604
+ }
605
+ async savedraft() {
606
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
607
+ if (filedata?.filedetails?.nextToken) {
608
+ this.toastr.getErrorToast('Scroll Down to bottom load the files before save!');
609
+ } else {
610
+ this.openmodel = true;
611
+ const modalRef = this.modalService.open(this.confirmDraft, {
612
+ centered: true, size: 'md'
613
+ })
614
+ modalRef.result.then((result) => {
615
+ console.log("🚀 ~ StartAuditComponent ~ savedraft ~ result:", result)
616
+
617
+ if (result === 'isDenied') {
618
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
619
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
620
+ const decompressedData = LZString.decompress(stringifydata);
621
+ var customer = JSON.parse(decompressedData || '{}')
622
+ let storedData = [
623
+ {
624
+ type: "customer",
625
+ value: customer ? customer : [],
626
+ }
627
+ ]
628
+
629
+ this.category.map((data: any) => {
630
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '[]');
631
+ storedData.push({
632
+ type: data.type,
633
+ value: sessionvalue&&sessionvalue.length>0 ? sessionvalue : []
634
+ })
635
+ })
636
+
637
+ var inserobj: any = {
638
+ userCommands: this.datareason ? this.datareason : "",
639
+ // userId: user?.user,
640
+ storeId: totalfile?.filedetails?.storeId,
641
+ fileDate: totalfile?.filedetails?.Date,
642
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails.auditId,
643
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
644
+ customerCount: customer ? customer?.length : 0,
645
+ retagCount: 0,
646
+ timeSpent: this.timePassed,
647
+ retagImage: [],
648
+ draftedData: storedData
649
+ }
650
+ if(inserobj?.auditId&&inserobj?.auditId!=''){
651
+ this.auditservice.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe({
652
+ next: (res: any) => {
653
+ if (res && res.code == 200) {
654
+ this.submitted = false;
655
+ this.toastr.getSuccessToast(res?.data?.result)
656
+ } else {
657
+ if (res && res.code == 203) {
658
+ this.Errormsg = res.error;
659
+ const modalRef = this.modalService.open(this.confirmerror)
660
+ modalRef.result.then((result) => {
661
+ if (result.isConfirmed) {
662
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
663
+ }
664
+ })
665
+ }
666
+ }
667
+ },
668
+ error: (err: any) => {
669
+ if (err?.code == 400 || err?.code == 204 || err?.code == 404 || err?.code == 500) {
670
+ this.toastr.getErrorToast('File not saved!')
671
+ }
672
+ }
673
+ })
674
+ }else{
675
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
676
+ }
677
+
678
+ } else if (result === 'isConfirmed') {
679
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
680
+
681
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
682
+ const decompressedData = LZString.decompress(stringifydata);
683
+ var customer = JSON.parse(decompressedData || '{}')
684
+ let storedData = [
685
+ {
686
+ type: "customer",
687
+ value: this.auditmappingdata ? this.auditmappingdata : [],
688
+ }
689
+ ]
690
+
691
+ this.category.map((data: any) => {
692
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '[]');
693
+ storedData.push({
694
+ type: data.type,
695
+ value: sessionvalue&&sessionvalue.length>0 ? sessionvalue : []
696
+ })
697
+ })
698
+ var inserobj: any = {
699
+ userCommands: this.datareason ? this.datareason : "",
700
+ customerCount: customer ? customer?.length : 0,
701
+ storeId: totalfile?.filedetails?.storeId,
702
+ auditType: totalfile?.filedetails?.type,
703
+ fileDate: totalfile?.filedetails?.Date,
704
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails.auditId,
705
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
706
+ retagCount: 0,
707
+ timeSpent: this.timePassed,
708
+ retagImage: [],
709
+ draftedData: storedData
710
+ }
711
+ if(inserobj?.auditId&&inserobj.auditId!==''){
712
+
713
+ this.auditservice.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe({
714
+ next: (res: any) => {
715
+ if (res && res.code == 200) {
716
+ this.submitted = false;
717
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
718
+ } else {
719
+ if (res && res.code == 203) {
720
+ this.Errormsg = res.error;
721
+ const modalRef = this.modalService.open(this.confirmerror)
722
+ modalRef.result.then((result) => {
723
+ if (result.isConfirmed) {
724
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
725
+ }
726
+ })
727
+ }
728
+
729
+ }
730
+ },
731
+ error: (err: any) => {
732
+ if (err?.code == 400 || err?.code == 204 || err?.code == 404 || err?.code == 500) {
733
+ this.toastr.getErrorToast('File not saved!')
734
+ }
735
+ }
736
+ })
737
+ } else{
738
+ this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
739
+ }
740
+ }else{
741
+
742
+ }
743
+ })
744
+ modalRef.result.finally(() => {
745
+ this.openmodel = false;
746
+ });
747
+ }
748
+ }
749
+
750
+ backtotickets() {
751
+ this.savedraft();
752
+ // this.router.navigate(['/manage/tickets'], { queryParams: { type: 'footfall' } })
753
+
754
+ }
755
+ cameraPreview() {
756
+ // const ModalRef = this.modalService.open(CameraPreviewComponent,{
757
+ // centered: true,
758
+ // size:'lg'
759
+ // })
760
+ }
761
+ }