using Fitness_core_BE.DTOs.Booking; using System.Net; namespace Fitness_core_BE.Helpers { // Minimal, dependency-free HTML for the public booking confirmation page (BookingController. // ViewBooking). No admin dashboard or mobile app exists yet for this to link into instead -- // this is a self-contained page so "share the booking link" already works today. public static class BookingViewHtml { public static string Render(BookingDto booking) { var who = booking.IsGuest ? Encode(booking.GuestName) : "Member booking"; var when = $"{booking.StartTime:dddd, dd MMM yyyy}, {booking.StartTime:h:mm tt} - {booking.EndTime:h:mm tt}"; var statusColor = booking.Status switch { "CheckedIn" => "#16a34a", "Cancelled" => "#dc2626", "NoShow" => "#dc2626", _ => "#2563eb" }; var otpBlock = !string.IsNullOrEmpty(booking.OtpCode) ? $$"""
Show this code at the door
{{Encode(booking.OtpCode)}}
""" : booking.OtpVerified ? "

Checked in -- code already used.

" : ""; return $$""" Booking Confirmation - Vijaya Sport Club

Vijaya Sport Club

Facility{{Encode(booking.FacilityName)}}
Session{{Encode(when)}}
Booked for{{who}}
Payment{{Encode(booking.PaymentStatus)}}
Status{{Encode(booking.Status)}}
{{otpBlock}}
"""; } public static string NotFound() => """ Booking not found

Booking not found

This link may have expired or the booking may have been cancelled.

"""; private static string Encode(string? value) => WebUtility.HtmlEncode(value ?? ""); } }