From caa80b05051f5405ce74494ba7718a3b3cb866e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Gla=CC=88ser?= Date: Sun, 6 Sep 2026 10:32:21 +0200 Subject: [PATCH] Bestellungen-Drawer an Produkte-Card-Stil angleichen --- modules/shared/auth/ui/home.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/shared/auth/ui/home.php b/modules/shared/auth/ui/home.php index 4a8bc22..a266ec1 100644 --- a/modules/shared/auth/ui/home.php +++ b/modules/shared/auth/ui/home.php @@ -779,7 +779,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " '',"; echo " '',"; echo " '',"; - echo " '
',"; + echo " '
',"; echo " '
',"; echo " '

Bestellnummer: ' + escapeHtml(orderNumber) + '

',"; echo " '

Bestelldatum: ' + escapeHtml(orderDate) + '

',"; @@ -827,9 +827,9 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " const value = (label, content) => '

' + escapeHtml(label) + ': ' + escapeHtml(content || 'Nicht vorhanden') + '

';"; echo " const renderCards = (order) => {"; echo " const c = order.customer || {}; const a = order.amounts || {}; const address = [[c.street, c.house_number].filter(Boolean).join(' '), [c.zip, c.city].filter(Boolean).join(' '), c.country_name].filter(Boolean).join('
');"; - echo " const lines = (order.lines || []).map((line) => '

' + escapeHtml(line.item_name) + ' · ' + escapeHtml(line.item_code) + ' · Menge: ' + escapeHtml(String(line.qty)) + '

' + value('Positionsstatus', line.line_status) + value('Einzelpreis', formatAmount(line.unit_price, a.currency || 'CHF')) + value('Positionssumme', formatAmount(line.line_total, a.currency || 'CHF')) + '
').join('');"; + echo " const lines = (order.lines || []).map((line) => '

' + escapeHtml(line.item_name) + ' · ' + escapeHtml(line.item_code) + ' · Menge: ' + escapeHtml(String(line.qty)) + '

' + value('Positionsstatus', line.line_status) + value('Einzelpreis', formatAmount(line.unit_price, a.currency || 'CHF')) + value('Positionssumme', formatAmount(line.line_total, a.currency || 'CHF')) + '
').join('');"; echo " const allocations = (order.lines || []).flatMap((line) => (line.product_allocations || []).map((item) => '
' + escapeHtml(item.product_name) + ': ' + escapeHtml(item.lot_number || 'Nicht zugeordnet') + ' · ' + escapeHtml(item.allocated_qty === null ? 'Nicht zugeordnet' : String(item.allocated_qty)) + ' · ' + escapeHtml(item.allocation_status || 'Nicht vorhanden') + (item.lot_status === 'virtual_shortage' ? ' · Virtuelle Fehlbestandscharge' : '') + '
')).join('');"; - echo " return '
Bestellübersicht
' + value('Bestellnummer', order.external_ref) + value('Bestelldatum', formatDate(order.order_date)) + value('Verkaufskanal', order.order_source) + value('Bestellstatus', order.order_status) + value('Zahlungsstatus', order.payment_status) + value('Zahlungsart', order.payment_method) + value('Versandart', order.shipping_method) + '

Kunde: ' + escapeHtml([c.first_name, c.last_name].filter(Boolean).join(' ') || 'Nicht vorhanden') + '

Lieferadresse:
' + address + '

' + value('Netto', formatAmount(a.net, a.currency || 'CHF')) + value('Versand', formatAmount(a.shipping, a.currency || 'CHF')) + value('Rabatt', formatAmount(a.discount, a.currency || 'CHF')) + value('Steuer', formatAmount(a.tax, a.currency || 'CHF')) + value('Gesamtsumme', formatAmount(a.total, a.currency || 'CHF')) + '
Bestellte Artikel
' + (lines || '

Keine Artikel vorhanden.

') + '
Chargenzuordnung
' + (allocations || '

Keine Chargenzuordnung vorhanden.

') + '
';"; + echo " return '
Bestellübersicht
' + value('Bestellnummer', order.external_ref) + value('Bestelldatum', formatDate(order.order_date)) + value('Verkaufskanal', order.order_source) + value('Bestellstatus', order.order_status) + value('Zahlungsstatus', order.payment_status) + value('Zahlungsart', order.payment_method) + value('Versandart', order.shipping_method) + '

Kunde: ' + escapeHtml([c.first_name, c.last_name].filter(Boolean).join(' ') || 'Nicht vorhanden') + '

Lieferadresse:
' + address + '

' + value('Netto', formatAmount(a.net, a.currency || 'CHF')) + value('Versand', formatAmount(a.shipping, a.currency || 'CHF')) + value('Rabatt', formatAmount(a.discount, a.currency || 'CHF')) + value('Steuer', formatAmount(a.tax, a.currency || 'CHF')) + value('Gesamtsumme', formatAmount(a.total, a.currency || 'CHF')) + '
Bestellte Artikel
' + (lines || '

