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,
phoneNumber: user?.phoneNumber ?? initialData.phoneNumber,
zipCode: initialData.zipCode,
specialRequests: initialData.specialRequests,
},
})
const noPreferenceItem = {
value: "",
label: intl.formatMessage({
id: "No preference",
}),
}
const onSubmit = useCallback(
(values: DetailsSchema) => {
updateDetails(values)
@@ -135,12 +143,7 @@ export default function Details({ user, memberPrice }: DetailsProps) {
label={intl.formatMessage({ id: "Floor preference" })}
name="specialRequests.floorPreference"
items={[
{
value: "",
label: intl.formatMessage({
id: "No preference",
}),
},
noPreferenceItem,
{
value: 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" })}
name="specialRequests.elevatorPreference"
items={[
{
value: "",
label: intl.formatMessage({
id: "No preference",
}),
},
noPreferenceItem,
{
value: ElevatorPreference.AWAY_FROM_ELEVATOR,
label: intl.formatMessage({

View File

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

View File

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

View File

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

View File

@@ -152,7 +152,7 @@
"First name can't contain any special characters": "Fornavn kan ikke indeholde specielle tegn",
"First name is required": "Fornavn er påkrævet",
"Flexibility": "Fleksibilitet",
"Floor preferences": "Etagepræferencer",
"Floor preference": "Etagepræference",
"Follow us": "Følg os",
"Food options": "Madvalg",
"Former Scandic Hotel": "Tidligere Scandic Hotel",
@@ -265,6 +265,7 @@
"No breakfast": "Ingen morgenmad",
"No content published": "Intet indhold offentliggjort",
"No matching location found": "Der blev ikke fundet nogen matchende placering",
"No preference": "Ingen præference",
"No prices available": "Ingen tilgængelige priser",
"No results": "Ingen resultater",
"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 is required": "Vorname ist erforderlich",
"Flexibility": "Flexibilität",
"Floor preferences": "Etagenpräferenzen",
"Floor preference": "Etagenpräferenzen",
"Follow us": "Folgen Sie uns",
"Food options": "Speisen & Getränke",
"Former Scandic Hotel": "Ehemaliges Scandic Hotel",
@@ -264,6 +264,7 @@
"No breakfast": "Kein Frühstück",
"No content published": "Kein Inhalt veröffentlicht",
"No matching location found": "Kein passender Standort gefunden",
"No preference": "Keine Präferenz",
"No prices available": "Keine Preise verfügbar",
"No results": "Keine Ergebnisse",
"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 is required": "First name is required",
"Flexibility": "Flexibility",
"Floor preferences": "Floor preferences",
"Floor preference": "Floor preference",
"Follow us": "Follow us",
"Food options": "Food options",
"Former Scandic Hotel": "Former Scandic Hotel",
@@ -286,6 +286,7 @@
"No content published": "No content published",
"No matching location found": "No matching location found",
"No membership benefits applied": "No membership benefits applied",
"No preference": "No preference",
"No prices available": "No prices available",
"No results": "No results",
"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 is required": "Etunimi vaaditaan",
"Flexibility": "Joustavuus",
"Floor preferences": "Kerrostasotoive",
"Floor preference": "Kerrostasotoive",
"Follow us": "Seuraa meitä",
"Food options": "Ruokavalio",
"Former Scandic Hotel": "Entinen Scandic-hotelli",
@@ -265,6 +265,7 @@
"No breakfast": "Ei aamiaista",
"No content published": "Ei julkaistua sisältöä",
"No matching location found": "Vastaavaa sijaintia ei löytynyt",
"No preference": "Ei toivetta",
"No prices available": "Hintoja ei ole saatavilla",
"No results": "Ei tuloksia",
"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 is required": "Fornavn kreves",
"Flexibility": "Fleksibilitet",
"Floor preferences": "Etasjepreferanser",
"Floor preference": "Etasjepreferans",
"Follow us": "Følg oss",
"Food options": "Matvalg",
"Former Scandic Hotel": "Tidligere Scandic-hotell",
@@ -264,6 +264,7 @@
"No breakfast": "Ingen frokost",
"No content published": "Ingen innhold publisert",
"No matching location found": "Fant ingen samsvarende plassering",
"No preference": "Ingen preferanse",
"No prices available": "Ingen priser tilgjengelig",
"No results": "Ingen resultater",
"No transactions available": "Ingen transaksjoner tilgjengelig",

View File

@@ -127,7 +127,7 @@
"Earn bonus nights & points": "Tjäna bonusnätter och poäng",
"Edit": "Redigera",
"Edit profile": "Redigera profil",
"Elevator preference": "Hisspreferencer",
"Elevator preference": "Hisspreferens",
"Email": "E-post",
"Email address": "E-postadress",
"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 is required": "Förnamn är obligatoriskt",
"Flexibility": "Flexibilitet",
"Floor preferences": "Våningpreferenser",
"Floor preference": "Våningpreferens",
"Follow us": "Följ oss",
"Food options": "Matval",
"Former Scandic Hotel": "Tidigare Scandichotell",
@@ -264,6 +264,7 @@
"No breakfast": "Ingen frukost",
"No content published": "Inget innehåll publicerat",
"No matching location found": "Ingen matchande plats hittades",
"No preference": "Ingen preferens",
"No prices available": "Inga priser tillgängliga",
"No results": "Inga resultat",
"No transactions available": "Inga transaktioner tillgängliga",