@sunbird-cb/cbp-ai 0.1.88 → 0.1.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/delete-role-mapping/delete-role-mapping.component.mjs +1 -4
- package/esm2022/lib/components/role-mapping-generation/role-mapping-generation.component.mjs +41 -37
- package/esm2022/lib/components/role-mapping-list/role-mapping-list.component.mjs +17 -51
- package/fesm2022/sunbird-cb-cbp-ai.mjs +56 -89
- package/fesm2022/sunbird-cb-cbp-ai.mjs.map +1 -1
- package/lib/components/delete-role-mapping/delete-role-mapping.component.d.ts.map +1 -1
- package/lib/components/role-mapping-generation/role-mapping-generation.component.d.ts +2 -2
- package/lib/components/role-mapping-generation/role-mapping-generation.component.d.ts.map +1 -1
- package/lib/components/role-mapping-list/role-mapping-list.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/sunbird-cb-cbp-ai-0.1.90.tgz +0 -0
|
@@ -11376,57 +11376,55 @@ class RoleMappingGenerationComponent {
|
|
|
11376
11376
|
}
|
|
11377
11377
|
getMinistryData() {
|
|
11378
11378
|
this.apiLoading = true;
|
|
11379
|
-
this.
|
|
11380
|
-
|
|
11381
|
-
this.
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11379
|
+
const requestedType = this.selectedMinistryType;
|
|
11380
|
+
return new Promise((resolve) => {
|
|
11381
|
+
this.sharedService.getMinistryData(requestedType).subscribe((data) => {
|
|
11382
|
+
console.log('data--', data);
|
|
11383
|
+
this.apiLoading = false;
|
|
11384
|
+
// Ignore stale responses from a type that was changed again before this one returned
|
|
11385
|
+
if (requestedType !== this.selectedMinistryType) {
|
|
11386
|
+
resolve();
|
|
11387
|
+
return;
|
|
11388
|
+
}
|
|
11389
|
+
this.ministryFullData = data;
|
|
11390
|
+
this.ministryData = [];
|
|
11391
|
+
if (requestedType === 'ministry') {
|
|
11392
|
+
data.forEach((item) => {
|
|
11393
|
+
if (item?.sbOrgType === 'ministry') {
|
|
11394
|
+
this.ministryData.push(item);
|
|
11395
|
+
}
|
|
11396
|
+
});
|
|
11397
|
+
}
|
|
11398
|
+
else if (requestedType === 'state') {
|
|
11399
|
+
data.forEach((item) => {
|
|
11400
|
+
if (item?.sbOrgType === 'state') {
|
|
11401
|
+
this.ministryData.push(item);
|
|
11402
|
+
}
|
|
11403
|
+
});
|
|
11404
|
+
}
|
|
11405
|
+
this.getUserProfileData(requestedType, resolve);
|
|
11406
|
+
});
|
|
11399
11407
|
});
|
|
11400
11408
|
}
|
|
11401
11409
|
async onMinistryTypeChange(event) {
|
|
11402
11410
|
console.log('event', event);
|
|
11403
|
-
if (this.login) {
|
|
11404
|
-
await this.getMinistryData();
|
|
11405
|
-
}
|
|
11406
11411
|
this.sharedService.cbpPlanFinalObj['ministryType'] = event.value;
|
|
11407
11412
|
this.sharedService.cbpPlanFinalObj['role_mapping_generation'] = [];
|
|
11408
11413
|
this.selectedMinistryType = event.value;
|
|
11409
|
-
localStorage.setItem('cbpPlanFinalObj', JSON.stringify(this.sharedService.cbpPlanFinalObj));
|
|
11410
11414
|
this.ministryData = [];
|
|
11415
|
+
if (this.login) {
|
|
11416
|
+
await this.getMinistryData();
|
|
11417
|
+
}
|
|
11418
|
+
localStorage.setItem('cbpPlanFinalObj', JSON.stringify(this.sharedService.cbpPlanFinalObj));
|
|
11411
11419
|
if (event?.value === 'state') {
|
|
11412
11420
|
this.roleMappingForm.get('ministry')?.setValue(null);
|
|
11413
11421
|
this.roleMappingForm.get('sectors')?.setValue([]);
|
|
11414
11422
|
this.roleMappingForm.get('departments')?.setValue([]);
|
|
11415
|
-
this.ministryFullData.forEach((item) => {
|
|
11416
|
-
if (item?.type === 'state') {
|
|
11417
|
-
this.ministryData.push(item);
|
|
11418
|
-
}
|
|
11419
|
-
});
|
|
11420
11423
|
}
|
|
11421
11424
|
else if (event?.value === 'ministry') {
|
|
11422
11425
|
this.roleMappingForm.get('ministry')?.setValue(null);
|
|
11423
11426
|
this.roleMappingForm.get('sectors')?.setValue([]);
|
|
11424
11427
|
this.roleMappingForm.get('departments')?.setValue([]);
|
|
11425
|
-
this.ministryFullData.forEach((item) => {
|
|
11426
|
-
if (item?.type === 'central') {
|
|
11427
|
-
this.ministryData.push(item);
|
|
11428
|
-
}
|
|
11429
|
-
});
|
|
11430
11428
|
}
|
|
11431
11429
|
this.sharedService.cbpPlanFinalObj['ministry'] = '';
|
|
11432
11430
|
this.sharedService.cbpPlanFinalObj['department_name'] = '';
|
|
@@ -11967,20 +11965,26 @@ class RoleMappingGenerationComponent {
|
|
|
11967
11965
|
input.value = '';
|
|
11968
11966
|
}
|
|
11969
11967
|
}
|
|
11970
|
-
getUserProfileData() {
|
|
11968
|
+
getUserProfileData(requestedType, done) {
|
|
11971
11969
|
this.sharedService.getUserProfile().subscribe((data) => {
|
|
11972
11970
|
console.log('data--', data);
|
|
11973
11971
|
localStorage.setItem('userProfile', JSON.stringify(data));
|
|
11974
11972
|
this.loginUserOrgIds = data?.organization_ids;
|
|
11973
|
+
// Ignore stale responses from a type that was changed again before this one returned
|
|
11974
|
+
if (requestedType && requestedType !== this.selectedMinistryType) {
|
|
11975
|
+
done?.();
|
|
11976
|
+
return;
|
|
11977
|
+
}
|
|
11975
11978
|
let filteredMinistryData = [];
|
|
11976
11979
|
this.ministryFullData.map((item) => {
|
|
11977
|
-
if (this.loginUserOrgIds.indexOf(item?.identifier) > -1) {
|
|
11980
|
+
if (this.loginUserOrgIds.indexOf(item?.identifier) > -1 && item?.sbOrgType === (requestedType || this.selectedMinistryType)) {
|
|
11978
11981
|
filteredMinistryData.push(item);
|
|
11979
11982
|
}
|
|
11980
11983
|
});
|
|
11981
11984
|
this.ministryData = filteredMinistryData;
|
|
11982
11985
|
this.originalMinistryData = filteredMinistryData;
|
|
11983
11986
|
this.filteredList = filteredMinistryData;
|
|
11987
|
+
done?.();
|
|
11984
11988
|
});
|
|
11985
11989
|
}
|
|
11986
11990
|
onOpened(opened) {
|
|
@@ -12057,9 +12061,6 @@ class DeleteRoleMappingComponent {
|
|
|
12057
12061
|
this.planData = data;
|
|
12058
12062
|
}
|
|
12059
12063
|
deleteRoleMapping() {
|
|
12060
|
-
// this.sharedService.deleteRoleMapping(this.planData.id).subscribe(()=>{
|
|
12061
|
-
// this.dialogRef.close('saved')
|
|
12062
|
-
// })
|
|
12063
12064
|
this.sharedService.deleteRoleMapping(this.planData.id).subscribe({
|
|
12064
12065
|
next: () => {
|
|
12065
12066
|
this.dialogRef.close('saved');
|
|
@@ -14374,39 +14375,8 @@ class RoleMappingListComponent {
|
|
|
14374
14375
|
});
|
|
14375
14376
|
dialogRef.afterClosed().subscribe(result => {
|
|
14376
14377
|
if (result === 'saved') {
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
console.log(this.sharedService.cbpPlanFinalObj);
|
|
14380
|
-
if (this.sharedService.cbpPlanFinalObj && this.sharedService.cbpPlanFinalObj.ministry && this.sharedService.cbpPlanFinalObj.ministry.identifier &&
|
|
14381
|
-
this.sharedService.cbpPlanFinalObj.ministry?.sbOrgType === 'ministry') {
|
|
14382
|
-
if (this.sharedService.cbpPlanFinalObj.departments) {
|
|
14383
|
-
this.sharedService.getRoleMappingByStateCenterAndDepartment(this.sharedService.cbpPlanFinalObj.ministry.identifier, this.sharedService.cbpPlanFinalObj.departments).subscribe((res) => {
|
|
14384
|
-
console.log('res', res);
|
|
14385
|
-
this.dataSource = new MatTableDataSource(res);
|
|
14386
|
-
this.dataSource.paginator = this.paginator;
|
|
14387
|
-
this.originalData = res;
|
|
14388
|
-
console.log('this.dataSource', this.dataSource);
|
|
14389
|
-
});
|
|
14390
|
-
}
|
|
14391
|
-
else {
|
|
14392
|
-
this.sharedService.getRoleMappingByStateCenter(this.sharedService.cbpPlanFinalObj.ministry.identifier).subscribe((res) => {
|
|
14393
|
-
console.log('res', res);
|
|
14394
|
-
this.dataSource = new MatTableDataSource(res);
|
|
14395
|
-
this.dataSource.paginator = this.paginator;
|
|
14396
|
-
this.originalData = res;
|
|
14397
|
-
console.log('this.dataSource', this.dataSource);
|
|
14398
|
-
});
|
|
14399
|
-
}
|
|
14400
|
-
}
|
|
14401
|
-
else {
|
|
14402
|
-
this.sharedService.getRoleMappingByStateCenterAndDepartment(this.sharedService.cbpPlanFinalObj.ministry.identifier, this.sharedService.cbpPlanFinalObj.departments).subscribe((res) => {
|
|
14403
|
-
console.log('res', res);
|
|
14404
|
-
this.dataSource = new MatTableDataSource(res);
|
|
14405
|
-
this.dataSource.paginator = this.paginator;
|
|
14406
|
-
this.originalData = res;
|
|
14407
|
-
console.log('this.dataSource', this.dataSource);
|
|
14408
|
-
});
|
|
14409
|
-
}
|
|
14378
|
+
this.selection.clear();
|
|
14379
|
+
this.loadRoleMappingList();
|
|
14410
14380
|
}
|
|
14411
14381
|
});
|
|
14412
14382
|
}
|
|
@@ -14496,11 +14466,9 @@ class RoleMappingListComponent {
|
|
|
14496
14466
|
console.log('matchedRoleMapping', matchedRoleMapping);
|
|
14497
14467
|
this.matchedRoleMappingData = matchedRoleMapping?.matched_details || [];
|
|
14498
14468
|
this.matchedRoleMapping = matchedRoleMapping?.matched_count;
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
this.matchedDesignationSet = new Set(matchedNames);
|
|
14503
|
-
this.matchedRoleMapping = matchedNames.length;
|
|
14469
|
+
const matchedRoleMappingIds = matchedRoleMapping?.matched_details?.map(x => x.role_mapping_id) || [];
|
|
14470
|
+
this.matchedDesignationSet = new Set(matchedRoleMappingIds);
|
|
14471
|
+
this.matchedRoleMapping = matchedRoleMappingIds.length;
|
|
14504
14472
|
this.unMatchedRoleMapping = this.masterData.length - this.matchedRoleMapping;
|
|
14505
14473
|
this.applyAllFilters();
|
|
14506
14474
|
});
|
|
@@ -14539,11 +14507,9 @@ class RoleMappingListComponent {
|
|
|
14539
14507
|
console.log('matchedRoleMapping', matchedRoleMapping);
|
|
14540
14508
|
this.matchedRoleMappingData = matchedRoleMapping?.matched_details || [];
|
|
14541
14509
|
this.matchedRoleMapping = matchedRoleMapping?.matched_count;
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
this.matchedDesignationSet = new Set(matchedNames);
|
|
14546
|
-
this.matchedRoleMapping = matchedNames.length;
|
|
14510
|
+
const matchedRoleMappingIds = matchedRoleMapping?.matched_details?.map(x => x.role_mapping_id) || [];
|
|
14511
|
+
this.matchedDesignationSet = new Set(matchedRoleMappingIds);
|
|
14512
|
+
this.matchedRoleMapping = matchedRoleMappingIds.length;
|
|
14547
14513
|
this.unMatchedRoleMapping = this.masterData.length - this.matchedRoleMapping;
|
|
14548
14514
|
this.applyAllFilters();
|
|
14549
14515
|
});
|
|
@@ -14579,11 +14545,9 @@ class RoleMappingListComponent {
|
|
|
14579
14545
|
console.log('matchedRoleMapping', matchedRoleMapping);
|
|
14580
14546
|
this.matchedRoleMappingData = matchedRoleMapping?.matched_details || [];
|
|
14581
14547
|
this.matchedRoleMapping = matchedRoleMapping?.matched_count;
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
this.matchedDesignationSet = new Set(matchedNames);
|
|
14586
|
-
this.matchedRoleMapping = matchedNames.length;
|
|
14548
|
+
const matchedRoleMappingIds = matchedRoleMapping?.matched_details?.map(x => x.role_mapping_id) || [];
|
|
14549
|
+
this.matchedDesignationSet = new Set(matchedRoleMappingIds);
|
|
14550
|
+
this.matchedRoleMapping = matchedRoleMappingIds.length;
|
|
14587
14551
|
this.unMatchedRoleMapping = this.masterData.length - this.matchedRoleMapping;
|
|
14588
14552
|
this.applyAllFilters();
|
|
14589
14553
|
});
|
|
@@ -14635,11 +14599,14 @@ class RoleMappingListComponent {
|
|
|
14635
14599
|
}
|
|
14636
14600
|
applyAllFilters() {
|
|
14637
14601
|
let data = [...this.masterData];
|
|
14602
|
+
this.masterData.forEach(item => {
|
|
14603
|
+
const roleMappingId = item.id;
|
|
14604
|
+
});
|
|
14638
14605
|
if (this.activeTab === 'matched') {
|
|
14639
|
-
data = data.filter(item => this.matchedDesignationSet.has(item.
|
|
14606
|
+
data = data.filter(item => this.matchedDesignationSet.has(item.id));
|
|
14640
14607
|
}
|
|
14641
14608
|
if (this.activeTab === 'unmatched') {
|
|
14642
|
-
data = data.filter(item => !this.matchedDesignationSet.has(item.
|
|
14609
|
+
data = data.filter(item => !this.matchedDesignationSet.has(item.id));
|
|
14643
14610
|
}
|
|
14644
14611
|
if (this.searchText.trim()) {
|
|
14645
14612
|
const terms = this.searchText.toLowerCase().split(/\s+/);
|