2024-06-25 15:03:16 +04:00
|
|
|
|
@page
|
|
|
|
|
@model WebApp.Pages.IndexModel
|
2024-05-09 17:45:03 +04:00
|
|
|
|
@{
|
2024-06-25 15:03:16 +04:00
|
|
|
|
ViewData["Title"] = "Catalog Page";
|
2024-05-09 17:45:03 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 17:13:06 +04:00
|
|
|
|
<!-- Шапка -->
|
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
2024-06-25 15:03:16 +04:00
|
|
|
|
<div class="container">
|
2024-06-26 08:04:07 +04:00
|
|
|
|
<a asp-page="Index" class="navbar-brand">Catalog</a>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
|
</button>
|
|
|
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
|
|
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
|
|
|
|
<li class="nav-item dropdown">
|
|
|
|
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
2024-06-25 20:26:34 +04:00
|
|
|
|
Category
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</a>
|
|
|
|
|
@* МОЖНО РЕАЛИЗОВАТЬ ПОЗЖЕ *@
|
|
|
|
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
2024-06-25 20:26:34 +04:00
|
|
|
|
<li><a class="dropdown-item" href="#">Pistols</a></li>
|
|
|
|
|
<li><a class="dropdown-item" href="#">Rifles</a></li>
|
|
|
|
|
<li><a class="dropdown-item" href="#">Hard Weapons</a></li>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<form class="d-flex" method="get">
|
2024-06-25 20:26:34 +04:00
|
|
|
|
<input asp-for="ProductsModel" type="search" placeholder="Поиск" name="search" value="">
|
2024-06-24 17:13:06 +04:00
|
|
|
|
<button class="btn btn-outline-success" type="submit"><i class="fas fa-search"></i></button>
|
|
|
|
|
</form>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
<div class="form-group ms-3">
|
|
|
|
|
<div class="d-flex align-items-center">
|
2024-06-26 08:04:07 +04:00
|
|
|
|
<input type="range" step="1" min="0" max="100" value="" class="custom-range me-2" id="priceFrom">
|
|
|
|
|
<label asp-for="ProductsModel" s for="pricefrom">От: <span id="priceLabelFrom"></span> руб.</label>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</div>
|
|
|
|
|
<div class="d-flex align-items-center">
|
2024-06-26 08:04:07 +04:00
|
|
|
|
<input type="range" step="1" min="0" max="100" value="" class="custom-range me-2" id="priceTo">
|
|
|
|
|
<label asp-for="ProductsModel" for="priceto">До: <span id="priceLabelTo"></span> руб.</label>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-24 17:13:06 +04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
|
2024-06-25 15:03:16 +04:00
|
|
|
|
@* КАРТОЧКИ ТОВАРОВ *@
|
2024-06-25 20:26:34 +04:00
|
|
|
|
<div id="Row">
|
|
|
|
|
<div class="row row-cols-1 row-cols-md-3 g-5">
|
|
|
|
|
@foreach (var weapon in @Model.ProductsModel)
|
|
|
|
|
{
|
|
|
|
|
<div class="col mb-4">
|
|
|
|
|
<div class="card h-100">
|
|
|
|
|
<img src="data:image/png;base64,@Convert.ToBase64String(Model.GetMediaByProduct(weapon))" class="card-img-top" alt="@weapon.Name">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h5 class="card-title">@weapon.Name</h5>
|
|
|
|
|
<p class="card-text">Цена: @weapon.Price руб.</p>
|
2024-06-26 08:04:07 +04:00
|
|
|
|
|
|
|
|
|
<div class="star-rating">
|
|
|
|
|
@for (int i = 0; i < (int)Math.Round(@weapon.Rate); i++)
|
|
|
|
|
{
|
|
|
|
|
<span class="filled-star">★</span>
|
|
|
|
|
}
|
|
|
|
|
@for (int i = 0; i < 5 - (int)Math.Round(@weapon.Rate); i++)
|
|
|
|
|
{
|
|
|
|
|
<span class="empty-star">★</span>
|
|
|
|
|
}
|
|
|
|
|
(@weapon.Rate)
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@if (User.Identity.IsAuthenticated)
|
|
|
|
|
{
|
|
|
|
|
<a asp-page="Cart" asp-route-id="@weapon.Id" asp-route-count=1 class="btn btn-primary">To cart</a>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<a asp-page="Login" asp-route-count=1 class="btn btn-primary">To cart</a>
|
|
|
|
|
}
|
|
|
|
|
<a asp-page="ProductPage" asp-route-id="@weapon.Id" class="btn btn-secondary">View Product</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-25 20:26:34 +04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</div>
|
2024-06-25 20:26:34 +04:00
|
|
|
|
}
|
|
|
|
|
</div>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</div>
|
2024-06-24 17:13:06 +04:00
|
|
|
|
|
|
|
|
|
@section Scripts {
|
|
|
|
|
<script>
|
2024-06-25 15:03:16 +04:00
|
|
|
|
// СЛАЙДЕРЫ
|
2024-06-24 17:13:06 +04:00
|
|
|
|
document.getElementById("priceFrom").addEventListener("input", function () {
|
|
|
|
|
var price = this.value;
|
2024-06-25 15:03:16 +04:00
|
|
|
|
document.getElementById("priceLabelFrom").textContent = price + " р.";
|
2024-06-24 17:13:06 +04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.getElementById("priceTo").addEventListener("input", function () {
|
|
|
|
|
var price = this.value;
|
2024-06-25 15:03:16 +04:00
|
|
|
|
document.getElementById("priceLabelTo").textContent = price + " р.";
|
2024-06-24 17:13:06 +04:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
}
|