diff --git a/html/dashboard.php b/html/dashboard.php index ba584cb..8a89440 100644 --- a/html/dashboard.php +++ b/html/dashboard.php @@ -95,6 +95,11 @@ foreach ($entries as $entry) { $filterZahlweise[$entry['zahlweise']] = true; } } +// Vorauswahl der Filter aus GET-Parametern (z. B. Link aus einem Report) +$presetZahler = isset($_GET['zahler']) ? $_GET['zahler'] : ''; +$presetKategorie = isset($_GET['kategorie']) ? $_GET['kategorie'] : ''; +$presetKategorien = isset($_GET['kategorien']) && is_array($_GET['kategorien']) ? $_GET['kategorien'] : []; + $filterZahler = array_keys($filterZahler); $filterPersonen = array_keys($filterPersonen); $filterKategorie = array_keys($filterKategorie); @@ -155,7 +160,7 @@ sort($filterZahlweise, SORT_STRING | SORT_FLAG_CASE); @@ -171,7 +176,7 @@ sort($filterZahlweise, SORT_STRING | SORT_FLAG_CASE); @@ -224,6 +229,8 @@ document.querySelector('.hamburger').addEventListener('click', function() { (function() { const filters = document.querySelectorAll('.column-filter'); const rows = document.querySelectorAll('#entries-body tr'); + // Mehrfach-Kategorie-Vorauswahl, z. B. per Link aus dem Personenreport (Kategorie-Select kann nur einen Wert anzeigen) + const presetKategorien = ; function applyFilters() { const activeFilters = Array.from(filters) @@ -236,7 +243,7 @@ document.querySelector('.hamburger').addEventListener('click', function() { const cell = cells[f.col]; if (!cell) return true; return cell.textContent.trim().toLowerCase().includes(f.value); - }); + }) && (presetKategorien.length === 0 || (cells[3] && presetKategorien.includes(cells[3].textContent.trim().toLowerCase()))); row.style.display = visible ? '' : 'none'; }); } @@ -245,6 +252,8 @@ document.querySelector('.hamburger').addEventListener('click', function() { f.addEventListener('input', applyFilters); f.addEventListener('change', applyFilters); }); + + applyFilters(); })(); diff --git a/html/rep-month.php b/html/rep-month.php index 9efe683..ede26bc 100644 --- a/html/rep-month.php +++ b/html/rep-month.php @@ -152,7 +152,11 @@ if (isset($_GET['export']) && $_GET['export'] === 'csv') { - + + + + + diff --git a/html/rep-person.php b/html/rep-person.php index a60e138..d1aba93 100644 --- a/html/rep-person.php +++ b/html/rep-person.php @@ -32,10 +32,10 @@ $categoryStmt = $pdo->query("SELECT category_id, name FROM categories ORDER BY n $categories = $categoryStmt->fetchAll(); // Standardmäßig alle Kategorien auswählen, falls keine Auswahl getroffen wurde -// $selectedCategories = isset($_GET['categories']) ? $_GET['categories'] : array_column($categories, 'category_id'); - if (array_key_exists('categories', $_GET) && $_GET['categories'] !== []) { $selectedCategories = $_GET['categories']; +} else { + $selectedCategories = array_column($categories, 'category_id'); } @@ -60,6 +60,14 @@ $params = array_merge([$month, $year], $selectedCategories); $stmt = $pdo->prepare($sql); $stmt->execute($params); $entries = $stmt->fetchAll(); + +// Namen der aktuell ausgewählten Kategorien ermitteln (für den Link zum Dashboard) +$selectedCategoryNames = []; +foreach ($categories as $category) { + if (in_array($category['category_id'], $selectedCategories)) { + $selectedCategoryNames[] = $category['name']; + } +} ?> @@ -126,7 +134,16 @@ $entries = $stmt->fetchAll(); - + + + + +