Update heading by selected module
This commit is contained in:
@@ -14,6 +14,15 @@ function render_auth_home_page(array $user): void
|
||||
],
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
|
||||
);
|
||||
$moduleHeadings = json_encode(
|
||||
[
|
||||
'Übersicht' => 'Willkommen bei Naurua Übersicht',
|
||||
'ERP' => 'Willkommen bei Naurua ERP',
|
||||
'Buchhaltung' => 'Willkommen bei Naurua Buchhaltung',
|
||||
'Kundenberatung' => 'Willkommen bei Naurua Kundenberatung',
|
||||
],
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
|
||||
);
|
||||
|
||||
echo '<!doctype html>';
|
||||
echo '<html lang="de">';
|
||||
@@ -52,7 +61,7 @@ function render_auth_home_page(array $user): void
|
||||
echo '</div>';
|
||||
echo '</header>';
|
||||
echo '</article>';
|
||||
echo '<h1 class="sg-main-heading">Willkommen im Naurua ERP</h1>';
|
||||
echo '<h1 class="sg-main-heading" data-main-heading aria-live="polite">Willkommen bei Naurua ERP</h1>';
|
||||
echo '<section class="sg-left-navigation-pattern" aria-label="Linke Navigation">';
|
||||
echo '<div class="sg-left-navigation-pattern__layout" aria-label="Left Navigation Demo">';
|
||||
echo '<aside class="sg-group-card sg-left-navigation-pattern__group-card sg-left-navigation-pattern__group-card--navigation" data-component="group-card" aria-label="Navigation">';
|
||||
@@ -72,6 +81,11 @@ function render_auth_home_page(array $user): void
|
||||
echo '</section>';
|
||||
echo '<script>';
|
||||
echo 'const portalModuleNavigation = ' . $moduleNavigation . ';';
|
||||
echo 'const portalModuleHeadings = ' . $moduleHeadings . ';';
|
||||
echo "const renderMainHeading = (moduleName) => {";
|
||||
echo " const heading = document.querySelector('[data-main-heading]');";
|
||||
echo " if (heading && portalModuleHeadings[moduleName]) { heading.textContent = portalModuleHeadings[moduleName]; }";
|
||||
echo "};";
|
||||
echo "const renderLeftNavigation = (moduleName) => {";
|
||||
echo " const title = document.querySelector('[data-left-navigation-title]');";
|
||||
echo " const menu = document.getElementById('left-navigation-menu');";
|
||||
@@ -105,6 +119,7 @@ function render_auth_home_page(array $user): void
|
||||
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 " });";
|
||||
echo " });";
|
||||
@@ -160,6 +175,7 @@ function render_auth_home_page(array $user): void
|
||||
echo " syncMode();";
|
||||
echo " mediaQuery.addEventListener('change', syncMode);";
|
||||
echo "})();";
|
||||
echo "renderMainHeading('ERP');";
|
||||
echo "renderLeftNavigation('ERP');";
|
||||
echo '</script>';
|
||||
echo '</body>';
|
||||
|
||||
Reference in New Issue
Block a user