Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit b172306

Browse files
committed
linter fixes
1 parent 60fb339 commit b172306

File tree

1 file changed

+113
-100
lines changed

1 file changed

+113
-100
lines changed

src/views/Register/Step2.vue

Lines changed: 113 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,135 @@
11
<template>
2-
<v-form @submit.prevent="validate" ref="form" v-model="isValid">
3-
<v-card-text>
4-
<v-row no-gutters>
5-
<v-col>
6-
<v-text-field
7-
v-bind="fields.firstName"
8-
v-model="fields.firstName.value"
9-
:disabled="isSubmitting"
10-
/>
11-
</v-col>
12-
<v-col>
13-
<v-text-field
14-
v-bind="fields.lastName"
15-
v-model="fields.lastName.value"
16-
:disabled="isSubmitting"
17-
/>
18-
</v-col>
19-
</v-row>
20-
<v-text-field
21-
v-bind="fields.studentEmail"
22-
v-model="fields.studentEmail.value"
23-
:disabled="isSubmitting"
24-
/>
25-
<date-of-birth-field :label="fields.dateOfBirth.label" v-model="fields.dateOfBirth.value" />
26-
</v-card-text>
2+
<v-form @submit.prevent="validate" ref="form" v-model="isValid">
3+
<v-card-text>
4+
<v-row no-gutters>
5+
<v-col>
6+
<v-text-field
7+
v-bind="fields.firstName"
8+
v-model="fields.firstName.value"
9+
:disabled="isSubmitting"
10+
/>
11+
</v-col>
12+
<v-col>
13+
<v-text-field
14+
v-bind="fields.lastName"
15+
v-model="fields.lastName.value"
16+
:disabled="isSubmitting"
17+
/>
18+
</v-col>
19+
</v-row>
20+
<v-text-field
21+
v-bind="fields.studentEmail"
22+
v-model="fields.studentEmail.value"
23+
:disabled="isSubmitting"
24+
/>
25+
<date-of-birth-field
26+
:label="fields.dateOfBirth.label"
27+
v-model="fields.dateOfBirth.value"
28+
/>
29+
</v-card-text>
2730

28-
<v-card-text v-if="showParentConsentAlert">
29-
<v-alert colored-border icon="mdi-firework">
30-
You are not 13 years of age.
31-
<p>
32-
In order to continue with the code challenge you must have your
33-
parent's permission. Have your parent or guardian complete the rest of
34-
this page.
35-
</p>
36-
<v-switch
37-
v-model="hasParentConsent"
38-
class="mx-2"
39-
:rules="[
31+
<v-card-text v-if="showParentConsentAlert">
32+
<v-alert colored-border icon="mdi-firework">
33+
You are not 13 years of age.
34+
<p>
35+
In order to continue with the code challenge you must have your
36+
parent's permission. Have your parent or guardian complete the rest of
37+
this page.
38+
</p>
39+
<v-switch
40+
v-model="hasParentConsent"
41+
class="mx-2"
42+
:rules="[
4043
v =>
4144
!!v ||
4245
'Please have your parent or guardian review this form before continuing'
4346
]"
44-
:label="
47+
:label="
4548
'I, the parent or guardian of ' +
4649
this.fields.firstName.value +
4750
' ' +
4851
this.fields.lastName.value +
4952
', give my consent to participate in the CodeWizardsHQ Code Challenge.'
5053
"
51-
></v-switch>
52-
</v-alert>
53-
</v-card-text>
54+
></v-switch>
55+
</v-alert>
56+
</v-card-text>
5457

55-
<v-card-actions>
56-
<v-btn color="secondary darken-2" @click="() => $emit('back')" :disabled="isSubmitting">Back</v-btn>
57-
<v-spacer />
58-
<v-btn color="secondary darken-2" type="submit" :disabled="isSubmitting">
59-
Next
60-
<v-progress-circular size="14" class="ml-3" indeterminate v-if="isSubmitting" />
61-
</v-btn>
62-
</v-card-actions>
63-
</v-form>
58+
<v-card-actions>
59+
<v-btn
60+
color="secondary darken-2"
61+
@click="() => $emit('back')"
62+
:disabled="isSubmitting"
63+
>Back</v-btn
64+
>
65+
<v-spacer />
66+
<v-btn color="secondary darken-2" type="submit" :disabled="isSubmitting">
67+
Next
68+
<v-progress-circular
69+
size="14"
70+
class="ml-3"
71+
indeterminate
72+
v-if="isSubmitting"
73+
/>
74+
</v-btn>
75+
</v-card-actions>
76+
</v-form>
6477
</template>
6578

6679
<script>
6780
import DateOfBirthField from "./DateOfBirthField";
6881
import moment from "moment";
6982
7083
export default {
71-
name: "register-step-2",
72-
props: ["fields"],
73-
components: {
74-
DateOfBirthField
75-
},
76-
watch: {
77-
"fields.dateOfBirth.value"() {
78-
if (!this.needsParentConsent) {
79-
this.showParentConsentAlert = false;
80-
}
81-
}
82-
},
83-
computed: {
84-
age() {
85-
return moment().diff(this.fields.dateOfBirth.value, "years", false);
86-
},
87-
needsParentConsent() {
88-
return this.age < 13;
89-
}
90-
},
91-
methods: {
92-
async submit() {
93-
if (this.isSubmitting) {
94-
return;
95-
}
96-
this.isSubmitting = true;
97-
const cb = () => {
98-
this.isSubmitting = false;
99-
};
100-
this.$emit("submit", cb);
101-
},
102-
validate() {
103-
if (this.$refs.form.validate()) {
104-
if (this.needsParentConsent && !this.hasParentConsent) {
105-
this.showParentConsentAlert = true;
106-
} else {
107-
this.submit();
108-
}
109-
}
110-
}
111-
},
112-
data() {
113-
return {
114-
showParentConsentAlert: false,
115-
hasParentConsent: false,
116-
isValid: false,
117-
isSubmitting: false,
118-
showCalendar: false
119-
};
120-
}
84+
name: "register-step-2",
85+
props: ["fields"],
86+
components: {
87+
DateOfBirthField
88+
},
89+
watch: {
90+
"fields.dateOfBirth.value"() {
91+
if (!this.needsParentConsent) {
92+
this.showParentConsentAlert = false;
93+
}
94+
}
95+
},
96+
computed: {
97+
age() {
98+
return moment().diff(this.fields.dateOfBirth.value, "years", false);
99+
},
100+
needsParentConsent() {
101+
return this.age < 13;
102+
}
103+
},
104+
methods: {
105+
async submit() {
106+
if (this.isSubmitting) {
107+
return;
108+
}
109+
this.isSubmitting = true;
110+
const cb = () => {
111+
this.isSubmitting = false;
112+
};
113+
this.$emit("submit", cb);
114+
},
115+
validate() {
116+
if (this.$refs.form.validate()) {
117+
if (this.needsParentConsent && !this.hasParentConsent) {
118+
this.showParentConsentAlert = true;
119+
} else {
120+
this.submit();
121+
}
122+
}
123+
}
124+
},
125+
data() {
126+
return {
127+
showParentConsentAlert: false,
128+
hasParentConsent: false,
129+
isValid: false,
130+
isSubmitting: false,
131+
showCalendar: false
132+
};
133+
}
121134
};
122135
</script>

0 commit comments

Comments
 (0)