1
0
forked from PGL/Clyde

Fix the profilepicture url issue (it wasn't sent to the db)

add a prototype of a more generic uploadfile function in uploads.js

makes the distinction between a master cursus and a bachelor cursus in display
This commit is contained in:
2024-03-29 10:55:59 +01:00
parent 94f12f0a86
commit a3c9d6a7c0
6 changed files with 46 additions and 14 deletions

View File

@ -24,9 +24,12 @@
const submitValue= ref(i18n("login.guest.submit"))
const passwordConfirm=ref("")
//Allows to display MA or BAB for years
let yearprefix = "";
const imageSaved = ref(false)
const ppData = ref(false)
let ppData = "";
const curricula= await getAllCurriculums();
@ -50,7 +53,20 @@
disconnect();
window.location.reload();}
async function uploadPP(arg){
const data = await uploadProfilePicture(arg);
ppData = data.url;
console.log(ppData);
}
//This functions makes the distinction between a master cursus (year 4 or more) and a bachelor cursus (year 3 or less)
function getCursusDisplay(cursus){
if (cursus.year <= 3){
return "BAB " + cursus.year + " " + cursus.option;
}else{
return "MA" + (parseInt(cursus.year)-3).toString() + " " + cursus.option;
}
}
</script>
@ -130,16 +146,16 @@
</div>
<form novalidate enctype="multipart/form-data" class="inputBox">
<p>{{i18n("profile.picture").toUpperCase()}}</p>
<input type="file" :disabled="imageSaved" @change="ppData = uploadProfilePicture($event.target.files); imageSaved = true;" accept="image/*">
<input type="file" @change="uploadPP($event.target.files); imageSaved = true;" accept="image/*">
</form>
<div class="inputBox">
<p>{{i18n("Curriculum").toUpperCase()}}</p>
<select v-model="outputs.curriculum">
<option v-for="item in curricula">{{item.curriculumId}}</option>
<option v-for="item in curricula">{{getCursusDisplay(item)}}</option>
</select>
</div>
<div style="align-self:center;" class="inputBox">
<button style="margin-top:25px;" @click="page++">
<button style="margin-top:25px;" @click="page++; register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, null, new Date());">
{{i18n("login.guest.nextpage")}}
</button>
</div>
@ -153,7 +169,6 @@
<div v-if="page === 2">
<form novalidate enctype="multipart/form-data" class="inputBox">
Carte d'identité :
</form>
</div>
</form>