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,520 @@
1
+ import { Component, OnInit, OnChanges, SimpleChanges, OnDestroy, ChangeDetectorRef, ViewChild } from '@angular/core';
2
+ import { ActivatedRoute, Router } from '@angular/router';
3
+ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
4
+ import { ToastService } from 'tango-app-ui-shared';
5
+ import { AuditService } from '../../services/audit.service';
6
+ import * as LZString from 'lz-string';
7
+ // import { AuditReportPopupComponent } from '../audit-report-popup/audit-report-popup.component';
8
+ import { Subject, takeUntil, Subscription } from 'rxjs';
9
+ import { TimerService } from '../../services/timer.service';
10
+ import { AuditReportPopupComponent } from '../audit-report-popup/audit-report-popup.component';
11
+
12
+ @Component({
13
+ selector: 'lib-audit-mapping-list',
14
+ templateUrl: './audit-mapping-list.component.html',
15
+ styleUrl: './audit-mapping-list.component.scss'
16
+ })
17
+ export class AuditMappingListComponent {
18
+
19
+ totalfile = 0;
20
+ customer = 0;
21
+ junk = 0;
22
+ employee = 0;
23
+ currentValue: any = 0;
24
+ showvalue: boolean = false;
25
+ retggingpage: boolean = false;
26
+ showvalue1: boolean = false;
27
+ junkimage: any = []
28
+ retagimage: any = []
29
+ submitvalue: boolean = true;
30
+ auditmappingdata: any;
31
+ customercount: any;
32
+ auditLoading = true;
33
+ selectedType: any;
34
+
35
+ junkcount: any = 0;
36
+ employeecount: any = 0;
37
+ employeimage: any = [];
38
+ filedetails: any;
39
+ demographic: any;
40
+ submitted: boolean = false;
41
+ dummymapping: any;
42
+ private readonly destroy$ = new Subject();
43
+ timePassed: number = 0;
44
+ subscription: Subscription | null = null;
45
+ formattedTime: string = '00:00:00';
46
+ count: any;
47
+ category: any = []
48
+ @ViewChild('confirmDraft') confirmDraft: any;
49
+
50
+ constructor(public modalService: NgbModal, private router: Router, private auditService: AuditService, private toastr: ToastService, private route: ActivatedRoute,
51
+ private cd: ChangeDetectorRef, private timerService: TimerService) {
52
+ this.selectedType = this.route.snapshot.paramMap.get('type')
53
+ }
54
+
55
+ ngOnInit(): void {
56
+ this.getAuditConfig()
57
+ // this.initial_data_loading();
58
+ if (this.retagimage.length > 0) {
59
+ this.showvalue = true
60
+ }
61
+ this.setTimer();
62
+ }
63
+ getAuditConfig() {
64
+
65
+ let filedata = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
66
+ this.auditService.getAuditconfig(filedata?.filedetails?.clientId).pipe(takeUntil(this.destroy$)).subscribe({
67
+ next: (res: any) => {
68
+ if (res && res?.code == 200) {
69
+ this.category = res.data.footfallDirectoryConfigs.taggingLimitation
70
+ // this.initial_data_loading()
71
+ // this.saveDraftimg();
72
+ this.getmappingdata()
73
+
74
+ }
75
+ }
76
+ })
77
+ }
78
+ setTimer() {
79
+ this.subscription = this.timerService.getTimePassed().subscribe(time => {
80
+ this.timePassed = time;
81
+ this.formattedTime = this.timerService.formatTime(time);
82
+ this.cd.detectChanges();
83
+ });
84
+ this.timerService.startTimer();
85
+ document.addEventListener('mousemove', this.handleGlobalMouseEvent);
86
+ document.addEventListener('click', this.handleGlobalMouseEvent);
87
+ document.addEventListener('mouseenter', this.handleGlobalMouseEvent);
88
+ document.addEventListener('scroll', this.handleGlobalMouseEvent);
89
+
90
+ }
91
+
92
+ ngOnDestroy(): void {
93
+ this.destroy$.next(true);
94
+ this.destroy$.complete();
95
+ document.removeEventListener('mousemove', this.handleGlobalMouseEvent);
96
+ document.removeEventListener('click', this.handleGlobalMouseEvent);
97
+ document.removeEventListener('mouseenter', this.handleGlobalMouseEvent);
98
+ document.removeEventListener('scroll', this.handleGlobalMouseEvent);
99
+ this.timerService.clearTimer()
100
+ }
101
+
102
+ handleGlobalMouseEvent = (): void => {
103
+ this.timerService.startTimer();
104
+ }
105
+
106
+ initial_data_loading() {
107
+ if ('audit' in sessionStorage) {
108
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
109
+ const decompressedData = LZString.decompress(stringifydata);
110
+ var auditdata = JSON.parse(decompressedData || '{}')
111
+ if (auditdata.length > 0) {
112
+ this.auditmappingdata = auditdata;
113
+ this.customercount = this.auditmappingdata.length
114
+ } else {
115
+ this.auditmappingdata = []
116
+ this.customercount = 0
117
+ }
118
+ this.demographic = this.auditmappingdata.filter((data: any) => data.demographic === 'd').length;
119
+ }
120
+ this.category.map((data: any) => {
121
+ var count = JSON.parse(sessionStorage.getItem(data?.type) || '{}')
122
+ data.count = count?.length
123
+ })
124
+ if ('retag' in sessionStorage) {
125
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
126
+ if (retagdata.length > 0) {
127
+ this.retagimage = retagdata;
128
+ } else {
129
+ this.retagimage = [];
130
+ if (this.retagimage.length == 0) {
131
+ this.showvalue = false
132
+ }
133
+ }
134
+ }
135
+ if ('totalfiles' in sessionStorage) {
136
+ var files = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
137
+ this.totalfile = files?.totalfiles
138
+ this.filedetails = files?.filedetails
139
+ }
140
+
141
+ }
142
+
143
+ getmappingdata() {
144
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
145
+ this.filedetails = totalfile?.filedetails
146
+
147
+ var payload: any = {
148
+ storeId: totalfile?.filedetails?.storeId,
149
+ fileDate: totalfile?.filedetails?.Date,
150
+ auditId: totalfile?.auditId,
151
+ count: totalfile?.totalfiles
152
+ }
153
+ this.auditService.getAuditmappinglist(payload).pipe(takeUntil(this.destroy$)).subscribe({
154
+ next: (res: any) => {
155
+ if (res && res?.code == 200) {
156
+ this.auditLoading = false;
157
+
158
+
159
+
160
+
161
+ this.category.map((data: any) => {
162
+ let filterData = res?.data?.result?.draftedData?.filter((x: any) => x.type === data.type)
163
+ data.value = filterData[0]?.value && filterData[0]?.value.length > 0 ? filterData[0]?.value : []
164
+ data.count = data?.value?.length
165
+ sessionStorage.setItem(data?.type, JSON.stringify(data?.value && data?.value.length > 0 ? data?.value : []))
166
+
167
+ })
168
+ let customerData = res?.data?.result?.draftedData?.filter((x: any) => x.type === 'customer')
169
+
170
+ this.auditmappingdata = customerData[0]?.value
171
+ const jsonString = JSON.stringify(customerData[0]?.value);
172
+ const compressedData = LZString.compress(jsonString);
173
+ sessionStorage.setItem('audit', compressedData)
174
+
175
+
176
+
177
+ var retagiamge = JSON.parse(sessionStorage.getItem('retag') || '[]')
178
+ if (retagiamge.length > 0) {
179
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
180
+ const decompressedData = LZString.decompress(stringifydata);
181
+ var customer = JSON.parse(decompressedData || '{}')
182
+ customer = [...customer, ...retagiamge]
183
+ const jsonString = JSON.stringify(customer);
184
+ const compressedData = LZString.compress(jsonString);
185
+ sessionStorage.setItem('audit', compressedData)
186
+ }
187
+ sessionStorage.removeItem('retag')
188
+ this.retagimage = []
189
+ this.initial_data_loading()
190
+ if (this.retagimage.length == 0) {
191
+ this.showvalue = false
192
+ }
193
+ }
194
+ },
195
+ error: (err: any) => {
196
+
197
+ }
198
+ })
199
+ }
200
+
201
+ redireact: boolean = false;
202
+
203
+ backToTagging() {
204
+ this.redireact = true;
205
+ this.saveDraftimg();
206
+ }
207
+
208
+ changesdata() {
209
+ var user = JSON.parse(localStorage.getItem('user-info') || '{}')
210
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
211
+ var payload: any = {
212
+ storeId: totalfile?.filedetails?.storeId,
213
+ fileDate: totalfile?.filedetails?.Date,
214
+ auditId: totalfile?.auditId,
215
+ count: totalfile?.totalfiles
216
+ }
217
+ this.auditService.getAuditmappinglist(payload).pipe(takeUntil(this.destroy$)).subscribe({
218
+ next: (res: any) => {
219
+ if (res && res?.code == 200) {
220
+ this.auditLoading = false;
221
+ sessionStorage.removeItem('retag')
222
+ this.retagimage = []
223
+ this.category.map((data: any) => {
224
+ let filterData = res?.data?.result?.draftedData?.filter((x: any) => x.type === data.type)
225
+ data.value = filterData[0]?.value && filterData[0]?.value.length > 0 ? filterData[0]?.value : []
226
+ data.count = data?.value?.length
227
+ sessionStorage.setItem(data?.type, JSON.stringify(data?.value && data?.value.length > 0 ? data?.value : []))
228
+
229
+ })
230
+ let customerData = res?.data?.result?.draftedData?.filter((x: any) => x.type === 'customer')
231
+
232
+ this.auditmappingdata = customerData[0]?.value
233
+ const jsonString = JSON.stringify(customerData[0]?.value);
234
+ const compressedData = LZString.compress(jsonString);
235
+ sessionStorage.setItem('audit', compressedData)
236
+ if (this.retagimage.length == 0) {
237
+ this.showvalue = false
238
+ }
239
+
240
+ this.router.navigate(["/manage/tickets/audit"])
241
+ }
242
+ },
243
+ error: (err: any) => {
244
+
245
+ }
246
+ })
247
+
248
+ }
249
+
250
+ ngOnChanges(changes: SimpleChanges): void {
251
+ if (changes['auditmappingdata']) {
252
+ this.dummymapping = JSON.parse(JSON.stringify(changes['auditmappingdata'].currentValue));
253
+ }
254
+ }
255
+
256
+ allowDrop(ev: any) {
257
+ ev.preventDefault();
258
+ }
259
+
260
+ drag(ev: any) {
261
+ ev.dataTransfer.setData("text/plain", ev.target.id);
262
+ }
263
+
264
+ dropforretag(ev: any) {
265
+ ev.preventDefault();
266
+ const draggedImageId = ev.dataTransfer.getData('text/plain');
267
+ const draggedImage = document.getElementById(draggedImageId);
268
+ this.showvalue = true;
269
+ const htmltag = ev.dataTransfer.getData('text/html');
270
+ var Name = getTagNameFromHTML(htmltag);
271
+ if (Name != null && this.category.filter((data: any) => data?.type === Name)?.length > 0) {
272
+
273
+ let imageData = JSON.parse(sessionStorage.getItem(Name) || '{}')
274
+ var splicedvalue = imageData.splice(imageData.findIndex(({ img_id }: { img_id: string }) => img_id == draggedImageId), 1);
275
+
276
+ this.category.map((data: any) => {
277
+ if (data?.type == Name) {
278
+ data.value = imageData
279
+ data.count = imageData.length
280
+ }
281
+
282
+ })
283
+ sessionStorage.setItem(Name, JSON.stringify(imageData))
284
+ var oldretag = JSON.parse(sessionStorage.getItem('retag') || '{}')
285
+ var newtag: any = []
286
+ if (Number(oldretag.length) > 0) {
287
+ newtag = [...oldretag, ...splicedvalue]
288
+ } else {
289
+ newtag = splicedvalue
290
+ }
291
+ this.retagimage = newtag
292
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
293
+
294
+ } else if (Name != null) {
295
+ var insertIndex = this.auditmappingdata.findIndex(({ img_id }: { img_id: string }) => img_id == Name)
296
+ var mainarray = this.auditmappingdata.splice(this.auditmappingdata.findIndex(({ img_id }: { img_id: string }) => img_id == Name), 1);
297
+ this.customercount = this.auditmappingdata?.length;
298
+ if (mainarray?.length > 0 && mainarray[0].mappedid.length > 1) {
299
+ var checkindex = mainarray[0].mappedid.findIndex(({ img_id }: { img_id: string }) => img_id == draggedImageId)
300
+
301
+ var subarray = mainarray[0].mappedid.splice(mainarray[0].mappedid.findIndex(({ img_id }: { img_id: string }) => img_id == draggedImageId), 1);
302
+ if (checkindex == 0) {
303
+ mainarray[0].img_name = mainarray[0].mappedid[0].img_name
304
+ mainarray[0].img_id = mainarray[0].mappedid[0].img_id
305
+ mainarray[0].img_path = mainarray[0].mappedid[0].img_path
306
+ }
307
+ mainarray[0].count = mainarray[0].count - 1
308
+ subarray[0].mappedid = []
309
+ let obj = {
310
+ img_name: subarray[0].img_name,
311
+ img_id: subarray[0].img_id,
312
+ img_path: subarray[0].img_path
313
+ }
314
+ subarray[0].mappedid.push(obj)
315
+ subarray[0].selected = false
316
+ subarray[0].dropped = false
317
+ subarray[0].demographic = ''
318
+ subarray[0].count = 1;
319
+ var oldretag = JSON.parse(sessionStorage.getItem('retag') || '{}')
320
+ var newtag: any = []
321
+ if (Number(oldretag.length) > 0) {
322
+ newtag = [...oldretag, ...subarray]
323
+ } else {
324
+ newtag = subarray
325
+ }
326
+ this.retagimage = newtag
327
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
328
+ this.auditmappingdata.splice(insertIndex, 0, ...mainarray);
329
+ const jsonString = JSON.stringify(this.auditmappingdata);
330
+ const compressedData = LZString.compress(jsonString);
331
+ sessionStorage.setItem('audit', compressedData)
332
+ } else {
333
+
334
+ var oldretag = JSON.parse(sessionStorage.getItem('retag') || '{}')
335
+ var newtag: any = []
336
+ if (Number(oldretag.length) > 0) {
337
+ newtag = [...oldretag, ...mainarray]
338
+ } else {
339
+ newtag = mainarray
340
+ }
341
+ this.retagimage = newtag
342
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
343
+ const jsonString = JSON.stringify(this.auditmappingdata);
344
+ const compressedData = LZString.compress(jsonString);
345
+ sessionStorage.setItem('audit', compressedData)
346
+ }
347
+ }
348
+
349
+ function getTagNameFromHTML(html: any) {
350
+ var tempElement = document.createElement('div');
351
+ tempElement.innerHTML = html;
352
+ var firstChild: any = tempElement.firstChild;
353
+ if (firstChild.hasAttribute('name')) {
354
+ var namePropertyValue = firstChild.getAttribute('name');
355
+ return namePropertyValue;
356
+ }
357
+ return null;
358
+ }
359
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
360
+
361
+ if ('retag' in sessionStorage) {
362
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
363
+ this.retagimage = retagdata;
364
+
365
+ }
366
+ }
367
+
368
+ removeimage(data: any) {
369
+ var removed_img = this.retagimage.filter((ev: any) => ev.img_id == data.img_id)
370
+ this.retagimage.splice(this.retagimage.findIndex(({ img_id }: { img_id: string }) => img_id == data.img_id), 1);
371
+ this.auditmappingdata = [...this.auditmappingdata, ...removed_img]
372
+ this.customercount = this.auditmappingdata?.length;
373
+ if (!this.retagimage.length) { this.showvalue = false }
374
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
375
+ const decompressedData = LZString.decompress(stringifydata);
376
+ const completeDate = JSON.parse(decompressedData || '{}')
377
+ const jsonString = JSON.stringify(this.auditmappingdata);
378
+ const compressedData = LZString.compress(jsonString);
379
+ sessionStorage.setItem('audit', compressedData)
380
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
381
+ this.cd.detectChanges();
382
+ }
383
+
384
+ saveDraftimg() {
385
+ this.submitted = true;
386
+
387
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
388
+ this.timePassed = JSON.parse(sessionStorage.getItem('timeSpent') || '{}')
389
+ if ('retag' in sessionStorage) {
390
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
391
+ this.retagimage = retagdata;
392
+ }
393
+ let storedData = [
394
+ {
395
+ type: "customer",
396
+ value: this.auditmappingdata ? this.auditmappingdata : [],
397
+ }
398
+ ]
399
+
400
+ this.category.map((data: any) => {
401
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '{}');
402
+ storedData.push({
403
+ type: data.type,
404
+ value: sessionvalue && sessionvalue.length > 0 ? sessionvalue : []
405
+ })
406
+ })
407
+ var inserobj: any = {
408
+ storeId: totalfile?.filedetails?.storeId,
409
+ fileDate: totalfile?.filedetails?.Date,
410
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails?.auditId,
411
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
412
+ retagCount: this.retagimage.length,
413
+ timeSpent: this.timePassed,
414
+ retagImage: this.retagimage ? this.retagimage : []
415
+ }
416
+
417
+ this.auditService.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe(() => {
418
+ if (!this.redireact) {
419
+ this.submitted = false;
420
+ this.getmappingdata()
421
+ } else {
422
+ this.changesdata()
423
+ }
424
+ })
425
+ }
426
+
427
+
428
+ taggingview() {
429
+ this.submitted = true;
430
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
431
+ this.showvalue = false;
432
+ this.showvalue1 = true;
433
+ this.retggingpage = true;
434
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
435
+ const decompressedData = LZString.decompress(stringifydata);
436
+ var customer = JSON.parse(decompressedData || '{}')
437
+ let storedData = [
438
+ {
439
+ type: "customer",
440
+ value: customer ? customer : [],
441
+ }
442
+ ]
443
+
444
+ this.category.map((data: any) => {
445
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '{}');
446
+ storedData.push({
447
+ type: data.type,
448
+ value: sessionvalue && sessionvalue.length > 0 ? sessionvalue : []
449
+ })
450
+ })
451
+ var inserobj: any = {
452
+ storeId: totalfile?.filedetails?.store_id,
453
+ fileDate: totalfile?.filedetails?.file_date,
454
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails.auditId,
455
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
456
+ retagCount: this.retagimage.length,
457
+ timeSpent: this.timePassed,
458
+ retagImage: this.retagimage ? this.retagimage : []
459
+ }
460
+
461
+ this.auditService.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe(() => { this.submitted = false; })
462
+ if ('retag' in sessionStorage) {
463
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
464
+ this.retagimage = retagdata;
465
+
466
+ }
467
+ this.router.navigate(["/manage/tickets/retag-mapping"])
468
+ }
469
+
470
+ submitaudit() {
471
+ const modalRef = this.modalService.open(AuditReportPopupComponent, {
472
+ size: 'lg',
473
+ centered: true
474
+ })
475
+ modalRef.componentInstance.selectedType = this.selectedType;
476
+ }
477
+
478
+
479
+
480
+ setValue(i: any) {
481
+ let index = 0;
482
+ if (i > index) {
483
+ return this.currentValue = this.currentValue + 1;
484
+ }
485
+
486
+ }
487
+ currentGroupNumber: any = 0;
488
+
489
+ getGroupNumber(obj: any): number | null {
490
+ if (obj.count > 1) {
491
+ return ++this.currentGroupNumber;
492
+ }
493
+ return null;
494
+ }
495
+
496
+ resetGroupNumber() {
497
+ this.currentGroupNumber = 0;
498
+ }
499
+
500
+ getFilteredData(count: number) {
501
+ return this.auditmappingdata.filter((obj: any) => obj.count === count);
502
+
503
+ }
504
+
505
+ toggleImage(img_name: any) {
506
+ this.auditmappingdata.map((data: any) => {
507
+ if (data.img_name == img_name) {
508
+ if (data.mappedid.length > 0) {
509
+ data.demographic !== 'd' ? data.demographic = 'd' : data.demographic = ''
510
+ } else {
511
+ data.dropped = !data.dropped
512
+ }
513
+ }
514
+ })
515
+ this.demographic = this.auditmappingdata.filter((data: any) => data.demographic === 'd').length;
516
+ const jsonString = JSON.stringify(this.auditmappingdata);
517
+ const compressedData = LZString.compress(jsonString);
518
+ sessionStorage.setItem('audit', compressedData)
519
+ }
520
+ }