Add the post feature for differents types of changeCurriculumRequest
This commit is contained in:
parent
1be7b4cdbe
commit
a27cf63daf
@ -179,7 +179,14 @@ public class RequestsController {
|
|||||||
public ResponseEntity<String> addChangeCurrReq(@RequestBody Map<String,Object> reqInfos){
|
public ResponseEntity<String> addChangeCurrReq(@RequestBody Map<String,Object> reqInfos){
|
||||||
User user = userRepository.findById((Integer) reqInfos.get("userId"));
|
User user = userRepository.findById((Integer) reqInfos.get("userId"));
|
||||||
|
|
||||||
Curriculum actualCurriculum = curriculumRepository.findById((Integer) reqInfos.get("actualcursus"));
|
Curriculum actualCurriculum;
|
||||||
|
|
||||||
|
//If null then it means we are in a supplementary cursus case
|
||||||
|
if (reqInfos.get("actualcursus") == null){
|
||||||
|
actualCurriculum = null;
|
||||||
|
}else{
|
||||||
|
actualCurriculum = curriculumRepository.findById((Integer) reqInfos.get("actualcursus"));
|
||||||
|
}
|
||||||
|
|
||||||
Curriculum destinationCurriculum = curriculumRepository.findById((Integer) reqInfos.get("newcursus"));
|
Curriculum destinationCurriculum = curriculumRepository.findById((Integer) reqInfos.get("newcursus"));
|
||||||
|
|
||||||
|
@ -85,13 +85,14 @@ public class MockController {
|
|||||||
Curriculum infoBab2 = new Curriculum(2,"info");
|
Curriculum infoBab2 = new Curriculum(2,"info");
|
||||||
Curriculum masterinfo1 = new Curriculum(4, "info");
|
Curriculum masterinfo1 = new Curriculum(4, "info");
|
||||||
Curriculum masterinfo2 = new Curriculum(5, "info");
|
Curriculum masterinfo2 = new Curriculum(5, "info");
|
||||||
|
Curriculum chemistryBab2 = new Curriculum(2, "chemistry");
|
||||||
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(masterinfo1);
|
||||||
curriculumService.save(masterinfo2);
|
curriculumService.save(masterinfo2);
|
||||||
|
curriculumService.save(chemistryBab2);
|
||||||
|
|
||||||
ucr.save(new UserCurriculum(joe, infoBab1, 2022, false));
|
ucr.save(new UserCurriculum(joe, infoBab1, 2022, false));
|
||||||
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true));
|
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {reactive, ref } from 'vue'
|
import {reactive, ref } from 'vue'
|
||||||
import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js'
|
import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js'
|
||||||
import {getSelfCurriculum, getAllCurriculums, getSomeonesCurriculumList} from '../rest/curriculum.js'
|
import {getSelfCurriculum, getAllCurriculums, getSomeonesCurriculumList, getcurriculum} from '../rest/curriculum.js'
|
||||||
import {getCourses} from "../rest/courses.js"
|
import {getCourses} from "../rest/courses.js"
|
||||||
import i18n from "@/i18n.js"
|
import i18n from "@/i18n.js"
|
||||||
import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js'
|
import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js'
|
||||||
@ -29,6 +29,7 @@
|
|||||||
const windowState = ref(0);
|
const windowState = ref(0);
|
||||||
|
|
||||||
const isChecked = ref(false);
|
const isChecked = ref(false);
|
||||||
|
const reRegState = ref(0);
|
||||||
|
|
||||||
const pattern = {
|
const pattern = {
|
||||||
profilPictureUrl:null,
|
profilPictureUrl:null,
|
||||||
@ -159,6 +160,31 @@
|
|||||||
|
|
||||||
await createScholarshipRequest(scholarshipData)
|
await createScholarshipRequest(scholarshipData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//1 = previous 0 = next
|
||||||
|
function getCurriculumsNextYear(){
|
||||||
|
const currlist = getActualCurriculumList()
|
||||||
|
let list = []
|
||||||
|
|
||||||
|
for (let i = 0; i < currlist.length; i++){
|
||||||
|
for (let j = 0; j < curricula.value.length; j++){
|
||||||
|
if (curricula.value[j].option === currlist[i].option && curricula.value[j].year === currlist[i].year + 1){
|
||||||
|
list.push(curricula.value[j])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getActualCurr(curr){
|
||||||
|
const cursus = await getcurriculum(curr);
|
||||||
|
for (let i = 0; i < curricula.value.length; i++){
|
||||||
|
if (curricula.value[i].option === cursus.option && curricula.value[i].year === cursus.year - 1){
|
||||||
|
changecurrdata.actualcursus = curricula.value[i].curriculumId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -305,7 +331,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="windowState === 2" class="infosContainer">
|
<div v-else-if="windowState === 2" class="infosContainer">
|
||||||
<div style="height:40px;">
|
<div>
|
||||||
|
I would like to :
|
||||||
|
<select v-model="reRegState">
|
||||||
|
<option :value="1">Reregister in the next year of one of my cursus</option>
|
||||||
|
<option :value="2">Register for a supplementary cursus</option>
|
||||||
|
<option :value="3">Change from a cursus to another</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div style="height:40px;" v-if="reRegState === 3">
|
||||||
{{i18n("Curriculum")}}:
|
{{i18n("Curriculum")}}:
|
||||||
<select v-model="changecurrdata.actualcursus" style="margin-right: 3%">
|
<select v-model="changecurrdata.actualcursus" style="margin-right: 3%">
|
||||||
<option v-for="item in getActualCurriculumList()" style="font-size:20px;" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
<option v-for="item in getActualCurriculumList()" style="font-size:20px;" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
||||||
@ -315,8 +349,20 @@
|
|||||||
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="height:40px;" v-if="reRegState === 2">
|
||||||
|
New Curriculum :
|
||||||
|
<select v-model="changecurrdata.newcursus">
|
||||||
|
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div style="height:40px;" v-if="reRegState === 1">
|
||||||
|
New Curriculum :
|
||||||
|
<select v-model="changecurrdata.newcursus" @change="getActualCurr(changecurrdata.newcursus);">
|
||||||
|
<option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button @click=" windowState = 0;postChangeCurrReq(changecurrdata)">{{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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user