feat: add dynamic max year of study based on selected program in registration form

This commit is contained in:
Veronika Fehérvíziová
2025-12-02 20:32:31 +01:00
parent 4a5a4f990c
commit e64b6c2eca

View File

@@ -45,6 +45,7 @@ const form = ref({
year_of_study: 1,
consent: false,
});
const maxYearOfStudy = ref(0);
const loading = ref(false);
const error = ref(null as null | string);
@@ -83,6 +84,10 @@ async function handleRegistration() {
loading.value = false;
}
}
watch(form, (newForm) => {
maxYearOfStudy.value = newForm.studyProgram.slice(-1) === 'b' ? 3 : 2;
}, { deep: true, immediate: true });
</script>
<template>
@@ -119,7 +124,7 @@ async function handleRegistration() {
label="Študijný odbor:" variant="outlined" density="comfortable" />
<v-number-input control-variant="split" v-model="form.year_of_study" :rules="[rules.required]"
label="Ročník:" :min="1" :max="5"></v-number-input>
label="Ročník:" :min="1" :max="maxYearOfStudy"></v-number-input>
<v-checkbox v-model="form.consent" :rules="[rules.mustAgree]"
label="Súhlasím s podmienkami spracúvania osobných údajov" density="comfortable" />