fix: add special requests to store

This commit is contained in:
Christel Westerberg
2024-12-11 15:19:43 +01:00
parent ed3879f6d2
commit 4872847ecb
10 changed files with 26 additions and 30 deletions

View File

@@ -53,9 +53,17 @@ export default function Details({ user, memberPrice }: DetailsProps) {
membershipNo: initialData.membershipNo, membershipNo: initialData.membershipNo,
phoneNumber: user?.phoneNumber ?? initialData.phoneNumber, phoneNumber: user?.phoneNumber ?? initialData.phoneNumber,
zipCode: initialData.zipCode, zipCode: initialData.zipCode,
specialRequests: initialData.specialRequests,
}, },
}) })
const noPreferenceItem = {
value: "",
label: intl.formatMessage({
id: "No preference",
}),
}
const onSubmit = useCallback( const onSubmit = useCallback(
(values: DetailsSchema) => { (values: DetailsSchema) => {
updateDetails(values) updateDetails(values)
@@ -135,12 +143,7 @@ export default function Details({ user, memberPrice }: DetailsProps) {
label={intl.formatMessage({ id: "Floor preference" })} label={intl.formatMessage({ id: "Floor preference" })}
name="specialRequests.floorPreference" name="specialRequests.floorPreference"
items={[ items={[
{ noPreferenceItem,
value: "",
label: intl.formatMessage({
id: "No preference",
}),
},
{ {
value: FloorPreference.HIGH, value: FloorPreference.HIGH,
label: intl.formatMessage({ id: FloorPreference.HIGH }), label: intl.formatMessage({ id: FloorPreference.HIGH }),
@@ -156,12 +159,7 @@ export default function Details({ user, memberPrice }: DetailsProps) {
label={intl.formatMessage({ id: "Elevator preference" })} label={intl.formatMessage({ id: "Elevator preference" })}
name="specialRequests.elevatorPreference" name="specialRequests.elevatorPreference"
items={[ items={[
{ noPreferenceItem,
value: "",
label: intl.formatMessage({
id: "No preference",
}),
},
{ {
value: ElevatorPreference.AWAY_FROM_ELEVATOR, value: ElevatorPreference.AWAY_FROM_ELEVATOR,
label: intl.formatMessage({ label: intl.formatMessage({

View File

@@ -22,7 +22,7 @@ const specialRequestsSchema = z
.object({ .object({
floorPreference: z.nativeEnum(FloorPreference).optional(), floorPreference: z.nativeEnum(FloorPreference).optional(),
elevatorPreference: z.nativeEnum(ElevatorPreference).optional(), elevatorPreference: z.nativeEnum(ElevatorPreference).optional(),
comments: z.string().optional(), comments: z.string().default(""),
}) })
.optional() .optional()

View File

@@ -118,7 +118,7 @@
.accordion:not(:last-child) .iconWrapper::after { .accordion:not(:last-child) .iconWrapper::after {
position: absolute; position: absolute;
left: 12px; left: 12px;
bottom: calc(0px - var(--Spacing-x7)); bottom: calc(0px - var(--Spacing-x5));
top: var(--circle-height); top: var(--circle-height);
content: ""; content: "";

View File

@@ -15,8 +15,6 @@ import Body from "../../Text/Body"
import styles from "./textarea.module.css" import styles from "./textarea.module.css"
import type { HTMLAttributes, WheelEvent } from "react"
import type { TextAreaProps } from "./input" import type { TextAreaProps } from "./input"
export default function TextArea({ export default function TextArea({
@@ -29,15 +27,9 @@ export default function TextArea({
placeholder = "", placeholder = "",
readOnly = false, readOnly = false,
registerOptions = {}, registerOptions = {},
type = "text",
}: TextAreaProps) { }: TextAreaProps) {
const { control } = useFormContext() const { control } = useFormContext()
let numberAttributes: HTMLAttributes<HTMLTextAreaElement> = {}
if (type === "number") {
numberAttributes.onWheel = function (evt: WheelEvent<HTMLTextAreaElement>) {
evt.currentTarget.blur()
}
}
return ( return (
<Controller <Controller
disabled={disabled} disabled={disabled}

View File

@@ -152,7 +152,7 @@
"First name can't contain any special characters": "Fornavn kan ikke indeholde specielle tegn", "First name can't contain any special characters": "Fornavn kan ikke indeholde specielle tegn",
"First name is required": "Fornavn er påkrævet", "First name is required": "Fornavn er påkrævet",
"Flexibility": "Fleksibilitet", "Flexibility": "Fleksibilitet",
"Floor preferences": "Etagepræferencer", "Floor preference": "Etagepræference",
"Follow us": "Følg os", "Follow us": "Følg os",
"Food options": "Madvalg", "Food options": "Madvalg",
"Former Scandic Hotel": "Tidligere Scandic Hotel", "Former Scandic Hotel": "Tidligere Scandic Hotel",
@@ -265,6 +265,7 @@
"No breakfast": "Ingen morgenmad", "No breakfast": "Ingen morgenmad",
"No content published": "Intet indhold offentliggjort", "No content published": "Intet indhold offentliggjort",
"No matching location found": "Der blev ikke fundet nogen matchende placering", "No matching location found": "Der blev ikke fundet nogen matchende placering",
"No preference": "Ingen præference",
"No prices available": "Ingen tilgængelige priser", "No prices available": "Ingen tilgængelige priser",
"No results": "Ingen resultater", "No results": "Ingen resultater",
"No transactions available": "Ingen tilgængelige transaktioner", "No transactions available": "Ingen tilgængelige transaktioner",

View File

@@ -152,7 +152,7 @@
"First name can't contain any special characters": "Der Vorname darf keine Sonderzeichen enthalten", "First name can't contain any special characters": "Der Vorname darf keine Sonderzeichen enthalten",
"First name is required": "Vorname ist erforderlich", "First name is required": "Vorname ist erforderlich",
"Flexibility": "Flexibilität", "Flexibility": "Flexibilität",
"Floor preferences": "Etagenpräferenzen", "Floor preference": "Etagenpräferenzen",
"Follow us": "Folgen Sie uns", "Follow us": "Folgen Sie uns",
"Food options": "Speisen & Getränke", "Food options": "Speisen & Getränke",
"Former Scandic Hotel": "Ehemaliges Scandic Hotel", "Former Scandic Hotel": "Ehemaliges Scandic Hotel",
@@ -264,6 +264,7 @@
"No breakfast": "Kein Frühstück", "No breakfast": "Kein Frühstück",
"No content published": "Kein Inhalt veröffentlicht", "No content published": "Kein Inhalt veröffentlicht",
"No matching location found": "Kein passender Standort gefunden", "No matching location found": "Kein passender Standort gefunden",
"No preference": "Keine Präferenz",
"No prices available": "Keine Preise verfügbar", "No prices available": "Keine Preise verfügbar",
"No results": "Keine Ergebnisse", "No results": "Keine Ergebnisse",
"No transactions available": "Keine Transaktionen verfügbar", "No transactions available": "Keine Transaktionen verfügbar",

View File

@@ -160,7 +160,7 @@
"First name can't contain any special characters": "First name can't contain any special characters", "First name can't contain any special characters": "First name can't contain any special characters",
"First name is required": "First name is required", "First name is required": "First name is required",
"Flexibility": "Flexibility", "Flexibility": "Flexibility",
"Floor preferences": "Floor preferences", "Floor preference": "Floor preference",
"Follow us": "Follow us", "Follow us": "Follow us",
"Food options": "Food options", "Food options": "Food options",
"Former Scandic Hotel": "Former Scandic Hotel", "Former Scandic Hotel": "Former Scandic Hotel",
@@ -286,6 +286,7 @@
"No content published": "No content published", "No content published": "No content published",
"No matching location found": "No matching location found", "No matching location found": "No matching location found",
"No membership benefits applied": "No membership benefits applied", "No membership benefits applied": "No membership benefits applied",
"No preference": "No preference",
"No prices available": "No prices available", "No prices available": "No prices available",
"No results": "No results", "No results": "No results",
"No transactions available": "No transactions available", "No transactions available": "No transactions available",

View File

@@ -152,7 +152,7 @@
"First name can't contain any special characters": "Etunimi ei voi sisältää erikoismerkkejä", "First name can't contain any special characters": "Etunimi ei voi sisältää erikoismerkkejä",
"First name is required": "Etunimi vaaditaan", "First name is required": "Etunimi vaaditaan",
"Flexibility": "Joustavuus", "Flexibility": "Joustavuus",
"Floor preferences": "Kerrostasotoive", "Floor preference": "Kerrostasotoive",
"Follow us": "Seuraa meitä", "Follow us": "Seuraa meitä",
"Food options": "Ruokavalio", "Food options": "Ruokavalio",
"Former Scandic Hotel": "Entinen Scandic-hotelli", "Former Scandic Hotel": "Entinen Scandic-hotelli",
@@ -265,6 +265,7 @@
"No breakfast": "Ei aamiaista", "No breakfast": "Ei aamiaista",
"No content published": "Ei julkaistua sisältöä", "No content published": "Ei julkaistua sisältöä",
"No matching location found": "Vastaavaa sijaintia ei löytynyt", "No matching location found": "Vastaavaa sijaintia ei löytynyt",
"No preference": "Ei toivetta",
"No prices available": "Hintoja ei ole saatavilla", "No prices available": "Hintoja ei ole saatavilla",
"No results": "Ei tuloksia", "No results": "Ei tuloksia",
"No transactions available": "Ei tapahtumia saatavilla", "No transactions available": "Ei tapahtumia saatavilla",

View File

@@ -151,7 +151,7 @@
"First name can't contain any special characters": "Fornavn kan ikke inneholde spesielle tegn", "First name can't contain any special characters": "Fornavn kan ikke inneholde spesielle tegn",
"First name is required": "Fornavn kreves", "First name is required": "Fornavn kreves",
"Flexibility": "Fleksibilitet", "Flexibility": "Fleksibilitet",
"Floor preferences": "Etasjepreferanser", "Floor preference": "Etasjepreferans",
"Follow us": "Følg oss", "Follow us": "Følg oss",
"Food options": "Matvalg", "Food options": "Matvalg",
"Former Scandic Hotel": "Tidligere Scandic-hotell", "Former Scandic Hotel": "Tidligere Scandic-hotell",
@@ -264,6 +264,7 @@
"No breakfast": "Ingen frokost", "No breakfast": "Ingen frokost",
"No content published": "Ingen innhold publisert", "No content published": "Ingen innhold publisert",
"No matching location found": "Fant ingen samsvarende plassering", "No matching location found": "Fant ingen samsvarende plassering",
"No preference": "Ingen preferanse",
"No prices available": "Ingen priser tilgjengelig", "No prices available": "Ingen priser tilgjengelig",
"No results": "Ingen resultater", "No results": "Ingen resultater",
"No transactions available": "Ingen transaksjoner tilgjengelig", "No transactions available": "Ingen transaksjoner tilgjengelig",

View File

@@ -127,7 +127,7 @@
"Earn bonus nights & points": "Tjäna bonusnätter och poäng", "Earn bonus nights & points": "Tjäna bonusnätter och poäng",
"Edit": "Redigera", "Edit": "Redigera",
"Edit profile": "Redigera profil", "Edit profile": "Redigera profil",
"Elevator preference": "Hisspreferencer", "Elevator preference": "Hisspreferens",
"Email": "E-post", "Email": "E-post",
"Email address": "E-postadress", "Email address": "E-postadress",
"Email address is required": "E-postadress är obligatorisk", "Email address is required": "E-postadress är obligatorisk",
@@ -151,7 +151,7 @@
"First name can't contain any special characters": "Förnamn får inte innehålla några specialtecken", "First name can't contain any special characters": "Förnamn får inte innehålla några specialtecken",
"First name is required": "Förnamn är obligatoriskt", "First name is required": "Förnamn är obligatoriskt",
"Flexibility": "Flexibilitet", "Flexibility": "Flexibilitet",
"Floor preferences": "Våningpreferenser", "Floor preference": "Våningpreferens",
"Follow us": "Följ oss", "Follow us": "Följ oss",
"Food options": "Matval", "Food options": "Matval",
"Former Scandic Hotel": "Tidigare Scandichotell", "Former Scandic Hotel": "Tidigare Scandichotell",
@@ -264,6 +264,7 @@
"No breakfast": "Ingen frukost", "No breakfast": "Ingen frukost",
"No content published": "Inget innehåll publicerat", "No content published": "Inget innehåll publicerat",
"No matching location found": "Ingen matchande plats hittades", "No matching location found": "Ingen matchande plats hittades",
"No preference": "Ingen preferens",
"No prices available": "Inga priser tillgängliga", "No prices available": "Inga priser tillgängliga",
"No results": "Inga resultat", "No results": "Inga resultat",
"No transactions available": "Inga transaktioner tillgängliga", "No transactions available": "Inga transaktioner tillgängliga",