Add hint for inputs in Welcome Dialog
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import actionDialog from '@/components/basics/actionDialog.vue';
|
import actionDialog from '@/components/basics/actionDialog.vue';
|
||||||
import outlinedButton from '@/components/basics/outlinedButton.vue';
|
import outlinedButton from '@/components/basics/outlinedButton.vue';
|
||||||
import ServerStateText from '@/components/pageParts/serverStateText.vue';
|
import ServerStateText from '@/components/pageParts/serverStateText.vue';
|
||||||
|
import { getRegisterNumberRules, getStringRules } from '@/scripts/validationRules';
|
||||||
import { useFeedbackStore } from '@/stores/feedback.store';
|
import { useFeedbackStore } from '@/stores/feedback.store';
|
||||||
import { usePreferencesStore } from '@/stores/preferences.store';
|
import { usePreferencesStore } from '@/stores/preferences.store';
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
@@ -135,9 +136,9 @@ watch(() => currentStep.value, () => {
|
|||||||
<v-col>
|
<v-col>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
hide-details
|
|
||||||
:label="$t('misc.yourFullName')"
|
:label="$t('misc.yourFullName')"
|
||||||
v-model="preferencesStore.studentName"
|
v-model="preferencesStore.studentName"
|
||||||
|
:rules="getStringRules(4)"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -146,9 +147,9 @@ watch(() => currentStep.value, () => {
|
|||||||
<v-col>
|
<v-col>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
hide-details
|
|
||||||
:label="$t('misc.registrationNumber')"
|
:label="$t('misc.registrationNumber')"
|
||||||
v-model="preferencesStore.registrationNumber"
|
v-model="preferencesStore.registrationNumber"
|
||||||
|
:rules="getRegisterNumberRules()"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -177,8 +178,8 @@ watch(() => currentStep.value, () => {
|
|||||||
<outlined-button
|
<outlined-button
|
||||||
v-else
|
v-else
|
||||||
@click="showDialog = false; preferencesStore.firstStartup = false"
|
@click="showDialog = false; preferencesStore.firstStartup = false"
|
||||||
:disabled="preferencesStore.studentName.length == 0 ||
|
:disabled="preferencesStore.studentName.length < 5 ||
|
||||||
preferencesStore.registrationNumber.length == 0"
|
preferencesStore.registrationNumber.length < 8"
|
||||||
prepend-icon="mdi-check"
|
prepend-icon="mdi-check"
|
||||||
color="success"
|
color="success"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -168,4 +168,32 @@ export function getIbanRules() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRegisterNumberRules() {
|
||||||
|
const feedbackStore = useFeedbackStore()
|
||||||
|
|
||||||
|
return [
|
||||||
|
value => {
|
||||||
|
if (value) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return feedbackStore.i18n.t('misc.validation.required')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value => {
|
||||||
|
if (value?.length >= 8) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return feedbackStore.i18n.t('misc.validation.notEnoughChars')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value => {
|
||||||
|
if(!isNaN(value) && !isNaN(parseFloat(value))) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return feedbackStore.i18n.t('misc.validation.onlyDigitsAllowed')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user