"use strict"; document.addEventListener('DOMContentLoaded', () => { const brandNav = document.querySelector('#brandNav'); if (brandNav) { brandNav.addEventListener('click', () => { window.location.href = '/'; }); } const homeNav = document.querySelector('#homeNav'); if (homeNav) { homeNav.addEventListener('click', () => { window.location.href = '/'; }); } const inventoryNav = document.querySelector('#inventoryNav'); if (inventoryNav) { inventoryNav.addEventListener('click', () => { window.location.href = '/inventory'; }); } const loginNav = document.querySelector('#loginNav'); if (loginNav) { loginNav.addEventListener('click', () => { window.location.href = '/login'; }); } const settingsNav = document.querySelector('#settingsNav'); if (settingsNav) { settingsNav.addEventListener('click', () => { window.location.href = '/settings'; }); } const ordersNav = document.querySelector('#ordersNav'); if (ordersNav) { ordersNav.addEventListener('click', () => { window.location.href = '/orders'; }); } const boxesNav = document.querySelector('#boxesNav'); if (boxesNav) { boxesNav.addEventListener('click', () => { window.location.href = '/boxes'; }); } const logoutNav = document.querySelector('#logoutNav'); if (logoutNav) { logoutNav.addEventListener('click', (event) => { event.preventDefault(); // Prevent default link behavior $.get('/auth/logout', function (data) { window.location.href = '/login'; }).fail((jqXHR) => { alert('Logout failed: ' + jqXHR.responseText); }); }); } });