Portalnavigation nach Reload beibehalten

This commit is contained in:
gitea_admin committed 2026-09-20 13:13:39 +02:00
1 parent e6431dbe66
commit f1b090ee85
1 file changed
+10 -6
+10 -6
View File
@@ -924,7 +924,8 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM
echo " const heading = document.querySelector('[data-main-heading]');"; echo " const heading = document.querySelector('[data-main-heading]');";
echo " if (heading && portalModuleHeadings[moduleName]) { heading.textContent = portalModuleHeadings[moduleName]; }"; echo " if (heading && portalModuleHeadings[moduleName]) { heading.textContent = portalModuleHeadings[moduleName]; }";
echo "};"; echo "};";
echo "const renderLeftNavigation = (moduleName) => {"; echo "const updatePortalLocation = (moduleName, entryName = '') => { const url = new URL(window.location.href); url.searchParams.set('portal_module', moduleName); if (entryName) { url.searchParams.set('portal_section', entryName); } else { url.searchParams.delete('portal_section'); } window.history.replaceState({ ...(window.history.state || {}), portalModule: moduleName, portalSection: entryName }, '', url); };";
echo "const renderLeftNavigation = (moduleName, requestedEntry = '') => {";
echo " const title = document.querySelector('[data-left-navigation-title]');"; echo " const title = document.querySelector('[data-left-navigation-title]');";
echo " const contentTitle = document.querySelector('[data-left-navigation-content-title]');"; echo " const contentTitle = document.querySelector('[data-left-navigation-content-title]');";
echo " const contentSection = document.querySelector('.sg-left-navigation-pattern__group-card--content');"; echo " const contentSection = document.querySelector('.sg-left-navigation-pattern__group-card--content');";
@@ -933,7 +934,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM
echo " if (title) { title.textContent = moduleName; }"; echo " if (title) { title.textContent = moduleName; }";
echo " if (!menu) { return; }"; echo " if (!menu) { return; }";
echo " const entries = portalModuleNavigation[moduleName] || [];"; echo " const entries = portalModuleNavigation[moduleName] || [];";
echo " const activeEntry = entries[0] || '';"; echo " const activeEntry = entries.includes(requestedEntry) ? requestedEntry : (entries[0] || '');";
echo " if (contentTitle) { contentTitle.textContent = activeEntry; }"; echo " if (contentTitle) { contentTitle.textContent = activeEntry; }";
echo " if (contentSection) { contentSection.setAttribute('aria-hidden', 'false'); }"; echo " if (contentSection) { contentSection.setAttribute('aria-hidden', 'false'); }";
echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[activeEntry] || ''; }"; echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[activeEntry] || ''; }";
@@ -961,10 +962,11 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM
echo " if (contentTitle) { contentTitle.textContent = entryName; }"; echo " if (contentTitle) { contentTitle.textContent = entryName; }";
echo " if (contentSection) { contentSection.setAttribute('aria-hidden', 'false'); }"; echo " if (contentSection) { contentSection.setAttribute('aria-hidden', 'false'); }";
echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[entryName] || ''; }"; echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[entryName] || ''; }";
echo " if (entryName === 'Bestellungen') { initBestellungenBindings(); }"; echo " if (entryName === 'Bestellungen') { initBestellungenBindings(); }";
echo " if (entryName === 'Marktdurchführungen') { initMarketsBindings(); }"; echo " if (entryName === 'Marktdurchführungen') { initMarketsBindings(); }";
echo " if (entryName === 'Märkte') { initMarketDefinitionsBindings(); }"; echo " if (entryName === 'Märkte') { initMarketDefinitionsBindings(); }";
echo " if (entryName === 'Lager' || entryName === 'Artikel') { initLagerBindings(); }"; echo " if (entryName === 'Lager' || entryName === 'Artikel') { initLagerBindings(); }";
echo " updatePortalLocation(moduleName, entryName);";
echo " });"; echo " });";
echo " });"; echo " });";
echo "};"; echo "};";
@@ -978,9 +980,11 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $otcM
echo " });"; echo " });";
echo " renderMainHeading(button.textContent.trim());"; echo " renderMainHeading(button.textContent.trim());";
echo " renderLeftNavigation(button.textContent.trim());"; echo " renderLeftNavigation(button.textContent.trim());";
echo " updatePortalLocation(button.textContent.trim());";
echo " });"; echo " });";
echo " });"; 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 "document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {";
echo " const button = wrap.querySelector('.sg-sandwich-button');"; echo " const button = wrap.querySelector('.sg-sandwich-button');";
echo " button.addEventListener('click', (event) => {"; echo " button.addEventListener('click', (event) => {";