|
@@ -83,9 +83,9 @@
|
|
|
</v-col>
|
|
</v-col>
|
|
|
|
|
|
|
|
<v-col cols="12" md="6">
|
|
<v-col cols="12" md="6">
|
|
|
- <!-- TODO: remplacer par un input dédié aux nums de téléphone -->
|
|
|
|
|
<v-text-field
|
|
<v-text-field
|
|
|
v-model="phone"
|
|
v-model="phone"
|
|
|
|
|
+ :rules="[validatePhone]"
|
|
|
label="Téléphone*"
|
|
label="Téléphone*"
|
|
|
type="tel"
|
|
type="tel"
|
|
|
/>
|
|
/>
|
|
@@ -251,6 +251,9 @@ const validatePostalCode = (postalCode: string | null) =>
|
|
|
const validateEmail = (email: string | null) =>
|
|
const validateEmail = (email: string | null) =>
|
|
|
(!!email && /.+@.+\..+/.test(email)) || "L'adresse e-mail doit être valide";
|
|
(!!email && /.+@.+\..+/.test(email)) || "L'adresse e-mail doit être valide";
|
|
|
|
|
|
|
|
|
|
+const validatePhone = (email: string | null) =>
|
|
|
|
|
+ (!!email && /^((\+|00)33\s?|0)[67]([\s.]?\d{2}){4}$/.test(email)) || "Le numéro de téléphone doit être valide";
|
|
|
|
|
+
|
|
|
const validateStructureName = (structureName: string | null) =>
|
|
const validateStructureName = (structureName: string | null) =>
|
|
|
!!structureName || "Le nom de la structure est requis";
|
|
!!structureName || "Le nom de la structure est requis";
|
|
|
|
|
|
|
@@ -265,6 +268,7 @@ const valid: ComputedRef<boolean> = computed(() => {
|
|
|
validateSurname(surname.value) === true &&
|
|
validateSurname(surname.value) === true &&
|
|
|
validatePostalCode(postalCode.value) === true &&
|
|
validatePostalCode(postalCode.value) === true &&
|
|
|
validateEmail(email.value) === true &&
|
|
validateEmail(email.value) === true &&
|
|
|
|
|
+ validatePhone(phone.value) === true &&
|
|
|
validateStructureName(structureName.value) === true &&
|
|
validateStructureName(structureName.value) === true &&
|
|
|
validateMessageLength(message.value) === true &&
|
|
validateMessageLength(message.value) === true &&
|
|
|
privacyPolicy.value === true &&
|
|
privacyPolicy.value === true &&
|