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')) + '' + 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')) + 'Kunde: ' + escapeHtml([c.first_name, c.last_name].filter(Boolean).join(' ') || 'Nicht vorhanden') + '
Lieferadresse:
' + address + '
Keine Artikel vorhanden.
Keine Chargenzuordnung vorhanden.
') + 'Kunde: ' + escapeHtml([c.first_name, c.last_name].filter(Boolean).join(' ') || 'Nicht vorhanden') + '
Lieferadresse:
' + address + '
Keine Artikel vorhanden.
Keine Chargenzuordnung vorhanden.
') + '' + 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 = 'Bestellnummer: ' + escapeHtml(order.external_ref) + '
Bestelldatum: ' + escapeHtml(formatDate(order.order_date)) + '
Verkaufskanal: ' + escapeHtml(order.order_source) + '
Status: ' + escapeHtml(order.order_status) + '
Keine Artikel vorhanden.
') + 'Keine Chargenzuordnung vorhanden.
') + '' + 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 = 'Bestellnummer: ' + escapeHtml(order.external_ref) + '
Bestelldatum: ' + escapeHtml(formatDate(order.order_date)) + '
Verkaufskanal: ' + escapeHtml(order.order_source) + '
Status: ' + escapeHtml(order.order_status) + '
Keine Artikel vorhanden.
') + 'Keine Chargenzuordnung vorhanden.
') + '' + escapeHtml(error.message) + '
'; } });"; echo " bestellungenDetailOpen = true;"; echo " window.history.pushState({ bestellungenView: 'detail', orderId: trigger.dataset.orderId || '' }, '', window.location.href);"; echo " };";