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">
|
2024-07-26 02:46:29 +04:00
|
|
|
|
|
2024-06-25 15:03:16 +04:00
|
|
|
|
<form class="d-flex" method="get">
|
2024-07-26 02:46:29 +04:00
|
|
|
|
<input asp-for="ProductsModel" type="search" placeholder="Поиск" name="search" value="" id="search">
|
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-07-26 02:46:29 +04:00
|
|
|
|
|
|
|
|
|
<div class="dropdown">
|
|
|
|
|
<form class="form-group" method="get">
|
|
|
|
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
|
|
|
Фильтр
|
|
|
|
|
</a>
|
|
|
|
|
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuLink">
|
|
|
|
|
<input type="hidden" name="search" id="search_hidden">
|
|
|
|
|
<div class="d-flex align-items-center">
|
|
|
|
|
<input type="range" step="1" min="0" max="100" value="0" class="custom-range me-2" id="priceFrom">
|
|
|
|
|
От: <input type="number" name="pricefrom" step="0.01" id="priceLabelFrom"> руб.
|
|
|
|
|
</div>
|
|
|
|
|
<div class="d-flex align-items-center">
|
|
|
|
|
<input type="range" step="1" min="0" max="100" value="100" class="custom-range me-2" id="priceTo">
|
|
|
|
|
До: <input type="number" name="priceto" step="0.01" id="priceLabelTo"> руб.
|
|
|
|
|
</div>
|
|
|
|
|
<li><input type="radio" name="category" value="Pistol" class="dropdown-item">Pistol</li>
|
|
|
|
|
<li><input type="radio" name="category" value="Rifle" class="dropdown-item">Rifle</li>
|
|
|
|
|
<li><input type="radio" name="category" value="Revolver" class="dropdown-item">Revolver</li>
|
|
|
|
|
<button class="btn btn-outline-success" type="submit">Применить</i></button>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@* АКЦИИ *@
|
|
|
|
|
<div class="container mt-4">
|
|
|
|
|
<div class="row">
|
|
|
|
|
@foreach (var sale in Model.SalesModel)
|
|
|
|
|
{
|
|
|
|
|
<div class="col-12 col-md-6 mb-4">
|
|
|
|
|
<div class="card h-100 border-0 shadow-sm rounded-lg overflow-hidden">
|
|
|
|
|
<div class="row g-0">
|
|
|
|
|
<div class="col-md-4">
|
|
|
|
|
<img src="~/big-sale.png" class="card-img" alt="@sale.Name">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-8">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h5 class="card-title">@sale.Name</h5>
|
|
|
|
|
<p class="card-text small text-muted">@sale.Description</p>
|
|
|
|
|
<a asp-page="Details" asp-route-id="@sale.Id" class="btn btn-primary stretched-link" data-toggle="modal" data-target="#saleDetailModal">Подробнее</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal fade" id="saleDetailModal" tabindex="-1" role="dialog" aria-labelledby="saleDetailModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h5 class="modal-title" id="saleDetailModalLabel">Подробная информация об акции</h5>
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
@sale.FullDescription
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Закрыть</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
2024-06-25 15:03:16 +04:00
|
|
|
|
</div>
|
2024-06-24 17:13:06 +04:00
|
|
|
|
</div>
|
2024-07-26 02:46:29 +04:00
|
|
|
|
|
2024-06-24 17:13:06 +04:00
|
|
|
|
</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>
|
2024-07-26 02:46:29 +04:00
|
|
|
|
<p class="card-text">
|
|
|
|
|
|
|
|
|
|
@foreach (var sale in Model.SalesModel)
|
|
|
|
|
if (sale.Category == weapon.Category)
|
|
|
|
|
{
|
|
|
|
|
<span>Цена: <del>@weapon.Price руб.</del> </span>
|
|
|
|
|
<span style="color:red;">@(weapon.Price / 100 * (100 - sale.Value)) руб.</span>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<span>Цена: @weapon.Price руб.</span>
|
|
|
|
|
}
|
|
|
|
|
</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>
|
|
|
|
|
|
2024-07-26 02:46:29 +04:00
|
|
|
|
<a asp-page="ProductPage" asp-route-id="@weapon.Id" class="btn btn-success">Подробнее</a>
|
2024-06-26 08:04:07 +04:00
|
|
|
|
|
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-07-26 02:46:29 +04:00
|
|
|
|
document.getElementById("priceLabelFrom").value = price + " р.";
|
2024-06-24 17:13:06 +04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.getElementById("priceTo").addEventListener("input", function () {
|
|
|
|
|
var price = this.value;
|
2024-07-26 02:46:29 +04:00
|
|
|
|
document.getElementById("priceLabelTo").value = price + " р.";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.getElementById("search").addEventListener("input", function () {
|
|
|
|
|
var text = this.value;
|
|
|
|
|
document.getElementById("search_hidden").value = text;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#saleDetailModal').on('show.bs.modal', function (event) {
|
|
|
|
|
var button = $(event.relatedTarget); // Кнопка, которая активировала модальное окно
|
|
|
|
|
var saleId = button.data('sale-id'); // Экземпляр saleId из атрибута data-sale-id кнопки
|
|
|
|
|
|
|
|
|
|
// Загрузка данных о продаже с сервера (пример с использованием AJAX)
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '/api/sales/' + saleId, // URL API для получения данных о продаже
|
|
|
|
|
type: 'GET',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
var modal = $(this);
|
|
|
|
|
modal.find('.modal-title').text('Дата проведения акции: ' + data.date);
|
|
|
|
|
modal.find('.modal-body').text('Описание акции: ' + data.description);
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-06-24 17:13:06 +04:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
}
|