diff --git a/assets/css/style.css b/assets/css/style.css index e282978..2224de7 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -780,6 +780,12 @@ input[type="datetime-local"]::-webkit-calendar-picker-indicator { margin-top: 1rem; } +.report-user-filter-input { + display: block; + max-width: 320px; + margin-top: 0.75rem; +} + .filter-tab { padding: 0.4rem 0.9rem; border-radius: 999px; diff --git a/assets/js/reports.js b/assets/js/reports.js index 3a38e9e..61c558a 100644 --- a/assets/js/reports.js +++ b/assets/js/reports.js @@ -122,6 +122,30 @@ }); } + // ---- Nach Nutzer filtern (gemeldet oder Melder) ---- + function initUserFilter() { + var input = document.getElementById('report-user-filter'); + var rows = document.querySelectorAll('.report-row'); + var emptyMessage = document.getElementById('report-filter-empty'); + if (!input || !rows.length) return; + + input.addEventListener('input', function () { + var query = input.value.trim().toLowerCase(); + var visibleCount = 0; + + rows.forEach(function (row) { + var matches = query === '' + || (row.getAttribute('data-reported-name') || '').indexOf(query) !== -1 + || (row.getAttribute('data-reporter-name') || '').indexOf(query) !== -1; + row.hidden = !matches; + if (matches) visibleCount++; + }); + + if (emptyMessage) emptyMessage.hidden = visibleCount !== 0; + }); + } + initAddWeightModal(); initAddExclusionModal(); + initUserFilter(); })(); diff --git a/reports.php b/reports.php index ed61101..9ff1bb9 100644 --- a/reports.php +++ b/reports.php @@ -87,6 +87,9 @@ include __DIR__ . '/includes/header.php'; + + + @@ -129,7 +132,7 @@ include __DIR__ . '/includes/header.php'; $timestamp = (int) ($report['timestamp'] ?? 0); ?> - +
@@ -182,6 +185,7 @@ include __DIR__ . '/includes/header.php'; +
@@ -341,10 +345,10 @@ include __DIR__ . '/includes/header.php'; - - + +