Keine Artikel vorhanden.

') + '
Chargenzuordnung
' + (allocations || '

Keine Chargenzuordnung vorhanden.

') + '
';"; echo " };"; echo " setDrawerState(true);"; echo " if (drawerTitle) { drawerTitle.textContent = trigger.dataset.orderNumber ? 'Bestellung ' + trigger.dataset.orderNumber : 'Bestellung'; }"; @@ -857,7 +857,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best echo " document.body.appendChild(bestellungenMobileDetailHost);"; echo " document.body.classList.add('sg-bestellungen-mobile-detail-open');"; echo " }"; - echo " fetch('/api/bestellungen/detail.php?id=' + encodeURIComponent(trigger.dataset.orderId || ''), { credentials: 'same-origin' }).then((response) => response.ok ? response.json() : Promise.reject(new Error('Bestelldetails konnten nicht geladen werden.'))).then((payload) => { if (!payload.ok || !bestellungenMobileDetailHost) { throw new Error('Bestelldetails konnten nicht geladen werden.'); } const order = payload.order; const cards = bestellungenMobileDetailHost.querySelector('[data-bestellungen-mobile-cards]'); const lines = (order.lines || []).map((line) => '

' + escapeHtml(line.item_name) + ' · ' + escapeHtml(line.item_code) + ' · Menge: ' + escapeHtml(String(line.qty)) + ' · Status: ' + escapeHtml(line.line_status) + '

').join(''); const allocations = (order.lines || []).flatMap((line) => (line.product_allocations || []).map((item) => '

' + escapeHtml(item.product_name) + ': ' + escapeHtml(item.lot_number || 'Nicht zugeordnet') + ' · ' + escapeHtml(item.allocation_status || 'Nicht vorhanden') + '

')).join(''); if (cards) { cards.innerHTML = '
Bestellübersicht

Bestellnummer: ' + escapeHtml(order.external_ref) + '

Bestelldatum: ' + escapeHtml(formatDate(order.order_date)) + '

Verkaufskanal: ' + escapeHtml(order.order_source) + '

Status: ' + escapeHtml(order.order_status) + '

Bestellte Artikel
' + (lines || '

Keine Artikel vorhanden.

') + '
Chargenzuordnung
' + (allocations || '

Keine Chargenzuordnung vorhanden.

') + '
'; } }).catch((error) => { const cards = bestellungenMobileDetailHost?.querySelector('[data-bestellungen-mobile-cards]'); if (cards) { cards.innerHTML = '

' + escapeHtml(error.message) + '

'; } });"; + echo " fetch('/api/bestellungen/detail.php?id=' + encodeURIComponent(trigger.dataset.orderId || ''), { credentials: 'same-origin' }).then((response) => response.ok ? response.json() : Promise.reject(new Error('Bestelldetails konnten nicht geladen werden.'))).then((payload) => { if (!payload.ok || !bestellungenMobileDetailHost) { throw new Error('Bestelldetails konnten nicht geladen werden.'); } const order = payload.order; const cards = bestellungenMobileDetailHost.querySelector('[data-bestellungen-mobile-cards]'); const lines = (order.lines || []).map((line) => '

' + escapeHtml(line.item_name) + ' · ' + escapeHtml(line.item_code) + ' · Menge: ' + escapeHtml(String(line.qty)) + ' · Status: ' + escapeHtml(line.line_status) + '

').join(''); const allocations = (order.lines || []).flatMap((line) => (line.product_allocations || []).map((item) => '

' + escapeHtml(item.product_name) + ': ' + escapeHtml(item.lot_number || 'Nicht zugeordnet') + ' · ' + escapeHtml(item.allocation_status || 'Nicht vorhanden') + '

')).join(''); if (cards) { cards.innerHTML = '
Bestellübersicht

Bestellnummer: ' + escapeHtml(order.external_ref) + '

Bestelldatum: ' + escapeHtml(formatDate(order.order_date)) + '

Verkaufskanal: ' + escapeHtml(order.order_source) + '

Status: ' + escapeHtml(order.order_status) + '

Bestellte Artikel
' + (lines || '

Keine Artikel vorhanden.

') + '
Chargenzuordnung
' + (allocations || '

Keine Chargenzuordnung vorhanden.

') + '
'; } }).catch((error) => { const cards = bestellungenMobileDetailHost?.querySelector('[data-bestellungen-mobile-cards]'); if (cards) { cards.innerHTML = '

' + escapeHtml(error.message) + '

'; } });"; echo " bestellungenDetailOpen = true;"; echo " window.history.pushState({ bestellungenView: 'detail', orderId: trigger.dataset.orderId || '' }, '', window.location.href);"; echo " };";