Start the rework of externalCurriculum interface
This commit is contained in:
parent
8a5a26e2ab
commit
a9e52d34d4
@ -30,9 +30,16 @@ public class ExternalCurriculumController {
|
|||||||
//everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service)
|
//everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service)
|
||||||
@PostMapping("/externalcurriculum")
|
@PostMapping("/externalcurriculum")
|
||||||
public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody Map<String, Object> externalCurrInfos){
|
public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody Map<String, Object> externalCurrInfos){
|
||||||
InscriptionRequest ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId"));
|
//An external curriculum can either be linked to an User or to an InscriptionRequest
|
||||||
|
InscriptionRequest ir = null;
|
||||||
|
User user = null;
|
||||||
|
if (externalCurrInfos.get("inscriptionRequestId") != null){
|
||||||
|
ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId"));
|
||||||
|
}else{
|
||||||
|
user = userRepository.findById((Integer) externalCurrInfos.get("userRegNo"));
|
||||||
|
}
|
||||||
|
|
||||||
ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), null);
|
ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), user);
|
||||||
|
|
||||||
return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK);
|
return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,9 @@ public class MockController {
|
|||||||
|
|
||||||
userService.saveAll(mockUsers);
|
userService.saveAll(mockUsers);
|
||||||
|
|
||||||
|
ExternalCurriculum externalCurriculum = new ExternalCurriculum(null, "HEH", "Bachelier en ingénieur", "completed", 2015, 2017, null, joe);
|
||||||
|
externalCurriculumRepository.save(externalCurriculum);
|
||||||
|
|
||||||
Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023);
|
Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023);
|
||||||
minervalRepository.save(minerval);
|
minervalRepository.save(minerval);
|
||||||
// Course / Curriculum part
|
// Course / Curriculum part
|
||||||
@ -133,7 +136,7 @@ public class MockController {
|
|||||||
UnregisterRequest unregisterRequest = new UnregisterRequest(RequestState.Pending, "je veux partir", new Date(), joe.getRegNo(), joe.getFirstName(), joe.getLastName(), joe.getEmail(), null);
|
UnregisterRequest unregisterRequest = new UnregisterRequest(RequestState.Pending, "je veux partir", new Date(), joe.getRegNo(), joe.getFirstName(), joe.getLastName(), joe.getEmail(), null);
|
||||||
uninscriptionRequestRepository.save(unregisterRequest);
|
uninscriptionRequestRepository.save(unregisterRequest);
|
||||||
|
|
||||||
ExternalCurriculum externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null);
|
externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null);
|
||||||
externalCurriculumRepository.save(externalCurriculum);
|
externalCurriculumRepository.save(externalCurriculum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="extercurrlist==true">
|
<div v-if="extercurrlist==true">
|
||||||
<ExternalCurriculumList :ext-curr-list="externalcurrlist"></ExternalCurriculumList>
|
<ExternalCurriculumList :ext-curr-list="externalcurrlist" :mode="1"></ExternalCurriculumList>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,25 +1,91 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import i18n from "@/i18n.js";
|
import i18n from "@/i18n.js";
|
||||||
import {ref} from "vue";
|
import {reactive, ref} from "vue";
|
||||||
|
import {getSelf} from "@/rest/Users.js";
|
||||||
|
import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
|
||||||
|
|
||||||
const props = defineProps(["extCurrList"])
|
//mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user
|
||||||
|
const props = defineProps(["extCurrList", "mode"])
|
||||||
|
|
||||||
const extCurrList = ref(props.extCurrList)
|
const extCurrList = ref(props.extCurrList)
|
||||||
console.log(extCurrList)
|
|
||||||
|
const User = await getSelf()
|
||||||
|
|
||||||
|
const list = ref(true)
|
||||||
|
|
||||||
|
const notcompletedCheck = ref(false);
|
||||||
|
|
||||||
|
const externalCurr = reactive({
|
||||||
|
inscriptionRequestId : null,
|
||||||
|
school:null,
|
||||||
|
formation :null,
|
||||||
|
completion : "completed",
|
||||||
|
startYear : 0,
|
||||||
|
endYear: 0,
|
||||||
|
justifdocUrl : null,
|
||||||
|
userRegNo : null
|
||||||
|
})
|
||||||
|
|
||||||
|
if (props.mode === 1){
|
||||||
|
externalCurr.userRegNo = props.extCurrList[0].user.regNo
|
||||||
|
}
|
||||||
|
|
||||||
|
async function postExternalCurr(){
|
||||||
|
await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo);
|
||||||
|
//We refresh the list
|
||||||
|
extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
|
||||||
|
list.value = !list.value;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template style="margin-top:5%;">
|
<template style="margin-top:5%;">
|
||||||
<div style="display:flex; justify-content:center; " v-for="item in extCurrList">
|
<div v-if="list">
|
||||||
<div class="bodu">
|
<div v-if="User.regNo === externalCurr.userRegNo" style="margin-left: 2%;margin-top: 2%">
|
||||||
<div class="container">
|
<button @click="list = !list">Add external curriculum</button>
|
||||||
<div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
|
</div>
|
||||||
<div class="school"><a>{{item.school}}</a></div>
|
<div style="display:flex; justify-content:center; " v-for="item in extCurrList">
|
||||||
<div class="formation"><a>{{item.formation}}</a></div>
|
<div class="bodu">
|
||||||
<div class="completion"><a>{{item.completion}}</a></div>
|
<div class="container">
|
||||||
<div class="download"><button>Download document</button></div>
|
<div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
|
||||||
|
<div class="school"><a>{{item.school}}</a></div>
|
||||||
|
<div class="formation"><a>{{item.formation}}</a></div>
|
||||||
|
<div class="completion"><a>{{item.completion}}</a></div>
|
||||||
|
<div class="download"><button>Download document</button></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="loginbox" style="margin-left: 35%; margin-top: 3%">
|
||||||
|
<form class="form">
|
||||||
|
<div class="inputBox">
|
||||||
|
<p>Ecole</p>
|
||||||
|
<input type="text" v-model="externalCurr.school">
|
||||||
|
</div>
|
||||||
|
<div class="inputBox">
|
||||||
|
<p>Formation</p>
|
||||||
|
<input type="text" v-model="externalCurr.formation">
|
||||||
|
</div>
|
||||||
|
<div class="inputBox">
|
||||||
|
<p>Cochez la case si vous n'avez terminé cette formation</p>
|
||||||
|
<input v-model="notcompletedCheck" type="checkbox" id="checkboxformation">
|
||||||
|
<div v-if="notcompletedCheck">
|
||||||
|
<p>En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?</p>
|
||||||
|
<input type="text" v-model="externalCurr.completion">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="inputBox">
|
||||||
|
<p>Année de début</p>
|
||||||
|
<input type="number" v-model="externalCurr.startYear">
|
||||||
|
</div>
|
||||||
|
<div class="inputBox">
|
||||||
|
<p>Année de fin</p>
|
||||||
|
<input type="number" v-model="externalCurr.endYear">
|
||||||
|
</div>
|
||||||
|
<div class="inputBox" style="margin-top: 3%; margin-bottom: 3%">
|
||||||
|
<input type="submit" value="Upload curriculum" @click="postExternalCurr()">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -61,18 +127,12 @@
|
|||||||
font-size: 70%;
|
font-size: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.download{
|
.download{
|
||||||
grid-area: download;
|
grid-area: download;
|
||||||
align-self:center;
|
align-self:center;
|
||||||
}
|
}
|
||||||
button{
|
|
||||||
font-size:15px;
|
|
||||||
height:50px;
|
|
||||||
width:75%;
|
|
||||||
border:none;
|
|
||||||
border-radius:20px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.bodu {
|
.bodu {
|
||||||
margin-top:2%;
|
margin-top:2%;
|
||||||
@ -82,6 +142,43 @@ button{
|
|||||||
background-color:rgb(50,50,50);
|
background-color:rgb(50,50,50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loginbox {
|
||||||
|
background-color: rgb(24,24,24);
|
||||||
|
width: 400px;
|
||||||
|
display:flex;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 5%;
|
||||||
|
box-shadow:0 5px 25px #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
position:relative;
|
||||||
|
width:100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items:center;
|
||||||
|
gap: 3%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputBox input,select {
|
||||||
|
width:100%;
|
||||||
|
border: none;
|
||||||
|
margin-right: 12.5%;
|
||||||
|
padding-left: 2.5%;
|
||||||
|
padding-top:2.5%;
|
||||||
|
padding-bottom:2.5%;
|
||||||
|
outline:none;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size:1.35em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputBox p{
|
||||||
|
position:relative;
|
||||||
|
z-index: 100;
|
||||||
|
font-family:sans-serif ;
|
||||||
|
color:rgb(239,60,168);
|
||||||
|
transition: 0.5;
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="setup">
|
<div class="setup">
|
||||||
<div v-if="loginPage">
|
<div v-if="loginPage">
|
||||||
<div class='loginBox' style="margin-top:30%;">
|
<div class='loginBox' style="margin-top:30%;">
|
||||||
<form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form">
|
<form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form">
|
||||||
<h1 style="color:rgb(239,60,168); font-family: sans-serif;">
|
<h1 style="color:rgb(239,60,168); font-family: sans-serif;">
|
||||||
@ -288,7 +288,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 5%;
|
border-radius: 5%;
|
||||||
box-shadow:0 5px 25px #000000;
|
box-shadow:0 5px 25px #000000;
|
||||||
|
|
||||||
}
|
}
|
||||||
.form {
|
.form {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
@ -9,11 +9,15 @@
|
|||||||
import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js";
|
import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js";
|
||||||
import {postPayment} from "@/rest/payment.js";
|
import {postPayment} from "@/rest/payment.js";
|
||||||
import {addUninscReq, createScholarshipRequest, postChangeCurrReq} from "@/rest/requests.js";
|
import {addUninscReq, createScholarshipRequest, postChangeCurrReq} from "@/rest/requests.js";
|
||||||
|
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
|
||||||
|
import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
|
||||||
|
|
||||||
const user = ref(await getSelf());
|
const user = ref(await getSelf());
|
||||||
const UserCurriculum = ref("");
|
const UserCurriculum = ref("");
|
||||||
const curricula = ref (await getAllCurriculums());
|
const curricula = ref (await getAllCurriculums());
|
||||||
const minerv = ref({});
|
const minerv = ref({});
|
||||||
|
const extcurrlist = ref(await getExternalCurriculumByUser(user.value.regNo))
|
||||||
|
|
||||||
if(user.value.role === "Student"){
|
if(user.value.role === "Student"){
|
||||||
minerv.value = ref(await getCurrentMinerval(user.value.regNo));
|
minerv.value = ref(await getCurrentMinerval(user.value.regNo));
|
||||||
UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo);
|
UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo);
|
||||||
@ -25,7 +29,7 @@
|
|||||||
|
|
||||||
const sure = ref(0);
|
const sure = ref(0);
|
||||||
|
|
||||||
//0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister
|
//0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister, 12 manage external curriculums
|
||||||
const windowState = ref(0);
|
const windowState = ref(0);
|
||||||
|
|
||||||
const isChecked = ref(false);
|
const isChecked = ref(false);
|
||||||
@ -68,7 +72,7 @@
|
|||||||
const changecurrdata = reactive({
|
const changecurrdata = reactive({
|
||||||
userId : user.value.regNo,
|
userId : user.value.regNo,
|
||||||
actualcursus:null,
|
actualcursus:null,
|
||||||
newcursus:null
|
newcursus:1
|
||||||
})
|
})
|
||||||
|
|
||||||
//Used to post a uninscription request
|
//Used to post a uninscription request
|
||||||
@ -81,6 +85,8 @@
|
|||||||
let toModify= Object.assign({}, pattern);
|
let toModify= Object.assign({}, pattern);
|
||||||
let personnalInfos = Object.assign({}, patternInfos);
|
let personnalInfos = Object.assign({}, patternInfos);
|
||||||
|
|
||||||
|
//Used to store the year of the new cursus selected in change cursus feature
|
||||||
|
const selectedYear = ref(0);
|
||||||
function resetInputs(inputs,list){
|
function resetInputs(inputs,list){
|
||||||
inputs=Object.assign({},list);
|
inputs=Object.assign({},list);
|
||||||
}
|
}
|
||||||
@ -138,6 +144,9 @@
|
|||||||
return date.getFullYear()
|
return date.getFullYear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function refreshExtCurrList(){
|
||||||
|
extcurrlist.value = await getExternalCurriculumByUser(user.value.regNo)
|
||||||
|
}
|
||||||
//This function travels through the student cursus array and extract the current cursus of the student
|
//This function travels through the student cursus array and extract the current cursus of the student
|
||||||
function getActualCurriculumList(){
|
function getActualCurriculumList(){
|
||||||
let actualCurriculumList = [];
|
let actualCurriculumList = [];
|
||||||
@ -188,7 +197,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="body">
|
<div class="body" v-if="windowState !== 12">
|
||||||
<div class="container" v-if="windowState!==4">
|
<div class="container" v-if="windowState!==4">
|
||||||
<div class="profilPic" v-if="windowState===0">
|
<div class="profilPic" v-if="windowState===0">
|
||||||
<img class="subContainter" :src=getPP()>
|
<img class="subContainter" :src=getPP()>
|
||||||
@ -216,6 +225,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="(user.role==='Student')">
|
<div v-if="(user.role==='Student')">
|
||||||
<button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
|
<button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
|
||||||
|
<button @click="windowState=12;refreshExtCurrList() ">Manage external curriculums</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="(user.role==='Student')">
|
<div v-if="(user.role==='Student')">
|
||||||
<button @click="windowState=4">Manage Courses</button>
|
<button @click="windowState=4">Manage Courses</button>
|
||||||
@ -361,6 +371,9 @@
|
|||||||
<option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
<option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="curricula[changecurrdata.newcursus-1].year > 1 && reRegState !== 1">
|
||||||
|
The cursus you selected has some prerequisites
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button @click=" windowState = 0;postChangeCurrReq(changecurrdata);changecurrdata.actualcursus=null;changecurrdata.newcursus=null">{{i18n("courses.confirm")}}</button>
|
<button @click=" windowState = 0;postChangeCurrReq(changecurrdata);changecurrdata.actualcursus=null;changecurrdata.newcursus=null">{{i18n("courses.confirm")}}</button>
|
||||||
<button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
|
<button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||||
@ -422,6 +435,10 @@
|
|||||||
<button style="width: 10%; margin-top: 5%" @click="windowState = 0">Return to profile</button>
|
<button style="width: 10%; margin-top: 5%" @click="windowState = 0">Return to profile</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="windowState === 12">
|
||||||
|
<ExternalCurriculumList :ext-curr-list="extcurrlist" :mode="1"></ExternalCurriculumList>
|
||||||
|
<button @click="windowState = 0;refreshExtCurrList()">Back to profile</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
|
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
|
||||||
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
|
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
|
||||||
|
|
||||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){
|
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl, userRegNo){
|
||||||
return restPost("/externalcurriculum", {
|
return restPost("/externalcurriculum", {
|
||||||
inscriptionRequestId: inscriptionRequestId,
|
inscriptionRequestId: inscriptionRequestId,
|
||||||
school:school,
|
school:school,
|
||||||
formation :formation,
|
formation :formation,
|
||||||
completion : completion,
|
completion : completion,
|
||||||
startYear : parseInteger(startYear),
|
startYear : startYear,
|
||||||
endYear: parseInteger(endYear),
|
endYear: endYear,
|
||||||
justifdocUrl : justifdocUrl
|
justifdocUrl : justifdocUrl,
|
||||||
|
userRegNo : userRegNo
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user