65 lines
2.2 KiB
Plaintext
65 lines
2.2 KiB
Plaintext
@page
|
|
@using System.Globalization
|
|
@using ZTravel.API.HAFAS
|
|
@using ZTravel.API.VRRF
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>Departures - ZTravel</title>
|
|
<meta http-equiv="refresh" content="30">
|
|
<link rel="stylesheet" href="~/css/site.css"/>
|
|
</head>
|
|
<body>
|
|
<div class="navbar-fixed">
|
|
<nav style="color: #ffffff; background-color: #00838f;">
|
|
<div class="nav-wrapper container">
|
|
<span class="brand-logo">Salzburg Maria-Cebotari-Straße (2)</span>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
<div class="app applight">
|
|
<ul>
|
|
@foreach (var dep in Endpoints.SvvEndpoint.GetDepartures("Salzburg Maria-Cebotari-Straße", 20)
|
|
.OrderBy(p => p.RealDeparture)
|
|
.Where(p => p.Destination != "Parsch")) {
|
|
var countdownRaw = dep.RealDeparture - DateTime.Now;
|
|
var countdown = Math.Round(countdownRaw.TotalMinutes);
|
|
var time = dep.RealDeparture.ToString("HH:mm");
|
|
var displaytime = countdown <= 60 ? $"{countdown} min" : time;
|
|
var delay = (int)(dep.RealDeparture - dep.PlannedDeparture).TotalMinutes;
|
|
var abstime = time;
|
|
if (delay > 0) {
|
|
abstime += $" (+{delay})";
|
|
}
|
|
if (delay < 0) {
|
|
abstime += $" ({delay})";
|
|
}
|
|
|
|
if (countdown <= 0) {
|
|
displaytime = "now";
|
|
}
|
|
if (countdown <= -1) {
|
|
continue;
|
|
}
|
|
|
|
<li>
|
|
@if (int.Parse(dep.Line) <= 14) {
|
|
<div class="line obus obus-line-@dep.Line">@dep.Line</div>
|
|
}
|
|
else {
|
|
<div class="line bus">@dep.Line</div>
|
|
}
|
|
<div class="dest">@dep.Destination</div>
|
|
<span class="route">Salzburg AG - Obus Linie @dep.Line</span>
|
|
<span class="countdown">
|
|
<span class="platform">@displaytime</span>
|
|
</span>
|
|
<span class="time">@abstime</span>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html> |