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

136 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using ElectronicsShopContracts.ViewModels
@model List<PaymeantViewModel>
@{
ViewData["Title"] = "Report";
}
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<div class="text-center">
<h1 class="display-4">Отчёты</h1>
</div>
<div class="text-start">
<h2 class="display-5">Отчёт за период</h2>
</div>
<form method="post">
<div class="align-content-center row mb-3">
<div class="col-sm-auto">
<label>С:</label>
</div>
<div class="col-3">
<input name="DateFrom" id="datefrom" type="date" />
</div>
<div class="col-sm-auto">
<label>По:</label>
</div>
<div class="col-3">
<input name="DateTo" id="dateto" type="date" />
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Cформировать отчет" class="btn btn-sm btn-outline-danger m-2 p-2" /></div>
</div>
</div>
</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 () {
let val = [];
$("input[name='Select_rec']:checked").each(function () {
val.push($(this).val());
});
var str = 'ids=';
for (let i = 0; i < val.length - 1; i++) {
str += val[i] + '&='
}
str += val[val.length - 1];
window.location.href = "ReportSearchFix/" + str;
});
</script>