@sunbird-cb/cbp-ai 0.1.86 → 0.1.87
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/edit-cbp-plan/edit-cbp-plan.component.mjs +31 -18
- package/fesm2022/sunbird-cb-cbp-ai.mjs +30 -17
- package/fesm2022/sunbird-cb-cbp-ai.mjs.map +1 -1
- package/lib/components/edit-cbp-plan/edit-cbp-plan.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/sunbird-cb-cbp-ai-0.1.86.tgz +0 -0
|
@@ -1764,24 +1764,37 @@ class EditCbpPlanComponent {
|
|
|
1764
1764
|
"competencies": formData.competencies
|
|
1765
1765
|
};
|
|
1766
1766
|
console.log('masterData?.designation', this.masterData?.designation);
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1767
|
+
const normalize = (v) => (v || '').trim().toLowerCase();
|
|
1768
|
+
const selectedDesignationName = formData?.designation_name ? formData.designation_name : '';
|
|
1769
|
+
const visibleDesignation = (this.masterData?.designation || []).find((item) => normalize(item?.name) === normalize(selectedDesignationName) &&
|
|
1770
|
+
item?.igot_designation_id);
|
|
1771
|
+
const backupDesignation = (this.masterData?.designationBackup || []).find((item) => normalize(item?.name) === normalize(selectedDesignationName) &&
|
|
1772
|
+
item?.igot_designation_id);
|
|
1773
|
+
const isSameAsExistingDesignation = normalize(this.planData?.designation_name || '') ===
|
|
1774
|
+
normalize(selectedDesignationName);
|
|
1775
|
+
const resolvedDesignationId = formData?.igot_designation_id ||
|
|
1776
|
+
visibleDesignation?.igot_designation_id ||
|
|
1777
|
+
backupDesignation?.igot_designation_id ||
|
|
1778
|
+
(isSameAsExistingDesignation
|
|
1779
|
+
? (this.planData?.igot_designation_id || '')
|
|
1780
|
+
: '');
|
|
1781
|
+
if (isSameAsExistingDesignation && !resolvedDesignationId) {
|
|
1782
|
+
console.log('Skipping designation payload for unchanged unmatched designation');
|
|
1770
1783
|
}
|
|
1771
1784
|
else {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
req["
|
|
1781
|
-
|
|
1782
|
-
console.log('selectedDesignation 123', selectedDesignation);
|
|
1783
|
-
console.log('igot_designation_id 123', req['igot_designation_id']);
|
|
1785
|
+
if (!resolvedDesignationId) {
|
|
1786
|
+
this.loading = false;
|
|
1787
|
+
this.snackBar.open('Please select a valid designation from the list.', 'X', {
|
|
1788
|
+
duration: 3000,
|
|
1789
|
+
panelClass: ['snackbar-error']
|
|
1790
|
+
});
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
req["designation_name"] = selectedDesignationName;
|
|
1794
|
+
req["igot_designation_id"] = resolvedDesignationId;
|
|
1784
1795
|
}
|
|
1796
|
+
console.log('backupDesignation', backupDesignation);
|
|
1797
|
+
console.log('igot_designation_id 123', req['igot_designation_id']);
|
|
1785
1798
|
if (this.sharedService.fromMdoPortal) {
|
|
1786
1799
|
req['request_id'] = this.requestRowData?.id;
|
|
1787
1800
|
req['item_id'] = this.planData?.id;
|
|
@@ -2225,10 +2238,10 @@ class EditCbpPlanComponent {
|
|
|
2225
2238
|
igot_designation_id: '',
|
|
2226
2239
|
};
|
|
2227
2240
|
}
|
|
2228
|
-
|
|
2241
|
+
const deduplicatedBackup = backup.filter((item) => normalize(item?.name) !== normalize(selectedDesignation));
|
|
2229
2242
|
this.masterData.designationBackup = [
|
|
2230
2243
|
selectedObj,
|
|
2231
|
-
...
|
|
2244
|
+
...deduplicatedBackup
|
|
2232
2245
|
];
|
|
2233
2246
|
// Also update visible list (same order logic)
|
|
2234
2247
|
const visible = [...(this.masterData.designation || [])];
|