From cb0dfcecad104f25245b69eadf74ff4e1b065d56 Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Thu, 9 Jan 2025 16:14:24 +0100 Subject: [PATCH] fix (SW-1352): update PriceDetailsTable with avarage price per night --- .../Summary/PriceDetailsTable/index.tsx | 112 +++++++++++------- i18n/dictionaries/da.json | 5 + i18n/dictionaries/de.json | 6 +- i18n/dictionaries/en.json | 5 + i18n/dictionaries/fi.json | 5 + i18n/dictionaries/no.json | 5 + i18n/dictionaries/sv.json | 5 + 7 files changed, 98 insertions(+), 45 deletions(-) diff --git a/components/HotelReservation/EnterDetails/Summary/PriceDetailsTable/index.tsx b/components/HotelReservation/EnterDetails/Summary/PriceDetailsTable/index.tsx index 354f65038..7eff059da 100644 --- a/components/HotelReservation/EnterDetails/Summary/PriceDetailsTable/index.tsx +++ b/components/HotelReservation/EnterDetails/Summary/PriceDetailsTable/index.tsx @@ -8,7 +8,6 @@ import { useEnterDetailsStore } from "@/stores/enter-details" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import useLang from "@/hooks/useLang" -import { getNights } from "@/utils/dateFormatting" import { formatPrice } from "@/utils/numberFormatting" import styles from "./priceDetailsTable.module.css" @@ -16,14 +15,22 @@ import styles from "./priceDetailsTable.module.css" import { type PriceDetailsTableProps } from "@/types/components/hotelReservation/enterDetails/priceDetailsTable" import type { DetailsState } from "@/types/stores/enter-details" -function Row({ label, value }: { label: string; value: string }) { +function Row({ + label, + value, + bold, +}: { + label: string + value: string + bold?: boolean +}) { return ( - {label} + {label} - {value} + {value} ) @@ -33,11 +40,18 @@ function TableSection({ children }: React.PropsWithChildren) { return {children} } -function TableSectionHeader({ title }: { title: string }) { +function TableSectionHeader({ + title, + subtitle, +}: { + title: string + subtitle?: string +}) { return ( {title} + {subtitle ? {subtitle} : null} ) @@ -67,54 +81,58 @@ export default function PriceDetailsTable({ // TODO: Update for Multiroom later const { adults, childrenInRoom } = booking.rooms[0] - const nights = getNights(booking.fromDate, booking.toDate) + const diff = dt(booking.toDate).diff(booking.fromDate, "days") + const nights = intl.formatMessage( + { id: "booking.nights" }, + { totalNights: diff } + ) const vatPercentage = vat / 100 const vatAmount = totalPrice.local.price * vatPercentage const priceExclVat = totalPrice.local.price - vatAmount + const duration = ` ${dt(booking.fromDate).locale(lang).format("ddd, D MMM")} + - + ${dt(booking.toDate).locale(lang).format("ddd, D MMM")} (${nights})` return ( - - {nights.map((night) => { - return ( - - ) - })} - - {bedType ? ( - + + + {bedType ? ( - - ) : null} + ) : null} + + + {breakfast ? ( - {childrenInRoom?.length ? ( ) : null} + ) : null} diff --git a/i18n/dictionaries/da.json b/i18n/dictionaries/da.json index 5b29716f2..e613a7841 100644 --- a/i18n/dictionaries/da.json +++ b/i18n/dictionaries/da.json @@ -45,6 +45,7 @@ "At latest": "Senest", "At the hotel": "På hotellet", "Attractions": "Attraktioner", + "Average price per night": "gennemsnitspris pr. nat", "Away from elevator": "Væk fra elevator", "Back to scandichotels.com": "Tilbage til scandichotels.com", "Back to top": "Tilbage til top", @@ -62,12 +63,15 @@ "Booking number": "Bookingnummer", "Breakfast": "Morgenmad", "Breakfast buffet": "Morgenbuffet", + "Breakfast charge": "Morgenmadsgebyr", "Breakfast deal can be purchased at the hotel.": "Morgenmad kan købes på hotellet.", "Breakfast excluded": "Morgenmad ikke inkluderet", "Breakfast included": "Morgenmad inkluderet", "Breakfast is included.": "Morgenmad er inkluderet.", "Breakfast restaurant": "Breakfast restaurant", "Breakfast selection in next step.": "Valg af morgenmad i næste trin.", + "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Morgenmad ({totalAdults, plural, one {# voksen} other {# voksne}}) x {totalBreakfasts}", + "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Morgenmad ({totalChildren, plural, one {# barn} other {# børn}}) x {totalBreakfasts}", "Bus terminal": "Busstation", "Business": "Forretning", "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.": "Ved at acceptere vilkårene og betingelserne for Scandic Friends, forstår jeg, at mine personlige oplysninger vil blive behandlet i overensstemmelse med Scandics privatlivspolitik.", @@ -365,6 +369,7 @@ "Restaurants & Bars": "Restaurants & Bars", "Retype new password": "Gentag den nye adgangskode", "Room & Terms": "Værelse & Vilkår", + "Room charge": "Værelsesafgift", "Room facilities": "Værelsesfaciliteter", "Rooms": "Værelser", "Rooms & Guests": "Værelser & gæster", diff --git a/i18n/dictionaries/de.json b/i18n/dictionaries/de.json index 58f4b340f..5cffa6ec0 100644 --- a/i18n/dictionaries/de.json +++ b/i18n/dictionaries/de.json @@ -45,6 +45,7 @@ "At latest": "Spätestens", "At the hotel": "Im Hotel", "Attraction": "Attraktion", + "Average price per night": "Durchschnittspreis pro Nacht", "Away from elevator": "Weg vom Aufzug", "Back to scandichotels.com": "Zurück zu scandichotels.com", "Back to top": "Zurück zur Spitze", @@ -62,13 +63,15 @@ "Booking number": "Buchungsnummer", "Breakfast": "Frühstück", "Breakfast buffet": "Frühstücksbuffet", + "Breakfast charge": "Frühstücksgebühr", "Breakfast deal can be purchased at the hotel.": "Frühstücksangebot kann im Hotel gekauft werden.", "Breakfast excluded": "Frühstück nicht inbegriffen", "Breakfast included": "Frühstück inbegriffen", "Breakfast is included.": "Frühstück ist inbegriffen.", "Breakfast restaurant": "Breakfast restaurant", "Breakfast selection in next step.": "Frühstücksauswahl in nächsten Schritt.", - "Bus terminal": "Busbahnhof", + "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Frühstück ({totalAdults, plural, one {# erwachsene} other {# erwachsene}}) x {totalBreakfasts}", + "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Frühstück ({totalChildren, plural, one {# kind} other {# kinder}}) x {totalBreakfasts}", "Business": "Geschäft", "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.": "Mit der Annahme der Allgemeinen Geschäftsbedingungen für Scandic Friends erkläre ich mich damit einverstanden, dass meine persönlichen Daten in Übereinstimmung mit der Datenschutzrichtlinie von Scandic verarbeitet werden.", "By paying with any of the payment methods available, I accept the terms for this booking and the general Terms & Conditions, and understand that Scandic will process my personal data for this booking in accordance with Scandic's Privacy policy. I also accept that Scandic require a valid credit card during my visit in case anything is left unpaid.": "Mit der Zahlung über eine der verfügbaren Zahlungsmethoden akzeptiere ich die Buchungsbedingungen und die allgemeinen Geschäftsbedingungen und verstehe, dass Scandic meine personenbezogenen Daten im Zusammenhang mit dieser Buchung gemäß der Scandic Datenschutzrichtlinie verarbeitet. Ich akzeptiere, dass Scandic während meines Aufenthalts eine gültige Kreditkarte für eventuelle Rückerstattungen benötigt.", @@ -365,6 +368,7 @@ "Retype new password": "Neues Passwort erneut eingeben", "Room": "Zimmer", "Room & Terms": "Zimmer & Bedingungen", + "Room charge": "Zimmerpreis", "Room facilities": "Zimmerausstattung", "Rooms": "Räume", "Rooms & Guests": "Zimmer & Gäste", diff --git a/i18n/dictionaries/en.json b/i18n/dictionaries/en.json index c4458b6e5..3f161a249 100644 --- a/i18n/dictionaries/en.json +++ b/i18n/dictionaries/en.json @@ -45,6 +45,7 @@ "At latest": "At latest", "At the hotel": "At the hotel", "Attractions": "Attractions", + "Average price per night": "Average price per night", "Away from elevator": "Away from elevator", "Back to scandichotels.com": "Back to scandichotels.com", "Back to top": "Back to top", @@ -65,12 +66,15 @@ "Booking number": "Booking number", "Breakfast": "Breakfast", "Breakfast buffet": "Breakfast buffet", + "Breakfast charge": "Breakfast charge", "Breakfast deal can be purchased at the hotel.": "Breakfast deal can be purchased at the hotel.", "Breakfast excluded": "Breakfast excluded", "Breakfast included": "Breakfast included", "Breakfast is included.": "Breakfast is included.", "Breakfast restaurant": "Breakfast restaurant", "Breakfast selection in next step.": "Breakfast selection in next step.", + "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}", + "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}", "Bus terminal": "Bus terminal", "Business": "Business", "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.": "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.", @@ -403,6 +407,7 @@ "Retype new password": "Retype new password", "Room": "Room", "Room & Terms": "Room & Terms", + "Room charge": "Room charge", "Room facilities": "Room facilities", "Rooms": "Rooms", "Rooms & Guests": "Rooms & Guests", diff --git a/i18n/dictionaries/fi.json b/i18n/dictionaries/fi.json index dea10b0db..502120436 100644 --- a/i18n/dictionaries/fi.json +++ b/i18n/dictionaries/fi.json @@ -45,6 +45,7 @@ "At latest": "Viimeistään", "At the hotel": "Hotellissa", "Attractions": "Nähtävyydet", + "Average price per night": "keskihinta per yö", "Away from elevator": "Kaukana hissistä", "Back to scandichotels.com": "Takaisin scandichotels.com", "Back to top": "Takaisin ylös", @@ -68,6 +69,9 @@ "Breakfast is included.": "Aamiainen sisältyy.", "Breakfast restaurant": "Breakfast restaurant", "Breakfast selection in next step.": "Aamiaisvalinta seuraavassa vaiheessa.", + "Breakfast charge": "Aamiaismaksu", + "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Aamiainen ({totalAdults, plural, one {# aikuinen} other {# aikuiset}}) x {totalBreakfasts}", + "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Aamiainen ({totalChildren, plural, one {# lapsi} other {# lasta}}) x {totalBreakfasts}", "Bus terminal": "Bussiasema", "Business": "Business", "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.": "Kyllä, hyväksyn Scandic Friends -jäsenyyttä koskevat ehdot ja ymmärrän, että Scandic käsittelee henkilötietojani Scandicin Tietosuojaselosteen mukaisesti.", @@ -365,6 +369,7 @@ "Restaurants & Bars": "Restaurants & Bars", "Retype new password": "Kirjoita uusi salasana uudelleen", "Room & Terms": "Huone & Ehdot", + "Room charge": "Huonemaksu", "Room facilities": "Huoneen varustelu", "Rooms": "Huoneet", "Rooms & Guests": "Huoneet & Vieraat", diff --git a/i18n/dictionaries/no.json b/i18n/dictionaries/no.json index dc256752b..7111837a9 100644 --- a/i18n/dictionaries/no.json +++ b/i18n/dictionaries/no.json @@ -45,6 +45,7 @@ "At latest": "Senest", "At the hotel": "På hotellet", "Attractions": "Attraksjoner", + "Average price per night": "gjennomsnittlig pris per natt", "Away from elevator": "Bort fra heisen", "Back to scandichotels.com": "Tilbake til scandichotels.com", "Back to top": "Tilbake til toppen", @@ -68,6 +69,9 @@ "Breakfast is included.": "Frokost er inkludert.", "Breakfast restaurant": "Breakfast restaurant", "Breakfast selection in next step.": "Frokostvalg i neste steg.", + "Breakfast charge": "Pris for frokost", + "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Frokost ({totalAdults, plural, one {# voksen} other {# voksne}}) x {totalBreakfasts}", + "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Frokost ({totalChildren, plural, one {# barn} other {# barn}}) x {totalBreakfasts}", "Bus terminal": "Bussterminal", "Business": "Forretnings", "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.": "Ved å akseptere vilkårene og betingelsene for Scandic Friends, er jeg inneforstått med at mine personopplysninger vil bli behandlet i samsvar med Scandics personvernpolicy.", @@ -364,6 +368,7 @@ "Restaurants & Bars": "Restaurants & Bars", "Retype new password": "Skriv inn nytt passord på nytt", "Room & Terms": "Rom & Vilkår", + "Room charge": "Pris for rom", "Room facilities": "Romfasiliteter", "Rooms": "Rom", "Rooms & Guests": "Rom og gjester", diff --git a/i18n/dictionaries/sv.json b/i18n/dictionaries/sv.json index 118557d06..4e2c42ac7 100644 --- a/i18n/dictionaries/sv.json +++ b/i18n/dictionaries/sv.json @@ -45,6 +45,7 @@ "At latest": "Senast", "At the hotel": "På hotellet", "Attractions": "Sevärdheter", + "Average price per night": "Snittpris per natt", "Away from elevator": "Bort från hissen", "Back to scandichotels.com": "Tillbaka till scandichotels.com", "Back to top": "Tillbaka till toppen", @@ -68,6 +69,9 @@ "Breakfast is included.": "Frukost ingår.", "Breakfast restaurant": "Breakfast restaurant", "Breakfast selection in next step.": "Frukostval i nästa steg.", + "Breakfast charge": "Frukostpris", + "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Frukost ({totalAdults, plural, one {# vuxen} other {# vuxna}}) x {totalBreakfasts}", + "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Frukost ({totalChildren, plural, one {# barn} other {# barn}}) x {totalBreakfasts}", "Bus terminal": "Bussterminal", "Business": "Business", "By accepting the Terms and Conditions for Scandic Friends I understand that my personal data will be processed in accordance with Scandic's Privacy Policy.": "Genom att acceptera villkoren för Scandic Friends förstår jag att mina personuppgifter kommer att behandlas i enlighet med Scandics Integritetspolicy.", @@ -364,6 +368,7 @@ "Restaurants & Bars": "Restaurants & Bars", "Retype new password": "Upprepa nytt lösenord", "Room & Terms": "Rum & Villkor", + "Room charge": "Rumspris", "Room facilities": "Rumfaciliteter", "Rooms": "Rum", "Rooms & Guests": "Rum och gäster",