auto.bus_razor/TicketOffice/Pages/Auth/Account.cshtml
cuqmbr c47d67b15d feat: places' availability depends on bought tickets
if cities in route you're searching for intersects with cities in the smb's ticket for the route, taken place will be unavailable and capacity in the search results will be decreased
2022-05-28 20:10:50 +03:00

173 lines
8.0 KiB
Plaintext

@page
@using System.Globalization
@model TicketOffice.Pages.Account.IndexModel
@{
Layout = "~/Pages/Shared/_Layout.cshtml";
ViewData["Title"] = "Аккаунт";
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("uk-UA");
}
<link rel="stylesheet" href="~/css/Account.css"/>
<link rel="stylesheet" href="~/css/CityListPopup.css"/>
<link rel="stylesheet" href="~/css/InfoPopup.css">
<div class="section">
<div class="section-header">Придбані квитки</div>
@if (Model.Tickets is {Count: 0})
{
<div class="section-text">Ви не придбали жодного квитка. <a href="/Routes" class="link">Пошук маршрутів</a></div>
}
else
{
<div class="tickets">
@foreach (var ticket in Model.Tickets)
{
<div class="ticket">
<div class="ticket-header">Квиток № @ticket.Id</div>
<div class="ticket-body">
<div class="ticket-info">
<div class="ticket-info-line">
<span>Пасажир, місце:</span>
<span>@ticket.PassengerLastName @ticket.PassengerFirstName, @ticket.PassengerPlace</span>
</div>
<div class="ticket-info-line">
<span>Номер рейсу:</span>
<span> № @ticket.Route.Number</span>
</div>
<div class="ticket-info-line date">
<span>Дата відправлення:</span>
<span>
@ticket.Cities.First().DepartureTime?.ToString("f").Split(",")[0].ToLower(),
@ticket.Cities.First().DepartureTime?.ToString("dd.MM.yyyy"),
@ticket.Cities.First().DepartureTime?.ToString("HH:mm")
</span>
</div>
<div class="ticket-info-line date">
<span>Дата прибуття:</span>
<span>
@ticket.Cities.Last().ArrivalTime?.ToString("f").Split(",")[0].ToLower(),
@ticket.Cities.Last().ArrivalTime?.ToString("dd.MM.yyyy"),
@ticket.Cities.Last().ArrivalTime?.ToString("HH:mm")
</span>
</div>
</div>
</div>
<div class="ticket-footer">
<a class="ticket-link-btn" onclick="document.getElementById('popup-city-list-@ticket.Id').style.display = 'inherit'">Маршрут</a>
<a class="ticket-link-btn" onclick="document.getElementById('popup-info-@ticket.Id').style.display = 'inherit'">Повернути</a>
</div>
</div>
}
</div>
}
</div>
@* <div class="divider"></div> *@
@* *@
@* <div class="section"> *@
@* <div class="section-header">Керування аккаунтом</div> *@
@* </div> *@
@* Popup windows *@
@if (Model.Tickets is not {Count: 0})
{
foreach (var ticket in Model.Tickets)
{
<div class="popup-container-city-list" id="popup-city-list-@ticket.Id">
<div class="popup-city-list">
<div class="popup-header-city-list">
Автобус №@ticket.Route.Number
</div>
<div class="popup-body-city-list">
<table class="city-list">
<thead>
<tr class="tr-intermediate city-list">
<th class="th-route city-list">
Інформація
</th>
<th class="th-route city-list">
Місто
</th>
<th class="th-route city-list">
Час прибуття
</th>
<th class="th-route city-list">
Час відправлення
</th>
</tr>
</thead>
<tbody>
<tr class="tr-departure city-list">
<td class="td-route city-list">
Відправлення
</td>
<td class="td-route city-list">
@ticket.Cities.First().Name
</td>
<td class="td-route city-list">
-
</td>
<td class="td-route city-list">
@ticket.Cities.First().DepartureTime?.ToString("HH:mm")
</td>
</tr>
@for (int i = 1; i < ticket.Cities.Count - 1; i++)
{
<tr class="tr-intermediate city-list">
<td class="td-route city-list">
Проміжна станція
</td>
<td class="td-route city-list">
@ticket.Cities.ToList()[i].Name
</td>
<td class="td-route city-list">
@ticket.Cities.ToList()[i].ArrivalTime?.ToString("HH:mm")
</td>
<td class="td-route city-list">
@ticket.Cities.ToList()[i].DepartureTime?.ToString("HH:mm")
</td>
</tr>
}
<tr class="tr-arrival city-list">
<td class="td-route city-list">
Прибуття
</td>
<td class="td-route city-list">
@ticket.Cities.Last().Name
</td>
<td class="td-route city-list">
@ticket.Cities.Last().ArrivalTime?.ToString("HH:mm")
</td>
<td class="td-route city-list">
-
</td>
</tr>
</tbody>
</table>
</div>
<div class="popup-footer-city-list">
<a class="popup-footer-link-button-city-list" onclick="document.getElementById('popup-city-list-@ticket.Id').style.display = 'none'">Закрити</a>
</div>
</div>
</div>
<div class="popup-container-info" id="popup-info-@ticket.Id">
<div class="popup-info">
<div class="popup-info-header">Квиток № @ticket.Id</div>
<div class="popup-info-body">
Ви дійсно хочете повернути квиток?
</div>
<div class="popup-info-footer">
<a class="popup-info-footer-link-button" onclick="document.getElementById('popup-info-@ticket.Id').style.display = 'none'">Відмінити</a>
<a class="popup-info-footer-link-button" asp-page-handler="ReturnTicket" asp-route-ReturnTicketId="@ticket.Id">Повернути</a>
</div>
</div>
</div>
}
}