94 lines
2.5 KiB
Plaintext
94 lines
2.5 KiB
Plaintext
@model List<SushiBarContracts.ViewModels.MessageInfoViewModel>
|
|
@{
|
|
ViewData["Title"] = "Mails";
|
|
}
|
|
<div class="text-center">
|
|
<h1 class="display-4">Mail</h1>
|
|
</div>
|
|
<div class="text-center">
|
|
@{
|
|
if (Model == null)
|
|
{
|
|
<h3 class="display-4">Авторизируйтесь</h3>
|
|
return;
|
|
}
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
Date
|
|
</th>
|
|
<th>
|
|
Title
|
|
</th>
|
|
<th>
|
|
Text
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in Model)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@Html.DisplayFor(modelItem =>
|
|
item.DateDelivery)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem =>
|
|
item.Subject)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem =>
|
|
item.Body)
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
<nav>
|
|
<ul class="pagination justify-content-center">
|
|
<li class="page-item">
|
|
<a class="page-link" href="#" id="prev">Previous</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="#" id="next">Next</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
<script>
|
|
const url = document.location.href;
|
|
const urlPart1 = url.split('=')[0];
|
|
const urlParameter = url.split('=')[1];
|
|
let parameter = parseInt(urlParameter);
|
|
|
|
const go = () => {
|
|
window.location.href = window.location.protocol + "//" + window.location.host + `/Home/Mails?page=${parameter}`
|
|
}
|
|
|
|
const paginationNext = document.getElementById("next")
|
|
paginationNext.onclick = (e) => {
|
|
e.preventDefault();
|
|
if (isNaN(parameter)) {
|
|
parameter = 1
|
|
}
|
|
parameter++;
|
|
go();
|
|
}
|
|
|
|
const paginationPrev = document.getElementById("prev")
|
|
|
|
if (isNaN(parameter) || parameter === 1) {
|
|
paginationPrev.parentElement.classList.add("disabled");
|
|
}
|
|
|
|
paginationPrev.onclick = (e) => {
|
|
e.preventDefault();
|
|
parameter--;
|
|
if (parameter <= 0)
|
|
parameter = 1
|
|
go();
|
|
}
|
|
</script> |