Add admin order management with full status workflow.
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
{{define "admin_orders.html"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{.Title}}</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<link rel="stylesheet" href="/static/css/admin.css">
|
||||
<link rel="stylesheet" href="/static/css/shop.css">
|
||||
</head>
|
||||
<body class="admin-body">
|
||||
{{template "admin_nav" .}}
|
||||
|
||||
<main class="admin-main container">
|
||||
<h1 class="admin-page-title">Заказы</h1>
|
||||
|
||||
{{if .Success}}
|
||||
<div class="admin-alert admin-alert--ok">{{.Success}}</div>
|
||||
{{end}}
|
||||
|
||||
<section class="admin-section">
|
||||
<table class="admin-table admin-table--orders">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Дата</th>
|
||||
<th>Клиент</th>
|
||||
<th>Сумма</th>
|
||||
<th>Статус</th>
|
||||
<th>Изменить</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Orders}}
|
||||
{{$orderStatus := .Status}}
|
||||
<tr>
|
||||
<td><strong>{{.ID}}</strong></td>
|
||||
<td>{{.CreatedAt.Format "02.01.2006 15:04"}}</td>
|
||||
<td>
|
||||
<div>{{.GuestName}}</div>
|
||||
<div class="admin-table__muted">{{.GuestEmail}}</div>
|
||||
<div class="admin-table__muted">{{.GuestPhone}}</div>
|
||||
</td>
|
||||
<td>{{printf "%.0f" .Total}} ₽</td>
|
||||
<td>
|
||||
<span class="order-status {{orderClass .Status}}">{{orderLabel .Status}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<form method="POST" action="/admin/orders/{{.ID}}/status" class="admin-status-form">
|
||||
<select name="status" class="admin-form__input admin-form__input--sm">
|
||||
{{range $.StatusList}}
|
||||
<option value="{{.Code}}" {{if eq .Code (orderNorm $orderStatus)}}selected{{end}}>{{.Label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
<button type="submit" class="btn btn--primary btn--sm">OK</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="admin-order-details">
|
||||
<td colspan="6">
|
||||
<strong>Адрес:</strong> {{.Address}}
|
||||
{{if .Items}}
|
||||
<ul class="admin-order-items">
|
||||
{{range .Items}}
|
||||
<li>{{.ProductName}} × {{.Quantity}} — {{printf "%.0f" .Price}} ₽</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr><td colspan="6" class="admin-empty">Заказов пока нет</td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<div class="admin-status-legend">
|
||||
<h3 class="admin-section__title">Статусы</h3>
|
||||
<div class="admin-status-legend__grid">
|
||||
{{range .StatusList}}
|
||||
<span class="order-status {{orderClass .Code}}">{{.Label}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user