58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Корзина — {{ app_name }}{% endblock %}
|
||
|
||
{% block content %}
|
||
<section class="page-section">
|
||
<div class="section-head">
|
||
<h2>Корзина</h2>
|
||
<p>Проверьте товары перед оформлением</p>
|
||
</div>
|
||
|
||
{% if not items %}
|
||
<p class="empty">Корзина пуста. <a href="/#catalog">Перейти в каталог</a></p>
|
||
{% else %}
|
||
<div class="table-wrap">
|
||
<table class="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Товар</th>
|
||
<th>Цена</th>
|
||
<th>Кол-во</th>
|
||
<th>Сумма</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for item in items %}
|
||
<tr>
|
||
<td>
|
||
<a href="/product/{{ item.product.slug }}">{{ item.product.title }}</a>
|
||
<div class="muted">В наличии: {{ item.stock }}</div>
|
||
</td>
|
||
<td>{{ item.product.price | rub }}</td>
|
||
<td>
|
||
<form method="post" action="/cart/update" class="inline-form">
|
||
<input type="hidden" name="product_id" value="{{ item.product.id }}" />
|
||
<input type="number" name="quantity" min="0" max="{{ item.stock }}" value="{{ item.quantity }}" />
|
||
<button class="btn btn-ghost btn-tiny" type="submit">OK</button>
|
||
</form>
|
||
</td>
|
||
<td>{{ item.line_total | rub }}</td>
|
||
<td>
|
||
<form method="post" action="/cart/remove/{{ item.product.id }}">
|
||
<button class="btn btn-ghost btn-tiny" type="submit">Удалить</button>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="cart-summary">
|
||
<div class="price big">Итого: {{ total | rub }}</div>
|
||
<a class="btn btn-primary" href="/checkout">Оформить заказ</a>
|
||
</div>
|
||
{% endif %}
|
||
</section>
|
||
{% endblock %}
|