Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

521 - contact us form fields fixed #522

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions frontend/src/components/HomePage/ContactUs/ContactUs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,39 @@
</v-row>
<form @submit.prevent="onSubmit">
<v-text-field
variant="underlined"
color="#0CAEE7"
v-model="name"
:error-messages="nameErrors"
label="Imię"
required
@input="v$.name.$touch()"
@update:name="v$.name.$touch()"
@blur="v$.name.$touch()"
></v-text-field>
<v-text-field
variant="underlined"
color="#0CAEE7"
v-model="email"
:error-messages="emailErrors"
label="E-mail"
required
@input="v$.email.$touch()"
@input="v$.email.$touch"
@blur="v$.email.$touch()"
></v-text-field>
<v-text-field
variant="underlined"
color="#0CAEE7"
v-model="phone_no"
mask="###-###-###"
:error-messages="phoneErrors"
:counter="9"
label="Telefon"
@input="v$.phone_no.$touch()"
@update:phone_no="v$.phone_no.$touch()"
@blur="v$.phone_no.$touch()"
></v-text-field>
<v-textarea
variant="underlined"
color="#0CAEE7"
v-model="content"
:error-messages="contentErrors"
label="Wiadomość"
Expand Down Expand Up @@ -111,31 +119,31 @@ export default {
const errors = [];

if (!this.v$.name.$dirty) return errors;
!this.v$.name.required && errors.push('Imię jest wymagane');
this.v$.name.required.$invalid && errors.push('Imię jest wymagane');
return errors;
},
emailErrors() {
const errors = [];

if (!this.v$.email.$dirty) return errors;
!this.v$.email.email && errors.push('Poprawny adres email jest wymagany');
!this.v$.email.required && errors.push('E-mail jest wymagany');
this.v$.email.email.$invalid &&
errors.push('Poprawny adres email jest wymagany');
this.v$.email.required.$invalid && errors.push('E-mail jest wymagany');
return errors;
},
phoneErrors() {
const errors = [];

!this.v$.phone_no.minLength &&
this.v$.phone_no.minLength.$invalid &&
errors.push('Wprowadź poprawny numer np. 111-222-333');
return errors;
},
contentErrors() {
const errors = [];

if (!this.v$.content.$dirty) return errors;
!this.v$.content.minLength &&
this.v$.content.minLength.$invalid &&
errors.push('Minimalna długość to 10 znaków');
!this.v$.content.required &&
this.v$.content.required.$invalid &&
errors.push('Treść wiadomości jest wymagana');
return errors;
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/HomePage/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<app-join-us />
<div>
<v-alert
:value="sent"
v-model="sent"
dismissible
@click="onCloseAlert"
type="success"
Expand All @@ -16,7 +16,7 @@
Twoja wiadomość została wysłana
</v-alert>
<v-alert
:value="msgError"
v-model="msgError"
dismissible
@click="onErrorAlert"
type="error"
Expand Down