Small changes

This commit is contained in:
LeoMoulin 2024-04-20 12:42:41 +02:00
parent 92cdeaebba
commit cdc3772384
6 changed files with 22 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import {getExternalCurriculumByInscrReq} from "@/rest/externalCurriculum.js";
import {ref} from "vue"; import {ref} from "vue";
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue"; import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
import {editEquivalenceState} from "@/rest/requests.js"; import {editEquivalenceState} from "@/rest/requests.js";
import {downloadPdf} from "@/rest/uploads.js";
const props = defineProps(['target']); const props = defineProps(['target']);
const request = await getRegisters(props.target); const request = await getRegisters(props.target);
@ -56,6 +57,10 @@ async function editEquivalence(id, newstate){
<div> <div>
Cursus voulu : BAB {{cursus.year}} {{cursus.option}} Cursus voulu : BAB {{cursus.year}} {{cursus.option}}
</div> </div>
<div>
<a :href="downloadPdf(request.identityCard)">Download identity card</a>
<button v-if="request.admissionDocUrl != null">Download admission document</button>
</div>
<div v-if="cursus.year > 1"> <div v-if="cursus.year > 1">
<button style="background-color:rgb(105,05,105);margin-left: 5%" @click="list=!list" v-if="(user.role == 'Teacher' || user.role == 'Admin')&& request.equivalenceState == 'Pending'">See external curriculums</button> <button style="background-color:rgb(105,05,105);margin-left: 5%" @click="list=!list" v-if="(user.role == 'Teacher' || user.role == 'Admin')&& request.equivalenceState == 'Pending'">See external curriculums</button>
</div> </div>

View File

@ -54,7 +54,7 @@ async function uploadandrefreshScholarshipRequest(){
Birthdate : {{user.birthDate.slice(0,10)}} Birthdate : {{user.birthDate.slice(0,10)}}
</div> </div>
<div> <div>
<button>Download tax justif document</button> <button @click="">Download tax justif document</button>
<button style="margin-left: 2%">Download residency justif document</button> <button style="margin-left: 2%">Download residency justif document</button>
</div> </div>
<div v-if="req.state == 'Pending'"> <div v-if="req.state == 'Pending'">

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {getUser} from '../../rest/Users.js' import {getSelf, getUser} from '../../rest/Users.js'
import {getSomeonesCurriculumList} from "@/rest/curriculum.js"; import {getSomeonesCurriculumList} from "@/rest/curriculum.js";
import {ref} from "vue"; import {ref} from "vue";
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue"; import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
@ -12,6 +12,7 @@
const externalcurrlist = await getExternalCurriculumByUser(user.regNo) const externalcurrlist = await getExternalCurriculumByUser(user.regNo)
const extercurrlist = ref(false) const extercurrlist = ref(false)
const watchingUser = await getSelf()
function getPP(){ function getPP(){
if(user.profilePictureUrl === null){ if(user.profilePictureUrl === null){
return "/Clyde.png" return "/Clyde.png"
@ -54,6 +55,9 @@
<div> <div>
Date de naissance : {{user.birthDate}} Date de naissance : {{user.birthDate}}
</div> </div>
<div>
<button v-if="watchingUser.role === 'Admin' || watchingUser.role === 'InscriptionService' || watchingUser.role === 'Secretary' || watchingUser.regNo === user.regNo">Download identity card</button>
</div>
<div> <div>
<button @click="extercurrlist=!extercurrlist">See external curriculums</button> <button @click="extercurrlist=!extercurrlist">See external curriculums</button>
</div> </div>

View File

@ -3,6 +3,7 @@
import {reactive, ref} from "vue"; import {reactive, ref} from "vue";
import {getSelf} from "@/rest/Users.js"; import {getSelf} from "@/rest/Users.js";
import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js"; import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
import {uploadFile} from "@/rest/uploads.js";
//mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user, 2 inscription procedure //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user, 2 inscription procedure
const props = defineProps(["extCurrList", "mode"]) const props = defineProps(["extCurrList", "mode"])
@ -51,7 +52,8 @@
async function postExternalCurr(){ async function postExternalCurr(){
if (props.mode === 1){ if (props.mode === 1){
await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo); const temp = await uploadFile(externalCurr.justifdocUrl, "JustificationDocument")
await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, temp.value.url, externalCurr.userRegNo);
//We refresh the list //We refresh the list
extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
list.value = !list.value; list.value = !list.value;
@ -68,7 +70,6 @@
}); });
extCurrList.value = externalCurrTab.value extCurrList.value = externalCurrTab.value
list.value = !list.value; list.value = !list.value;
console.log(externalCurrTab.value)
} }
} }
</script> </script>
@ -118,6 +119,10 @@
<p>Année de fin</p> <p>Année de fin</p>
<input type="number" v-model="externalCurr.endYear"> <input type="number" v-model="externalCurr.endYear">
</div> </div>
<div class="inputBox">
<p>Veuillez soumettre un document attestant de ce parcours</p>
<input type="file" @change="externalCurr.justifdocUrl = $event.target.files">
</div>
<div class="inputBox" style="margin-top: 3%; margin-bottom: 3%"> <div class="inputBox" style="margin-top: 3%; margin-bottom: 3%">
<input v-if="!editmode" type="submit" value="Upload curriculum" @click="postExternalCurr()"> <input v-if="!editmode" type="submit" value="Upload curriculum" @click="postExternalCurr()">
<input v-else type="submit" value="Edit curriculum" @click="externalCurrTab[extNum] = {inscriptionRequestId : externalCurr.inscriptionRequestId,school:externalCurr.school,formation :externalCurr.formation,completion : externalCurr.completion,startYear : externalCurr.startYear,endYear: externalCurr.endYear,justifdocUrl : externalCurr.justifdocUrl,userRegNo : externalCurr.userRegNo};editmode=!editmode;list=!list"> <input v-else type="submit" value="Edit curriculum" @click="externalCurrTab[extNum] = {inscriptionRequestId : externalCurr.inscriptionRequestId,school:externalCurr.school,formation :externalCurr.formation,completion : externalCurr.completion,startYear : externalCurr.startYear,endYear: externalCurr.endYear,justifdocUrl : externalCurr.justifdocUrl,userRegNo : externalCurr.userRegNo};editmode=!editmode;list=!list">

View File

@ -108,13 +108,13 @@
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, identityCardFile.url, new Date(), outputs.equivalenceState, justif); const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, identityCardFile.url, new Date(), outputs.equivalenceState, justif);
for (let item in externalCurrTab.value){ for (let item in externalCurrTab.value){
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, externalCurrTab.value[item].justifdocUrl); const temp = await uploadFile(externalCurrTab.value[item].justifdocUrl, "JustificationDocument")
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, temp.value.url);
} }
} }
</script> </script>
<template> <template>
<div class="setup" v-if="page !== 4"> <div class="setup" v-if="page !== 4">
<div v-if="loginPage"> <div v-if="loginPage">

View File

@ -13,11 +13,11 @@ export async function uploadProfilePicture(file){
/** /**
* More generic version of the upload method * More generic version of the uploadProfilePicture method
*/ */
export async function uploadFile(file, type){ export async function uploadFile(file, type){
const formData = new FormData(); const formData = new FormData();
formData.append("file", file[0]); formData.append("file", file[0]);
return restPostFile("/upload/"+type, formData) return restPostFile("/upload/"+type, formData)
} }