feat: Implementiere farbige Tippübersicht mit Joker-Anzeige
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
parent
b7cfb834f7
commit
2127a40b9e
2 changed files with 105 additions and 30 deletions
|
|
@ -1,45 +1,90 @@
|
|||
<?php
|
||||
use App\Models\Game;
|
||||
use App\Models\Tipp;
|
||||
|
||||
// Stellt sicher, dass die benötigten Variablen vorhanden sind
|
||||
if (!isset($selectedRound) || !isset($roundsToShow)) {
|
||||
if (!isset($selectedRound) || !isset($roundsToShow) || !isset($users) || !isset($tipps_map)) {
|
||||
echo "Fehler: Daten für die Rundenansicht nicht gefunden.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$pageTitle = 'Rundenübersicht - ' . htmlspecialchars($selectedRound['name']);
|
||||
$pageTitle = 'Tippübersicht - ' . htmlspecialchars($selectedRound['name']);
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
<style>
|
||||
/* Styling für die Punkt-Zellen (aus Rangliste übernommen) */
|
||||
.tipp-cell { text-align: center; position: relative; }
|
||||
.col_exact { background-color: #28a745 !important; color: white; } /* Exaktes Ergebnis */
|
||||
.col_diff { background-color: #ffc107 !important; } /* Richtige Tordifferenz */
|
||||
.col_tendenz { background-color: #17a2b8 !important; color: white; } /* Richtige Tendenz */
|
||||
.joker-icon { font-size: 0.7em; vertical-align: top; }
|
||||
th.game-header { white-space: normal; } /* Erlaubt Umbruch im Header */
|
||||
.table-container { width: 100%; overflow-x: auto; margin-top: 20px; }
|
||||
</style>
|
||||
|
||||
<h1>Tippübersicht bis: <?php echo htmlspecialchars($selectedRound['name']); ?></h1>
|
||||
|
||||
<?php foreach ($roundsToShow as $round): ?>
|
||||
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||||
<?php if (!empty($round['games'])): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Anpfiff</th>
|
||||
<th>Heim</th>
|
||||
<th>Gast</th>
|
||||
<th>Ergebnis</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($round['games'] as $game): ?>
|
||||
<?php if (empty($users)): ?>
|
||||
<p>Keine teilnehmenden Spieler für diese Saison gefunden.</p>
|
||||
<?php else: ?>
|
||||
<?php foreach ($roundsToShow as $round): ?>
|
||||
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||||
<?php if (!empty($round['games'])): ?>
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars((new DateTime($game['kickoff']))->format('d.m.Y H:i')); ?></td>
|
||||
<td><?php echo htmlspecialchars($game['team1']); ?></td>
|
||||
<td><?php echo htmlspecialchars($game['team2']); ?></td>
|
||||
<td><?php echo App\Models\Game::getResultString($game['score1'], $game['score2'], $game['kickoff']); ?></td>
|
||||
<td><?php echo App\Models\Game::isLocked($game['kickoff']) ? 'Gesperrt' : 'Offen'; ?></td>
|
||||
<th>Spieler</th>
|
||||
<?php foreach ($round['games'] as $game): ?>
|
||||
<th class="game-header">
|
||||
<?php echo htmlspecialchars($game['team1']); ?><br>
|
||||
<?php echo htmlspecialchars($game['team2']); ?><br>
|
||||
<small>(<?php echo Game::getResultString($game['score1'], $game['score2'], $game['kickoff']); ?>)</small>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<p>Für diese Runde wurden keine Spiele gefunden.</p>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($user['name']); ?></td>
|
||||
<?php foreach ($round['games'] as $game): ?>
|
||||
<?php
|
||||
$tipp = $tipps_map[$user['id']][$game['id']] ?? null;
|
||||
$color = '';
|
||||
$text = '-';
|
||||
$is_joker = false;
|
||||
|
||||
if ($tipp && $game['score1'] > -1) {
|
||||
$color = Tipp::getCol($game['score1'], $game['score2'], $tipp['tipp1'], $tipp['tipp2'], $tipp['joker']);
|
||||
}
|
||||
if ($tipp) {
|
||||
// Zeige Tipps nur für gesperrte Spiele
|
||||
if (Game::isLocked($game['kickoff'])) {
|
||||
$text = $tipp['tipp1'] . ':' . $tipp['tipp2'];
|
||||
} else {
|
||||
$text = 'verdeckt';
|
||||
}
|
||||
$is_joker = (bool)$tipp['joker'];
|
||||
}
|
||||
?>
|
||||
<td class="tipp-cell <?php echo htmlspecialchars($color); ?>">
|
||||
<?php echo htmlspecialchars($text); ?>
|
||||
<?php if ($is_joker && Game::isLocked($game['kickoff'])): ?>
|
||||
<span class="joker-icon" title="Joker">🃏</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p>Für diese Runde wurden keine Spiele gefunden.</p>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><a href="/">Zurück zur Startseite</a></p>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue