Files
shop10/src/views/admin/reservations.ejs
T

47 lines
1.6 KiB
Plaintext

<%- include('../partials/layout-start') %>
<div class="admin-header">
<h1>Бронирования</h1>
<%- include('../partials/admin-nav', { adminNav: 'reservations' }) %>
</div>
<% const resStatus = { active: 'Активна', fulfilled: 'Выполнена', cancelled: 'Отменена', expired: 'Истекла' }; %>
<table class="cart-table">
<thead>
<tr>
<th>№</th>
<th>Клиент</th>
<th>Товар</th>
<th>Кол-во</th>
<th>Статус</th>
<th>До</th>
<th>Действие</th>
</tr>
</thead>
<tbody>
<% reservations.forEach(r => { %>
<tr>
<td>#<%= r.id %></td>
<td><%= r.user_name %><br><span class="muted"><%= r.user_email %></span></td>
<td><%= r.product_name %></td>
<td><%= r.quantity %></td>
<td><span class="status status--<%= r.status === 'active' ? 'pending' : r.status %>"><%= resStatus[r.status] || r.status %></span></td>
<td><%= r.status === 'active' ? new Date(r.expires_at).toLocaleString('ru-RU') : '—' %></td>
<td>
<form method="post" action="/admin/reservations/<%= r.id %>/status" class="admin-status-form">
<select name="status" class="input input--sm">
<% ['active','fulfilled','cancelled','expired'].forEach(s => { %>
<option value="<%= s %>" <%= r.status === s ? 'selected' : '' %>><%= resStatus[s] %></option>
<% }) %>
</select>
<button type="submit" class="btn btn--ghost btn--sm">OK</button>
</form>
</td>
</tr>
<% }) %>
</tbody>
</table>
<%- include('../partials/layout-end') %>