feature/addQualifications #23

Merged
SZUT-Ole merged 2 commits from feature/addQualifications into trunk 2025-01-21 11:54:54 +00:00
Showing only changes of commit 16a9aef3c5 - Show all commits

View file

@ -138,6 +138,10 @@ export class QualificationsComponent {
return; return;
} }
this.qualificationService.getAllQualificationEmployees({id: qualification.id}).subscribe((employees: QualificationEmployees) => { this.qualificationService.getAllQualificationEmployees({id: qualification.id}).subscribe((employees: QualificationEmployees) => {
if (employees.employees.length==0){
this.execDelete(qualification);
return;
}
const requests: Array<Observable<RemoveQualificationFromEmployeeResponse>> = []; const requests: Array<Observable<RemoveQualificationFromEmployeeResponse>> = [];
for (const employee of employees.employees) { for (const employee of employees.employees) {
requests.push(this.employeeService.removeQualificationFromEmployee({ requests.push(this.employeeService.removeQualificationFromEmployee({
@ -152,6 +156,12 @@ export class QualificationsComponent {
return; return;
} }
} }
this.execDelete(qualification);
});
});
});
}
execDelete(qualification: Qualification){
this.qualificationService.deleteQualification({id: qualification.id}).subscribe(() => { this.qualificationService.deleteQualification({id: qualification.id}).subscribe(() => {
const data = this.qualificationDataSource.data; const data = this.qualificationDataSource.data;
const i = data.indexOf(qualification); const i = data.indexOf(qualification);
@ -161,8 +171,5 @@ export class QualificationsComponent {
} }
this.notifications.publish(`Deleted ${qualification.skill}`, NotificationType.Information); this.notifications.publish(`Deleted ${qualification.skill}`, NotificationType.Information);
}); });
});
});
});
} }
} }