85 lines
3.6 KiB
Plaintext
85 lines
3.6 KiB
Plaintext
@model List<CartItem>
|
||
@{
|
||
ViewData["Title"] = "Корзина";
|
||
var total = (decimal?)ViewData["Total"] ?? 0m;
|
||
}
|
||
|
||
<div class="page-head">
|
||
<span class="section-overline">Корзина</span>
|
||
<h1 class="page-title">Корзина</h1>
|
||
<p class="page-subtitle">@(Model.Count == 0 ? "Ваша корзина пуста" : Model.Count + (Model.Count == 1 ? " позиция" : Model.Count < 5 ? " позиции" : " позиций"))</p>
|
||
</div>
|
||
|
||
@if (TempData["OrderSuccess"] != null)
|
||
{
|
||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||
@TempData["OrderSuccess"]
|
||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Закрыть"></button>
|
||
</div>
|
||
}
|
||
|
||
@if (Model.Count == 0)
|
||
{
|
||
<div class="catalog-empty">
|
||
<span class="catalog-empty__icon"><i class="bi bi-cart3"></i></span>
|
||
<h2 class="catalog-empty__title">В корзине пока пусто</h2>
|
||
<p class="catalog-empty__text">Загляните в каталог и выберите то, что нравится.</p>
|
||
<a class="btn btn-primary" asp-controller="Catalog" asp-action="Index">Перейти в каталог</a>
|
||
</div>
|
||
}
|
||
else
|
||
{
|
||
<div class="cart-table">
|
||
@foreach (var item in Model)
|
||
{
|
||
<div class="cart-row">
|
||
<div class="cart-row__media"><i class="bi @item.Product.Icon"></i></div>
|
||
<div class="cart-row__info">
|
||
<h5 class="cart-row__name">@item.Product.Name</h5>
|
||
<p class="cart-row__specs">@item.Product.Specs</p>
|
||
<div class="cart-row__price">
|
||
@item.Product.Price.ToString("N0") ₽
|
||
@if (item.Quantity > 1)
|
||
{
|
||
<span class="cart-row__subtotal">= @item.Subtotal.ToString("N0") ₽</span>
|
||
}
|
||
</div>
|
||
</div>
|
||
|
||
<form class="cart-row__qty" asp-action="Update" asp-controller="Cart" method="post">
|
||
<input type="hidden" name="productId" value="@item.ProductId" />
|
||
<input type="number" name="quantity" value="@item.Quantity" min="1" max="99"
|
||
class="form-control form-control-sm" aria-label="Количество" />
|
||
<button type="submit" class="btn btn-outline-secondary btn-sm">Обновить</button>
|
||
</form>
|
||
|
||
<form asp-action="Remove" asp-controller="Cart" method="post">
|
||
<input type="hidden" name="productId" value="@item.ProductId" />
|
||
<button type="submit" class="btn-remove" title="Удалить" aria-label="Удалить">
|
||
<i class="bi bi-trash"></i>
|
||
</button>
|
||
</form>
|
||
</div>
|
||
}
|
||
</div>
|
||
|
||
<div class="cart-summary">
|
||
<div class="cart-summary__total">
|
||
Итого: <strong>@total.ToString("N0") ₽</strong>
|
||
</div>
|
||
|
||
<div class="cart-summary__actions">
|
||
<form asp-action="Clear" asp-controller="Cart" method="post">
|
||
<button type="submit" class="btn btn-outline-secondary">
|
||
<i class="bi bi-trash"></i> Очистить корзину
|
||
</button>
|
||
</form>
|
||
|
||
<form asp-action="Checkout" asp-controller="Cart" method="post">
|
||
<button type="submit" class="btn btn-primary">
|
||
<i class="bi bi-bag-check"></i> Оформить заказ
|
||
</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
} |