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

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 +536 -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 +497 -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 +772 -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 +493 -0
  84. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.html +3751 -0
  85. package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.scss +1240 -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 +2863 -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,536 @@
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
+
112
+ if (auditdata.length > 0) {
113
+ this.auditmappingdata = auditdata;
114
+ this.customercount = this.auditmappingdata.length
115
+ } else {
116
+ this.auditmappingdata = []
117
+ this.customercount = 0
118
+ }
119
+ this.demographic = this.auditmappingdata.filter((data: any) => data.demographic === 'd').length;
120
+ }
121
+ this.category.map((data: any) => {
122
+ var count = JSON.parse(sessionStorage.getItem(data?.type) || '{}')
123
+ data.count = count?.length
124
+ })
125
+ if ('retag' in sessionStorage) {
126
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
127
+ if (retagdata.length > 0) {
128
+ this.retagimage = retagdata;
129
+ } else {
130
+ this.retagimage = [];
131
+ if (this.retagimage.length == 0) {
132
+ this.showvalue = false
133
+ }
134
+ }
135
+ }
136
+ if ('totalfiles' in sessionStorage) {
137
+ var files = JSON.parse(sessionStorage.getItem('totalfiles') || '{}')
138
+ this.totalfile = files?.totalfiles
139
+ this.filedetails = files?.filedetails
140
+ }
141
+
142
+ }
143
+
144
+ getmappingdata() {
145
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
146
+ this.filedetails = totalfile?.filedetails
147
+ let tickettype = sessionStorage.getItem('ticketType')
148
+ var payload: any = {
149
+ storeId: totalfile?.filedetails?.storeId,
150
+ fileDate: totalfile?.filedetails?.Date,
151
+ auditId: totalfile?.auditId,
152
+ count: totalfile?.totalfiles,
153
+ tickettype:tickettype
154
+ }
155
+ this.auditService.getAuditmappinglist(payload).pipe(takeUntil(this.destroy$)).subscribe({
156
+ next: (res: any) => {
157
+ if (res && res?.code == 200) {
158
+ this.auditLoading = false;
159
+
160
+
161
+
162
+
163
+ this.category.map((data: any) => {
164
+ let filterData = res?.data?.result?.draftedData?.filter((x: any) => x.type === data.type)
165
+ data.value = filterData[0]?.value && filterData[0]?.value.length > 0 ? filterData[0]?.value : []
166
+ data.count = data?.value?.length
167
+ sessionStorage.setItem(data?.type, JSON.stringify(data?.value && data?.value.length > 0 ? data?.value : []))
168
+
169
+ })
170
+ let customerData = res?.data?.result?.draftedData?.filter((x: any) => x.type === 'customer')
171
+
172
+ this.auditmappingdata = customerData[0]?.value
173
+ const jsonString = JSON.stringify(customerData[0]?.value);
174
+ const compressedData = LZString.compress(jsonString);
175
+ sessionStorage.setItem('audit', compressedData)
176
+
177
+
178
+
179
+ var retagiamge = JSON.parse(sessionStorage.getItem('retag') || '[]')
180
+ if (retagiamge.length > 0) {
181
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
182
+ const decompressedData = LZString.decompress(stringifydata);
183
+ var customer = JSON.parse(decompressedData || '{}')
184
+ customer = [...customer, ...retagiamge]
185
+ const jsonString = JSON.stringify(customer);
186
+ const compressedData = LZString.compress(jsonString);
187
+ sessionStorage.setItem('audit', compressedData)
188
+ }
189
+ sessionStorage.removeItem('retag')
190
+ this.retagimage = []
191
+ this.initial_data_loading()
192
+ if (this.retagimage.length == 0) {
193
+ this.showvalue = false
194
+ }
195
+ }
196
+ },
197
+ error: (err: any) => {
198
+
199
+ }
200
+ })
201
+ }
202
+
203
+ redireact: boolean = false;
204
+
205
+ backToTagging() {
206
+ this.redireact = true;
207
+ this.saveDraftimg();
208
+ }
209
+
210
+ changesdata() {
211
+ var user = JSON.parse(localStorage.getItem('user-info') || '{}')
212
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
213
+ var payload: any = {
214
+ storeId: totalfile?.filedetails?.storeId,
215
+ fileDate: totalfile?.filedetails?.Date,
216
+ auditId: totalfile?.auditId,
217
+ count: totalfile?.totalfiles
218
+ }
219
+ this.auditService.getAuditmappinglist(payload).pipe(takeUntil(this.destroy$)).subscribe({
220
+ next: (res: any) => {
221
+ if (res && res?.code == 200) {
222
+ this.auditLoading = false;
223
+ sessionStorage.removeItem('retag')
224
+ this.retagimage = []
225
+ this.category.map((data: any) => {
226
+ let filterData = res?.data?.result?.draftedData?.filter((x: any) => x.type === data.type)
227
+ data.value = filterData[0]?.value && filterData[0]?.value.length > 0 ? filterData[0]?.value : []
228
+ data.count = data?.value?.length
229
+ sessionStorage.setItem(data?.type, JSON.stringify(data?.value && data?.value.length > 0 ? data?.value : []))
230
+
231
+ })
232
+ let customerData = res?.data?.result?.draftedData?.filter((x: any) => x.type === 'customer')
233
+
234
+ this.auditmappingdata = customerData[0]?.value
235
+ const jsonString = JSON.stringify(customerData[0]?.value);
236
+ const compressedData = LZString.compress(jsonString);
237
+ sessionStorage.setItem('audit', compressedData)
238
+ if (this.retagimage.length == 0) {
239
+ this.showvalue = false
240
+ }
241
+
242
+ this.router.navigate(["/manage/tickets/audit"])
243
+ }
244
+ },
245
+ error: (err: any) => {
246
+
247
+ }
248
+ })
249
+
250
+ }
251
+
252
+ ngOnChanges(changes: SimpleChanges): void {
253
+ if (changes['auditmappingdata']) {
254
+ this.dummymapping = JSON.parse(JSON.stringify(changes['auditmappingdata'].currentValue));
255
+ }
256
+ }
257
+
258
+ allowDrop(ev: any) {
259
+ ev.preventDefault();
260
+ }
261
+
262
+ drag(ev: any) {
263
+ ev.dataTransfer.setData("text/plain", ev.target.id);
264
+ }
265
+
266
+ dropforretag(ev: any) {
267
+ ev.preventDefault();
268
+ const draggedImageId = ev.dataTransfer.getData('text/plain');
269
+ const draggedImage = document.getElementById(draggedImageId);
270
+ this.showvalue = true;
271
+ const htmltag = ev.dataTransfer.getData('text/html');
272
+ var Name = getTagNameFromHTML(htmltag);
273
+ console.log("🚀 ~ AuditMappingListComponent ~ dropforretag ~ Name:", Name,draggedImageId)
274
+ if (Name != null && this.category.filter((data: any) => data?.type === Name)?.length > 0) {
275
+
276
+ let imageData = JSON.parse(sessionStorage.getItem(Name) || '{}')
277
+ var splicedvalue = imageData.splice(imageData.findIndex(({ img_id }: { img_id: string }) => img_id == draggedImageId), 1);
278
+
279
+ this.category.map((data: any) => {
280
+ if (data?.type == Name) {
281
+ data.value = imageData
282
+ data.count = imageData.length
283
+ }
284
+
285
+ })
286
+ sessionStorage.setItem(Name, JSON.stringify(imageData))
287
+ var oldretag = JSON.parse(sessionStorage.getItem('retag') || '{}')
288
+ var newtag: any = []
289
+ if (Number(oldretag.length) > 0) {
290
+ newtag = [...oldretag, ...splicedvalue]
291
+ } else {
292
+ newtag = splicedvalue
293
+ }
294
+ this.retagimage = newtag
295
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
296
+
297
+
298
+ if(Name==='duplicate'){
299
+ this.auditmappingdata.map((mainData:any)=>{
300
+ if(mainData.count>1){
301
+ console.log("🚀 ~ AuditMappingListComponent ~ dropforretag ~ mainData:", mainData)
302
+ mainData.mappedid = mainData.mappedid.filter((data:any)=>data.img_id!=draggedImageId)
303
+ mainData.count = mainData.mappedid.length
304
+ }
305
+ })
306
+ }
307
+
308
+
309
+
310
+ } else if (Name != null) {
311
+ var insertIndex = this.auditmappingdata.findIndex(({ img_id }: { img_id: string }) => img_id == Name)
312
+ var mainarray = this.auditmappingdata.splice(this.auditmappingdata.findIndex(({ img_id }: { img_id: string }) => img_id == Name), 1);
313
+ this.customercount = this.auditmappingdata?.length;
314
+ if (mainarray?.length > 0 && mainarray[0].mappedid.length > 1) {
315
+ var checkindex = mainarray[0].mappedid.findIndex(({ img_id }: { img_id: string }) => img_id == draggedImageId)
316
+
317
+ var subarray = mainarray[0].mappedid.splice(mainarray[0].mappedid.findIndex(({ img_id }: { img_id: string }) => img_id == draggedImageId), 1);
318
+ if (checkindex == 0) {
319
+ mainarray[0].img_name = mainarray[0].mappedid[0].img_name
320
+ mainarray[0].img_id = mainarray[0].mappedid[0].img_id
321
+ mainarray[0].img_path = mainarray[0].mappedid[0].img_path
322
+ }
323
+ mainarray[0].count = mainarray[0].count - 1
324
+ subarray[0].mappedid = []
325
+ let obj = {
326
+ img_name: subarray[0].img_name,
327
+ img_id: subarray[0].img_id,
328
+ img_path: subarray[0].img_path
329
+ }
330
+ subarray[0].mappedid.push(obj)
331
+ subarray[0].selected = false
332
+ subarray[0].dropped = false
333
+ subarray[0].demographic = ''
334
+ subarray[0].count = 1;
335
+ var oldretag = JSON.parse(sessionStorage.getItem('retag') || '{}')
336
+ var newtag: any = []
337
+ if (Number(oldretag.length) > 0) {
338
+ newtag = [...oldretag, ...subarray]
339
+ } else {
340
+ newtag = subarray
341
+ }
342
+ this.retagimage = newtag
343
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
344
+ this.auditmappingdata.splice(insertIndex, 0, ...mainarray);
345
+ const jsonString = JSON.stringify(this.auditmappingdata);
346
+ const compressedData = LZString.compress(jsonString);
347
+ sessionStorage.setItem('audit', compressedData)
348
+ } else {
349
+
350
+ var oldretag = JSON.parse(sessionStorage.getItem('retag') || '{}')
351
+ var newtag: any = []
352
+ if (Number(oldretag.length) > 0) {
353
+ newtag = [...oldretag, ...mainarray]
354
+ } else {
355
+ newtag = mainarray
356
+ }
357
+ this.retagimage = newtag
358
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
359
+ const jsonString = JSON.stringify(this.auditmappingdata);
360
+ const compressedData = LZString.compress(jsonString);
361
+ sessionStorage.setItem('audit', compressedData)
362
+ }
363
+ }
364
+
365
+ function getTagNameFromHTML(html: any) {
366
+ var tempElement = document.createElement('div');
367
+ tempElement.innerHTML = html;
368
+ var firstChild: any = tempElement.firstChild;
369
+ if (firstChild.hasAttribute('name')) {
370
+ var namePropertyValue = firstChild.getAttribute('name');
371
+ return namePropertyValue;
372
+ }
373
+ return null;
374
+ }
375
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
376
+
377
+ if ('retag' in sessionStorage) {
378
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
379
+ this.retagimage = retagdata;
380
+
381
+ }
382
+ }
383
+
384
+ removeimage(data: any) {
385
+ var removed_img = this.retagimage.filter((ev: any) => ev.img_id == data.img_id)
386
+ this.retagimage.splice(this.retagimage.findIndex(({ img_id }: { img_id: string }) => img_id == data.img_id), 1);
387
+ this.auditmappingdata = [...this.auditmappingdata, ...removed_img]
388
+ this.customercount = this.auditmappingdata?.length;
389
+ if (!this.retagimage.length) { this.showvalue = false }
390
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
391
+ const decompressedData = LZString.decompress(stringifydata);
392
+ const completeDate = JSON.parse(decompressedData || '{}')
393
+ const jsonString = JSON.stringify(this.auditmappingdata);
394
+ const compressedData = LZString.compress(jsonString);
395
+ sessionStorage.setItem('audit', compressedData)
396
+ sessionStorage.setItem('retag', JSON.stringify(this.retagimage))
397
+ this.cd.detectChanges();
398
+ }
399
+
400
+ saveDraftimg() {
401
+ this.submitted = true;
402
+
403
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
404
+ this.timePassed = JSON.parse(sessionStorage.getItem('timeSpent') || '{}')
405
+ if ('retag' in sessionStorage) {
406
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
407
+ this.retagimage = retagdata;
408
+ }
409
+ let storedData = [
410
+ {
411
+ type: "customer",
412
+ value: this.auditmappingdata ? this.auditmappingdata : [],
413
+ }
414
+ ]
415
+
416
+ this.category.map((data: any) => {
417
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '{}');
418
+ storedData.push({
419
+ type: data.type,
420
+ value: sessionvalue && sessionvalue.length > 0 ? sessionvalue : []
421
+ })
422
+ })
423
+ var inserobj: any = {
424
+ storeId: totalfile?.filedetails?.storeId,
425
+ fileDate: totalfile?.filedetails?.Date,
426
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails?.auditId,
427
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
428
+ retagCount: this.retagimage.length,
429
+ timeSpent: this.timePassed,
430
+ retagImage: this.retagimage ? this.retagimage : []
431
+ }
432
+
433
+ this.auditService.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe(() => {
434
+ if (!this.redireact) {
435
+ this.submitted = false;
436
+ this.getmappingdata()
437
+ } else {
438
+ this.changesdata()
439
+ }
440
+ })
441
+ }
442
+
443
+
444
+ taggingview() {
445
+ this.submitted = true;
446
+ var totalfile: any = JSON.parse(sessionStorage.getItem('totalfiles') || '{}');
447
+ this.showvalue = false;
448
+ this.showvalue1 = true;
449
+ this.retggingpage = true;
450
+ let stringifydata = sessionStorage.getItem('audit') || '{}'
451
+ const decompressedData = LZString.decompress(stringifydata);
452
+ var customer = JSON.parse(decompressedData || '{}')
453
+ let storedData = [
454
+ {
455
+ type: "customer",
456
+ value: customer ? customer : [],
457
+ }
458
+ ]
459
+
460
+ this.category.map((data: any) => {
461
+ let sessionvalue = JSON.parse(sessionStorage.getItem(data.type) || '{}');
462
+ storedData.push({
463
+ type: data.type,
464
+ value: sessionvalue && sessionvalue.length > 0 ? sessionvalue : []
465
+ })
466
+ })
467
+ var inserobj: any = {
468
+ storeId: totalfile?.filedetails?.store_id,
469
+ fileDate: totalfile?.filedetails?.file_date,
470
+ auditId: totalfile?.auditId ? totalfile?.auditId : totalfile?.filedetails.auditId,
471
+ totalCount: totalfile?.totalfiles ? totalfile.totalfiles : 0,
472
+ retagCount: this.retagimage.length,
473
+ timeSpent: this.timePassed,
474
+ retagImage: this.retagimage ? this.retagimage : []
475
+ }
476
+
477
+ this.auditService.saveDraft(inserobj).pipe(takeUntil(this.destroy$)).subscribe(() => { this.submitted = false; })
478
+ if ('retag' in sessionStorage) {
479
+ var retagdata = JSON.parse(sessionStorage.getItem('retag') || '{}')
480
+ this.retagimage = retagdata;
481
+
482
+ }
483
+ this.router.navigate(["/manage/tickets/retag-mapping"])
484
+ }
485
+
486
+ submitaudit() {
487
+ const modalRef = this.modalService.open(AuditReportPopupComponent, {
488
+ size: 'lg',
489
+ centered: true
490
+ })
491
+ modalRef.componentInstance.selectedType = this.selectedType;
492
+ }
493
+
494
+
495
+
496
+ setValue(i: any) {
497
+ let index = 0;
498
+ if (i > index) {
499
+ return this.currentValue = this.currentValue + 1;
500
+ }
501
+
502
+ }
503
+ currentGroupNumber: any = 0;
504
+
505
+ getGroupNumber(obj: any): number | null {
506
+ if (obj.count > 1) {
507
+ return ++this.currentGroupNumber;
508
+ }
509
+ return null;
510
+ }
511
+
512
+ resetGroupNumber() {
513
+ this.currentGroupNumber = 0;
514
+ }
515
+
516
+ getFilteredData(count: number) {
517
+ return this.auditmappingdata.filter((obj: any) => obj.count === count);
518
+
519
+ }
520
+
521
+ toggleImage(img_name: any) {
522
+ this.auditmappingdata.map((data: any) => {
523
+ if (data.img_name == img_name) {
524
+ if (data.mappedid.length > 0) {
525
+ data.demographic !== 'd' ? data.demographic = 'd' : data.demographic = ''
526
+ } else {
527
+ data.dropped = !data.dropped
528
+ }
529
+ }
530
+ })
531
+ this.demographic = this.auditmappingdata.filter((data: any) => data.demographic === 'd').length;
532
+ const jsonString = JSON.stringify(this.auditmappingdata);
533
+ const compressedData = LZString.compress(jsonString);
534
+ sessionStorage.setItem('audit', compressedData)
535
+ }
536
+ }