Fix: Abschließen blockiert wenn Checklist-Todos noch offen
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -416,6 +416,12 @@ const OnOffboardingPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const completeOn = async () => {
|
const completeOn = async () => {
|
||||||
|
const relevantProcesses = onProcesses.filter(p => !editingOn?.department || p.department_name === editingOn.department);
|
||||||
|
const unchecked = relevantProcesses.filter(p => !onForm.checklist_data[`proc_${p.id}`]);
|
||||||
|
if (unchecked.length > 0) {
|
||||||
|
toast.error(`Noch ${unchecked.length} Aufgabe(n) offen — bitte zuerst alle Punkte abhaken.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await onboardingService.update(editingOn.id, { status: 'completed', checklist_data: onForm.checklist_data, notes: onForm.notes, completion_date: today() });
|
await onboardingService.update(editingOn.id, { status: 'completed', checklist_data: onForm.checklist_data, notes: onForm.notes, completion_date: today() });
|
||||||
toast.success('Onboarding abgeschlossen!');
|
toast.success('Onboarding abgeschlossen!');
|
||||||
@@ -513,6 +519,14 @@ const OnOffboardingPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const completeOff = async () => {
|
const completeOff = async () => {
|
||||||
|
const relevantProcesses = offProcesses.filter((p, i, arr) =>
|
||||||
|
arr.findIndex(x => x.responsible_team === p.responsible_team && x.title === p.title) === i
|
||||||
|
);
|
||||||
|
const unchecked = relevantProcesses.filter(p => !offForm.checklist_data[`proc_${p.id}`]);
|
||||||
|
if (unchecked.length > 0) {
|
||||||
|
toast.error(`Noch ${unchecked.length} Aufgabe(n) offen — bitte zuerst alle Punkte abhaken.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await offboardingService.update(editingOff.id, { status: 'completed', checklist_data: offForm.checklist_data, notes: offForm.notes, completion_date: today() });
|
await offboardingService.update(editingOff.id, { status: 'completed', checklist_data: offForm.checklist_data, notes: offForm.notes, completion_date: today() });
|
||||||
toast.success('Offboarding abgeschlossen!');
|
toast.success('Offboarding abgeschlossen!');
|
||||||
|
|||||||
Reference in New Issue
Block a user