58 lines
2.3 KiB
Plaintext
58 lines
2.3 KiB
Plaintext
@model IEnumerable<TechnoWorld.Models.Product>
|
||
@{
|
||
ViewData["Title"] = "Каталог";
|
||
var categories = (List<string>?)ViewData["Categories"] ?? [];
|
||
var currentCategory = (string?)ViewData["CurrentCategory"];
|
||
var searchQuery = (string?)ViewData["SearchQuery"];
|
||
var count = Model.Count();
|
||
}
|
||
|
||
<div class="page-head">
|
||
<span class="section-overline">Каталог</span>
|
||
<h1 class="page-title">Каталог техники</h1>
|
||
<p class="page-subtitle">@(count == 0 ? "Ничего не найдено" : count + (count == 1 ? " товар" : count < 5 ? " товара" : " товаров"))</p>
|
||
</div>
|
||
|
||
<div class="catalog-toolbar">
|
||
<div class="catalog-filter">
|
||
<a class="catalog-filter__link @(string.IsNullOrEmpty(currentCategory) ? "is-active" : "")"
|
||
asp-controller="Catalog" asp-action="Index">Все</a>
|
||
@foreach (var category in categories)
|
||
{
|
||
<a class="catalog-filter__link @(category == currentCategory ? "is-active" : "")"
|
||
asp-controller="Catalog" asp-action="Index"
|
||
asp-route-category="@category">@category</a>
|
||
}
|
||
</div>
|
||
|
||
<form class="catalog-search" asp-controller="Catalog" asp-action="Index" method="get">
|
||
<input class="catalog-search__input" type="search" name="q" value="@searchQuery"
|
||
placeholder="Поиск по каталогу..." aria-label="Поиск по каталогу" />
|
||
<button class="catalog-search__btn" type="submit" aria-label="Искать">
|
||
<i class="bi bi-search"></i>
|
||
</button>
|
||
</form>
|
||
</div>
|
||
|
||
@if (Model.Any())
|
||
{
|
||
<div class="row g-3 g-md-4">
|
||
@foreach (var product in Model)
|
||
{
|
||
<div class="col-lg-3 col-md-6 col-12">
|
||
<partial name="_ProductCard" model="product" />
|
||
</div>
|
||
}
|
||
</div>
|
||
}
|
||
else
|
||
{
|
||
<div class="catalog-empty">
|
||
<span class="catalog-empty__icon"><i class="bi bi-search"></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>
|
||
} |