@sunbird-cb/cbp-ai 0.1.81 → 0.1.83

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.
@@ -1612,7 +1612,7 @@ class EditCbpPlanComponent {
1612
1612
  this.planData = data;
1613
1613
  }
1614
1614
  }
1615
- console.log('Received data:', data);
1615
+ console.log('Received data:', this.planData);
1616
1616
  // this.planData.competencies.map((competencies:any)=>{
1617
1617
  // this.competenciesCount['total'] = this.competenciesCount['total'] + 1
1618
1618
  // if(competencies.type === 'Behavioral') {
@@ -1627,9 +1627,14 @@ class EditCbpPlanComponent {
1627
1627
  // })
1628
1628
  }
1629
1629
  ngOnInit() {
1630
+ console.log('this.data?.matched_role_mappings', this.data?.matched_role_mappings);
1630
1631
  this.matchedDesignationIds = this.data?.matched_role_mappings?.map((item) => item?.igot_designation_id) || [];
1631
1632
  this.loadCompetenciesData();
1632
1633
  this.initializeForm();
1634
+ if (this.planData?.designation_name &&
1635
+ !this.planData?.igot_designation_id) {
1636
+ this.getDesignation(this.planData.designation_name, 0);
1637
+ }
1633
1638
  const searchControl = this.cbpForm.get('searchDesignation');
1634
1639
  if (searchControl) {
1635
1640
  searchControl.valueChanges
@@ -1730,12 +1735,17 @@ class EditCbpPlanComponent {
1730
1735
  this.dialogRef.close();
1731
1736
  }
1732
1737
  saveRoleMapping() {
1738
+ console.log("saved function called...");
1733
1739
  if (this.cbpForm.invalid)
1734
1740
  return;
1735
1741
  const formData = this.cbpForm.value;
1736
1742
  console.log('Submitted Data:', formData);
1737
1743
  let cbpPlanData = this.sharedService.cbpPlanFinalObj;
1738
1744
  console.log('cbpPlanData', cbpPlanData);
1745
+ console.log('Backup entry:', this.masterData.designationBackup.find((x) => x.name?.toLowerCase() ===
1746
+ formData.designation_name?.toLowerCase()));
1747
+ console.log('Visible entry:', this.masterData.designation.find((x) => x.name?.toLowerCase() ===
1748
+ formData.designation_name?.toLowerCase()));
1739
1749
  const roleResponsibilitiesArray = this.cbpForm.value.role_responsibilities_text
1740
1750
  .split('\n')
1741
1751
  .map(line => line.trim())
@@ -1761,8 +1771,16 @@ class EditCbpPlanComponent {
1761
1771
  else {
1762
1772
  console.log('masterData?.designation', this.masterData?.designation);
1763
1773
  req["designation_name"] = formData?.designation_name ? formData.designation_name : '';
1774
+ console.log('Searching in backup:', this.masterData.designationBackup.find((x) => x.name?.trim().toLowerCase() ===
1775
+ formData.designation_name?.trim().toLowerCase()));
1764
1776
  const selectedDesignation = this.masterData?.designation?.find((item) => item?.name?.toLowerCase() === formData?.designation_name?.toLowerCase());
1777
+ const backupDesignation = this.masterData.designationBackup.find((x) => x.name?.toLowerCase() ===
1778
+ formData.designation_name?.toLowerCase());
1779
+ console.log('backupDesignation', backupDesignation);
1765
1780
  req["igot_designation_id"] = selectedDesignation?.igot_designation_id || '';
1781
+ console.log('designation_name 123 ', formData.designation_name);
1782
+ console.log('selectedDesignation 123', selectedDesignation);
1783
+ console.log('igot_designation_id 123', req['igot_designation_id']);
1766
1784
  }
1767
1785
  if (this.sharedService.fromMdoPortal) {
1768
1786
  req['request_id'] = this.requestRowData?.id;
@@ -1783,7 +1801,7 @@ class EditCbpPlanComponent {
1783
1801
  },
1784
1802
  error: (error) => {
1785
1803
  console.log('error', error);
1786
- this.dialogRef.close();
1804
+ // this.dialogRef.close()
1787
1805
  // Handle 409 Conflict here
1788
1806
  // alert('Conflict detected: The resource already exists or action conflicts.');
1789
1807
  //this.get
@@ -2089,6 +2107,8 @@ class EditCbpPlanComponent {
2089
2107
  name: item?.designation || '',
2090
2108
  status: item?.status || 'Active',
2091
2109
  }));
2110
+ console.log('Managing Director from API ====', mapped.filter((x) => x.name?.trim().toLowerCase() === 'managing director'));
2111
+ console.log('Total mapped designations ====', mapped.length);
2092
2112
  const total = _$1.get(res, 'result.result.totalcount', _$1.get(res, 'result.result.data.totalCount', _$1.get(res, 'result.result.totalCount', 0)));
2093
2113
  this.defaultSearchDesignationCount = total;
2094
2114
  // =========================
@@ -2096,9 +2116,15 @@ class EditCbpPlanComponent {
2096
2116
  // =========================
2097
2117
  if (searchText?.length) {
2098
2118
  this.masterData.designationFiltered = mapped;
2119
+ // IMPORTANT: merge searched result into backup
2120
+ const combined = [
2121
+ ...(this.masterData.designationBackup || []),
2122
+ ...mapped
2123
+ ];
2124
+ this.masterData.designationBackup = _$1.uniqBy(combined, (it) => (it?.name || '').toLowerCase());
2099
2125
  this.masterData.designation =
2100
2126
  this.masterData.designationFiltered.slice(0, this.searchDesignationLoadCount);
2101
- this.checkCurrentDesignationPresent();
2127
+ console.log('Backup after search', this.masterData.designationBackup.find((x) => x.name?.toLowerCase() === 'managing director'));
2102
2128
  return;
2103
2129
  }
2104
2130
  // =========================
@@ -2109,7 +2135,7 @@ class EditCbpPlanComponent {
2109
2135
  }
2110
2136
  else {
2111
2137
  const combined = (this.masterData['designationBackup'] || []).concat(mapped);
2112
- this.masterData['designationBackup'] = _$1.uniqBy(combined, (it) => (it?.name || '').toLowerCase());
2138
+ this.masterData['designationBackup'] = _$1.uniqBy(combined, (it) => `${(it?.name || '').toLowerCase()}_${it?.igot_designation_id}`);
2113
2139
  }
2114
2140
  this.masterData.designation =
2115
2141
  (this.masterData.designationBackup || []).slice(0, this.designationListLoadCount);
@@ -2176,7 +2202,9 @@ class EditCbpPlanComponent {
2176
2202
  return;
2177
2203
  const normalize = (v) => (v || '').trim().toLowerCase();
2178
2204
  const backup = [...this.masterData.designationBackup];
2179
- const existingIndex = backup.findIndex((item) => normalize(item?.name) === normalize(selectedDesignation));
2205
+ console.log('All matching records', backup.filter((item) => normalize(item?.name) === normalize(selectedDesignation)));
2206
+ const existingIndex = backup.findIndex((item) => normalize(item?.name) === normalize(selectedDesignation) &&
2207
+ item?.igot_designation_id);
2180
2208
  let selectedObj;
2181
2209
  // If exists → remove it and reuse
2182
2210
  if (existingIndex > -1) {
@@ -11012,8 +11040,8 @@ class RoleMappingGenerationComponent {
11012
11040
  else {
11013
11041
  this.documents = [];
11014
11042
  this.apiLoading = false;
11015
- this.disableUploadDocument = true;
11016
- this.disableUploadDocumentOriginal = true;
11043
+ this.disableUploadDocument = false;
11044
+ this.disableUploadDocumentOriginal = false;
11017
11045
  }
11018
11046
  });
11019
11047
  }