@sunbird-cb/access-settings 0.0.1-ang-17-20
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.
|
@@ -0,0 +1,4313 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, inject, ChangeDetectionStrategy, NgModule, EventEmitter, HostListener, HostBinding, Output, Directive, signal, Injectable, Input, ViewChild, ElementRef, Inject } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/material/snack-bar';
|
|
4
|
+
import { MAT_SNACK_BAR_DATA, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
5
|
+
import * as i2 from '@angular/material/icon';
|
|
6
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
+
import * as i4 from '@angular/common';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
9
|
+
import * as i2$1 from '@angular/forms';
|
|
10
|
+
import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
11
|
+
import * as i1$3 from '@angular/material/dialog';
|
|
12
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
13
|
+
import { MatRippleModule } from '@angular/material/core';
|
|
14
|
+
import * as i10 from '@angular/material/expansion';
|
|
15
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
16
|
+
import * as i11$1 from '@angular/material/tabs';
|
|
17
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
|
18
|
+
import * as i6 from '@angular/material/table';
|
|
19
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
20
|
+
import * as i7 from '@angular/material/sort';
|
|
21
|
+
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
22
|
+
import * as i13 from '@angular/material/tooltip';
|
|
23
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
24
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
25
|
+
import * as i8 from '@angular/material/input';
|
|
26
|
+
import { MatInputModule } from '@angular/material/input';
|
|
27
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
28
|
+
import * as i5 from '@angular/material/radio';
|
|
29
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
30
|
+
import * as i3 from '@angular/material/select';
|
|
31
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
32
|
+
import * as i12 from '@angular/material/progress-spinner';
|
|
33
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
34
|
+
import * as i4$1 from '@angular/material/checkbox';
|
|
35
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
36
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
37
|
+
import * as i11 from '@angular/material/button';
|
|
38
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
39
|
+
import { Subject } from 'rxjs';
|
|
40
|
+
import { takeUntil } from 'rxjs/operators';
|
|
41
|
+
import * as _ from 'lodash';
|
|
42
|
+
import { toNumber } from 'lodash';
|
|
43
|
+
import * as i1$1 from '@angular/common/http';
|
|
44
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
45
|
+
import * as i1$2 from '@angular/cdk/a11y';
|
|
46
|
+
import { v4 } from 'uuid';
|
|
47
|
+
|
|
48
|
+
class AccessSettingsComponent {
|
|
49
|
+
constructor() { }
|
|
50
|
+
ngOnInit() { }
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessSettingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
52
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: AccessSettingsComponent, isStandalone: false, selector: "sb-uic-access-settings", ngImport: i0, template: ` <p>access settings works!</p> `, isInline: true, styles: ["::ng-deep .mdc-tooltip{--mat-tooltip-container-color: #616161;--mat-tooltip-supporting-text-color: #ffffff;--mat-tooltip-container-shape: 4px;--mat-tooltip-container-size: 340px;--mat-tooltip-supporting-text-padding: 8px}\n"] }); }
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessSettingsComponent, decorators: [{
|
|
55
|
+
type: Component,
|
|
56
|
+
args: [{ selector: "sb-uic-access-settings", template: ` <p>access settings works!</p> `, standalone: false, styles: ["::ng-deep .mdc-tooltip{--mat-tooltip-container-color: #616161;--mat-tooltip-supporting-text-color: #ffffff;--mat-tooltip-container-shape: 4px;--mat-tooltip-container-size: 340px;--mat-tooltip-supporting-text-padding: 8px}\n"] }]
|
|
57
|
+
}], ctorParameters: () => [] });
|
|
58
|
+
|
|
59
|
+
class SnackbarComponent {
|
|
60
|
+
constructor(snackBarRef) {
|
|
61
|
+
this.snackBarRef = snackBarRef;
|
|
62
|
+
this.data = inject(MAT_SNACK_BAR_DATA);
|
|
63
|
+
}
|
|
64
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SnackbarComponent, deps: [{ token: i1.MatSnackBarRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
65
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: SnackbarComponent, isStandalone: false, selector: "sb-uic-snackbar", ngImport: i0, template: "<div class=\"snackbar-wrapper\">\n <div class=\"flex items-center justify-between\">\n <div class=\"message flex items-center gap-4\">\n <ng-container *ngIf=\"data?.type === 'success'\">\n <mat-icon class=\"text-white\">check</mat-icon>\n </ng-container>\n\n <ng-container *ngIf=\"data?.type === 'error'\">\n <img src=\"/assets/icons/error-icon.svg\" alt=\"error\" width=\"24\" height=\"24\" style=\"filter: brightness(0) invert(1)\" />\n </ng-container>\n\n <span class=\"text-white\">{{ data?.message }}</span>\n </div>\n\n <div class=\"close\">\n <mat-icon class=\"cursor-pointer text-white\" (click)=\"snackBarRef.dismiss()\"> close </mat-icon>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
66
|
+
}
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SnackbarComponent, decorators: [{
|
|
68
|
+
type: Component,
|
|
69
|
+
args: [{ selector: "sb-uic-snackbar", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"snackbar-wrapper\">\n <div class=\"flex items-center justify-between\">\n <div class=\"message flex items-center gap-4\">\n <ng-container *ngIf=\"data?.type === 'success'\">\n <mat-icon class=\"text-white\">check</mat-icon>\n </ng-container>\n\n <ng-container *ngIf=\"data?.type === 'error'\">\n <img src=\"/assets/icons/error-icon.svg\" alt=\"error\" width=\"24\" height=\"24\" style=\"filter: brightness(0) invert(1)\" />\n </ng-container>\n\n <span class=\"text-white\">{{ data?.message }}</span>\n </div>\n\n <div class=\"close\">\n <mat-icon class=\"cursor-pointer text-white\" (click)=\"snackBarRef.dismiss()\"> close </mat-icon>\n </div>\n </div>\n</div>\n" }]
|
|
70
|
+
}], ctorParameters: () => [{ type: i1.MatSnackBarRef }] });
|
|
71
|
+
|
|
72
|
+
class AccessSettingsModule {
|
|
73
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessSettingsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
74
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: AccessSettingsModule, declarations: [AccessSettingsComponent, SnackbarComponent], imports: [MatIconModule, CommonModule], exports: [AccessSettingsComponent] }); }
|
|
75
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessSettingsModule, imports: [MatIconModule, CommonModule] }); }
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessSettingsModule, decorators: [{
|
|
78
|
+
type: NgModule,
|
|
79
|
+
args: [{
|
|
80
|
+
declarations: [AccessSettingsComponent, SnackbarComponent],
|
|
81
|
+
imports: [MatIconModule, CommonModule],
|
|
82
|
+
exports: [AccessSettingsComponent]
|
|
83
|
+
}]
|
|
84
|
+
}] });
|
|
85
|
+
|
|
86
|
+
class DragDropDirective {
|
|
87
|
+
constructor() {
|
|
88
|
+
this.fileDropped = new EventEmitter();
|
|
89
|
+
this.opacity = "1";
|
|
90
|
+
}
|
|
91
|
+
// Dragover listener
|
|
92
|
+
onDragOver(evt) {
|
|
93
|
+
evt.preventDefault();
|
|
94
|
+
evt.stopPropagation();
|
|
95
|
+
this.opacity = "0.4";
|
|
96
|
+
}
|
|
97
|
+
// Dragleave listener
|
|
98
|
+
onDragLeave(evt) {
|
|
99
|
+
evt.preventDefault();
|
|
100
|
+
evt.stopPropagation();
|
|
101
|
+
this.opacity = "1.0";
|
|
102
|
+
}
|
|
103
|
+
// Drop listener
|
|
104
|
+
ondrop(evt) {
|
|
105
|
+
evt.preventDefault();
|
|
106
|
+
evt.stopPropagation();
|
|
107
|
+
const files = evt.dataTransfer.files[0];
|
|
108
|
+
this.opacity = "1.0";
|
|
109
|
+
if (files) {
|
|
110
|
+
this.fileDropped.emit(files);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
114
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: DragDropDirective, isStandalone: false, selector: "[wsAuthDragDrop]", outputs: { fileDropped: "fileDropped" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "ondrop($event)" }, properties: { "style.opacity": "this.opacity" } }, ngImport: i0 }); }
|
|
115
|
+
}
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DragDropDirective, decorators: [{
|
|
117
|
+
type: Directive,
|
|
118
|
+
args: [{
|
|
119
|
+
selector: "[wsAuthDragDrop]",
|
|
120
|
+
standalone: false
|
|
121
|
+
}]
|
|
122
|
+
}], propDecorators: { fileDropped: [{
|
|
123
|
+
type: Output
|
|
124
|
+
}], opacity: [{
|
|
125
|
+
type: HostBinding,
|
|
126
|
+
args: ["style.opacity"]
|
|
127
|
+
}], onDragOver: [{
|
|
128
|
+
type: HostListener,
|
|
129
|
+
args: ["dragover", ["$event"]]
|
|
130
|
+
}], onDragLeave: [{
|
|
131
|
+
type: HostListener,
|
|
132
|
+
args: ["dragleave", ["$event"]]
|
|
133
|
+
}], ondrop: [{
|
|
134
|
+
type: HostListener,
|
|
135
|
+
args: ["drop", ["$event"]]
|
|
136
|
+
}] } });
|
|
137
|
+
|
|
138
|
+
var NsAccessControlConfig;
|
|
139
|
+
(function (NsAccessControlConfig) {
|
|
140
|
+
let SelectionType;
|
|
141
|
+
(function (SelectionType) {
|
|
142
|
+
SelectionType["Users"] = "user";
|
|
143
|
+
SelectionType["Organizations"] = "rootOrgId";
|
|
144
|
+
SelectionType["Group"] = "group";
|
|
145
|
+
SelectionType["Designation"] = "designation";
|
|
146
|
+
SelectionType["VerificationStatus"] = "profilestatus";
|
|
147
|
+
SelectionType["Cadre"] = "Cadre";
|
|
148
|
+
SelectionType["Service"] = "service";
|
|
149
|
+
SelectionType["Batch"] = "batch";
|
|
150
|
+
SelectionType["CustomField"] = "customeField";
|
|
151
|
+
SelectionType["CentralDeputation"] = "isOnCentralDeputation";
|
|
152
|
+
})(SelectionType = NsAccessControlConfig.SelectionType || (NsAccessControlConfig.SelectionType = {}));
|
|
153
|
+
let IActions;
|
|
154
|
+
(function (IActions) {
|
|
155
|
+
IActions["Confirm"] = "confirm";
|
|
156
|
+
IActions["Reject"] = "reject";
|
|
157
|
+
})(IActions = NsAccessControlConfig.IActions || (NsAccessControlConfig.IActions = {}));
|
|
158
|
+
let IAccessTypes;
|
|
159
|
+
(function (IAccessTypes) {
|
|
160
|
+
IAccessTypes["Public"] = "public";
|
|
161
|
+
IAccessTypes["Custom"] = "custom";
|
|
162
|
+
})(IAccessTypes = NsAccessControlConfig.IAccessTypes || (NsAccessControlConfig.IAccessTypes = {}));
|
|
163
|
+
let IAccessSetting;
|
|
164
|
+
(function (IAccessSetting) {
|
|
165
|
+
IAccessSetting["ALL_USERS"] = "allUsers";
|
|
166
|
+
IAccessSetting["MDO_SPECIFIC"] = "mdoSpecific";
|
|
167
|
+
IAccessSetting["CUSTOME_USER"] = "customeUser";
|
|
168
|
+
})(IAccessSetting = NsAccessControlConfig.IAccessSetting || (NsAccessControlConfig.IAccessSetting = {}));
|
|
169
|
+
let Application;
|
|
170
|
+
(function (Application) {
|
|
171
|
+
Application["MDO"] = "mdo_portal";
|
|
172
|
+
Application["Creation_Portal"] = "cbp_portal";
|
|
173
|
+
})(Application = NsAccessControlConfig.Application || (NsAccessControlConfig.Application = {}));
|
|
174
|
+
})(NsAccessControlConfig || (NsAccessControlConfig = {}));
|
|
175
|
+
|
|
176
|
+
const PAGINATION_LIMIT = 100;
|
|
177
|
+
const ENDPOINTS = {
|
|
178
|
+
SEARCH_USER_WITH_ADMIN: (query) => `/apis/proxies/v8/user/v1/autocomplete/${query}`,
|
|
179
|
+
SEARCH_USER: `/apis/proxies/v8/user/v1/admin/search`,
|
|
180
|
+
SEARCH_ORG: "/apis/proxies/v8/org/v1/admin/search",
|
|
181
|
+
VALIDATE_USER: "/apis/proxies/v8/user/v1/search",
|
|
182
|
+
GROUPS: "/apis/proxies/v8/user/v1/groups",
|
|
183
|
+
CADRE_CONFIG: "/apis/proxies/v8/data/v2/system/settings/get/cadreConfig",
|
|
184
|
+
DESIGNATION_LIST: "/apis/proxies/v8/designation/search",
|
|
185
|
+
SEARCH_V4: "/apis/proxies/v8/sunbirdigot/v4/search",
|
|
186
|
+
CREATE_USERGROUPS_CONTROL: "/apis/proxies/v8/accessSettings/v1/upsert",
|
|
187
|
+
GET_ACCESS_CONTROL: (id) => `/apis/proxies/v8/accessSettings/read/${id}`,
|
|
188
|
+
ACTION_CONTENT_V3: `apis/proxies/v8/action/content/v3/`,
|
|
189
|
+
PRIVATE_CONTENT_V4: `apis/proxies/v8/private/content/v4/`,
|
|
190
|
+
CUSTOMES_FIELD_SEARCH: "apis/proxies/v8/customFields/v1/search",
|
|
191
|
+
};
|
|
192
|
+
class AccessControlService {
|
|
193
|
+
constructor(http) {
|
|
194
|
+
this.http = http;
|
|
195
|
+
this.customesFieldData = signal([], ...(ngDevMode ? [{ debugName: "customesFieldData" }] : []));
|
|
196
|
+
this.accessControlConfig = signal(null, ...(ngDevMode ? [{ debugName: "accessControlConfig" }] : []));
|
|
197
|
+
this.holdServiceCadrebatch = signal({
|
|
198
|
+
service: [],
|
|
199
|
+
batch: [],
|
|
200
|
+
cadre: [],
|
|
201
|
+
}, ...(ngDevMode ? [{ debugName: "holdServiceCadrebatch" }] : []));
|
|
202
|
+
}
|
|
203
|
+
fetchUserListWithAdmin(queryString) {
|
|
204
|
+
return this.http.get(ENDPOINTS.SEARCH_USER_WITH_ADMIN(queryString));
|
|
205
|
+
}
|
|
206
|
+
fetchUserList(query, pagination, userIds, filters, sorting) {
|
|
207
|
+
let request = {
|
|
208
|
+
filters: {
|
|
209
|
+
status: 1,
|
|
210
|
+
},
|
|
211
|
+
limit: pagination.limit || 5,
|
|
212
|
+
offset: pagination.offset || 0,
|
|
213
|
+
query: query,
|
|
214
|
+
sort_by: {},
|
|
215
|
+
fields: ["userId", "firstName", "maskedEmail", "rootOrgName", "phone"],
|
|
216
|
+
};
|
|
217
|
+
if (userIds?.length) {
|
|
218
|
+
request.filters = { ...request.filters, userId: userIds };
|
|
219
|
+
}
|
|
220
|
+
if (filters) {
|
|
221
|
+
request.filters = { ...request.filters, ...filters };
|
|
222
|
+
}
|
|
223
|
+
if (sorting) {
|
|
224
|
+
request.sort_by = sorting;
|
|
225
|
+
}
|
|
226
|
+
return this.http.post(ENDPOINTS.SEARCH_USER, { request: request });
|
|
227
|
+
}
|
|
228
|
+
fetchOrgList(query, pagination, selectedData, characterSearch) {
|
|
229
|
+
let request = {
|
|
230
|
+
request: {
|
|
231
|
+
filters: {
|
|
232
|
+
status: 1,
|
|
233
|
+
isMdo: true,
|
|
234
|
+
},
|
|
235
|
+
// sort_by: {
|
|
236
|
+
// channel: "asc",
|
|
237
|
+
// },
|
|
238
|
+
fields: ["channel", "identifier", "iscca"],
|
|
239
|
+
query: query,
|
|
240
|
+
limit: pagination.limit,
|
|
241
|
+
offset: pagination.offset,
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
if (selectedData?.length) {
|
|
245
|
+
request.request.filters.identifier = selectedData;
|
|
246
|
+
characterSearch = "";
|
|
247
|
+
}
|
|
248
|
+
if (characterSearch && characterSearch !== '#' && !query) {
|
|
249
|
+
request.request.filters.channel = { startsWith: characterSearch };
|
|
250
|
+
}
|
|
251
|
+
return this.http.post(ENDPOINTS.SEARCH_ORG, request);
|
|
252
|
+
}
|
|
253
|
+
validateUser(request) {
|
|
254
|
+
return this.http.post(ENDPOINTS.VALIDATE_USER, request);
|
|
255
|
+
}
|
|
256
|
+
fetchGroupsList() {
|
|
257
|
+
return this.http.get(ENDPOINTS.GROUPS);
|
|
258
|
+
}
|
|
259
|
+
fetchCadreConfig() {
|
|
260
|
+
return this.http.get(ENDPOINTS.CADRE_CONFIG).toPromise();
|
|
261
|
+
}
|
|
262
|
+
fetchDesignation(query, pagination, selectedData, characterSearch) {
|
|
263
|
+
let payload = {
|
|
264
|
+
filterCriteriaMap: {
|
|
265
|
+
status: "Active",
|
|
266
|
+
},
|
|
267
|
+
requestedFields: ["designation", "id"],
|
|
268
|
+
pageSize: pagination.pageSize || this.accessControlConfig()?.accessControlCriteriaSelection?.paginationLimit || PAGINATION_LIMIT,
|
|
269
|
+
pageNumber: pagination.pageNumber || 0,
|
|
270
|
+
// orderDirection: "ASC",
|
|
271
|
+
};
|
|
272
|
+
if (selectedData?.length) {
|
|
273
|
+
payload.filterCriteriaMap.designation = selectedData;
|
|
274
|
+
characterSearch = "";
|
|
275
|
+
}
|
|
276
|
+
if (query) {
|
|
277
|
+
payload.searchString = query;
|
|
278
|
+
}
|
|
279
|
+
if (characterSearch && characterSearch !== '#' && !query) {
|
|
280
|
+
payload.startsWith = characterSearch;
|
|
281
|
+
}
|
|
282
|
+
if (!query) {
|
|
283
|
+
payload.orderBy = "designation";
|
|
284
|
+
}
|
|
285
|
+
return this.http.post(ENDPOINTS.DESIGNATION_LIST, payload);
|
|
286
|
+
}
|
|
287
|
+
fetchDesignationsWithOrg(paginationOffset, categories, query, selectedData, characterSearch) {
|
|
288
|
+
let payload = {
|
|
289
|
+
request: {
|
|
290
|
+
filters: {
|
|
291
|
+
status: "Live",
|
|
292
|
+
category: "designation",
|
|
293
|
+
categories: categories,
|
|
294
|
+
objectType: "Term",
|
|
295
|
+
},
|
|
296
|
+
fields: ["identifier", "name"],
|
|
297
|
+
query: query,
|
|
298
|
+
sort_by: { name: "asc" },
|
|
299
|
+
facets: [],
|
|
300
|
+
limit: this.accessControlConfig()?.accessControlCriteriaSelection?.paginationLimit || PAGINATION_LIMIT,
|
|
301
|
+
offset: paginationOffset,
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
if (selectedData?.length) {
|
|
305
|
+
payload.request.filters.name = selectedData;
|
|
306
|
+
}
|
|
307
|
+
if (characterSearch && characterSearch !== '#' && !query) {
|
|
308
|
+
if (!payload.request.filters.name || typeof payload.request.filters.name !== "object") {
|
|
309
|
+
payload.request.filters.name = {};
|
|
310
|
+
}
|
|
311
|
+
payload.request.filters.name.startsWith = characterSearch;
|
|
312
|
+
}
|
|
313
|
+
return this.http.post(ENDPOINTS.SEARCH_V4, payload);
|
|
314
|
+
}
|
|
315
|
+
applyUserGroupAccessControl(request) {
|
|
316
|
+
return this.http.put(ENDPOINTS.CREATE_USERGROUPS_CONTROL, request);
|
|
317
|
+
}
|
|
318
|
+
fetchUserGroupAccessControl(id) {
|
|
319
|
+
return this.http.get(ENDPOINTS.GET_ACCESS_CONTROL(id));
|
|
320
|
+
}
|
|
321
|
+
updateContentV3(meta, id) {
|
|
322
|
+
return this.http.patch(`${ENDPOINTS.ACTION_CONTENT_V3}update/${id}`, meta);
|
|
323
|
+
}
|
|
324
|
+
updateContentV4(meta, id) {
|
|
325
|
+
return this.http.patch(`${ENDPOINTS.PRIVATE_CONTENT_V4}update/${id}`, meta);
|
|
326
|
+
}
|
|
327
|
+
downloadFile(data, filename = "data") {
|
|
328
|
+
const csvData = this.convertToCSV(data, ["email", "status", "mobile", "message"]);
|
|
329
|
+
const blob = new Blob([`\ufeff${csvData}`], { type: "text/csv;charset=utf-8;" });
|
|
330
|
+
const dwldLink = document.createElement("a");
|
|
331
|
+
const url = URL.createObjectURL(blob);
|
|
332
|
+
const isSafariBrowser = navigator.userAgent.indexOf("Safari") !== -1 && navigator.userAgent.indexOf("Chrome") === -1;
|
|
333
|
+
if (isSafariBrowser) {
|
|
334
|
+
// if Safari open in new window to save file with random filename.
|
|
335
|
+
dwldLink.setAttribute("target", "_blank");
|
|
336
|
+
}
|
|
337
|
+
dwldLink.setAttribute("href", url);
|
|
338
|
+
dwldLink.setAttribute("download", `${filename}.csv`);
|
|
339
|
+
dwldLink.style.visibility = "hidden";
|
|
340
|
+
document.body.appendChild(dwldLink);
|
|
341
|
+
dwldLink.click();
|
|
342
|
+
document.body.removeChild(dwldLink);
|
|
343
|
+
}
|
|
344
|
+
convertToCSV(objArray, headerList) {
|
|
345
|
+
const array = typeof objArray !== "object" ? JSON.parse(objArray) : objArray;
|
|
346
|
+
let str = "";
|
|
347
|
+
let row = "S.No,";
|
|
348
|
+
for (const index in headerList) {
|
|
349
|
+
if (headerList[index]) {
|
|
350
|
+
row += `${headerList[index]} ,`;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
row = row.slice(0, -1);
|
|
354
|
+
str += `${row}\r\n`;
|
|
355
|
+
// for (let i = 0; i < array.length; i += 1) {
|
|
356
|
+
for (const iIndex in array) {
|
|
357
|
+
if (array[iIndex]) {
|
|
358
|
+
let line = `${toNumber(iIndex) + 1} `;
|
|
359
|
+
for (const index in headerList) {
|
|
360
|
+
if (headerList[index]) {
|
|
361
|
+
const head = headerList[index];
|
|
362
|
+
line += `, ${array[iIndex][head]}`;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
str += `${line}\r\n`;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return str;
|
|
369
|
+
}
|
|
370
|
+
createRequestContent(apiResponse, accessSettingsEnabled) {
|
|
371
|
+
return {
|
|
372
|
+
request: {
|
|
373
|
+
content: {
|
|
374
|
+
versionKey: apiResponse.versionKey || "",
|
|
375
|
+
accessSettingsEnabled: accessSettingsEnabled || false,
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
createRequesForMDOContent(apiResponse, accessSettingsEnabled, secureSettings) {
|
|
381
|
+
return {
|
|
382
|
+
request: {
|
|
383
|
+
content: {
|
|
384
|
+
versionKey: apiResponse.versionKey || "",
|
|
385
|
+
accessSettingsEnabled: accessSettingsEnabled || false,
|
|
386
|
+
secureSettings: secureSettings || null,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
fetchCustomsField(filterCriteria) {
|
|
392
|
+
const requestPayload = {
|
|
393
|
+
filterCriteriaMap: filterCriteria,
|
|
394
|
+
requestedFields: ["name", "isActive", "createdBy", "createdOn", "isEnabled", "isMandatory", "customFieldData", "originalCustomFieldData", "attributeName", "type", "reversedOrderCustomFieldData"],
|
|
395
|
+
pageNumber: 0,
|
|
396
|
+
pageSize: this.accessControlConfig()?.accessControlCriteriaSelection?.paginationLimit || PAGINATION_LIMIT,
|
|
397
|
+
orderDirection: "DESC",
|
|
398
|
+
orderBy: "createdOn",
|
|
399
|
+
facets: [],
|
|
400
|
+
};
|
|
401
|
+
return this.http.post(ENDPOINTS.CUSTOMES_FIELD_SEARCH, requestPayload);
|
|
402
|
+
}
|
|
403
|
+
enableDeputation(value) {
|
|
404
|
+
const config = this.accessControlConfig();
|
|
405
|
+
if (config) {
|
|
406
|
+
const centralDeputationOption = { disabled: false, value: NsAccessControlConfig.SelectionType.CentralDeputation, label: "Central Deputation" };
|
|
407
|
+
const centralDeputationCriteria = [
|
|
408
|
+
{ value: "yes", label: "Yes" },
|
|
409
|
+
{ value: "no", label: "No" },
|
|
410
|
+
];
|
|
411
|
+
// Add if true, remove if false
|
|
412
|
+
if (value) {
|
|
413
|
+
// Add to optionsEntity if not present
|
|
414
|
+
if (!config.accessControlCriteriaSelection.optionsEntity.some((o) => o.value === NsAccessControlConfig.SelectionType.CentralDeputation)) {
|
|
415
|
+
config.accessControlCriteriaSelection.optionsEntity.push(centralDeputationOption);
|
|
416
|
+
}
|
|
417
|
+
// Add to accessControlCriteriaSelection if not present
|
|
418
|
+
if (!config.accessControlCriteriaSelection.centralDeputation) {
|
|
419
|
+
config.accessControlCriteriaSelection.centralDeputation = centralDeputationCriteria;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
// Remove from optionsEntity
|
|
424
|
+
config.accessControlCriteriaSelection.optionsEntity = config.accessControlCriteriaSelection.optionsEntity.filter((o) => o.value !== NsAccessControlConfig.SelectionType.CentralDeputation);
|
|
425
|
+
// Remove from accessControlCriteriaSelection
|
|
426
|
+
if (config.accessControlCriteriaSelection.centralDeputation) {
|
|
427
|
+
delete config.accessControlCriteriaSelection.centralDeputation;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// Update Signal Value
|
|
431
|
+
this.accessControlConfig.set({ ...config });
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
435
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlService, providedIn: "root" }); }
|
|
436
|
+
}
|
|
437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlService, decorators: [{
|
|
438
|
+
type: Injectable,
|
|
439
|
+
args: [{
|
|
440
|
+
providedIn: "root",
|
|
441
|
+
}]
|
|
442
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }] });
|
|
443
|
+
|
|
444
|
+
class PaginationComponent {
|
|
445
|
+
constructor() {
|
|
446
|
+
this._currentPage = 1;
|
|
447
|
+
this.defaultPaginationSize = 10;
|
|
448
|
+
this.defaultPaginationSizeOptions = [];
|
|
449
|
+
this.totalItemsCount = 0;
|
|
450
|
+
this.pageChange = new EventEmitter();
|
|
451
|
+
this.pagination = [];
|
|
452
|
+
this.showingArray = [];
|
|
453
|
+
this.lastPage = 0;
|
|
454
|
+
this.firstPage = 0;
|
|
455
|
+
this.previousPage = 0;
|
|
456
|
+
}
|
|
457
|
+
set currentPage(value) {
|
|
458
|
+
if (this._currentPage !== value) {
|
|
459
|
+
this._currentPage = value;
|
|
460
|
+
this.paginationInListing();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
get currentPage() {
|
|
464
|
+
return this._currentPage;
|
|
465
|
+
}
|
|
466
|
+
ngOnInit() {
|
|
467
|
+
this.paginationInListing();
|
|
468
|
+
}
|
|
469
|
+
ngOnChanges(changes) {
|
|
470
|
+
if (changes.totalItemsCount &&
|
|
471
|
+
changes.totalItemsCount.previousValue &&
|
|
472
|
+
changes.totalItemsCount.currentValue !==
|
|
473
|
+
changes.totalItemsCount.previousValue) {
|
|
474
|
+
this.paginationInListing();
|
|
475
|
+
}
|
|
476
|
+
if (changes?.currentPage) {
|
|
477
|
+
this.currentPage = changes.currentPage.currentValue;
|
|
478
|
+
this.previousPage = changes.currentPage.previousValue || 0;
|
|
479
|
+
this.paginationInListing();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
paginationInListing() {
|
|
483
|
+
let lower = 0;
|
|
484
|
+
let upper = 0;
|
|
485
|
+
let limit = this.defaultPaginationSize;
|
|
486
|
+
let items = this.totalItemsCount;
|
|
487
|
+
this.showingArray = [];
|
|
488
|
+
for (let i = 0; i < items; i++) {
|
|
489
|
+
if (upper !== items && upper < items) {
|
|
490
|
+
lower = upper;
|
|
491
|
+
if (upper != items && (upper = lower + limit) <= items) {
|
|
492
|
+
upper = lower + limit;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
upper = items;
|
|
496
|
+
}
|
|
497
|
+
this.showingArray.push([lower, upper]);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
let dividedPagination = Math.ceil(this.totalItemsCount / limit);
|
|
501
|
+
let paginationLength = this.paginationDup(this.currentPage, dividedPagination);
|
|
502
|
+
let currentIndex = this.showingArray[this.currentPage - 1];
|
|
503
|
+
let lowerPagination = this.totalItemsCount ? currentIndex[0] + 1 : "";
|
|
504
|
+
let upperPagination = this.totalItemsCount ? currentIndex[1] : "";
|
|
505
|
+
this.lastPage = paginationLength[paginationLength.length - 1];
|
|
506
|
+
this.firstPage = paginationLength[0];
|
|
507
|
+
this.pagination = {
|
|
508
|
+
dividedPagination: dividedPagination,
|
|
509
|
+
paginationLength: paginationLength,
|
|
510
|
+
lower: lowerPagination,
|
|
511
|
+
upper: upperPagination,
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
paginationDup(c, m) {
|
|
515
|
+
let current = c;
|
|
516
|
+
let last = m;
|
|
517
|
+
let delta = 5;
|
|
518
|
+
let left = current - delta;
|
|
519
|
+
let right = current + delta + 1;
|
|
520
|
+
let range = [];
|
|
521
|
+
let l;
|
|
522
|
+
this.rangeWithDots = [];
|
|
523
|
+
for (let i = 1; i <= last; i++) {
|
|
524
|
+
if (i == 1 || i == last || (i >= left && i < right)) {
|
|
525
|
+
range.push(i);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
for (let i of range) {
|
|
529
|
+
if (l) {
|
|
530
|
+
if (i - l === 2) {
|
|
531
|
+
this.rangeWithDots.push(l + 1);
|
|
532
|
+
}
|
|
533
|
+
else if (i - l !== 1) {
|
|
534
|
+
this.rangeWithDots.push("...");
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
this.rangeWithDots.push(i);
|
|
538
|
+
l = i;
|
|
539
|
+
}
|
|
540
|
+
return this.rangeWithDots;
|
|
541
|
+
}
|
|
542
|
+
goToPage(page) {
|
|
543
|
+
this.currentPage = page;
|
|
544
|
+
this.pageChange.emit({
|
|
545
|
+
currentPage: this.currentPage,
|
|
546
|
+
previousPage: this.previousPage,
|
|
547
|
+
limit: this.defaultPaginationSize,
|
|
548
|
+
});
|
|
549
|
+
this.paginationInListing();
|
|
550
|
+
}
|
|
551
|
+
// TODO: May need to implement in future
|
|
552
|
+
navigateToLastPage(page) {
|
|
553
|
+
if (page != this.currentPage) {
|
|
554
|
+
this.goToPage(page);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
// TODO: May need to implement in future
|
|
558
|
+
navigateToFirstPage(page) {
|
|
559
|
+
if (page != this.currentPage) {
|
|
560
|
+
this.goToPage(page);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
navigateToNextPage(page) {
|
|
564
|
+
if (page <=
|
|
565
|
+
(this.pagination.paginationLength &&
|
|
566
|
+
this.pagination.paginationLength[this.pagination.paginationLength.length - 1])) {
|
|
567
|
+
this.currentPage = this.currentPage + 1;
|
|
568
|
+
this.previousPage = page;
|
|
569
|
+
this.goToPage(this.currentPage);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
navigateToPrevPage(page) {
|
|
573
|
+
if (page <=
|
|
574
|
+
(this.pagination.paginationLength &&
|
|
575
|
+
this.pagination.paginationLength[this.pagination.paginationLength.length - 1])) {
|
|
576
|
+
this.currentPage = this.currentPage - 1;
|
|
577
|
+
this.previousPage = page;
|
|
578
|
+
this.goToPage(this.currentPage);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
onChangePageSize(event) {
|
|
582
|
+
this.defaultPaginationSize = event.value;
|
|
583
|
+
this.currentPage = 1;
|
|
584
|
+
this.previousPage = 0;
|
|
585
|
+
this.paginationInListing();
|
|
586
|
+
this.pageChange.emit({
|
|
587
|
+
currentPage: this.currentPage,
|
|
588
|
+
previousPage: this.previousPage,
|
|
589
|
+
limit: this.defaultPaginationSize,
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
593
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: PaginationComponent, isStandalone: false, selector: "sb-uic-pagination", inputs: { defaultPaginationSize: "defaultPaginationSize", defaultPaginationSizeOptions: "defaultPaginationSizeOptions", totalItemsCount: "totalItemsCount", currentPage: "currentPage" }, outputs: { pageChange: "pageChange" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"ws-pagination-wrapper px-4 mt-3\">\n <div class=\"pagination-size-select mat-full-radius-select flex items-center gap-2\">\n <span class=\"text-xs font-normal hidden md:block\">Show Entries</span>\n <mat-form-field appearance=\"outline\">\n <mat-select [(value)]=\"defaultPaginationSize\" (selectionChange)=\"onChangePageSize($event)\">\n <ng-container *ngFor=\"let option of defaultPaginationSizeOptions\">\n <mat-option [value]=\"option\">{{option}}</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </div>\n <ul class=\"pagination\">\n <div class=\"pagination-listing flex items-center\">\n <ng-container\n *ngFor=\"let count of pagination?.paginationLength; let last = last; let first = first; let i = index\">\n <li class=\"page-item\" *ngIf=\"first\" (click)=\"navigateToPrevPage(currentPage)\"\n [ngClass]=\"{disabled: currentPage === firstPage}\">\n <a class=\"page-link\" aria-label=\"Previous\">\n <span aria-hidden=\"true\"><mat-icon>keyboard_arrow_left</mat-icon></span>\n </a>\n </li>\n <li class=\"page-item flex items-center justify-center\" [ngClass]=\"count == currentPage ? 'active' : '' \"\n (click)=\"goToPage(count)\">\n <a class=\"page-link\">{{count}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"last\" (click)=\"navigateToNextPage(currentPage)\"\n [ngClass]=\"{disabled: currentPage === lastPage}\">\n <a class=\" page-link\" aria-label=\"Next\">\n <span aria-hidden=\"true\"><mat-icon>keyboard_arrow_right</mat-icon></span>\n </a>\n </li>\n\n </ng-container>\n </div>\n </ul>\n</div>", styles: [".ws-pagination-wrapper{display:flex;align-items:center;justify-content:space-between;background-color:#fff;border-top:1px solid rgba(0,0,0,.0784313725)}.ws-pagination-wrapper .pagination-size-select span{font-family:Lato;line-height:100%;color:#666}ul{list-style:none;gap:4px}ul li{width:32px;height:24px;text-align:center}ul li a{color:#666;font-size:14px;border:0;font-family:Lato;font-weight:400;font-size:12px;line-height:14.4px;letter-spacing:0%;text-align:center}ul li:hover{border-radius:99px;cursor:pointer;background-color:#f5f5f5}ul li.active{background:#1b4ca1;border-radius:99px}ul li.active a{color:#fff!important}.ws-pagination-wrapper ::ng-deep .pagination-size-select.mat-full-radius-select mat-form-field{height:40px!important;max-width:80px!important}.ws-pagination-wrapper ::ng-deep .pagination-size-select.mat-full-radius-select .mat-form-field-appearance-outline .mat-form-field-infix{padding:0 0 8px!important}.ws-pagination-wrapper ::ng-deep .pagination-size-select.mat-full-radius-select .mat-form-field-wrapper{padding-bottom:0!important}.page-item.disabled{pointer-events:none;opacity:.5;cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] }); }
|
|
594
|
+
}
|
|
595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PaginationComponent, decorators: [{
|
|
596
|
+
type: Component,
|
|
597
|
+
args: [{ selector: "sb-uic-pagination", standalone: false, template: "<div class=\"ws-pagination-wrapper px-4 mt-3\">\n <div class=\"pagination-size-select mat-full-radius-select flex items-center gap-2\">\n <span class=\"text-xs font-normal hidden md:block\">Show Entries</span>\n <mat-form-field appearance=\"outline\">\n <mat-select [(value)]=\"defaultPaginationSize\" (selectionChange)=\"onChangePageSize($event)\">\n <ng-container *ngFor=\"let option of defaultPaginationSizeOptions\">\n <mat-option [value]=\"option\">{{option}}</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </div>\n <ul class=\"pagination\">\n <div class=\"pagination-listing flex items-center\">\n <ng-container\n *ngFor=\"let count of pagination?.paginationLength; let last = last; let first = first; let i = index\">\n <li class=\"page-item\" *ngIf=\"first\" (click)=\"navigateToPrevPage(currentPage)\"\n [ngClass]=\"{disabled: currentPage === firstPage}\">\n <a class=\"page-link\" aria-label=\"Previous\">\n <span aria-hidden=\"true\"><mat-icon>keyboard_arrow_left</mat-icon></span>\n </a>\n </li>\n <li class=\"page-item flex items-center justify-center\" [ngClass]=\"count == currentPage ? 'active' : '' \"\n (click)=\"goToPage(count)\">\n <a class=\"page-link\">{{count}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"last\" (click)=\"navigateToNextPage(currentPage)\"\n [ngClass]=\"{disabled: currentPage === lastPage}\">\n <a class=\" page-link\" aria-label=\"Next\">\n <span aria-hidden=\"true\"><mat-icon>keyboard_arrow_right</mat-icon></span>\n </a>\n </li>\n\n </ng-container>\n </div>\n </ul>\n</div>", styles: [".ws-pagination-wrapper{display:flex;align-items:center;justify-content:space-between;background-color:#fff;border-top:1px solid rgba(0,0,0,.0784313725)}.ws-pagination-wrapper .pagination-size-select span{font-family:Lato;line-height:100%;color:#666}ul{list-style:none;gap:4px}ul li{width:32px;height:24px;text-align:center}ul li a{color:#666;font-size:14px;border:0;font-family:Lato;font-weight:400;font-size:12px;line-height:14.4px;letter-spacing:0%;text-align:center}ul li:hover{border-radius:99px;cursor:pointer;background-color:#f5f5f5}ul li.active{background:#1b4ca1;border-radius:99px}ul li.active a{color:#fff!important}.ws-pagination-wrapper ::ng-deep .pagination-size-select.mat-full-radius-select mat-form-field{height:40px!important;max-width:80px!important}.ws-pagination-wrapper ::ng-deep .pagination-size-select.mat-full-radius-select .mat-form-field-appearance-outline .mat-form-field-infix{padding:0 0 8px!important}.ws-pagination-wrapper ::ng-deep .pagination-size-select.mat-full-radius-select .mat-form-field-wrapper{padding-bottom:0!important}.page-item.disabled{pointer-events:none;opacity:.5;cursor:not-allowed}\n"] }]
|
|
598
|
+
}], propDecorators: { defaultPaginationSize: [{
|
|
599
|
+
type: Input
|
|
600
|
+
}], defaultPaginationSizeOptions: [{
|
|
601
|
+
type: Input
|
|
602
|
+
}], totalItemsCount: [{
|
|
603
|
+
type: Input
|
|
604
|
+
}], currentPage: [{
|
|
605
|
+
type: Input
|
|
606
|
+
}], pageChange: [{
|
|
607
|
+
type: Output
|
|
608
|
+
}] } });
|
|
609
|
+
|
|
610
|
+
class ListTableComponent {
|
|
611
|
+
constructor(_liveAnnouncer) {
|
|
612
|
+
this._liveAnnouncer = _liveAnnouncer;
|
|
613
|
+
this.data = [];
|
|
614
|
+
this.count = 0;
|
|
615
|
+
this.initialPaginationSize = 5;
|
|
616
|
+
this.initialPaginationSizeOptions = [5, 10, 25, 100];
|
|
617
|
+
this.currentPage = 1;
|
|
618
|
+
this.isDisabled = false;
|
|
619
|
+
this.selectedDataChange = new EventEmitter();
|
|
620
|
+
this.pageChange = new EventEmitter();
|
|
621
|
+
this.removeSelectedData = new EventEmitter();
|
|
622
|
+
this.sortChange = new EventEmitter();
|
|
623
|
+
this.dataSource = new MatTableDataSource(this.data);
|
|
624
|
+
this.selection = new SelectionModel(true, []);
|
|
625
|
+
this.selectedTablerow = [];
|
|
626
|
+
}
|
|
627
|
+
ngOnInit() { }
|
|
628
|
+
ngOnChanges(changes) {
|
|
629
|
+
// Handle data input change
|
|
630
|
+
if (changes["data"]?.currentValue?.length) {
|
|
631
|
+
const mappedUsers = changes["data"].currentValue.map((user) => ({
|
|
632
|
+
firstName: user?.firstName || user?.firstname || user?.fullName || "",
|
|
633
|
+
mobile: user?.mobile || user?.phone || "",
|
|
634
|
+
email: user?.email || user?.maskedEmail || "",
|
|
635
|
+
ministry: user?.ministry || user?.rootOrgName || "",
|
|
636
|
+
invited_on: user?.invited_on || "",
|
|
637
|
+
status: user?.status || "",
|
|
638
|
+
userId: user?.userId || user?.id || ""
|
|
639
|
+
}));
|
|
640
|
+
this.data = mappedUsers;
|
|
641
|
+
this.dataSource = new MatTableDataSource(mappedUsers);
|
|
642
|
+
this.dataSource.sort = this.sort;
|
|
643
|
+
}
|
|
644
|
+
if (changes["count"]?.currentValue !== undefined) {
|
|
645
|
+
this.count = changes["count"].currentValue;
|
|
646
|
+
}
|
|
647
|
+
if (changes["selected"]?.currentValue) {
|
|
648
|
+
this.selection.clear();
|
|
649
|
+
if (changes["selected"].currentValue.length > 0) {
|
|
650
|
+
this.dataSource.data.forEach(row => {
|
|
651
|
+
if (changes["selected"].currentValue.some((sel) => sel.userId === row.userId)) {
|
|
652
|
+
this.selection.select(row);
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
this.selectedTablerow = changes["selected"]?.currentValue || [];
|
|
657
|
+
}
|
|
658
|
+
if (changes["currentPage"]?.currentValue) {
|
|
659
|
+
this.currentPage = changes["currentPage"]?.currentValue;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
ngAfterViewInit() {
|
|
663
|
+
if (this.tableConfig?.canSortColumn) {
|
|
664
|
+
this.dataSource.sort = this.sort;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
setPaginatedUsers(page) {
|
|
668
|
+
const startIndex = (page - 1) * this.initialPaginationSize;
|
|
669
|
+
const endIndex = startIndex + this.initialPaginationSize;
|
|
670
|
+
const paginatedUsers = this.data.slice(startIndex, endIndex);
|
|
671
|
+
this.dataSource = new MatTableDataSource(paginatedUsers);
|
|
672
|
+
this.dataSource.sort = this.sort;
|
|
673
|
+
}
|
|
674
|
+
isAllSelected() {
|
|
675
|
+
const numSelected = this.selection.selected.length;
|
|
676
|
+
const numRows = this.dataSource.data.length;
|
|
677
|
+
return numSelected === numRows;
|
|
678
|
+
}
|
|
679
|
+
masterToggle() {
|
|
680
|
+
const isAll = this.isAllSelected();
|
|
681
|
+
if (isAll) {
|
|
682
|
+
const previouslySelected = this.dataSource.data.filter(row => this.selectedTablerow.some(sel => sel.userId === row.userId));
|
|
683
|
+
this.dataSource.data.forEach(row => this.selection.deselect(row));
|
|
684
|
+
this.selectedTablerow = this.selectedTablerow.filter(sel => !this.dataSource.data.some(row => row.userId === sel.userId));
|
|
685
|
+
this.selectedDataChange.emit({
|
|
686
|
+
selectedRows: this.selectedTablerow,
|
|
687
|
+
toggledRows: previouslySelected,
|
|
688
|
+
action: "unselectedAll"
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
const newlySelected = this.dataSource.data.filter(row => !this.selectedTablerow.some(sel => sel.userId === row.userId));
|
|
693
|
+
this.dataSource.data.forEach(row => this.selection.select(row));
|
|
694
|
+
this.selectedTablerow = [...this.selectedTablerow, ...newlySelected];
|
|
695
|
+
this.selectedDataChange.emit({
|
|
696
|
+
selectedRows: this.selectedTablerow,
|
|
697
|
+
toggledRows: newlySelected,
|
|
698
|
+
action: "selectedAll"
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
toggleSelection(row) {
|
|
703
|
+
const rowId = row.userId;
|
|
704
|
+
const isSelected = this.selectedTablerow.some(r => r.userId === rowId);
|
|
705
|
+
if (isSelected) {
|
|
706
|
+
this.selectedTablerow = this.selectedTablerow.filter(r => r.userId !== rowId);
|
|
707
|
+
this.selection.deselect(row);
|
|
708
|
+
}
|
|
709
|
+
else {
|
|
710
|
+
this.selectedTablerow.push(row);
|
|
711
|
+
this.selection.select(row);
|
|
712
|
+
}
|
|
713
|
+
this.selectedDataChange.emit({
|
|
714
|
+
selectedRows: _.cloneDeep(this.selectedTablerow),
|
|
715
|
+
toggledRow: row,
|
|
716
|
+
action: isSelected ? "unselected" : "selected"
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
onPageChange(event) {
|
|
720
|
+
this.currentPage = event?.currentPage;
|
|
721
|
+
this.pageChange.emit(event);
|
|
722
|
+
}
|
|
723
|
+
removeUserFromSelected() {
|
|
724
|
+
if (!this.selectedTablerow.length) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const removedList = [...this.selectedTablerow];
|
|
728
|
+
const remainingList = this.data.filter(user => !this.selectedTablerow.some(selected => selected.userId === user.userId));
|
|
729
|
+
this.data = remainingList;
|
|
730
|
+
this.count = remainingList.length;
|
|
731
|
+
this.selectedTablerow = [];
|
|
732
|
+
this.selection.clear();
|
|
733
|
+
this.dataSource = new MatTableDataSource(remainingList);
|
|
734
|
+
this.dataSource.sort = this.sort;
|
|
735
|
+
if (this.tableConfig?.type === "selectedUsers") {
|
|
736
|
+
this.removeSelectedData.emit({
|
|
737
|
+
remainingList,
|
|
738
|
+
removedList
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
onSortChange(sortState) {
|
|
743
|
+
if (sortState.direction) {
|
|
744
|
+
if (sortState.active === "ministry")
|
|
745
|
+
sortState.active = "rootOrgName";
|
|
746
|
+
if (sortState.active === "mobile")
|
|
747
|
+
sortState.active = "phone";
|
|
748
|
+
if (this.tableConfig?.type === "selectedUsers") {
|
|
749
|
+
this._liveAnnouncer.announce(`Sorted ${sortState.direction}ending`);
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
this.sortChange.emit({ [sortState.active]: sortState.direction });
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
if (this.tableConfig?.type === "selectedUsers") {
|
|
757
|
+
this._liveAnnouncer.announce("Sorting cleared");
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
this.sortChange.emit({});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
refreshSelected() {
|
|
765
|
+
this.selection.clear();
|
|
766
|
+
}
|
|
767
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListTableComponent, deps: [{ token: i1$2.LiveAnnouncer }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
768
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: ListTableComponent, isStandalone: false, selector: "sb-uic-list-table", inputs: { data: "data", count: "count", initialPaginationSize: "initialPaginationSize", initialPaginationSizeOptions: "initialPaginationSizeOptions", tableConfig: "tableConfig", selected: "selected", bulkUploadEntriesCount: "bulkUploadEntriesCount", currentPage: "currentPage", isDisabled: "isDisabled" }, outputs: { selectedDataChange: "selectedDataChange", pageChange: "pageChange", removeSelectedData: "removeSelectedData", sortChange: "sortChange" }, viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"wrapper-user-table\" id=\"user-table-select\">\n <div class=\"selections-meta\">\n <div class=\"flex items-center justify-between p-2\">\n <div class=\"flex items-center gap-2 selection-count\" *ngIf=\"tableConfig?.canShowSelectedItems || false\">\n <span class=\"\">{{selectedTablerow?.length}}</span>\n <span class=\"text-sm font-normal\">Items Selected</span>\n </div>\n <div class=\"flex items-center gap-2 actions-selections ml-auto\">\n <button mat-button color=\"primary\" class=\"text-sm font-normal action-refresh-btn\" (click)=\"refreshSelected()\"\n *ngIf=\"tableConfig?.canShowRefreshBtn || false\">\n <mat-icon>refresh</mat-icon>\n Refresh\n </button>\n\n <button mat-button color=\"warn\" class=\"text-sm font-bold action-delete-btn\"\n (click)=\"removeUserFromSelected()\" *ngIf=\"tableConfig?.canShowDeleteBtn || false\">\n <mat-icon>delete</mat-icon>\n Delete\n </button>\n </div>\n </div>\n </div>\n\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortChange($event)\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <ng-container *ngIf=\"tableConfig?.canShowMasterSelect\">\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [disabled]=\"isDisabled\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\">\n </mat-checkbox>\n </ng-container>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"toggleSelection(row)\" [disabled]=\"isDisabled\"\n [checked]=\"selection.isSelected(row)\">\n </mat-checkbox>\n </td>\n </ng-container>\n\n <!-- first_name Column -->\n <ng-container matColumnDef=\"firstName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Full Name </th>\n <td mat-cell *matCellDef=\"let element\"> {{element?.firstName}} </td>\n </ng-container>\n\n <!-- Email Column -->\n <ng-container matColumnDef=\"email\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Email </th>\n <td mat-cell *matCellDef=\"let element\"> {{element?.email}} </td>\n </ng-container>\n\n <!-- ministry Column -->\n <ng-container matColumnDef=\"ministry\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Ministry </th>\n <td mat-cell *matCellDef=\"let element\">\n <span class=\"truncated-text \">\n {{element?.ministry}}\n </span>\n </td>\n </ng-container>\n\n <!-- mobile_no Column -->\n <ng-container matColumnDef=\"mobile\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Mobile No </th>\n <td mat-cell *matCellDef=\"let element\">\n {{element?.mobile}}\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"invited_on\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Invited On </th>\n <td mat-cell *matCellDef=\"let element\">\n {{element?.invited_on}}\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"status\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>\n <td mat-cell *matCellDef=\"let element\">\n <!-- {{element?.status}} -->\n <div class=\"success-status flex items-center justify-center\">Success</div>\n <!-- <div class=\"rejected-status flex items-center justify-center\">Rejected</div> -->\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"tableConfig?.displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: tableConfig?.displayedColumns;\" (click)=\"toggleSelection(row);\">\n </tr>\n </table>\n <div *ngIf=\"!dataSource.data.length\" class=\"no-data-center\">\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\">\n <span class=\"font-bold\">No information to display yet</span>\n </div>\n </div>\n <ng-container *ngIf=\"count && tableConfig?.canShowPagination\">\n <div class=\"pagination-users\">\n <sb-uic-pagination [defaultPaginationSize]=\"initialPaginationSize\"\n [defaultPaginationSizeOptions]=\"initialPaginationSizeOptions\" [totalItemsCount]=\"count\"\n [currentPage]=\"currentPage\" (pageChange)=\"onPageChange($event)\">\n </sb-uic-pagination>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"bulkUploadEntriesCount\">\n <div class=\"text-xs text-[#666666] p-4 border-t border-black/15\">\n {{bulkUploadEntriesCount?.success}}/{{bulkUploadEntriesCount?.totalCount}} entries uploaded successfully\n </div>\n </ng-container>\n\n\n</div>", styles: ["::ng-deep .mat-column-select{text-align:center}::ng-deep .mat-column-email{width:213px}.truncated-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;line-height:1.4em;max-height:2.8em;width:213px}.wrapper-user-table{margin-top:16px;border:1px solid rgba(0,0,0,.1607843137);border-radius:4px}.selection-count span{font-family:Lato;font-weight:400}.selection-count span:first-child{background:#d1dbec;border:1px solid rgba(0,0,0,.1607843137);border-radius:50%;padding:4px;height:18px;width:18px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#0009}.selection-count span:nth-child(2){font-size:14px;color:#000000de}.actions-selections{height:22px}.actions-selections button{font-family:Lato;font-weight:400;font-size:14px;background:none;border:none;padding:8px 4px;min-width:unset}.actions-selections button.action-refresh-btn{color:#1b4ca1!important}.actions-selections button.action-refresh-btn mat-icon{color:#1b4ca1!important}.actions-selections button.action-delete-btn{color:#d13924}.actions-selections button.action-delete-btn mat-icon{color:#d13924}.actions-selections button ::ng-deep .mat-button-wrapper{display:flex;align-items:center;gap:4px;height:22px}:host ::ng-deep .mat-mdc-table .mat-mdc-header-cell,:host ::ng-deep .mat-mdc-table .mat-mdc-cell{border-top:1px solid rgba(0,0,0,.1607843137);border-right:1px solid rgba(0,0,0,.1607843137)}:host ::ng-deep .mat-mdc-header-cell{font-family:Montserrat;font-weight:600;font-size:14px;color:#1b2133}.success-status{width:62px;height:22px;border-radius:4px;padding:4px 12px;font-family:Lato;font-weight:400;font-size:12px;background:#1d8923;text-align:center;color:#fff}.no-data span{font-family:Lato;font-size:8.98px;color:#000000de}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i11.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i6.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: PaginationComponent, selector: "sb-uic-pagination", inputs: ["defaultPaginationSize", "defaultPaginationSizeOptions", "totalItemsCount", "currentPage"], outputs: ["pageChange"] }] }); }
|
|
769
|
+
}
|
|
770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListTableComponent, decorators: [{
|
|
771
|
+
type: Component,
|
|
772
|
+
args: [{ selector: "sb-uic-list-table", standalone: false, template: "<div class=\"wrapper-user-table\" id=\"user-table-select\">\n <div class=\"selections-meta\">\n <div class=\"flex items-center justify-between p-2\">\n <div class=\"flex items-center gap-2 selection-count\" *ngIf=\"tableConfig?.canShowSelectedItems || false\">\n <span class=\"\">{{selectedTablerow?.length}}</span>\n <span class=\"text-sm font-normal\">Items Selected</span>\n </div>\n <div class=\"flex items-center gap-2 actions-selections ml-auto\">\n <button mat-button color=\"primary\" class=\"text-sm font-normal action-refresh-btn\" (click)=\"refreshSelected()\"\n *ngIf=\"tableConfig?.canShowRefreshBtn || false\">\n <mat-icon>refresh</mat-icon>\n Refresh\n </button>\n\n <button mat-button color=\"warn\" class=\"text-sm font-bold action-delete-btn\"\n (click)=\"removeUserFromSelected()\" *ngIf=\"tableConfig?.canShowDeleteBtn || false\">\n <mat-icon>delete</mat-icon>\n Delete\n </button>\n </div>\n </div>\n </div>\n\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortChange($event)\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <ng-container *ngIf=\"tableConfig?.canShowMasterSelect\">\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [disabled]=\"isDisabled\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\">\n </mat-checkbox>\n </ng-container>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"toggleSelection(row)\" [disabled]=\"isDisabled\"\n [checked]=\"selection.isSelected(row)\">\n </mat-checkbox>\n </td>\n </ng-container>\n\n <!-- first_name Column -->\n <ng-container matColumnDef=\"firstName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Full Name </th>\n <td mat-cell *matCellDef=\"let element\"> {{element?.firstName}} </td>\n </ng-container>\n\n <!-- Email Column -->\n <ng-container matColumnDef=\"email\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Email </th>\n <td mat-cell *matCellDef=\"let element\"> {{element?.email}} </td>\n </ng-container>\n\n <!-- ministry Column -->\n <ng-container matColumnDef=\"ministry\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Ministry </th>\n <td mat-cell *matCellDef=\"let element\">\n <span class=\"truncated-text \">\n {{element?.ministry}}\n </span>\n </td>\n </ng-container>\n\n <!-- mobile_no Column -->\n <ng-container matColumnDef=\"mobile\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Mobile No </th>\n <td mat-cell *matCellDef=\"let element\">\n {{element?.mobile}}\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"invited_on\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Invited On </th>\n <td mat-cell *matCellDef=\"let element\">\n {{element?.invited_on}}\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"status\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>\n <td mat-cell *matCellDef=\"let element\">\n <!-- {{element?.status}} -->\n <div class=\"success-status flex items-center justify-center\">Success</div>\n <!-- <div class=\"rejected-status flex items-center justify-center\">Rejected</div> -->\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"tableConfig?.displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: tableConfig?.displayedColumns;\" (click)=\"toggleSelection(row);\">\n </tr>\n </table>\n <div *ngIf=\"!dataSource.data.length\" class=\"no-data-center\">\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\">\n <span class=\"font-bold\">No information to display yet</span>\n </div>\n </div>\n <ng-container *ngIf=\"count && tableConfig?.canShowPagination\">\n <div class=\"pagination-users\">\n <sb-uic-pagination [defaultPaginationSize]=\"initialPaginationSize\"\n [defaultPaginationSizeOptions]=\"initialPaginationSizeOptions\" [totalItemsCount]=\"count\"\n [currentPage]=\"currentPage\" (pageChange)=\"onPageChange($event)\">\n </sb-uic-pagination>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"bulkUploadEntriesCount\">\n <div class=\"text-xs text-[#666666] p-4 border-t border-black/15\">\n {{bulkUploadEntriesCount?.success}}/{{bulkUploadEntriesCount?.totalCount}} entries uploaded successfully\n </div>\n </ng-container>\n\n\n</div>", styles: ["::ng-deep .mat-column-select{text-align:center}::ng-deep .mat-column-email{width:213px}.truncated-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;line-height:1.4em;max-height:2.8em;width:213px}.wrapper-user-table{margin-top:16px;border:1px solid rgba(0,0,0,.1607843137);border-radius:4px}.selection-count span{font-family:Lato;font-weight:400}.selection-count span:first-child{background:#d1dbec;border:1px solid rgba(0,0,0,.1607843137);border-radius:50%;padding:4px;height:18px;width:18px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#0009}.selection-count span:nth-child(2){font-size:14px;color:#000000de}.actions-selections{height:22px}.actions-selections button{font-family:Lato;font-weight:400;font-size:14px;background:none;border:none;padding:8px 4px;min-width:unset}.actions-selections button.action-refresh-btn{color:#1b4ca1!important}.actions-selections button.action-refresh-btn mat-icon{color:#1b4ca1!important}.actions-selections button.action-delete-btn{color:#d13924}.actions-selections button.action-delete-btn mat-icon{color:#d13924}.actions-selections button ::ng-deep .mat-button-wrapper{display:flex;align-items:center;gap:4px;height:22px}:host ::ng-deep .mat-mdc-table .mat-mdc-header-cell,:host ::ng-deep .mat-mdc-table .mat-mdc-cell{border-top:1px solid rgba(0,0,0,.1607843137);border-right:1px solid rgba(0,0,0,.1607843137)}:host ::ng-deep .mat-mdc-header-cell{font-family:Montserrat;font-weight:600;font-size:14px;color:#1b2133}.success-status{width:62px;height:22px;border-radius:4px;padding:4px 12px;font-family:Lato;font-weight:400;font-size:12px;background:#1d8923;text-align:center;color:#fff}.no-data span{font-family:Lato;font-size:8.98px;color:#000000de}\n"] }]
|
|
773
|
+
}], ctorParameters: () => [{ type: i1$2.LiveAnnouncer }], propDecorators: { data: [{
|
|
774
|
+
type: Input
|
|
775
|
+
}], count: [{
|
|
776
|
+
type: Input
|
|
777
|
+
}], initialPaginationSize: [{
|
|
778
|
+
type: Input
|
|
779
|
+
}], initialPaginationSizeOptions: [{
|
|
780
|
+
type: Input
|
|
781
|
+
}], tableConfig: [{
|
|
782
|
+
type: Input
|
|
783
|
+
}], selected: [{
|
|
784
|
+
type: Input
|
|
785
|
+
}], bulkUploadEntriesCount: [{
|
|
786
|
+
type: Input
|
|
787
|
+
}], currentPage: [{
|
|
788
|
+
type: Input
|
|
789
|
+
}], isDisabled: [{
|
|
790
|
+
type: Input
|
|
791
|
+
}], selectedDataChange: [{
|
|
792
|
+
type: Output
|
|
793
|
+
}], pageChange: [{
|
|
794
|
+
type: Output
|
|
795
|
+
}], removeSelectedData: [{
|
|
796
|
+
type: Output
|
|
797
|
+
}], sortChange: [{
|
|
798
|
+
type: Output
|
|
799
|
+
}], sort: [{
|
|
800
|
+
type: ViewChild,
|
|
801
|
+
args: [MatSort]
|
|
802
|
+
}] } });
|
|
803
|
+
|
|
804
|
+
const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100 MB
|
|
805
|
+
class BulkUploadKarmayogiComponent {
|
|
806
|
+
constructor(accessControlService, snackBar) {
|
|
807
|
+
this.accessControlService = accessControlService;
|
|
808
|
+
this.snackBar = snackBar;
|
|
809
|
+
this.appliedUser = new EventEmitter();
|
|
810
|
+
this.isDisabled = false;
|
|
811
|
+
this.currrentFilterType = "success";
|
|
812
|
+
this.contacts = [];
|
|
813
|
+
this.properties = "";
|
|
814
|
+
this.flag = false;
|
|
815
|
+
this.fileUploading = false;
|
|
816
|
+
this.isSuccessUserlist = [];
|
|
817
|
+
this.isErrorUserlist = [];
|
|
818
|
+
this.fileName = "";
|
|
819
|
+
this.currentDate = new Date();
|
|
820
|
+
this.holdSelectedUsers = [];
|
|
821
|
+
this.finalSelectedUsers = [];
|
|
822
|
+
this.isCCA = false;
|
|
823
|
+
this.bulkUploadConfig = this.accessControlService.accessControlConfig().bulkUploadKarmayogi;
|
|
824
|
+
this.isCCA = this.accessControlService.accessControlConfig()?.userConfig?.org?.isCCA ?? false;
|
|
825
|
+
}
|
|
826
|
+
downloadSample() {
|
|
827
|
+
const sampleFilePath = this.bulkUploadConfig.downloadSampleFile;
|
|
828
|
+
if (sampleFilePath) {
|
|
829
|
+
const link = document.createElement("a");
|
|
830
|
+
link.href = sampleFilePath.path;
|
|
831
|
+
link.download = sampleFilePath.fileName || "sample.csv";
|
|
832
|
+
document.body.appendChild(link);
|
|
833
|
+
link.click();
|
|
834
|
+
document.body.removeChild(link);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
onDrop(input) {
|
|
838
|
+
this.fileUploading = true;
|
|
839
|
+
const files = [input];
|
|
840
|
+
const fileTypes = ["csv"]; // acceptable file types
|
|
841
|
+
if (files && files.length) {
|
|
842
|
+
const extension = files[0].name.split(".").pop().toLowerCase(); // file extension from input file
|
|
843
|
+
const isSuccess = fileTypes.indexOf(extension) > -1; // is extension in acceptable types
|
|
844
|
+
if (files[0].size > MAX_FILE_SIZE) {
|
|
845
|
+
this.fileUploading = false;
|
|
846
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
847
|
+
data: {
|
|
848
|
+
message: "The file has exceeded the 100 MB upload size limit.",
|
|
849
|
+
type: "error"
|
|
850
|
+
},
|
|
851
|
+
duration: 3000,
|
|
852
|
+
panelClass: "course-error-snackbar"
|
|
853
|
+
});
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
if (isSuccess) {
|
|
857
|
+
this.fileName = files[0].name;
|
|
858
|
+
const fileToRead = files[0];
|
|
859
|
+
const fileReader = new FileReader();
|
|
860
|
+
fileReader.onload = (event) => {
|
|
861
|
+
this.onFileLoad(event);
|
|
862
|
+
};
|
|
863
|
+
fileReader.readAsText(fileToRead, "UTF-8");
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
this.fileUploading = false;
|
|
867
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
868
|
+
data: {
|
|
869
|
+
message: "Unsupported File Format. Please upload a CSV file.",
|
|
870
|
+
type: "error"
|
|
871
|
+
},
|
|
872
|
+
duration: 3000,
|
|
873
|
+
panelClass: "course-error-snackbar"
|
|
874
|
+
});
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
this.fileUploading = false;
|
|
880
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
881
|
+
data: {
|
|
882
|
+
message: "Unsupported File Format. Please upload a CSV file.",
|
|
883
|
+
type: "error"
|
|
884
|
+
},
|
|
885
|
+
duration: 3000,
|
|
886
|
+
panelClass: "course-error-snackbar"
|
|
887
|
+
});
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
async onFileLoad(fileLoadedEvent) {
|
|
892
|
+
this.isSuccessUserlist = [];
|
|
893
|
+
this.isErrorUserlist = [];
|
|
894
|
+
const textFromFileLoaded = fileLoadedEvent.target.result;
|
|
895
|
+
this.csvContent = textFromFileLoaded;
|
|
896
|
+
// Flag is for extracting first line
|
|
897
|
+
let flag = false;
|
|
898
|
+
// Main Data
|
|
899
|
+
const objarray = [];
|
|
900
|
+
// Properties
|
|
901
|
+
const prop = [];
|
|
902
|
+
// Total Length
|
|
903
|
+
let size = 0;
|
|
904
|
+
for (const line of this.csvContent.split(/[\r\n]+/)) {
|
|
905
|
+
if (flag) {
|
|
906
|
+
const obj = {};
|
|
907
|
+
for (let k = 0; k < size; k += 1) {
|
|
908
|
+
// Dynamic Object Properties
|
|
909
|
+
obj[prop[k]] = line.split(",")[k];
|
|
910
|
+
}
|
|
911
|
+
objarray.push(obj);
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
// First Line of CSV will be having Properties
|
|
915
|
+
for (let k = 0; k < line.split(",").length; k += 1) {
|
|
916
|
+
size = line.split(",").length;
|
|
917
|
+
// Removing all the spaces to make them usefull, also removing any " characters
|
|
918
|
+
prop.push(line.split(",")[k].replace(/ /g, "").replace(/"/g, ""));
|
|
919
|
+
}
|
|
920
|
+
flag = true;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
this.contacts = objarray;
|
|
924
|
+
if (this.contacts && this.contacts.length > 0) {
|
|
925
|
+
const headerValues = Object.keys(this.contacts[0]);
|
|
926
|
+
if (headerValues.length < 0 || headerValues.length > 2) {
|
|
927
|
+
// NOSONAR
|
|
928
|
+
this.fileUploading = false;
|
|
929
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
930
|
+
data: {
|
|
931
|
+
message: "Field Mismatch. Please ensure your uploaded file matches the sample template provided.",
|
|
932
|
+
type: "error"
|
|
933
|
+
},
|
|
934
|
+
duration: 3000,
|
|
935
|
+
panelClass: "course-error-snackbar"
|
|
936
|
+
});
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (!headerValues.includes("Emailid") || !headerValues.includes("Mobilenumber")) {
|
|
940
|
+
this.fileUploading = false;
|
|
941
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
942
|
+
data: {
|
|
943
|
+
message: "Field Mismatch. Please ensure your uploaded file matches the sample template provided.",
|
|
944
|
+
type: "error"
|
|
945
|
+
},
|
|
946
|
+
duration: 3000,
|
|
947
|
+
panelClass: "course-error-snackbar"
|
|
948
|
+
});
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
this.properties = [];
|
|
953
|
+
this.properties = prop;
|
|
954
|
+
// console.log(this.properties)
|
|
955
|
+
const emailIds = [];
|
|
956
|
+
const mobileNumbers = [];
|
|
957
|
+
const bothEmailAndMobile = {};
|
|
958
|
+
this.contacts = this.contacts.filter((ele) => ele.Emailid || ele.Mobilenumber);
|
|
959
|
+
if (this.contacts.length > 50000) {
|
|
960
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
961
|
+
data: { message: "More than 50000 users are not allowed", type: "error" },
|
|
962
|
+
duration: 3000,
|
|
963
|
+
panelClass: "course-error-snackbar"
|
|
964
|
+
});
|
|
965
|
+
this.fileUploading = false;
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
await this.contacts.forEach((element) => {
|
|
969
|
+
const emailPattern = new RegExp(`^[\\w\-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$`);
|
|
970
|
+
const mobilePattern = new RegExp(/^(6|7|8|9)\d{9}$/);
|
|
971
|
+
const emailTest = element.Emailid ? emailPattern.test(element.Emailid) : true;
|
|
972
|
+
const mobileTest = element.Mobilenumber ? mobilePattern.test(element.Mobilenumber) : true;
|
|
973
|
+
element["email"] = element.Emailid;
|
|
974
|
+
element["mobile"] = element.Mobilenumber;
|
|
975
|
+
if (mobileTest && element.Mobilenumber) {
|
|
976
|
+
mobileNumbers.push(element.Mobilenumber);
|
|
977
|
+
}
|
|
978
|
+
if (emailTest && element.Emailid) {
|
|
979
|
+
emailIds.push(element.Emailid.toLowerCase());
|
|
980
|
+
}
|
|
981
|
+
if (emailTest && mobileTest) {
|
|
982
|
+
element["status"] = "Success";
|
|
983
|
+
element["userStatus"] = true;
|
|
984
|
+
bothEmailAndMobile[element.Emailid.toLowerCase()] = element;
|
|
985
|
+
}
|
|
986
|
+
else {
|
|
987
|
+
if (emailTest || mobileTest) {
|
|
988
|
+
element["status"] = "Success";
|
|
989
|
+
element["userStatus"] = true;
|
|
990
|
+
if ((!emailTest && element.Mobilenumber !== "") || (!emailTest && element.Mobilenumber === "")) {
|
|
991
|
+
element["status"] = "Error";
|
|
992
|
+
element["userStatus"] = false;
|
|
993
|
+
element["message"] = emailPattern.test(element.Emailid) ? "" : "Invalid Email id";
|
|
994
|
+
}
|
|
995
|
+
if ((!mobileTest && element.Emailid !== "") || (!mobileTest && element.Emailid === "")) {
|
|
996
|
+
element["status"] = "Error";
|
|
997
|
+
element["userStatus"] = false;
|
|
998
|
+
element["message"] = mobilePattern.test(element.Mobilenumber) ? "" : "Invalid Mobile number";
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
if (!emailTest && !mobileTest) {
|
|
1003
|
+
element["status"] = "Error";
|
|
1004
|
+
element["userStatus"] = false;
|
|
1005
|
+
element["message"] = "Invalid Email id and Mobile number";
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
element["status"] = "Error";
|
|
1009
|
+
element["userStatus"] = false;
|
|
1010
|
+
element["message"] = emailPattern.test(element.Emailid) ? "" : "Invalid Email id";
|
|
1011
|
+
element["message"] = mobilePattern.test(element.Mobilenumber) ? "" : "Invalid Mobile number";
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
// Check for duplicate email IDs
|
|
1017
|
+
const duplicateEmails = emailIds.filter((item, index) => emailIds.indexOf(item) !== index);
|
|
1018
|
+
if (duplicateEmails.length > 0) {
|
|
1019
|
+
this.fileUploading = false;
|
|
1020
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
1021
|
+
data: {
|
|
1022
|
+
message: "Duplicate email IDs found in the uploaded file. Please remove duplicates and try again.",
|
|
1023
|
+
type: "error"
|
|
1024
|
+
},
|
|
1025
|
+
duration: 3000,
|
|
1026
|
+
panelClass: "course-error-snackbar"
|
|
1027
|
+
});
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
// Check for duplicate mobile numbers
|
|
1031
|
+
const duplicateMobiles = mobileNumbers.filter((item, index) => mobileNumbers.indexOf(item) !== index);
|
|
1032
|
+
if (duplicateMobiles.length > 0) {
|
|
1033
|
+
this.fileUploading = false;
|
|
1034
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
1035
|
+
data: {
|
|
1036
|
+
message: "Duplicate mobile numbers found in the uploaded file. Please remove duplicates and try again.",
|
|
1037
|
+
type: "error"
|
|
1038
|
+
},
|
|
1039
|
+
duration: 3000,
|
|
1040
|
+
panelClass: "course-error-snackbar"
|
|
1041
|
+
});
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
this.flag = true;
|
|
1045
|
+
const emailResponseData = await this.callUserCheckApi(emailIds, "primaryEmail");
|
|
1046
|
+
const mobileResponseData = await this.callUserCheckApi(mobileNumbers, "mobile");
|
|
1047
|
+
if (emailResponseData && mobileResponseData) {
|
|
1048
|
+
this.manageData(emailResponseData, mobileResponseData);
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
this.fileUploading = false;
|
|
1052
|
+
this.snackBar.openFromComponent(SnackbarComponent, {
|
|
1053
|
+
data: {
|
|
1054
|
+
message: "Something went wrong! Please try again",
|
|
1055
|
+
type: "error"
|
|
1056
|
+
},
|
|
1057
|
+
duration: 3000,
|
|
1058
|
+
panelClass: "course-error-snackbar"
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
async callUserCheckApi(userData, key) {
|
|
1064
|
+
const request = {
|
|
1065
|
+
request: {
|
|
1066
|
+
filters: {},
|
|
1067
|
+
fields: ["userId", "email", "firstName", "lastName", "phone", "rootOrgId", "channel", "roles", "profileDetails", "rootOrgName"]
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
if (key === "primaryEmail") {
|
|
1071
|
+
request.request.filters = {
|
|
1072
|
+
...request.request.filters,
|
|
1073
|
+
email: userData
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
request.request.filters = {
|
|
1078
|
+
...request.request.filters,
|
|
1079
|
+
phone: userData
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
if (this.accessControlService.accessControlConfig()?.application === NsAccessControlConfig.Application.MDO) {
|
|
1083
|
+
if (!this.isCCA) {
|
|
1084
|
+
request.request.filters.rootOrgId = this.accessControlService.accessControlConfig().userConfig.org?.rootOrgId ? [this.accessControlService.accessControlConfig().userConfig.org?.rootOrgId] : [];
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return this.accessControlService
|
|
1088
|
+
.validateUser(request)
|
|
1089
|
+
.toPromise()
|
|
1090
|
+
.then(async (res) => {
|
|
1091
|
+
if (res.result.response) {
|
|
1092
|
+
return await res.result.response;
|
|
1093
|
+
}
|
|
1094
|
+
})
|
|
1095
|
+
.catch((_err) => { })
|
|
1096
|
+
.finally(() => Promise.resolve());
|
|
1097
|
+
}
|
|
1098
|
+
manageData(userEmailData, userMobileData) {
|
|
1099
|
+
this.isSuccessUserlist = [];
|
|
1100
|
+
this.isErrorUserlist = [];
|
|
1101
|
+
const userEmailMap = {};
|
|
1102
|
+
const userEmailMapUserId = {};
|
|
1103
|
+
const userMobileMap = {};
|
|
1104
|
+
if (userEmailData.count) {
|
|
1105
|
+
userEmailData.content.forEach(async (e) => {
|
|
1106
|
+
if (e.profileDetails) {
|
|
1107
|
+
userEmailMap[e.profileDetails.personalDetails.primaryEmail.toLowerCase()] = e;
|
|
1108
|
+
userEmailMapUserId[e.userId] = e;
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
if (userMobileData.count) {
|
|
1113
|
+
userMobileData.content.forEach(async (e) => {
|
|
1114
|
+
if (e.profileDetails) {
|
|
1115
|
+
userMobileMap[e.profileDetails.personalDetails.mobile] = e;
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
this.contacts.forEach(async (e) => {
|
|
1120
|
+
if (e.userStatus) {
|
|
1121
|
+
if (e.email && e.mobile) {
|
|
1122
|
+
const userData = userEmailMap[e.email.toLowerCase()];
|
|
1123
|
+
if (userData && userData.profileDetails.personalDetails && userData.profileDetails.personalDetails.mobile) {
|
|
1124
|
+
if (String(userData.profileDetails.personalDetails.mobile) === String(e.mobile)) {
|
|
1125
|
+
e["userId"] = userData.userId;
|
|
1126
|
+
e["ministry"] = userData.rootOrgName;
|
|
1127
|
+
e["fullName"] = userData.firstName || userData.firstname;
|
|
1128
|
+
e["mobile"] = userData?.phone;
|
|
1129
|
+
e["email"] = userData?.email;
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
e["status"] = "Error";
|
|
1133
|
+
e["userStatus"] = false;
|
|
1134
|
+
e["message"] = "Given credentials are not matching";
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
else {
|
|
1138
|
+
e["status"] = "Error";
|
|
1139
|
+
e["userStatus"] = false;
|
|
1140
|
+
e["message"] = "Given credentials are not matching";
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
else if (e.email && userEmailMap[e.email.toLowerCase()]) {
|
|
1144
|
+
const userData = userEmailMap[e.email.toLowerCase()];
|
|
1145
|
+
e["mobile"] = userData?.phone;
|
|
1146
|
+
e["userId"] = userData.userId;
|
|
1147
|
+
e["ministry"] = userData.rootOrgName;
|
|
1148
|
+
e["fullName"] = userData.firstName || userData.firstname;
|
|
1149
|
+
}
|
|
1150
|
+
else if (e.mobile && userMobileMap[e.mobile]) {
|
|
1151
|
+
const userData = userMobileMap[e.mobile];
|
|
1152
|
+
e["email"] = userData?.email;
|
|
1153
|
+
e["userId"] = userData.userId;
|
|
1154
|
+
e["ministry"] = userData.rootOrgName;
|
|
1155
|
+
e["fullName"] = userData.firstName || userData.firstname;
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
e["status"] = "Error";
|
|
1159
|
+
e["userStatus"] = false;
|
|
1160
|
+
e["message"] = "Given credentials are not matching";
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
this.fileUploading = false;
|
|
1165
|
+
this.isSuccessUserlist = this.contacts.filter((ele) => ele.userStatus);
|
|
1166
|
+
this.isErrorUserlist = this.contacts.filter((ele) => !ele.userStatus);
|
|
1167
|
+
// this.successUserData.emit(this.isSuccessUserlist);
|
|
1168
|
+
this.currrentFilterType = this.isSuccessUserlist.length ? "success" : "error";
|
|
1169
|
+
if (this.currrentFilterType === "success") {
|
|
1170
|
+
// this.displayedColumns = [
|
|
1171
|
+
// "fullName",
|
|
1172
|
+
// "email",
|
|
1173
|
+
// "ministry",
|
|
1174
|
+
// "status",
|
|
1175
|
+
// "mobile",
|
|
1176
|
+
// ];
|
|
1177
|
+
// this.dataSource = new MatTableDataSource<IUserElement>(
|
|
1178
|
+
// this.isSuccessUserlist
|
|
1179
|
+
// );
|
|
1180
|
+
this.holdSelectedUsers = this.isSuccessUserlist;
|
|
1181
|
+
this.appliedUser.emit(this.holdSelectedUsers);
|
|
1182
|
+
// document.getElementById("user-table-select")?.scrollIntoView({ behavior: "smooth" });
|
|
1183
|
+
}
|
|
1184
|
+
else if (this.currrentFilterType === "error") {
|
|
1185
|
+
// this.displayedColumns = ["email", "status", "mobile", "message"];
|
|
1186
|
+
// this.dataSource = new MatTableDataSource<IUserElement>(
|
|
1187
|
+
// this.isErrorUserlist
|
|
1188
|
+
// );
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
onFilterChange(type) {
|
|
1192
|
+
this.currrentFilterType = type;
|
|
1193
|
+
}
|
|
1194
|
+
downloadErrorFile() {
|
|
1195
|
+
this.accessControlService.downloadFile(this.isErrorUserlist, "userErrordata");
|
|
1196
|
+
}
|
|
1197
|
+
onSelectingUser(event) {
|
|
1198
|
+
this.holdSelectedUsers = [...event.selectedRows];
|
|
1199
|
+
this.appliedUser.emit(this.holdSelectedUsers);
|
|
1200
|
+
}
|
|
1201
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BulkUploadKarmayogiComponent, deps: [{ token: AccessControlService }, { token: i1.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1202
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: BulkUploadKarmayogiComponent, isStandalone: false, selector: "sb-uic-bulk-upload-karmayogi", inputs: { isDisabled: "isDisabled" }, outputs: { appliedUser: "appliedUser" }, ngImport: i0, template: "<div class=\"bulk-upload-wrapper\">\n <div class=\"flex gap-4 py-4 px-5 wrapper-border\">\n <div class=\"instructions-download py-4 px-5 border-dotted flex-1\">\n <div class=\"mb-6 text-style\">Open & follow these instruction</div>\n <div class=\"instructions-list\">\n <ul class=\"numbered-list\">\n <ng-container *ngFor=\"let item of bulkUploadConfig?.uploadInstructions\">\n <li>{{ item }}</li>\n </ng-container>\n </ul>\n </div>\n <div class=\"download-sample mt-6\">\n <button mat-flat-button (click)=\"downloadSample()\" class=\"rounded-full px-4 py-2 font-bold text-sm mat-btn-outline cursor-pointer\">\n Download Sample File\n </button>\n </div>\n </div>\n\n <div class=\"bulk-upload-select py-4 px-5 border-dotted flex-1\">\n <div class=\"right_upload_inner flex flex-col items-center justify-center\" wsAuthDragDrop (fileDropped)=\"onDrop($event)\">\n <div class=\"flex flex-row items-center justify-center margin-bottom-s\">\n <mat-icon class=\"svg-ico\" svgIcon=\"excel-sheet\"></mat-icon>\n </div>\n <div class=\"items-center justify-center flex flex-col\">\n <a class=\"new-color cursor-pointer text-sm font-bold mb-1 mt-7\" (click)=\"fileInput.click()\">Browse files</a>\n <p class=\"mt-2 text-sm\">Or</p>\n <p class=\"mt-2 ws-mat-black60-text text-base\">Drag file to upload</p>\n <p class=\"text-xs ws-mat-black87-text margin-remove\">Max size: 100 MB</p>\n <p class=\"text-xs ws-mat-black60-text margin-remove\">Supported file types: CSV</p>\n </div>\n <input type=\"file\" #fileInput class=\"inputfile\" accept=\".csv\" (change)=\"onDrop($event.target.files[0]); fileInput.value = null\" />\n <div *ngIf=\"file\" class=\"flex flex-middle justify-center flex-column position-relative pt-5 px-5\">\n <mat-icon class=\"ws-mat-primary-text\" svgIcon=\"excel-sheet\"> </mat-icon>\n <p class=\"margin-left-xs mat-h3 font-weight-500 margin-remove-bottom break\">\n <ng-container *ngIf=\"file; else elseBlock\">\n <span class=\"flex-wrap\"> {{ file?.name }}</span>\n </ng-container>\n <ng-template #elseBlock>\n <span i18n>No file uploaded</span>\n </ng-template>\n </p>\n </div>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"fileName\">\n <div class=\"filter-by-select my-4\">\n <div class=\"flex gap-4 items-center\">\n <div class=\"text-title\">Filter By</div>\n <div class=\"flex gap-2\">\n <button\n mat-flat-button\n (click)=\"onFilterChange('success')\"\n [ngClass]=\"currrentFilterType === 'success' ? 'new-bg-color text-white mat-btn-flat' : 'mat-btn-outline'\"\n class=\"rounded-full px-4 py-2 font-bold text-sm cursor-pointer\">\n Success\n </button>\n <button\n (click)=\"onFilterChange('error')\"\n mat-flat-button\n [ngClass]=\"currrentFilterType === 'error' ? 'new-bg-color text-white mat-btn-flat' : 'mat-btn-outline'\"\n class=\"rounded-full px-4 py-2 font-bold text-sm cursor-pointer\">\n Error\n </button>\n </div>\n </div>\n </div>\n\n <div class=\"list-table-bulk-upload\">\n <ng-container *ngIf=\"currrentFilterType === 'success'\">\n <div class=\"flex items-center gap-2 selection-count mb-4 p-2\">\n <span class=\"\">{{ holdSelectedUsers?.length }}</span>\n <span class=\"text-sm font-normal\">Items Selected</span>\n </div>\n <sb-uic-list-table\n [data]=\"isSuccessUserlist\"\n [count]=\"1\"\n [initialPaginationSize]=\"bulkUploadConfig['bulkUploadTable']?.initialPaginationSize\"\n [tableConfig]=\"bulkUploadConfig['bulkUploadTable']\"\n (selectedDataChange)=\"onSelectingUser($event)\"\n [selected]=\"holdSelectedUsers\"\n [isDisabled]=\"isDisabled\"\n [bulkUploadEntriesCount]=\"{ totalCount: isSuccessUserlist?.length + isErrorUserlist?.length, success: isSuccessUserlist?.length }\">\n </sb-uic-list-table>\n\n <!-- <ng-container *ngIf=\"isSuccessUserlist?.length && holdSelectedUsers?.length\">\n <div class=\"w-full mt-4\">\n <button\n mat-flat-button\n (click)=\"applySelections()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2 w-full\">\n Apply\n </button>\n </div>\n </ng-container> -->\n </ng-container>\n\n <ng-container *ngIf=\"currrentFilterType === 'error'\">\n <div class=\"wrapper-border rounded-sm p-4\">\n <div class=\"log-history-text\">Log History</div>\n </div>\n <div class=\"information-list py-4 px-6\">\n <!-- <ng-container *ngFor=\"let item of isErrorUserlist\"> -->\n <ng-container *ngIf=\"isErrorUserlist?.length > 0; else noErrorList\">\n <div class=\"rounded-lg wrapper-border py-5 px-4 mb-4\">\n <div class=\"flex items-center justify-between\">\n <div class=\"error-log-title flex gap-2 items-center\">\n <span class=\"text-title text-dark\">File Information</span>\n <img src=\"/assets/icons/icon-wrapper.svg\" alt=\"tooltip-icon\" />\n </div>\n <button mat-flat-button (click)=\"downloadErrorFile()\" class=\"rounded-full px-4 py-2 font-bold text-sm mat-btn-outline cursor-pointer\">\n <mat-icon class=\"new-color\">file_download</mat-icon>\n Download error log\n </button>\n </div>\n <div class=\"my-4 meta-info\">\n <div class=\"flex gap-2 items-center\">\n <span class=\"text-title text-dark\">{{ fileName }}</span>\n <img src=\"/assets/icons/error-icon.svg\" alt=\"error-icon\" />\n </div>\n <div class=\"text-style text-dark\">There's an error occurred while uploading this file.</div>\n </div>\n <div class=\"flex gap-x-6 gap-y-4 falied-records-info\">\n <div class=\"flex flex-column gap-4 flex-grow-1\">\n <div>\n <p class=\"text-sm text-gray-500\">Name</p>\n <p class=\"font-medium break-all text-dark\">\n {{ fileName }}\n </p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500\">Total Records</p>\n <p class=\"font-medium text-dark\">{{ isSuccessUserlist?.length + isErrorUserlist?.length }}</p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500 mt-2\">Failed Records</p>\n <p class=\"font-medium text-dark\">{{ isErrorUserlist?.length }}</p>\n </div>\n </div>\n <div class=\"flex flex-column gap-4 flex-grow-1\">\n <div>\n <p class=\"text-sm text-gray-500\">Status</p>\n <p class=\"text-red-600 font-normal\">FAILED</p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500\">Created On</p>\n <p class=\"font-medium text-dark\">{{ currentDate | date : \"medium\" }}</p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500 mt-2\">Updated On</p>\n <p class=\"font-medium text-dark\">{{ currentDate | date : \"medium\" }}</p>\n </div>\n </div>\n <div class=\"flex flex-column gap-4 flex-grow-1\">\n <div>\n <p class=\"text-sm text-gray-500\">Success Records</p>\n <p class=\"font-medium text-dark\">{{ isSuccessUserlist?.length }}</p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-template #noErrorList>\n <div class=\"wrapper-border rounded-lg py-5 px-4 mb-4\">\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\" />\n <span class=\"font-bold\">No information to display yet</span>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n", styles: [".wrapper-border{border:1px solid rgba(0,0,0,.0784313725)}.numbered-list{list-style:none;counter-reset:list-counter;padding-left:0}.numbered-list li{counter-increment:list-counter;margin-bottom:16px}.numbered-list li:before{content:counter(list-counter) \". \"}.text-style,.numbered-list li{color:#000000de;font-family:Lato;font-weight:400;font-size:14px}.border-dotted{border:1px dashed rgba(0,0,0,.1607843137)}.svg-ico{width:75px;height:75px}.inputfile{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute;z-index:-1}.inputfile+label{font-size:1.25em;color:#fff;display:inline-block;cursor:pointer}.browse_link{color:#1b4ca1;padding:6px 15px;text-align:center;border-radius:4px}.or-text{margin-bottom:0!important}.ws-mat-black87-text{color:#000000de}.text-title,.log-history-text{font-family:Montserrat;font-weight:600;font-size:16px;text-align:center;color:#1b4ca1}.selection-count{border:1px solid rgba(0,0,0,.0784313725);background:#d1dbec}.selection-count span{font-family:Lato;font-weight:400}.selection-count span:first-child{background:#d1dbec;border:1px solid rgba(0,0,0,.1607843137);border-radius:50%;padding:4px;height:18px;width:18px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#0009}.selection-count span:nth-child(2){font-size:14px;color:#000000de}.log-history-text{font-size:14px;color:#1b2133;text-align:start}.information-list{border:1px solid rgba(0,0,0,.0784313725)}.meta-info{background:#d1392429;border:1px solid rgba(0,0,0,.0784313725);border-radius:12px;padding:18px 16px}.falied-records-info p{margin-bottom:8px!important}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i11.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: ListTableComponent, selector: "sb-uic-list-table", inputs: ["data", "count", "initialPaginationSize", "initialPaginationSizeOptions", "tableConfig", "selected", "bulkUploadEntriesCount", "currentPage", "isDisabled"], outputs: ["selectedDataChange", "pageChange", "removeSelectedData", "sortChange"] }, { kind: "directive", type: DragDropDirective, selector: "[wsAuthDragDrop]", outputs: ["fileDropped"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }] }); }
|
|
1203
|
+
}
|
|
1204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BulkUploadKarmayogiComponent, decorators: [{
|
|
1205
|
+
type: Component,
|
|
1206
|
+
args: [{ selector: "sb-uic-bulk-upload-karmayogi", standalone: false, template: "<div class=\"bulk-upload-wrapper\">\n <div class=\"flex gap-4 py-4 px-5 wrapper-border\">\n <div class=\"instructions-download py-4 px-5 border-dotted flex-1\">\n <div class=\"mb-6 text-style\">Open & follow these instruction</div>\n <div class=\"instructions-list\">\n <ul class=\"numbered-list\">\n <ng-container *ngFor=\"let item of bulkUploadConfig?.uploadInstructions\">\n <li>{{ item }}</li>\n </ng-container>\n </ul>\n </div>\n <div class=\"download-sample mt-6\">\n <button mat-flat-button (click)=\"downloadSample()\" class=\"rounded-full px-4 py-2 font-bold text-sm mat-btn-outline cursor-pointer\">\n Download Sample File\n </button>\n </div>\n </div>\n\n <div class=\"bulk-upload-select py-4 px-5 border-dotted flex-1\">\n <div class=\"right_upload_inner flex flex-col items-center justify-center\" wsAuthDragDrop (fileDropped)=\"onDrop($event)\">\n <div class=\"flex flex-row items-center justify-center margin-bottom-s\">\n <mat-icon class=\"svg-ico\" svgIcon=\"excel-sheet\"></mat-icon>\n </div>\n <div class=\"items-center justify-center flex flex-col\">\n <a class=\"new-color cursor-pointer text-sm font-bold mb-1 mt-7\" (click)=\"fileInput.click()\">Browse files</a>\n <p class=\"mt-2 text-sm\">Or</p>\n <p class=\"mt-2 ws-mat-black60-text text-base\">Drag file to upload</p>\n <p class=\"text-xs ws-mat-black87-text margin-remove\">Max size: 100 MB</p>\n <p class=\"text-xs ws-mat-black60-text margin-remove\">Supported file types: CSV</p>\n </div>\n <input type=\"file\" #fileInput class=\"inputfile\" accept=\".csv\" (change)=\"onDrop($event.target.files[0]); fileInput.value = null\" />\n <div *ngIf=\"file\" class=\"flex flex-middle justify-center flex-column position-relative pt-5 px-5\">\n <mat-icon class=\"ws-mat-primary-text\" svgIcon=\"excel-sheet\"> </mat-icon>\n <p class=\"margin-left-xs mat-h3 font-weight-500 margin-remove-bottom break\">\n <ng-container *ngIf=\"file; else elseBlock\">\n <span class=\"flex-wrap\"> {{ file?.name }}</span>\n </ng-container>\n <ng-template #elseBlock>\n <span i18n>No file uploaded</span>\n </ng-template>\n </p>\n </div>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"fileName\">\n <div class=\"filter-by-select my-4\">\n <div class=\"flex gap-4 items-center\">\n <div class=\"text-title\">Filter By</div>\n <div class=\"flex gap-2\">\n <button\n mat-flat-button\n (click)=\"onFilterChange('success')\"\n [ngClass]=\"currrentFilterType === 'success' ? 'new-bg-color text-white mat-btn-flat' : 'mat-btn-outline'\"\n class=\"rounded-full px-4 py-2 font-bold text-sm cursor-pointer\">\n Success\n </button>\n <button\n (click)=\"onFilterChange('error')\"\n mat-flat-button\n [ngClass]=\"currrentFilterType === 'error' ? 'new-bg-color text-white mat-btn-flat' : 'mat-btn-outline'\"\n class=\"rounded-full px-4 py-2 font-bold text-sm cursor-pointer\">\n Error\n </button>\n </div>\n </div>\n </div>\n\n <div class=\"list-table-bulk-upload\">\n <ng-container *ngIf=\"currrentFilterType === 'success'\">\n <div class=\"flex items-center gap-2 selection-count mb-4 p-2\">\n <span class=\"\">{{ holdSelectedUsers?.length }}</span>\n <span class=\"text-sm font-normal\">Items Selected</span>\n </div>\n <sb-uic-list-table\n [data]=\"isSuccessUserlist\"\n [count]=\"1\"\n [initialPaginationSize]=\"bulkUploadConfig['bulkUploadTable']?.initialPaginationSize\"\n [tableConfig]=\"bulkUploadConfig['bulkUploadTable']\"\n (selectedDataChange)=\"onSelectingUser($event)\"\n [selected]=\"holdSelectedUsers\"\n [isDisabled]=\"isDisabled\"\n [bulkUploadEntriesCount]=\"{ totalCount: isSuccessUserlist?.length + isErrorUserlist?.length, success: isSuccessUserlist?.length }\">\n </sb-uic-list-table>\n\n <!-- <ng-container *ngIf=\"isSuccessUserlist?.length && holdSelectedUsers?.length\">\n <div class=\"w-full mt-4\">\n <button\n mat-flat-button\n (click)=\"applySelections()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2 w-full\">\n Apply\n </button>\n </div>\n </ng-container> -->\n </ng-container>\n\n <ng-container *ngIf=\"currrentFilterType === 'error'\">\n <div class=\"wrapper-border rounded-sm p-4\">\n <div class=\"log-history-text\">Log History</div>\n </div>\n <div class=\"information-list py-4 px-6\">\n <!-- <ng-container *ngFor=\"let item of isErrorUserlist\"> -->\n <ng-container *ngIf=\"isErrorUserlist?.length > 0; else noErrorList\">\n <div class=\"rounded-lg wrapper-border py-5 px-4 mb-4\">\n <div class=\"flex items-center justify-between\">\n <div class=\"error-log-title flex gap-2 items-center\">\n <span class=\"text-title text-dark\">File Information</span>\n <img src=\"/assets/icons/icon-wrapper.svg\" alt=\"tooltip-icon\" />\n </div>\n <button mat-flat-button (click)=\"downloadErrorFile()\" class=\"rounded-full px-4 py-2 font-bold text-sm mat-btn-outline cursor-pointer\">\n <mat-icon class=\"new-color\">file_download</mat-icon>\n Download error log\n </button>\n </div>\n <div class=\"my-4 meta-info\">\n <div class=\"flex gap-2 items-center\">\n <span class=\"text-title text-dark\">{{ fileName }}</span>\n <img src=\"/assets/icons/error-icon.svg\" alt=\"error-icon\" />\n </div>\n <div class=\"text-style text-dark\">There's an error occurred while uploading this file.</div>\n </div>\n <div class=\"flex gap-x-6 gap-y-4 falied-records-info\">\n <div class=\"flex flex-column gap-4 flex-grow-1\">\n <div>\n <p class=\"text-sm text-gray-500\">Name</p>\n <p class=\"font-medium break-all text-dark\">\n {{ fileName }}\n </p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500\">Total Records</p>\n <p class=\"font-medium text-dark\">{{ isSuccessUserlist?.length + isErrorUserlist?.length }}</p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500 mt-2\">Failed Records</p>\n <p class=\"font-medium text-dark\">{{ isErrorUserlist?.length }}</p>\n </div>\n </div>\n <div class=\"flex flex-column gap-4 flex-grow-1\">\n <div>\n <p class=\"text-sm text-gray-500\">Status</p>\n <p class=\"text-red-600 font-normal\">FAILED</p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500\">Created On</p>\n <p class=\"font-medium text-dark\">{{ currentDate | date : \"medium\" }}</p>\n </div>\n <div>\n <p class=\"text-sm text-gray-500 mt-2\">Updated On</p>\n <p class=\"font-medium text-dark\">{{ currentDate | date : \"medium\" }}</p>\n </div>\n </div>\n <div class=\"flex flex-column gap-4 flex-grow-1\">\n <div>\n <p class=\"text-sm text-gray-500\">Success Records</p>\n <p class=\"font-medium text-dark\">{{ isSuccessUserlist?.length }}</p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-template #noErrorList>\n <div class=\"wrapper-border rounded-lg py-5 px-4 mb-4\">\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\" />\n <span class=\"font-bold\">No information to display yet</span>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n", styles: [".wrapper-border{border:1px solid rgba(0,0,0,.0784313725)}.numbered-list{list-style:none;counter-reset:list-counter;padding-left:0}.numbered-list li{counter-increment:list-counter;margin-bottom:16px}.numbered-list li:before{content:counter(list-counter) \". \"}.text-style,.numbered-list li{color:#000000de;font-family:Lato;font-weight:400;font-size:14px}.border-dotted{border:1px dashed rgba(0,0,0,.1607843137)}.svg-ico{width:75px;height:75px}.inputfile{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute;z-index:-1}.inputfile+label{font-size:1.25em;color:#fff;display:inline-block;cursor:pointer}.browse_link{color:#1b4ca1;padding:6px 15px;text-align:center;border-radius:4px}.or-text{margin-bottom:0!important}.ws-mat-black87-text{color:#000000de}.text-title,.log-history-text{font-family:Montserrat;font-weight:600;font-size:16px;text-align:center;color:#1b4ca1}.selection-count{border:1px solid rgba(0,0,0,.0784313725);background:#d1dbec}.selection-count span{font-family:Lato;font-weight:400}.selection-count span:first-child{background:#d1dbec;border:1px solid rgba(0,0,0,.1607843137);border-radius:50%;padding:4px;height:18px;width:18px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#0009}.selection-count span:nth-child(2){font-size:14px;color:#000000de}.log-history-text{font-size:14px;color:#1b2133;text-align:start}.information-list{border:1px solid rgba(0,0,0,.0784313725)}.meta-info{background:#d1392429;border:1px solid rgba(0,0,0,.0784313725);border-radius:12px;padding:18px 16px}.falied-records-info p{margin-bottom:8px!important}\n"] }]
|
|
1207
|
+
}], ctorParameters: () => [{ type: AccessControlService }, { type: i1.MatSnackBar }], propDecorators: { appliedUser: [{
|
|
1208
|
+
type: Output
|
|
1209
|
+
}], isDisabled: [{
|
|
1210
|
+
type: Input
|
|
1211
|
+
}] } });
|
|
1212
|
+
|
|
1213
|
+
class InviteUsersComponent {
|
|
1214
|
+
constructor(dialogRef, accessControlService, snackbar) {
|
|
1215
|
+
this.dialogRef = dialogRef;
|
|
1216
|
+
this.accessControlService = accessControlService;
|
|
1217
|
+
this.snackbar = snackbar;
|
|
1218
|
+
this.data = inject(MAT_DIALOG_DATA);
|
|
1219
|
+
this.destroy$ = new Subject();
|
|
1220
|
+
this.searchControl = new FormControl("");
|
|
1221
|
+
this.filterValue = "add_karmayogis";
|
|
1222
|
+
this.usersList = [];
|
|
1223
|
+
this.totalUsers = 0;
|
|
1224
|
+
this.holdSelectedUsers = [];
|
|
1225
|
+
this.finalSelectedUsers = [];
|
|
1226
|
+
this.usersFinalList = [];
|
|
1227
|
+
this.bulkUploadUserList = [];
|
|
1228
|
+
this.usersLoading = false;
|
|
1229
|
+
this.activeTab = 0;
|
|
1230
|
+
this.sortState = {};
|
|
1231
|
+
this.pagination = {
|
|
1232
|
+
limit: 5,
|
|
1233
|
+
offset: 0,
|
|
1234
|
+
};
|
|
1235
|
+
this.filters = {};
|
|
1236
|
+
this.currentPage = 1;
|
|
1237
|
+
this.isCCA = false;
|
|
1238
|
+
}
|
|
1239
|
+
ngOnInit() {
|
|
1240
|
+
this.usersTableConfig = this.accessControlService.accessControlConfig().usersTableConfig;
|
|
1241
|
+
this.isCCA = this.accessControlService.accessControlConfig()?.userConfig?.org?.isCCA ?? false;
|
|
1242
|
+
if (this.data && this.data.selected && this.data.selected.length) {
|
|
1243
|
+
if (!this.isArrayOfObjects(this.data?.selected)) {
|
|
1244
|
+
this.getUsersList("", this.data?.selected?.length, this.pagination.offset, this.data?.selected);
|
|
1245
|
+
}
|
|
1246
|
+
else {
|
|
1247
|
+
this.usersFinalList = [...this.data.selected];
|
|
1248
|
+
this.holdSelectedUsers = [...this.usersFinalList];
|
|
1249
|
+
this.finalSelectedUsers = [...this.usersFinalList];
|
|
1250
|
+
this.activeTab = 1;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
ngOnDestroy() {
|
|
1255
|
+
this.destroy$.next();
|
|
1256
|
+
this.destroy$.complete();
|
|
1257
|
+
}
|
|
1258
|
+
onClose() {
|
|
1259
|
+
this.dialogRef.close();
|
|
1260
|
+
}
|
|
1261
|
+
search() {
|
|
1262
|
+
let reducedData = {};
|
|
1263
|
+
this.resetPagination();
|
|
1264
|
+
this.sortState = {};
|
|
1265
|
+
const pickEntity = [
|
|
1266
|
+
NsAccessControlConfig.SelectionType.Organizations,
|
|
1267
|
+
NsAccessControlConfig.SelectionType.VerificationStatus,
|
|
1268
|
+
NsAccessControlConfig.SelectionType.Designation,
|
|
1269
|
+
NsAccessControlConfig.SelectionType.Group,
|
|
1270
|
+
NsAccessControlConfig.SelectionType.Cadre,
|
|
1271
|
+
NsAccessControlConfig.SelectionType.Service,
|
|
1272
|
+
NsAccessControlConfig.SelectionType.Batch,
|
|
1273
|
+
];
|
|
1274
|
+
if (this.accessControlService.accessControlConfig()?.application === NsAccessControlConfig.Application.MDO) {
|
|
1275
|
+
if (!this.isCCA) {
|
|
1276
|
+
reducedData.rootOrgId = this.accessControlService.accessControlConfig().userConfig.org?.rootOrgId ? [this.accessControlService.accessControlConfig().userConfig.org?.rootOrgId] : [];
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
if (this.data?.rule?.conditions.length) {
|
|
1280
|
+
reducedData = this.data?.rule?.conditions.reduce((acc, curr) => {
|
|
1281
|
+
if (pickEntity.includes(curr.entity)) {
|
|
1282
|
+
acc[curr.entity] = curr.selections;
|
|
1283
|
+
}
|
|
1284
|
+
return acc;
|
|
1285
|
+
}, { ...reducedData });
|
|
1286
|
+
}
|
|
1287
|
+
if (Object.keys(reducedData)?.length) {
|
|
1288
|
+
this.filters = {
|
|
1289
|
+
rootOrgId: reducedData?.rootOrgId,
|
|
1290
|
+
"profileDetails.profileStatus": reducedData.profilestatus,
|
|
1291
|
+
"profileDetails.professionalDetails.designation": reducedData.designation,
|
|
1292
|
+
"profileDetails.professionalDetails.group": reducedData.group,
|
|
1293
|
+
"profileDetails.cadreDetails.cadreName": reducedData.Cadre,
|
|
1294
|
+
"profileDetails.cadreDetails.civilServiceName": reducedData.service,
|
|
1295
|
+
"profileDetails.cadreDetails.cadreBatch": reducedData.batch,
|
|
1296
|
+
status: 1,
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
this.getUsersList(this.searchControl.value, this.pagination.limit, this.pagination.offset, [], this.filters, this.sortState);
|
|
1300
|
+
}
|
|
1301
|
+
onFilterChange(event) {
|
|
1302
|
+
if (event?.value === "bulk_upload_karmayogis")
|
|
1303
|
+
this.bulkUploadUserList = [];
|
|
1304
|
+
this.filterValue = event.value;
|
|
1305
|
+
}
|
|
1306
|
+
getUsersList(query, limit, offset, userIds, filters, sorting) {
|
|
1307
|
+
this.usersLoading = true;
|
|
1308
|
+
this.accessControlService
|
|
1309
|
+
.fetchUserList(query, { limit: limit, offset: offset }, userIds, filters, sorting)
|
|
1310
|
+
.pipe(takeUntil(this.destroy$))
|
|
1311
|
+
.subscribe({
|
|
1312
|
+
next: (response) => {
|
|
1313
|
+
if (response?.result && response?.result?.response?.content) {
|
|
1314
|
+
this.usersList = response?.result?.response?.content;
|
|
1315
|
+
this.totalUsers = response?.result?.response?.count;
|
|
1316
|
+
if (userIds?.length) {
|
|
1317
|
+
this.finalSelectedUsers = response.result.response.content;
|
|
1318
|
+
this.holdSelectedUsers = this.finalSelectedUsers;
|
|
1319
|
+
this.activeTab = 1;
|
|
1320
|
+
}
|
|
1321
|
+
if (this.holdSelectedUsers?.length) {
|
|
1322
|
+
this.usersFinalList = [...this.holdSelectedUsers];
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
else {
|
|
1326
|
+
this.usersList = [];
|
|
1327
|
+
this.totalUsers = 0;
|
|
1328
|
+
}
|
|
1329
|
+
this.usersLoading = false;
|
|
1330
|
+
},
|
|
1331
|
+
complete: () => {
|
|
1332
|
+
this.usersLoading = false;
|
|
1333
|
+
},
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
onSelectingUser(event) {
|
|
1337
|
+
this.holdSelectedUsers = [...event.selectedRows];
|
|
1338
|
+
}
|
|
1339
|
+
selectUsers() {
|
|
1340
|
+
this.finalSelectedUsers = this.holdSelectedUsers;
|
|
1341
|
+
this.usersFinalList = [...this.finalSelectedUsers];
|
|
1342
|
+
this.snackbar.openFromComponent(SnackbarComponent, {
|
|
1343
|
+
data: { message: `Users added to Selected tab`, type: "success" },
|
|
1344
|
+
duration: 3000,
|
|
1345
|
+
panelClass: "course-success-snackbar",
|
|
1346
|
+
});
|
|
1347
|
+
this.activeTab = 1;
|
|
1348
|
+
}
|
|
1349
|
+
onPageChange(event) {
|
|
1350
|
+
this.currentPage = event.currentPage;
|
|
1351
|
+
this.pagination.limit = event.limit;
|
|
1352
|
+
this.pagination.offset = (event.currentPage - 1) * this.pagination.limit;
|
|
1353
|
+
this.getUsersList(this.searchControl.value, this.pagination.limit, this.pagination.offset, [], this.filters, this.sortState);
|
|
1354
|
+
}
|
|
1355
|
+
removedUserData(event) {
|
|
1356
|
+
this.finalSelectedUsers = [...event.remainingList];
|
|
1357
|
+
this.holdSelectedUsers = this.finalSelectedUsers;
|
|
1358
|
+
}
|
|
1359
|
+
onSelectingUserToApply(event) {
|
|
1360
|
+
this.usersFinalList = [...event.selectedRows];
|
|
1361
|
+
this.holdSelectedUsers = [...event.selectedRows];
|
|
1362
|
+
}
|
|
1363
|
+
applySelections() {
|
|
1364
|
+
this.dialogRef.close({ rule: this.data.rule, condition: this.data.condition, selected: this.usersFinalList });
|
|
1365
|
+
}
|
|
1366
|
+
isArrayOfObjects(arr) {
|
|
1367
|
+
return Array.isArray(arr) && arr.every((item) => typeof item === "object" && item !== null && !Array.isArray(item));
|
|
1368
|
+
}
|
|
1369
|
+
onSortChange(sortState) {
|
|
1370
|
+
this.sortState = sortState;
|
|
1371
|
+
this.getUsersList(this.searchControl.value, this.pagination.limit, this.pagination.offset, [], this.filters, sortState);
|
|
1372
|
+
}
|
|
1373
|
+
resetPagination() {
|
|
1374
|
+
this.currentPage = 1;
|
|
1375
|
+
this.pagination.limit = 5;
|
|
1376
|
+
this.pagination.offset = 0;
|
|
1377
|
+
}
|
|
1378
|
+
onApplyingUserBulkUpload(event) {
|
|
1379
|
+
this.bulkUploadUserList = event;
|
|
1380
|
+
}
|
|
1381
|
+
applySelectionsBulk() {
|
|
1382
|
+
this.dialogRef.close({ rule: this.data.rule, condition: this.data.condition, selected: this.bulkUploadUserList });
|
|
1383
|
+
}
|
|
1384
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InviteUsersComponent, deps: [{ token: i1$3.MatDialogRef }, { token: AccessControlService }, { token: i1.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1385
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: InviteUsersComponent, isStandalone: false, selector: "sb-uic-invite-users", ngImport: i0, template: "<div class=\"flex justify-between dialog-heading items-center\">\n <h2 mat-dialog-title class=\"mb-0\">Users</h2>\n <button mat-icon-button class=\"close-button\" (click)=\"onClose()\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n\n<div mat-dialog-content class=\"user-dialog-body\">\n <div class=\"\">\n <!-- Filter Options -->\n <div class=\"filter-options\">\n <mat-radio-group [(ngModel)]=\"filterValue\" aria-label=\"Filter options\" (change)=\"onFilterChange($event)\">\n <mat-radio-button class=\"text-dark\" value=\"add_karmayogis\">Add Karmayogis</mat-radio-button>\n <mat-radio-button class=\"text-dark\" value=\"bulk_upload_karmayogis\">Bulk Upload Karmayogis</mat-radio-button>\n </mat-radio-group>\n </div>\n </div>\n\n <ng-container *ngIf=\"filterValue === 'add_karmayogis'\">\n <!-- Search Box -->\n <div class=\"search-container flex items-center gap-4 mb-4\">\n <div class=\"mat-full-radius flex-grow\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-icon matPrefix>search</mat-icon>\n <input matInput placeholder=\"Search by Name, Email and Phone Number\" [formControl]=\"searchControl\" (keyup.enter)=\"search()\" />\n </mat-form-field>\n </div>\n <button mat-flat-button class=\"flex items-center rounded-full new-bg-color font-bold text-sm text-white search-button\" (click)=\"search()\">\n Search\n </button>\n </div>\n\n <div class=\"contents-wrapper\">\n <ng-container>\n <mat-tab-group mat-stretch-tabs=\"false\" mat-align-tabs=\"start\" [(selectedIndex)]=\"activeTab\" dynamicHeight>\n <mat-tab label=\"All Learners\" class=\"mb-3\">\n <ng-container *ngIf=\"usersLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <div [ngClass]=\"{ hidden: usersLoading }\">\n <ng-container *ngIf=\"usersList && usersList.length > 0; else noData\">\n <sb-uic-list-table\n [data]=\"usersList\"\n [count]=\"totalUsers\"\n [initialPaginationSize]=\"pagination.limit\"\n [tableConfig]=\"usersTableConfig['allLearners']\"\n (selectedDataChange)=\"onSelectingUser($event)\"\n (pageChange)=\"onPageChange($event)\"\n (sortChange)=\"onSortChange($event)\"\n [selected]=\"usersFinalList\"\n [isDisabled]=\"data?.disabled\"\n [currentPage]=\"currentPage\"></sb-uic-list-table>\n </ng-container>\n </div>\n </mat-tab>\n <mat-tab label=\" Selected Users\" class=\"mb-3\">\n <ng-container *ngIf=\"usersLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <div [ngClass]=\"{ hidden: usersLoading }\">\n <ng-container *ngIf=\"finalSelectedUsers && finalSelectedUsers.length > 0; else noData\">\n <sb-uic-list-table\n [data]=\"finalSelectedUsers\"\n [count]=\"finalSelectedUsers.length || 0\"\n [initialPaginationSize]=\"pagination.limit\"\n [tableConfig]=\"usersTableConfig['selectedUsers']\"\n (selectedDataChange)=\"onSelectingUserToApply($event)\"\n (removeSelectedData)=\"removedUserData($event)\"\n [isDisabled]=\"data?.disabled\"\n [selected]=\"usersFinalList\"></sb-uic-list-table>\n </ng-container>\n </div>\n </mat-tab>\n </mat-tab-group>\n </ng-container>\n\n <ng-template #noData>\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\" />\n <span class=\"font-bold\">No information to display yet</span>\n </div>\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"filterValue === 'bulk_upload_karmayogis'\">\n <sb-uic-bulk-upload-karmayogi (appliedUser)=\"onApplyingUserBulkUpload($event)\" [isDisabled]=\"data?.disabled\"></sb-uic-bulk-upload-karmayogi>\n </ng-container>\n</div>\n\n<mat-dialog-actions>\n <ng-container *ngIf=\"filterValue === 'add_karmayogis'\">\n <ng-container *ngIf=\"activeTab === 0 && usersList.length\">\n <button\n mat-flat-button\n (click)=\"selectUsers()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white w-full mt-2\"\n [disabled]=\"holdSelectedUsers?.length === 0 || data?.disabled\">\n Select Users\n </button>\n </ng-container>\n <ng-container *ngIf=\"activeTab === 1 && usersFinalList.length && finalSelectedUsers.length\">\n <button\n [disabled]=\"data?.disabled\"\n mat-flat-button\n (click)=\"applySelections()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white w-full mt-2\">\n Apply\n </button>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"filterValue === 'bulk_upload_karmayogis'\">\n <ng-container *ngIf=\"bulkUploadUserList?.length\">\n <button\n [disabled]=\"data?.disabled\"\n mat-flat-button\n (click)=\"applySelectionsBulk()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white w-full mt-2\">\n Apply\n </button>\n </ng-container>\n </ng-container>\n</mat-dialog-actions>\n", styles: [":host{display:block}.dialog-heading{border-bottom:2px solid rgba(0,0,0,.12);padding:0 16px}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title{margin-bottom:8px!important;font-family:Montserrat;font-weight:600;font-size:16px;color:#000000de;padding:0 24px 9px 0}.close-button{margin-right:-8px}.user-dialog-body ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.search-button{padding:4px 24px}.filter-options{margin-bottom:15px}.filter-options .mat-radio-button{margin-right:24px}.no-data span{font-family:Lato;font-size:8.98px;color:#000000de}.mt-4{margin-top:1rem!important}.spinner-loader{height:200px}:host ::ng-deep .mat-mdc-dialog-content{max-height:75vh!important}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i5.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i1$3.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$3.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$3.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i11.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i11.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i11$1.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "component", type: i11$1.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: i12.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: ListTableComponent, selector: "sb-uic-list-table", inputs: ["data", "count", "initialPaginationSize", "initialPaginationSizeOptions", "tableConfig", "selected", "bulkUploadEntriesCount", "currentPage", "isDisabled"], outputs: ["selectedDataChange", "pageChange", "removeSelectedData", "sortChange"] }, { kind: "component", type: BulkUploadKarmayogiComponent, selector: "sb-uic-bulk-upload-karmayogi", inputs: ["isDisabled"], outputs: ["appliedUser"] }] }); }
|
|
1386
|
+
}
|
|
1387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InviteUsersComponent, decorators: [{
|
|
1388
|
+
type: Component,
|
|
1389
|
+
args: [{ selector: "sb-uic-invite-users", standalone: false, template: "<div class=\"flex justify-between dialog-heading items-center\">\n <h2 mat-dialog-title class=\"mb-0\">Users</h2>\n <button mat-icon-button class=\"close-button\" (click)=\"onClose()\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n\n<div mat-dialog-content class=\"user-dialog-body\">\n <div class=\"\">\n <!-- Filter Options -->\n <div class=\"filter-options\">\n <mat-radio-group [(ngModel)]=\"filterValue\" aria-label=\"Filter options\" (change)=\"onFilterChange($event)\">\n <mat-radio-button class=\"text-dark\" value=\"add_karmayogis\">Add Karmayogis</mat-radio-button>\n <mat-radio-button class=\"text-dark\" value=\"bulk_upload_karmayogis\">Bulk Upload Karmayogis</mat-radio-button>\n </mat-radio-group>\n </div>\n </div>\n\n <ng-container *ngIf=\"filterValue === 'add_karmayogis'\">\n <!-- Search Box -->\n <div class=\"search-container flex items-center gap-4 mb-4\">\n <div class=\"mat-full-radius flex-grow\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-icon matPrefix>search</mat-icon>\n <input matInput placeholder=\"Search by Name, Email and Phone Number\" [formControl]=\"searchControl\" (keyup.enter)=\"search()\" />\n </mat-form-field>\n </div>\n <button mat-flat-button class=\"flex items-center rounded-full new-bg-color font-bold text-sm text-white search-button\" (click)=\"search()\">\n Search\n </button>\n </div>\n\n <div class=\"contents-wrapper\">\n <ng-container>\n <mat-tab-group mat-stretch-tabs=\"false\" mat-align-tabs=\"start\" [(selectedIndex)]=\"activeTab\" dynamicHeight>\n <mat-tab label=\"All Learners\" class=\"mb-3\">\n <ng-container *ngIf=\"usersLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <div [ngClass]=\"{ hidden: usersLoading }\">\n <ng-container *ngIf=\"usersList && usersList.length > 0; else noData\">\n <sb-uic-list-table\n [data]=\"usersList\"\n [count]=\"totalUsers\"\n [initialPaginationSize]=\"pagination.limit\"\n [tableConfig]=\"usersTableConfig['allLearners']\"\n (selectedDataChange)=\"onSelectingUser($event)\"\n (pageChange)=\"onPageChange($event)\"\n (sortChange)=\"onSortChange($event)\"\n [selected]=\"usersFinalList\"\n [isDisabled]=\"data?.disabled\"\n [currentPage]=\"currentPage\"></sb-uic-list-table>\n </ng-container>\n </div>\n </mat-tab>\n <mat-tab label=\" Selected Users\" class=\"mb-3\">\n <ng-container *ngIf=\"usersLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <div [ngClass]=\"{ hidden: usersLoading }\">\n <ng-container *ngIf=\"finalSelectedUsers && finalSelectedUsers.length > 0; else noData\">\n <sb-uic-list-table\n [data]=\"finalSelectedUsers\"\n [count]=\"finalSelectedUsers.length || 0\"\n [initialPaginationSize]=\"pagination.limit\"\n [tableConfig]=\"usersTableConfig['selectedUsers']\"\n (selectedDataChange)=\"onSelectingUserToApply($event)\"\n (removeSelectedData)=\"removedUserData($event)\"\n [isDisabled]=\"data?.disabled\"\n [selected]=\"usersFinalList\"></sb-uic-list-table>\n </ng-container>\n </div>\n </mat-tab>\n </mat-tab-group>\n </ng-container>\n\n <ng-template #noData>\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\" />\n <span class=\"font-bold\">No information to display yet</span>\n </div>\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"filterValue === 'bulk_upload_karmayogis'\">\n <sb-uic-bulk-upload-karmayogi (appliedUser)=\"onApplyingUserBulkUpload($event)\" [isDisabled]=\"data?.disabled\"></sb-uic-bulk-upload-karmayogi>\n </ng-container>\n</div>\n\n<mat-dialog-actions>\n <ng-container *ngIf=\"filterValue === 'add_karmayogis'\">\n <ng-container *ngIf=\"activeTab === 0 && usersList.length\">\n <button\n mat-flat-button\n (click)=\"selectUsers()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white w-full mt-2\"\n [disabled]=\"holdSelectedUsers?.length === 0 || data?.disabled\">\n Select Users\n </button>\n </ng-container>\n <ng-container *ngIf=\"activeTab === 1 && usersFinalList.length && finalSelectedUsers.length\">\n <button\n [disabled]=\"data?.disabled\"\n mat-flat-button\n (click)=\"applySelections()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white w-full mt-2\">\n Apply\n </button>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"filterValue === 'bulk_upload_karmayogis'\">\n <ng-container *ngIf=\"bulkUploadUserList?.length\">\n <button\n [disabled]=\"data?.disabled\"\n mat-flat-button\n (click)=\"applySelectionsBulk()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white w-full mt-2\">\n Apply\n </button>\n </ng-container>\n </ng-container>\n</mat-dialog-actions>\n", styles: [":host{display:block}.dialog-heading{border-bottom:2px solid rgba(0,0,0,.12);padding:0 16px}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title{margin-bottom:8px!important;font-family:Montserrat;font-weight:600;font-size:16px;color:#000000de;padding:0 24px 9px 0}.close-button{margin-right:-8px}.user-dialog-body ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.search-button{padding:4px 24px}.filter-options{margin-bottom:15px}.filter-options .mat-radio-button{margin-right:24px}.no-data span{font-family:Lato;font-size:8.98px;color:#000000de}.mt-4{margin-top:1rem!important}.spinner-loader{height:200px}:host ::ng-deep .mat-mdc-dialog-content{max-height:75vh!important}\n"] }]
|
|
1390
|
+
}], ctorParameters: () => [{ type: i1$3.MatDialogRef }, { type: AccessControlService }, { type: i1.MatSnackBar }] });
|
|
1391
|
+
|
|
1392
|
+
const BATCH_RANGES = [
|
|
1393
|
+
{ label: "1960-1990", start: 1960, end: 1990 },
|
|
1394
|
+
{ label: "1991-2020", start: 1991, end: 2020 },
|
|
1395
|
+
{ label: "2021-2025", start: 2021, end: 2025 },
|
|
1396
|
+
];
|
|
1397
|
+
const CHECKBOX_OPTIONS = [
|
|
1398
|
+
{ label: "Select All", value: "selectAll" },
|
|
1399
|
+
// { label: "Cadre Controlling Authority", value: "isCCA" },
|
|
1400
|
+
];
|
|
1401
|
+
|
|
1402
|
+
class CadreMappingService {
|
|
1403
|
+
constructor() {
|
|
1404
|
+
this.allCadres = new Map();
|
|
1405
|
+
this.allServices = new Map();
|
|
1406
|
+
this.cadreToServiceMap = new Map();
|
|
1407
|
+
this.serviceToCadresMap = new Map();
|
|
1408
|
+
this.batchYearToCadresMap = new Map();
|
|
1409
|
+
this.batchYearToServicesMap = new Map();
|
|
1410
|
+
this.cadreConfigData = null;
|
|
1411
|
+
}
|
|
1412
|
+
addToMapSet(map, key, value) {
|
|
1413
|
+
if (!map.has(key)) {
|
|
1414
|
+
map.set(key, new Set());
|
|
1415
|
+
}
|
|
1416
|
+
map.get(key)?.add(value);
|
|
1417
|
+
}
|
|
1418
|
+
initialize(data) {
|
|
1419
|
+
// Clear existing data
|
|
1420
|
+
this.allCadres.clear();
|
|
1421
|
+
this.allServices.clear();
|
|
1422
|
+
this.cadreToServiceMap.clear();
|
|
1423
|
+
this.serviceToCadresMap.clear();
|
|
1424
|
+
this.batchYearToCadresMap.clear();
|
|
1425
|
+
this.batchYearToServicesMap.clear();
|
|
1426
|
+
// Build lookups
|
|
1427
|
+
data?.civilServiceType?.civilServiceTypeList.forEach(cst => {
|
|
1428
|
+
if (cst) {
|
|
1429
|
+
cst.serviceList.forEach(service => {
|
|
1430
|
+
const { id: serviceId, commonBatchStartYear, commonBatchEndYear } = service;
|
|
1431
|
+
this.allServices.set(serviceId, service);
|
|
1432
|
+
// Add years to service-batch map
|
|
1433
|
+
for (let y = commonBatchStartYear; y <= commonBatchEndYear; y++) {
|
|
1434
|
+
this.addToMapSet(this.batchYearToServicesMap, y, serviceId);
|
|
1435
|
+
}
|
|
1436
|
+
service.cadreList?.forEach(cadre => {
|
|
1437
|
+
const { id: cadreId, startBatchYear, endBatchYear } = cadre;
|
|
1438
|
+
this.allCadres.set(cadreId, cadre);
|
|
1439
|
+
// Map cadre <-> service
|
|
1440
|
+
this.addToMapSet(this.cadreToServiceMap, cadreId, serviceId);
|
|
1441
|
+
this.addToMapSet(this.serviceToCadresMap, serviceId, cadreId);
|
|
1442
|
+
// Add years to cadre-batch map
|
|
1443
|
+
for (let y = startBatchYear; y <= endBatchYear; y++) {
|
|
1444
|
+
this.addToMapSet(this.batchYearToCadresMap, y, cadreId);
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
getAllBatchYears() {
|
|
1452
|
+
return Array.from(this.batchYearToCadresMap.keys()).sort((a, b) => a - b);
|
|
1453
|
+
}
|
|
1454
|
+
getAllCadres() {
|
|
1455
|
+
return Array.from(this.allCadres.values()).map(c => ({
|
|
1456
|
+
id: c.id,
|
|
1457
|
+
name: c.name
|
|
1458
|
+
}));
|
|
1459
|
+
}
|
|
1460
|
+
getAllServices() {
|
|
1461
|
+
return Array.from(this.allServices.values()).map(s => ({
|
|
1462
|
+
id: s.id,
|
|
1463
|
+
name: s.name
|
|
1464
|
+
}));
|
|
1465
|
+
}
|
|
1466
|
+
getServicesByCadres(cadreIds) {
|
|
1467
|
+
const serviceIdsSet = new Set();
|
|
1468
|
+
cadreIds.forEach(cadreId => {
|
|
1469
|
+
const services = this.cadreToServiceMap.get(cadreId) || new Set();
|
|
1470
|
+
services.forEach(serviceId => serviceIdsSet.add(serviceId));
|
|
1471
|
+
});
|
|
1472
|
+
return Array.from(serviceIdsSet).map(id => {
|
|
1473
|
+
const s = this.allServices.get(id);
|
|
1474
|
+
return { id: s.id, name: s.name };
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
getCadresByServices(serviceIds) {
|
|
1478
|
+
const cadreIdsSet = new Set();
|
|
1479
|
+
serviceIds.forEach(serviceId => {
|
|
1480
|
+
const cadres = this.serviceToCadresMap.get(serviceId) || new Set();
|
|
1481
|
+
cadres.forEach(cadreId => cadreIdsSet.add(cadreId));
|
|
1482
|
+
});
|
|
1483
|
+
return Array.from(cadreIdsSet).map(id => {
|
|
1484
|
+
const c = this.allCadres.get(id);
|
|
1485
|
+
return { id: c.id, name: c.name };
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
getCadresByBatchYears(years) {
|
|
1489
|
+
const cadreIdsSet = new Set();
|
|
1490
|
+
years.forEach(year => {
|
|
1491
|
+
const cadres = this.batchYearToCadresMap.get(year) || new Set();
|
|
1492
|
+
cadres.forEach(cadreId => cadreIdsSet.add(cadreId));
|
|
1493
|
+
});
|
|
1494
|
+
return Array.from(cadreIdsSet).map(id => {
|
|
1495
|
+
const c = this.allCadres.get(id);
|
|
1496
|
+
return { id: c.id, name: c.name };
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
getServicesByBatchYears(years) {
|
|
1500
|
+
const serviceIdsSet = new Set();
|
|
1501
|
+
years.forEach(year => {
|
|
1502
|
+
const services = this.batchYearToServicesMap.get(year) || new Set();
|
|
1503
|
+
services.forEach(serviceId => serviceIdsSet.add(serviceId));
|
|
1504
|
+
});
|
|
1505
|
+
return Array.from(serviceIdsSet).map(id => {
|
|
1506
|
+
const s = this.allServices.get(id);
|
|
1507
|
+
return { id: s.id, name: s.name };
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
getServicesByCadresAndBatch(cadreIds, years) {
|
|
1511
|
+
const services = this.getServicesByCadres(cadreIds);
|
|
1512
|
+
if (!Array.isArray(years)) {
|
|
1513
|
+
years = [years];
|
|
1514
|
+
}
|
|
1515
|
+
return services.filter(service => {
|
|
1516
|
+
const fullService = this.allServices.get(service.id);
|
|
1517
|
+
// Return true if any year is within the service's batch year range
|
|
1518
|
+
return years.some(year => year >= fullService.commonBatchStartYear && year <= fullService.commonBatchEndYear);
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
getCadresByServicesAndBatch(serviceIds, years) {
|
|
1522
|
+
const cadres = this.getCadresByServices(serviceIds);
|
|
1523
|
+
if (!Array.isArray(years)) {
|
|
1524
|
+
years = [years];
|
|
1525
|
+
}
|
|
1526
|
+
return cadres.filter(cadre => {
|
|
1527
|
+
const fullCadre = this.allCadres.get(cadre.id);
|
|
1528
|
+
// Return true if any year is within the cadre's batch year range
|
|
1529
|
+
return years.some(year => year >= fullCadre.startBatchYear && year <= fullCadre.endBatchYear);
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
getBatchYearsByCadres(cadreIds) {
|
|
1533
|
+
const batchYearsSet = new Set();
|
|
1534
|
+
cadreIds.forEach(cadreId => {
|
|
1535
|
+
const cadre = this.allCadres.get(cadreId);
|
|
1536
|
+
if (cadre) {
|
|
1537
|
+
for (let y = cadre.startBatchYear; y <= cadre.endBatchYear; y++) {
|
|
1538
|
+
batchYearsSet.add(y);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
return Array.from(batchYearsSet).sort((a, b) => a - b);
|
|
1543
|
+
}
|
|
1544
|
+
getBatchYearsByServices(serviceIds) {
|
|
1545
|
+
const batchYearsSet = new Set();
|
|
1546
|
+
serviceIds.forEach(serviceId => {
|
|
1547
|
+
const service = this.allServices.get(serviceId);
|
|
1548
|
+
if (service) {
|
|
1549
|
+
for (let y = service.commonBatchStartYear; y <= service.commonBatchEndYear; y++) {
|
|
1550
|
+
batchYearsSet.add(y);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
return Array.from(batchYearsSet).sort((a, b) => a - b);
|
|
1555
|
+
}
|
|
1556
|
+
getBatchYearsByServicesAndCadres(serviceIds, cadreIds) {
|
|
1557
|
+
const serviceYears = this.getBatchYearsByServices(serviceIds);
|
|
1558
|
+
const cadreYears = this.getBatchYearsByCadres(cadreIds);
|
|
1559
|
+
// Find intersection of years
|
|
1560
|
+
const commonYears = serviceYears.filter(year => cadreYears.includes(year));
|
|
1561
|
+
return commonYears.sort((a, b) => a - b);
|
|
1562
|
+
}
|
|
1563
|
+
getCadreIdsByName(names) {
|
|
1564
|
+
if (!Array.isArray(names))
|
|
1565
|
+
names = [names];
|
|
1566
|
+
const lowerNames = names.map(n => n.toLowerCase());
|
|
1567
|
+
return Array.from(this.allCadres.values())
|
|
1568
|
+
.filter(cadre => lowerNames.includes(cadre.name.toLowerCase()))
|
|
1569
|
+
.map(cadre => cadre.id);
|
|
1570
|
+
}
|
|
1571
|
+
getServiceIdsByName(names) {
|
|
1572
|
+
if (!Array.isArray(names))
|
|
1573
|
+
names = [names];
|
|
1574
|
+
const lowerNames = names.map((n) => n.toLowerCase());
|
|
1575
|
+
return Array.from(this.allServices.values())
|
|
1576
|
+
.filter((service) => lowerNames.includes(service.name.toLowerCase()))
|
|
1577
|
+
.map((service) => service.id);
|
|
1578
|
+
}
|
|
1579
|
+
setCadreConfigData(data) {
|
|
1580
|
+
this.cadreConfigData = data;
|
|
1581
|
+
}
|
|
1582
|
+
getCadreConfigData() {
|
|
1583
|
+
return this.cadreConfigData;
|
|
1584
|
+
}
|
|
1585
|
+
getServicesByNames(names) {
|
|
1586
|
+
if (!Array.isArray(names))
|
|
1587
|
+
names = [names];
|
|
1588
|
+
const lowerNames = names.map((n) => n.toLowerCase());
|
|
1589
|
+
const uniqueMap = new Map();
|
|
1590
|
+
const cadreConfig = this.getCadreConfigData();
|
|
1591
|
+
if (cadreConfig) {
|
|
1592
|
+
cadreConfig.civilServiceType.civilServiceTypeList.forEach((cst) => {
|
|
1593
|
+
cst.serviceList.forEach((service) => {
|
|
1594
|
+
if (lowerNames.includes(service.name.toLowerCase())) {
|
|
1595
|
+
if (!uniqueMap.has(cst.id)) {
|
|
1596
|
+
uniqueMap.set(cst.id, { id: cst.id, name: cst.name });
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
return Array.from(uniqueMap.values());
|
|
1603
|
+
}
|
|
1604
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CadreMappingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1605
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CadreMappingService, providedIn: "root" }); }
|
|
1606
|
+
}
|
|
1607
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CadreMappingService, decorators: [{
|
|
1608
|
+
type: Injectable,
|
|
1609
|
+
args: [{
|
|
1610
|
+
providedIn: "root",
|
|
1611
|
+
}]
|
|
1612
|
+
}] });
|
|
1613
|
+
|
|
1614
|
+
class EntitySelectionsComponent {
|
|
1615
|
+
constructor(dialogRef, accessControlService, cadreMappingService, environment) {
|
|
1616
|
+
this.dialogRef = dialogRef;
|
|
1617
|
+
this.accessControlService = accessControlService;
|
|
1618
|
+
this.cadreMappingService = cadreMappingService;
|
|
1619
|
+
this.destroy$ = new Subject();
|
|
1620
|
+
this.isLoading = false;
|
|
1621
|
+
this.searchControl = new FormControl("");
|
|
1622
|
+
this.filterValue = "all";
|
|
1623
|
+
this.alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ#".split("");
|
|
1624
|
+
this.dataList = [];
|
|
1625
|
+
this.dataListDup = [];
|
|
1626
|
+
this.selectedCentralDeputation = false;
|
|
1627
|
+
this.selectedData = [];
|
|
1628
|
+
this.selectedDataTemp = [];
|
|
1629
|
+
this.groupedEntityData = {};
|
|
1630
|
+
this.selectionTypeEnum = NsAccessControlConfig.SelectionType;
|
|
1631
|
+
this.radioSelections = [];
|
|
1632
|
+
this.activeTab = 0;
|
|
1633
|
+
this.searchedOrganisationFlagWithQuery = false;
|
|
1634
|
+
this.data = inject(MAT_DIALOG_DATA);
|
|
1635
|
+
this.orgSelectionIds = [];
|
|
1636
|
+
this.paginationOffset = 0;
|
|
1637
|
+
this.totalItemsCount = 0;
|
|
1638
|
+
this.paginationLImit = 100;
|
|
1639
|
+
this.isFetchingMore = false;
|
|
1640
|
+
this.application = "";
|
|
1641
|
+
this.APPLICATION_ENUM = NsAccessControlConfig.Application;
|
|
1642
|
+
this.accessControlConfig = null;
|
|
1643
|
+
this.serviceSelectionTypes = ["All Services"];
|
|
1644
|
+
this.selectedServiceType = "All Services";
|
|
1645
|
+
this.entityFilterOptions = CHECKBOX_OPTIONS;
|
|
1646
|
+
this.isCCA = false;
|
|
1647
|
+
this.applyNewServiceSelections = true;
|
|
1648
|
+
this.canLoadMasterDesignation = false;
|
|
1649
|
+
this.environment = environment;
|
|
1650
|
+
}
|
|
1651
|
+
ngOnInit() {
|
|
1652
|
+
// If data was passed to the dialog, initialize selections
|
|
1653
|
+
if (this.environment.ODCSMasterFramework) {
|
|
1654
|
+
this.ODCSMasterFramework = this.environment.ODCSMasterFramework;
|
|
1655
|
+
}
|
|
1656
|
+
this.accessControlConfig = this.accessControlService.accessControlConfig();
|
|
1657
|
+
this.accessControlCriteriaSelection = this.accessControlConfig?.accessControlCriteriaSelection;
|
|
1658
|
+
this.userProfile = this.accessControlConfig?.userConfig;
|
|
1659
|
+
this.content = this.accessControlConfig?.content;
|
|
1660
|
+
this.application = this.accessControlConfig?.application || "";
|
|
1661
|
+
this.isCCA = this.accessControlConfig?.userConfig?.org?.isCCA ?? false;
|
|
1662
|
+
// if(this.content && this.content?.externalId) {
|
|
1663
|
+
// this.applyNewServiceSelections = true
|
|
1664
|
+
// }
|
|
1665
|
+
if (this.data) {
|
|
1666
|
+
this.selectionType = this.data?.condition?.entity;
|
|
1667
|
+
}
|
|
1668
|
+
this.isEntityCustomField = this.checkIfCustomeField(this.data.condition);
|
|
1669
|
+
if (this.isEntityCustomField) {
|
|
1670
|
+
this.customeFieldValues = this.accessControlService.customesFieldData().find((ele) => ele?.value === this.data.condition.entity);
|
|
1671
|
+
this.selectionType = NsAccessControlConfig.SelectionType.CustomField;
|
|
1672
|
+
}
|
|
1673
|
+
if (this.data && this.data.selected && this.data.selected.length) {
|
|
1674
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Batch) {
|
|
1675
|
+
this.selectedData = [...this.data.selected.map((ele) => _.toNumber(ele))];
|
|
1676
|
+
this.selectedDataTemp = [...this.selectedData];
|
|
1677
|
+
}
|
|
1678
|
+
else if (this.selectionType === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
1679
|
+
this.selectedCentralDeputation = this.data.selected[0] === 'true' || this.data.selected[0] === true;
|
|
1680
|
+
}
|
|
1681
|
+
else {
|
|
1682
|
+
this.selectedData = [...this.data.selected];
|
|
1683
|
+
this.selectedDataTemp = [...this.selectedData];
|
|
1684
|
+
}
|
|
1685
|
+
if (this.application === NsAccessControlConfig.Application.MDO) {
|
|
1686
|
+
this.selectedServiceType = "All Services";
|
|
1687
|
+
}
|
|
1688
|
+
this.activeTab = this.data?.activeTabSelected || 0;
|
|
1689
|
+
this.filterValue = this.data?.activeTabSelected > 0 ? "selected" : "all";
|
|
1690
|
+
}
|
|
1691
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
1692
|
+
this.selectedDataTemp = [this.selectedCentralDeputation];
|
|
1693
|
+
}
|
|
1694
|
+
// Subscribe to search control changes
|
|
1695
|
+
this.searchControl.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((query) => {
|
|
1696
|
+
if (this.selectionType) {
|
|
1697
|
+
switch (this.selectionType) {
|
|
1698
|
+
case this.selectionTypeEnum.Service:
|
|
1699
|
+
this.getServicesList(query);
|
|
1700
|
+
break;
|
|
1701
|
+
case this.selectionTypeEnum.Cadre:
|
|
1702
|
+
this.getCadreList(query);
|
|
1703
|
+
break;
|
|
1704
|
+
case this.selectionTypeEnum.Batch:
|
|
1705
|
+
this.getBatchList(query);
|
|
1706
|
+
break;
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
});
|
|
1710
|
+
this.initializeDisplay();
|
|
1711
|
+
}
|
|
1712
|
+
initializeDisplay() {
|
|
1713
|
+
switch (this.selectionType) {
|
|
1714
|
+
case NsAccessControlConfig.SelectionType.Organizations:
|
|
1715
|
+
if (this.activeTab === 0) {
|
|
1716
|
+
this.selectedCharacterRange = "A";
|
|
1717
|
+
this.getOrganisationsList("", [], this.selectedCharacterRange);
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
this.getOrganisationsList("", this.selectedData, undefined);
|
|
1721
|
+
this.alphabet = [];
|
|
1722
|
+
}
|
|
1723
|
+
this.radioSelections = this.accessControlCriteriaSelection.organizationRadioSelection;
|
|
1724
|
+
break;
|
|
1725
|
+
case NsAccessControlConfig.SelectionType.Designation:
|
|
1726
|
+
// For isCCA = false , fetch designations within their orgs only
|
|
1727
|
+
if (!this.isCCA && this.application === NsAccessControlConfig.Application.MDO) {
|
|
1728
|
+
this.orgSelectionIds = this.accessControlConfig.userConfig.org?.rootOrgId ? [this.accessControlConfig.userConfig.org?.rootOrgId] : [];
|
|
1729
|
+
}
|
|
1730
|
+
else {
|
|
1731
|
+
this.orgSelectionIds = this.data?.rule?.conditions?.find((c) => c.entity === NsAccessControlConfig.SelectionType.Organizations)?.selections;
|
|
1732
|
+
}
|
|
1733
|
+
if (this.orgSelectionIds?.length) {
|
|
1734
|
+
this.alphabet = ["#", ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")];
|
|
1735
|
+
this.selectedCharacterRange = "#";
|
|
1736
|
+
}
|
|
1737
|
+
else
|
|
1738
|
+
this.selectedCharacterRange = "A";
|
|
1739
|
+
if (this.activeTab === 0) {
|
|
1740
|
+
this.getDesignationsList(this.paginationOffset, "", [], this.selectedCharacterRange);
|
|
1741
|
+
}
|
|
1742
|
+
else {
|
|
1743
|
+
this.getDesignationsList(this.paginationOffset, "", this.selectedData, undefined);
|
|
1744
|
+
this.alphabet = [];
|
|
1745
|
+
}
|
|
1746
|
+
this.radioSelections = this.accessControlCriteriaSelection?.designationRadioSelection;
|
|
1747
|
+
break;
|
|
1748
|
+
case NsAccessControlConfig.SelectionType.Service:
|
|
1749
|
+
this.radioSelections = this.accessControlCriteriaSelection?.servicesRadioSelection;
|
|
1750
|
+
this.getServicesList(this.searchControl.value);
|
|
1751
|
+
break;
|
|
1752
|
+
case NsAccessControlConfig.SelectionType.Cadre:
|
|
1753
|
+
this.radioSelections = this.accessControlCriteriaSelection?.cadreRadioSelection;
|
|
1754
|
+
this.getCadreList(this.searchControl.value);
|
|
1755
|
+
break;
|
|
1756
|
+
case NsAccessControlConfig.SelectionType.Batch:
|
|
1757
|
+
this.radioSelections = this.accessControlCriteriaSelection?.batchRadioSelection;
|
|
1758
|
+
this.getBatchList(this.searchControl.value);
|
|
1759
|
+
break;
|
|
1760
|
+
case NsAccessControlConfig.SelectionType.Group:
|
|
1761
|
+
this.getGroupList();
|
|
1762
|
+
break;
|
|
1763
|
+
case NsAccessControlConfig.SelectionType.VerificationStatus:
|
|
1764
|
+
this.getVerificationStatus();
|
|
1765
|
+
break;
|
|
1766
|
+
case NsAccessControlConfig.SelectionType.CustomField:
|
|
1767
|
+
this.radioSelections = this.accessControlCriteriaSelection[this.customeFieldValues?.value];
|
|
1768
|
+
this.getCustomsFieldList();
|
|
1769
|
+
break;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
onClose() {
|
|
1773
|
+
this.dialogRef.close();
|
|
1774
|
+
}
|
|
1775
|
+
getSelectionValue(item) {
|
|
1776
|
+
if (typeof item !== "object" || item === null) {
|
|
1777
|
+
return item;
|
|
1778
|
+
}
|
|
1779
|
+
else if (this.selectionType === NsAccessControlConfig.SelectionType.Cadre ||
|
|
1780
|
+
this.selectionType === NsAccessControlConfig.SelectionType.Service ||
|
|
1781
|
+
this.selectionType === NsAccessControlConfig.SelectionType.Designation) {
|
|
1782
|
+
return item?.name?.toLowerCase() || item?.designation?.toLowerCase();
|
|
1783
|
+
}
|
|
1784
|
+
else if (this.selectionType === NsAccessControlConfig.SelectionType.Batch) {
|
|
1785
|
+
return Number(item);
|
|
1786
|
+
}
|
|
1787
|
+
return item?.id?.toLowerCase() || item?.identifier?.toLowerCase() || item;
|
|
1788
|
+
}
|
|
1789
|
+
isSelected(item) {
|
|
1790
|
+
const value = this.getSelectionValue(item);
|
|
1791
|
+
const compareList = this.filterValue === "selected" ? this.selectedData : this.selectedDataTemp;
|
|
1792
|
+
return compareList.some(selected => {
|
|
1793
|
+
if (typeof selected === 'string' && typeof value === 'string') {
|
|
1794
|
+
return selected === value ||
|
|
1795
|
+
selected.toLowerCase() === value.toLowerCase() ||
|
|
1796
|
+
selected.toUpperCase() === value.toUpperCase();
|
|
1797
|
+
}
|
|
1798
|
+
else {
|
|
1799
|
+
return selected === value;
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
toggleSelection(item) {
|
|
1804
|
+
const value = this.getSelectionValue(item);
|
|
1805
|
+
if (this.filterValue === "all") {
|
|
1806
|
+
if (this.selectedDataTemp.includes(value)) {
|
|
1807
|
+
this.selectedDataTemp = this.selectedDataTemp.filter((v) => v !== value);
|
|
1808
|
+
}
|
|
1809
|
+
else {
|
|
1810
|
+
this.selectedDataTemp = [...this.selectedDataTemp, value];
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
else if (this.filterValue === "selected") {
|
|
1814
|
+
if (this.selectedData.includes(value)) {
|
|
1815
|
+
this.selectedData = this.selectedData.filter((v) => v !== value);
|
|
1816
|
+
}
|
|
1817
|
+
else {
|
|
1818
|
+
this.selectedData = [...this.selectedData, value];
|
|
1819
|
+
}
|
|
1820
|
+
this.selectedDataTemp = [...this.selectedData];
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
setSelected() {
|
|
1824
|
+
this.selectedData = [...this.selectedDataTemp];
|
|
1825
|
+
this.activeTab = 1;
|
|
1826
|
+
}
|
|
1827
|
+
onFilterChange(event) {
|
|
1828
|
+
if ((event?.tab?.textLabel).toLowerCase().includes("selected")) {
|
|
1829
|
+
this.filterValue = "selected";
|
|
1830
|
+
this.searchControl.setValue("");
|
|
1831
|
+
}
|
|
1832
|
+
else {
|
|
1833
|
+
this.filterValue = "all";
|
|
1834
|
+
}
|
|
1835
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Organizations) {
|
|
1836
|
+
if (this.activeTab === 0) {
|
|
1837
|
+
this.selectedCharacterRange = "A";
|
|
1838
|
+
this.getOrganisationsList("", [], this.selectedCharacterRange);
|
|
1839
|
+
}
|
|
1840
|
+
else {
|
|
1841
|
+
this.getOrganisationsList("", this.selectedData, undefined);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Designation) {
|
|
1845
|
+
if (this.orgSelectionIds?.length) {
|
|
1846
|
+
this.alphabet = ["#", ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")];
|
|
1847
|
+
this.selectedCharacterRange = "#";
|
|
1848
|
+
}
|
|
1849
|
+
else
|
|
1850
|
+
this.selectedCharacterRange = "A";
|
|
1851
|
+
if (this.activeTab === 0) {
|
|
1852
|
+
this.getDesignationsList(this.paginationOffset, "", [], this.selectedCharacterRange);
|
|
1853
|
+
}
|
|
1854
|
+
else {
|
|
1855
|
+
this.getDesignationsList(this.paginationOffset, "", this.selectedData, undefined);
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
this.getFilteredEntityGrouped();
|
|
1859
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Batch) {
|
|
1860
|
+
this.updateBatchRanges();
|
|
1861
|
+
}
|
|
1862
|
+
else {
|
|
1863
|
+
this.updateAlphabet();
|
|
1864
|
+
}
|
|
1865
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Cadre || this.selectionType === NsAccessControlConfig.SelectionType.Service) {
|
|
1866
|
+
this.alphabet = [];
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
search() {
|
|
1870
|
+
this.paginationOffset = 0;
|
|
1871
|
+
switch (this.selectionType) {
|
|
1872
|
+
case NsAccessControlConfig.SelectionType.Designation:
|
|
1873
|
+
if (this.filterValue === "all" && !this.searchControl.value) {
|
|
1874
|
+
this.selectedCharacterRange = "A";
|
|
1875
|
+
this.updateAlphabet();
|
|
1876
|
+
this.getDesignationsList(this.paginationOffset, this.searchControl.value, [], this.selectedCharacterRange);
|
|
1877
|
+
}
|
|
1878
|
+
else {
|
|
1879
|
+
this.getDesignationsList(this.paginationOffset, this.searchControl.value);
|
|
1880
|
+
}
|
|
1881
|
+
break;
|
|
1882
|
+
case NsAccessControlConfig.SelectionType.Organizations:
|
|
1883
|
+
this.selectedCharacterRange = "A";
|
|
1884
|
+
if (this.filterValue === "all" && !this.searchControl.value)
|
|
1885
|
+
this.updateAlphabet();
|
|
1886
|
+
this.getOrganisationsList(this.searchControl.value, []);
|
|
1887
|
+
break;
|
|
1888
|
+
case NsAccessControlConfig.SelectionType.Service:
|
|
1889
|
+
this.getServicesList(this.searchControl.value);
|
|
1890
|
+
break;
|
|
1891
|
+
case NsAccessControlConfig.SelectionType.Cadre:
|
|
1892
|
+
this.getCadreList(this.searchControl.value);
|
|
1893
|
+
break;
|
|
1894
|
+
case NsAccessControlConfig.SelectionType.Batch:
|
|
1895
|
+
this.getCadreList(this.searchControl.value);
|
|
1896
|
+
break;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
getFilteredEntityGrouped() {
|
|
1900
|
+
this.isLoading = true;
|
|
1901
|
+
let filtered = this.dataList;
|
|
1902
|
+
if (this.filterValue === "selected") {
|
|
1903
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.CustomField) {
|
|
1904
|
+
const selectedData = this.selectedData.map((ele) => ele.fieldValue);
|
|
1905
|
+
filtered = this.dataListDup.filter((item) => this.isSelected(item) && selectedData.includes(item?.fieldValue));
|
|
1906
|
+
}
|
|
1907
|
+
else {
|
|
1908
|
+
filtered = this.dataListDup.filter(item => {
|
|
1909
|
+
const keysToCheck = [item?.name, item?.designation, item?.id, item?.identifier, item];
|
|
1910
|
+
return this.isSelected(item) && keysToCheck.some(key => key && this.selectedData.some(selected => {
|
|
1911
|
+
if (typeof selected === 'string' && typeof key === 'string') {
|
|
1912
|
+
return selected === key ||
|
|
1913
|
+
selected.toLowerCase() === key.toLowerCase() ||
|
|
1914
|
+
selected.toUpperCase() === key.toUpperCase();
|
|
1915
|
+
}
|
|
1916
|
+
else {
|
|
1917
|
+
return selected === key;
|
|
1918
|
+
}
|
|
1919
|
+
}));
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
if (filtered.length === 0) {
|
|
1924
|
+
this.groupedEntityData = {};
|
|
1925
|
+
this.isLoading = false;
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
// For batch, group by range and chunk each range
|
|
1929
|
+
if (this.selectionType === this.selectionTypeEnum.Batch) {
|
|
1930
|
+
const batchGrouped = this.groupBatchByRange(filtered);
|
|
1931
|
+
const chunked = {};
|
|
1932
|
+
for (const key in batchGrouped) {
|
|
1933
|
+
chunked[key] = this.chunkArray(batchGrouped[key], 8);
|
|
1934
|
+
}
|
|
1935
|
+
this.groupedEntityData = chunked;
|
|
1936
|
+
this.isLoading = false;
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
// For cadre and service, group 8 items irrespective of letter
|
|
1940
|
+
if (this.selectionType === this.selectionTypeEnum.Cadre || this.selectionType === this.selectionTypeEnum.Service) {
|
|
1941
|
+
// sort the filtered list by name
|
|
1942
|
+
filtered = filtered.sort((a, b) => {
|
|
1943
|
+
const nameA = a?.name?.toLowerCase() || "";
|
|
1944
|
+
const nameB = b?.name?.toLowerCase() || "";
|
|
1945
|
+
return nameA.localeCompare(nameB);
|
|
1946
|
+
});
|
|
1947
|
+
// chunk the filtered list into groups of 8
|
|
1948
|
+
const grouped = {};
|
|
1949
|
+
grouped["All"] = this.chunkArray(filtered, 8);
|
|
1950
|
+
this.groupedEntityData = grouped;
|
|
1951
|
+
this.isLoading = false;
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
if (this.selectionType === this.selectionTypeEnum.CustomField) {
|
|
1955
|
+
filtered = filtered.sort((a, b) => {
|
|
1956
|
+
const nameA = a?.fieldValue?.toLowerCase() || "";
|
|
1957
|
+
const nameB = b?.fieldValue?.toLowerCase() || "";
|
|
1958
|
+
return nameA.localeCompare(nameB);
|
|
1959
|
+
});
|
|
1960
|
+
// chunk the filtered list into groups of 8
|
|
1961
|
+
const grouped = {};
|
|
1962
|
+
grouped["All"] = this.chunkArray(filtered, 8);
|
|
1963
|
+
this.groupedEntityData = grouped;
|
|
1964
|
+
this.isLoading = false;
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
// For Designation or organizations with search query, don't group by letter
|
|
1968
|
+
if ((this.selectionType === this.selectionTypeEnum.Designation || this.selectionType === this.selectionTypeEnum.Organizations) && this.searchControl.value) {
|
|
1969
|
+
const grouped = {};
|
|
1970
|
+
grouped["All"] = this.chunkArray(filtered, 8);
|
|
1971
|
+
this.groupedEntityData = grouped;
|
|
1972
|
+
this.isLoading = false;
|
|
1973
|
+
this.alphabet = [];
|
|
1974
|
+
return;
|
|
1975
|
+
}
|
|
1976
|
+
// For all other types, group by letter and chunk each group
|
|
1977
|
+
const grouped = {};
|
|
1978
|
+
const temp = {};
|
|
1979
|
+
for (const org of filtered) {
|
|
1980
|
+
let entity = org?.channel || org?.name || org?.designation;
|
|
1981
|
+
let letter = entity?.trim()?.charAt(0)?.toUpperCase() || "#";
|
|
1982
|
+
if (!/^[A-Z]$/.test(letter)) {
|
|
1983
|
+
letter = "#";
|
|
1984
|
+
}
|
|
1985
|
+
if (!temp[letter])
|
|
1986
|
+
temp[letter] = [];
|
|
1987
|
+
temp[letter].push(org);
|
|
1988
|
+
}
|
|
1989
|
+
// Ensure # group is assigned at the end
|
|
1990
|
+
const sortedLetters = Object.keys(temp)
|
|
1991
|
+
.filter((l) => l !== "#")
|
|
1992
|
+
.sort();
|
|
1993
|
+
if (temp["#"])
|
|
1994
|
+
sortedLetters.push("#");
|
|
1995
|
+
for (const letter of sortedLetters) {
|
|
1996
|
+
grouped[letter] = this.chunkArray(temp[letter], 7);
|
|
1997
|
+
}
|
|
1998
|
+
this.groupedEntityData = grouped;
|
|
1999
|
+
this.isLoading = false;
|
|
2000
|
+
}
|
|
2001
|
+
scrollToSection(letter) {
|
|
2002
|
+
this.paginationOffset = 0;
|
|
2003
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Organizations && this.filterValue === "all" && !this.searchedOrganisationFlagWithQuery) {
|
|
2004
|
+
this.selectedCharacterRange = letter;
|
|
2005
|
+
this.getOrganisationsList("", [], letter);
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Designation && this.filterValue === "all" && !this.searchedDesignationFlagWithQuery) {
|
|
2009
|
+
// !this.orgSelectionIds?.length
|
|
2010
|
+
this.selectedCharacterRange = letter;
|
|
2011
|
+
this.getDesignationsList(this.paginationOffset, "", [], letter);
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
const section = document.getElementById(`section-${letter}`);
|
|
2015
|
+
if (section) {
|
|
2016
|
+
this.selectedCharacterRange = letter;
|
|
2017
|
+
section.scrollIntoView({ behavior: "auto", inline: "start" });
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
updateAlphabet() {
|
|
2021
|
+
this.selectedCharacterRange = "A";
|
|
2022
|
+
const chars = new Set();
|
|
2023
|
+
const sourceList = this.filterValue === "selected"
|
|
2024
|
+
? this.dataListDup.filter((item) => this.isSelected(item) && this.selectedData.includes(item?.name || item?.designation || item?.id || item?.identifier || item))
|
|
2025
|
+
: this.dataList;
|
|
2026
|
+
for (const data of sourceList) {
|
|
2027
|
+
const value = data?.channel || data?.name || data?.designation || "";
|
|
2028
|
+
let letter = value.charAt(0)?.toUpperCase() || "#";
|
|
2029
|
+
if (!/^[A-Z]$/.test(letter)) {
|
|
2030
|
+
letter = "#";
|
|
2031
|
+
}
|
|
2032
|
+
chars.add(letter);
|
|
2033
|
+
}
|
|
2034
|
+
const sorted = Array.from(chars)
|
|
2035
|
+
.filter((c) => c !== "#")
|
|
2036
|
+
.sort();
|
|
2037
|
+
if (chars.has("#"))
|
|
2038
|
+
sorted.push("#");
|
|
2039
|
+
// Show all characters for Organizations
|
|
2040
|
+
if ((this.selectionType === NsAccessControlConfig.SelectionType.Organizations || this.selectionType === NsAccessControlConfig.SelectionType.Designation) &&
|
|
2041
|
+
this.filterValue === "all" &&
|
|
2042
|
+
!this.searchControl.value) {
|
|
2043
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Designation && this.orgSelectionIds?.length) {
|
|
2044
|
+
this.alphabet = ["#", ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")];
|
|
2045
|
+
this.selectedCharacterRange = "#";
|
|
2046
|
+
}
|
|
2047
|
+
else {
|
|
2048
|
+
this.alphabet = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""), "#"];
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
else {
|
|
2052
|
+
this.alphabet = sorted;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
get checkIfData() {
|
|
2056
|
+
return ((this.groupedEntityData && Object.keys(this.groupedEntityData).length > 0) ||
|
|
2057
|
+
(this.selectionType === NsAccessControlConfig.SelectionType.Group && this.dataList.length > 0) ||
|
|
2058
|
+
(this.selectionType === NsAccessControlConfig.SelectionType.VerificationStatus && this.dataList.length > 0) ||
|
|
2059
|
+
(this.selectionType === NsAccessControlConfig.SelectionType.Designation && this.dataList.length > 0));
|
|
2060
|
+
}
|
|
2061
|
+
onScrollPaginate(event) {
|
|
2062
|
+
const threshold = 150;
|
|
2063
|
+
const position = event.target.scrollLeft + event.target.offsetWidth;
|
|
2064
|
+
const width = event.target.scrollWidth;
|
|
2065
|
+
if (width - position < threshold && !this.isLoading && !this.isFetchingMore && this.dataList.length < this.totalItemsCount) {
|
|
2066
|
+
this.loadMore();
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
loadMore() {
|
|
2070
|
+
if (this.dataList.length >= this.totalItemsCount || this.isFetchingMore)
|
|
2071
|
+
return;
|
|
2072
|
+
this.isFetchingMore = true;
|
|
2073
|
+
this.paginationOffset += this.accessControlConfig.accessControlCriteriaSelection.paginationLimit || this.paginationLImit;
|
|
2074
|
+
switch (this.selectionType) {
|
|
2075
|
+
case this.selectionTypeEnum.Designation:
|
|
2076
|
+
if (this.searchControl.value)
|
|
2077
|
+
this.selectedCharacterRange = "";
|
|
2078
|
+
this.getDesignationsList(this.paginationOffset, this.searchControl.value, [], this.selectedCharacterRange, true);
|
|
2079
|
+
break;
|
|
2080
|
+
case this.selectionTypeEnum.Organizations:
|
|
2081
|
+
if (this.searchControl.value)
|
|
2082
|
+
this.selectedCharacterRange = "";
|
|
2083
|
+
this.getOrganisationsList(this.searchControl.value, [], this.selectedCharacterRange, true);
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
getOrganisationsList(query, selectedData, character, append = false) {
|
|
2088
|
+
if (!append) {
|
|
2089
|
+
this.isLoading = true;
|
|
2090
|
+
}
|
|
2091
|
+
const pagination = {
|
|
2092
|
+
limit: this.accessControlConfig.accessControlCriteriaSelection.paginationLimit || this.paginationLImit,
|
|
2093
|
+
offset: this.paginationOffset
|
|
2094
|
+
};
|
|
2095
|
+
this.accessControlService.fetchOrgList(query, pagination, query ? [] : selectedData, character)
|
|
2096
|
+
.pipe(takeUntil(this.destroy$))
|
|
2097
|
+
.subscribe({
|
|
2098
|
+
next: (response) => {
|
|
2099
|
+
if (response?.result && response?.result?.response?.content) {
|
|
2100
|
+
const newData = response.result.response.content;
|
|
2101
|
+
this.dataList = append ? [...this.dataList, ...newData] : newData;
|
|
2102
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...newData], _.isEqual);
|
|
2103
|
+
this.totalItemsCount = response.result.response.count;
|
|
2104
|
+
if (query)
|
|
2105
|
+
this.searchedOrganisationFlagWithQuery = true;
|
|
2106
|
+
else
|
|
2107
|
+
this.searchedOrganisationFlagWithQuery = false;
|
|
2108
|
+
if (this.filterValue === "selected" || query)
|
|
2109
|
+
this.updateAlphabet();
|
|
2110
|
+
this.getFilteredEntityGrouped();
|
|
2111
|
+
}
|
|
2112
|
+
else {
|
|
2113
|
+
this.dataList = [];
|
|
2114
|
+
this.alphabet = [];
|
|
2115
|
+
this.dataListDup = [];
|
|
2116
|
+
this.groupedEntityData = {};
|
|
2117
|
+
}
|
|
2118
|
+
},
|
|
2119
|
+
complete: () => {
|
|
2120
|
+
this.isLoading = false;
|
|
2121
|
+
this.isFetchingMore = false;
|
|
2122
|
+
},
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
getDesignationsList(paginationOffset, query, selectedData, character, append = false) {
|
|
2126
|
+
if (!append) {
|
|
2127
|
+
this.isLoading = true;
|
|
2128
|
+
}
|
|
2129
|
+
// // For isCCA = false , fetch designations within their orgs only
|
|
2130
|
+
// if(!this.isCCA && this.application === NsAccessControlConfig.Application.MDO) {
|
|
2131
|
+
// this.orgSelectionIds = this.accessControlConfig.userConfig.org?.rootOrgId ? [this.accessControlConfig.userConfig.org?.rootOrgId] : [];
|
|
2132
|
+
// } else {
|
|
2133
|
+
// this.orgSelectionIds = this.data?.rule?.conditions?.find((c: any) => c.entity === NsAccessControlConfig.SelectionType.Organizations)?.selections;
|
|
2134
|
+
// }
|
|
2135
|
+
if (this.orgSelectionIds?.length && !this.canLoadMasterDesignation) {
|
|
2136
|
+
const categories = this.orgSelectionIds.map((ele) => `${ele}_${this.ODCSMasterFramework ? this.ODCSMasterFramework : 'odcs'}_designation`);
|
|
2137
|
+
this.accessControlService
|
|
2138
|
+
.fetchDesignationsWithOrg(paginationOffset, categories, query, query ? [] : selectedData, character)
|
|
2139
|
+
.pipe(takeUntil(this.destroy$))
|
|
2140
|
+
.subscribe({
|
|
2141
|
+
next: (response) => {
|
|
2142
|
+
if (response?.result && response?.result?.Term) {
|
|
2143
|
+
// const newData = response?.result?.Term;
|
|
2144
|
+
const newData = _.uniqBy(response.result.Term, (item) => item?.identifier && item?.name);
|
|
2145
|
+
this.dataList = append ? [...this.dataList, ...newData] : newData;
|
|
2146
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...newData], _.isEqual);
|
|
2147
|
+
this.totalItemsCount = response?.result?.count;
|
|
2148
|
+
if (query)
|
|
2149
|
+
this.searchedDesignationFlagWithQuery = true;
|
|
2150
|
+
if (this.filterValue === "selected" || query)
|
|
2151
|
+
this.updateAlphabet();
|
|
2152
|
+
this.getFilteredEntityGrouped();
|
|
2153
|
+
}
|
|
2154
|
+
else {
|
|
2155
|
+
this.dataList = [];
|
|
2156
|
+
this.dataListDup = [];
|
|
2157
|
+
this.groupedEntityData = {};
|
|
2158
|
+
if (query)
|
|
2159
|
+
this.alphabet = [];
|
|
2160
|
+
if (!query && selectedData?.length) {
|
|
2161
|
+
this.loadMoreDesignation();
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
},
|
|
2165
|
+
complete: () => {
|
|
2166
|
+
this.isLoading = false;
|
|
2167
|
+
this.isFetchingMore = false;
|
|
2168
|
+
},
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
const pageSize = this.accessControlConfig.accessControlCriteriaSelection.paginationLimit || this.paginationLImit;
|
|
2173
|
+
const pagination = {
|
|
2174
|
+
pageSize: pageSize,
|
|
2175
|
+
pageNumber: Math.floor(paginationOffset / pageSize)
|
|
2176
|
+
};
|
|
2177
|
+
this.accessControlService
|
|
2178
|
+
.fetchDesignation(query, pagination, query ? [] : selectedData, character)
|
|
2179
|
+
.pipe(takeUntil(this.destroy$))
|
|
2180
|
+
.subscribe({
|
|
2181
|
+
next: (response) => {
|
|
2182
|
+
if (response?.result && response?.result?.result?.data) {
|
|
2183
|
+
const newData = response?.result?.result?.data;
|
|
2184
|
+
this.dataList = append ? [...this.dataList, ...newData] : newData;
|
|
2185
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...newData], _.isEqual);
|
|
2186
|
+
this.totalItemsCount = response?.result?.result?.totalCount;
|
|
2187
|
+
if (query)
|
|
2188
|
+
this.searchedDesignationFlagWithQuery = true;
|
|
2189
|
+
else
|
|
2190
|
+
this.searchedDesignationFlagWithQuery = false;
|
|
2191
|
+
if (this.filterValue === "selected" || query)
|
|
2192
|
+
this.updateAlphabet();
|
|
2193
|
+
this.getFilteredEntityGrouped();
|
|
2194
|
+
if (!query && selectedData?.length && this.orgSelectionIds?.length) {
|
|
2195
|
+
this.canLoadMasterDesignation = true;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
else {
|
|
2199
|
+
this.dataList = [];
|
|
2200
|
+
this.dataListDup = [];
|
|
2201
|
+
this.groupedEntityData = {};
|
|
2202
|
+
this.alphabet = [];
|
|
2203
|
+
}
|
|
2204
|
+
},
|
|
2205
|
+
complete: () => {
|
|
2206
|
+
this.isLoading = false;
|
|
2207
|
+
this.isFetchingMore = false;
|
|
2208
|
+
},
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
getServicesList(query) {
|
|
2213
|
+
if (this.application === NsAccessControlConfig.Application.MDO || this.applyNewServiceSelections) {
|
|
2214
|
+
const baseList = this.accessControlService.holdServiceCadrebatch().service;
|
|
2215
|
+
const baseServiceNames = new Set(baseList.map(service => service.name?.trim().toLowerCase()));
|
|
2216
|
+
const cadreDataRaw = this.cadreMappingService.getCadreConfigData()?.civilServiceType?.civilServiceTypeList || [];
|
|
2217
|
+
// Update service types only once when first loading
|
|
2218
|
+
if (this.serviceSelectionTypes.length === 1) {
|
|
2219
|
+
this.serviceSelectionTypes = ["All Services", ...cadreDataRaw.map((element) => element.name)];
|
|
2220
|
+
}
|
|
2221
|
+
let selectedTypes;
|
|
2222
|
+
if (this.selectedServiceType === "All Services") {
|
|
2223
|
+
selectedTypes = cadreDataRaw.map((element) => element.name);
|
|
2224
|
+
}
|
|
2225
|
+
else {
|
|
2226
|
+
selectedTypes = [this.selectedServiceType];
|
|
2227
|
+
}
|
|
2228
|
+
let allServices = [];
|
|
2229
|
+
cadreDataRaw.forEach((item) => {
|
|
2230
|
+
if (selectedTypes.includes(item.name) && Array.isArray(item.serviceList)) {
|
|
2231
|
+
// Filter services that exist in baseList
|
|
2232
|
+
const filteredServices = item.serviceList.filter((service) => baseServiceNames.has(service.name?.trim().toLowerCase()));
|
|
2233
|
+
allServices = allServices.concat(filteredServices);
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
allServices = _.uniqBy(allServices, (service) => service.name?.trim().toLowerCase());
|
|
2237
|
+
this.dataList = query ? allServices.filter((service) => service.name?.toLowerCase().includes(query.toLowerCase())) : allServices;
|
|
2238
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...this.dataList], _.isEqual);
|
|
2239
|
+
this.alphabet = [];
|
|
2240
|
+
this.getFilteredEntityGrouped();
|
|
2241
|
+
}
|
|
2242
|
+
else {
|
|
2243
|
+
const baseList = this.accessControlService.holdServiceCadrebatch().service;
|
|
2244
|
+
this.dataList = query ? baseList.filter((service) => service.name?.toLowerCase().includes(query.toLowerCase())) : baseList;
|
|
2245
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...this.dataList], _.isEqual);
|
|
2246
|
+
this.alphabet = [];
|
|
2247
|
+
this.getFilteredEntityGrouped();
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
getCadreList(query) {
|
|
2251
|
+
const baseList = this.accessControlService.holdServiceCadrebatch().cadre;
|
|
2252
|
+
this.dataList = query ? baseList.filter((cadre) => cadre.name?.toLowerCase().includes(query.toLowerCase())) : baseList;
|
|
2253
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...this.dataList], _.isEqual);
|
|
2254
|
+
this.alphabet = [];
|
|
2255
|
+
this.getFilteredEntityGrouped();
|
|
2256
|
+
}
|
|
2257
|
+
getBatchList(query) {
|
|
2258
|
+
const baseList = this.accessControlService.holdServiceCadrebatch().batch;
|
|
2259
|
+
this.dataList = query ? baseList.filter((batch) => batch.toString().includes(query)) : baseList;
|
|
2260
|
+
this.dataListDup = _.uniqWith([...this.dataListDup, ...this.dataList], _.isEqual);
|
|
2261
|
+
this.updateBatchRanges();
|
|
2262
|
+
this.getFilteredEntityGrouped();
|
|
2263
|
+
}
|
|
2264
|
+
getGroupList() {
|
|
2265
|
+
this.isLoading = true;
|
|
2266
|
+
this.accessControlService
|
|
2267
|
+
.fetchGroupsList()
|
|
2268
|
+
.pipe(takeUntil(this.destroy$))
|
|
2269
|
+
.subscribe({
|
|
2270
|
+
next: (response) => {
|
|
2271
|
+
if (response?.result && response?.result?.response) {
|
|
2272
|
+
this.dataList = response.result.response;
|
|
2273
|
+
}
|
|
2274
|
+
},
|
|
2275
|
+
complete: () => {
|
|
2276
|
+
this.isLoading = false;
|
|
2277
|
+
},
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
getVerificationStatus() {
|
|
2281
|
+
this.dataList = this.accessControlCriteriaSelection.verificationStatus;
|
|
2282
|
+
}
|
|
2283
|
+
getCustomsFieldList() {
|
|
2284
|
+
if (this.customeFieldValues?.reversedOrderCustomFieldData?.length) {
|
|
2285
|
+
const mappedValues = this.customeFieldValues?.reversedOrderCustomFieldData;
|
|
2286
|
+
this.dataList = mappedValues || [];
|
|
2287
|
+
this.dataListDup = _.uniqWith([...mappedValues], _.isEqual);
|
|
2288
|
+
this.alphabet = [];
|
|
2289
|
+
if (this.data && this.data.selected && Array.isArray(this.data.selected) && this.data.selected.length) {
|
|
2290
|
+
if (this.data.selected.every((item) => typeof item === "string")) {
|
|
2291
|
+
const dataFields = this.dataList.filter((ele) => this.data.selected.includes(ele?.fieldValue));
|
|
2292
|
+
this.selectedData = [...dataFields];
|
|
2293
|
+
this.selectedDataTemp = [...this.selectedData];
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
this.getFilteredEntityGrouped();
|
|
2297
|
+
}
|
|
2298
|
+
else {
|
|
2299
|
+
this.dataList = [];
|
|
2300
|
+
this.dataListDup = [];
|
|
2301
|
+
this.getFilteredEntityGrouped();
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
updateBatchRanges() {
|
|
2305
|
+
const isSelectedFilter = this.filterValue === "selected";
|
|
2306
|
+
const sourceList = isSelectedFilter ? this.dataListDup.filter((item) => this.isSelected(item) && this.selectedData.includes(item)) : this.dataList;
|
|
2307
|
+
const validLabels = [];
|
|
2308
|
+
for (const { label, start, end } of BATCH_RANGES) {
|
|
2309
|
+
const hasItemInRange = sourceList.some((item) => item >= start && item <= end);
|
|
2310
|
+
if (hasItemInRange) {
|
|
2311
|
+
validLabels.push(label);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
this.batchRanges = validLabels;
|
|
2315
|
+
}
|
|
2316
|
+
groupBatchByRange(batchList) {
|
|
2317
|
+
const grouped = {};
|
|
2318
|
+
for (const range of BATCH_RANGES) {
|
|
2319
|
+
grouped[range.label] = batchList.filter((year) => year >= range.start && year <= range.end);
|
|
2320
|
+
}
|
|
2321
|
+
return grouped;
|
|
2322
|
+
}
|
|
2323
|
+
getModalTitle() {
|
|
2324
|
+
switch (this.selectionType) {
|
|
2325
|
+
case NsAccessControlConfig.SelectionType.Designation:
|
|
2326
|
+
return "Select Designation";
|
|
2327
|
+
case NsAccessControlConfig.SelectionType.Organizations:
|
|
2328
|
+
return "Select Organisation";
|
|
2329
|
+
case NsAccessControlConfig.SelectionType.Service:
|
|
2330
|
+
return "Select Services";
|
|
2331
|
+
case NsAccessControlConfig.SelectionType.Cadre:
|
|
2332
|
+
return "Select Cadre";
|
|
2333
|
+
case NsAccessControlConfig.SelectionType.Batch:
|
|
2334
|
+
return "Select Batch";
|
|
2335
|
+
case NsAccessControlConfig.SelectionType.Group:
|
|
2336
|
+
return "Select Group";
|
|
2337
|
+
case NsAccessControlConfig.SelectionType.VerificationStatus:
|
|
2338
|
+
return "Verification Status";
|
|
2339
|
+
case NsAccessControlConfig.SelectionType.CustomField:
|
|
2340
|
+
return `Select ${this.capitalizeFirstLetter(this.customeFieldValues?.label)}` || "Select Value";
|
|
2341
|
+
case NsAccessControlConfig.SelectionType.CentralDeputation:
|
|
2342
|
+
return "Central Deputation";
|
|
2343
|
+
}
|
|
2344
|
+
return "";
|
|
2345
|
+
}
|
|
2346
|
+
applySelections() {
|
|
2347
|
+
if (this.selectionType === NsAccessControlConfig.SelectionType.Group ||
|
|
2348
|
+
this.selectionType === NsAccessControlConfig.SelectionType.VerificationStatus ||
|
|
2349
|
+
this.selectionType === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
2350
|
+
this.selectedData = this.selectedDataTemp;
|
|
2351
|
+
}
|
|
2352
|
+
this.dialogRef.close({
|
|
2353
|
+
rule: this.data.rule,
|
|
2354
|
+
condition: this.data.condition,
|
|
2355
|
+
selected: this.selectedData,
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
chunkArray(array, chunkSize) {
|
|
2359
|
+
const results = [];
|
|
2360
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
2361
|
+
results.push(array.slice(i, i + chunkSize));
|
|
2362
|
+
}
|
|
2363
|
+
return results;
|
|
2364
|
+
}
|
|
2365
|
+
ngOnDestroy() {
|
|
2366
|
+
this.destroy$.next();
|
|
2367
|
+
this.destroy$.complete();
|
|
2368
|
+
}
|
|
2369
|
+
onVerificationChange(event) {
|
|
2370
|
+
const value = event.value;
|
|
2371
|
+
const index = this.selectedDataTemp.indexOf(value);
|
|
2372
|
+
if (index > -1) {
|
|
2373
|
+
this.selectedDataTemp.splice(index, 1);
|
|
2374
|
+
}
|
|
2375
|
+
else {
|
|
2376
|
+
this.selectedDataTemp.push(value);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
isSelectedVerification(event) {
|
|
2380
|
+
return this.selectedDataTemp.includes(event?.value);
|
|
2381
|
+
}
|
|
2382
|
+
disableOrganisationIfModerated(item) {
|
|
2383
|
+
const value = this.getSelectionValue(item);
|
|
2384
|
+
// // Case 1: It's the user's own root org AND content is MDO-specific
|
|
2385
|
+
// const isOwnRootOrgAndMdoSpecific =
|
|
2386
|
+
// value === this.userProfile?.rootOrgId &&
|
|
2387
|
+
// this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC;
|
|
2388
|
+
// // Case 2: Org is already selected AND content is/was Live → prevent deselection
|
|
2389
|
+
// const isAlreadySelectedAndLive =
|
|
2390
|
+
// this.data.selected.includes(value) &&
|
|
2391
|
+
// (this.content?.status === "Live" || this.content?.prevStatus === "Live");
|
|
2392
|
+
// // Disable if EITHER condition is true
|
|
2393
|
+
// return isOwnRootOrgAndMdoSpecific || isAlreadySelectedAndLive;
|
|
2394
|
+
if (value === this.userProfile?.rootOrgId && this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC)
|
|
2395
|
+
return true;
|
|
2396
|
+
return false;
|
|
2397
|
+
}
|
|
2398
|
+
disabledVerifiedIfModerated(item) {
|
|
2399
|
+
// const isVerifiedOption = item?.value === "VERIFIED";
|
|
2400
|
+
// const isMdoSpecific = this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC;
|
|
2401
|
+
// const isSelectedAndLive = this.data.selected.includes(item?.value) && (this.content?.status === "Live" || this.content?.prevStatus === "Live");
|
|
2402
|
+
// return isMdoSpecific && (isVerifiedOption || isSelectedAndLive);
|
|
2403
|
+
if (item?.value === "VERIFIED" && this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC)
|
|
2404
|
+
return true;
|
|
2405
|
+
return false;
|
|
2406
|
+
}
|
|
2407
|
+
// On Mdo Portal, Service Selection Type Change
|
|
2408
|
+
onChangeServiceSelectionType(event) {
|
|
2409
|
+
const wasSelectAllChecked = this.areAllSelected();
|
|
2410
|
+
this.selectedServiceType = event.value;
|
|
2411
|
+
this.getServicesList(this.searchControl.value);
|
|
2412
|
+
// If selectAll was checked before, auto-select all items in the new filtered list
|
|
2413
|
+
if (wasSelectAllChecked) {
|
|
2414
|
+
this.selectedDataTemp = this.dataList.map((item) => this.getSelectionValue(item));
|
|
2415
|
+
this.getFilteredEntityGrouped();
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
checkIfCustomeField(condition) {
|
|
2419
|
+
const optionsEntity = this.accessControlConfig.accessControlCriteriaSelection.optionsEntity;
|
|
2420
|
+
if (optionsEntity && optionsEntity.length) {
|
|
2421
|
+
const matched = optionsEntity.find((ele) => ele?.value === condition?.entity);
|
|
2422
|
+
return matched?.isCustomField || false;
|
|
2423
|
+
}
|
|
2424
|
+
return false;
|
|
2425
|
+
}
|
|
2426
|
+
isCentralDeputationSelected(isDeputation) {
|
|
2427
|
+
return this.selectedDataTemp.includes(isDeputation);
|
|
2428
|
+
}
|
|
2429
|
+
onCentralDeputationChange(event) {
|
|
2430
|
+
const isChecked = event?.target?.checked;
|
|
2431
|
+
this.selectedDataTemp = [isChecked];
|
|
2432
|
+
}
|
|
2433
|
+
selectAvailableOptions(event) {
|
|
2434
|
+
const checked = event.checked;
|
|
2435
|
+
const value = event.source.value;
|
|
2436
|
+
if (!checked) {
|
|
2437
|
+
this.selectedDataTemp = [];
|
|
2438
|
+
return;
|
|
2439
|
+
}
|
|
2440
|
+
switch (value) {
|
|
2441
|
+
case "selectAll":
|
|
2442
|
+
this.selectedDataTemp = this.dataList.map((item) => this.getSelectionValue(item));
|
|
2443
|
+
break;
|
|
2444
|
+
case "isCCA":
|
|
2445
|
+
this.selectedDataTemp = this.dataList.filter((item) => item?.iscca === true).map((item) => this.getSelectionValue(item));
|
|
2446
|
+
break;
|
|
2447
|
+
}
|
|
2448
|
+
switch (this.selectionType) {
|
|
2449
|
+
case this.selectionTypeEnum.Organizations:
|
|
2450
|
+
case this.selectionTypeEnum.Designation:
|
|
2451
|
+
case this.selectionTypeEnum.Group:
|
|
2452
|
+
case this.selectionTypeEnum.CustomField:
|
|
2453
|
+
case this.selectionTypeEnum.Cadre:
|
|
2454
|
+
case this.selectionTypeEnum.Batch:
|
|
2455
|
+
this.getFilteredEntityGrouped();
|
|
2456
|
+
break;
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
areAllSelected() {
|
|
2460
|
+
if (!this.dataList.length)
|
|
2461
|
+
return false;
|
|
2462
|
+
return this.dataList.every((item) => this.selectedDataTemp.includes(this.getSelectionValue(item)));
|
|
2463
|
+
}
|
|
2464
|
+
isOptionSelected(value) {
|
|
2465
|
+
switch (value) {
|
|
2466
|
+
case "selectAll":
|
|
2467
|
+
return this.areAllSelected();
|
|
2468
|
+
default:
|
|
2469
|
+
return false;
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
capitalizeFirstLetter(str) {
|
|
2473
|
+
if (typeof str !== "string" || str.length === 0) {
|
|
2474
|
+
return str;
|
|
2475
|
+
}
|
|
2476
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2477
|
+
}
|
|
2478
|
+
loadMoreDesignation() {
|
|
2479
|
+
this.canLoadMasterDesignation = true;
|
|
2480
|
+
if (this.filterValue === "all") {
|
|
2481
|
+
this.getDesignationsList(this.paginationOffset, '', [], 'A', false);
|
|
2482
|
+
}
|
|
2483
|
+
else {
|
|
2484
|
+
this.getDesignationsList(this.paginationOffset, '', this.selectedData, '', false);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntitySelectionsComponent, deps: [{ token: i1$3.MatDialogRef }, { token: AccessControlService }, { token: CadreMappingService }, { token: "environment" }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2488
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: EntitySelectionsComponent, isStandalone: false, selector: "sb-uic-entity-selections", viewQueries: [{ propertyName: "tabGroupRef", first: true, predicate: ["tabGroup"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"flex justify-between dialog-heading items-center\">\n <h2 mat-dialog-title class=\"mb-0\">{{ getModalTitle() }}</h2>\n <button mat-icon-button class=\"close-button\" (click)=\"onClose()\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n\n<div mat-dialog-content class=\"dialog-body-wrapper\">\n <ng-container\n *ngIf=\"\n selectionType === selectionTypeEnum.Designation ||\n selectionType === selectionTypeEnum.Service ||\n selectionType === selectionTypeEnum.Cadre ||\n selectionType === selectionTypeEnum.Batch ||\n selectionType === selectionTypeEnum.Organizations ||\n selectionType === selectionTypeEnum.CustomField\n \"\n >\n <!-- Search Box -->\n <ng-container *ngIf=\"selectionType !== selectionTypeEnum.CustomField\">\n <div class=\"search-container flex items-center gap-4\">\n <div class=\"mat-full-radius flex-grow\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-icon matPrefix>search</mat-icon>\n <input matInput placeholder=\"Type here to search...\" [formControl]=\"searchControl\" (keyup.enter)=\"search()\" />\n </mat-form-field>\n </div>\n <button mat-flat-button [disabled]=\"!searchControl.value\" class=\"flex items-center rounded-full new-bg-color font-bold text-sm text-white search-button\" (click)=\"search()\">Search</button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Organizations\">\n <div class=\"lato-normal-text-line mt-2 ml-4\">Select the Organizations only if this plan needs to be made visible to only selective organizations users.</div>\n </ng-container>\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Designation\">\n <div class=\"lato-normal-text-line mt-2 ml-4\">Select the Designations only if this plan needs to be made visible to only selective designation users.</div>\n </ng-container>\n\n <div class=\"p-4 pl-0 mt-2\">\n <!-- Filter Options -->\n <ng-container *ngIf=\"selectionType !== selectionTypeEnum.Group && selectionType !== selectionTypeEnum.VerificationStatus\">\n <div class=\"filter-options\">\n <mat-tab-group #tabGroup dynamicHeight mat-stretch-tabs=\"false\" mat-align-tabs=\"start\" (selectedTabChange)=\"onFilterChange($event)\" [(selectedIndex)]=\"activeTab\" [animationDuration]=\"100\">\n <mat-tab *ngFor=\"let item of radioSelections\" [label]=\"item.label\">\n <div class=\"org-container\">\n <!-- A-Z Filter Bar -->\n <ng-container *ngIf=\"isLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!isLoading\">\n <!-- Select all option -->\n <ng-container\n *ngIf=\"\n ( selectionType === selectionTypeEnum.Cadre ||\n selectionType === selectionTypeEnum.CustomField ||\n selectionType === selectionTypeEnum.Service ||\n selectionType === selectionTypeEnum.Batch) &&\n filterValue === 'all'\n \"\n >\n <div class=\"px-2 py-4 options-checkbox\">\n <ng-container *ngFor=\"let item of entityFilterOptions\">\n <mat-checkbox\n class=\"mr-4\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"\n (change)=\"selectAvailableOptions($event)\"\n [value]=\"item?.value\"\n [checked]=\"item?.value === 'selectAll' ? areAllSelected() : isOptionSelected(item?.value)\"\n >\n {{ item?.label }}\n </mat-checkbox>\n </ng-container>\n </div>\n </ng-container>\n <div class=\"alphabet-filter\" *ngIf=\"selectionType !== selectionTypeEnum.Batch && selectionType !== selectionTypeEnum.CustomField && alphabet?.length\">\n <ng-container *ngTemplateOutlet=\"alphabetFilterTemplate; context: { alphabet: alphabet }\"></ng-container>\n </div>\n\n <div class=\"alphabet-filter\" *ngIf=\"selectionType === selectionTypeEnum.Batch\">\n <ng-container *ngFor=\"let letter of batchRanges; let i = index; let last = last\">\n <button\n mat-button\n class=\"range-button px-4\"\n (click)=\"scrollToSection(letter)\"\n [ngClass]=\"{\n 'active-range-btn': selectedCharacterRange === letter\n }\"\n >\n {{ letter }}\n </button>\n <div class=\"divider-apl\" *ngIf=\"!last\"></div>\n </ng-container>\n </div>\n\n <!-- Selections for Service -->\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Service && (application === APPLICATION_ENUM.MDO || applyNewServiceSelections)\">\n <ng-container *ngIf=\"filterValue === 'all' && selectionType === selectionTypeEnum.Service\">\n <div class=\"flex gap-4 items-center px-2 my-3 options-radio\">\n <mat-radio-group [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\" \n [(ngModel)]=\"selectedServiceType\" \n (change)=\"onChangeServiceSelectionType($event)\"\n class=\"flex flex-wrap gap-4\">\n <ng-container *ngFor=\"let type of serviceSelectionTypes\">\n <mat-radio-button\n [value]=\"type\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"\n [checked]=\"selectedServiceType === type\"\n class=\"service-radio-btn\"\n >\n {{ type }}\n </mat-radio-button>\n </ng-container>\n </mat-radio-group>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"checkIfData; else noData\">\n <ng-container *ngTemplateOutlet=\"entityListTemplate\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"(selectionType !== selectionTypeEnum.Service)\">\n <ng-container *ngIf=\"checkIfData; else noData\">\n <ng-container *ngTemplateOutlet=\"entityListTemplate\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #noData>\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\" />\n <span class=\"font-bold\">No information to display yet</span>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Designation && orgSelectionIds?.length && !searchControl.value\">\n <ng-container *ngIf=\"selectedCharacterRange === '#' && application !== APPLICATION_ENUM.MDO\">\n <div class=\"lato-normal-text-line text-center mt-2 mb-2\">Designations are not available for the selected organizations.</div>\n <button (click)=\"loadMoreDesignation()\" mat-flat-button class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2\">\n Load Master Designations\n </button>\n </ng-container>\n </ng-container>\n </div>\n </ng-template>\n </ng-container>\n </div>\n </mat-tab>\n </mat-tab-group>\n </div>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Group\">\n <ng-container *ngIf=\"isLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!isLoading\">\n <div class=\"flex gap-16 items-center p-4 options-checkbox\">\n <ng-container *ngFor=\"let group of dataList\">\n <mat-checkbox [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\" [checked]=\"isSelected(group)\" (change)=\"toggleSelection(group)\" [title]=\"group\">\n {{ group }}\n </mat-checkbox>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.VerificationStatus\">\n <div class=\"flex gap-16 items-center p-4 options-checkbox\">\n <ng-container *ngFor=\"let group of dataList\">\n <mat-checkbox\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled || disabledVerifiedIfModerated(group)\"\n [checked]=\"isSelectedVerification(group)\"\n (change)=\"onVerificationChange(group)\"\n [title]=\"group?.label\"\n >\n {{ group?.label }}\n </mat-checkbox>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.CentralDeputation\">\n <div class=\"flex items-start p-4 flex-column\">\n <div class=\"lato-normal-text-line\">When ON, this training plan will be allocated to all AIS officials marked as on Central Deputation in their profiles.</div>\n <div class=\"toggle-central-deputation flex gap-4 items-end\">\n <div class=\"toggle-central-deputation lato-normal-text-line\">Central Deputation</div>\n <div class=\"checkbox-toggle\">\n <input\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"\n [(ngModel)]=\"selectedCentralDeputation\"\n (change)=\"onCentralDeputationChange($event)\"\n id=\"switch-onDeputation\"\n type=\"checkbox\"\n />\n <label for=\"switch-onDeputation\" [attr.data-disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"></label>\n </div>\n </div>\n </div>\n </ng-container>\n</div>\n\n<mat-dialog-actions>\n <ng-container *ngIf=\"checkIfData || selectionType === selectionTypeEnum.CentralDeputation\">\n <div class=\"flex gap-4 items-center ml-auto mr-1 apply-button-container my-2\">\n <ng-container *ngIf=\"selectionType !== selectionTypeEnum.VerificationStatus && selectionType !== selectionTypeEnum.CentralDeputation\">\n <div class=\"text-xs\">{{ filterValue === \"all\" ? selectedDataTemp?.length : selectedData?.length }} items selected</div>\n </ng-container>\n <ng-container\n *ngIf=\"selectionType === selectionTypeEnum?.VerificationStatus || selectionType === selectionTypeEnum?.Group || selectionType === selectionTypeEnum?.CentralDeputation || activeTab === 1\"\n >\n <button\n mat-flat-button\n [disabled]=\"(selectedData.length === 0 && selectedDataTemp.length === 0) || accessControlCriteriaSelection?.readOnly || data?.disabled\"\n (click)=\"applySelections()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2\"\n >\n Apply\n </button>\n </ng-container>\n <ng-container\n *ngIf=\"selectionType !== selectionTypeEnum?.VerificationStatus && selectionType !== selectionTypeEnum?.Group && selectionType !== selectionTypeEnum.CentralDeputation && activeTab === 0\"\n >\n <button\n mat-flat-button\n [disabled]=\"selectedDataTemp.length === 0 || accessControlCriteriaSelection?.readOnly || data?.disabled\"\n (click)=\"setSelected()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2\"\n >\n {{ getModalTitle() }}\n </button>\n </ng-container>\n </div>\n </ng-container>\n</mat-dialog-actions>\n\n<ng-template #entityListTemplate>\n <div class=\"flex overflow-x-auto\" (scroll)=\"onScrollPaginate($event)\">\n <ng-container *ngFor=\"let group of groupedEntityData | keyvalue\">\n <div class=\"org-column p-2 mr-4\" [attr.id]=\"'section-' + group.key\">\n <div class=\"org-list\">\n <div class=\"batch-range-columns\">\n <ng-container *ngIf=\"group.value && group.value.length\">\n <ng-container *ngFor=\"let column of group.value\">\n <div class=\"batch-column\">\n <div *ngFor=\"let entity of column\" class=\"org-card py-2\">\n <ng-container\n *ngIf=\"\n selectionType === selectionTypeEnum.Designation ||\n selectionType === selectionTypeEnum.Organizations ||\n selectionType === selectionTypeEnum.Service ||\n selectionType === selectionTypeEnum.Cadre ||\n selectionType === selectionTypeEnum.CustomField\n \"\n >\n <mat-checkbox\n [disabled]=\"accessControlCriteriaSelection?.readOnly || disableOrganisationIfModerated(entity) || data?.disabled\"\n [checked]=\"isSelected(entity)\"\n (change)=\"toggleSelection(entity)\"\n [title]=\"entity?.fieldValue || entity?.name || entity?.designation || entity?.channel\"\n >\n {{ entity?.fieldValue || entity?.name || entity?.designation || entity?.channel }}\n </mat-checkbox>\n </ng-container>\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Batch\">\n <mat-checkbox [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\" [checked]=\"isSelected(entity)\" (change)=\"toggleSelection(entity)\" [title]=\"entity\">\n {{ entity }}\n </mat-checkbox>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #alphabetFilterTemplate let-alphabet=\"alphabet\">\n <ng-container *ngFor=\"let letter of alphabet; let i = index; let last = last\">\n <button\n mat-button\n class=\"letter-button\"\n (click)=\"scrollToSection(letter)\"\n [ngClass]=\"{\n 'active-range-btn': selectedCharacterRange === letter\n }\"\n >\n {{ letter }}\n </button>\n <div class=\"divider-apl\" *ngIf=\"!last\"></div>\n </ng-container>\n</ng-template>\n", styles: [":host{display:block}.dialog-heading{border-bottom:2px solid rgba(0,0,0,.12);padding:0 16px}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title{margin-bottom:8px!important;font-family:Montserrat;font-weight:600;font-size:16px;color:#000000de;padding:0 0 9px}.close-button{margin-right:-8px}.dialog-body-wrapper ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.search-button{padding:4px 24px}.filter-options{margin-bottom:15px}.filter-options .mat-radio-button{margin-right:24px}.org-container{display:flex;flex-direction:column}.alphabet-filter{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;padding:8px 0}.alphabet-filter .divider-apl{width:1px;height:14px;background-color:#00000029}.alphabet-filter .letter-button,.alphabet-filter .range-button{min-width:30px;padding:0;margin:2px;line-height:30px;font-family:Lato;font-weight:400;font-size:12px;color:#0009}.alphabet-filter .letter-button.active-range-btn,.alphabet-filter .active-range-btn.range-button{font-weight:700;font-size:14px;color:#000}.alphabet-filter .range-button{padding:0 16px!important}.organization-scroll{flex:1;overflow-x:auto;white-space:nowrap}.org-row{display:flex;flex-direction:row}.org-column .org-list{display:flex;flex-direction:column;gap:6px}.org-column .org-card .mat-checkbox ::ng-deep .mat-checkbox-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:180px;font-family:Lato;font-weight:700;font-size:14px;line-height:16px;color:#000000de}:host ::ng-deep .mat-mdc-dialog-content{max-height:79vh!important}.apply-button-container div:first-child{color:#0009}.apply-button-container button{padding:0 54px}.spinner-loader{height:200px}.no-data span{font-family:Lato;font-size:8.98px;color:#000000de}.batch-range-title{font-weight:700;margin-bottom:8px}.batch-range-columns{display:flex;flex-direction:row;gap:24px}.batch-column{display:flex;flex-direction:column;min-width:180px}.options-checkbox .mat-checkbox ::ng-deep .mat-checkbox-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;font-family:Lato;font-weight:700;font-size:14px;line-height:14px;color:#000000de}.lato-normal-text-line{font-family:Lato;font-weight:400;font-size:14px;color:#000}.checkbox-toggle input[type=checkbox]{height:0;width:0;visibility:hidden}.checkbox-toggle label{cursor:pointer;width:60px;height:28px;background:#666;display:block;border-radius:100px;position:relative}.checkbox-toggle label:before{content:\"OFF\";color:#fff;position:absolute;left:28px;top:2px;z-index:1;transition:.3s;font-family:Montserrat;font-weight:600;font-size:11.57px}.checkbox-toggle label:after{content:\"\";position:absolute;top:4px;left:5px;width:20px;height:20px;background:#fff;border-radius:90px;transition:.3s;z-index:2}.checkbox-toggle input:checked+label{background:#1d8923}.checkbox-toggle input:checked+label:before{content:\"ON\";left:10px;font-family:Montserrat;font-weight:600;font-size:11.57px;transition:.3s}.checkbox-toggle input:checked+label:after{left:calc(100% - 5px);transform:translate(-100%)}.checkbox-toggle label:active:after{width:30px}.checkbox-toggle label[data-disabled=true]{cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i5.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i5.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i1$3.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$3.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$3.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i11.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i11.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i11$1.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "component", type: i11$1.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: i12.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "pipe", type: i4.KeyValuePipe, name: "keyvalue" }] }); }
|
|
2489
|
+
}
|
|
2490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntitySelectionsComponent, decorators: [{
|
|
2491
|
+
type: Component,
|
|
2492
|
+
args: [{ selector: "sb-uic-entity-selections", standalone: false, template: "<div class=\"flex justify-between dialog-heading items-center\">\n <h2 mat-dialog-title class=\"mb-0\">{{ getModalTitle() }}</h2>\n <button mat-icon-button class=\"close-button\" (click)=\"onClose()\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n\n<div mat-dialog-content class=\"dialog-body-wrapper\">\n <ng-container\n *ngIf=\"\n selectionType === selectionTypeEnum.Designation ||\n selectionType === selectionTypeEnum.Service ||\n selectionType === selectionTypeEnum.Cadre ||\n selectionType === selectionTypeEnum.Batch ||\n selectionType === selectionTypeEnum.Organizations ||\n selectionType === selectionTypeEnum.CustomField\n \"\n >\n <!-- Search Box -->\n <ng-container *ngIf=\"selectionType !== selectionTypeEnum.CustomField\">\n <div class=\"search-container flex items-center gap-4\">\n <div class=\"mat-full-radius flex-grow\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-icon matPrefix>search</mat-icon>\n <input matInput placeholder=\"Type here to search...\" [formControl]=\"searchControl\" (keyup.enter)=\"search()\" />\n </mat-form-field>\n </div>\n <button mat-flat-button [disabled]=\"!searchControl.value\" class=\"flex items-center rounded-full new-bg-color font-bold text-sm text-white search-button\" (click)=\"search()\">Search</button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Organizations\">\n <div class=\"lato-normal-text-line mt-2 ml-4\">Select the Organizations only if this plan needs to be made visible to only selective organizations users.</div>\n </ng-container>\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Designation\">\n <div class=\"lato-normal-text-line mt-2 ml-4\">Select the Designations only if this plan needs to be made visible to only selective designation users.</div>\n </ng-container>\n\n <div class=\"p-4 pl-0 mt-2\">\n <!-- Filter Options -->\n <ng-container *ngIf=\"selectionType !== selectionTypeEnum.Group && selectionType !== selectionTypeEnum.VerificationStatus\">\n <div class=\"filter-options\">\n <mat-tab-group #tabGroup dynamicHeight mat-stretch-tabs=\"false\" mat-align-tabs=\"start\" (selectedTabChange)=\"onFilterChange($event)\" [(selectedIndex)]=\"activeTab\" [animationDuration]=\"100\">\n <mat-tab *ngFor=\"let item of radioSelections\" [label]=\"item.label\">\n <div class=\"org-container\">\n <!-- A-Z Filter Bar -->\n <ng-container *ngIf=\"isLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!isLoading\">\n <!-- Select all option -->\n <ng-container\n *ngIf=\"\n ( selectionType === selectionTypeEnum.Cadre ||\n selectionType === selectionTypeEnum.CustomField ||\n selectionType === selectionTypeEnum.Service ||\n selectionType === selectionTypeEnum.Batch) &&\n filterValue === 'all'\n \"\n >\n <div class=\"px-2 py-4 options-checkbox\">\n <ng-container *ngFor=\"let item of entityFilterOptions\">\n <mat-checkbox\n class=\"mr-4\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"\n (change)=\"selectAvailableOptions($event)\"\n [value]=\"item?.value\"\n [checked]=\"item?.value === 'selectAll' ? areAllSelected() : isOptionSelected(item?.value)\"\n >\n {{ item?.label }}\n </mat-checkbox>\n </ng-container>\n </div>\n </ng-container>\n <div class=\"alphabet-filter\" *ngIf=\"selectionType !== selectionTypeEnum.Batch && selectionType !== selectionTypeEnum.CustomField && alphabet?.length\">\n <ng-container *ngTemplateOutlet=\"alphabetFilterTemplate; context: { alphabet: alphabet }\"></ng-container>\n </div>\n\n <div class=\"alphabet-filter\" *ngIf=\"selectionType === selectionTypeEnum.Batch\">\n <ng-container *ngFor=\"let letter of batchRanges; let i = index; let last = last\">\n <button\n mat-button\n class=\"range-button px-4\"\n (click)=\"scrollToSection(letter)\"\n [ngClass]=\"{\n 'active-range-btn': selectedCharacterRange === letter\n }\"\n >\n {{ letter }}\n </button>\n <div class=\"divider-apl\" *ngIf=\"!last\"></div>\n </ng-container>\n </div>\n\n <!-- Selections for Service -->\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Service && (application === APPLICATION_ENUM.MDO || applyNewServiceSelections)\">\n <ng-container *ngIf=\"filterValue === 'all' && selectionType === selectionTypeEnum.Service\">\n <div class=\"flex gap-4 items-center px-2 my-3 options-radio\">\n <mat-radio-group [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\" \n [(ngModel)]=\"selectedServiceType\" \n (change)=\"onChangeServiceSelectionType($event)\"\n class=\"flex flex-wrap gap-4\">\n <ng-container *ngFor=\"let type of serviceSelectionTypes\">\n <mat-radio-button\n [value]=\"type\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"\n [checked]=\"selectedServiceType === type\"\n class=\"service-radio-btn\"\n >\n {{ type }}\n </mat-radio-button>\n </ng-container>\n </mat-radio-group>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"checkIfData; else noData\">\n <ng-container *ngTemplateOutlet=\"entityListTemplate\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"(selectionType !== selectionTypeEnum.Service)\">\n <ng-container *ngIf=\"checkIfData; else noData\">\n <ng-container *ngTemplateOutlet=\"entityListTemplate\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #noData>\n <div class=\"no-data p-4 flex flex-column items-center justify-center\">\n <img src=\"/assets/icons/no-events.png\" alt=\"no-data\" />\n <span class=\"font-bold\">No information to display yet</span>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Designation && orgSelectionIds?.length && !searchControl.value\">\n <ng-container *ngIf=\"selectedCharacterRange === '#' && application !== APPLICATION_ENUM.MDO\">\n <div class=\"lato-normal-text-line text-center mt-2 mb-2\">Designations are not available for the selected organizations.</div>\n <button (click)=\"loadMoreDesignation()\" mat-flat-button class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2\">\n Load Master Designations\n </button>\n </ng-container>\n </ng-container>\n </div>\n </ng-template>\n </ng-container>\n </div>\n </mat-tab>\n </mat-tab-group>\n </div>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Group\">\n <ng-container *ngIf=\"isLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!isLoading\">\n <div class=\"flex gap-16 items-center p-4 options-checkbox\">\n <ng-container *ngFor=\"let group of dataList\">\n <mat-checkbox [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\" [checked]=\"isSelected(group)\" (change)=\"toggleSelection(group)\" [title]=\"group\">\n {{ group }}\n </mat-checkbox>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.VerificationStatus\">\n <div class=\"flex gap-16 items-center p-4 options-checkbox\">\n <ng-container *ngFor=\"let group of dataList\">\n <mat-checkbox\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled || disabledVerifiedIfModerated(group)\"\n [checked]=\"isSelectedVerification(group)\"\n (change)=\"onVerificationChange(group)\"\n [title]=\"group?.label\"\n >\n {{ group?.label }}\n </mat-checkbox>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.CentralDeputation\">\n <div class=\"flex items-start p-4 flex-column\">\n <div class=\"lato-normal-text-line\">When ON, this training plan will be allocated to all AIS officials marked as on Central Deputation in their profiles.</div>\n <div class=\"toggle-central-deputation flex gap-4 items-end\">\n <div class=\"toggle-central-deputation lato-normal-text-line\">Central Deputation</div>\n <div class=\"checkbox-toggle\">\n <input\n [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"\n [(ngModel)]=\"selectedCentralDeputation\"\n (change)=\"onCentralDeputationChange($event)\"\n id=\"switch-onDeputation\"\n type=\"checkbox\"\n />\n <label for=\"switch-onDeputation\" [attr.data-disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\"></label>\n </div>\n </div>\n </div>\n </ng-container>\n</div>\n\n<mat-dialog-actions>\n <ng-container *ngIf=\"checkIfData || selectionType === selectionTypeEnum.CentralDeputation\">\n <div class=\"flex gap-4 items-center ml-auto mr-1 apply-button-container my-2\">\n <ng-container *ngIf=\"selectionType !== selectionTypeEnum.VerificationStatus && selectionType !== selectionTypeEnum.CentralDeputation\">\n <div class=\"text-xs\">{{ filterValue === \"all\" ? selectedDataTemp?.length : selectedData?.length }} items selected</div>\n </ng-container>\n <ng-container\n *ngIf=\"selectionType === selectionTypeEnum?.VerificationStatus || selectionType === selectionTypeEnum?.Group || selectionType === selectionTypeEnum?.CentralDeputation || activeTab === 1\"\n >\n <button\n mat-flat-button\n [disabled]=\"(selectedData.length === 0 && selectedDataTemp.length === 0) || accessControlCriteriaSelection?.readOnly || data?.disabled\"\n (click)=\"applySelections()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2\"\n >\n Apply\n </button>\n </ng-container>\n <ng-container\n *ngIf=\"selectionType !== selectionTypeEnum?.VerificationStatus && selectionType !== selectionTypeEnum?.Group && selectionType !== selectionTypeEnum.CentralDeputation && activeTab === 0\"\n >\n <button\n mat-flat-button\n [disabled]=\"selectedDataTemp.length === 0 || accessControlCriteriaSelection?.readOnly || data?.disabled\"\n (click)=\"setSelected()\"\n class=\"flex items-center justify-center rounded-full new-bg-color font-bold text-sm text-white mt-2\"\n >\n {{ getModalTitle() }}\n </button>\n </ng-container>\n </div>\n </ng-container>\n</mat-dialog-actions>\n\n<ng-template #entityListTemplate>\n <div class=\"flex overflow-x-auto\" (scroll)=\"onScrollPaginate($event)\">\n <ng-container *ngFor=\"let group of groupedEntityData | keyvalue\">\n <div class=\"org-column p-2 mr-4\" [attr.id]=\"'section-' + group.key\">\n <div class=\"org-list\">\n <div class=\"batch-range-columns\">\n <ng-container *ngIf=\"group.value && group.value.length\">\n <ng-container *ngFor=\"let column of group.value\">\n <div class=\"batch-column\">\n <div *ngFor=\"let entity of column\" class=\"org-card py-2\">\n <ng-container\n *ngIf=\"\n selectionType === selectionTypeEnum.Designation ||\n selectionType === selectionTypeEnum.Organizations ||\n selectionType === selectionTypeEnum.Service ||\n selectionType === selectionTypeEnum.Cadre ||\n selectionType === selectionTypeEnum.CustomField\n \"\n >\n <mat-checkbox\n [disabled]=\"accessControlCriteriaSelection?.readOnly || disableOrganisationIfModerated(entity) || data?.disabled\"\n [checked]=\"isSelected(entity)\"\n (change)=\"toggleSelection(entity)\"\n [title]=\"entity?.fieldValue || entity?.name || entity?.designation || entity?.channel\"\n >\n {{ entity?.fieldValue || entity?.name || entity?.designation || entity?.channel }}\n </mat-checkbox>\n </ng-container>\n <ng-container *ngIf=\"selectionType === selectionTypeEnum.Batch\">\n <mat-checkbox [disabled]=\"accessControlCriteriaSelection?.readOnly || data?.disabled\" [checked]=\"isSelected(entity)\" (change)=\"toggleSelection(entity)\" [title]=\"entity\">\n {{ entity }}\n </mat-checkbox>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #alphabetFilterTemplate let-alphabet=\"alphabet\">\n <ng-container *ngFor=\"let letter of alphabet; let i = index; let last = last\">\n <button\n mat-button\n class=\"letter-button\"\n (click)=\"scrollToSection(letter)\"\n [ngClass]=\"{\n 'active-range-btn': selectedCharacterRange === letter\n }\"\n >\n {{ letter }}\n </button>\n <div class=\"divider-apl\" *ngIf=\"!last\"></div>\n </ng-container>\n</ng-template>\n", styles: [":host{display:block}.dialog-heading{border-bottom:2px solid rgba(0,0,0,.12);padding:0 16px}::ng-deep .mat-mdc-dialog-container .mdc-dialog__title{margin-bottom:8px!important;font-family:Montserrat;font-weight:600;font-size:16px;color:#000000de;padding:0 0 9px}.close-button{margin-right:-8px}.dialog-body-wrapper ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.search-button{padding:4px 24px}.filter-options{margin-bottom:15px}.filter-options .mat-radio-button{margin-right:24px}.org-container{display:flex;flex-direction:column}.alphabet-filter{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;padding:8px 0}.alphabet-filter .divider-apl{width:1px;height:14px;background-color:#00000029}.alphabet-filter .letter-button,.alphabet-filter .range-button{min-width:30px;padding:0;margin:2px;line-height:30px;font-family:Lato;font-weight:400;font-size:12px;color:#0009}.alphabet-filter .letter-button.active-range-btn,.alphabet-filter .active-range-btn.range-button{font-weight:700;font-size:14px;color:#000}.alphabet-filter .range-button{padding:0 16px!important}.organization-scroll{flex:1;overflow-x:auto;white-space:nowrap}.org-row{display:flex;flex-direction:row}.org-column .org-list{display:flex;flex-direction:column;gap:6px}.org-column .org-card .mat-checkbox ::ng-deep .mat-checkbox-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:180px;font-family:Lato;font-weight:700;font-size:14px;line-height:16px;color:#000000de}:host ::ng-deep .mat-mdc-dialog-content{max-height:79vh!important}.apply-button-container div:first-child{color:#0009}.apply-button-container button{padding:0 54px}.spinner-loader{height:200px}.no-data span{font-family:Lato;font-size:8.98px;color:#000000de}.batch-range-title{font-weight:700;margin-bottom:8px}.batch-range-columns{display:flex;flex-direction:row;gap:24px}.batch-column{display:flex;flex-direction:column;min-width:180px}.options-checkbox .mat-checkbox ::ng-deep .mat-checkbox-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;font-family:Lato;font-weight:700;font-size:14px;line-height:14px;color:#000000de}.lato-normal-text-line{font-family:Lato;font-weight:400;font-size:14px;color:#000}.checkbox-toggle input[type=checkbox]{height:0;width:0;visibility:hidden}.checkbox-toggle label{cursor:pointer;width:60px;height:28px;background:#666;display:block;border-radius:100px;position:relative}.checkbox-toggle label:before{content:\"OFF\";color:#fff;position:absolute;left:28px;top:2px;z-index:1;transition:.3s;font-family:Montserrat;font-weight:600;font-size:11.57px}.checkbox-toggle label:after{content:\"\";position:absolute;top:4px;left:5px;width:20px;height:20px;background:#fff;border-radius:90px;transition:.3s;z-index:2}.checkbox-toggle input:checked+label{background:#1d8923}.checkbox-toggle input:checked+label:before{content:\"ON\";left:10px;font-family:Montserrat;font-weight:600;font-size:11.57px;transition:.3s}.checkbox-toggle input:checked+label:after{left:calc(100% - 5px);transform:translate(-100%)}.checkbox-toggle label:active:after{width:30px}.checkbox-toggle label[data-disabled=true]{cursor:not-allowed}\n"] }]
|
|
2493
|
+
}], ctorParameters: () => [{ type: i1$3.MatDialogRef }, { type: AccessControlService }, { type: CadreMappingService }, { type: undefined, decorators: [{
|
|
2494
|
+
type: Inject,
|
|
2495
|
+
args: ["environment"]
|
|
2496
|
+
}] }], propDecorators: { tabGroupRef: [{
|
|
2497
|
+
type: ViewChild,
|
|
2498
|
+
args: ["tabGroup", { read: ElementRef }]
|
|
2499
|
+
}] } });
|
|
2500
|
+
|
|
2501
|
+
class ConfirmDialogComponent {
|
|
2502
|
+
constructor(dialogRef) {
|
|
2503
|
+
this.dialogRef = dialogRef;
|
|
2504
|
+
this.data = inject(MAT_DIALOG_DATA);
|
|
2505
|
+
}
|
|
2506
|
+
confirmNo() {
|
|
2507
|
+
this.dialogRef.close({ action: NsAccessControlConfig.IActions.Reject });
|
|
2508
|
+
}
|
|
2509
|
+
confirmYes() {
|
|
2510
|
+
this.dialogRef.close({ action: NsAccessControlConfig.IActions.Confirm });
|
|
2511
|
+
}
|
|
2512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ConfirmDialogComponent, deps: [{ token: i1$3.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2513
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: ConfirmDialogComponent, isStandalone: false, selector: "sb-uic-confirm-dialog", ngImport: i0, template: "<div class=\"dialog-confirm p-4\" *ngIf=\"data && data?.type !== 'confirm-reset-fields'\">\n <div class=\"flex items-center justify-center flex-column\">\n <div class=\"icon mb-6\" [ngSwitch]=\"data.type\">\n <mat-icon *ngSwitchCase=\"'delete'\">delete</mat-icon>\n <mat-icon *ngSwitchCase=\"'confirm-access-type'\" svgIcon=\"radio-on\"></mat-icon>\n <mat-icon *ngSwitchCase=\"'confirm-apply-accesscontrol-for-live'\" svgIcon=\"radio-on\"></mat-icon>\n </div>\n\n <div [ngSwitch]=\"data?.type\">\n <ng-container *ngSwitchCase=\"'delete'\">\n <div class=\"confirm-title text-center\">Are you sure you want to delete {{ data?.additionalData || \"\" }} ?</div>\n <div class=\"confirm-desc text-center\">\n Once deleted, it cannot be restored, and any access permissions associated with it will be removed. This action is irreversible.\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'confirm-access-type'\">\n <div class=\"confirm-title text-center\">Are you sure you want to opt for \"Public\" access?</div>\n <div class=\"confirm-desc text-center\">Or else please cancel and select <strong>\"Custom\"</strong> for the restricted content access.</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'confirm-save-without-user-group'\">\n <div class=\"confirm-title text-center\">Are you sure you want to save without adding user group/s?</div>\n <div class=\"confirm-desc text-center\">Or please cancel and <strong>\u201CAdd User Group\u201D</strong> for the restricted content access,</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'confirm-apply-accesscontrol-for-live'\">\n <div class=\"confirm-title text-center\">\n Are you sure you want to apply changes without any more modifications?\n </div>\n <div class=\"confirm-desc text-center\">\n <p><strong>These changes will go live immediately</strong> and affect <strong>all enrolled learners</strong>.</p>\n </div>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"data?.type === 'delete'\">\n <div class=\"confirm-actions flex items-center gap-4 mt-4\">\n <button mat-flat-button class=\"mat-btn-outline mt-2 gap-2 border-radius-4\" (click)=\"confirmNo()\">No</button>\n <button mat-flat-button class=\"new-bg-color text-white mt-2\" (click)=\"confirmYes()\">Yes</button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"data?.type === 'confirm-access-type' || data?.type === 'confirm-save-without-user-group' || data?.type === 'confirm-apply-accesscontrol-for-live'\">\n <div class=\"confirm-actions flex items-center gap-4 mt-4\">\n <button mat-flat-button class=\"mat-btn-outline mt-2 gap-2 border-radius-4\" (click)=\"confirmNo()\">Cancel</button>\n <button mat-flat-button class=\"new-bg-color text-white mt-2\" (click)=\"confirmYes()\">Yes</button>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div class=\"dialog-confirm p-4\" *ngIf=\"data && data?.type === 'confirm-reset-fields'\">\n <div class=\"flex items-center justify-center flex-column\">\n\n <div class=\"icon mb-6\" [ngSwitch]=\"data.type\">\n <mat-icon *ngSwitchCase=\"'confirm-reset-fields'\" svgIcon=\"radio-on\"></mat-icon>\n </div>\n\n <div [ngSwitch]=\"data?.type\">\n <ng-container *ngSwitchCase=\"'confirm-reset-fields'\">\n <div class=\"confirm-title text-center\">\n Any changes in this condition would reset the below AND conditions, do you still wish to continue?\n </div>\n <!-- Optional description div can go here -->\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"data?.type === 'confirm-reset-fields'\">\n <div class=\"confirm-actions flex items-center justify-center gap-4 mt-4\">\n <button mat-flat-button class=\"mat-btn-outline mt-2 gap-2\" (click)=\"confirmNo()\">Cancel</button>\n <button mat-flat-button class=\"new-bg-color text-white mt-2\" (click)=\"confirmYes()\">Confirm</button>\n </div>\n </ng-container>\n\n </div>\n</div>\n\n\n", styles: [".confirm-title{font-family:Montserrat;font-weight:600;font-size:14px;color:#1b2133}.confirm-desc{font-family:Lato;font-weight:400;font-size:14px;color:#0009}.icon mat-icon{font-size:56px;height:56px;width:56px;color:#1b4ca1}.confirm-actions button{padding:0 32px!important}.border-radius-4{border-radius:4px!important}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i4.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i11.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] }); }
|
|
2514
|
+
}
|
|
2515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
2516
|
+
type: Component,
|
|
2517
|
+
args: [{ selector: "sb-uic-confirm-dialog", standalone: false, template: "<div class=\"dialog-confirm p-4\" *ngIf=\"data && data?.type !== 'confirm-reset-fields'\">\n <div class=\"flex items-center justify-center flex-column\">\n <div class=\"icon mb-6\" [ngSwitch]=\"data.type\">\n <mat-icon *ngSwitchCase=\"'delete'\">delete</mat-icon>\n <mat-icon *ngSwitchCase=\"'confirm-access-type'\" svgIcon=\"radio-on\"></mat-icon>\n <mat-icon *ngSwitchCase=\"'confirm-apply-accesscontrol-for-live'\" svgIcon=\"radio-on\"></mat-icon>\n </div>\n\n <div [ngSwitch]=\"data?.type\">\n <ng-container *ngSwitchCase=\"'delete'\">\n <div class=\"confirm-title text-center\">Are you sure you want to delete {{ data?.additionalData || \"\" }} ?</div>\n <div class=\"confirm-desc text-center\">\n Once deleted, it cannot be restored, and any access permissions associated with it will be removed. This action is irreversible.\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'confirm-access-type'\">\n <div class=\"confirm-title text-center\">Are you sure you want to opt for \"Public\" access?</div>\n <div class=\"confirm-desc text-center\">Or else please cancel and select <strong>\"Custom\"</strong> for the restricted content access.</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'confirm-save-without-user-group'\">\n <div class=\"confirm-title text-center\">Are you sure you want to save without adding user group/s?</div>\n <div class=\"confirm-desc text-center\">Or please cancel and <strong>\u201CAdd User Group\u201D</strong> for the restricted content access,</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'confirm-apply-accesscontrol-for-live'\">\n <div class=\"confirm-title text-center\">\n Are you sure you want to apply changes without any more modifications?\n </div>\n <div class=\"confirm-desc text-center\">\n <p><strong>These changes will go live immediately</strong> and affect <strong>all enrolled learners</strong>.</p>\n </div>\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"data?.type === 'delete'\">\n <div class=\"confirm-actions flex items-center gap-4 mt-4\">\n <button mat-flat-button class=\"mat-btn-outline mt-2 gap-2 border-radius-4\" (click)=\"confirmNo()\">No</button>\n <button mat-flat-button class=\"new-bg-color text-white mt-2\" (click)=\"confirmYes()\">Yes</button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"data?.type === 'confirm-access-type' || data?.type === 'confirm-save-without-user-group' || data?.type === 'confirm-apply-accesscontrol-for-live'\">\n <div class=\"confirm-actions flex items-center gap-4 mt-4\">\n <button mat-flat-button class=\"mat-btn-outline mt-2 gap-2 border-radius-4\" (click)=\"confirmNo()\">Cancel</button>\n <button mat-flat-button class=\"new-bg-color text-white mt-2\" (click)=\"confirmYes()\">Yes</button>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div class=\"dialog-confirm p-4\" *ngIf=\"data && data?.type === 'confirm-reset-fields'\">\n <div class=\"flex items-center justify-center flex-column\">\n\n <div class=\"icon mb-6\" [ngSwitch]=\"data.type\">\n <mat-icon *ngSwitchCase=\"'confirm-reset-fields'\" svgIcon=\"radio-on\"></mat-icon>\n </div>\n\n <div [ngSwitch]=\"data?.type\">\n <ng-container *ngSwitchCase=\"'confirm-reset-fields'\">\n <div class=\"confirm-title text-center\">\n Any changes in this condition would reset the below AND conditions, do you still wish to continue?\n </div>\n <!-- Optional description div can go here -->\n </ng-container>\n </div>\n\n <ng-container *ngIf=\"data?.type === 'confirm-reset-fields'\">\n <div class=\"confirm-actions flex items-center justify-center gap-4 mt-4\">\n <button mat-flat-button class=\"mat-btn-outline mt-2 gap-2\" (click)=\"confirmNo()\">Cancel</button>\n <button mat-flat-button class=\"new-bg-color text-white mt-2\" (click)=\"confirmYes()\">Confirm</button>\n </div>\n </ng-container>\n\n </div>\n</div>\n\n\n", styles: [".confirm-title{font-family:Montserrat;font-weight:600;font-size:14px;color:#1b2133}.confirm-desc{font-family:Lato;font-weight:400;font-size:14px;color:#0009}.icon mat-icon{font-size:56px;height:56px;width:56px;color:#1b4ca1}.confirm-actions button{padding:0 32px!important}.border-radius-4{border-radius:4px!important}\n"] }]
|
|
2518
|
+
}], ctorParameters: () => [{ type: i1$3.MatDialogRef }] });
|
|
2519
|
+
|
|
2520
|
+
class AccessControlGuideComponent {
|
|
2521
|
+
constructor(dialogRef, accessControlService) {
|
|
2522
|
+
this.dialogRef = dialogRef;
|
|
2523
|
+
this.accessControlService = accessControlService;
|
|
2524
|
+
}
|
|
2525
|
+
ngOnInit() {
|
|
2526
|
+
this.accessControlGuideConfig = this.accessControlService.accessControlConfig().accessControlGuide;
|
|
2527
|
+
}
|
|
2528
|
+
onClose() {
|
|
2529
|
+
this.dialogRef.close();
|
|
2530
|
+
}
|
|
2531
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlGuideComponent, deps: [{ token: i1$3.MatDialogRef }, { token: AccessControlService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2532
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: AccessControlGuideComponent, isStandalone: false, selector: "sb-uic-access-control-guide", ngImport: i0, template: "<div class=\"flex justify-between dialog-heading items-center\">\n <h2 mat-dialog-title class=\"mb-0\">Access Control Guide</h2>\n <button mat-icon-button class=\"close-button\" (click)=\"onClose()\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n<div mat-dialog-content>\n <div class=\"video-wrapper\">\n <video [src]=\"accessControlGuideConfig?.instructionVideoPath\" class=\"w-full h-full\" autoplay controls></video>\n </div>\n\n <div class=\"guide-information\">\n <mat-tab-group dynamicHeight mat-stretch-tabs=\"false\" mat-align-tabs=\"start\">\n <mat-tab label=\"Summary\" *ngIf=\"accessControlGuideConfig?.canShowSummaryTab\">\n <div class=\"about-guide text-xs text-dark py-4\">\n {{ accessControlGuideConfig?.summaryText || \"\" }}\n </div>\n </mat-tab>\n <!-- <mat-tab label=\"Transcript\" *ngIf=\"accessControlGuideConfig?.canShowTranscriptTab\">No data yet </mat-tab> -->\n </mat-tab-group>\n </div>\n</div>\n", styles: [".dialog-heading{border-bottom:2px solid rgba(0,0,0,.12);padding:0 16px}.dialog-heading h2{font-family:Montserrat;font-weight:600;font-size:20px;margin-bottom:12px;padding-left:16px}:host ::ng-deep .mat-mdc-dialog-content{max-height:79vh!important}::ng-deep .mat-mdc-tab .mdc-tab__text-label{color:#241c15a6;font-family:Lato;font-weight:400;font-size:16px}::ng-deep .mat-mdc-tab.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:#1b4ca1;--mat-tab-active-label-text-color: #1b4ca1 !important}:host ::ng-deep .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{font-family:Lato;font-weight:700;font-size:14px;color:#000000de}.mat-mdc-tab-header{--mat-tab-active-indicator-height: 2.5px !important}.about-guide{font-family:Lato;font-weight:400}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i1$3.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$3.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i11.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i11$1.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "component", type: i11$1.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }] }); }
|
|
2533
|
+
}
|
|
2534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlGuideComponent, decorators: [{
|
|
2535
|
+
type: Component,
|
|
2536
|
+
args: [{ selector: "sb-uic-access-control-guide", standalone: false, template: "<div class=\"flex justify-between dialog-heading items-center\">\n <h2 mat-dialog-title class=\"mb-0\">Access Control Guide</h2>\n <button mat-icon-button class=\"close-button\" (click)=\"onClose()\">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n<div mat-dialog-content>\n <div class=\"video-wrapper\">\n <video [src]=\"accessControlGuideConfig?.instructionVideoPath\" class=\"w-full h-full\" autoplay controls></video>\n </div>\n\n <div class=\"guide-information\">\n <mat-tab-group dynamicHeight mat-stretch-tabs=\"false\" mat-align-tabs=\"start\">\n <mat-tab label=\"Summary\" *ngIf=\"accessControlGuideConfig?.canShowSummaryTab\">\n <div class=\"about-guide text-xs text-dark py-4\">\n {{ accessControlGuideConfig?.summaryText || \"\" }}\n </div>\n </mat-tab>\n <!-- <mat-tab label=\"Transcript\" *ngIf=\"accessControlGuideConfig?.canShowTranscriptTab\">No data yet </mat-tab> -->\n </mat-tab-group>\n </div>\n</div>\n", styles: [".dialog-heading{border-bottom:2px solid rgba(0,0,0,.12);padding:0 16px}.dialog-heading h2{font-family:Montserrat;font-weight:600;font-size:20px;margin-bottom:12px;padding-left:16px}:host ::ng-deep .mat-mdc-dialog-content{max-height:79vh!important}::ng-deep .mat-mdc-tab .mdc-tab__text-label{color:#241c15a6;font-family:Lato;font-weight:400;font-size:16px}::ng-deep .mat-mdc-tab.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:#1b4ca1;--mat-tab-active-label-text-color: #1b4ca1 !important}:host ::ng-deep .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{font-family:Lato;font-weight:700;font-size:14px;color:#000000de}.mat-mdc-tab-header{--mat-tab-active-indicator-height: 2.5px !important}.about-guide{font-family:Lato;font-weight:400}\n"] }]
|
|
2537
|
+
}], ctorParameters: () => [{ type: i1$3.MatDialogRef }, { type: AccessControlService }] });
|
|
2538
|
+
|
|
2539
|
+
class AccessControlComponent {
|
|
2540
|
+
constructor(dialog, fb, accessControlService, cadreMappingService, snackbar) {
|
|
2541
|
+
this.dialog = dialog;
|
|
2542
|
+
this.fb = fb;
|
|
2543
|
+
this.accessControlService = accessControlService;
|
|
2544
|
+
this.cadreMappingService = cadreMappingService;
|
|
2545
|
+
this.snackbar = snackbar;
|
|
2546
|
+
this.contentId = "";
|
|
2547
|
+
this.accessControlData = new EventEmitter();
|
|
2548
|
+
this.refreshContentMeta = new EventEmitter();
|
|
2549
|
+
this.sendForCQF = new EventEmitter();
|
|
2550
|
+
this.destroy$ = new Subject();
|
|
2551
|
+
this.accessType = NsAccessControlConfig.IAccessTypes.Public;
|
|
2552
|
+
this.accessTypeDup = NsAccessControlConfig.IAccessTypes.Public;
|
|
2553
|
+
this.ACCESS_TYPE_ENUM = NsAccessControlConfig.IAccessTypes;
|
|
2554
|
+
this.ACCESS_SETTING_ENUM = NsAccessControlConfig.IAccessSetting;
|
|
2555
|
+
this.isLoading = false;
|
|
2556
|
+
this.isVisibilityEnabled = true;
|
|
2557
|
+
this.filterCriteria = false;
|
|
2558
|
+
this.defaultConditionRelationship = "AND";
|
|
2559
|
+
this.defaultUserGroupRelationship = "OR";
|
|
2560
|
+
this.MDO_SPECIFIC = NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC;
|
|
2561
|
+
this.MDO_APPLICATION = NsAccessControlConfig.Application.MDO;
|
|
2562
|
+
this.CBP_APPLICATION = NsAccessControlConfig.Application.Creation_Portal;
|
|
2563
|
+
this.isSaveFltrBtnDisabled = true;
|
|
2564
|
+
this.isAddUserGroupBtnDisabled = false;
|
|
2565
|
+
this.isSaving = false;
|
|
2566
|
+
this.userCount = {};
|
|
2567
|
+
this.canShowAccessControlTypeRadio = true;
|
|
2568
|
+
this.shouldShowVisibilityToggle = true;
|
|
2569
|
+
this.isCCA = false;
|
|
2570
|
+
}
|
|
2571
|
+
async ngOnInit() {
|
|
2572
|
+
this.initForm();
|
|
2573
|
+
if (this.config?.application === NsAccessControlConfig.Application.MDO) {
|
|
2574
|
+
this.isCCA = this.config?.userConfig?.org?.isCCA ?? false;
|
|
2575
|
+
if (!this.isCCA) {
|
|
2576
|
+
this.config.accessControlCriteriaSelection.optionsEntity = _.filter(this.config.accessControlCriteriaSelection.optionsEntity, (entity) => entity.value !== NsAccessControlConfig.SelectionType.Organizations);
|
|
2577
|
+
}
|
|
2578
|
+
this.mdoContent = this.config?.mdoContent;
|
|
2579
|
+
}
|
|
2580
|
+
this.config.content = this.content;
|
|
2581
|
+
this.accessControlCriteriaSelection = this.config?.accessControlCriteriaSelection;
|
|
2582
|
+
if (this.accessControlCriteriaSelection.readOnly) {
|
|
2583
|
+
this.accessControlCriteriaSelection.readOnly = false;
|
|
2584
|
+
}
|
|
2585
|
+
this.usersTableConfig = this.config?.usersTableConfig;
|
|
2586
|
+
// Dont call read api for MDO its only for CBP for now
|
|
2587
|
+
if (this.config.application !== NsAccessControlConfig.Application.MDO) {
|
|
2588
|
+
this.getAccessControl();
|
|
2589
|
+
}
|
|
2590
|
+
if (!this.cadreConfigData) {
|
|
2591
|
+
this.fetchCadreConfigData();
|
|
2592
|
+
}
|
|
2593
|
+
if (this.content && !this.content?.externalId) {
|
|
2594
|
+
const isAllUsers = this.content.accessSetting === NsAccessControlConfig.IAccessSetting.ALL_USERS;
|
|
2595
|
+
const isCustomAccess = this.content.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC ||
|
|
2596
|
+
this.content.accessSetting === NsAccessControlConfig.IAccessSetting.CUSTOME_USER;
|
|
2597
|
+
const isComprehensiveCategory = this.content.courseCategory === "Comprehensive Assessment Program";
|
|
2598
|
+
const accessTypePublic = _.find(this.accessControlCriteriaSelection?.accessTypes, {
|
|
2599
|
+
value: NsAccessControlConfig.IAccessTypes.Public
|
|
2600
|
+
});
|
|
2601
|
+
if (isAllUsers) {
|
|
2602
|
+
this.accessType = NsAccessControlConfig.IAccessTypes.Public;
|
|
2603
|
+
if (accessTypePublic)
|
|
2604
|
+
accessTypePublic.disabled = false;
|
|
2605
|
+
if (this.content.accessSettingsEnabled) {
|
|
2606
|
+
this.accessType = NsAccessControlConfig.IAccessTypes.Custom;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
if (isCustomAccess || isComprehensiveCategory) {
|
|
2610
|
+
this.accessType = NsAccessControlConfig.IAccessTypes.Custom;
|
|
2611
|
+
if (accessTypePublic)
|
|
2612
|
+
accessTypePublic.disabled = true;
|
|
2613
|
+
}
|
|
2614
|
+
this.processConditionsForContentType();
|
|
2615
|
+
}
|
|
2616
|
+
else if (this.config.application === NsAccessControlConfig.Application.MDO) {
|
|
2617
|
+
// Condition for MDO
|
|
2618
|
+
this.accessType = NsAccessControlConfig.IAccessTypes.Custom;
|
|
2619
|
+
}
|
|
2620
|
+
// For curated content of marketplace with external id
|
|
2621
|
+
else if (this.content && this.content?.externalId) {
|
|
2622
|
+
this.accessType = NsAccessControlConfig.IAccessTypes.Custom;
|
|
2623
|
+
}
|
|
2624
|
+
this.canShowAccessControlTypeRadio = this.config?.accessControlCriteriaSelection?.canShowAccessTypeRadio ?? true;
|
|
2625
|
+
this.shouldShowVisibilityToggle = this.config?.accessControlCriteriaSelection?.shouldShowVisibilityToggle ?? true;
|
|
2626
|
+
this.accessTypeDup = this.accessType;
|
|
2627
|
+
// Add config to signal
|
|
2628
|
+
this.accessControlService.accessControlConfig.set(this.config);
|
|
2629
|
+
if (this.config.application === this.MDO_APPLICATION) {
|
|
2630
|
+
if (this.tempAccessControl) {
|
|
2631
|
+
this.processTempAccessControl(this.tempAccessControl);
|
|
2632
|
+
}
|
|
2633
|
+
else {
|
|
2634
|
+
// Don't create a default user group yet - wait for API data to load
|
|
2635
|
+
// If no data is loaded, the component using this will call addUserGroup
|
|
2636
|
+
setTimeout(() => {
|
|
2637
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
2638
|
+
this.setupFormChangeDetection();
|
|
2639
|
+
}, 0);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
ngAfterViewInit() {
|
|
2644
|
+
if (this.config?.visiblilityOnOff?.default !== "on") {
|
|
2645
|
+
this.isVisibilityEnabled = false;
|
|
2646
|
+
}
|
|
2647
|
+
localStorage.removeItem("goToSetting");
|
|
2648
|
+
}
|
|
2649
|
+
ngOnDestroy() {
|
|
2650
|
+
this.destroy$.next();
|
|
2651
|
+
this.destroy$.complete();
|
|
2652
|
+
}
|
|
2653
|
+
async fetchCadreConfigData() {
|
|
2654
|
+
this.isLoading = true;
|
|
2655
|
+
const response = await this.accessControlService.fetchCadreConfig().catch(() => (this.isLoading = false));
|
|
2656
|
+
if (response?.result && response?.result?.response && Object.keys(response?.result?.response)?.length) {
|
|
2657
|
+
this.cadreConfigData = response?.result?.response?.value;
|
|
2658
|
+
this.cadreMappingService.initialize(this.cadreConfigData);
|
|
2659
|
+
this.accessControlService.holdServiceCadrebatch.set({
|
|
2660
|
+
service: this.cadreMappingService.getAllServices(),
|
|
2661
|
+
batch: this.cadreMappingService.getAllBatchYears(),
|
|
2662
|
+
cadre: this.cadreMappingService.getAllCadres(),
|
|
2663
|
+
});
|
|
2664
|
+
this.cadreMappingService.setCadreConfigData(this.cadreConfigData);
|
|
2665
|
+
if (this.config.accessControlCriteriaSelection.allowCustomsField && !this.isCCA) {
|
|
2666
|
+
this.getCustomsField();
|
|
2667
|
+
}
|
|
2668
|
+
else {
|
|
2669
|
+
this.isLoading = false;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
initForm() {
|
|
2674
|
+
this.accessControlForm = this.fb.group({
|
|
2675
|
+
userGroup: this.fb.array([])
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2678
|
+
get userGroup() {
|
|
2679
|
+
return this.accessControlForm.get("userGroup");
|
|
2680
|
+
}
|
|
2681
|
+
ruleConditions(ruleIndex) {
|
|
2682
|
+
return this.userGroup.at(ruleIndex).get("conditions");
|
|
2683
|
+
}
|
|
2684
|
+
onAccessTypeChange(event) {
|
|
2685
|
+
const selectedType = event.value;
|
|
2686
|
+
event?.source?._inputElement?.nativeElement?.blur();
|
|
2687
|
+
if (selectedType === NsAccessControlConfig.IAccessTypes.Public) {
|
|
2688
|
+
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
|
2689
|
+
width: "470px",
|
|
2690
|
+
data: { type: "confirm-access-type" }
|
|
2691
|
+
});
|
|
2692
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
2693
|
+
if (result?.action === NsAccessControlConfig.IActions.Confirm) {
|
|
2694
|
+
this.accessType = selectedType;
|
|
2695
|
+
this.updateContentAccessSetting();
|
|
2696
|
+
}
|
|
2697
|
+
else {
|
|
2698
|
+
this.accessTypeDup = this.accessType;
|
|
2699
|
+
}
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
else {
|
|
2703
|
+
this.accessType = selectedType;
|
|
2704
|
+
this.updateContentAccessSetting();
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
addUserGroup() {
|
|
2708
|
+
const ruleGroup = this.fb.group({
|
|
2709
|
+
id: [v4()],
|
|
2710
|
+
name: [`User Group ${this.userGroup.length + 1}`],
|
|
2711
|
+
description: [`Description for UserGroup ${this.userGroup.length + 1}`],
|
|
2712
|
+
conditions: this.fb.array([this.createConditionGroup(v4(), this.userGroup.length - 1)]),
|
|
2713
|
+
isUserGroupDisabled: [false],
|
|
2714
|
+
isAddConditionDisabled: [false]
|
|
2715
|
+
});
|
|
2716
|
+
this.userGroup.push(ruleGroup);
|
|
2717
|
+
// Update Central Deputation availability based on current AIS status
|
|
2718
|
+
const hasAIS = this.hasAllIndiaServicesInAnyGroup();
|
|
2719
|
+
if (!hasAIS) {
|
|
2720
|
+
this.accessControlService.enableDeputation(false);
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
addCondition(userGroupIndex) {
|
|
2724
|
+
this.processCadreConfigMapping(userGroupIndex);
|
|
2725
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
2726
|
+
const accessSetting = this.content?.accessSetting;
|
|
2727
|
+
// Check if organization/users already exists based on access setting
|
|
2728
|
+
if (accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC || accessSetting === NsAccessControlConfig.IAccessSetting.CUSTOME_USER) {
|
|
2729
|
+
const entityType = accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC
|
|
2730
|
+
? NsAccessControlConfig.SelectionType.Organizations
|
|
2731
|
+
: NsAccessControlConfig.SelectionType.Users;
|
|
2732
|
+
const existingEntity = conditions.controls.some(ctrl => ctrl.get("entity")?.value === entityType);
|
|
2733
|
+
if (existingEntity) {
|
|
2734
|
+
this.callSnackbar(`${entityType.toUpperCase()} is already added in this user group`, "error");
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
// Check if the last condition's selections are empty
|
|
2739
|
+
if (conditions?.length > 0) {
|
|
2740
|
+
const lastCondition = conditions.at(conditions.length - 1);
|
|
2741
|
+
const selections = lastCondition.get("selections")?.value || [];
|
|
2742
|
+
if (selections.length === 0) {
|
|
2743
|
+
this.callSnackbar("Please select a value for the current condition before adding another one.", "error");
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
// Check if user is added in the condition then no more conditions can be added
|
|
2748
|
+
if (conditions?.length > 0) {
|
|
2749
|
+
const lastCondition = conditions.at(conditions.length - 1);
|
|
2750
|
+
const lastEntity = lastCondition.get("entity")?.value;
|
|
2751
|
+
if (lastEntity === NsAccessControlConfig.SelectionType.Users) {
|
|
2752
|
+
this.callSnackbar("Adding further condition is not possible , as you have already added User as condition", "error");
|
|
2753
|
+
return;
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
conditions.push(this.createConditionGroup(v4(), userGroupIndex));
|
|
2757
|
+
// Update Central Deputation availability based on current AIS status
|
|
2758
|
+
const hasAIS = this.hasAllIndiaServicesInAnyGroup();
|
|
2759
|
+
if (!hasAIS) {
|
|
2760
|
+
this.accessControlService.enableDeputation(false);
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
createConditionGroup(id, userGroupIndex) {
|
|
2764
|
+
let entity = "";
|
|
2765
|
+
const accessSetting = this.content?.accessSetting;
|
|
2766
|
+
if (accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC || accessSetting === NsAccessControlConfig.IAccessSetting.CUSTOME_USER) {
|
|
2767
|
+
entity =
|
|
2768
|
+
accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC
|
|
2769
|
+
? NsAccessControlConfig.SelectionType.Organizations
|
|
2770
|
+
: NsAccessControlConfig.SelectionType.Users;
|
|
2771
|
+
this.accessControlCriteriaSelection.optionsEntity.forEach((ele) => {
|
|
2772
|
+
ele.disabled = ele.value !== entity;
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
else {
|
|
2776
|
+
// Don't modify optionsEntity here - it will be handled in onOpeningEntityChange
|
|
2777
|
+
// Just reset to default state
|
|
2778
|
+
this.accessControlCriteriaSelection.optionsEntity.forEach((ele) => {
|
|
2779
|
+
ele.disabled = false;
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
// Disable entity control if readOnly is true
|
|
2783
|
+
const isEntityDisabled = !!this.accessControlCriteriaSelection?.readOnly;
|
|
2784
|
+
return this.fb.group({
|
|
2785
|
+
id: [id],
|
|
2786
|
+
entity: [{ value: entity, disabled: isEntityDisabled }, Validators.required],
|
|
2787
|
+
conditionType: [{ value: "is", disabled: true }, Validators.required],
|
|
2788
|
+
selections: [[]]
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2791
|
+
/**
|
|
2792
|
+
* Check if any user group has All India Services selected
|
|
2793
|
+
*/
|
|
2794
|
+
hasAllIndiaServicesInAnyGroup() {
|
|
2795
|
+
const isAllIndiaService = (serviceName) => {
|
|
2796
|
+
if (!serviceName)
|
|
2797
|
+
return false;
|
|
2798
|
+
const lower = serviceName.toLowerCase();
|
|
2799
|
+
return lower.includes("all india service") ||
|
|
2800
|
+
lower.includes("indian administrative service") ||
|
|
2801
|
+
lower.includes("(ias)") ||
|
|
2802
|
+
lower.includes("indian police service") ||
|
|
2803
|
+
lower.includes("(ips)") ||
|
|
2804
|
+
lower.includes("indian forest service") ||
|
|
2805
|
+
lower.includes("(ifs)");
|
|
2806
|
+
};
|
|
2807
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
2808
|
+
const conditions = this.ruleConditions(i);
|
|
2809
|
+
for (let j = 0; j < conditions.length; j++) {
|
|
2810
|
+
const condition = conditions.at(j);
|
|
2811
|
+
const entity = condition?.get("entity")?.value;
|
|
2812
|
+
const selections = condition?.get("selections")?.value || [];
|
|
2813
|
+
if (entity === NsAccessControlConfig.SelectionType.Service && selections.length > 0) {
|
|
2814
|
+
// Check raw selections
|
|
2815
|
+
if (selections.some((s) => isAllIndiaService(s))) {
|
|
2816
|
+
return true;
|
|
2817
|
+
}
|
|
2818
|
+
// Also check through service mapping
|
|
2819
|
+
const serviceNames = this.cadreMappingService.getServicesByNames(selections);
|
|
2820
|
+
if (serviceNames.some((service) => isAllIndiaService(service.name))) {
|
|
2821
|
+
return true;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
return false;
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* Check if a specific user group has All India Services selected
|
|
2830
|
+
*/
|
|
2831
|
+
hasAllIndiaServicesInUserGroup(userGroupIndex) {
|
|
2832
|
+
if (userGroupIndex < 0 || userGroupIndex >= this.userGroup.length) {
|
|
2833
|
+
return false;
|
|
2834
|
+
}
|
|
2835
|
+
const isAllIndiaService = (serviceName) => {
|
|
2836
|
+
if (!serviceName)
|
|
2837
|
+
return false;
|
|
2838
|
+
const lower = serviceName.toLowerCase();
|
|
2839
|
+
return lower.includes("all india service") ||
|
|
2840
|
+
lower.includes("indian administrative service") ||
|
|
2841
|
+
lower.includes("(ias)") ||
|
|
2842
|
+
lower.includes("indian police service") ||
|
|
2843
|
+
lower.includes("(ips)") ||
|
|
2844
|
+
lower.includes("indian forest service") ||
|
|
2845
|
+
lower.includes("(ifs)");
|
|
2846
|
+
};
|
|
2847
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
2848
|
+
for (let j = 0; j < conditions.length; j++) {
|
|
2849
|
+
const condition = conditions.at(j);
|
|
2850
|
+
const entity = condition?.get("entity")?.value;
|
|
2851
|
+
const selections = condition?.get("selections")?.value || [];
|
|
2852
|
+
if (entity === NsAccessControlConfig.SelectionType.Service && selections.length > 0) {
|
|
2853
|
+
// Check raw selections
|
|
2854
|
+
if (selections.some((s) => isAllIndiaService(s))) {
|
|
2855
|
+
return true;
|
|
2856
|
+
}
|
|
2857
|
+
// Also check through service mapping
|
|
2858
|
+
const serviceNames = this.cadreMappingService.getServicesByNames(selections);
|
|
2859
|
+
if (serviceNames.some((service) => isAllIndiaService(service.name))) {
|
|
2860
|
+
return true;
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
return false;
|
|
2865
|
+
}
|
|
2866
|
+
onEntityChange(userGroupIndex, conditionIndex) {
|
|
2867
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
2868
|
+
const condition = conditions.at(conditionIndex);
|
|
2869
|
+
const selectedEntity = condition?.get("entity")?.value;
|
|
2870
|
+
const previousEntity = condition?.value?.entity;
|
|
2871
|
+
if (condition?.value?.selections?.length) {
|
|
2872
|
+
condition.get("selections")?.setValue([]);
|
|
2873
|
+
this.processDisableAddConditionOnClose(userGroupIndex);
|
|
2874
|
+
this.calculateUserCountForUserGroup(userGroupIndex, conditionIndex);
|
|
2875
|
+
}
|
|
2876
|
+
// If entity type changed from Service to something else, clear Central Deputation conditions
|
|
2877
|
+
if (previousEntity === NsAccessControlConfig.SelectionType.Service && selectedEntity !== NsAccessControlConfig.SelectionType.Service) {
|
|
2878
|
+
// Remove all Central Deputation conditions after this index in this user group
|
|
2879
|
+
for (let i = conditions.length - 1; i >= conditionIndex + 1; i--) {
|
|
2880
|
+
const cond = conditions.at(i);
|
|
2881
|
+
if (cond?.get("entity")?.value === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
2882
|
+
conditions.removeAt(i);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
// Check if any other user group still has AIS
|
|
2886
|
+
const hasAIS = this.hasAllIndiaServicesInAnyGroup();
|
|
2887
|
+
if (!hasAIS) {
|
|
2888
|
+
this.accessControlService.enableDeputation(false);
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
onOpeningEntityChange(event, userGroupIndex, conditionIndex) {
|
|
2893
|
+
if (event) {
|
|
2894
|
+
// Disable cadre from selection if services/batch has not cadre
|
|
2895
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
2896
|
+
let selectedService = [];
|
|
2897
|
+
let selectedBatch = [];
|
|
2898
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
2899
|
+
const entity = conditions.at(i).get("entity")?.value;
|
|
2900
|
+
const selections = conditions.at(i).get("selections")?.value || [];
|
|
2901
|
+
if (entity === NsAccessControlConfig.SelectionType.Service) {
|
|
2902
|
+
selectedService = selections;
|
|
2903
|
+
}
|
|
2904
|
+
if (entity === NsAccessControlConfig.SelectionType.Batch) {
|
|
2905
|
+
selectedBatch = selections;
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
let availableCadres = [];
|
|
2909
|
+
let disableCadre = false;
|
|
2910
|
+
// 1. Only service is added
|
|
2911
|
+
if (selectedService.length) {
|
|
2912
|
+
const serviceSelections = this.cadreMappingService.getServiceIdsByName(selectedService || []) || [];
|
|
2913
|
+
availableCadres = this.cadreMappingService.getCadresByServices(serviceSelections);
|
|
2914
|
+
disableCadre = availableCadres.length === 0;
|
|
2915
|
+
}
|
|
2916
|
+
else {
|
|
2917
|
+
// If neither is selected, do not disable Cadre
|
|
2918
|
+
if (this.content) {
|
|
2919
|
+
if (this.content.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC)
|
|
2920
|
+
disableCadre = true;
|
|
2921
|
+
else
|
|
2922
|
+
disableCadre = false;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
// Check if Central Deputation should be available (only if All India Services exists in THIS user group)
|
|
2926
|
+
const hasAISInThisGroup = this.hasAllIndiaServicesInUserGroup(userGroupIndex);
|
|
2927
|
+
const disableCentralDeputation = !hasAISInThisGroup;
|
|
2928
|
+
const updatedOptions = this.accessControlCriteriaSelection.optionsEntity.map(option => {
|
|
2929
|
+
if (option.value === NsAccessControlConfig.SelectionType.Cadre) {
|
|
2930
|
+
return { ...option, disabled: disableCadre };
|
|
2931
|
+
}
|
|
2932
|
+
if (option.value === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
2933
|
+
return { ...option, disabled: disableCentralDeputation };
|
|
2934
|
+
}
|
|
2935
|
+
return option;
|
|
2936
|
+
});
|
|
2937
|
+
this.accessControlCriteriaSelection.optionsEntity = [...updatedOptions];
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
getAvailableEntities(userGroupIndex, currentConditionIndex) {
|
|
2941
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
2942
|
+
const selectedEntities = conditions.controls
|
|
2943
|
+
.map((ctrl, idx) => (idx !== currentConditionIndex ? ctrl.get("entity")?.value : null))
|
|
2944
|
+
.filter(e => !!e);
|
|
2945
|
+
return this.accessControlCriteriaSelection?.optionsEntity.filter(option => !selectedEntities.includes(option.value));
|
|
2946
|
+
}
|
|
2947
|
+
removeUserGroup(index) {
|
|
2948
|
+
const group = this.userGroup.at(index);
|
|
2949
|
+
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
|
2950
|
+
width: "470px",
|
|
2951
|
+
data: { additionalData: group?.value?.name, type: "delete" }
|
|
2952
|
+
});
|
|
2953
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
2954
|
+
if (result?.action === NsAccessControlConfig.IActions.Confirm) {
|
|
2955
|
+
if (group?.value?.conditions?.length && group?.value?.conditions[0]?.selections.length) {
|
|
2956
|
+
this.userGroup.removeAt(index);
|
|
2957
|
+
// Rename remaining groups
|
|
2958
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
2959
|
+
this.resetUserGroup(i);
|
|
2960
|
+
}
|
|
2961
|
+
this.reindexUserCount();
|
|
2962
|
+
// Check if any remaining user group has AIS
|
|
2963
|
+
const hasAIS = this.hasAllIndiaServicesInAnyGroup();
|
|
2964
|
+
if (!hasAIS) {
|
|
2965
|
+
this.accessControlService.enableDeputation(false);
|
|
2966
|
+
}
|
|
2967
|
+
this.applyAccessControlValue(true);
|
|
2968
|
+
this.calculateUserCountForUserGroup(index);
|
|
2969
|
+
}
|
|
2970
|
+
else {
|
|
2971
|
+
this.userGroup.removeAt(index);
|
|
2972
|
+
// Rename remaining groups
|
|
2973
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
2974
|
+
this.resetUserGroup(i);
|
|
2975
|
+
}
|
|
2976
|
+
this.reindexUserCount();
|
|
2977
|
+
// Check if any remaining user group has AIS
|
|
2978
|
+
const hasAIS = this.hasAllIndiaServicesInAnyGroup();
|
|
2979
|
+
if (!hasAIS) {
|
|
2980
|
+
this.accessControlService.enableDeputation(false);
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
reindexUserCount() {
|
|
2987
|
+
const newUserCount = {};
|
|
2988
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
2989
|
+
newUserCount[i] = this.userCount[i] || 0;
|
|
2990
|
+
}
|
|
2991
|
+
this.userCount = newUserCount;
|
|
2992
|
+
}
|
|
2993
|
+
resetUserGroup(index) {
|
|
2994
|
+
const group = this.userGroup.at(index);
|
|
2995
|
+
if (group) {
|
|
2996
|
+
group.get("name")?.setValue(`User Group ${index + 1}`);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
resetUserGroupWithSelections(userGroupIndex) {
|
|
3000
|
+
const group = this.userGroup.at(userGroupIndex);
|
|
3001
|
+
if (group) {
|
|
3002
|
+
group.get("name")?.setValue(`User Group ${userGroupIndex + 1}`);
|
|
3003
|
+
const conditions = group.get("conditions");
|
|
3004
|
+
if (conditions && conditions.length) {
|
|
3005
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
3006
|
+
const condition = conditions.at(i);
|
|
3007
|
+
condition.get("entity")?.setValue("");
|
|
3008
|
+
condition.get("selections")?.setValue([]);
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
this.calculateUserCountForUserGroup(userGroupIndex);
|
|
3012
|
+
this.processDisableAddConditionOnClose(userGroupIndex);
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
checkServicesAndResetReleated(userGroupIndex, conditionIndex) {
|
|
3016
|
+
const userGroups = this.userGroup.at(userGroupIndex);
|
|
3017
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
3018
|
+
if (userGroups) {
|
|
3019
|
+
const conditionsUserGroup = userGroups?.value?.conditions || [];
|
|
3020
|
+
// Find service index
|
|
3021
|
+
const serviceIndex = _.findIndex(conditionsUserGroup, (c) => c.entity === NsAccessControlConfig.SelectionType.Service);
|
|
3022
|
+
const condition = conditions.at(conditionIndex);
|
|
3023
|
+
if (serviceIndex !== -1 && condition?.get("entity")?.value === NsAccessControlConfig.SelectionType.Service) {
|
|
3024
|
+
conditionsUserGroup.forEach((c, index) => {
|
|
3025
|
+
if (_.includes([NsAccessControlConfig.SelectionType.CentralDeputation], c.entity) && index > serviceIndex) {
|
|
3026
|
+
conditions.setControl(index, this.createConditionGroup(v4(), userGroupIndex));
|
|
3027
|
+
this.accessControlService.enableDeputation(false);
|
|
3028
|
+
}
|
|
3029
|
+
});
|
|
3030
|
+
if (this.accessControlCriteriaSelection?.optionsEntity?.filter(ele => ele.value === NsAccessControlConfig.SelectionType.CentralDeputation)?.length) {
|
|
3031
|
+
this.accessControlService.enableDeputation(false);
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
removeCondition(userGroupIndex, conditionIndex) {
|
|
3037
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
3038
|
+
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
|
3039
|
+
width: "470px",
|
|
3040
|
+
data: { additionalData: "this condition", type: "delete" }
|
|
3041
|
+
});
|
|
3042
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3043
|
+
if (result?.action === NsAccessControlConfig.IActions.Confirm) {
|
|
3044
|
+
this.checkServicesAndResetReleated(userGroupIndex, conditionIndex);
|
|
3045
|
+
conditions.removeAt(conditionIndex);
|
|
3046
|
+
this.applyAccessControlValue(true);
|
|
3047
|
+
this.calculateUserCountForUserGroup(userGroupIndex);
|
|
3048
|
+
this.processDisableAddConditionOnClose(userGroupIndex);
|
|
3049
|
+
}
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
resetCondition(userGroupIndex, conditionIndex) {
|
|
3053
|
+
const conditions = this.ruleConditions(userGroupIndex);
|
|
3054
|
+
const condition = conditions.at(conditionIndex);
|
|
3055
|
+
if (condition) {
|
|
3056
|
+
const wasServiceCondition = condition.get("entity")?.value === NsAccessControlConfig.SelectionType.Service;
|
|
3057
|
+
this.checkServicesAndResetReleated(userGroupIndex, conditionIndex);
|
|
3058
|
+
const id = condition.get("id")?.value || v4();
|
|
3059
|
+
conditions.setControl(conditionIndex, this.createConditionGroup(id, userGroupIndex));
|
|
3060
|
+
// If it was a service condition, check if any user group still has AIS
|
|
3061
|
+
if (wasServiceCondition) {
|
|
3062
|
+
const hasAIS = this.hasAllIndiaServicesInAnyGroup();
|
|
3063
|
+
if (!hasAIS) {
|
|
3064
|
+
this.accessControlService.enableDeputation(false);
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
this.calculateUserCountForUserGroup(userGroupIndex, conditionIndex);
|
|
3068
|
+
this.processDisableAddConditionOnClose(userGroupIndex);
|
|
3069
|
+
if (this.config.application === this.MDO_APPLICATION) {
|
|
3070
|
+
this.applyAccessControlValue(true, false);
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
manageSelections(conditionForm, ruleForm, userGroupIndex, activeTabSelected = 0) {
|
|
3075
|
+
const condition = conditionForm.getRawValue();
|
|
3076
|
+
const rule = ruleForm.getRawValue();
|
|
3077
|
+
let resetFilterFlag = false;
|
|
3078
|
+
if (!(this.content?.status === "Live" || this.content?.prevStatus === "Live" || this.content?.status === "Review") || this.config.application === this.MDO_APPLICATION || this.content?.contentId) {
|
|
3079
|
+
if (this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.ALL_USERS) {
|
|
3080
|
+
resetFilterFlag = this.checkForResetFilter(condition, rule, userGroupIndex);
|
|
3081
|
+
}
|
|
3082
|
+
else if (this.config.application === this.MDO_APPLICATION || this.content?.contentId) {
|
|
3083
|
+
// For MDO applications, check if the user group is in initial state
|
|
3084
|
+
const currentGroup = this.userGroup.at(userGroupIndex);
|
|
3085
|
+
const isInInitialState = (() => {
|
|
3086
|
+
if (this.config?.mdoContent?.status === 'Live' || this.content?.status === 'live') {
|
|
3087
|
+
const initialUserGroups = this.getInitialState();
|
|
3088
|
+
if (initialUserGroups) {
|
|
3089
|
+
return initialUserGroups.some(group => group.userGroupName === currentGroup.get('name')?.value);
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
return false;
|
|
3093
|
+
})();
|
|
3094
|
+
// Only show reset filter flag if not in initial state
|
|
3095
|
+
if (!isInInitialState) {
|
|
3096
|
+
resetFilterFlag = this.checkForResetFilter(condition, rule, userGroupIndex);
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
if (resetFilterFlag) {
|
|
3100
|
+
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
|
3101
|
+
width: "470px",
|
|
3102
|
+
data: { type: "confirm-reset-fields" }
|
|
3103
|
+
});
|
|
3104
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3105
|
+
if (result?.action === NsAccessControlConfig.IActions.Confirm) {
|
|
3106
|
+
this.resetActiveUserGroupFields(condition, rule, userGroupIndex);
|
|
3107
|
+
}
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
switch (condition.entity) {
|
|
3112
|
+
case NsAccessControlConfig.SelectionType.Users:
|
|
3113
|
+
if (!resetFilterFlag) {
|
|
3114
|
+
this.openInviteUserDialog(condition, rule, activeTabSelected, rule?.isUserGroupDisabled);
|
|
3115
|
+
}
|
|
3116
|
+
break;
|
|
3117
|
+
case NsAccessControlConfig.SelectionType.Organizations:
|
|
3118
|
+
case NsAccessControlConfig.SelectionType.Designation:
|
|
3119
|
+
case NsAccessControlConfig.SelectionType.Service:
|
|
3120
|
+
case NsAccessControlConfig.SelectionType.Cadre:
|
|
3121
|
+
case NsAccessControlConfig.SelectionType.Batch:
|
|
3122
|
+
case NsAccessControlConfig.SelectionType.Group:
|
|
3123
|
+
case NsAccessControlConfig.SelectionType.VerificationStatus:
|
|
3124
|
+
this.processCadreConfigMapping(userGroupIndex);
|
|
3125
|
+
if (!resetFilterFlag) {
|
|
3126
|
+
this.openSelectionDialog(rule, condition, activeTabSelected, rule?.isUserGroupDisabled);
|
|
3127
|
+
}
|
|
3128
|
+
break;
|
|
3129
|
+
default:
|
|
3130
|
+
if (!resetFilterFlag) {
|
|
3131
|
+
this.openSelectionDialog(rule, condition, activeTabSelected, rule?.isUserGroupDisabled);
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
openSelectionDialog(rule, condition, activeTabSelected, isDisabled) {
|
|
3136
|
+
const originalSelections = [...(condition.selections || [])];
|
|
3137
|
+
const dialogRef = this.dialog.open(EntitySelectionsComponent, {
|
|
3138
|
+
width: "1032px",
|
|
3139
|
+
data: { rule: rule, condition: condition, selected: condition.selections, activeTabSelected: activeTabSelected, disabled: isDisabled }
|
|
3140
|
+
});
|
|
3141
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3142
|
+
if (result) {
|
|
3143
|
+
// Find the rule FormGroup in the FormArray
|
|
3144
|
+
const ruleIndex = this.userGroup.controls.findIndex((ctrl) => ctrl.get("id")?.value === result.rule.id);
|
|
3145
|
+
if (ruleIndex !== -1) {
|
|
3146
|
+
const ruleGroup = this.userGroup.at(ruleIndex);
|
|
3147
|
+
const conditions = ruleGroup.get("conditions");
|
|
3148
|
+
const conditionIndex = conditions.controls.findIndex((ctrl) => ctrl.get("id")?.value === result.condition.id);
|
|
3149
|
+
if (conditionIndex !== -1) {
|
|
3150
|
+
const conditionGroup = conditions.at(conditionIndex);
|
|
3151
|
+
conditionGroup.get("selections")?.setValue(result.selected);
|
|
3152
|
+
if (condition.entity === NsAccessControlConfig.SelectionType.Organizations &&
|
|
3153
|
+
!this.areSelectionsEqual(originalSelections, result.selected)) {
|
|
3154
|
+
const designationCondition = conditions.controls.find(ctrl => ctrl.get("entity")?.value === NsAccessControlConfig.SelectionType.Designation);
|
|
3155
|
+
if (designationCondition) {
|
|
3156
|
+
designationCondition.get("selections")?.setValue([]);
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
// Enable Deputation if Service is selected 'All India Services'
|
|
3160
|
+
if (condition.entity === NsAccessControlConfig.SelectionType.Service) {
|
|
3161
|
+
this.checkServicesAndResetReleated(ruleIndex, conditionIndex);
|
|
3162
|
+
const isAllIndiaService = (serviceName) => {
|
|
3163
|
+
if (!serviceName)
|
|
3164
|
+
return false;
|
|
3165
|
+
const lower = serviceName.toLowerCase();
|
|
3166
|
+
return lower.includes("all india service") ||
|
|
3167
|
+
lower.includes("indian administrative service") ||
|
|
3168
|
+
lower.includes("(ias)") ||
|
|
3169
|
+
lower.includes("indian police service") ||
|
|
3170
|
+
lower.includes("(ips)") ||
|
|
3171
|
+
lower.includes("indian forest service") ||
|
|
3172
|
+
lower.includes("(ifs)");
|
|
3173
|
+
};
|
|
3174
|
+
const hasAIS = result.selected.some((s) => isAllIndiaService(s));
|
|
3175
|
+
if (hasAIS) {
|
|
3176
|
+
this.accessControlService.enableDeputation(true);
|
|
3177
|
+
}
|
|
3178
|
+
else {
|
|
3179
|
+
this.accessControlService.enableDeputation(false);
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
this.processCadreConfigMapping(ruleIndex);
|
|
3183
|
+
this.processDisableAddConditionOnClose(ruleIndex);
|
|
3184
|
+
if (!this.areSelectionsEqual(originalSelections, result.selected)) {
|
|
3185
|
+
this.calculateUserCountForUserGroup(ruleIndex);
|
|
3186
|
+
}
|
|
3187
|
+
// send event after every selection for MDO
|
|
3188
|
+
if (this.config.application === this.MDO_APPLICATION) {
|
|
3189
|
+
this.applyAccessControlValue(true, false);
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
});
|
|
3195
|
+
}
|
|
3196
|
+
areSelectionsEqual(content_1, content_2) {
|
|
3197
|
+
if (content_1.length !== content_2.length)
|
|
3198
|
+
return false;
|
|
3199
|
+
return content_1.every(item => content_2.includes(item));
|
|
3200
|
+
}
|
|
3201
|
+
processCadreConfigMapping(userGroupIndex) {
|
|
3202
|
+
const ruleGroup = this.userGroup.at(userGroupIndex);
|
|
3203
|
+
const conditionValue = ruleGroup.get("conditions").value;
|
|
3204
|
+
if (conditionValue && conditionValue.length) {
|
|
3205
|
+
const services = conditionValue.find((ele) => ele.entity === NsAccessControlConfig.SelectionType.Service);
|
|
3206
|
+
const cadre = conditionValue.find((ele) => ele.entity === NsAccessControlConfig.SelectionType.Cadre);
|
|
3207
|
+
const batch = conditionValue.find((ele) => ele.entity === NsAccessControlConfig.SelectionType.Batch);
|
|
3208
|
+
const serviceSelections = this.cadreMappingService.getServiceIdsByName(services?.selections || []) || [];
|
|
3209
|
+
const cadreSelections = this.cadreMappingService.getCadreIdsByName(cadre?.selections || []) || [];
|
|
3210
|
+
const batchSelections = batch?.selections || [];
|
|
3211
|
+
// Case 1: Only service selected
|
|
3212
|
+
if (serviceSelections?.length && !cadreSelections?.length && !batchSelections?.length) {
|
|
3213
|
+
this.accessControlService.holdServiceCadrebatch.update(prev => ({
|
|
3214
|
+
...prev,
|
|
3215
|
+
service: this.cadreMappingService.getAllServices(),
|
|
3216
|
+
cadre: this.cadreMappingService.getCadresByServices(serviceSelections),
|
|
3217
|
+
batch: this.cadreMappingService.getBatchYearsByServices(serviceSelections)
|
|
3218
|
+
}));
|
|
3219
|
+
}
|
|
3220
|
+
// Case 2: Only cadre selected
|
|
3221
|
+
else if (!serviceSelections?.length && cadreSelections?.length && !batchSelections?.length) {
|
|
3222
|
+
this.accessControlService.holdServiceCadrebatch.update(prev => ({
|
|
3223
|
+
...prev,
|
|
3224
|
+
cadre: this.cadreMappingService.getAllCadres(),
|
|
3225
|
+
service: this.cadreMappingService.getServicesByCadres(cadreSelections),
|
|
3226
|
+
batch: this.cadreMappingService.getBatchYearsByCadres(cadreSelections)
|
|
3227
|
+
}));
|
|
3228
|
+
}
|
|
3229
|
+
// Case 3: Only batch selected
|
|
3230
|
+
else if (!serviceSelections?.length && !cadreSelections?.length && batchSelections?.length) {
|
|
3231
|
+
this.accessControlService.holdServiceCadrebatch.update(prev => ({
|
|
3232
|
+
...prev,
|
|
3233
|
+
batch: this.cadreMappingService.getAllBatchYears(),
|
|
3234
|
+
service: this.cadreMappingService.getServicesByBatchYears(batchSelections),
|
|
3235
|
+
cadre: this.cadreMappingService.getCadresByBatchYears(batchSelections)
|
|
3236
|
+
}));
|
|
3237
|
+
}
|
|
3238
|
+
// Case 4: Service and Cadre selected
|
|
3239
|
+
else if (serviceSelections?.length && cadreSelections?.length && !batchSelections?.length) {
|
|
3240
|
+
this.accessControlService.holdServiceCadrebatch.update(prev => ({
|
|
3241
|
+
...prev,
|
|
3242
|
+
service: this.cadreMappingService.getServicesByCadres(cadreSelections),
|
|
3243
|
+
cadre: this.cadreMappingService.getCadresByServices(serviceSelections),
|
|
3244
|
+
batch: this.cadreMappingService.getBatchYearsByServicesAndCadres(serviceSelections, cadreSelections)
|
|
3245
|
+
}));
|
|
3246
|
+
}
|
|
3247
|
+
// Case 5: Service and Batch selected
|
|
3248
|
+
else if (serviceSelections?.length && !cadreSelections?.length && batchSelections?.length) {
|
|
3249
|
+
this.accessControlService.holdServiceCadrebatch.update(prev => ({
|
|
3250
|
+
...prev,
|
|
3251
|
+
cadre: this.cadreMappingService.getCadresByServicesAndBatch(serviceSelections, batchSelections),
|
|
3252
|
+
service: this.cadreMappingService.getServicesByBatchYears(batchSelections),
|
|
3253
|
+
batch: this.cadreMappingService.getBatchYearsByServices(serviceSelections)
|
|
3254
|
+
}));
|
|
3255
|
+
}
|
|
3256
|
+
// Case 6: Cadre and Batch selected
|
|
3257
|
+
else if (!serviceSelections?.length && cadreSelections?.length && batchSelections?.length) {
|
|
3258
|
+
this.accessControlService.holdServiceCadrebatch.update(prev => ({
|
|
3259
|
+
...prev,
|
|
3260
|
+
service: this.cadreMappingService.getServicesByCadresAndBatch(cadreSelections, batchSelections),
|
|
3261
|
+
cadre: this.cadreMappingService.getCadresByBatchYears(batchSelections),
|
|
3262
|
+
batch: this.cadreMappingService.getBatchYearsByCadres(cadreSelections)
|
|
3263
|
+
}));
|
|
3264
|
+
}
|
|
3265
|
+
else {
|
|
3266
|
+
this.accessControlService.holdServiceCadrebatch.set({
|
|
3267
|
+
service: this.cadreMappingService.getAllServices(),
|
|
3268
|
+
batch: this.cadreMappingService.getAllBatchYears(),
|
|
3269
|
+
cadre: this.cadreMappingService.getAllCadres()
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
processDisableAddConditionOnClose(userGroupIndex) {
|
|
3275
|
+
// If any condition is Users and at least one user is added, disable add condition
|
|
3276
|
+
const ruleGroup = this.userGroup.at(userGroupIndex);
|
|
3277
|
+
const conditions = ruleGroup.get("conditions");
|
|
3278
|
+
const hasUsersConditionWithSelection = conditions.controls.some(ctrl => ctrl.get("entity")?.value === NsAccessControlConfig.SelectionType.Users &&
|
|
3279
|
+
Array.isArray(ctrl.get("selections")?.value) &&
|
|
3280
|
+
ctrl.get("selections")?.value.length > 0);
|
|
3281
|
+
ruleGroup.get("isAddConditionDisabled")?.setValue(hasUsersConditionWithSelection);
|
|
3282
|
+
}
|
|
3283
|
+
openInviteUserDialog(condition, rule, activeTabSelected, isDisabled) {
|
|
3284
|
+
const originalSelections = [...(condition.selections || [])];
|
|
3285
|
+
const dialogRef = this.dialog.open(InviteUsersComponent, {
|
|
3286
|
+
width: "1090px",
|
|
3287
|
+
data: { condition: condition, rule: rule, selected: condition.selections, activeTab: activeTabSelected, disabled: isDisabled }
|
|
3288
|
+
});
|
|
3289
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3290
|
+
if (result) {
|
|
3291
|
+
// Find the rule FormGroup in the FormArray
|
|
3292
|
+
const ruleIndex = this.userGroup.controls.findIndex((ctrl) => ctrl.get("id")?.value === result.rule.id);
|
|
3293
|
+
if (ruleIndex !== -1) {
|
|
3294
|
+
const ruleGroup = this.userGroup.at(ruleIndex);
|
|
3295
|
+
const conditions = ruleGroup.get("conditions");
|
|
3296
|
+
const conditionIndex = conditions.controls.findIndex((ctrl) => ctrl.get("id")?.value === result.condition.id);
|
|
3297
|
+
if (conditionIndex !== -1) {
|
|
3298
|
+
const conditionGroup = conditions.at(conditionIndex);
|
|
3299
|
+
// const userIds = result.selected && result.selected.map((user: any) => user?.userId);
|
|
3300
|
+
conditionGroup.get("selections")?.setValue(result.selected);
|
|
3301
|
+
this.processDisableAddConditionOnClose(ruleIndex);
|
|
3302
|
+
}
|
|
3303
|
+
// send event after every selection for MDO
|
|
3304
|
+
if (this.config.application === this.MDO_APPLICATION) {
|
|
3305
|
+
this.applyAccessControlValue(true, false);
|
|
3306
|
+
}
|
|
3307
|
+
if (!this.areSelectionsEqual(originalSelections, result.selected)) {
|
|
3308
|
+
this.calculateUserCountForUserGroup(ruleIndex);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
callSnackbar(message, type) {
|
|
3315
|
+
if (type === "success") {
|
|
3316
|
+
this.snackbar.openFromComponent(SnackbarComponent, {
|
|
3317
|
+
data: { message: message, type: "success" },
|
|
3318
|
+
duration: 3000,
|
|
3319
|
+
panelClass: "course-success-snackbar"
|
|
3320
|
+
});
|
|
3321
|
+
}
|
|
3322
|
+
else if (type === "error") {
|
|
3323
|
+
this.snackbar.openFromComponent(SnackbarComponent, {
|
|
3324
|
+
data: { message: message, type: "error" },
|
|
3325
|
+
duration: 3000,
|
|
3326
|
+
panelClass: "course-error-snackbar"
|
|
3327
|
+
});
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
validateFormData() {
|
|
3331
|
+
// Validate user groups and conditions
|
|
3332
|
+
if (!this.userGroup || this.userGroup.length === 0) {
|
|
3333
|
+
this.callSnackbar("Please add at least one user group.", "error");
|
|
3334
|
+
return false;
|
|
3335
|
+
}
|
|
3336
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
3337
|
+
const group = this.userGroup.at(i);
|
|
3338
|
+
const conditions = group.get("conditions");
|
|
3339
|
+
if (!conditions || conditions.length === 0) {
|
|
3340
|
+
this.callSnackbar(`User group ${i + 1} must have at least one condition.`, "error");
|
|
3341
|
+
return false;
|
|
3342
|
+
}
|
|
3343
|
+
for (let j = 0; j < conditions.length; j++) {
|
|
3344
|
+
const selections = conditions.at(j).get("selections")?.value;
|
|
3345
|
+
if (!selections || selections.length === 0) {
|
|
3346
|
+
this.callSnackbar(`Condition ${j + 1} in user group ${i + 1} must have at least one selection.`, "error");
|
|
3347
|
+
return false;
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
return true;
|
|
3352
|
+
}
|
|
3353
|
+
async applyAccessControlValue(shouldProceedWithoutValidation = false, displaySuccessMessage = true) {
|
|
3354
|
+
if (!shouldProceedWithoutValidation) {
|
|
3355
|
+
const validated = this.validateFormData();
|
|
3356
|
+
if (!validated)
|
|
3357
|
+
return;
|
|
3358
|
+
}
|
|
3359
|
+
this.isSaving = true;
|
|
3360
|
+
const payload = await this.processRequestCreation();
|
|
3361
|
+
if (this.config.application === this.MDO_APPLICATION) {
|
|
3362
|
+
this.accessControlData.emit({ userGroup: payload, accessType: this.accessType });
|
|
3363
|
+
if (displaySuccessMessage)
|
|
3364
|
+
this.callSnackbar("Access Control saved successfully", "success");
|
|
3365
|
+
this.isSaveFltrBtnDisabled = true;
|
|
3366
|
+
this.isSaving = false;
|
|
3367
|
+
this.isAddUserGroupBtnDisabled = true;
|
|
3368
|
+
return;
|
|
3369
|
+
}
|
|
3370
|
+
this.accessControlService
|
|
3371
|
+
.applyUserGroupAccessControl(payload)
|
|
3372
|
+
.pipe(takeUntil(this.destroy$))
|
|
3373
|
+
.subscribe({
|
|
3374
|
+
next: response => {
|
|
3375
|
+
if (response?.result && response?.result?.accessControl) {
|
|
3376
|
+
this.accessControlData.emit({ userGroup: response.result.accessControl?.userGroups, accessType: this.accessType });
|
|
3377
|
+
if (displaySuccessMessage)
|
|
3378
|
+
this.callSnackbar("Access Control saved successfully", "success");
|
|
3379
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
3380
|
+
this.isSaveFltrBtnDisabled = true;
|
|
3381
|
+
// Update secure setting for moderated content
|
|
3382
|
+
if (this.content?.status !== "Live" && this.content?.prevStatus !== "Live" && !this.isCuratedContentWithExternalId) {
|
|
3383
|
+
this.updateContentAccessSetting();
|
|
3384
|
+
}
|
|
3385
|
+
// Remove initialstate for saved content for Marketplace external content on live status
|
|
3386
|
+
if (this.content?.status === 'live' && this.isCuratedContentWithExternalId) {
|
|
3387
|
+
localStorage.removeItem(`${NsAccessControlConfig.Application.Creation_Portal}_access_control_${this.contentId}`);
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
else {
|
|
3391
|
+
this.callSnackbar("Could not save access control, Please try again.", "error");
|
|
3392
|
+
}
|
|
3393
|
+
this.isSaving = false;
|
|
3394
|
+
},
|
|
3395
|
+
error: () => {
|
|
3396
|
+
this.callSnackbar("Could not save access control, Please try again.", "error");
|
|
3397
|
+
this.isSaving = false;
|
|
3398
|
+
}
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
processRequestCreation() {
|
|
3402
|
+
return new Promise((resolve, reject) => {
|
|
3403
|
+
try {
|
|
3404
|
+
const data = this.accessControlForm.getRawValue();
|
|
3405
|
+
// Filter out user groups with empty userGroupCriteriaList
|
|
3406
|
+
const userGroups = data.userGroup
|
|
3407
|
+
.map((group) => ({
|
|
3408
|
+
userGroupName: group.name,
|
|
3409
|
+
userGroupCriteriaList: group.conditions.map((condition) => {
|
|
3410
|
+
let criteriaValue;
|
|
3411
|
+
if (condition?.entity === NsAccessControlConfig.SelectionType.Users &&
|
|
3412
|
+
condition?.selections?.length &&
|
|
3413
|
+
condition?.selections[0]?.userId) {
|
|
3414
|
+
const userIds = condition.selections?.map((user) => user?.userId) || [];
|
|
3415
|
+
criteriaValue = userIds;
|
|
3416
|
+
}
|
|
3417
|
+
else if (condition?.entity === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
3418
|
+
criteriaValue = condition.selections[0];
|
|
3419
|
+
return { criteriaKey: condition.entity, criteriaValue };
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
if (condition.selections.length && typeof condition.selections[0] === "object") {
|
|
3423
|
+
criteriaValue = condition.selections?.map((sel) => sel?.fieldValue) || [];
|
|
3424
|
+
}
|
|
3425
|
+
else {
|
|
3426
|
+
criteriaValue = condition.selections?.map(String) || [];
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
if (condition.entity && criteriaValue && criteriaValue.length > 0) {
|
|
3430
|
+
return {
|
|
3431
|
+
criteriaKey: condition.entity,
|
|
3432
|
+
criteriaValue,
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
return null;
|
|
3436
|
+
})
|
|
3437
|
+
.filter((criteria) => !!criteria), // Remove nulls
|
|
3438
|
+
}))
|
|
3439
|
+
.filter((group) => Array.isArray(group.userGroupCriteriaList) && group.userGroupCriteriaList.length > 0);
|
|
3440
|
+
const requestPayload = {
|
|
3441
|
+
contentId: this.contentId,
|
|
3442
|
+
accessControl: {
|
|
3443
|
+
version: 1,
|
|
3444
|
+
userGroups,
|
|
3445
|
+
},
|
|
3446
|
+
};
|
|
3447
|
+
resolve(requestPayload);
|
|
3448
|
+
}
|
|
3449
|
+
catch (error) {
|
|
3450
|
+
reject(error);
|
|
3451
|
+
}
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
openInstructonsDialog() {
|
|
3455
|
+
this.dialog.open(AccessControlGuideComponent, {
|
|
3456
|
+
width: "960px"
|
|
3457
|
+
});
|
|
3458
|
+
}
|
|
3459
|
+
async getAccessControl() {
|
|
3460
|
+
const response = await this.accessControlService
|
|
3461
|
+
.fetchUserGroupAccessControl(this.contentId)
|
|
3462
|
+
.pipe(takeUntil(this.destroy$))
|
|
3463
|
+
.toPromise()
|
|
3464
|
+
.catch(() => {
|
|
3465
|
+
// For Moderated Content Condition if not already added the usergroup autocreate a usergroup with added conditions and save it
|
|
3466
|
+
if (this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC) {
|
|
3467
|
+
// Create Organization condition
|
|
3468
|
+
const orgCondition = this.createConditionGroup(v4(), 0);
|
|
3469
|
+
orgCondition.get("entity")?.setValue(NsAccessControlConfig.SelectionType.Organizations);
|
|
3470
|
+
orgCondition.get("selections").setValue([this.config?.userConfig?.rootOrgId]);
|
|
3471
|
+
// Create Verification Status condition with default 'Verified'
|
|
3472
|
+
const verificationCondition = this.createConditionGroup(v4(), 0);
|
|
3473
|
+
verificationCondition.get("entity")?.setValue(NsAccessControlConfig.SelectionType.VerificationStatus);
|
|
3474
|
+
verificationCondition.get("selections")?.setValue(["VERIFIED"]);
|
|
3475
|
+
// Create user group with these two conditions
|
|
3476
|
+
const group = this.fb.group({
|
|
3477
|
+
id: [v4()],
|
|
3478
|
+
name: ["User Group 1"],
|
|
3479
|
+
description: ["Description for UserGroup 1"],
|
|
3480
|
+
conditions: this.fb.array([orgCondition, verificationCondition])
|
|
3481
|
+
});
|
|
3482
|
+
this.userGroup.push(group);
|
|
3483
|
+
// Disable add user group btn
|
|
3484
|
+
this.isAddUserGroupBtnDisabled = true;
|
|
3485
|
+
this.accessControlData.emit({ userGroup: this.accessControlForm.value?.userGroup, accessType: this.accessType });
|
|
3486
|
+
this.applyAccessControlValue(false, false);
|
|
3487
|
+
this.updateContentAccessSetting();
|
|
3488
|
+
}
|
|
3489
|
+
// For a content not having any user group disable the access control type change
|
|
3490
|
+
if ((this.content?.status === "Live" || this.content?.prevStatus === "Live") &&
|
|
3491
|
+
// this.content?.accessSetting !== NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC &&
|
|
3492
|
+
(!this.isCuratedContentWithExternalId)) {
|
|
3493
|
+
this.accessControlCriteriaSelection?.accessTypes.forEach((type) => {
|
|
3494
|
+
type.disabled = true;
|
|
3495
|
+
});
|
|
3496
|
+
this.isSaveFltrBtnDisabled = true;
|
|
3497
|
+
}
|
|
3498
|
+
setTimeout(() => {
|
|
3499
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
3500
|
+
this.setupFormChangeDetection();
|
|
3501
|
+
}, 0);
|
|
3502
|
+
});
|
|
3503
|
+
if (response?.result?.accessControl) {
|
|
3504
|
+
this.processAccessControlResult(response.result.accessControl);
|
|
3505
|
+
this.accessControlData.emit({ userGroup: response.result.accessControl?.userGroups, accessType: this.accessType });
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
setupFormChangeDetection() {
|
|
3509
|
+
this.accessControlForm.valueChanges.subscribe(() => {
|
|
3510
|
+
const currentValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
3511
|
+
if (this.content?.status === "Live" || this.content?.prevStatus === "Live") {
|
|
3512
|
+
this.isSaveFltrBtnDisabled = currentValue === this.initialUserGroupValue;
|
|
3513
|
+
if (this.content?.accessSetting !== NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC) {
|
|
3514
|
+
this.isAddUserGroupBtnDisabled = currentValue === this.initialUserGroupValue;
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
else {
|
|
3518
|
+
this.isSaveFltrBtnDisabled = currentValue === this.initialUserGroupValue;
|
|
3519
|
+
}
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
processAccessControlResult(accessControl) {
|
|
3523
|
+
if (!accessControl?.userGroups?.length) {
|
|
3524
|
+
setTimeout(() => {
|
|
3525
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
3526
|
+
this.setupFormChangeDetection();
|
|
3527
|
+
}, 0);
|
|
3528
|
+
return;
|
|
3529
|
+
}
|
|
3530
|
+
while (this.userGroup.length) {
|
|
3531
|
+
this.userGroup.removeAt(0);
|
|
3532
|
+
}
|
|
3533
|
+
// Save initial state if not already saved for live content
|
|
3534
|
+
if (!this.getInitialState()) {
|
|
3535
|
+
this.saveInitialState(accessControl?.userGroups);
|
|
3536
|
+
}
|
|
3537
|
+
// Check if ANY user group has All India Services BEFORE processing
|
|
3538
|
+
const isAllIndiaService = (serviceName) => {
|
|
3539
|
+
if (!serviceName)
|
|
3540
|
+
return false;
|
|
3541
|
+
const lower = serviceName.toLowerCase();
|
|
3542
|
+
return lower.includes("all india service") ||
|
|
3543
|
+
lower.includes("indian administrative service") ||
|
|
3544
|
+
lower.includes("(ias)") ||
|
|
3545
|
+
lower.includes("indian police service") ||
|
|
3546
|
+
lower.includes("(ips)") ||
|
|
3547
|
+
lower.includes("indian forest service") ||
|
|
3548
|
+
lower.includes("(ifs)");
|
|
3549
|
+
};
|
|
3550
|
+
let hasAISInAnyGroup = false;
|
|
3551
|
+
accessControl.userGroups.forEach((group) => {
|
|
3552
|
+
const isContainsService = group.userGroupCriteriaList.find((criteria) => criteria.criteriaKey === NsAccessControlConfig.SelectionType.Service);
|
|
3553
|
+
if (isContainsService?.criteriaKey === NsAccessControlConfig.SelectionType.Service) {
|
|
3554
|
+
const criteriaValues = isContainsService.criteriaValue || [];
|
|
3555
|
+
// Check if any service is an All India Service
|
|
3556
|
+
if (criteriaValues.some((val) => isAllIndiaService(val))) {
|
|
3557
|
+
hasAISInAnyGroup = true;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
});
|
|
3561
|
+
// Enable/disable deputation based on whether ANY group has AIS
|
|
3562
|
+
if (hasAISInAnyGroup) {
|
|
3563
|
+
this.accessControlService.enableDeputation(true);
|
|
3564
|
+
}
|
|
3565
|
+
else {
|
|
3566
|
+
this.accessControlService.enableDeputation(false);
|
|
3567
|
+
}
|
|
3568
|
+
accessControl.userGroups.forEach((group, index) => {
|
|
3569
|
+
const conditions = this.fb.array([]);
|
|
3570
|
+
group.userGroupCriteriaList.forEach((criteria) => {
|
|
3571
|
+
const condition = this.createConditionGroup(v4(), this.userGroup.length);
|
|
3572
|
+
// Map API keys to form entity values
|
|
3573
|
+
const entityMap = {
|
|
3574
|
+
rootOrgId: NsAccessControlConfig.SelectionType.Organizations,
|
|
3575
|
+
user: NsAccessControlConfig.SelectionType.Users,
|
|
3576
|
+
group: NsAccessControlConfig.SelectionType.Group,
|
|
3577
|
+
designation: NsAccessControlConfig.SelectionType.Designation,
|
|
3578
|
+
profilestatus: NsAccessControlConfig.SelectionType.VerificationStatus,
|
|
3579
|
+
Cadre: NsAccessControlConfig.SelectionType.Cadre,
|
|
3580
|
+
service: NsAccessControlConfig.SelectionType.Service,
|
|
3581
|
+
batch: NsAccessControlConfig.SelectionType.Batch,
|
|
3582
|
+
isOnCentralDeputation: NsAccessControlConfig.SelectionType.CentralDeputation
|
|
3583
|
+
};
|
|
3584
|
+
// Set the form values
|
|
3585
|
+
condition.patchValue({
|
|
3586
|
+
entity: entityMap[criteria.criteriaKey] || criteria.criteriaKey,
|
|
3587
|
+
selections: criteria.criteriaKey === NsAccessControlConfig.SelectionType.Batch
|
|
3588
|
+
? Array.isArray(criteria.criteriaValue)
|
|
3589
|
+
? criteria.criteriaValue.map((b) => Number(b))
|
|
3590
|
+
: []
|
|
3591
|
+
: criteria.criteriaKey === NsAccessControlConfig.SelectionType.CentralDeputation
|
|
3592
|
+
? Array.isArray(criteria.criteriaValue)
|
|
3593
|
+
? criteria.criteriaValue
|
|
3594
|
+
: [criteria.criteriaValue]
|
|
3595
|
+
: criteria.criteriaValue,
|
|
3596
|
+
});
|
|
3597
|
+
conditions.push(condition);
|
|
3598
|
+
});
|
|
3599
|
+
const ruleGroup = this.fb.group({
|
|
3600
|
+
id: [group.userGroupId || v4()],
|
|
3601
|
+
name: [group.userGroupName],
|
|
3602
|
+
description: [`Description for ${group.userGroupName}`],
|
|
3603
|
+
conditions: conditions,
|
|
3604
|
+
isUserGroupDisabled: [false],
|
|
3605
|
+
isAddConditionDisabled: [false]
|
|
3606
|
+
});
|
|
3607
|
+
this.userGroup.push(ruleGroup);
|
|
3608
|
+
// Check if add condition should be disabled for this user group
|
|
3609
|
+
this.processDisableAddConditionOnClose(index);
|
|
3610
|
+
// Calculate count for each user group
|
|
3611
|
+
this.calculateUserCountForUserGroup(index);
|
|
3612
|
+
if ((this.content?.status === "Live" || this.content?.prevStatus === "Live") &&
|
|
3613
|
+
// this.content?.accessSetting !== NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC &&
|
|
3614
|
+
(!this.isCuratedContentWithExternalId)) {
|
|
3615
|
+
// publisher (cannot edit already added)
|
|
3616
|
+
for (let i = 0; i < this.userGroup?.length; i++) {
|
|
3617
|
+
const group = this.userGroup.at(i);
|
|
3618
|
+
group.get("id")?.disable();
|
|
3619
|
+
group.get("name")?.disable();
|
|
3620
|
+
group.get("description")?.disable();
|
|
3621
|
+
group.get("conditions")?.disable();
|
|
3622
|
+
group.get("isUserGroupDisabled")?.setValue(true);
|
|
3623
|
+
}
|
|
3624
|
+
this.accessControlCriteriaSelection?.accessTypes.forEach((type) => {
|
|
3625
|
+
type.disabled = true;
|
|
3626
|
+
});
|
|
3627
|
+
this.isSaveFltrBtnDisabled = true;
|
|
3628
|
+
}
|
|
3629
|
+
// For marketplace curated content with external id, disable only those user groups which were in live
|
|
3630
|
+
if (this.content?.status === "live" && this.isCuratedContentWithExternalId) {
|
|
3631
|
+
// Get initial state from localStorage
|
|
3632
|
+
const initialUserGroups = this.getInitialState();
|
|
3633
|
+
if (initialUserGroups) {
|
|
3634
|
+
// Only disable user groups that were in the initial state
|
|
3635
|
+
const initialGroupIds = initialUserGroups.map(group => group.userGroupName);
|
|
3636
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
3637
|
+
const group = this.userGroup.at(i);
|
|
3638
|
+
const groupId = group.get("name")?.value;
|
|
3639
|
+
// If this group was in the initial state, disable it
|
|
3640
|
+
if (initialGroupIds.includes(groupId)) {
|
|
3641
|
+
group.get("id")?.disable();
|
|
3642
|
+
group.get("name")?.disable();
|
|
3643
|
+
group.get("description")?.disable();
|
|
3644
|
+
group.get("conditions")?.disable();
|
|
3645
|
+
group.get("isUserGroupDisabled")?.setValue(true);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
this.isSaveFltrBtnDisabled = true;
|
|
3650
|
+
}
|
|
3651
|
+
setTimeout(() => {
|
|
3652
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
3653
|
+
this.setupFormChangeDetection();
|
|
3654
|
+
}, 0);
|
|
3655
|
+
});
|
|
3656
|
+
}
|
|
3657
|
+
async updateContentAccessSetting() {
|
|
3658
|
+
let secureSettings = {};
|
|
3659
|
+
if (typeof this.content.language === "string") {
|
|
3660
|
+
this.content.language = [this.content.language];
|
|
3661
|
+
}
|
|
3662
|
+
if (this.content.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC) {
|
|
3663
|
+
const userGroup0 = this.userGroup.at(0);
|
|
3664
|
+
let organisation = [];
|
|
3665
|
+
let isVerifiedKarmayogi = "";
|
|
3666
|
+
if (userGroup0) {
|
|
3667
|
+
const conditions = userGroup0.get("conditions");
|
|
3668
|
+
if (conditions && conditions.length) {
|
|
3669
|
+
const orgCondition = conditions.controls.find(ctrl => ctrl.get("entity")?.value === NsAccessControlConfig.SelectionType.Organizations);
|
|
3670
|
+
if (orgCondition) {
|
|
3671
|
+
organisation = orgCondition.get("selections")?.value || [];
|
|
3672
|
+
}
|
|
3673
|
+
const verificationCondition = conditions.controls.find(ctrl => ctrl.get("entity")?.value === NsAccessControlConfig.SelectionType.VerificationStatus);
|
|
3674
|
+
if (verificationCondition) {
|
|
3675
|
+
const verSelections = verificationCondition.get("selections")?.value || [];
|
|
3676
|
+
isVerifiedKarmayogi = Array.isArray(verSelections) && verSelections?.length > 1 ? "No" : "Yes";
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
this.content.secureSettings = {
|
|
3681
|
+
version: 1,
|
|
3682
|
+
organisation,
|
|
3683
|
+
isVerifiedKarmayogi
|
|
3684
|
+
};
|
|
3685
|
+
secureSettings = {
|
|
3686
|
+
version: 1,
|
|
3687
|
+
organisation,
|
|
3688
|
+
isVerifiedKarmayogi
|
|
3689
|
+
};
|
|
3690
|
+
}
|
|
3691
|
+
const accessTypeBoolean = this.accessType === NsAccessControlConfig.IAccessTypes.Public ? false : true;
|
|
3692
|
+
const request = this.accessControlService.createRequestContent(this.content, accessTypeBoolean);
|
|
3693
|
+
const requestForMDO = this.accessControlService.createRequesForMDOContent(this.content, accessTypeBoolean, secureSettings);
|
|
3694
|
+
if (this.content.status !== "Live" || this.content.prevStatus != "Live") {
|
|
3695
|
+
if ((this.config.userConfig.userRoles.has("content_publisher") || this.config.userConfig.userRoles.has("spv_publisher")) &&
|
|
3696
|
+
this.content.status !== "Draft") {
|
|
3697
|
+
if (this.content.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC) {
|
|
3698
|
+
if (this.content.reviewStatus) {
|
|
3699
|
+
requestForMDO.request.content.reviewStatus = this.content.reviewStatus;
|
|
3700
|
+
}
|
|
3701
|
+
await this.accessControlService.updateContentV4(requestForMDO, this.contentId).toPromise();
|
|
3702
|
+
}
|
|
3703
|
+
else {
|
|
3704
|
+
if (this.content.reviewStatus) {
|
|
3705
|
+
request.request.content.reviewStatus = this.content.reviewStatus;
|
|
3706
|
+
}
|
|
3707
|
+
await this.accessControlService.updateContentV4(request, this.contentId).toPromise();
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
else {
|
|
3711
|
+
if (this.content.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC) {
|
|
3712
|
+
await this.accessControlService.updateContentV3(requestForMDO, this.contentId).toPromise();
|
|
3713
|
+
}
|
|
3714
|
+
else {
|
|
3715
|
+
await this.accessControlService.updateContentV3(request, this.contentId).toPromise();
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
this.refreshContentMeta.emit(true);
|
|
3720
|
+
}
|
|
3721
|
+
get hasUserGroupBeenAdded() {
|
|
3722
|
+
if (!this.userGroup?.length) {
|
|
3723
|
+
return true;
|
|
3724
|
+
}
|
|
3725
|
+
return !this.userGroup.controls.every((group) => {
|
|
3726
|
+
const conditions = group.get("conditions")?.controls || [];
|
|
3727
|
+
return (conditions?.length > 0 &&
|
|
3728
|
+
conditions.every((condition) => {
|
|
3729
|
+
const selections = condition.get("selections")?.value;
|
|
3730
|
+
return Array.isArray(selections) && selections.length > 0;
|
|
3731
|
+
}));
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
get getTotalUserCount() {
|
|
3735
|
+
return Object.values(this.userCount).reduce((total, count) => total + count, 0);
|
|
3736
|
+
}
|
|
3737
|
+
processConditionsForContentType() {
|
|
3738
|
+
if (this.content?.accessSetting === NsAccessControlConfig.IAccessSetting.MDO_SPECIFIC) {
|
|
3739
|
+
// Disable add user group btn
|
|
3740
|
+
this.isAddUserGroupBtnDisabled = true;
|
|
3741
|
+
}
|
|
3742
|
+
if (this.content?.status === "Review" && this.content?.reviewStatus === "InReview") {
|
|
3743
|
+
// reviewer(readonly)
|
|
3744
|
+
this.accessControlCriteriaSelection.readOnly = true;
|
|
3745
|
+
this.isSaveFltrBtnDisabled = true;
|
|
3746
|
+
}
|
|
3747
|
+
// else if (
|
|
3748
|
+
// (this.content?.status === "Live" || this.content?.prevStatus === "Live") &&
|
|
3749
|
+
// this.content?.courseCategory !== "Comprehensive Assessment Program" &&
|
|
3750
|
+
// (this.config.userConfig.userRoles.has("spv_publisher") || this.config.userConfig.userRoles.has("content_publisher")) &&
|
|
3751
|
+
// !this.config.userConfig.userRoles.has("content_creator")
|
|
3752
|
+
// ) {
|
|
3753
|
+
// // publisher (disabled all)
|
|
3754
|
+
// this.accessControlCriteriaSelection.readOnly = true;
|
|
3755
|
+
// this.isSaveFltrBtnDisabled = true;
|
|
3756
|
+
// }
|
|
3757
|
+
}
|
|
3758
|
+
async calculateUserCountForUserGroup(userGroupIndex, conditionIndex) {
|
|
3759
|
+
// Mapping of entity to request key
|
|
3760
|
+
const entityKeyMap = {
|
|
3761
|
+
[NsAccessControlConfig.SelectionType.Organizations]: "rootOrgId",
|
|
3762
|
+
[NsAccessControlConfig.SelectionType.Designation]: "profileDetails.professionalDetails.designation",
|
|
3763
|
+
[NsAccessControlConfig.SelectionType.Group]: "profileDetails.professionalDetails.group",
|
|
3764
|
+
[NsAccessControlConfig.SelectionType.VerificationStatus]: "profileDetails.profileStatus",
|
|
3765
|
+
[NsAccessControlConfig.SelectionType.Cadre]: "profileDetails.cadreDetails.cadreName",
|
|
3766
|
+
[NsAccessControlConfig.SelectionType.Service]: "profileDetails.cadreDetails.civilServiceName",
|
|
3767
|
+
[NsAccessControlConfig.SelectionType.Batch]: "profileDetails.cadreDetails.cadreBatch",
|
|
3768
|
+
[NsAccessControlConfig.SelectionType.Users]: "identifier",
|
|
3769
|
+
[NsAccessControlConfig.SelectionType.CentralDeputation]: "profileDetails.cadreDetails.isOnCentralDeputation"
|
|
3770
|
+
};
|
|
3771
|
+
const group = this.userGroup.at(userGroupIndex);
|
|
3772
|
+
if (!group) {
|
|
3773
|
+
this.userCount[userGroupIndex] = 0;
|
|
3774
|
+
return;
|
|
3775
|
+
}
|
|
3776
|
+
const conditions = group.get("conditions");
|
|
3777
|
+
const request = {};
|
|
3778
|
+
for (let j = 0; j < conditions.length; j++) {
|
|
3779
|
+
const condition = conditions.at(j);
|
|
3780
|
+
const entity = condition.get("entity")?.value;
|
|
3781
|
+
const selections = condition.get("selections")?.value || [];
|
|
3782
|
+
const key = entityKeyMap[entity];
|
|
3783
|
+
if (key) {
|
|
3784
|
+
if (entity === NsAccessControlConfig.SelectionType.Users &&
|
|
3785
|
+
Array.isArray(selections) &&
|
|
3786
|
+
selections.every(sel => typeof sel === "object" && sel !== null)) {
|
|
3787
|
+
const userIds = selections && selections.map((user) => user?.userId);
|
|
3788
|
+
request[key] = userIds;
|
|
3789
|
+
}
|
|
3790
|
+
else if (entity === NsAccessControlConfig.SelectionType.CentralDeputation) {
|
|
3791
|
+
if (selections.length && typeof selections[0] === "boolean") {
|
|
3792
|
+
request[key] = selections[0];
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
else {
|
|
3796
|
+
request[key] = selections;
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
else {
|
|
3800
|
+
const customFieldSelections = selections.map((sel) => sel?.fieldValue || sel);
|
|
3801
|
+
request[`${entity}`] = customFieldSelections;
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
// Remove keys with empty array values
|
|
3805
|
+
Object.keys(request).forEach(key => {
|
|
3806
|
+
if (Array.isArray(request[key]) && request[key].length === 0) {
|
|
3807
|
+
delete request[key];
|
|
3808
|
+
}
|
|
3809
|
+
});
|
|
3810
|
+
if (this.accessControlService.accessControlConfig()?.application === NsAccessControlConfig.Application.MDO) {
|
|
3811
|
+
if (!this.isCCA && Object.keys(request)?.length > 0) {
|
|
3812
|
+
request.rootOrgId = this.accessControlService.accessControlConfig().userConfig.org?.rootOrgId ? [this.accessControlService.accessControlConfig().userConfig.org?.rootOrgId] : [];
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
const filters = { ...request };
|
|
3816
|
+
if (Object.keys(filters).length > 0) {
|
|
3817
|
+
filters.status = 1;
|
|
3818
|
+
}
|
|
3819
|
+
else {
|
|
3820
|
+
delete filters.status;
|
|
3821
|
+
}
|
|
3822
|
+
const payload = {
|
|
3823
|
+
request: {
|
|
3824
|
+
...(Object.keys(filters).length > 0 ? { filters } : {}),
|
|
3825
|
+
fields: ["identifier", "rootOrgId", "firstName"]
|
|
3826
|
+
}
|
|
3827
|
+
};
|
|
3828
|
+
if (payload?.request?.filters) {
|
|
3829
|
+
const response = await this.accessControlService
|
|
3830
|
+
.validateUser(payload)
|
|
3831
|
+
.toPromise()
|
|
3832
|
+
.catch(() => {
|
|
3833
|
+
this.userCount[userGroupIndex] = 0;
|
|
3834
|
+
});
|
|
3835
|
+
if (response?.result?.response) {
|
|
3836
|
+
const count = response?.result?.response?.count;
|
|
3837
|
+
this.userCount[userGroupIndex] = count;
|
|
3838
|
+
if (!this.userCount[userGroupIndex]) {
|
|
3839
|
+
this.callSnackbar("No iGOT official match the set conditions selections, please review the set conditions and their respective selections.", "error");
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
else {
|
|
3844
|
+
this.userCount[userGroupIndex] = 0;
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
isUserGroupFormChanged(initialValue) {
|
|
3848
|
+
const currentValue = this.accessControlForm.getRawValue().userGroup;
|
|
3849
|
+
return JSON.stringify(currentValue) !== JSON.stringify(initialValue);
|
|
3850
|
+
}
|
|
3851
|
+
checkForResetFilter(condition, rule, userGroupIndex) {
|
|
3852
|
+
let flag = false;
|
|
3853
|
+
let accessControlFormData = this.accessControlForm.getRawValue();
|
|
3854
|
+
let activeManageSelection = accessControlFormData && accessControlFormData?.userGroup?.[userGroupIndex];
|
|
3855
|
+
let activeSelectionCount = 0;
|
|
3856
|
+
if (activeManageSelection && activeManageSelection?.conditions && activeManageSelection?.conditions?.length > 1) {
|
|
3857
|
+
//Show Popup
|
|
3858
|
+
let onlyOneCondition = this.hasOnlyOneArrayWithLength(activeManageSelection?.conditions, "selections");
|
|
3859
|
+
if (onlyOneCondition) {
|
|
3860
|
+
flag = false;
|
|
3861
|
+
}
|
|
3862
|
+
else {
|
|
3863
|
+
activeManageSelection?.conditions?.map(item => {
|
|
3864
|
+
if (item?.entity == condition?.entity && item?.selections.length > 0) {
|
|
3865
|
+
flag = true;
|
|
3866
|
+
}
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
if (activeManageSelection?.conditions?.length > 1) {
|
|
3870
|
+
let checkLastIndexHaveSelections = -1;
|
|
3871
|
+
activeManageSelection?.conditions?.forEach((item, index) => {
|
|
3872
|
+
if (item?.selections.length > 0) {
|
|
3873
|
+
checkLastIndexHaveSelections = index;
|
|
3874
|
+
}
|
|
3875
|
+
});
|
|
3876
|
+
// console.log('activeManageSelection?.conditions', activeManageSelection?.conditions)
|
|
3877
|
+
// console.log('checkLastIndexHaveSelections--', checkLastIndexHaveSelections)
|
|
3878
|
+
if (activeManageSelection?.conditions[checkLastIndexHaveSelections]?.entity === condition?.entity && condition?.selections?.length > 0) {
|
|
3879
|
+
flag = false;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
// let index = activeManageSelection?.conditions?.findLastIndex((item) =>
|
|
3883
|
+
// item?.entity === condition?.entity && item?.selections.length > 0
|
|
3884
|
+
// );
|
|
3885
|
+
// if((index + 1) === activeManageSelection?.conditions.length) {
|
|
3886
|
+
// flag = false
|
|
3887
|
+
// }
|
|
3888
|
+
// console.log('activeManageSelection?.conditions', activeManageSelection?.conditions)
|
|
3889
|
+
// console.log('index', index)
|
|
3890
|
+
}
|
|
3891
|
+
return flag;
|
|
3892
|
+
}
|
|
3893
|
+
hasOnlyOneArrayWithLength(data, key) {
|
|
3894
|
+
let count = 0;
|
|
3895
|
+
for (const obj of data) {
|
|
3896
|
+
if (Array.isArray(obj[key]) && obj[key].length > 0) {
|
|
3897
|
+
count++;
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
return count > 1 ? false : true;
|
|
3901
|
+
}
|
|
3902
|
+
resetActiveUserGroupFields(condition, rule, userGroupIndex) {
|
|
3903
|
+
let accessControlFormData = this.accessControlForm.getRawValue();
|
|
3904
|
+
let activeManageSelection = accessControlFormData && accessControlFormData?.userGroup?.[userGroupIndex];
|
|
3905
|
+
let activeConditionIndex = activeManageSelection?.conditions?.findIndex(item => {
|
|
3906
|
+
return item?.entity === condition?.entity && item?.selections?.length > 0;
|
|
3907
|
+
});
|
|
3908
|
+
let activeManageSelectionArrLength = activeManageSelection?.conditions.length;
|
|
3909
|
+
for (let i = activeConditionIndex + 1; i < activeManageSelectionArrLength; i++) {
|
|
3910
|
+
const userGroupArray = this.accessControlForm.get("userGroup");
|
|
3911
|
+
const userGroup = userGroupArray.at(userGroupIndex);
|
|
3912
|
+
const conditionsArray = userGroup.get("conditions");
|
|
3913
|
+
const conditionGroup = conditionsArray.at(i);
|
|
3914
|
+
// conditionGroup.reset();
|
|
3915
|
+
const condition = conditionGroup;
|
|
3916
|
+
condition.get("entity")?.setValue("");
|
|
3917
|
+
condition.get("selections")?.setValue([]);
|
|
3918
|
+
}
|
|
3919
|
+
this.calculateUserCountForUserGroup(userGroupIndex);
|
|
3920
|
+
}
|
|
3921
|
+
// Customs Field Logics
|
|
3922
|
+
getCustomsField() {
|
|
3923
|
+
this.accessControlService
|
|
3924
|
+
.fetchCustomsField({
|
|
3925
|
+
organisationId: this.config.userConfig.rootOrgId,
|
|
3926
|
+
isEnabled: true,
|
|
3927
|
+
type: "masterList"
|
|
3928
|
+
// isMandatory: true,
|
|
3929
|
+
})
|
|
3930
|
+
.subscribe({
|
|
3931
|
+
next: (data) => {
|
|
3932
|
+
if (data && data?.result && data.result.searchResults?.data) {
|
|
3933
|
+
const results = data.result.searchResults.data;
|
|
3934
|
+
if (Array.isArray(results) && results.length) {
|
|
3935
|
+
const mappedFields = _.chain(results)
|
|
3936
|
+
.map(field => {
|
|
3937
|
+
if (field?.originalCustomFieldData?.length === 1) {
|
|
3938
|
+
const firstField = _.first(field.originalCustomFieldData);
|
|
3939
|
+
const filteredAndUniqueData = _.chain(field?.reversedOrderCustomFieldData)
|
|
3940
|
+
.filter((item) => item?.fieldAttribute === firstField?.attributeName)
|
|
3941
|
+
.uniqBy('fieldValue')
|
|
3942
|
+
.value();
|
|
3943
|
+
return {
|
|
3944
|
+
disabled: false,
|
|
3945
|
+
value: firstField?.attributeName || "",
|
|
3946
|
+
label: firstField?.name || "",
|
|
3947
|
+
isCustomField: true,
|
|
3948
|
+
reversedOrderCustomFieldData: filteredAndUniqueData
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
else if (field?.originalCustomFieldData?.length > 1) {
|
|
3952
|
+
const lastField = _.last(field.originalCustomFieldData);
|
|
3953
|
+
if (lastField) {
|
|
3954
|
+
const filteredAndUniqueData = _.chain(field?.reversedOrderCustomFieldData)
|
|
3955
|
+
.filter((item) => item?.fieldAttribute === lastField?.attributeName)
|
|
3956
|
+
.uniqBy('fieldValue')
|
|
3957
|
+
.value();
|
|
3958
|
+
return {
|
|
3959
|
+
disabled: false,
|
|
3960
|
+
value: lastField?.attributeName || "",
|
|
3961
|
+
label: lastField?.name || "",
|
|
3962
|
+
isCustomField: true,
|
|
3963
|
+
reversedOrderCustomFieldData: filteredAndUniqueData
|
|
3964
|
+
};
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
return null;
|
|
3968
|
+
})
|
|
3969
|
+
.compact()
|
|
3970
|
+
.value();
|
|
3971
|
+
// Update the service with mapped fields
|
|
3972
|
+
this.accessControlService.customesFieldData.set(mappedFields);
|
|
3973
|
+
// Update optionsEntity without duplicates
|
|
3974
|
+
this.accessControlCriteriaSelection.optionsEntity = _.uniqBy([...this.accessControlCriteriaSelection.optionsEntity, ...mappedFields], 'value');
|
|
3975
|
+
// Create dynamic fields
|
|
3976
|
+
const dynamicFields = mappedFields.reduce((acc, field) => {
|
|
3977
|
+
acc[field.value] = [
|
|
3978
|
+
{ value: "all", label: `All ${field.label}` },
|
|
3979
|
+
{ value: "selected", label: `Selected ${field.label}` },
|
|
3980
|
+
];
|
|
3981
|
+
return acc;
|
|
3982
|
+
}, {});
|
|
3983
|
+
// Merge configurations
|
|
3984
|
+
this.accessControlCriteriaSelection = {
|
|
3985
|
+
...this.accessControlCriteriaSelection,
|
|
3986
|
+
...dynamicFields,
|
|
3987
|
+
};
|
|
3988
|
+
// Update the signal with the full updated object
|
|
3989
|
+
this.accessControlService.accessControlConfig.update((prevConfig) => ({
|
|
3990
|
+
...prevConfig,
|
|
3991
|
+
accessControlCriteriaSelection: this.accessControlCriteriaSelection,
|
|
3992
|
+
}));
|
|
3993
|
+
this.isLoading = false;
|
|
3994
|
+
}
|
|
3995
|
+
else {
|
|
3996
|
+
this.isLoading = false;
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
else {
|
|
4000
|
+
this.isLoading = false;
|
|
4001
|
+
}
|
|
4002
|
+
},
|
|
4003
|
+
});
|
|
4004
|
+
}
|
|
4005
|
+
// Patch raw accesscontrol to form
|
|
4006
|
+
getStorageKey() {
|
|
4007
|
+
return `${this.config.application}_access_control_${this.contentId}`;
|
|
4008
|
+
}
|
|
4009
|
+
saveInitialState(userGroups) {
|
|
4010
|
+
if ((this.config?.application === this.MDO_APPLICATION && this.config?.mdoContent?.status === "Live") ||
|
|
4011
|
+
(this.content?.status === "live" && this.isCuratedContentWithExternalId)) {
|
|
4012
|
+
const state = {
|
|
4013
|
+
initialUserGroups: userGroups,
|
|
4014
|
+
timestamp: new Date().getTime()
|
|
4015
|
+
};
|
|
4016
|
+
localStorage.setItem(this.getStorageKey(), JSON.stringify(state));
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
getInitialState() {
|
|
4020
|
+
const savedState = localStorage.getItem(this.getStorageKey());
|
|
4021
|
+
if (savedState) {
|
|
4022
|
+
const { initialUserGroups } = JSON.parse(savedState);
|
|
4023
|
+
return initialUserGroups;
|
|
4024
|
+
}
|
|
4025
|
+
return null;
|
|
4026
|
+
}
|
|
4027
|
+
processTempAccessControl(tempAccessControl) {
|
|
4028
|
+
while (this.userGroup.length) {
|
|
4029
|
+
this.userGroup.removeAt(0);
|
|
4030
|
+
}
|
|
4031
|
+
// If no user groups in the data, add a default one
|
|
4032
|
+
if (!tempAccessControl?.userGroups || tempAccessControl.userGroups.length === 0) {
|
|
4033
|
+
this.addUserGroup();
|
|
4034
|
+
setTimeout(() => {
|
|
4035
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
4036
|
+
this.setupFormChangeDetection();
|
|
4037
|
+
}, 0);
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
4040
|
+
// Save initial state if not already saved for live content
|
|
4041
|
+
if (!this.getInitialState()) {
|
|
4042
|
+
this.saveInitialState(tempAccessControl.userGroups);
|
|
4043
|
+
}
|
|
4044
|
+
// Check if ANY user group has All India Services BEFORE processing
|
|
4045
|
+
const isAllIndiaService = (serviceName) => {
|
|
4046
|
+
if (!serviceName)
|
|
4047
|
+
return false;
|
|
4048
|
+
const lower = serviceName.toLowerCase();
|
|
4049
|
+
return lower.includes("all india service") ||
|
|
4050
|
+
lower.includes("indian administrative service") ||
|
|
4051
|
+
lower.includes("(ias)") ||
|
|
4052
|
+
lower.includes("indian police service") ||
|
|
4053
|
+
lower.includes("(ips)") ||
|
|
4054
|
+
lower.includes("indian forest service") ||
|
|
4055
|
+
lower.includes("(ifs)");
|
|
4056
|
+
};
|
|
4057
|
+
let hasAISInAnyGroup = false;
|
|
4058
|
+
if (this.config?.application === NsAccessControlConfig.Application.MDO) {
|
|
4059
|
+
tempAccessControl.userGroups.forEach((group) => {
|
|
4060
|
+
const isContainsService = group.userGroupCriteriaList.find((criteria) => criteria.criteriaKey === NsAccessControlConfig.SelectionType.Service);
|
|
4061
|
+
if (isContainsService?.criteriaKey === NsAccessControlConfig.SelectionType.Service) {
|
|
4062
|
+
const criteriaValues = isContainsService.criteriaValue || [];
|
|
4063
|
+
// Check if any service is an All India Service
|
|
4064
|
+
if (criteriaValues.some((val) => isAllIndiaService(val))) {
|
|
4065
|
+
hasAISInAnyGroup = true;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
});
|
|
4069
|
+
// Enable/disable deputation based on whether ANY group has AIS
|
|
4070
|
+
if (hasAISInAnyGroup) {
|
|
4071
|
+
this.accessControlService.enableDeputation(true);
|
|
4072
|
+
}
|
|
4073
|
+
else {
|
|
4074
|
+
this.accessControlService.enableDeputation(false);
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
tempAccessControl.userGroups.forEach((group, index) => {
|
|
4078
|
+
// Process patching.
|
|
4079
|
+
const conditions = this.fb.array([]);
|
|
4080
|
+
group.userGroupCriteriaList.forEach((criteria) => {
|
|
4081
|
+
if (!this.isCCA && criteria.criteriaKey === NsAccessControlConfig.SelectionType.Organizations) {
|
|
4082
|
+
return; // Skip this iteration to not add the organization condition
|
|
4083
|
+
}
|
|
4084
|
+
const condition = this.createConditionGroup(v4(), this.userGroup.length);
|
|
4085
|
+
// Set the form values
|
|
4086
|
+
condition.patchValue({
|
|
4087
|
+
entity: criteria.criteriaKey,
|
|
4088
|
+
selections: criteria.criteriaKey === NsAccessControlConfig.SelectionType.Batch
|
|
4089
|
+
? Array.isArray(criteria.criteriaValue)
|
|
4090
|
+
? criteria.criteriaValue.map((b) => Number(b))
|
|
4091
|
+
: []
|
|
4092
|
+
: criteria.criteriaKey === NsAccessControlConfig.SelectionType.CentralDeputation
|
|
4093
|
+
? Array.isArray(criteria.criteriaValue)
|
|
4094
|
+
? criteria.criteriaValue
|
|
4095
|
+
: [criteria.criteriaValue]
|
|
4096
|
+
: criteria.criteriaValue,
|
|
4097
|
+
});
|
|
4098
|
+
conditions.push(condition);
|
|
4099
|
+
});
|
|
4100
|
+
const ruleGroup = this.fb.group({
|
|
4101
|
+
id: [group.userGroupId || v4()],
|
|
4102
|
+
name: [group.userGroupName],
|
|
4103
|
+
description: [`Description for ${group.userGroupName}`],
|
|
4104
|
+
conditions: conditions,
|
|
4105
|
+
isUserGroupDisabled: [false],
|
|
4106
|
+
isAddConditionDisabled: [false],
|
|
4107
|
+
});
|
|
4108
|
+
this.userGroup.push(ruleGroup);
|
|
4109
|
+
if ((this.mdoContent?.status === "Live") &&
|
|
4110
|
+
(this.config.userConfig.userRoles.has("mdo_admin") || this.config.userConfig.userRoles.has("mdo_leader"))) {
|
|
4111
|
+
// Get initial state from localStorage
|
|
4112
|
+
const initialUserGroups = this.getInitialState();
|
|
4113
|
+
if (initialUserGroups) {
|
|
4114
|
+
// Only disable user groups that were in the initial state
|
|
4115
|
+
const initialGroupIds = initialUserGroups.map(group => group.userGroupName);
|
|
4116
|
+
for (let i = 0; i < this.userGroup.length; i++) {
|
|
4117
|
+
const group = this.userGroup.at(i);
|
|
4118
|
+
const groupId = group.get("name")?.value;
|
|
4119
|
+
// If this group was in the initial state, disable it
|
|
4120
|
+
if (initialGroupIds.includes(groupId)) {
|
|
4121
|
+
group.get("id")?.disable();
|
|
4122
|
+
group.get("name")?.disable();
|
|
4123
|
+
group.get("description")?.disable();
|
|
4124
|
+
group.get("conditions")?.disable();
|
|
4125
|
+
group.get("isUserGroupDisabled")?.setValue(true);
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
this.isSaveFltrBtnDisabled = true;
|
|
4130
|
+
}
|
|
4131
|
+
// Check if add condition should be disabled for this user group
|
|
4132
|
+
this.processDisableAddConditionOnClose(index);
|
|
4133
|
+
// Calculate count for each user group
|
|
4134
|
+
this.calculateUserCountForUserGroup(index);
|
|
4135
|
+
});
|
|
4136
|
+
setTimeout(() => {
|
|
4137
|
+
this.initialUserGroupValue = JSON.stringify(this.accessControlForm.getRawValue().userGroup);
|
|
4138
|
+
this.setupFormChangeDetection();
|
|
4139
|
+
}, 0);
|
|
4140
|
+
}
|
|
4141
|
+
get canAddUserGroup() {
|
|
4142
|
+
if (this.isLoading) {
|
|
4143
|
+
return false;
|
|
4144
|
+
}
|
|
4145
|
+
if (!this.userGroup?.length) {
|
|
4146
|
+
return true;
|
|
4147
|
+
}
|
|
4148
|
+
if (this.config?.application !== this.MDO_APPLICATION) {
|
|
4149
|
+
return true;
|
|
4150
|
+
}
|
|
4151
|
+
// For MDO applications with Live status
|
|
4152
|
+
if (this.config?.application === this.MDO_APPLICATION && this.config?.mdoContent?.status === "Live") {
|
|
4153
|
+
const initialUserGroups = this.getInitialState();
|
|
4154
|
+
if (!initialUserGroups) {
|
|
4155
|
+
return true;
|
|
4156
|
+
}
|
|
4157
|
+
// Get current non-disabled user groups
|
|
4158
|
+
const activeUserGroups = this.userGroup.controls.filter(group => !group.get('isUserGroupDisabled')?.value);
|
|
4159
|
+
if (activeUserGroups.length === 0) {
|
|
4160
|
+
return true;
|
|
4161
|
+
}
|
|
4162
|
+
return false;
|
|
4163
|
+
}
|
|
4164
|
+
return false;
|
|
4165
|
+
}
|
|
4166
|
+
get isCuratedContentWithExternalId() {
|
|
4167
|
+
return !!(this.content && this.content.externalId);
|
|
4168
|
+
}
|
|
4169
|
+
saveAccessSettings() {
|
|
4170
|
+
const isLiveContent = this.content?.status === "Live" || this.content?.prevStatus === "Live" || this.content?.status === "live";
|
|
4171
|
+
const isMdoLiveContent = this.config?.application === this.MDO_APPLICATION && this.config?.mdoContent?.status === "Live";
|
|
4172
|
+
const isCuratedLiveWithExternalId = this.content?.status === "live" && this.isCuratedContentWithExternalId;
|
|
4173
|
+
if (isLiveContent || isMdoLiveContent || isCuratedLiveWithExternalId) {
|
|
4174
|
+
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
|
4175
|
+
width: "520px",
|
|
4176
|
+
data: { type: "confirm-apply-accesscontrol-for-live" }
|
|
4177
|
+
});
|
|
4178
|
+
dialogRef.afterClosed().subscribe((result) => {
|
|
4179
|
+
if (result?.action === "confirm") {
|
|
4180
|
+
this.applyAccessControlValue(true, true);
|
|
4181
|
+
}
|
|
4182
|
+
});
|
|
4183
|
+
}
|
|
4184
|
+
else {
|
|
4185
|
+
this.applyAccessControlValue(true, true);
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlComponent, deps: [{ token: i1$3.MatDialog }, { token: i2$1.FormBuilder }, { token: AccessControlService }, { token: CadreMappingService }, { token: i1.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4189
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: AccessControlComponent, isStandalone: false, selector: "sb-uic-access-control", inputs: { config: "config", contentId: "contentId", content: "content", tempAccessControl: "tempAccessControl" }, outputs: { accessControlData: "accessControlData", refreshContentMeta: "refreshContentMeta", sendForCQF: "sendForCQF" }, ngImport: i0, template: "<div class=\"py-4 px-10\">\n <div class=\"p-4 as-container\">\n <div class=\"flex items-center justify-between\">\n <span class=\"text-xl font-bold primary-text-color\">{{(config?.application === MDO_APPLICATION || config?.application === CBP_APPLICATION) ? 'Access Control' : 'Access Settings'}}</span>\n <div class=\"flex gap-2 items-center\">\n <span class=\"text-sm primary-text-color cursor-pointer\" (click)=\"openInstructonsDialog()\">How to use access control?</span>\n <img src=\"/assets/icons/support-i.svg\" alt=\"support i\" class=\"img-icon-24 cursor-pointer\" (click)=\"openInstructonsDialog()\"/>\n </div>\n </div>\n <div class=\"light-grey-border p-4 mt-4\">\n <ng-container *ngIf=\"canShowAccessControlTypeRadio\">\n <mat-radio-group [(ngModel)]=\"accessTypeDup\" (change)=\"onAccessTypeChange($event)\">\n <div class=\"radio-container flex gap-5 mb-4\">\n <ng-container *ngFor=\"let item of accessControlCriteriaSelection?.accessTypes\">\n <mat-radio-button [value]=\"item.value\" [disabled]=\"item?.disabled || accessControlCriteriaSelection?.readOnly\">\n <div class=\"flex gap-2 items-center\">\n <span>{{ item?.name }}</span>\n <mat-icon svgIcon=\"info-outline\" [matTooltip]=\"item?.tooltip\"></mat-icon>\n </div>\n </mat-radio-button>\n </ng-container>\n </div>\n </mat-radio-group>\n </ng-container>\n\n <ng-container *ngIf=\"accessType === ACCESS_TYPE_ENUM.Public\">\n <!-- <div class=\"info-container\">\n <label class=\"text-sm\">This event will be visible to all Karmayogis.</label>\n </div> -->\n </ng-container>\n <ng-container *ngIf=\"accessType === ACCESS_TYPE_ENUM.Custom\">\n <ng-container *ngIf=\"shouldShowVisibilityToggle\">\n <div class=\"visibiliy-container light-grey-border p-4 mb-4\">\n <div class=\"flex justify-between items-center\">\n <span class=\"text-lg font-bold\">{{ config?.visiblilityOnOff?.label }}</span>\n <!-- <mat-slide-toggle [(ngModel)]=\"isVisibilityEnabled\" [disabled]=\"config?.visiblilityOnOff?.disabled || false\"></mat-slide-toggle> -->\n <div class=\"checkbox-toggle\">\n <input [(ngModel)]=\"isVisibilityEnabled\" [disabled]=\"config?.visiblilityOnOff?.disabled || false\" type=\"checkbox\" id=\"switch\" />\n <label for=\"switch\" [attr.disabled]=\"config?.visiblilityOnOff?.disabled || false\"></label>\n </div>\n </div>\n <ng-container *ngIf=\"!isVisibilityEnabled\">\n <label class=\"text-sm\">{{ (config?.visiblilityOnOff?.off || \"\").replace(\"{contentType}\", content?.courseCategory || content?.contentType) }}</label>\n </ng-container>\n <ng-container *ngIf=\"isVisibilityEnabled\">\n <label class=\"text-sm\">{{ (config?.visiblilityOnOff?.on || \"\").replace(\"{contentType}\", content?.courseCategory || content?.contentType) }}</label>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"filterCriteria\">\n <div class=\"filter-criteria-container light-grey-border p-4 mt-4 flex flex-middle justify-between mb-4\">\n <div class=\"info\">\n <span class=\"text-sm\">Define the conditions that Karmayogis must satisfy to enroll in the event.</span>\n </div>\n <button mat-button class=\"new-secondary-button-no-border button-with-corners\" type=\"button\">\n <div class=\"flex gap-2 flex-middle\">\n <span class=\"text-m\">Refresh</span>\n <mat-icon class=\"primary-text-color\">refresh</mat-icon>\n </div>\n </button>\n </div>\n </ng-container>\n\n <div class=\"users-total-count flex gap-2 items-center my-3\" *ngIf=\"getTotalUserCount\">\n <mat-icon svgIcon=\"info-outline\" [matTooltip]=\"\"></mat-icon>\n <div class=\"text-dark\">Total Count : {{ getTotalUserCount }}</div>\n </div>\n\n <ng-container *ngIf=\"accessControlForm && userGroup?.length > 0 && !isLoading\">\n <form [formGroup]=\"accessControlForm\">\n <mat-accordion class=\"example-headers-align access-usergroup-accordion mt-3\" multi=\"true\">\n <ng-container formArrayName=\"userGroup\" *ngFor=\"let rule of userGroup?.controls; let i = index; let ruleLast = last\">\n <ng-container [formGroupName]=\"i\">\n <mat-expansion-panel class=\"access-usergroup-panel\" expanded>\n <mat-expansion-panel-header>\n <mat-panel-title class=\"items-center\">\n <div class=\"flex gap-4 items-center\">\n <span class=\"text-sm\">{{ rule.get(\"name\")?.value }}</span>\n <ng-container *ngIf=\"userCount[i]\">\n <div class=\"text-dark user-group-user-count\">Count : {{ userCount[i] }}</div>\n </ng-container>\n </div>\n </mat-panel-title>\n <mat-panel-description class=\"justify-end items-center\" (click)=\"$event.stopPropagation()\">\n <ng-container *ngIf=\"content?.accessSetting !== MDO_SPECIFIC && (config?.application !== MDO_APPLICATION || (config?.application === MDO_APPLICATION && config?.mdoContent?.status === 'Live' && userGroup?.length > 1))\">\n <button\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n mat-icon-button\n aria-label=\"delete user group\"\n (click)=\"removeUserGroup(i)\"\n title=\"Delete\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n <button\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n mat-icon-button\n aria-label=\"refresh user group\"\n (click)=\"resetUserGroupWithSelections(i)\"\n title=\"Refresh\"\n >\n <img src=\"/assets/icons/restart.svg\" alt=\"refresh\" class=\"img-icon-24\" />\n </button>\n </ng-container>\n </mat-panel-description>\n </mat-expansion-panel-header>\n <ng-container *ngIf=\"rule.get('conditions') as conditionsArray\">\n <div [formArrayName]=\"'conditions'\">\n <ng-container *ngFor=\"let condition of conditionsArray?.controls; let j = index; let conditionlast = last\">\n <div class=\"condition-selection mt-2\" [formGroupName]=\"j\">\n <div class=\"select-condition-text mb-3 mt-4\">Select Condition {{ i + 1 + \".\" + (j + 1) }}</div>\n <div class=\"selections-options grid grid-cols-5 gap-4\">\n <div class=\"mat-full-radius\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-select placeholder=\"Select\" formControlName=\"entity\" (selectionChange)=\"onEntityChange(i, j)\" (openedChange)=\"onOpeningEntityChange($event, i, j)\">\n <ng-container *ngFor=\"let item of getAvailableEntities(i, j)\">\n <mat-option [value]=\"item?.value\" [disabled]=\"item?.disabled\">{{ item?.label }}</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"mat-full-radius\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-select placeholder=\"Select\" formControlName=\"conditionType\">\n <ng-container *ngFor=\"let item of accessControlCriteriaSelection?.optionsConditions\">\n <mat-option [value]=\"item?.value\">{{ item?.label }}</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"action-manage-selection\">\n <button\n mat-flat-button\n (click)=\"manageSelections(condition, rule, i)\"\n [disabled]=\"!condition.get('entity').value || !condition.get('conditionType').value || accessControlCriteriaSelection?.readOnly\"\n class=\"rounded-full new-bg-color text-white mt-2 flex items-center gap-2\"\n >\n <mat-icon svgIcon=\"svg_search\" class=\"mr-2\"></mat-icon>\n <span class=\"font-bold text-sm\">Manage Selection</span>\n </button>\n </div>\n <div class=\"action-options-selected\">\n <button [disabled]=\"!condition.get('entity').value\" mat-button class=\"new-secondary-button-no-border button-with-corners mt-2\" type=\"button\" (click)=\"manageSelections(condition, rule, i, 1)\">\n <div class=\"flex gap-2 flex-middle mt-2\">\n <span class=\"text-m underline\">{{ condition?.get(\"selections\").value?.length }} items selected</span>\n </div>\n </button>\n </div>\n <div class=\"action-more-options flex justify-end\">\n <div class=\"flex gap-4\">\n <ng-container *ngIf=\"content?.accessSetting !== MDO_SPECIFIC\">\n <button\n mat-icon-button\n aria-label=\"delete condition\"\n class=\"mt-2 ml-auto\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n (click)=\"removeCondition(i, j)\"\n title=\"Delete\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n <button\n mat-icon-button\n aria-label=\"refresh condition\"\n class=\"mt-2 ml-auto\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n (click)=\"resetCondition(i, j)\"\n title=\"Refresh\"\n >\n <img src=\"/assets/icons/restart.svg\" alt=\"refresh\" class=\"img-icon-24\" />\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n <div class=\"and-or mat-full-radius\" *ngIf=\"conditionsArray?.length > 1 && !conditionlast\">\n <mat-form-field appearance=\"outline\" class=\"w-max-100\">\n <mat-select placeholder=\"Select\" [(value)]=\"defaultConditionRelationship\">\n <mat-option [value]=\"'AND'\">AND</mat-option>\n <!-- <mat-option [value]=\"'OR'\" [disabled]=\"true\">OR</mat-option> -->\n </mat-select>\n </mat-form-field>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div class=\"action-add-condition\">\n <button\n [disabled]=\"\n content?.accessSetting === ACCESS_SETTING_ENUM.MDO_SPECIFIC ||\n content?.accessSetting === ACCESS_SETTING_ENUM.CUSTOME_USER ||\n accessControlCriteriaSelection?.readOnly ||\n rule.get('isUserGroupDisabled')?.value ||\n rule.get('isAddConditionDisabled')?.value\n \"\n mat-button\n class=\"new-secondary-button-no-border button-with-corners\"\n type=\"button\"\n (click)=\"addCondition(i)\"\n >\n <div class=\"flex gap-2 flex-middle\">\n <mat-icon class=\"primary-text-color\">add</mat-icon>\n <span class=\"text-m\">Add New Condition</span>\n </div>\n </button>\n </div>\n </mat-expansion-panel>\n <div class=\"and-or mat-full-radius\" *ngIf=\"userGroup?.length > 1 && !ruleLast\">\n <mat-form-field appearance=\"outline\" class=\"w-max-100\">\n <mat-select placeholder=\"Select\" [(value)]=\"defaultUserGroupRelationship\">\n <mat-option [value]=\"'AND'\" [disabled]=\"true\">AND</mat-option>\n <mat-option [value]=\"'OR'\">OR</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n </ng-container>\n </ng-container>\n </mat-accordion>\n </form>\n </ng-container>\n\n <ng-container *ngIf=\"isLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <ng-container *ngIf=\"canAddUserGroup\">\n <div class=\"text-center mb-6 mt-4\">\n <button\n [disabled]=\"accessControlCriteriaSelection?.readOnly || isAddUserGroupBtnDisabled\"\n mat-button\n class=\"new-secondary-button-no-border button-with-corners\"\n type=\"button\"\n (click)=\"addUserGroup()\"\n >\n <div class=\"flex gap-2 flex-middle\">\n <mat-icon class=\"primary-text-color\">add</mat-icon>\n <span class=\"text-m\">Add User Group</span>\n </div>\n </button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"userGroup?.length > 0 && config?.application !== MDO_APPLICATION\">\n <div class=\"action-save flex justify-center items-center gap-4\" [ngClass]=\"{ 'mt-4': userGroup?.length === 1 && config?.application === MDO_APPLICATION }\">\n <!-- Save Filter Button -->\n <button\n mat-flat-button\n class=\"flex rounded-full px-4 py-2 mat-btn-outline font-bold text-sm items-center gap-2\"\n [disabled]=\"isSaveFltrBtnDisabled || isSaving || hasUserGroupBeenAdded\"\n (click)=\"saveAccessSettings()\"\n >\n <mat-spinner *ngIf=\"isSaving\" diameter=\"18\" strokeWidth=\"3\" class=\"!inline !m-0 mr-2\"></mat-spinner>\n <span>Save Filter</span>\n </button>\n\n <!-- Apply Button -->\n <!-- <button\n mat-flat-button\n [disabled]=\"isApplyBtnDisabled || isApplying || hasUserGroupBeenAdded\"\n class=\"flex items-center rounded-full px-4 py-2 new-bg-color font-bold text-sm text-white gap-2\"\n (click)=\"applyAccessControlValue()\">\n <mat-spinner *ngIf=\"isApplying\" diameter=\"18\" strokeWidth=\"3\" class=\"!inline !m-0 mr-2\"></mat-spinner>\n <span>Apply</span>\n </button> -->\n </div>\n </ng-container>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: [".as-container{border:1px solid #1b4ca1;border-radius:10px}.filter-criteria-container{background:#fff8ef}.access-rules-panel{background:#e8edf6!important;border-radius:4px;margin-bottom:10px;box-shadow:none!important}::ng-deep .mat-expansion-panel-body{background:#fff!important;padding:0 24px 16px!important}.more-menu-icon{font-size:16px;height:16px;width:16px}.selections-options .mat-full-radius ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline{border-radius:12px!important;border:1px solid rgba(0,0,0,.1607843137)}.selections-options .mat-full-radius ::ng-deep .mat-form-field-appearance-outline .mat-form-field-flex{width:100%}.selections-options .mat-full-radius ::ng-deep .mat-form-field .mat-form-field-outline-end{border-radius:0 12px 12px 0!important}.selections-options .mat-full-radius ::ng-deep .mat-form-field .mat-form-field-outline-start{border-radius:12px 0 0 12px!important;flex-grow:1}.selections-options .mat-full-radius ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.selections-options .mat-full-radius ::ng-deep .mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#ebebeb}.mt-2{margin-top:.5rem!important}.action-manage-selection mat-icon{font-size:0px;height:19px;width:19px;color:#fff!important}.action-manage-selection button{padding:4px 16px}.action-manage-selection button:disabled{opacity:1!important;background:#ebebeb!important;color:#666!important}.action-manage-selection button:disabled mat-icon{color:#666!important}.color-gr{background:#1b4ca1}.and-or ::ng-deep .mat-form-field .mat-form-field-outline-end{border:none!important}.and-or ::ng-deep .mat-form-field .mat-form-field-outline-start{border:none!important}.and-or ::ng-deep .mat-select-value{color:#1b4ca1!important;font-family:Montserrat;font-weight:600;font-size:16px}.and-or ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.w-max-100{max-width:100px}.access-usergroup-panel .mat-expansion-panel-header-title{padding-left:1rem}.access-usergroup-panel .mat-expansion-panel-header.mat-expanded{height:50px!important}.access-usergroup-panel .mat-expansion-panel-header{background:#e8edf6;padding:0 16px 0 0!important}.access-usergroup-panel .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none!important;border:1px solid rgba(0,0,0,.0784313725)}.mr-1{margin-right:.25rem!important}:host ::ng-deep .mdc-dialog .mdc-dialog__content{padding:0 24px 24px!important}.select-condition-text{font-family:Lato;font-weight:400;font-size:12px;color:#666}::ng-deep .mat-select-panel{max-height:360px!important}.radio-container mat-icon{width:16px;height:16px;font-size:0px}.img-icon-24{width:24px;height:24px}::ng-deep .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{font-family:Montserrat;font-weight:600;font-size:16px;color:#1b4ca1!important}::ng-deep .mat-mdc-tab .mdc-tab__text-label{color:#241c15a6!important;font-family:Lato;font-weight:400;font-size:16px}::ng-deep .mat-mdc-tab .mdc-tab-indicator__content--underline{border-color:#1b4ca1!important;border-top-width:3px!important}.checkbox-toggle input[type=checkbox]{height:0;width:0;visibility:hidden}.checkbox-toggle label{cursor:pointer;width:60px;height:28px;background:#666;display:block;border-radius:100px;position:relative}.checkbox-toggle label:before{content:\"OFF\";color:#fff;position:absolute;left:28px;top:2px;z-index:1;transition:.3s;font-family:Montserrat;font-weight:600;font-size:11.57px}.checkbox-toggle label:after{content:\"\";position:absolute;top:4px;left:5px;width:20px;height:20px;background:#fff;border-radius:90px;transition:.3s;z-index:2}.checkbox-toggle input:checked+label{background:#1d8923}.checkbox-toggle input:checked+label:before{content:\"ON\";left:10px;font-family:Montserrat;font-weight:600;font-size:11.57px;transition:.3s}.checkbox-toggle input:checked+label:after{left:calc(100% - 5px);transform:translate(-100%)}.checkbox-toggle label:active:after{width:30px}.checkbox-toggle label[disabled]{cursor:not-allowed}.users-total-count,.user-group-user-count{padding:6px;background-color:#fff;border-radius:4px;border:1px solid rgba(0,0,0,.0784313725);width:165px}.users-total-count mat-icon,.user-group-user-count mat-icon{width:16px;height:16px;font-size:0px}.users-total-count div:first-child,.user-group-user-count div:first-child,.user-group-user-count{font-family:Lato;font-weight:400;font-size:12px}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i5.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i10.MatAccordion, selector: "mat-accordion", inputs: ["hideToggle", "displayMode", "togglePosition"], exportAs: ["matAccordion"] }, { kind: "component", type: i10.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i10.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i10.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i10.MatExpansionPanelDescription, selector: "mat-panel-description" }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i11.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i11.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i12.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i13.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
|
|
4190
|
+
}
|
|
4191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlComponent, decorators: [{
|
|
4192
|
+
type: Component,
|
|
4193
|
+
args: [{ selector: "sb-uic-access-control", standalone: false, template: "<div class=\"py-4 px-10\">\n <div class=\"p-4 as-container\">\n <div class=\"flex items-center justify-between\">\n <span class=\"text-xl font-bold primary-text-color\">{{(config?.application === MDO_APPLICATION || config?.application === CBP_APPLICATION) ? 'Access Control' : 'Access Settings'}}</span>\n <div class=\"flex gap-2 items-center\">\n <span class=\"text-sm primary-text-color cursor-pointer\" (click)=\"openInstructonsDialog()\">How to use access control?</span>\n <img src=\"/assets/icons/support-i.svg\" alt=\"support i\" class=\"img-icon-24 cursor-pointer\" (click)=\"openInstructonsDialog()\"/>\n </div>\n </div>\n <div class=\"light-grey-border p-4 mt-4\">\n <ng-container *ngIf=\"canShowAccessControlTypeRadio\">\n <mat-radio-group [(ngModel)]=\"accessTypeDup\" (change)=\"onAccessTypeChange($event)\">\n <div class=\"radio-container flex gap-5 mb-4\">\n <ng-container *ngFor=\"let item of accessControlCriteriaSelection?.accessTypes\">\n <mat-radio-button [value]=\"item.value\" [disabled]=\"item?.disabled || accessControlCriteriaSelection?.readOnly\">\n <div class=\"flex gap-2 items-center\">\n <span>{{ item?.name }}</span>\n <mat-icon svgIcon=\"info-outline\" [matTooltip]=\"item?.tooltip\"></mat-icon>\n </div>\n </mat-radio-button>\n </ng-container>\n </div>\n </mat-radio-group>\n </ng-container>\n\n <ng-container *ngIf=\"accessType === ACCESS_TYPE_ENUM.Public\">\n <!-- <div class=\"info-container\">\n <label class=\"text-sm\">This event will be visible to all Karmayogis.</label>\n </div> -->\n </ng-container>\n <ng-container *ngIf=\"accessType === ACCESS_TYPE_ENUM.Custom\">\n <ng-container *ngIf=\"shouldShowVisibilityToggle\">\n <div class=\"visibiliy-container light-grey-border p-4 mb-4\">\n <div class=\"flex justify-between items-center\">\n <span class=\"text-lg font-bold\">{{ config?.visiblilityOnOff?.label }}</span>\n <!-- <mat-slide-toggle [(ngModel)]=\"isVisibilityEnabled\" [disabled]=\"config?.visiblilityOnOff?.disabled || false\"></mat-slide-toggle> -->\n <div class=\"checkbox-toggle\">\n <input [(ngModel)]=\"isVisibilityEnabled\" [disabled]=\"config?.visiblilityOnOff?.disabled || false\" type=\"checkbox\" id=\"switch\" />\n <label for=\"switch\" [attr.disabled]=\"config?.visiblilityOnOff?.disabled || false\"></label>\n </div>\n </div>\n <ng-container *ngIf=\"!isVisibilityEnabled\">\n <label class=\"text-sm\">{{ (config?.visiblilityOnOff?.off || \"\").replace(\"{contentType}\", content?.courseCategory || content?.contentType) }}</label>\n </ng-container>\n <ng-container *ngIf=\"isVisibilityEnabled\">\n <label class=\"text-sm\">{{ (config?.visiblilityOnOff?.on || \"\").replace(\"{contentType}\", content?.courseCategory || content?.contentType) }}</label>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"filterCriteria\">\n <div class=\"filter-criteria-container light-grey-border p-4 mt-4 flex flex-middle justify-between mb-4\">\n <div class=\"info\">\n <span class=\"text-sm\">Define the conditions that Karmayogis must satisfy to enroll in the event.</span>\n </div>\n <button mat-button class=\"new-secondary-button-no-border button-with-corners\" type=\"button\">\n <div class=\"flex gap-2 flex-middle\">\n <span class=\"text-m\">Refresh</span>\n <mat-icon class=\"primary-text-color\">refresh</mat-icon>\n </div>\n </button>\n </div>\n </ng-container>\n\n <div class=\"users-total-count flex gap-2 items-center my-3\" *ngIf=\"getTotalUserCount\">\n <mat-icon svgIcon=\"info-outline\" [matTooltip]=\"\"></mat-icon>\n <div class=\"text-dark\">Total Count : {{ getTotalUserCount }}</div>\n </div>\n\n <ng-container *ngIf=\"accessControlForm && userGroup?.length > 0 && !isLoading\">\n <form [formGroup]=\"accessControlForm\">\n <mat-accordion class=\"example-headers-align access-usergroup-accordion mt-3\" multi=\"true\">\n <ng-container formArrayName=\"userGroup\" *ngFor=\"let rule of userGroup?.controls; let i = index; let ruleLast = last\">\n <ng-container [formGroupName]=\"i\">\n <mat-expansion-panel class=\"access-usergroup-panel\" expanded>\n <mat-expansion-panel-header>\n <mat-panel-title class=\"items-center\">\n <div class=\"flex gap-4 items-center\">\n <span class=\"text-sm\">{{ rule.get(\"name\")?.value }}</span>\n <ng-container *ngIf=\"userCount[i]\">\n <div class=\"text-dark user-group-user-count\">Count : {{ userCount[i] }}</div>\n </ng-container>\n </div>\n </mat-panel-title>\n <mat-panel-description class=\"justify-end items-center\" (click)=\"$event.stopPropagation()\">\n <ng-container *ngIf=\"content?.accessSetting !== MDO_SPECIFIC && (config?.application !== MDO_APPLICATION || (config?.application === MDO_APPLICATION && config?.mdoContent?.status === 'Live' && userGroup?.length > 1))\">\n <button\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n mat-icon-button\n aria-label=\"delete user group\"\n (click)=\"removeUserGroup(i)\"\n title=\"Delete\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n <button\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n mat-icon-button\n aria-label=\"refresh user group\"\n (click)=\"resetUserGroupWithSelections(i)\"\n title=\"Refresh\"\n >\n <img src=\"/assets/icons/restart.svg\" alt=\"refresh\" class=\"img-icon-24\" />\n </button>\n </ng-container>\n </mat-panel-description>\n </mat-expansion-panel-header>\n <ng-container *ngIf=\"rule.get('conditions') as conditionsArray\">\n <div [formArrayName]=\"'conditions'\">\n <ng-container *ngFor=\"let condition of conditionsArray?.controls; let j = index; let conditionlast = last\">\n <div class=\"condition-selection mt-2\" [formGroupName]=\"j\">\n <div class=\"select-condition-text mb-3 mt-4\">Select Condition {{ i + 1 + \".\" + (j + 1) }}</div>\n <div class=\"selections-options grid grid-cols-5 gap-4\">\n <div class=\"mat-full-radius\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-select placeholder=\"Select\" formControlName=\"entity\" (selectionChange)=\"onEntityChange(i, j)\" (openedChange)=\"onOpeningEntityChange($event, i, j)\">\n <ng-container *ngFor=\"let item of getAvailableEntities(i, j)\">\n <mat-option [value]=\"item?.value\" [disabled]=\"item?.disabled\">{{ item?.label }}</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"mat-full-radius\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-select placeholder=\"Select\" formControlName=\"conditionType\">\n <ng-container *ngFor=\"let item of accessControlCriteriaSelection?.optionsConditions\">\n <mat-option [value]=\"item?.value\">{{ item?.label }}</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"action-manage-selection\">\n <button\n mat-flat-button\n (click)=\"manageSelections(condition, rule, i)\"\n [disabled]=\"!condition.get('entity').value || !condition.get('conditionType').value || accessControlCriteriaSelection?.readOnly\"\n class=\"rounded-full new-bg-color text-white mt-2 flex items-center gap-2\"\n >\n <mat-icon svgIcon=\"svg_search\" class=\"mr-2\"></mat-icon>\n <span class=\"font-bold text-sm\">Manage Selection</span>\n </button>\n </div>\n <div class=\"action-options-selected\">\n <button [disabled]=\"!condition.get('entity').value\" mat-button class=\"new-secondary-button-no-border button-with-corners mt-2\" type=\"button\" (click)=\"manageSelections(condition, rule, i, 1)\">\n <div class=\"flex gap-2 flex-middle mt-2\">\n <span class=\"text-m underline\">{{ condition?.get(\"selections\").value?.length }} items selected</span>\n </div>\n </button>\n </div>\n <div class=\"action-more-options flex justify-end\">\n <div class=\"flex gap-4\">\n <ng-container *ngIf=\"content?.accessSetting !== MDO_SPECIFIC\">\n <button\n mat-icon-button\n aria-label=\"delete condition\"\n class=\"mt-2 ml-auto\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n (click)=\"removeCondition(i, j)\"\n title=\"Delete\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n <button\n mat-icon-button\n aria-label=\"refresh condition\"\n class=\"mt-2 ml-auto\"\n [disabled]=\"accessControlCriteriaSelection?.readOnly || rule.get('isUserGroupDisabled')?.value\"\n (click)=\"resetCondition(i, j)\"\n title=\"Refresh\"\n >\n <img src=\"/assets/icons/restart.svg\" alt=\"refresh\" class=\"img-icon-24\" />\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n <div class=\"and-or mat-full-radius\" *ngIf=\"conditionsArray?.length > 1 && !conditionlast\">\n <mat-form-field appearance=\"outline\" class=\"w-max-100\">\n <mat-select placeholder=\"Select\" [(value)]=\"defaultConditionRelationship\">\n <mat-option [value]=\"'AND'\">AND</mat-option>\n <!-- <mat-option [value]=\"'OR'\" [disabled]=\"true\">OR</mat-option> -->\n </mat-select>\n </mat-form-field>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div class=\"action-add-condition\">\n <button\n [disabled]=\"\n content?.accessSetting === ACCESS_SETTING_ENUM.MDO_SPECIFIC ||\n content?.accessSetting === ACCESS_SETTING_ENUM.CUSTOME_USER ||\n accessControlCriteriaSelection?.readOnly ||\n rule.get('isUserGroupDisabled')?.value ||\n rule.get('isAddConditionDisabled')?.value\n \"\n mat-button\n class=\"new-secondary-button-no-border button-with-corners\"\n type=\"button\"\n (click)=\"addCondition(i)\"\n >\n <div class=\"flex gap-2 flex-middle\">\n <mat-icon class=\"primary-text-color\">add</mat-icon>\n <span class=\"text-m\">Add New Condition</span>\n </div>\n </button>\n </div>\n </mat-expansion-panel>\n <div class=\"and-or mat-full-radius\" *ngIf=\"userGroup?.length > 1 && !ruleLast\">\n <mat-form-field appearance=\"outline\" class=\"w-max-100\">\n <mat-select placeholder=\"Select\" [(value)]=\"defaultUserGroupRelationship\">\n <mat-option [value]=\"'AND'\" [disabled]=\"true\">AND</mat-option>\n <mat-option [value]=\"'OR'\">OR</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n </ng-container>\n </ng-container>\n </mat-accordion>\n </form>\n </ng-container>\n\n <ng-container *ngIf=\"isLoading\">\n <div class=\"spinner-loader flex items-center justify-center\">\n <mat-spinner></mat-spinner>\n </div>\n </ng-container>\n <ng-container *ngIf=\"canAddUserGroup\">\n <div class=\"text-center mb-6 mt-4\">\n <button\n [disabled]=\"accessControlCriteriaSelection?.readOnly || isAddUserGroupBtnDisabled\"\n mat-button\n class=\"new-secondary-button-no-border button-with-corners\"\n type=\"button\"\n (click)=\"addUserGroup()\"\n >\n <div class=\"flex gap-2 flex-middle\">\n <mat-icon class=\"primary-text-color\">add</mat-icon>\n <span class=\"text-m\">Add User Group</span>\n </div>\n </button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"userGroup?.length > 0 && config?.application !== MDO_APPLICATION\">\n <div class=\"action-save flex justify-center items-center gap-4\" [ngClass]=\"{ 'mt-4': userGroup?.length === 1 && config?.application === MDO_APPLICATION }\">\n <!-- Save Filter Button -->\n <button\n mat-flat-button\n class=\"flex rounded-full px-4 py-2 mat-btn-outline font-bold text-sm items-center gap-2\"\n [disabled]=\"isSaveFltrBtnDisabled || isSaving || hasUserGroupBeenAdded\"\n (click)=\"saveAccessSettings()\"\n >\n <mat-spinner *ngIf=\"isSaving\" diameter=\"18\" strokeWidth=\"3\" class=\"!inline !m-0 mr-2\"></mat-spinner>\n <span>Save Filter</span>\n </button>\n\n <!-- Apply Button -->\n <!-- <button\n mat-flat-button\n [disabled]=\"isApplyBtnDisabled || isApplying || hasUserGroupBeenAdded\"\n class=\"flex items-center rounded-full px-4 py-2 new-bg-color font-bold text-sm text-white gap-2\"\n (click)=\"applyAccessControlValue()\">\n <mat-spinner *ngIf=\"isApplying\" diameter=\"18\" strokeWidth=\"3\" class=\"!inline !m-0 mr-2\"></mat-spinner>\n <span>Apply</span>\n </button> -->\n </div>\n </ng-container>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: [".as-container{border:1px solid #1b4ca1;border-radius:10px}.filter-criteria-container{background:#fff8ef}.access-rules-panel{background:#e8edf6!important;border-radius:4px;margin-bottom:10px;box-shadow:none!important}::ng-deep .mat-expansion-panel-body{background:#fff!important;padding:0 24px 16px!important}.more-menu-icon{font-size:16px;height:16px;width:16px}.selections-options .mat-full-radius ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline{border-radius:12px!important;border:1px solid rgba(0,0,0,.1607843137)}.selections-options .mat-full-radius ::ng-deep .mat-form-field-appearance-outline .mat-form-field-flex{width:100%}.selections-options .mat-full-radius ::ng-deep .mat-form-field .mat-form-field-outline-end{border-radius:0 12px 12px 0!important}.selections-options .mat-full-radius ::ng-deep .mat-form-field .mat-form-field-outline-start{border-radius:12px 0 0 12px!important;flex-grow:1}.selections-options .mat-full-radius ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.selections-options .mat-full-radius ::ng-deep .mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#ebebeb}.mt-2{margin-top:.5rem!important}.action-manage-selection mat-icon{font-size:0px;height:19px;width:19px;color:#fff!important}.action-manage-selection button{padding:4px 16px}.action-manage-selection button:disabled{opacity:1!important;background:#ebebeb!important;color:#666!important}.action-manage-selection button:disabled mat-icon{color:#666!important}.color-gr{background:#1b4ca1}.and-or ::ng-deep .mat-form-field .mat-form-field-outline-end{border:none!important}.and-or ::ng-deep .mat-form-field .mat-form-field-outline-start{border:none!important}.and-or ::ng-deep .mat-select-value{color:#1b4ca1!important;font-family:Montserrat;font-weight:600;font-size:16px}.and-or ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important}.w-max-100{max-width:100px}.access-usergroup-panel .mat-expansion-panel-header-title{padding-left:1rem}.access-usergroup-panel .mat-expansion-panel-header.mat-expanded{height:50px!important}.access-usergroup-panel .mat-expansion-panel-header{background:#e8edf6;padding:0 16px 0 0!important}.access-usergroup-panel .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none!important;border:1px solid rgba(0,0,0,.0784313725)}.mr-1{margin-right:.25rem!important}:host ::ng-deep .mdc-dialog .mdc-dialog__content{padding:0 24px 24px!important}.select-condition-text{font-family:Lato;font-weight:400;font-size:12px;color:#666}::ng-deep .mat-select-panel{max-height:360px!important}.radio-container mat-icon{width:16px;height:16px;font-size:0px}.img-icon-24{width:24px;height:24px}::ng-deep .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{font-family:Montserrat;font-weight:600;font-size:16px;color:#1b4ca1!important}::ng-deep .mat-mdc-tab .mdc-tab__text-label{color:#241c15a6!important;font-family:Lato;font-weight:400;font-size:16px}::ng-deep .mat-mdc-tab .mdc-tab-indicator__content--underline{border-color:#1b4ca1!important;border-top-width:3px!important}.checkbox-toggle input[type=checkbox]{height:0;width:0;visibility:hidden}.checkbox-toggle label{cursor:pointer;width:60px;height:28px;background:#666;display:block;border-radius:100px;position:relative}.checkbox-toggle label:before{content:\"OFF\";color:#fff;position:absolute;left:28px;top:2px;z-index:1;transition:.3s;font-family:Montserrat;font-weight:600;font-size:11.57px}.checkbox-toggle label:after{content:\"\";position:absolute;top:4px;left:5px;width:20px;height:20px;background:#fff;border-radius:90px;transition:.3s;z-index:2}.checkbox-toggle input:checked+label{background:#1d8923}.checkbox-toggle input:checked+label:before{content:\"ON\";left:10px;font-family:Montserrat;font-weight:600;font-size:11.57px;transition:.3s}.checkbox-toggle input:checked+label:after{left:calc(100% - 5px);transform:translate(-100%)}.checkbox-toggle label:active:after{width:30px}.checkbox-toggle label[disabled]{cursor:not-allowed}.users-total-count,.user-group-user-count{padding:6px;background-color:#fff;border-radius:4px;border:1px solid rgba(0,0,0,.0784313725);width:165px}.users-total-count mat-icon,.user-group-user-count mat-icon{width:16px;height:16px;font-size:0px}.users-total-count div:first-child,.user-group-user-count div:first-child,.user-group-user-count{font-family:Lato;font-weight:400;font-size:12px}\n"] }]
|
|
4194
|
+
}], ctorParameters: () => [{ type: i1$3.MatDialog }, { type: i2$1.FormBuilder }, { type: AccessControlService }, { type: CadreMappingService }, { type: i1.MatSnackBar }], propDecorators: { config: [{
|
|
4195
|
+
type: Input
|
|
4196
|
+
}], contentId: [{
|
|
4197
|
+
type: Input
|
|
4198
|
+
}], content: [{
|
|
4199
|
+
type: Input
|
|
4200
|
+
}], tempAccessControl: [{
|
|
4201
|
+
type: Input
|
|
4202
|
+
}], accessControlData: [{
|
|
4203
|
+
type: Output
|
|
4204
|
+
}], refreshContentMeta: [{
|
|
4205
|
+
type: Output
|
|
4206
|
+
}], sendForCQF: [{
|
|
4207
|
+
type: Output
|
|
4208
|
+
}] } });
|
|
4209
|
+
|
|
4210
|
+
class AccessControlModule {
|
|
4211
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
4212
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: AccessControlModule, declarations: [AccessControlComponent,
|
|
4213
|
+
InviteUsersComponent,
|
|
4214
|
+
ListTableComponent,
|
|
4215
|
+
PaginationComponent,
|
|
4216
|
+
BulkUploadKarmayogiComponent,
|
|
4217
|
+
DragDropDirective,
|
|
4218
|
+
EntitySelectionsComponent,
|
|
4219
|
+
ConfirmDialogComponent,
|
|
4220
|
+
AccessControlGuideComponent], imports: [CommonModule,
|
|
4221
|
+
MatRadioModule,
|
|
4222
|
+
MatIconModule,
|
|
4223
|
+
MatDialogModule,
|
|
4224
|
+
MatMenuModule,
|
|
4225
|
+
MatCheckboxModule,
|
|
4226
|
+
MatSlideToggleModule,
|
|
4227
|
+
MatSelectModule,
|
|
4228
|
+
MatRippleModule,
|
|
4229
|
+
MatInputModule,
|
|
4230
|
+
MatFormFieldModule,
|
|
4231
|
+
MatExpansionModule,
|
|
4232
|
+
ReactiveFormsModule,
|
|
4233
|
+
FormsModule,
|
|
4234
|
+
MatButtonModule,
|
|
4235
|
+
MatTabsModule,
|
|
4236
|
+
MatTableModule,
|
|
4237
|
+
MatProgressSpinnerModule,
|
|
4238
|
+
MatSnackBarModule,
|
|
4239
|
+
MatSortModule,
|
|
4240
|
+
MatTooltipModule], exports: [AccessControlComponent, PaginationComponent] }); }
|
|
4241
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlModule, imports: [CommonModule,
|
|
4242
|
+
MatRadioModule,
|
|
4243
|
+
MatIconModule,
|
|
4244
|
+
MatDialogModule,
|
|
4245
|
+
MatMenuModule,
|
|
4246
|
+
MatCheckboxModule,
|
|
4247
|
+
MatSlideToggleModule,
|
|
4248
|
+
MatSelectModule,
|
|
4249
|
+
MatRippleModule,
|
|
4250
|
+
MatInputModule,
|
|
4251
|
+
MatFormFieldModule,
|
|
4252
|
+
MatExpansionModule,
|
|
4253
|
+
ReactiveFormsModule,
|
|
4254
|
+
FormsModule,
|
|
4255
|
+
MatButtonModule,
|
|
4256
|
+
MatTabsModule,
|
|
4257
|
+
MatTableModule,
|
|
4258
|
+
MatProgressSpinnerModule,
|
|
4259
|
+
MatSnackBarModule,
|
|
4260
|
+
MatSortModule,
|
|
4261
|
+
MatTooltipModule] }); }
|
|
4262
|
+
}
|
|
4263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AccessControlModule, decorators: [{
|
|
4264
|
+
type: NgModule,
|
|
4265
|
+
args: [{
|
|
4266
|
+
declarations: [
|
|
4267
|
+
AccessControlComponent,
|
|
4268
|
+
InviteUsersComponent,
|
|
4269
|
+
ListTableComponent,
|
|
4270
|
+
PaginationComponent,
|
|
4271
|
+
BulkUploadKarmayogiComponent,
|
|
4272
|
+
DragDropDirective,
|
|
4273
|
+
EntitySelectionsComponent,
|
|
4274
|
+
ConfirmDialogComponent,
|
|
4275
|
+
AccessControlGuideComponent
|
|
4276
|
+
],
|
|
4277
|
+
imports: [
|
|
4278
|
+
CommonModule,
|
|
4279
|
+
MatRadioModule,
|
|
4280
|
+
MatIconModule,
|
|
4281
|
+
MatDialogModule,
|
|
4282
|
+
MatMenuModule,
|
|
4283
|
+
MatCheckboxModule,
|
|
4284
|
+
MatSlideToggleModule,
|
|
4285
|
+
MatSelectModule,
|
|
4286
|
+
MatRippleModule,
|
|
4287
|
+
MatInputModule,
|
|
4288
|
+
MatFormFieldModule,
|
|
4289
|
+
MatExpansionModule,
|
|
4290
|
+
ReactiveFormsModule,
|
|
4291
|
+
FormsModule,
|
|
4292
|
+
MatButtonModule,
|
|
4293
|
+
MatTabsModule,
|
|
4294
|
+
MatTableModule,
|
|
4295
|
+
MatProgressSpinnerModule,
|
|
4296
|
+
MatSnackBarModule,
|
|
4297
|
+
MatSortModule,
|
|
4298
|
+
MatTooltipModule
|
|
4299
|
+
],
|
|
4300
|
+
exports: [AccessControlComponent, PaginationComponent]
|
|
4301
|
+
}]
|
|
4302
|
+
}] });
|
|
4303
|
+
|
|
4304
|
+
/*
|
|
4305
|
+
* Public API Surface of access-settings
|
|
4306
|
+
*/
|
|
4307
|
+
|
|
4308
|
+
/**
|
|
4309
|
+
* Generated bundle index. Do not edit.
|
|
4310
|
+
*/
|
|
4311
|
+
|
|
4312
|
+
export { AccessControlComponent, AccessControlModule, AccessSettingsComponent, AccessSettingsModule, NsAccessControlConfig, PaginationComponent };
|
|
4313
|
+
//# sourceMappingURL=sunbird-cb-access-settings.mjs.map
|