63 lines
2.2 KiB
PHP
63 lines
2.2 KiB
PHP
<?php use App\Core\View; ?>
|
|
|
|
<h2>Заказы</h2>
|
|
|
|
<?php if (empty($orders)): ?>
|
|
<div class="alert">Заказы отсутствуют</div>
|
|
<?php else: ?>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>№ заказа</th>
|
|
<th>Дата</th>
|
|
<th>Покупатель</th>
|
|
<th>Сумма</th>
|
|
<th>Статус</th>
|
|
<th>Действия</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($orders as $order): ?>
|
|
<tr>
|
|
<td><strong><?= htmlspecialchars($order['order_number']) ?></strong></td>
|
|
<td><?= View::formatDateTime($order['created_at']) ?></td>
|
|
<td>
|
|
<?= htmlspecialchars($order['customer_name']) ?><br>
|
|
<small><?= htmlspecialchars($order['user_email']) ?></small>
|
|
</td>
|
|
<td><?= View::formatPrice($order['final_amount']) ?></td>
|
|
<td>
|
|
<?php
|
|
$statusColors = [
|
|
'pending' => '#ffc107',
|
|
'processing' => '#17a2b8',
|
|
'shipped' => '#007bff',
|
|
'completed' => '#28a745',
|
|
'cancelled' => '#dc3545'
|
|
];
|
|
$statusNames = [
|
|
'pending' => 'Ожидает',
|
|
'processing' => 'Обработка',
|
|
'shipped' => 'Отправлен',
|
|
'completed' => 'Завершен',
|
|
'cancelled' => 'Отменен'
|
|
];
|
|
$color = $statusColors[$order['status']] ?? '#666';
|
|
$name = $statusNames[$order['status']] ?? $order['status'];
|
|
?>
|
|
<span style="background: <?= $color ?>; color: white; padding: 3px 10px; border-radius: 4px; font-size: 12px;">
|
|
<?= $name ?>
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<a href="/admin/orders/<?= $order['order_id'] ?>" class="btn btn-sm btn-primary">
|
|
<i class="fas fa-eye"></i> Подробнее
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
|