diff --git a/frontend/src/pages/ShiftPlans/ShiftPlanView.tsx b/frontend/src/pages/ShiftPlans/ShiftPlanView.tsx index 0f3b1fc..72f4cb2 100644 --- a/frontend/src/pages/ShiftPlans/ShiftPlanView.tsx +++ b/frontend/src/pages/ShiftPlans/ShiftPlanView.tsx @@ -167,11 +167,29 @@ const ShiftPlanView: React.FC = () => { setAssignmentResult(result); setShowAssignmentPreview(true); - if (!result.success) { + // Zeige Reparatur-Bericht in der Konsole + if (result.resolutionReport) { + console.log('🔧 Reparatur-Bericht:'); + result.resolutionReport.forEach(line => console.log(line)); + } + + // Verwende allProblemsResolved für die Erfolgsmeldung + if (result.allProblemsResolved) { showNotification({ - type: 'warning', - title: 'Warnung', - message: `Automatische Zuordnung hat ${result.violations.length} Probleme gefunden.` + type: 'success', + title: 'Erfolg', + message: 'Alle kritischen Probleme wurden behoben! Der Schichtplan kann veröffentlicht werden.' + }); + } else { + const criticalCount = result.violations.filter(v => v.includes('❌ KRITISCH:')).length; + const warningCount = result.violations.filter(v => v.includes('⚠️')).length; + + showNotification({ + type: warningCount > 0 ? 'warning' : 'error', + title: criticalCount > 0 ? 'Kritische Probleme' : 'Warnungen', + message: criticalCount > 0 + ? `${criticalCount} kritische Probleme müssen behoben werden` + : `${warningCount} Warnungen - Plan kann trotzdem veröffentlicht werden` }); } @@ -641,78 +659,95 @@ const ShiftPlanView: React.FC = () => { {/* Assignment Preview Modal */} {showAssignmentPreview && assignmentResult && ( +
-
-

Wochenmuster-Zuordnung

- - {/* Show weekly pattern info */} - {assignmentResult.pattern && ( -
-

Wochenmuster erstellt

-

- Der Algorithmus hat ein Muster für {assignmentResult.pattern.weekShifts.length} Schichten in der ersten Woche erstellt - und dieses für alle {Math.ceil(Object.keys(assignmentResult.assignments).length / assignmentResult.pattern.weekShifts.length)} Wochen im Plan wiederholt. -

-
- Wochenmuster-Statistik: -
- Schichten pro Woche: {assignmentResult.pattern.weekShifts.length}
-
- Zuweisungen pro Woche: {Object.values(assignmentResult.pattern.assignments).flat().length}
-
- Gesamtzuweisungen: {Object.values(assignmentResult.assignments).flat().length}
-
+

Wochenmuster-Zuordnung

+ + {/* Reparatur-Bericht anzeigen */} + {assignmentResult.resolutionReport && ( +
+

Reparatur-Bericht

+
+ {assignmentResult.resolutionReport.map((line, index) => ( +
+ {line} +
+ ))}
- )} - - {assignmentResult.violations.length > 0 && ( -
-

Warnungen:

-
    - {assignmentResult.violations.map((violation, index) => ( -
  • - {violation} -
  • - ))} -
-
- )} - -
-

Zusammenfassung:

-

- {assignmentResult.success - ? '✅ Alle Schichten können zugeordnet werden!' - : '⚠️ Es gibt Probleme bei der Zuordnung die manuell behoben werden müssen.'} -

+ )} + + {assignmentResult && ( +
+

Zusammenfassung:

+ {assignmentResult.allProblemsResolved ? ( +

+ ✅ Alle kritischen Probleme behoben! Der Plan kann veröffentlicht werden. +

+ ) : ( +
+

+ ❌ Es gibt kritische Probleme die behoben werden müssen: +

+
    + {assignmentResult.violations + .filter(v => v.includes('❌ KRITISCH:')) + .map((violation, index) => ( +
  • + {violation.replace('❌ KRITISCH: ', '')} +
  • + ))} +
+ {assignmentResult.violations.some(v => v.includes('⚠️')) && ( +
+

+ ⚠️ Warnungen (beeinflussen nicht die Veröffentlichung): +

+
    + {assignmentResult.violations + .filter(v => v.includes('⚠️')) + .map((warning, index) => ( +
  • + {warning.replace('⚠️ WARNHINWEIS: ', '')} +
  • + ))} +
+
+ )} +
+ )} +
+ )}