umfassende updates

This commit is contained in:
torsten 2026-10-18 21:40:43 +02:00
parent 3331f08091
commit 50cd802d33
16 changed files with 441 additions and 78 deletions

View file

@ -3,6 +3,7 @@ $pageTitle = 'Rangliste';
if ($selectedRound) {
$pageTitle .= ' - ' . htmlspecialchars($selectedRound['name']);
}
$bodyClass = 'ranking-page';
require __DIR__ . '/partials/header.php';
// Stellt sicher, dass die benötigten Variablen vorhanden sind
@ -16,6 +17,11 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
.game-header {
width: 100px; /* Feste Breite für die Spiele-Spalten */
}
table.ranking-table {
width: auto; /* Keine feste Breite, damit die Tabelle frei wachsen kann */
min-width: 100%;
max-width: none; /* Default-max-width (800px) aufheben */
}
.tipp-points {
width: 55px; /* Breite für den Tipp (z.B. 2:1) */
box-sizing: border-box;
@ -76,12 +82,66 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
padding: 6px 10px;
font-size: 0.8em;
gap: 6px 12px;
justify-content: center;
flex-wrap: nowrap; /* nicht umbrechen, volle Breite nutzen */
justify-content: flex-start;
}
.legend.legend-footer .legend-color { width: 12px; height: 12px; }
.legend.legend-footer .joker-icon { width: 1.1em; height: 1.1em; }
.legend.legend-footer .daily-winner-icon { font-size: 1em; }
/* Rundenpunkte als Link mit Aufschlüsselungs-Popup */
.round-points-link {
background: none;
box-shadow: none;
border: none;
border-radius: 0;
padding: 0;
color: var(--link);
text-transform: none;
letter-spacing: 0;
font-family: var(--font);
font-weight: 700;
text-decoration: underline;
cursor: pointer;
}
.round-points-link:hover { background: none; color: var(--pitch-dark); }
.breakdown-modal { position: fixed; inset: 0; z-index: 100; }
.breakdown-modal[hidden] { display: none; }
.breakdown-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.breakdown-modal-dialog {
position: relative;
margin: 12vh auto;
max-width: 440px;
width: calc(100% - 2em);
background: #fff;
border-radius: 10px;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
padding: 1.2em 1.2em 1.4em;
}
.breakdown-modal-close {
position: absolute;
top: 0.3em;
right: 0.4em;
background: none;
box-shadow: none;
border: none;
border-radius: 0;
padding: 0.1em 0.3em;
font-size: 1.6em;
line-height: 1;
color: var(--muted);
cursor: pointer;
}
.breakdown-modal-close:hover { background: none; color: var(--ink); }
.bd-title { font-weight: 800; font-size: 1.1em; margin-bottom: 0.6em; color: var(--pitch-dark); }
.bd-table { width: 100%; max-width: none; margin: 0 0 0.8em; border: 1px solid var(--line); }
.bd-table th, .bd-table td { padding: 4px 8px; font-size: 0.9em; }
.bd-table .bd-num { text-align: right; }
.bd-joker { font-size: 0.85em; color: var(--muted); }
.bd-line { display: flex; justify-content: space-between; padding: 0.15em 0; }
.bd-line.bd-total { border-top: 2px solid var(--pitch-dark); margin-top: 0.4em; padding-top: 0.4em; font-weight: 700; }
@media (max-width: 700px) {
.ranking-toolbar h1 { font-size: 1.1em; }
.ranking-toolbar .round-filter { margin-left: 0; }
@ -107,16 +167,15 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
</div>
<?php if ($selectedRound): ?>
<div class="table-container sticky-header">
<?php if (!empty($ranking)): ?>
<table>
<table class="ranking-table">
<thead>
<tr>
<th class="text-center">Platz</th>
<th>Name</th>
<th class="text-center"><span class="daily-winner-icon">🏆</span></th>
<th class="text-center">Punkte (Gesamt)</th>
<th class="text-center">Punkte (Runde)</th>
<th class="text-center">Punkte<br>(Gesamt)</th>
<th class="text-center">Punkte<br>(Runde)</th>
<?php foreach ($games as $game): ?>
<th class="game-header" colspan="2">
<?php echo htmlspecialchars($game['team1']); ?><br>
@ -131,6 +190,29 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
$rowClasses = [];
if ($entry['rank'] <= 3) $rowClasses[] = 'rank-' . $entry['rank'];
if ((int)$entry['user_id'] === (int)App\Core\Auth::id()) $rowClasses[] = 'me';
// Aufschlüsselung der Rundenpunkte für den Popup
$breakdownGamePoints = 0;
$breakdownRows = '';
foreach ($games as $game) {
$cell = $entry['cells'][$game['id']];
$pts = (int)$cell['points'];
$breakdownGamePoints += $pts;
$breakdownRows .= '<tr>'
. '<td>' . htmlspecialchars($game['team1'] . ' – ' . $game['team2']) . '</td>'
. '<td>' . htmlspecialchars($cell['text']) . ($cell['joker'] ? ' <span class="bd-joker">(Joker)</span>' : '') . '</td>'
. '<td class="bd-num">' . $pts . '</td>'
. '</tr>';
}
$breakdownBonus = (int)$entry['points'] - $breakdownGamePoints;
$breakdown = '<div class="bd-title">' . htmlspecialchars($entry['name']) . '</div>'
. '<table class="bd-table"><thead><tr><th>Spiel</th><th>Tipp</th><th>Punkte</th></tr></thead>'
. '<tbody>' . $breakdownRows . '</tbody></table>'
. '<div class="bd-line">Spiele gesamt: <strong>' . $breakdownGamePoints . ' P.</strong></div>';
if ($breakdownBonus > 0) {
$breakdown .= '<div class="bd-line">Rundenbonus (alle Spiele mind. Tendenz): <strong>+' . $breakdownBonus . ' P.</strong></div>';
}
$breakdown .= '<div class="bd-line bd-total">Rundenpunkte: <strong>' . (int)$entry['points'] . ' P.</strong></div>';
?>
<tr<?php if ($rowClasses) echo ' class="' . implode(' ', $rowClasses) . '"'; ?>
<?php if ((int)$entry['user_id'] === (int)App\Core\Auth::id()) echo ' id="me-row"'; ?>>
@ -138,7 +220,7 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
<td><?php echo htmlspecialchars($entry['name']); ?></td>
<td class="text-center"><?php echo $entry['is_day_winner'] ? '<span class="daily-winner-icon">🏆</span>' : ''; ?></td>
<td class="text-center"><strong><?php echo $entry['total']; ?></strong></td>
<td class="text-center"><?php echo $entry['points']; ?></td>
<td class="text-center"><button type="button" class="round-points-link" data-breakdown="<?php echo htmlspecialchars($breakdown, ENT_QUOTES); ?>"><?php echo (int)$entry['points']; ?></button></td>
<?php foreach ($games as $game): ?>
<?php
$tipp = $entry['cells'][$game['id']];
@ -162,7 +244,6 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
<?php else: ?>
<p>Für diese Saison gibt es noch keine Rangliste (möglicherweise haben noch keine Spieler bezahlt).</p>
<?php endif; ?>
</div>
<div class="legend legend-footer">
<div class="legend-item"><span class="daily-winner-icon">🏆</span> Tagessieger</div>
@ -175,6 +256,14 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
<p>Keine Runde für die Anzeige ausgewählt oder gefunden.</p>
<?php endif; ?>
<div class="breakdown-modal" id="breakdown-modal" hidden>
<div class="breakdown-modal-backdrop" data-close></div>
<div class="breakdown-modal-dialog" role="dialog" aria-modal="true">
<button type="button" class="breakdown-modal-close" data-close aria-label="Schließen">&times;</button>
<div class="breakdown-modal-body" id="breakdown-modal-body"></div>
</div>
</div>
<script>
// Springe beim Laden zur eigenen Zeile, falls der eingeloggte Spieler in der Tabelle ist
window.addEventListener('load', function () {
@ -183,6 +272,27 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
me.scrollIntoView({ block: 'center' });
}
});
(function () {
var modal = document.getElementById('breakdown-modal');
var body = document.getElementById('breakdown-modal-body');
if (!modal || !body) return;
function open(html) { body.innerHTML = html; modal.hidden = false; }
function close() { modal.hidden = true; }
document.querySelectorAll('.round-points-link').forEach(function (btn) {
btn.addEventListener('click', function () {
open(btn.getAttribute('data-breakdown'));
});
});
modal.addEventListener('click', function (e) {
if (e.target.hasAttribute && e.target.hasAttribute('data-close')) close();
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape') close();
});
})();
</script>
<?php require __DIR__ . '/partials/footer.php'; ?>