Skip to content

Commit

Permalink
Fixed Service EndTime String
Browse files Browse the repository at this point in the history
  • Loading branch information
acmoune committed May 20, 2024
1 parent 51887e0 commit 4134a38
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public async Task Handle(BookingCancelledEvent notification, CancellationToken c
var body = $@"Salut {notification.Booking.CustomerName},
Votre réservation du {notification.Booking.Campaign.BookingDate}, pour le service {notification.Booking.Campaign.Service.Name} à bien été annulée.
Raison de l'annulation: [{notification.Booking.CancellationReason}].
Nous espérons vous compter bientôt parmi nous.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public async Task Handle(BookingConfirmedEvent notification, CancellationToken c
var subject = $"Confirmation de votre réservation ({notification.Booking.Campaign.Name()})";
var body = $@"Salut {notification.Booking.CustomerName},
Nous confirmons votre réservation du {notification.Booking.Campaign.BookingDate}, pour le service {notification.Booking.Campaign.Service.Name}.
Ce service va de {notification.Booking.Campaign.Service.StartTime} à {notification.Booking.Campaign.Service.EndTime}.
Nous confirmons votre réservation du {notification.Booking.Campaign.BookingDate}, pour le service {notification.Booking.Campaign.Service.Name} ({notification.Booking.Campaign.Service.StartTime} - {notification.Booking.Campaign.Service.EndTimeString()}).
Veuillez télécharger votre PASS (QR Code) en pièce jointe.
Vous devrez le présenter à l'entrée pour être identifié. Veuillez également le partager à tous ceux qui seront à votre table.
Expand Down
10 changes: 9 additions & 1 deletion src/OsanWebsite.Core/Models/Service.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
namespace OsanWebsite.Core.Models;

public record Service (string? Id, string Name, string? Description, TimeOnly StartTime, TimeOnly EndTime);
public record Service (string? Id, string Name, string? Description, TimeOnly StartTime, TimeOnly EndTime)
{
public string ToHtmlString()
{
return $"<strong>{Name}</strong> . {StartTime.ToString("HH:mm")} - {EndTimeString()}";
}

public string EndTimeString() => EndTime.ToString("HH:mm") == "00:00" ? "Fermeture" : EndTime.ToString("HH:mm");
}
2 changes: 1 addition & 1 deletion src/OsanWebsite.Web/Components/BookingForm.razor
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<option value="">-- Selectionnez un service --</option>
@foreach (var s in _services)
{
<option value="@s.Name">@s.Name (@s.StartTime - @s.EndTime)</option>
<option value="@s.Name">@s.Name (@s.StartTime - @s.EndTimeString())</option>
}
</InputSelect>
<ValidationMessage For=@(() => _booking.Service) />
Expand Down
4 changes: 3 additions & 1 deletion src/OsanWebsite.Web/Pages/AboutPage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
@foreach (var service in Model.Services)
{
<div>
<div style="color: #db0842;"><strong>@service.Name</strong> . @service.StartTime.ToString("HH:mm") - @(service.EndTime.ToString("HH:mm") == "00:00" ? "Fermeture" : service.EndTime.ToString("HH:mm"))</div>
<div style="color: #db0842;">
@Html.Raw(service.ToHtmlString())
</div>

@if (!String.IsNullOrEmpty(service.Description))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
@foreach (var service in Model.Services)
{
<div class="ho-service">
<div class="ho-service-name" style="color: #db0842;"><strong>@service.Name</strong> . @service.StartTime.ToString("HH:mm") - @(service.EndTime.ToString("HH:mm") == "00:00" ? "Fermeture" : service.EndTime.ToString("HH:mm"))</div>
<div class="ho-service-name" style="color: #db0842;">
@Html.Raw(service.ToHtmlString())
</div>

@if (!String.IsNullOrEmpty(service.Description))
{
Expand Down

0 comments on commit 4134a38

Please sign in to comment.