diff --git a/README.md b/README.md index f35a263..f7fd944 100644 --- a/README.md +++ b/README.md @@ -168,13 +168,15 @@ Das Projekt basiert auf bewährten Web-Standards: ### 06.12.2025 * **Rucksäcke:** * Neues Feld für Hersteller-Link (Product URL) hinzugefügt. - * "Info"-Button in der Übersicht öffnet den hinterlegten Link. + * "Info"-Button in der Übersicht öffnet den hinterlegten Link (Design angepasst auf Grün). * Fix: Eingabefeld für neue Hersteller erscheint nun zuverlässig. * **Artikel:** * Komfort-Funktion: Auswahl aus den letzten 24 hochgeladenen Bildern beim Erstellen neuer Artikel hinzugefügt. * **Packlisten:** * **Editor:** Filter-Optionen ("Alle Kategorien", "Alle Hersteller") korrigiert und erweitert. - * **Erstellung:** Validierung hinzugefügt, die verhindert, dass ein Rucksack mehrfach zugewiesen wird. + * **Erstellung:** + * Validierung hinzugefügt, die verhindert, dass ein Rucksack mehrfach zugewiesen wird. + * **Critical Fix:** Browser-Freeze durch Endlosschleife bei der Validierung behoben. * **Details:** - * Design-Update: Diagramme verwenden nun Grüntöne passend zum Thema. + * Design-Update: Diagramme verwenden nun kontrastreiche Grüntöne passend zum Thema (ohne weiße Rahmen). * Statistik: Klickbare Trägernamen öffnen ein Modal mit detaillierten Gewichtsstatistiken pro Kategorie. diff --git a/src/add_packing_list.php b/src/add_packing_list.php index c456d6d..a116ef0 100644 --- a/src/add_packing_list.php +++ b/src/add_packing_list.php @@ -239,27 +239,18 @@ document.addEventListener('DOMContentLoaded', function() { } } - // Observe changes. - // The modal script updates the hidden input. We can listen to a custom event or use MutationObserver. - // Or simply listen to clicks on the "Select" buttons in the modal, but the modal logic is separate. - // However, the `render_backpack_modal_script` updates the UI and the hidden input. - // We can attach a MutationObserver to the form to detect value changes or DOM changes in the backpack cards. - - const observer = new MutationObserver(function(mutations) { - validateBackpacks(); - }); - - observer.observe(document.querySelector('.card-body'), { - subtree: true, - attributes: true, // value change might not trigger attribute change in DOM for inputs, but innerHTML changes of cards do - childList: true - }); - // Also listen to participation checkboxes document.querySelectorAll('.participation-check').forEach(chk => { chk.addEventListener('change', validateBackpacks); }); + // Listen for modal close/hide events (bootstrap specific) to re-validate + // Since the backpack selection happens in a modal, validating on modal hide is efficient. + // We use event delegation or attach to body since modals might be dynamically inserted/removed (though here they are static in footer usually) + document.body.addEventListener('hidden.bs.modal', function (event) { + validateBackpacks(); + }); + // Initial check validateBackpacks(); }); diff --git a/src/backpacks.php b/src/backpacks.php index 4e13ee7..be2f0ac 100644 --- a/src/backpacks.php +++ b/src/backpacks.php @@ -126,7 +126,7 @@ while ($row = $result->fetch_assoc()) {