Merged in fix/sw-1867-multiroom-guests (pull request #1822)

fix(sw-1867): Don't allow same name or membno between rooms

* fix(sw-1867): Don't allow same name or membno between rooms

We don't want to allow two different rooms to have the same firstname
and lastname combination or the same membership number.

* Fine tune validation triggers

* Add comments explaining manual validation triggering

* Change to react-hook-form built-in deps instead


Approved-by: Simon.Emanuelsson
This commit is contained in:
Niclas Edenvin
2025-04-22 09:06:43 +00:00
parent 8a68a79ac4
commit 3f6a65d390
5 changed files with 135 additions and 39 deletions

View File

@@ -45,6 +45,11 @@ export function getErrorMessage(intl: IntlShape, errorCode?: string) {
return intl.formatMessage({
defaultMessage: "Last name can't contain any special characters",
})
case multiroomErrors.FIRST_AND_LAST_NAME_UNIQUE:
return intl.formatMessage({
defaultMessage:
"First and last name can't be the same in two different rooms",
})
case findMyBookingErrors.EMAIL_REQUIRED:
case multiroomErrors.EMAIL_REQUIRED:
case roomOneErrors.EMAIL_REQUIRED:
@@ -120,6 +125,11 @@ export function getErrorMessage(intl: IntlShape, errorCode?: string) {
return intl.formatMessage({
defaultMessage: "Invalid membership number format",
})
case multiroomErrors.MEMBERSHIP_NO_UNIQUE:
return intl.formatMessage({
defaultMessage:
"Membership number can't be the same for two different rooms",
})
case bookingWidgetErrors.AGE_REQUIRED:
return intl.formatMessage({
defaultMessage: "Age is required",