diff --git a/frontend/src/components/MatchReportApiDialog.vue b/frontend/src/components/MatchReportApiDialog.vue index dc16cc3..bf0df44 100644 --- a/frontend/src/components/MatchReportApiDialog.vue +++ b/frontend/src/components/MatchReportApiDialog.vue @@ -311,7 +311,12 @@
-

Ergebniserfassung

+
+

Ergebniserfassung

+ +
@@ -776,6 +781,62 @@ Wir wünschen den Spielen einen schönen, spannenden und fairen Verlauf und begr return actualCount; }, + // Auto-Fill für leere Matches + autoFillEmptyMatches() { + console.log('🔧 Starte Auto-Fill für leere Matches...'); + + this.results.forEach((match, index) => { + const hasHomePlayer = match.homeName && match.homeName.trim() !== ''; + const hasGuestPlayer = match.guestName && match.guestName.trim() !== ''; + + console.log(`🔍 Match ${index + 1}: Heim="${match.homeName}", Gast="${match.guestName}"`); + console.log(` hat Heim-Spieler: ${hasHomePlayer}, hat Gast-Spieler: ${hasGuestPlayer}`); + + // Nur wenn genau ein Spieler vorhanden ist (der andere ist leer) + if (hasHomePlayer && !hasGuestPlayer) { + console.log(`✅ Auto-Fill Match ${index + 1}: Heim ${match.homeName} gewinnt 3:0`); + this.autoFillMatch(index, 'home', 3, 0); + } else if (!hasHomePlayer && hasGuestPlayer) { + console.log(`✅ Auto-Fill Match ${index + 1}: Gast ${match.guestName} gewinnt 3:0`); + this.autoFillMatch(index, 'guest', 0, 3); + } else if (!hasHomePlayer && !hasGuestPlayer) { + console.log(`⏭️ Match ${index + 1}: Keine Spieler → überspringe`); + } else { + console.log(`⏭️ Match ${index + 1}: Beide Spieler vorhanden → überspringe`); + } + }); + }, + + autoFillMatch(matchIndex, winner, winnerGames, opponentGames) { + if (matchIndex < 0 || matchIndex >= this.results.length) { + console.error(`❌ Ungültiger Match-Index: ${matchIndex}`); + return; + } + + const match = this.results[matchIndex]; + + // Setze 3 x 11:0 Sätze für den Gewinner + for (let setIndex = 0; setIndex < 3; setIndex++) { + if (winner === 'home') { + match.sets[setIndex] = '11:0'; // Heim gewinnt + } else { + match.sets[setIndex] = '0:11'; // Gast gewinnt + } + } + + // Setze auch Satz 4 und 5 als leer + if (match.sets[3] === undefined) match.sets[3] = ''; + if (match.sets[4] === undefined) match.sets[4] = ''; + + // Berechne Match-Ergebnis neu + this.calculateMatchResult(matchIndex); + + // Markiere Match als abgeschlossen + this.completeMatch(matchIndex); + + console.log(`🎯 Match ${matchIndex + 1} gefüllt und abgeschlossen: ${JSON.stringify(match.sets)}`); + }, + // Methoden für Abschluss-Seite getHomeDoublePairs() { if (!this.results || this.results.length === 0) return []; @@ -4220,6 +4281,48 @@ Wir wünschen den Spielen einen schönen, spannenden und fairen Verlauf und begr opacity: 0.7; } +/* Ergebniserfassungs-Header */ +.result-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +} + +.result-header h3 { + margin: 0; +} + +.autofill-btn { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + color: white; + border: none; + padding: 12px 20px; + border-radius: 8px; + font-weight: 600; + cursor: pointer; + display: flex; + align-items: center; + gap: 8px; + transition: all 0.3s ease; + font-size: 14px; + box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); +} + +.autofill-btn:hover:not(:disabled) { + background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%); + transform: translateY(-2px); + box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4); +} + +.autofill-btn:disabled { + background: #e2e8f0; + color: #a0aec0; + cursor: not-allowed; + transform: none; + box-shadow: none; +} + /* Completion warning auf Ergebniserfassungs-Seite */ .completion-warning { display: flex;