From 280c1432b7a33f5e9ed5a490e44eb0793d704fe1 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Sat, 4 Oct 2025 00:51:25 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=BCgt=20eine=20Auto-Fill-Funktion=20f=C3=BC?= =?UTF-8?q?r=20leere=20Matches=20im=20MatchReportApiDialog=20hinzu.=20Impl?= =?UTF-8?q?ementiert=20einen=20neuen=20Header=20mit=20einem=20Button=20zum?= =?UTF-8?q?=20automatischen=20Ausf=C3=BCllen,=20der=20die=20Spielergebniss?= =?UTF-8?q?e=20f=C3=BCr=20unvollst=C3=A4ndige=20Matches=20basierend=20auf?= =?UTF-8?q?=20vorhandenen=20Spielern=20automatisch=20ausf=C3=BCllt.=20Verb?= =?UTF-8?q?essert=20die=20Benutzeroberfl=C3=A4che=20mit=20neuen=20CSS-Stil?= =?UTF-8?q?en=20f=C3=BCr=20den=20Header=20und=20den=20Button.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/MatchReportApiDialog.vue | 105 +++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) 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;