CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml

136 lines
3.1 KiB
Plaintext
Raw Normal View History

2024-08-06 21:21:05 +04:00
@using ElectronicsShopContracts.ViewModels
@model List<PaymeantViewModel>
2024-06-06 17:21:39 +04:00
@{
2024-06-01 02:50:15 +04:00
ViewData["Title"] = "Report";
}
2024-08-06 21:21:05 +04:00
<script src="~/lib/jquery/dist/jquery.min.js"></script>
2024-06-01 02:50:15 +04:00
<div class="text-center">
2024-08-06 21:21:05 +04:00
<h1 class="display-4">Отчёты</h1>
2024-06-01 02:50:15 +04:00
</div>
2024-08-06 21:21:05 +04:00
<div class="text-start">
<h2 class="display-5">Отчёт за период</h2>
</div>
2024-06-01 02:50:15 +04:00
<form method="post">
<div class="align-content-center row mb-3">
<div class="col-sm-auto">
2024-06-06 17:21:39 +04:00
<label>С:</label>
2024-06-01 02:50:15 +04:00
</div>
<div class="col-3">
2024-06-06 17:21:39 +04:00
<input name="DateFrom" id="datefrom" type="date" />
2024-06-01 02:50:15 +04:00
</div>
<div class="col-sm-auto">
2024-06-06 17:21:39 +04:00
<label>По:</label>
2024-06-01 02:50:15 +04:00
</div>
<div class="col-3">
2024-06-06 17:21:39 +04:00
<input name="DateTo" id="dateto" type="date" />
2024-06-01 02:50:15 +04:00
</div>
2024-06-06 17:21:39 +04:00
<div class="row">
<div class="col-8"></div>
2024-08-06 21:21:05 +04:00
<div class="col-4"><input type="submit" value="Cформировать отчет" class="btn btn-sm btn-outline-danger m-2 p-2" /></div>
2024-06-01 02:50:15 +04:00
</div>
</div>
2024-08-06 21:21:05 +04:00
</form>
<div class="text-start">
<h2 class="display-5">Выбрать оплаты в отечет</h2>
</div>
<div class="text-center">
@{
if (Model == null) {
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<div class="text-end">
<button class="btn btn-sm btn-outline-danger m-2 p-2" id="btnFix">Cформировать отчет</button>
</div>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Номер заказа
</th>
<th>
Сумма к оплате
</th>
<th>
Статус оплаты
</th>
<th>
Дата оплаты
</th>
<th>
<input type="checkbox" class="form-check-input" id="Select_all" name="Select_all" /> Выбрать все
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<th>
@Html.DisplayFor(modelItem => item.ID)
</th>
<th>
@Html.DisplayFor(modelItem => item.OrderID)
</th>
<th>
@Html.DisplayFor(modelItem => item.SumPayment)
</th>
<th>
@Html.DisplayFor(modelItem => item.PayOption)
</th>
<th>
@Html.DisplayFor(modelItem => item.DatePaymeant)
</th>
<th>
<input type="checkbox" class="form-check-input" id="Select_rec" name="Select_rec" value="@item.ID" />
</th>
</tr>
}
</tbody>
</table>
}
</div>
<script>
$('#Select_all').on('click', function () {
let checkboxes = document.getElementsByTagName('input');
let val = null;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type === 'checkbox') {
if (val == null) {
val = checkboxes[i].checked;
}
else {
checkboxes[i].checked = val;
}
}
}
});
$('#btnFix').on('click', function () {
debugger
let val = [];
$("input[name='Select_rec']:checked").each(function () {
val.push($(this).val());
});
$.ajax({
type: 'POST',
url: '/Home/Report',
data: { 'ids': val, '_isFixReport': true},
success: function (result) {
$("#idsStr").val(result);
}
});
});
</script>