Schnitzeljagd: Einsendungen je Ort einklappbar, Filter Unbewertet / Anerkannt / Abgelehnt
Orte mit ungeprueften Einsendungen sind aufgeklappt (mit Zaehler), der Filter bleibt nach dem Bewerten erhalten; Plaetze und Punkte werden weiter ueber alle Einsendungen gerechnet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cc84faaa72
commit
45875d6200
3 changed files with 65 additions and 12 deletions
|
|
@ -10135,9 +10135,17 @@ a.hunt-spot-image { border: none; border-radius: 0; aspect-ratio: 16 / 9; backgr
|
|||
.hunt-add-spot { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); gap: 0.75rem; max-width: 560px; }
|
||||
.hunt-add-spot h3 { margin: 0; }
|
||||
|
||||
.hunt-review-spot { margin-top: 1.25rem; }
|
||||
.hunt-review-spot h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 0.6rem; }
|
||||
.hunt-review-spot h3 .text-muted { font-size: 0.85rem; font-weight: 400; }
|
||||
.hunt-review-filter { margin: 0.5rem 0 0.25rem; }
|
||||
.hunt-review-spot { margin-top: 0.6rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; scroll-margin-top: 1rem; }
|
||||
.hunt-review-spot > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; cursor: pointer; list-style: none; }
|
||||
.hunt-review-spot > summary::-webkit-details-marker { display: none; }
|
||||
.hunt-review-spot > summary::after { content: '▾'; margin-left: auto; color: var(--text-muted); }
|
||||
.hunt-review-spot[open] > summary::after { content: '▴'; }
|
||||
.hunt-review-spot[open] > summary { margin-bottom: 0.6rem; }
|
||||
.hunt-review-spot-title { font-size: 1.1rem; font-weight: 700; color: var(--gold); }
|
||||
.hunt-review-spot > summary:hover .hunt-review-spot-title { color: var(--gold-hover); }
|
||||
.hunt-review-spot > summary .text-muted { font-size: 0.85rem; }
|
||||
.hunt-review-spot > p { margin: 0.25rem 0 0.4rem; }
|
||||
a.hunt-review-spot-thumb { width: 64px; height: 40px; flex-shrink: 0; }
|
||||
.hunt-submission { display: grid; grid-template-columns: 56px minmax(170px, 1fr) minmax(220px, 1.2fr) minmax(240px, 1.2fr); gap: 0.9rem; align-items: center; padding: 0.75rem; margin-bottom: 0.5rem; background: var(--bg-panel-alt); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 8px; scroll-margin-top: 1rem; }
|
||||
.hunt-submission-accepted { border-left-color: var(--success); }
|
||||
|
|
|
|||
58
hunt.php
58
hunt.php
|
|
@ -118,9 +118,18 @@ $number = 0;
|
|||
foreach ($spots as $spot) {
|
||||
$labels[(int) $spot['id']] = hunt_spot_label($spot, empty($spot['is_bonus']) ? ++$number : 0);
|
||||
}
|
||||
$pendingTotal = 0;
|
||||
// Einsendungen nach Status zaehlen - fuer die Filter der Leitung (?status=pending|accepted|rejected)
|
||||
$statusCounts = ['pending' => 0, 'accepted' => 0, 'rejected' => 0];
|
||||
foreach ($bySpot as $rows) {
|
||||
$pendingTotal += count(array_filter($rows, static fn (array $r): bool => $r['status'] === 'pending'));
|
||||
foreach ($rows as $row) {
|
||||
$statusCounts[$row['status']]++;
|
||||
}
|
||||
}
|
||||
$pendingTotal = $statusCounts['pending'];
|
||||
$reviewFilters = ['all' => 'Alle', 'pending' => 'Unbewertet', 'accepted' => 'Anerkannt', 'rejected' => 'Abgelehnt'];
|
||||
$reviewFilter = (string) ($_GET['status'] ?? 'all');
|
||||
if (!array_key_exists($reviewFilter, $reviewFilters)) {
|
||||
$reviewFilter = 'all';
|
||||
}
|
||||
|
||||
$pageTitle = $hunt['title'] . ' - Schnitzeljagd';
|
||||
|
|
@ -283,16 +292,37 @@ include __DIR__ . '/includes/header.php';
|
|||
<div class="panel" id="einsendungen">
|
||||
<h2>Einsendungen</h2>
|
||||
<p class="text-muted">Nur die Leitung sieht diese Bilder. Beim Anerkennen die Uhrzeit eintragen, die im Spiel auf dem Screenshot zu sehen ist (vorausgefüllt mit der Upload-Zeit) – danach richten sich Reihenfolge, Platz und Punkte; bei gleicher Uhrzeit zählt, wer zuerst hochgeladen hat. Punkte gibt es nur für anerkannte Einsendungen.</p>
|
||||
<div class="filter-tabs hunt-review-filter">
|
||||
<?php foreach ($reviewFilters as $key => $filterLabel): ?>
|
||||
<a href="/hunt.php?id=<?= $huntId ?><?= $key !== 'all' ? '&status=' . e($key) : '' ?>#einsendungen" class="filter-tab<?= $reviewFilter === $key ? ' active' : '' ?>">
|
||||
<?= e($filterLabel) ?> <span class="filter-tab-count"><?= $key === 'all' ? array_sum($statusCounts) : $statusCounts[$key] ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if (!$spots): ?>
|
||||
<p class="text-muted">Noch keine Orte.</p>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($spots as $spot): ?>
|
||||
<?php $spotId = (int) $spot['id']; $rows = $bySpot[$spotId] ?? []; ?>
|
||||
<section class="hunt-review-spot">
|
||||
<h3><?= hunt_thumb_html('spot', $spotId, 'review-spot-' . $spotId, $labels[$spotId], 'hunt-review-spot-thumb') ?> <?= e($labels[$spotId]) ?>
|
||||
<span class="text-muted"><?= count($rows) ?> <?= count($rows) === 1 ? 'Einsendung' : 'Einsendungen' ?></span></h3>
|
||||
<?php
|
||||
$spotId = (int) $spot['id'];
|
||||
$allRows = $bySpot[$spotId] ?? [];
|
||||
// Gefiltert wird nur die Anzeige - Plaetze und Punkte sind ueber alle Einsendungen gerechnet
|
||||
$rows = $reviewFilter === 'all' ? $allRows : array_values(array_filter($allRows, static fn (array $r): bool => $r['status'] === $reviewFilter));
|
||||
$spotPending = count(array_filter($allRows, static fn (array $r): bool => $r['status'] === 'pending'));
|
||||
// Aufgeklappt, solange hier etwas zu pruefen ist bzw. der gewaehlte Filter hier etwas zeigt
|
||||
$spotOpen = $reviewFilter === 'all' ? $spotPending > 0 : $rows !== [];
|
||||
?>
|
||||
<details class="hunt-review-spot" id="einsendungen-ort-<?= $spotId ?>"<?= $spotOpen ? ' open' : '' ?>>
|
||||
<summary>
|
||||
<?= hunt_thumb_html('spot', $spotId, 'review-spot-' . $spotId, $labels[$spotId], 'hunt-review-spot-thumb') ?>
|
||||
<span class="hunt-review-spot-title"><?= e($labels[$spotId]) ?></span>
|
||||
<span class="text-muted"><?= count($allRows) ?> <?= count($allRows) === 1 ? 'Einsendung' : 'Einsendungen' ?></span>
|
||||
<?php if ($spotPending > 0): ?>
|
||||
<span class="badge badge-pending"><?= $spotPending ?> unbewertet</span>
|
||||
<?php endif; ?>
|
||||
</summary>
|
||||
<?php if (!$rows): ?>
|
||||
<p class="text-muted">Noch keine Einsendungen.</p>
|
||||
<p class="text-muted"><?= $allRows ? 'Keine Einsendungen in dieser Ansicht.' : 'Noch keine Einsendungen.' ?></p>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($rows as $row): ?>
|
||||
<?php
|
||||
|
|
@ -330,6 +360,7 @@ include __DIR__ . '/includes/header.php';
|
|||
<input type="hidden" name="action" value="review">
|
||||
<input type="hidden" name="hunt_id" value="<?= $huntId ?>">
|
||||
<input type="hidden" name="submission_id" value="<?= (int) $row['id'] ?>">
|
||||
<input type="hidden" name="filter" value="<?= e($reviewFilter) ?>">
|
||||
<div class="hunt-review-head">
|
||||
<?= hunt_status_badge((string) $row['status']) ?>
|
||||
<?php if ($reviewer !== null): ?>
|
||||
|
|
@ -350,7 +381,7 @@ include __DIR__ . '/includes/header.php';
|
|||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
</details>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
@ -415,4 +446,15 @@ include __DIR__ . '/includes/header.php';
|
|||
|
||||
<script src="<?= e(asset_url('/assets/js/image-resize.js')) ?>"></script>
|
||||
<script src="<?= e(asset_url('/assets/js/lightbox.js')) ?>" defer></script>
|
||||
<script>
|
||||
// Sprungmarke (z.B. nach dem Bewerten) in einem zugeklappten Ort: aufklappen und hinscrollen
|
||||
(function () {
|
||||
var target = location.hash.length > 1 ? document.getElementById(location.hash.slice(1)) : null;
|
||||
var details = target && target.closest('details');
|
||||
if (details && !details.open) {
|
||||
details.open = true;
|
||||
target.scrollIntoView();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||
|
|
|
|||
|
|
@ -298,7 +298,10 @@ if ($action === 'review') {
|
|||
$status === 'pending' ? null : date('Y-m-d H:i:s'),
|
||||
$submissionId,
|
||||
]);
|
||||
redirect($back($huntId, 'einsendung-' . $submissionId));
|
||||
// Zurueck in denselben Filter (Unbewertet, Anerkannt, ...) - gerade Bewertetes kann daraus verschwinden
|
||||
$filter = (string) ($_POST['filter'] ?? '');
|
||||
$query = in_array($filter, ['pending', 'accepted', 'rejected'], true) ? '&status=' . $filter : '';
|
||||
redirect('/hunt.php?id=' . $huntId . $query . '#' . ($query !== '' && $filter !== $status ? 'einsendungen-ort-' . (int) $submission['spot_id'] : 'einsendung-' . $submissionId));
|
||||
}
|
||||
|
||||
redirect($back($huntId));
|
||||
|
|
|
|||
Loading…
Reference in a new issue