tango-app-ui-manage-tickets 3.7.0-beta.61 → 3.7.0-beta.62
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.
- package/esm2022/lib/components/add-csm-modal/add-csm-modal.component.mjs +98 -0
- package/esm2022/lib/components/audit-log/audit-log.component.mjs +11 -0
- package/esm2022/lib/components/audit-mapping-list/audit-mapping-list.component.mjs +486 -0
- package/esm2022/lib/components/audit-metrics/audit-metrics.component.mjs +298 -0
- package/esm2022/lib/components/audit-report-popup/audit-report-popup.component.mjs +389 -0
- package/esm2022/lib/components/audit-retag/audit-retag.component.mjs +472 -0
- package/esm2022/lib/components/comment-model/comment-model.component.mjs +58 -0
- package/esm2022/lib/components/count/count.component.mjs +89 -0
- package/esm2022/lib/components/custom-select/custom-select.component.mjs +187 -0
- package/esm2022/lib/components/filter-options/filter-options.component.mjs +41 -0
- package/esm2022/lib/components/footfall-dic/footfall-dic.component.mjs +1061 -0
- package/esm2022/lib/components/footfall-dicview/footfall-dicview.component.mjs +1014 -0
- package/esm2022/lib/components/footfall-popup/footfall-popup.component.mjs +15 -0
- package/esm2022/lib/components/group-select/group-select.component.mjs +155 -0
- package/esm2022/lib/components/re-trigger/re-trigger.component.mjs +96 -0
- package/esm2022/lib/components/reactive-select/reactive-select.component.mjs +108 -0
- package/esm2022/lib/components/remove-audit/remove-audit.component.mjs +81 -0
- package/esm2022/lib/components/start-audit/start-audit.component.mjs +761 -0
- package/esm2022/lib/components/tango-manage-tickets/tango-manage-tickets.component.mjs +131 -0
- package/esm2022/lib/components/ticket-filter-panel/ticket-filter-panel.component.mjs +435 -0
- package/esm2022/lib/components/ticket-footfall-new/ticket-footfall-new.component.mjs +2748 -0
- package/esm2022/lib/components/ticketclosepopup/ticketclosepopup.component.mjs +43 -0
- package/esm2022/lib/components/tickets/tickets.component.mjs +847 -0
- package/esm2022/lib/components/viewcategory/viewcategory.component.mjs +89 -0
- package/esm2022/lib/services/audit.service.mjs +88 -0
- package/esm2022/lib/services/excel.service.mjs +45 -0
- package/esm2022/lib/services/ticket.service.mjs +319 -0
- package/esm2022/lib/services/timer.service.mjs +84 -0
- package/esm2022/lib/tango-manage-tickets-routing.module.mjs +44 -0
- package/esm2022/lib/tango-manage-tickets.module.mjs +109 -0
- package/esm2022/public-api.mjs +6 -0
- package/esm2022/tango-app-ui-manage-tickets.mjs +5 -0
- package/fesm2022/tango-app-ui-manage-tickets.mjs +10165 -0
- package/fesm2022/tango-app-ui-manage-tickets.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/add-csm-modal/add-csm-modal.component.d.ts +30 -0
- package/lib/components/audit-log/audit-log.component.d.ts +5 -0
- package/lib/components/audit-mapping-list/audit-mapping-list.component.d.ts +73 -0
- package/lib/components/audit-metrics/audit-metrics.component.d.ts +59 -0
- package/lib/components/audit-report-popup/audit-report-popup.component.d.ts +52 -0
- package/lib/components/audit-retag/audit-retag.component.d.ts +59 -0
- package/lib/components/comment-model/comment-model.component.d.ts +17 -0
- package/lib/components/count/count.component.d.ts +23 -0
- package/lib/components/custom-select/custom-select.component.d.ts +35 -0
- package/lib/components/filter-options/filter-options.component.d.ts +15 -0
- package/lib/components/footfall-dic/footfall-dic.component.d.ts +143 -0
- package/lib/components/footfall-dicview/footfall-dicview.component.d.ts +132 -0
- package/lib/components/footfall-popup/footfall-popup.component.d.ts +8 -0
- package/lib/components/group-select/group-select.component.d.ts +33 -0
- package/lib/components/re-trigger/re-trigger.component.d.ts +32 -0
- package/lib/components/reactive-select/reactive-select.component.d.ts +32 -0
- package/lib/components/remove-audit/remove-audit.component.d.ts +16 -0
- package/lib/components/start-audit/start-audit.component.d.ts +86 -0
- package/lib/components/tango-manage-tickets/tango-manage-tickets.component.d.ts +28 -0
- package/lib/components/ticket-filter-panel/ticket-filter-panel.component.d.ts +79 -0
- package/lib/components/ticket-footfall-new/ticket-footfall-new.component.d.ts +287 -0
- package/lib/components/ticketclosepopup/ticketclosepopup.component.d.ts +15 -0
- package/lib/components/tickets/tickets.component.d.ts +88 -0
- package/lib/components/viewcategory/viewcategory.component.d.ts +16 -0
- package/lib/services/audit.service.d.ts +36 -0
- package/lib/services/excel.service.d.ts +10 -0
- package/lib/services/ticket.service.d.ts +87 -0
- package/lib/services/timer.service.d.ts +22 -0
- package/lib/tango-manage-tickets-routing.module.d.ts +7 -0
- package/lib/tango-manage-tickets.module.d.ts +38 -0
- package/package.json +25 -12
- package/{src/public-api.ts → public-api.d.ts} +2 -8
- package/.eslintrc.json +0 -37
- package/ng-package.json +0 -7
- package/src/lib/components/add-csm-modal/add-csm-modal.component.html +0 -32
- package/src/lib/components/add-csm-modal/add-csm-modal.component.scss +0 -14
- package/src/lib/components/add-csm-modal/add-csm-modal.component.spec.ts +0 -23
- package/src/lib/components/add-csm-modal/add-csm-modal.component.ts +0 -94
- package/src/lib/components/audit-log/audit-log.component.html +0 -1
- package/src/lib/components/audit-log/audit-log.component.scss +0 -0
- package/src/lib/components/audit-log/audit-log.component.spec.ts +0 -23
- package/src/lib/components/audit-log/audit-log.component.ts +0 -10
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.html +0 -234
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.scss +0 -186
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.spec.ts +0 -23
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.ts +0 -520
- package/src/lib/components/audit-metrics/audit-metrics.component.html +0 -345
- package/src/lib/components/audit-metrics/audit-metrics.component.scss +0 -34
- package/src/lib/components/audit-metrics/audit-metrics.component.spec.ts +0 -23
- package/src/lib/components/audit-metrics/audit-metrics.component.ts +0 -292
- package/src/lib/components/audit-report-popup/audit-report-popup.component.html +0 -111
- package/src/lib/components/audit-report-popup/audit-report-popup.component.scss +0 -101
- package/src/lib/components/audit-report-popup/audit-report-popup.component.spec.ts +0 -23
- package/src/lib/components/audit-report-popup/audit-report-popup.component.ts +0 -397
- package/src/lib/components/audit-retag/audit-retag.component.html +0 -129
- package/src/lib/components/audit-retag/audit-retag.component.scss +0 -146
- package/src/lib/components/audit-retag/audit-retag.component.spec.ts +0 -23
- package/src/lib/components/audit-retag/audit-retag.component.ts +0 -489
- package/src/lib/components/comment-model/comment-model.component.html +0 -24
- package/src/lib/components/comment-model/comment-model.component.scss +0 -20
- package/src/lib/components/comment-model/comment-model.component.spec.ts +0 -23
- package/src/lib/components/comment-model/comment-model.component.ts +0 -53
- package/src/lib/components/count/count.component.html +0 -54
- package/src/lib/components/count/count.component.scss +0 -14
- package/src/lib/components/count/count.component.spec.ts +0 -23
- package/src/lib/components/count/count.component.ts +0 -82
- package/src/lib/components/custom-select/custom-select.component.html +0 -134
- package/src/lib/components/custom-select/custom-select.component.scss +0 -204
- package/src/lib/components/custom-select/custom-select.component.spec.ts +0 -23
- package/src/lib/components/custom-select/custom-select.component.ts +0 -189
- package/src/lib/components/filter-options/filter-options.component.html +0 -51
- package/src/lib/components/filter-options/filter-options.component.scss +0 -102
- package/src/lib/components/filter-options/filter-options.component.spec.ts +0 -23
- package/src/lib/components/filter-options/filter-options.component.ts +0 -38
- package/src/lib/components/footfall-dic/footfall-dic.component.html +0 -1275
- package/src/lib/components/footfall-dic/footfall-dic.component.scss +0 -273
- package/src/lib/components/footfall-dic/footfall-dic.component.spec.ts +0 -23
- package/src/lib/components/footfall-dic/footfall-dic.component.ts +0 -1206
- package/src/lib/components/footfall-dicview/footfall-dicview.component.html +0 -1136
- package/src/lib/components/footfall-dicview/footfall-dicview.component.scss +0 -416
- package/src/lib/components/footfall-dicview/footfall-dicview.component.spec.ts +0 -23
- package/src/lib/components/footfall-dicview/footfall-dicview.component.ts +0 -1168
- package/src/lib/components/footfall-popup/footfall-popup.component.html +0 -61
- package/src/lib/components/footfall-popup/footfall-popup.component.scss +0 -20
- package/src/lib/components/footfall-popup/footfall-popup.component.spec.ts +0 -23
- package/src/lib/components/footfall-popup/footfall-popup.component.ts +0 -12
- package/src/lib/components/group-select/group-select.component.html +0 -44
- package/src/lib/components/group-select/group-select.component.scss +0 -144
- package/src/lib/components/group-select/group-select.component.spec.ts +0 -23
- package/src/lib/components/group-select/group-select.component.ts +0 -145
- package/src/lib/components/re-trigger/re-trigger.component.html +0 -53
- package/src/lib/components/re-trigger/re-trigger.component.scss +0 -16
- package/src/lib/components/re-trigger/re-trigger.component.spec.ts +0 -23
- package/src/lib/components/re-trigger/re-trigger.component.ts +0 -96
- package/src/lib/components/reactive-select/reactive-select.component.html +0 -18
- package/src/lib/components/reactive-select/reactive-select.component.scss +0 -52
- package/src/lib/components/reactive-select/reactive-select.component.spec.ts +0 -23
- package/src/lib/components/reactive-select/reactive-select.component.ts +0 -104
- package/src/lib/components/remove-audit/remove-audit.component.html +0 -38
- package/src/lib/components/remove-audit/remove-audit.component.scss +0 -27
- package/src/lib/components/remove-audit/remove-audit.component.spec.ts +0 -23
- package/src/lib/components/remove-audit/remove-audit.component.ts +0 -81
- package/src/lib/components/start-audit/start-audit.component.html +0 -174
- package/src/lib/components/start-audit/start-audit.component.scss +0 -185
- package/src/lib/components/start-audit/start-audit.component.spec.ts +0 -23
- package/src/lib/components/start-audit/start-audit.component.ts +0 -761
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.html +0 -43
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.scss +0 -35
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.spec.ts +0 -23
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.ts +0 -118
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.html +0 -386
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.scss +0 -87
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.spec.ts +0 -23
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.ts +0 -494
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.html +0 -4743
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.scss +0 -1208
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.spec.ts +0 -23
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.ts +0 -3344
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.html +0 -100
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.scss +0 -34
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.spec.ts +0 -23
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.ts +0 -48
- package/src/lib/components/tickets/tickets.component.html +0 -451
- package/src/lib/components/tickets/tickets.component.scss +0 -131
- package/src/lib/components/tickets/tickets.component.spec.ts +0 -23
- package/src/lib/components/tickets/tickets.component.ts +0 -809
- package/src/lib/components/viewcategory/viewcategory.component.html +0 -38
- package/src/lib/components/viewcategory/viewcategory.component.scss +0 -29
- package/src/lib/components/viewcategory/viewcategory.component.spec.ts +0 -23
- package/src/lib/components/viewcategory/viewcategory.component.ts +0 -79
- package/src/lib/services/audit.service.spec.ts +0 -16
- package/src/lib/services/audit.service.ts +0 -98
- package/src/lib/services/excel.service.ts +0 -48
- package/src/lib/services/ticket.service.spec.ts +0 -16
- package/src/lib/services/ticket.service.ts +0 -501
- package/src/lib/services/timer.service.spec.ts +0 -16
- package/src/lib/services/timer.service.ts +0 -92
- package/src/lib/tango-manage-tickets-routing.module.ts +0 -37
- package/src/lib/tango-manage-tickets.module.ts +0 -68
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -1,761 +0,0 @@
|
|
|
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
|
-
}
|