diff --git a/front/src/pages/Booking.svelte b/front/src/pages/Booking.svelte index 194df16..ae9364a 100644 --- a/front/src/pages/Booking.svelte +++ b/front/src/pages/Booking.svelte @@ -4,6 +4,20 @@ import { expandOnTyping } from "../lib/utils"; import Calendar from "../components/Calendar.svelte"; + const timeSlots = { + slot0: "8am to 10am", + slot1: "10am to 12am", + slot2: "12am to 2pm", + slot3: "2pm to 4pm", + slot4: "4pm to 6pm", + slot5: "6pm to 8pm", + slot6: "8pm to 10pm", + } + const tables = { + table1: "Table 1", + table2: "Table 2", + table3: "Table 3", + } const specialRequestsMax = 300; const today = new Date(); @@ -21,6 +35,29 @@ let dateValid = true; let specialRequestsValid = true; + function formatDate(date: Date) { + let formattedDate = new Intl.DateTimeFormat( + 'en-UK', + { + year: 'numeric', + month: 'long', + day: 'numeric' + } + ).format(date); + + // Add the ordinal suffix + let day = date.getDate(); + let suffix = 'th'; + if (day % 10 === 1 && day !== 11) { + suffix = 'st'; + } else if (day % 10 === 2 && day !== 12) { + suffix = 'nd'; + } else if (day % 10 === 3 && day !== 13) { + suffix = 'rd'; + } + return formattedDate.replace(`${day}`, day + suffix); + } + function validateName() { nameValid = name.length > 1} function validateEmail() { emailValid = email.length > 1} function validateTelephone() { telephoneValid = telephone.length == 11} @@ -210,12 +247,22 @@

- I want to stay at table {tableSlot || "Table 1"}, on {date || "a pleasant day"}, {timeSlot || "during the day"}. -

- I request "{specialRequests || "a nice stay"}". -

- If I need to be contacted, my name is {name || "Unknown"}, - email {email || "Missing"} or alternatively call me on {telephone || "nothing"}. + On + {date ? `the ${formatDate(date)}` : "an undecided date"} + at + {timeSlot ? timeSlots[timeSlot] : "an undecided time"}, + I want to be seated at + {tableSlot ? tables[tableSlot] : "a table"}. +

+ I request + {specialRequests ? specialRequests : "nothing in particular"}. +

+ My name is + {name ? name : "Unknown"}, + in the event I need to be contacted by email, you can do that at + {email ? email : "an empty email"}, + or alternatively call me on + {telephone ? telephone : "an empty phone number"}.

@@ -296,6 +343,13 @@ } } + .h { + padding: 0 $spacing-xsmall; + border-radius: $border-radius-normal; + background-color: $color-dark; + color: $color-on-dark; + } + #book-button { padding: 0 $spacing-normal; diff --git a/front/src/pages/Checkout.svelte b/front/src/pages/Checkout.svelte index 24614c7..4dbabb8 100644 --- a/front/src/pages/Checkout.svelte +++ b/front/src/pages/Checkout.svelte @@ -244,14 +244,12 @@ {/each} £{1.50.toFixed(2)} - Online order Fee - + Online order Fee {#if CheckoutData.delivery} £{3.00.toFixed(2)} - Delivery fee - + Delivery fee {/if} @@ -458,7 +456,7 @@ } &.table-row-border { - border-top: 2px solid rgba($color-dark, 0.4); + border-top: 2px solid rgba($color-dark, 0.2); } th, td {