<?php
// footer.php - Globale Footer-Struktur
?>
            <footer class="main-footer">
        &copy; <?php echo date('Y'); ?> Trekking Packliste
    </footer>
    </div> </div> 

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
            tooltipTriggerList.map(function (tooltipTriggerEl) {
                return new bootstrap.Tooltip(tooltipTriggerEl);
            });

            const currentPath = window.location.pathname.split('/').pop();
            const sidebarLinks = document.querySelectorAll('.sidebar .nav-link');
            
            const parentMap = {
                'add_article.php': 'articles.php', 
                'edit_article.php': 'articles.php',
                'add_packing_list.php': 'packing_lists.php',
                'edit_packing_list_details.php': 'packing_lists.php',
                'manage_packing_list_items.php': 'packing_lists.php',
                'packing_list_detail.php': 'packing_lists.php',
                'share_packing_list.php': 'packing_lists.php',
                'duplicate_packing_list.php': 'packing_lists.php'
            };
            
            const activePage = parentMap[currentPath] || currentPath;
            
            sidebarLinks.forEach(link => {
                const linkPath = link.getAttribute('href');
                if (linkPath === activePage) {
                    link.classList.add('active');
                } else {
                    link.classList.remove('active');
                }
            });

            var invitationModalElement = document.getElementById('invitationModal');
            if (invitationModalElement) {
                var invitationModal = new bootstrap.Modal(invitationModalElement);
                invitationModal.show();
            }
        });
    </script>
</body>
</html>
