This commit is contained in:
2026-04-22 22:54:26 +02:00
parent cd1ea4a9db
commit c73b2fe9f6
26 changed files with 1377 additions and 34 deletions

View File

@@ -79,6 +79,50 @@ foreach ($addressesList as $address) {
<button type="button" class="btn btn--secondary btn--disabled">Edytuj</button>
</div>
</div>
<?php $riskInfo = is_array($customerRiskInfo ?? null) ? $customerRiskInfo : ['count' => 0, 'orders' => [], 'text' => '']; ?>
<?php if ((int) ($riskInfo['count'] ?? 0) >= 1): ?>
<div class="customer-risk-banner mt-12" role="alert">
<span class="customer-risk-banner__icon" aria-hidden="true">&#9888;</span>
<div class="customer-risk-banner__body">
<p class="customer-risk-banner__text"><?= $e((string) ($riskInfo['text'] ?? '')) ?></p>
<?php $riskOrders = is_array($riskInfo['orders'] ?? null) ? $riskInfo['orders'] : []; ?>
<?php if ($riskOrders !== []): ?>
<details class="customer-risk-banner__list">
<summary>Pokaz liste zamowien ze zwrotem (<?= count($riskOrders) ?>)</summary>
<table class="customer-risk-banner__table">
<thead>
<tr>
<th>Nr zamowienia</th>
<th>Data</th>
<th>Nr przesylki</th>
<th>Przewoznik</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($riskOrders as $ro): ?>
<?php
$roId = (int) ($ro['order_id'] ?? 0);
$roNumber = trim((string) ($ro['internal_order_number'] ?? ''));
$roLabel = $roNumber !== '' ? $roNumber : ('#' . $roId);
$roDate = trim((string) ($ro['ordered_at'] ?? ''));
$roDateShort = $roDate !== '' ? substr($roDate, 0, 10) : '-';
?>
<tr>
<td><a href="/orders/<?= $roId ?>" target="_blank" rel="noopener"><?= $e($roLabel) ?></a></td>
<td><?= $e($roDateShort) ?></td>
<td><?= $e((string) ($ro['tracking_number'] ?? '')) ?: '-' ?></td>
<td><?= $e((string) ($ro['provider'] ?? '')) ?: '-' ?></td>
<td><?= $e((string) ($ro['delivery_status_raw'] ?? '')) ?: 'returned' ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</details>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if ($flashSuccessMsg !== ''): ?>
<div class="flash flash--success mt-12"><?= $e($flashSuccessMsg) ?></div>
<?php endif; ?>