Add OTC order basic card

This commit is contained in:
2026-06-15 12:52:21 +02:00
parent 85db0620c7
commit 49210bce01
2 changed files with 28 additions and 2 deletions
+23 -2
View File
@@ -14,6 +14,12 @@ function render_auth_home_page(array $user): void
],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
);
$moduleContentCards = json_encode(
[
'Bestellungen' => '<article class="sg-card" data-component="basic-card"><div class="sg-card-segment sg-card-segment--body sg-card-segment--gray" data-component-part="card-body"><div class="sg-component-row sg-basic-card__actions"><button class="sg-interaction-element sg-button sg-button--active" type="button" data-component="button" data-component-state="active">OTC-Bestellung erfassen</button></div></div></article>',
],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
);
$moduleHeadings = json_encode(
[
'Übersicht' => 'Willkommen bei Naurua Übersicht',
@@ -81,12 +87,22 @@ function render_auth_home_page(array $user): void
echo '<div class="sg-group-card__header-row sg-left-navigation-pattern__header-row">';
echo '<h2 class="sg-heading-h2 sg-text-on-dark sg-group-card__heading" data-left-navigation-content-title aria-live="polite">Bestellungen</h2>';
echo '</div>';
echo '<div data-left-navigation-content-body>';
echo '<article class="sg-card" data-component="basic-card">';
echo '<div class="sg-card-segment sg-card-segment--body sg-card-segment--gray" data-component-part="card-body">';
echo '<div class="sg-component-row sg-basic-card__actions">';
echo '<button class="sg-interaction-element sg-button sg-button--active" type="button" data-component="button" data-component-state="active">OTC-Bestellung erfassen</button>';
echo '</div>';
echo '</div>';
echo '</article>';
echo '</div>';
echo '</section>';
echo '</div>';
echo '</section>';
echo '</section>';
echo '<script>';
echo 'const portalModuleNavigation = ' . $moduleNavigation . ';';
echo 'const portalModuleContentCards = ' . $moduleContentCards . ';';
echo 'const portalModuleHeadings = ' . $moduleHeadings . ';';
echo "const renderMainHeading = (moduleName) => {";
echo " const heading = document.querySelector('[data-main-heading]');";
@@ -95,11 +111,14 @@ function render_auth_home_page(array $user): void
echo "const renderLeftNavigation = (moduleName) => {";
echo " const title = document.querySelector('[data-left-navigation-title]');";
echo " const contentTitle = document.querySelector('[data-left-navigation-content-title]');";
echo " const contentBody = document.querySelector('[data-left-navigation-content-body]');";
echo " const menu = document.getElementById('left-navigation-menu');";
echo " if (title) { title.textContent = moduleName; }";
echo " if (!menu) { return; }";
echo " const entries = portalModuleNavigation[moduleName] || [];";
echo " if (contentTitle) { contentTitle.textContent = entries[0] || ''; }";
echo " const activeEntry = entries[0] || '';";
echo " if (contentTitle) { contentTitle.textContent = activeEntry; }";
echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[activeEntry] || ''; }";
echo " menu.innerHTML = '';";
echo " entries.forEach((entry, index) => {";
echo " const button = document.createElement('button');";
@@ -116,7 +135,9 @@ function render_auth_home_page(array $user): void
echo " menu.querySelectorAll('.sg-tab-button').forEach((otherButton) => {";
echo " otherButton.setAttribute('aria-selected', String(otherButton === button));";
echo " });";
echo " if (contentTitle) { contentTitle.textContent = button.textContent.trim(); }";
echo " const entryName = button.textContent.trim();";
echo " if (contentTitle) { contentTitle.textContent = entryName; }";
echo " if (contentBody) { contentBody.innerHTML = portalModuleContentCards[entryName] || ''; }";
echo " });";
echo " });";
echo "};";