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:
parent
94f12f0a86
commit
a3c9d6a7c0
@ -67,11 +67,15 @@ public class MockController {
|
|||||||
Curriculum chemistryBab1 = new Curriculum(1,"chemistry");
|
Curriculum chemistryBab1 = new Curriculum(1,"chemistry");
|
||||||
Curriculum psychologyBab1 = new Curriculum(1,"psychology");
|
Curriculum psychologyBab1 = new Curriculum(1,"psychology");
|
||||||
Curriculum infoBab2 = new Curriculum(2,"info");
|
Curriculum infoBab2 = new Curriculum(2,"info");
|
||||||
|
Curriculum masterinfo1 = new Curriculum(4, "info");
|
||||||
|
Curriculum masterinfo2 = new Curriculum(5, "info");
|
||||||
|
|
||||||
curriculumService.save(infoBab1);
|
curriculumService.save(infoBab1);
|
||||||
curriculumService.save(chemistryBab1);
|
curriculumService.save(chemistryBab1);
|
||||||
curriculumService.save(psychologyBab1);
|
curriculumService.save(psychologyBab1);
|
||||||
curriculumService.save(infoBab2);
|
curriculumService.save(infoBab2);
|
||||||
|
curriculumService.save(masterinfo1);
|
||||||
|
curriculumService.save(masterinfo2);
|
||||||
|
|
||||||
ucr.save(new UserCurriculum(joe, infoBab1, 2022));
|
ucr.save(new UserCurriculum(joe, infoBab1, 2022));
|
||||||
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023));
|
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023));
|
||||||
|
@ -9,10 +9,10 @@ let request = await getRegisters(props.target);
|
|||||||
const cursus = await getcurriculum(request.curriculum);
|
const cursus = await getcurriculum(request.curriculum);
|
||||||
|
|
||||||
function getPP(){
|
function getPP(){
|
||||||
if(request.profilePicture === null){
|
if(request.profilePictureUrl === null){
|
||||||
return "/Clyde.png"
|
return "/Clyde.png"
|
||||||
}
|
}
|
||||||
return request.profilePicture;
|
return request.profilePictureUrl;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
async function upPage(id,review){
|
async function upPage(id,review){
|
||||||
await validateRegister(id,review);
|
await validateRegister(id,review);
|
||||||
requests.value = await getAllRegisters();
|
requests.value = await getAllRegisters();
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -24,9 +24,12 @@
|
|||||||
|
|
||||||
const submitValue= ref(i18n("login.guest.submit"))
|
const submitValue= ref(i18n("login.guest.submit"))
|
||||||
const passwordConfirm=ref("")
|
const passwordConfirm=ref("")
|
||||||
|
|
||||||
|
//Allows to display MA or BAB for years
|
||||||
|
let yearprefix = "";
|
||||||
|
|
||||||
const imageSaved = ref(false)
|
const imageSaved = ref(false)
|
||||||
const ppData = ref(false)
|
let ppData = "";
|
||||||
|
|
||||||
const curricula= await getAllCurriculums();
|
const curricula= await getAllCurriculums();
|
||||||
|
|
||||||
@ -50,7 +53,20 @@
|
|||||||
disconnect();
|
disconnect();
|
||||||
window.location.reload();}
|
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>
|
</script>
|
||||||
|
|
||||||
@ -130,16 +146,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<form novalidate enctype="multipart/form-data" class="inputBox">
|
<form novalidate enctype="multipart/form-data" class="inputBox">
|
||||||
<p>{{i18n("profile.picture").toUpperCase()}}</p>
|
<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>
|
</form>
|
||||||
<div class="inputBox">
|
<div class="inputBox">
|
||||||
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
||||||
<select v-model="outputs.curriculum">
|
<select v-model="outputs.curriculum">
|
||||||
<option v-for="item in curricula">{{item.curriculumId}}</option>
|
<option v-for="item in curricula">{{getCursusDisplay(item)}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div style="align-self:center;" class="inputBox">
|
<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")}}
|
{{i18n("login.guest.nextpage")}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -153,7 +169,6 @@
|
|||||||
<div v-if="page === 2">
|
<div v-if="page === 2">
|
||||||
<form novalidate enctype="multipart/form-data" class="inputBox">
|
<form novalidate enctype="multipart/form-data" class="inputBox">
|
||||||
Carte d'identité :
|
Carte d'identité :
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -26,7 +26,7 @@ export function disconnect(){
|
|||||||
* @param curriculum
|
* @param curriculum
|
||||||
* @param imageId id of the image in database returned when uploaded
|
* @param imageId id of the image in database returned when uploaded
|
||||||
*/
|
*/
|
||||||
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId){
|
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate){
|
||||||
return restPost("/register", {
|
return restPost("/register", {
|
||||||
firstName: firstname,
|
firstName: firstname,
|
||||||
lastName: lastname,
|
lastName: lastname,
|
||||||
@ -36,7 +36,9 @@ export async function register(firstname, lastname, birthDate, password, email,
|
|||||||
address: address,
|
address: address,
|
||||||
country: country,
|
country: country,
|
||||||
curriculumId: curriculumId,
|
curriculumId: curriculumId,
|
||||||
profilePictureUrl: imageId,
|
profilePicture: imageId,
|
||||||
|
identityCard : identityCardId,
|
||||||
|
submissionDate : submissionDate
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ export async function register(firstname, lastname, birthDate, password, email,
|
|||||||
* @param country
|
* @param country
|
||||||
* @param imageId id of the image in database returned when uploaded
|
* @param imageId id of the image in database returned when uploaded
|
||||||
*
|
*
|
||||||
* PS: the password is not is not required as it is generated by the backend and sent to the user
|
* PS: the password is not required as it is generated by the backend and sent to the user
|
||||||
* by mail. it's up to the user to change it if he cares about security
|
* by mail. it's up to the user to change it if he cares about security
|
||||||
*/
|
*/
|
||||||
export async function createUser(firstname, lastname, birthDate, email, address, country, role, imageId){
|
export async function createUser(firstname, lastname, birthDate, email, address, country, role, imageId){
|
||||||
|
@ -7,5 +7,17 @@ import { restPostFile } from '@/rest/restConsumer.js'
|
|||||||
export async function uploadProfilePicture(file){
|
export async function uploadProfilePicture(file){
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", file[0]);
|
formData.append("file", file[0]);
|
||||||
return restPostFile("/upload/ProfilePicture", formData)
|
|
||||||
|
return restPostFile("/upload/ProfilePicture", formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* More generic version of the upload method
|
||||||
|
*/
|
||||||
|
|
||||||
|
export async function uploadFile(file, type){
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", file[0]);
|
||||||
|
return restPostFile("/upload/"+type, formData)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user