From d63b3d86d2a750acfea0d94e01759c9b624323e7 Mon Sep 17 00:00:00 2001 From: fds2610-bot Date: Thu, 23 Jul 2026 15:30:16 +0200 Subject: [PATCH] =?UTF-8?q?Spaltenfilter=20im=20Dashboard=20hinzugef=C3=BC?= =?UTF-8?q?gt,=20Docker-Dateien=20in=20.gitignore=20aufgenommen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jede Tabellenspalte im Dashboard bekommt eine eigene Filterzeile (Text- oder Dropdown-Filter je nach Spalte), die die sichtbaren Einträge clientseitig per JS einschränkt. Co-Authored-By: Claude Sonnet 5 --- .gitignore | 2 + html/assets/css/style.css | 25 ++++++++++ html/dashboard.php | 101 +++++++++++++++++++++++++++++++++++++- 3 files changed, 127 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b13a64d..f4296b5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ info.php config.php *.old html/.Trash-1000 +Dockerfile +docker-compose.yml diff --git a/html/assets/css/style.css b/html/assets/css/style.css index f53fce6..56574e4 100644 --- a/html/assets/css/style.css +++ b/html/assets/css/style.css @@ -326,6 +326,31 @@ tr:hover { display: inline-block; } +/* Spaltenfilter im Tabellenkopf */ +tr.filter-row th { + background: white; + padding: 6px 8px; + text-transform: none; + letter-spacing: normal; + font-weight: normal; +} + +.column-filter { + width: 100%; + box-sizing: border-box; + padding: 6px 8px; + border: 1px solid #ddd; + border-radius: 6px; + font-size: 0.85em; + color: #333; + background: white; +} + +.column-filter:focus { + outline: none; + border-color: var(--primary-color); +} + /* Button */ .btn-xr { diff --git a/html/dashboard.php b/html/dashboard.php index 9079c20..ba584cb 100644 --- a/html/dashboard.php +++ b/html/dashboard.php @@ -70,6 +70,39 @@ $stmt->execute([ 'month' => $month ]); $entries = $stmt->fetchAll(); + +// Eindeutige Werte für die Filter-Dropdowns ermitteln +$filterZahler = []; +$filterPersonen = []; +$filterKategorie = []; +$filterZahlweise = []; +foreach ($entries as $entry) { + if (!empty($entry['zahler'])) { + $filterZahler[$entry['zahler']] = true; + } + if (!empty($entry['personen'])) { + foreach (explode(',', $entry['personen']) as $person) { + $person = trim($person); + if ($person !== '') { + $filterPersonen[$person] = true; + } + } + } + if (!empty($entry['kategorie'])) { + $filterKategorie[$entry['kategorie']] = true; + } + if (!empty($entry['zahlweise'])) { + $filterZahlweise[$entry['zahlweise']] = true; + } +} +$filterZahler = array_keys($filterZahler); +$filterPersonen = array_keys($filterPersonen); +$filterKategorie = array_keys($filterKategorie); +$filterZahlweise = array_keys($filterZahlweise); +sort($filterZahler, SORT_STRING | SORT_FLAG_CASE); +sort($filterPersonen, SORT_STRING | SORT_FLAG_CASE); +sort($filterKategorie, SORT_STRING | SORT_FLAG_CASE); +sort($filterZahlweise, SORT_STRING | SORT_FLAG_CASE); ?> @@ -116,8 +149,47 @@ $entries = $stmt->fetchAll(); Hinweis   + + + + + + + + + + + + + + + + + +  + - + @@ -147,6 +219,33 @@ $entries = $stmt->fetchAll(); document.querySelector('.hamburger').addEventListener('click', function() { document.querySelector('.nav-list').classList.toggle('show'); }); + +// Spaltenfilter für die Tabelle +(function() { + const filters = document.querySelectorAll('.column-filter'); + const rows = document.querySelectorAll('#entries-body tr'); + + function applyFilters() { + const activeFilters = Array.from(filters) + .map(f => ({ col: parseInt(f.dataset.col, 10), value: f.value.trim().toLowerCase() })) + .filter(f => f.value !== ''); + + rows.forEach(row => { + const cells = row.children; + const visible = activeFilters.every(f => { + const cell = cells[f.col]; + if (!cell) return true; + return cell.textContent.trim().toLowerCase().includes(f.value); + }); + row.style.display = visible ? '' : 'none'; + }); + } + + filters.forEach(f => { + f.addEventListener('input', applyFilters); + f.addEventListener('change', applyFilters); + }); +})();