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.
- package/.eslintrc.json +37 -0
- package/ng-package.json +7 -0
- package/package.json +12 -25
- package/src/lib/components/add-csm-modal/add-csm-modal.component.html +32 -0
- package/src/lib/components/add-csm-modal/add-csm-modal.component.scss +14 -0
- package/src/lib/components/add-csm-modal/add-csm-modal.component.spec.ts +23 -0
- package/src/lib/components/add-csm-modal/add-csm-modal.component.ts +94 -0
- package/src/lib/components/audit-log/audit-log.component.html +1 -0
- package/src/lib/components/audit-log/audit-log.component.scss +0 -0
- package/src/lib/components/audit-log/audit-log.component.spec.ts +23 -0
- package/src/lib/components/audit-log/audit-log.component.ts +10 -0
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.html +234 -0
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.scss +186 -0
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.spec.ts +23 -0
- package/src/lib/components/audit-mapping-list/audit-mapping-list.component.ts +520 -0
- package/src/lib/components/audit-metrics/audit-metrics.component.html +345 -0
- package/src/lib/components/audit-metrics/audit-metrics.component.scss +34 -0
- package/src/lib/components/audit-metrics/audit-metrics.component.spec.ts +23 -0
- package/src/lib/components/audit-metrics/audit-metrics.component.ts +292 -0
- package/src/lib/components/audit-report-popup/audit-report-popup.component.html +111 -0
- package/src/lib/components/audit-report-popup/audit-report-popup.component.scss +101 -0
- package/src/lib/components/audit-report-popup/audit-report-popup.component.spec.ts +23 -0
- package/src/lib/components/audit-report-popup/audit-report-popup.component.ts +397 -0
- package/src/lib/components/audit-retag/audit-retag.component.html +129 -0
- package/src/lib/components/audit-retag/audit-retag.component.scss +146 -0
- package/src/lib/components/audit-retag/audit-retag.component.spec.ts +23 -0
- package/src/lib/components/audit-retag/audit-retag.component.ts +489 -0
- package/src/lib/components/comment-model/comment-model.component.html +24 -0
- package/src/lib/components/comment-model/comment-model.component.scss +20 -0
- package/src/lib/components/comment-model/comment-model.component.spec.ts +23 -0
- package/src/lib/components/comment-model/comment-model.component.ts +53 -0
- package/src/lib/components/count/count.component.html +54 -0
- package/src/lib/components/count/count.component.scss +14 -0
- package/src/lib/components/count/count.component.spec.ts +23 -0
- package/src/lib/components/count/count.component.ts +82 -0
- package/src/lib/components/custom-select/custom-select.component.html +134 -0
- package/src/lib/components/custom-select/custom-select.component.scss +204 -0
- package/src/lib/components/custom-select/custom-select.component.spec.ts +23 -0
- package/src/lib/components/custom-select/custom-select.component.ts +189 -0
- package/src/lib/components/filter-options/filter-options.component.html +51 -0
- package/src/lib/components/filter-options/filter-options.component.scss +102 -0
- package/src/lib/components/filter-options/filter-options.component.spec.ts +23 -0
- package/src/lib/components/filter-options/filter-options.component.ts +38 -0
- package/src/lib/components/footfall-dic/footfall-dic.component.html +1275 -0
- package/src/lib/components/footfall-dic/footfall-dic.component.scss +273 -0
- package/src/lib/components/footfall-dic/footfall-dic.component.spec.ts +23 -0
- package/src/lib/components/footfall-dic/footfall-dic.component.ts +1206 -0
- package/src/lib/components/footfall-dicview/footfall-dicview.component.html +1136 -0
- package/src/lib/components/footfall-dicview/footfall-dicview.component.scss +416 -0
- package/src/lib/components/footfall-dicview/footfall-dicview.component.spec.ts +23 -0
- package/src/lib/components/footfall-dicview/footfall-dicview.component.ts +1168 -0
- package/src/lib/components/footfall-popup/footfall-popup.component.html +61 -0
- package/src/lib/components/footfall-popup/footfall-popup.component.scss +20 -0
- package/src/lib/components/footfall-popup/footfall-popup.component.spec.ts +23 -0
- package/src/lib/components/footfall-popup/footfall-popup.component.ts +12 -0
- package/src/lib/components/group-select/group-select.component.html +44 -0
- package/src/lib/components/group-select/group-select.component.scss +144 -0
- package/src/lib/components/group-select/group-select.component.spec.ts +23 -0
- package/src/lib/components/group-select/group-select.component.ts +145 -0
- package/src/lib/components/re-trigger/re-trigger.component.html +53 -0
- package/src/lib/components/re-trigger/re-trigger.component.scss +16 -0
- package/src/lib/components/re-trigger/re-trigger.component.spec.ts +23 -0
- package/src/lib/components/re-trigger/re-trigger.component.ts +96 -0
- package/src/lib/components/reactive-select/reactive-select.component.html +18 -0
- package/src/lib/components/reactive-select/reactive-select.component.scss +52 -0
- package/src/lib/components/reactive-select/reactive-select.component.spec.ts +23 -0
- package/src/lib/components/reactive-select/reactive-select.component.ts +104 -0
- package/src/lib/components/remove-audit/remove-audit.component.html +38 -0
- package/src/lib/components/remove-audit/remove-audit.component.scss +27 -0
- package/src/lib/components/remove-audit/remove-audit.component.spec.ts +23 -0
- package/src/lib/components/remove-audit/remove-audit.component.ts +81 -0
- package/src/lib/components/start-audit/start-audit.component.html +174 -0
- package/src/lib/components/start-audit/start-audit.component.scss +185 -0
- package/src/lib/components/start-audit/start-audit.component.spec.ts +23 -0
- package/src/lib/components/start-audit/start-audit.component.ts +761 -0
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.html +43 -0
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.scss +35 -0
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.spec.ts +23 -0
- package/src/lib/components/tango-manage-tickets/tango-manage-tickets.component.ts +118 -0
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.html +386 -0
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.scss +87 -0
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.spec.ts +23 -0
- package/src/lib/components/ticket-filter-panel/ticket-filter-panel.component.ts +494 -0
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.html +4743 -0
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.scss +1208 -0
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.spec.ts +23 -0
- package/src/lib/components/ticket-footfall-new/ticket-footfall-new.component.ts +3351 -0
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.html +100 -0
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.scss +34 -0
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.spec.ts +23 -0
- package/src/lib/components/ticketclosepopup/ticketclosepopup.component.ts +48 -0
- package/src/lib/components/tickets/tickets.component.html +451 -0
- package/src/lib/components/tickets/tickets.component.scss +131 -0
- package/src/lib/components/tickets/tickets.component.spec.ts +23 -0
- package/src/lib/components/tickets/tickets.component.ts +809 -0
- package/src/lib/components/viewcategory/viewcategory.component.html +38 -0
- package/src/lib/components/viewcategory/viewcategory.component.scss +29 -0
- package/src/lib/components/viewcategory/viewcategory.component.spec.ts +23 -0
- package/src/lib/components/viewcategory/viewcategory.component.ts +79 -0
- package/src/lib/services/audit.service.spec.ts +16 -0
- package/src/lib/services/audit.service.ts +98 -0
- package/src/lib/services/excel.service.ts +48 -0
- package/src/lib/services/ticket.service.spec.ts +16 -0
- package/src/lib/services/ticket.service.ts +501 -0
- package/src/lib/services/timer.service.spec.ts +16 -0
- package/src/lib/services/timer.service.ts +92 -0
- package/src/lib/tango-manage-tickets-routing.module.ts +37 -0
- package/src/lib/tango-manage-tickets.module.ts +68 -0
- package/{public-api.d.ts → src/public-api.ts} +8 -2
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2022/lib/components/add-csm-modal/add-csm-modal.component.mjs +0 -98
- package/esm2022/lib/components/audit-log/audit-log.component.mjs +0 -11
- package/esm2022/lib/components/audit-metrics/audit-metrics.component.mjs +0 -298
- package/esm2022/lib/components/comment-model/comment-model.component.mjs +0 -58
- package/esm2022/lib/components/count/count.component.mjs +0 -89
- package/esm2022/lib/components/footfall-dic/footfall-dic.component.mjs +0 -894
- package/esm2022/lib/components/group-select/group-select.component.mjs +0 -155
- package/esm2022/lib/components/re-trigger/re-trigger.component.mjs +0 -96
- package/esm2022/lib/components/reactive-select/reactive-select.component.mjs +0 -108
- package/esm2022/lib/components/tango-manage-tickets/tango-manage-tickets.component.mjs +0 -127
- package/esm2022/lib/components/tickets/tickets.component.mjs +0 -793
- package/esm2022/lib/services/excel.service.mjs +0 -45
- package/esm2022/lib/services/ticket.service.mjs +0 -158
- package/esm2022/lib/tango-manage-tickets-routing.module.mjs +0 -24
- package/esm2022/lib/tango-manage-tickets.module.mjs +0 -54
- package/esm2022/public-api.mjs +0 -6
- package/esm2022/tango-app-ui-manage-tickets.mjs +0 -5
- package/fesm2022/tango-app-ui-manage-tickets.mjs +0 -2914
- package/fesm2022/tango-app-ui-manage-tickets.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/add-csm-modal/add-csm-modal.component.d.ts +0 -30
- package/lib/components/audit-log/audit-log.component.d.ts +0 -5
- package/lib/components/audit-metrics/audit-metrics.component.d.ts +0 -59
- package/lib/components/comment-model/comment-model.component.d.ts +0 -17
- package/lib/components/count/count.component.d.ts +0 -23
- package/lib/components/footfall-dic/footfall-dic.component.d.ts +0 -130
- package/lib/components/group-select/group-select.component.d.ts +0 -33
- package/lib/components/re-trigger/re-trigger.component.d.ts +0 -32
- package/lib/components/reactive-select/reactive-select.component.d.ts +0 -32
- package/lib/components/tango-manage-tickets/tango-manage-tickets.component.d.ts +0 -27
- package/lib/components/tickets/tickets.component.d.ts +0 -84
- package/lib/services/excel.service.d.ts +0 -10
- package/lib/services/ticket.service.d.ts +0 -49
- package/lib/tango-manage-tickets-routing.module.d.ts +0 -7
- package/lib/tango-manage-tickets.module.d.ts +0 -21
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { TicketFilterPanelComponent } from './ticket-filter-panel.component';
|
|
4
|
+
|
|
5
|
+
describe('TicketFilterPanelComponent', () => {
|
|
6
|
+
let component: TicketFilterPanelComponent;
|
|
7
|
+
let fixture: ComponentFixture<TicketFilterPanelComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [TicketFilterPanelComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(TicketFilterPanelComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
3
|
+
import { TicketService } from '../../services/ticket.service';
|
|
4
|
+
|
|
5
|
+
type Condition = 'gt' | 'lt' | 'gte' | 'lte' | 'between';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'lib-ticket-filter-panel',
|
|
9
|
+
templateUrl: './ticket-filter-panel.component.html',
|
|
10
|
+
styleUrl: './ticket-filter-panel.component.scss'
|
|
11
|
+
})
|
|
12
|
+
export class TicketFilterPanelComponent implements OnChanges {
|
|
13
|
+
@Output() apply = new EventEmitter<any>();
|
|
14
|
+
@Output() panelClosed = new EventEmitter<void>(); // ✅ not `close`
|
|
15
|
+
@Input() permissionType: string | null = null;
|
|
16
|
+
@Input() userType: string | null = null; // e.g. 'tango' or others
|
|
17
|
+
@Input() client :any;
|
|
18
|
+
@HostListener('document:click', ['$event'])
|
|
19
|
+
onDocumentClick(event: MouseEvent): void {
|
|
20
|
+
|
|
21
|
+
// 1️⃣ Always close dropdowns first
|
|
22
|
+
this.dropdownState.status = false;
|
|
23
|
+
this.dropdownState.reviewer = false;
|
|
24
|
+
this.dropdownState.approver = false;
|
|
25
|
+
|
|
26
|
+
// 2️⃣ If filter is not open → nothing to close
|
|
27
|
+
if (!this.isOpen) return;
|
|
28
|
+
|
|
29
|
+
// 3️⃣ Check if clicked inside filter card
|
|
30
|
+
const clickedInside = this.eRef.nativeElement.contains(event.target);
|
|
31
|
+
|
|
32
|
+
// 4️⃣ If clicked OUTSIDE → close entire filter panel
|
|
33
|
+
if (!clickedInside) {
|
|
34
|
+
this.isOpen = false;
|
|
35
|
+
this.panelClosed.emit();
|
|
36
|
+
this.filterForm.reset({
|
|
37
|
+
status: [],
|
|
38
|
+
reviewerCondition: null,
|
|
39
|
+
reviewerFrom: null,
|
|
40
|
+
reviewerTo: null,
|
|
41
|
+
|
|
42
|
+
approverCondition: null,
|
|
43
|
+
approverFrom: null,
|
|
44
|
+
approverTo: null,
|
|
45
|
+
|
|
46
|
+
tangoCondition: null,
|
|
47
|
+
tangoFrom: null,
|
|
48
|
+
tangoTo: null,
|
|
49
|
+
|
|
50
|
+
reviewedBy: [],
|
|
51
|
+
approvedBy: []
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
isOpen = false; // controls visibility
|
|
57
|
+
|
|
58
|
+
// called from parent via #filterPanel.open()
|
|
59
|
+
open() {
|
|
60
|
+
this.isOpen = true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// called from close button inside the panel
|
|
64
|
+
close() {
|
|
65
|
+
this.isOpen = false;
|
|
66
|
+
this.panelClosed.emit();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
showPanel = false; // you can also control this from parent
|
|
70
|
+
|
|
71
|
+
statusOptions: any[] = [
|
|
72
|
+
'Open',
|
|
73
|
+
'In-Progress',
|
|
74
|
+
'Closed',
|
|
75
|
+
'Under Tango Review',
|
|
76
|
+
'Tango Review Done',
|
|
77
|
+
'Expired',
|
|
78
|
+
'Tango Expired',
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
conditionOptions = [
|
|
83
|
+
{ value: 'gt', label: '> Greater than' },
|
|
84
|
+
{ value: 'lt', label: '< Lesser than' },
|
|
85
|
+
{ value: 'gte', label: '>= Greater than or equal to' },
|
|
86
|
+
{ value: 'lte', label: '<= Lesser than or equal to' },
|
|
87
|
+
{ value: 'between', label: 'Between' },
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
filterForm: FormGroup;
|
|
91
|
+
|
|
92
|
+
constructor(private fb: FormBuilder,private eRef: ElementRef,private service:TicketService) {
|
|
93
|
+
this.filterForm = this.fb.group({
|
|
94
|
+
status: [[]],
|
|
95
|
+
|
|
96
|
+
reviewerCondition: [null as Condition | null],
|
|
97
|
+
reviewerFrom: [null,[Validators.min(0), Validators.max(100)]],
|
|
98
|
+
reviewerTo: [null,[Validators.min(0), Validators.max(100)]],
|
|
99
|
+
|
|
100
|
+
approverCondition: [null as Condition | null],
|
|
101
|
+
approverFrom: [null,[Validators.min(0), Validators.max(100)]],
|
|
102
|
+
approverTo: [null,[Validators.min(0), Validators.max(100)]],
|
|
103
|
+
|
|
104
|
+
tangoCondition: [null as Condition | null],
|
|
105
|
+
tangoFrom: [null,[Validators.min(0), Validators.max(100)]],
|
|
106
|
+
tangoTo: [null,[Validators.min(0), Validators.max(100)]],
|
|
107
|
+
|
|
108
|
+
reviewedBy: [[]],
|
|
109
|
+
approvedBy: [[]],
|
|
110
|
+
});
|
|
111
|
+
this.onReset();
|
|
112
|
+
}
|
|
113
|
+
limitValue(event: any, controlName: string) {
|
|
114
|
+
let value = Number(event.target.value);
|
|
115
|
+
|
|
116
|
+
if (value < 0) value = 0;
|
|
117
|
+
if (value > 100) value = 100;
|
|
118
|
+
|
|
119
|
+
event.target.value = value;
|
|
120
|
+
this.filterForm.get(controlName)?.setValue(value, { emitEvent: false });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get isTango(): boolean {
|
|
124
|
+
return this.userType === 'tango';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// SHOW / HIDE RULES
|
|
128
|
+
|
|
129
|
+
// Reviewer accuracy and "Reviewed by" visible for tango + reviewer
|
|
130
|
+
get showReviewerAccuracy(): boolean {
|
|
131
|
+
return this.isTango || this.permissionType === 'review';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get showReviewedBy(): boolean {
|
|
135
|
+
return this.permissionType === 'review';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Approver accuracy and "Approved by" visible for tango + approver
|
|
139
|
+
get showApproverAccuracy(): boolean {
|
|
140
|
+
return this.isTango || this.permissionType === 'approve';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
get showApprovedBy(): boolean {
|
|
144
|
+
return this.permissionType === 'approve';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Tango accuracy only for tango users
|
|
148
|
+
get showTangoAccuracy(): boolean {
|
|
149
|
+
return this.isTango;
|
|
150
|
+
}
|
|
151
|
+
statusDropdownOpen = false;
|
|
152
|
+
isStatusSelected(status: string): boolean {
|
|
153
|
+
const selected: string[] = this.filterForm.value.status || [];
|
|
154
|
+
return selected.includes(status);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
onStatusChange(event: Event, status: string) {
|
|
158
|
+
const checkbox = event.target as HTMLInputElement;
|
|
159
|
+
const selected: string[] = this.filterForm.value.status || [];
|
|
160
|
+
let next: string[];
|
|
161
|
+
|
|
162
|
+
if (checkbox.checked) {
|
|
163
|
+
next = selected.includes(status) ? selected : [...selected, status];
|
|
164
|
+
} else {
|
|
165
|
+
next = selected.filter(s => s !== status);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.filterForm.patchValue({ status: next });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
toggleStatusDropdown(event?: MouseEvent) {
|
|
172
|
+
if (event) {
|
|
173
|
+
event.stopPropagation(); // avoid document click closing it
|
|
174
|
+
}
|
|
175
|
+
this.statusDropdownOpen = !this.statusDropdownOpen;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Are all statuses currently selected?
|
|
179
|
+
areAllStatusesSelected(): boolean {
|
|
180
|
+
const selected: string[] = this.filterForm.value.status || [];
|
|
181
|
+
return selected.length > 0 && selected.length === this.statusOptions.length;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Handle "Select All" checkbox change
|
|
185
|
+
onStatusSelectAllChange(event: Event) {
|
|
186
|
+
const checkbox = event.target as HTMLInputElement;
|
|
187
|
+
|
|
188
|
+
if (checkbox.checked) {
|
|
189
|
+
// Select every status
|
|
190
|
+
this.filterForm.patchValue({ status: [...this.statusOptions] });
|
|
191
|
+
} else {
|
|
192
|
+
// Clear all
|
|
193
|
+
this.filterForm.patchValue({ status: [] });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
get selectedStatuses(): string[] {
|
|
197
|
+
return this.filterForm.value.status || [];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
isBetween(controlName: string): boolean {
|
|
201
|
+
return this.filterForm.get(controlName)?.value === 'between';
|
|
202
|
+
}
|
|
203
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
204
|
+
if (changes['client'] || changes['permissionType'] || changes['userType']) {
|
|
205
|
+
this.loadReviewerList();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// full user list you already have
|
|
209
|
+
userList: any[] = [];
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
reviewerSearchTerm: string = '';
|
|
213
|
+
|
|
214
|
+
// ✅ simple computed list for *ngFor
|
|
215
|
+
get filteredReviewerList(): { email: string; name?: string }[] {
|
|
216
|
+
const term = (this.reviewerSearchTerm || '').trim().toLowerCase();
|
|
217
|
+
|
|
218
|
+
if (!term) {
|
|
219
|
+
return this.userList;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return this.userList.filter(u => {
|
|
223
|
+
const email = (u.email || '').toLowerCase();
|
|
224
|
+
const name = (u.name || '').toLowerCase();
|
|
225
|
+
return email.includes(term) || name.includes(term);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
approverSearchTerm:any;
|
|
229
|
+
get filteredApproverList(): any[] {
|
|
230
|
+
const term = (this.approverSearchTerm || '').trim().toLowerCase();
|
|
231
|
+
if (!term) {
|
|
232
|
+
return this.userList;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return this.userList.filter((u: any) => {
|
|
236
|
+
const email = (u.email || '').toLowerCase();
|
|
237
|
+
const name = (u.name || '').toLowerCase();
|
|
238
|
+
return email.includes(term) || name.includes(term);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
onApproverSearch(value: string) {
|
|
243
|
+
this.approverSearchTerm = value;
|
|
244
|
+
}
|
|
245
|
+
private loadReviewerList(): void {
|
|
246
|
+
if (!this.client) {
|
|
247
|
+
this.userList = [];
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
let type: string;
|
|
252
|
+
|
|
253
|
+
if (this.userType === 'tango') {
|
|
254
|
+
type = 'tango'; // or 'all'
|
|
255
|
+
} else if (this.permissionType === 'review') {
|
|
256
|
+
type = 'review';
|
|
257
|
+
} else if (this.permissionType === 'approve') {
|
|
258
|
+
type = 'approve';
|
|
259
|
+
} else {
|
|
260
|
+
this.userList = [];
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
this.service.getReviewerApi(this.client, type,'').subscribe({
|
|
265
|
+
next: (res: any) => {
|
|
266
|
+
if (res && res.code === 200) {
|
|
267
|
+
this.userList = res.data;
|
|
268
|
+
} else {
|
|
269
|
+
this.userList = [];
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
error: () => {
|
|
273
|
+
this.userList = [];
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// open flags
|
|
279
|
+
reviewerDropdownOpen = false;
|
|
280
|
+
approverDropdownOpen = false;
|
|
281
|
+
|
|
282
|
+
// convenience getters
|
|
283
|
+
get selectedReviewedBy(): string[] {
|
|
284
|
+
return this.filterForm.value.reviewedBy || [];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
get selectedApprovedBy(): string[] {
|
|
288
|
+
return this.filterForm.value.approvedBy || [];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// --- Reviewed By helpers ---
|
|
292
|
+
|
|
293
|
+
toggleReviewerDropdown(event?: MouseEvent) {
|
|
294
|
+
if (event) event.stopPropagation();
|
|
295
|
+
this.reviewerDropdownOpen = !this.reviewerDropdownOpen;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
isReviewerSelected(email: string): boolean {
|
|
299
|
+
return this.selectedReviewedBy.includes(email);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
onReviewerChange(event: Event, email: string) {
|
|
303
|
+
const checkbox = event.target as HTMLInputElement;
|
|
304
|
+
const selected = [...this.selectedReviewedBy];
|
|
305
|
+
|
|
306
|
+
if (checkbox.checked) {
|
|
307
|
+
if (!selected.includes(email)) selected.push(email);
|
|
308
|
+
} else {
|
|
309
|
+
const i = selected.indexOf(email);
|
|
310
|
+
if (i >= 0) selected.splice(i, 1);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
this.filterForm.patchValue({ reviewedBy: selected });
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
areAllReviewersSelected(): boolean {
|
|
317
|
+
return (
|
|
318
|
+
this.userList.length > 0 &&
|
|
319
|
+
this.selectedReviewedBy.length === this.userList.length
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
onReviewerSelectAll(event: Event) {
|
|
324
|
+
const checkbox = event.target as HTMLInputElement;
|
|
325
|
+
|
|
326
|
+
if (checkbox.checked) {
|
|
327
|
+
this.filterForm.patchValue({
|
|
328
|
+
reviewedBy: this.userList.map((u:any) => u.email),
|
|
329
|
+
});
|
|
330
|
+
} else {
|
|
331
|
+
this.filterForm.patchValue({ reviewedBy: [] });
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// --- Approved By helpers ---
|
|
336
|
+
|
|
337
|
+
toggleApproverDropdown(event?: MouseEvent) {
|
|
338
|
+
if (event) event.stopPropagation();
|
|
339
|
+
this.approverDropdownOpen = !this.approverDropdownOpen;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
isApproverSelected(email: string): boolean {
|
|
343
|
+
return this.selectedApprovedBy.includes(email);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
onApproverChange(event: Event, email: string) {
|
|
347
|
+
const checkbox = event.target as HTMLInputElement;
|
|
348
|
+
const selected = [...this.selectedApprovedBy];
|
|
349
|
+
|
|
350
|
+
if (checkbox.checked) {
|
|
351
|
+
if (!selected.includes(email)) selected.push(email);
|
|
352
|
+
} else {
|
|
353
|
+
const i = selected.indexOf(email);
|
|
354
|
+
if (i >= 0) selected.splice(i, 1);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
this.filterForm.patchValue({ approvedBy: selected });
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
areAllApproversSelected(): boolean {
|
|
361
|
+
return (
|
|
362
|
+
this.userList.length > 0 &&
|
|
363
|
+
this.selectedApprovedBy.length === this.userList.length
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
onApproverSelectAll(event: Event) {
|
|
368
|
+
const checkbox = event.target as HTMLInputElement;
|
|
369
|
+
|
|
370
|
+
if (checkbox.checked) {
|
|
371
|
+
this.filterForm.patchValue({
|
|
372
|
+
approvedBy: this.userList.map((u:any) => u.email),
|
|
373
|
+
});
|
|
374
|
+
} else {
|
|
375
|
+
this.filterForm.patchValue({ approvedBy: [] });
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
onReset(): void {
|
|
380
|
+
this.filterForm.reset({
|
|
381
|
+
status: [],
|
|
382
|
+
reviewerCondition: null,
|
|
383
|
+
reviewerFrom: null,
|
|
384
|
+
reviewerTo: null,
|
|
385
|
+
|
|
386
|
+
approverCondition: null,
|
|
387
|
+
approverFrom: null,
|
|
388
|
+
approverTo: null,
|
|
389
|
+
|
|
390
|
+
tangoCondition: null,
|
|
391
|
+
tangoFrom: null,
|
|
392
|
+
tangoTo: null,
|
|
393
|
+
|
|
394
|
+
reviewedBy: [],
|
|
395
|
+
approvedBy: []
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// 2️⃣ Reset search terms
|
|
399
|
+
this.reviewerSearchTerm = '';
|
|
400
|
+
this.approverSearchTerm = '';
|
|
401
|
+
|
|
402
|
+
// 3️⃣ Build empty payload to send back
|
|
403
|
+
const payload = {
|
|
404
|
+
filterByStatus: [],
|
|
405
|
+
filterByReviewer: null,
|
|
406
|
+
filterByApprover: null,
|
|
407
|
+
filterByTango: null,
|
|
408
|
+
filterByReviewedBy: [],
|
|
409
|
+
fileterByApprovedBy: []
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// 4️⃣ Emit the now-empty filter result
|
|
413
|
+
this.apply.emit(payload);
|
|
414
|
+
|
|
415
|
+
// 5️⃣ Close the filter panel
|
|
416
|
+
this.close();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
private mapAccuracy(
|
|
420
|
+
condition: Condition | null,
|
|
421
|
+
from: number | null,
|
|
422
|
+
to: number | null
|
|
423
|
+
): string | null {
|
|
424
|
+
|
|
425
|
+
// nothing selected
|
|
426
|
+
if (!condition || from == null) return null;
|
|
427
|
+
|
|
428
|
+
// "between" → "90 to 100"
|
|
429
|
+
if (condition === 'between') {
|
|
430
|
+
if (to == null) return null;
|
|
431
|
+
return `${from} to ${to}`;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// other conditions (gt, lt, gte, lte)
|
|
435
|
+
const opMap: Record<Condition, string> = {
|
|
436
|
+
gt: '>',
|
|
437
|
+
lt: '<',
|
|
438
|
+
gte: '>=',
|
|
439
|
+
lte: '<=',
|
|
440
|
+
between: '', // already handled above
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
return `${opMap[condition]} ${from}`; // e.g. ">= 90"
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
onApply(): void {
|
|
447
|
+
|
|
448
|
+
const raw = this.filterForm.value;
|
|
449
|
+
|
|
450
|
+
const reviewerStr = this.mapAccuracy(raw.reviewerCondition, raw.reviewerFrom, raw.reviewerTo);
|
|
451
|
+
const approverStr = this.mapAccuracy(raw.approverCondition, raw.approverFrom, raw.approverTo);
|
|
452
|
+
const tangoStr = this.mapAccuracy(raw.tangoCondition, raw.tangoFrom, raw.tangoTo);
|
|
453
|
+
|
|
454
|
+
const payload = {
|
|
455
|
+
filterByStatus: raw.status || [],
|
|
456
|
+
|
|
457
|
+
filterByReviewer: reviewerStr,
|
|
458
|
+
filterByApprover: approverStr,
|
|
459
|
+
filterByTango: tangoStr,
|
|
460
|
+
|
|
461
|
+
filterByReviewedBy: raw.reviewedBy || [],
|
|
462
|
+
fileterByApprovedBy: raw.approvedBy || [],
|
|
463
|
+
};
|
|
464
|
+
this.apply.emit(payload);
|
|
465
|
+
this.close();
|
|
466
|
+
this.showPanel = false;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
dropdownState = {
|
|
470
|
+
status: false,
|
|
471
|
+
reviewer: false,
|
|
472
|
+
approver: false
|
|
473
|
+
};
|
|
474
|
+
// @HostListener('document:click')
|
|
475
|
+
closeAll() {
|
|
476
|
+
this.dropdownState.status = false;
|
|
477
|
+
this.dropdownState.reviewer = false;
|
|
478
|
+
this.dropdownState.approver = false;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
toggleDropdown(type: 'status' | 'reviewer' | 'approver', event: MouseEvent) {
|
|
482
|
+
event.stopPropagation();
|
|
483
|
+
|
|
484
|
+
// Close all before opening a new one
|
|
485
|
+
this.closeAll();
|
|
486
|
+
|
|
487
|
+
// Toggle only the selected one
|
|
488
|
+
this.dropdownState[type] = !this.dropdownState[type];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
isDropdownOpen(type: 'status' | 'reviewer' | 'approver') {
|
|
492
|
+
return this.dropdownState[type];
|
|
493
|
+
}
|
|
494
|
+
}
|