diff options
Diffstat (limited to 'src/Costasdev.Busurbano.ServiceViewer/Views')
9 files changed, 227 insertions, 0 deletions
diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Services/DaysInFeed.cshtml b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/DaysInFeed.cshtml new file mode 100644 index 0000000..84f30a3 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/DaysInFeed.cshtml @@ -0,0 +1,22 @@ +@model Costasdev.ServiceViewer.Views.Services.DaysInFeedModel +@{ + ViewData["Title"] = "Fechas con datos"; +} + +@section Head +{ + <link rel="stylesheet" href="~/styles/days_in_feed.css" /> +} + +<header> + <h1>Fechas con datos</h1> +</header> + +<main> + @foreach (var day in Model.Days) + { + <article> + <a asp-controller="Services" asp-action="ServicesInDay" asp-route-day="@day.ToString("yyyy-MM-dd")">@day.ToString("M")</a> + </article> + } +</main> diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Services/DaysInFeed.cshtml.cs b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/DaysInFeed.cshtml.cs new file mode 100644 index 0000000..02fe5b0 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/DaysInFeed.cshtml.cs @@ -0,0 +1,7 @@ +namespace Costasdev.ServiceViewer.Views.Services; + +public class DaysInFeedModel +{ + public List<DateTime> Days { get; set; } = []; + public DateOnly Today { get; set; } +} diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServiceDetails.cshtml b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServiceDetails.cshtml new file mode 100644 index 0000000..8eae631 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServiceDetails.cshtml @@ -0,0 +1,63 @@ +@using Costasdev.ServiceViewer.Data.Gtfs +@using Humanizer +@using Humanizer.Localisation +@model Costasdev.ServiceViewer.Views.Services.ServiceDetailsModel +@{ + ViewData["Title"] = Model.ServiceName; +} + +@section Head +{ + <link rel="stylesheet" href="~/styles/service_details.css" /> + <link rel="stylesheet" href="/stylesheets/routecolours.css" /> + <style> + + </style> +} + +<header> + <h1>@ViewData["Title"]</h1> +</header> + +<nav class="navigation-bar"> + <a asp-action="DaysInFeed">Feed Vitrasa</a> + > + <a asp-action="ServicesInDay" asp-route-day="@Model.Date.ToString("yyyy-MM-dd")"> + @Model.Date.ToString("dd 'de' MMMM 'de' yyyy") + </a> + > + <span>@Model.ServiceName</span> +</nav> + +<section id="service-cards"> + @foreach (ServiceDetailsItem item in Model.Items) + { + <article class="trip-container route-@item.SafeRouteId"> + <div class="trip-header"> + <div class="route">@item.ShortName</div> + <div class="headsign">@item.LongName</div> + <div class="distance"> + @item.TotalDistance + </div> + </div> + <div class="trip-details"> + <div class="trip-leg"> + <div class="trip-time">@item.FirstStopTime</div> + <div class="trip-stop">@item.FirstStopName</div> + </div> + <div class="trip-leg"> + <div class="trip-time">@item.LastStopTime</div> + <div class="trip-stop">@item.LastStopName</div> + </div> + </div> + <div class="trip-footer" > + <a class="trip-details-link">Ver detalle del viaje →</a> + </div> + </article> + } +</section> + +<footer> + Tiempo de conducción: @Model.TotalDrivingTime.Hours horas y @Model.TotalDrivingTime.Minutes minutos.<br /> + Distancia total: @Model.TotalDistanceKm +</footer> diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServiceDetails.cshtml.cs b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServiceDetails.cshtml.cs new file mode 100644 index 0000000..a89efae --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServiceDetails.cshtml.cs @@ -0,0 +1,29 @@ +namespace Costasdev.ServiceViewer.Views.Services; + +public class ServiceDetailsModel +{ + public DateOnly Date { get; set; } + public string ServiceId { get; set; } = string.Empty; + public string ServiceName { get; set; } = string.Empty; + + public List<ServiceDetailsItem> Items { get; set; } = []; + public TimeSpan TotalDrivingTime { get; set; } + + public int TotalDistance { get; set; } + public string TotalDistanceKm => (TotalDistance / 1000.0).ToString("0.00 km"); +} + +public class ServiceDetailsItem +{ + public string TripId { get; set; } = string.Empty; + public string SafeRouteId { get; set; } = string.Empty; + public string ShortName { get; set; } = string.Empty; + public string LongName { get; set; } = string.Empty; + public string TotalDistance { get; set; } = string.Empty; + + public string FirstStopTime { get; set; } = string.Empty; + public string FirstStopName { get; set; } = string.Empty; + + public string LastStopTime { get; set; } = string.Empty; + public string LastStopName { get; set; } = string.Empty; +} diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServicesInDay.cshtml b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServicesInDay.cshtml new file mode 100644 index 0000000..a5ac66f --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServicesInDay.cshtml @@ -0,0 +1,40 @@ +@model Costasdev.ServiceViewer.Views.Services.ServiceInDayModel +@{ + ViewData["Title"] = "Servicios a realizar en " + Model.Date.ToString("dd 'de' MMMM 'de' yyyy"); +} + +@section Head +{ + <link rel="stylesheet" href="~/styles/services_in_day.css" /> + <link rel="stylesheet" href="/stylesheets/routecolours.css" /> +} + +<header> + <h1> + @ViewData["Title"] + </h1> +</header> + +<section id="service-cards"> + @foreach (ServicesInDayItem card in Model.Items) + { + <article> + <header> + <a asp-action="ServiceDetails" asp-route-day="@Model.Date.ToString("yyyy-MM-dd")" asp-route-serviceId="@card.ServiceId"> + @card.ServiceName + </a> + </header> + <main> + @card.ShiftStart → @card.ShiftEnd + </main> + <footer> + @foreach (var cardTripGroup in card.TripGroups) + { + <span class="route-group route-@cardTripGroup.route.SafeId"> + @cardTripGroup.route.ShortName (@cardTripGroup.count) + </span> + } + </footer> + </article> + } +</section> diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServicesInDay.cshtml.cs b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServicesInDay.cshtml.cs new file mode 100644 index 0000000..b0c57c3 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Services/ServicesInDay.cshtml.cs @@ -0,0 +1,39 @@ +using Costasdev.ServiceViewer.Data.Gtfs; + +namespace Costasdev.ServiceViewer.Views.Services; + +public class ServiceInDayModel +{ + public List<ServicesInDayItem> Items { get; set; } = []; + public DateOnly Date { get; set; } +} + +public class ServicesInDayItem +{ + public string ServiceId { get; set; } + public string ServiceName { get; set; } + public List<GtfsTrip> Trips { get; set; } + public List<TripGroup> TripGroups { get; set; } + + public string ShiftStart { get; set; } + public string ShiftEnd { get; set; } + + public ServicesInDayItem( + string serviceId, + string serviceName, + List<GtfsTrip> trips, + List<TripGroup> tripGroups, + string shiftStart, + string shiftEnd + ) { + ServiceId = serviceId; + ServiceName = serviceName; + Trips = trips; + TripGroups = tripGroups; + + ShiftStart = shiftStart; + ShiftEnd = shiftEnd; + } +} + +public record TripGroup(GtfsRoute route, int count); diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/Shared/_Layout.cshtml b/src/Costasdev.Busurbano.ServiceViewer/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..88d5b83 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/Shared/_Layout.cshtml @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html lang="es"> +<head> + <meta charset="UTF-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta rel="robots" content="noindex, nofollow"> + + <meta charset="utf-8"/> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <title>@ViewData["Title"] - VentaSync</title> + + <link rel="stylesheet" href="https://fonts.bunny.net/css?family=inter:300,400,700"> + <link rel="stylesheet" href="~/styles/common.css" /> + @await RenderSectionAsync("Head", required: false) +</head> + +<body> + +@RenderBody() +</body> +</html> diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/_ViewImports.cshtml b/src/Costasdev.Busurbano.ServiceViewer/Views/_ViewImports.cshtml new file mode 100644 index 0000000..785dc40 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using Costasdev.ServiceViewer.Views.Services +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/Costasdev.Busurbano.ServiceViewer/Views/_ViewStart.cshtml b/src/Costasdev.Busurbano.ServiceViewer/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/src/Costasdev.Busurbano.ServiceViewer/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} |
