From 6750d4778f33aaef06ba9c494f6a6ce1d8e69ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Gla=CC=88ser?= Date: Sun, 20 Sep 2026 13:18:26 +0200 Subject: [PATCH] Gespeicherte Portalnavigation beim Reload wiederherstellen --- modules/shared/auth/ui/home.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/shared/auth/ui/home.php b/modules/shared/auth/ui/home.php index 690c80b..7f4e106 100644 --- a/modules/shared/auth/ui/home.php +++ b/modules/shared/auth/ui/home.php @@ -960,7 +960,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM echo " button.type = 'button';"; echo " button.setAttribute('role', 'tab');"; echo " button.setAttribute('data-component-part', 'tab-button');"; - echo " button.setAttribute('aria-selected', String(index === 0));"; + echo " button.setAttribute('aria-selected', String(entry === activeEntry));"; echo " button.textContent = entry;"; echo " menu.appendChild(button);"; echo " });"; @@ -970,6 +970,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM echo " otherButton.setAttribute('aria-selected', String(otherButton === button));"; echo " });"; echo " const entryName = button.textContent.trim();"; + echo " updatePortalLocation(moduleName, entryName);"; echo " if (contentTitle) { contentTitle.textContent = entryName; }"; echo " if (contentSection) { contentSection.setAttribute('aria-hidden', 'false'); }"; echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[entryName] || ''; }"; @@ -977,7 +978,6 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM echo " if (entryName === 'Marktdurchführungen') { initMarketsBindings(); }"; echo " if (entryName === 'Märkte') { initMarketDefinitionsBindings(); }"; echo " if (entryName === 'Lager' || entryName === 'Artikel') { initLagerBindings(); }"; - echo " updatePortalLocation(moduleName, entryName);"; echo " });"; echo " });"; echo "};"; @@ -989,13 +989,13 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM echo " otherButton.setAttribute('aria-selected', String(isActive));"; echo " otherButton.dataset.componentState = isActive ? 'active' : 'inactive';"; echo " });"; - echo " renderMainHeading(button.textContent.trim());"; - echo " renderLeftNavigation(button.textContent.trim());"; - echo " updatePortalLocation(button.textContent.trim());"; + echo " const moduleName = button.textContent.trim();"; + echo " updatePortalLocation(moduleName);"; + echo " renderMainHeading(moduleName);"; + echo " renderLeftNavigation(moduleName);"; echo " });"; echo " });"; echo "});"; - echo "(() => { const url = new URL(window.location.href); const requestedModule = url.searchParams.get('portal_module') || 'ERP'; const moduleButton = Array.from(document.querySelectorAll('.sg-portal-header__tabs .sg-tab-button')).find((button) => button.textContent.trim() === requestedModule) || document.querySelector('.sg-portal-header__tabs .sg-tab-button'); if (!moduleButton) { return; } const moduleName = moduleButton.textContent.trim(); document.querySelectorAll('.sg-portal-header__tabs .sg-tab-button').forEach((button) => { const active = button === moduleButton; button.setAttribute('aria-selected', String(active)); button.dataset.componentState = active ? 'active' : 'inactive'; }); renderMainHeading(moduleName); renderLeftNavigation(moduleName, url.searchParams.get('portal_section') || ''); })();"; echo "document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {"; echo " const button = wrap.querySelector('.sg-sandwich-button');"; echo " button.addEventListener('click', (event) => {"; @@ -1895,8 +1895,7 @@ JS; echo " outsideClickIgnoreSelectors: ['.sg-sandwich-menu-wrap'],"; echo " });"; echo "}"; - echo "renderMainHeading('ERP');"; - echo "renderLeftNavigation('ERP');"; + echo "(() => { const url = new URL(window.location.href); const requestedModule = url.searchParams.get('portal_module') || 'ERP'; const moduleButton = Array.from(document.querySelectorAll('.sg-portal-header__tabs .sg-tab-button')).find((button) => button.textContent.trim() === requestedModule) || document.querySelector('.sg-portal-header__tabs .sg-tab-button'); if (!moduleButton) { return; } const moduleName = moduleButton.textContent.trim(); document.querySelectorAll('.sg-portal-header__tabs .sg-tab-button').forEach((button) => { const active = button === moduleButton; button.setAttribute('aria-selected', String(active)); button.dataset.componentState = active ? 'active' : 'inactive'; }); renderMainHeading(moduleName); renderLeftNavigation(moduleName, url.searchParams.get('portal_section') || ''); })();"; echo ''; echo ''; echo '';