Leo/InscriptionDesEtudiants #164

Merged
LeoMoulin merged 5 commits from Leo/InscriptionDesEtudiants into master 2024-04-20 21:21:14 +02:00
17 changed files with 237 additions and 140 deletions
Showing only changes of commit ef03a6bdca - Show all commits

View File

@ -29,7 +29,7 @@ public class InscriptionController {
@GetMapping("/requests/register")
public ResponseEntity<Iterable<Map<String,Object>>> getAllRequests(@RequestHeader("Authorization") String token){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
return new UnauthorizedResponse<>(null);
Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll();
@ -41,7 +41,7 @@ public class InscriptionController {
@GetMapping("/request/register/{id}")
public ResponseEntity<Map<String,Object>> getById(@RequestHeader("Authorization") String token, @PathVariable long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
return new UnauthorizedResponse<>(null);
InscriptionRequest foundInscriptionRequest = inscriptionServ.getById(id);
@ -87,6 +87,12 @@ public class InscriptionController {
return new UnauthorizedResponse<>(null);
InscriptionRequest toEdit = inscriptionServ.getById(id);
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
if (toEdit.getEquivalenceState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
toEdit.setEquivalenceState(newstate);
inscriptionServ.save(toEdit);

View File

@ -13,6 +13,7 @@ import ovh.herisson.Clyde.Repositories.UserCurriculumRepository;
import ovh.herisson.Clyde.Repositories.UserRepository;
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
import ovh.herisson.Clyde.Services.AuthenticatorService;
import ovh.herisson.Clyde.Services.TokenService;
import ovh.herisson.Clyde.Services.UserService;
import ovh.herisson.Clyde.Tables.*;
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
@ -28,6 +29,7 @@ import java.util.Map;
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
public class RequestsController {
public final TokenService tokenService;
public final ExemptionsRequestRepository err;
public final ScholarshipRequestRepository srr;
public final UserRepository userRepository;
@ -40,7 +42,8 @@ public class RequestsController {
public final ChangeCurriculumRequestRepository changeCurriculumRequestRepository;
public RequestsController(ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService, UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepository, ChangeCurriculumRequestRepository changeCurriculumRequestRepository) {
public RequestsController(TokenService tokenService, ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService, UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepository, ChangeCurriculumRequestRepository changeCurriculumRequestRepository) {
this.tokenService = tokenService;
this.err = err;
this.srr = srr;
this.userRepository = userRepository;
@ -78,7 +81,7 @@ public class RequestsController {
//Get all the exemptions Request
@GetMapping(value = "/exemptionsreq")
public ResponseEntity<ArrayList<ExemptionsRequest>> getAllExemptionsRequests(@RequestHeader("Authorization") String token){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
return new UnauthorizedResponse<>(null);
ArrayList<ExemptionsRequest> toReturn = new ArrayList<>();
@ -90,7 +93,7 @@ public class RequestsController {
@GetMapping(value = "/exemptionsreq/{id}")
public ResponseEntity<ExemptionsRequest> getExemptionRequestbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ExemptionsRequest exemptionsRequest = err.findById(id);
@ -100,10 +103,15 @@ public class RequestsController {
@PatchMapping(value = "/exemptionsreq/{id}/{newstate}")
public ResponseEntity<String> changeExemptionReqState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token))
return new UnauthorizedResponse<>(null);
ExemptionsRequest exemptionsRequest = err.findById(id);
if (exemptionsRequest.getState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
exemptionsRequest.setState(newstate);
err.save(exemptionsRequest);
@ -140,9 +148,17 @@ public class RequestsController {
}
@PatchMapping(value = "/scholarshipreq/")
public ResponseEntity<String> editScholReq(@RequestBody Map<String,Object> infos){
public ResponseEntity<String> editScholReq(@RequestHeader("Authorization") String token, @RequestBody Map<String,Object> infos){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ScholarshipRequest scholarshipRequest = srr.findById((Integer) infos.get("id"));
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
if (scholarshipRequest.getState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
if (infos.get("state").equals("Accepted")){
scholarshipRequest.setState(RequestState.Accepted);
scholarshipRequest.setAmount((int) infos.get("amount"));
@ -155,30 +171,48 @@ public class RequestsController {
}
@GetMapping(value = "/scholarshipreq/{id}")
public ResponseEntity<ScholarshipRequest> getScholReqbyId(@PathVariable long id){
public ResponseEntity<ScholarshipRequest> getScholReqbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
if (authServ.isNotIn(new Role[]{Role.Admin, Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ScholarshipRequest toReturn = srr.findById(id);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
@GetMapping(value = "/unregister")
public ResponseEntity<ArrayList<UnregisterRequest>> getAllUnregReq(){
public ResponseEntity<ArrayList<UnregisterRequest>> getAllUnregReq(@RequestHeader("Authorization") String token){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ArrayList<UnregisterRequest> toReturn = new ArrayList<>();
unregisterRequestRepository.findAll().forEach(toReturn::add);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
@GetMapping(value = "/unregister/{id}")
public ResponseEntity<UnregisterRequest> getUnregbyId(@PathVariable long id){
public ResponseEntity<UnregisterRequest> getUnregbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
return new ResponseEntity<>(unregisterRequest, HttpStatus.OK);
}
@PatchMapping(value = "/unregister/{id}/{newstate}")
public ResponseEntity<String> pathUnregReq(@PathVariable long id, @PathVariable RequestState newstate){
public ResponseEntity<String> pathUnregReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
User u = userRepository.findById(unregisterRequest.getRegNo());
unregisterRequest.setState(newstate);
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
if (unregisterRequest.getState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
unregisterRequest.setState(newstate);
unregisterRequestRepository.save(unregisterRequest);
if (newstate == RequestState.Accepted){
if (unregisterRequest.getCurriculum() == null){
ArrayList<UserCurriculum> userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u);
@ -193,8 +227,6 @@ public class RequestsController {
userCurriculumRepository.save(userCurriculum);
}
}
unregisterRequestRepository.save(unregisterRequest);
return new ResponseEntity<>(HttpStatus.OK);
}
@ -236,7 +268,7 @@ public class RequestsController {
@GetMapping("/changecurriculumreq")
public ResponseEntity<ArrayList <ChangeCurriculumRequest>> getAllChangeCurrReq(@RequestHeader("Authorization") String token){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
return new UnauthorizedResponse<>(null);
ArrayList<ChangeCurriculumRequest> toReturn = new ArrayList<>();
@ -248,7 +280,7 @@ public class RequestsController {
@GetMapping("/changecurriculumreq/{id}")
public ResponseEntity<ChangeCurriculumRequest> getCCrbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toReturn = changeCurriculumRequestRepository.findById(id);
@ -257,37 +289,45 @@ public class RequestsController {
@PatchMapping("/changecurriculumreq/{id}/{newState}")
public ResponseEntity<String> editCCReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newState){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id);
toEdit.setState(newState);
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
if (toEdit.getState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
toEdit.setState(newState);
changeCurriculumRequestRepository.save(toEdit);
if (newState == RequestState.Accepted && (toEdit.getTeacherApprovalState() == RequestState.Accepted || toEdit.getTeacherApprovalState() == RequestState.Unrequired)){
//If actual curriculum is not null then we need to set that the user doesn't follow it anymore
acceptProcedure(toEdit);
}
changeCurriculumRequestRepository.save(toEdit);
return new ResponseEntity<>(HttpStatus.OK);
}
@PatchMapping("/changecurriculumreqteacher/{id}/{newteacherstate}")
public ResponseEntity<String> editCCReqTeacherState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newteacherstate){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token))
return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id);
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
if (toEdit.getTeacherApprovalState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
toEdit.setState(newteacherstate);
changeCurriculumRequestRepository.save(toEdit);
if (newteacherstate == RequestState.Accepted && toEdit.getState() == RequestState.Accepted){
//If actual curriculum is not null then we need to set that the user doesn't follow it anymore
acceptProcedure(toEdit);
}
changeCurriculumRequestRepository.save(toEdit);
return new ResponseEntity<>(HttpStatus.OK);
}
@ -311,8 +351,16 @@ public class RequestsController {
}
@GetMapping("/exemptionreq/{userId}")
public ResponseEntity<ArrayList<ExemptionsRequest>> getExReqByuser(@PathVariable long userId){
public ResponseEntity<ArrayList<ExemptionsRequest>> getExReqByuser(@RequestHeader("Authorization") String token, @PathVariable long userId){
User currentUser = tokenService.getUserFromToken(token);
//Only admin, teacher, secretary and the student himself can access a student's data here
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher, Role.Secretary},token) && currentUser.getRegNo() != userId)
return new UnauthorizedResponse<>(null);
User u = userRepository.findById(userId);
return new ResponseEntity<>(HttpStatus.OK);
ArrayList<ExemptionsRequest> exList = err.findByUser(u);
return new ResponseEntity<>(exList, HttpStatus.OK);
}
}

View File

@ -109,7 +109,7 @@ public class MockController {
ucr.save(new UserCurriculum(popo, infoBab2, 2023, true));
Course progra1 = new Course(5,"Programmation et algorithmique 1",joke);
Course chemistry1 = new Course(12, "Thermochimie",joke);
Course chemistry1 = new Course(12, "Thermochimie",jojo);
Course psycho1 = new Course(21, "Neuroreaction of isolated brain cells",joke);
Course commun = new Course(2, "cours commun",joke);
@ -126,7 +126,7 @@ public class MockController {
CurriculumCourseService.save(new CurriculumCourse(infoBab1, psycho1));
CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,psycho1));
CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,commun));
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1, chemistry1));
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,commun));
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1));

View File

@ -2,7 +2,12 @@ package ovh.herisson.Clyde.Repositories.Inscription;
import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
import ovh.herisson.Clyde.Tables.User;
import java.util.ArrayList;
public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> {
ExemptionsRequest findById(long id);
ArrayList<ExemptionsRequest> findByUser(User user);
}

View File

@ -59,6 +59,11 @@ public class InscriptionService {
if (inscrRequest == null)
return false;
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
if (inscrRequest.getState() == RequestState.Accepted){
return true;
}
inscrRequest.setState(requestState);
save(inscrRequest);

View File

@ -66,12 +66,12 @@ async function editChangeCurrReqTeacherApproval(state){
</div>
</div>
</div>
<div v-if="localwindowstate === 0">
<div v-if="localwindowstate === 0" style="margin-left: 23%">
<button @click="windowState = 0" style="margin-left: 10%">Back</button>
</div>
<div v-if="localwindowstate === 1">
<AboutStudent :target="tag"></AboutStudent>
<button @click="localwindowstate--;">Back</button>
<button @click="localwindowstate--;" style="margin-left: 10%">Back</button>
</div>
</template>
@ -125,4 +125,12 @@ async function editChangeCurrReqTeacherApproval(state){
background-color:rgb(50,50,50);
border-radius:20px;
}
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -56,10 +56,10 @@ async function editExemp(newstate){
</div>
<div v-else>
<AboutStudent :target="req.user.regNo"></AboutStudent>
<button @click="profile=!profile">Back</button>
<button @click="profile=!profile" style="margin-left: 17%;margin-top: 3%">Back to request</button>
</div>
<div>
<button v-if="profile===false" @click="windowState = 0" style="margin-left: 30%">Back</button>
<button v-if="profile===false" @click="windowState = 0" style="margin-left: 31%">Back</button>
</div>
</template>
@ -113,4 +113,12 @@ async function editExemp(newstate){
background-color:rgb(50,50,50);
border-radius:20px;
}
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -31,7 +31,7 @@ async function editEquivalence(id, newstate){
</script>
<template>
<div class="body" v-if="list == false">
<div class="body" v-if="list == false" style="margin-top: 10%;">
<div class="container">
<div class="profilPic">
<img class="subContainter" :src=getPP()>
@ -56,25 +56,25 @@ async function editEquivalence(id, newstate){
<div>
Cursus voulu : BAB {{cursus.year}} {{cursus.option}}
</div>
<div>
<a :href="downloadPdf(request.identityCard)">Download identity card</a>
<div style="margin-top: 3%">
<a :href="request.identityCard">Download identity card</a>
<button v-if="request.admissionDocUrl != null">Download admission document</button>
</div>
<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-top: 3%" @click="list=!list" v-if="(user.role == 'Teacher' || user.role == 'Admin')">See external curriculums</button>
</div>
</div>
</div>
</div>
</div>
<div v-if="list == false">
<div v-if="list == false" style="margin-left: 30%; margin-top: 5%">
<button @click="windowState = 0">Back</button>
</div>
<div v-if="list==true">
<ExternalCurriculumList :ext-curr-list="externalCurriculum" :mode="0"></ExternalCurriculumList>
<div style="margin-left: 15%;margin-top: 5%;">
<button style="margin-left: 2%" @click="list = false;editEquivalence(request.id, 'Accepted'); request.equivalenceState='Accepted'">Accept Equivalence</button>
<button style="margin-left: 2%" @click="list = false;editEquivalence(request.id, 'Refused'); request.equivalenceState='Refused'">Refuse Equivalence</button>
<button style="margin-left: 2%" v-if="request.equivalenceState === 'Pending'" @click="list = false;editEquivalence(request.id, 'Accepted'); request.equivalenceState='Accepted'">Accept Equivalence</button>
<button style="margin-left: 2%" v-if="request.equivalenceState === 'Pending'" @click="list = false;editEquivalence(request.id, 'Refused'); request.equivalenceState='Refused'">Refuse Equivalence</button>
<button style="margin-left: 2%" @click="list=false">Back</button>
</div>
</div>
@ -132,10 +132,10 @@ async function editEquivalence(id, newstate){
}
button{
font-size:15px;
height:50px;
width:100px;
border:none;
border-radius:20px;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -57,7 +57,7 @@ async function uploadandrefreshScholarshipRequest(){
<button @click="">Download tax justif document</button>
<button style="margin-left: 2%">Download residency justif document</button>
</div>
<div v-if="req.state == 'Pending'">
<div v-if="req.state == 'Pending'" style="margin-top: 2%; margin-bottom: 2%;">
Please enter the amount to provide :
<input type="number" v-model="scholarshipData.amount">
</div>
@ -101,7 +101,7 @@ async function uploadandrefreshScholarshipRequest(){
display:flex;
align-items:center;
justify-content:center;
margin-top:7%;
margin-top:10%;
}
.subContainter{
@ -121,4 +121,12 @@ async function uploadandrefreshScholarshipRequest(){
background-color:rgb(50,50,50);
border-radius:20px;
}
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -63,7 +63,7 @@
</div>
</div>
</div>
<div class="moreInfos">
<div class="moreInfos" style="margin-top: 15%">
<div class = "oldcursus">
<div class="listTitle">
Anciens Cursus
@ -98,6 +98,7 @@
<style scoped>
.container{
min-width:675px;
display:grid;
@ -106,8 +107,7 @@
column-gap:2.7%;
row-gap:45px;
grid-template-areas:
"profilPic globalInfos"
"minfos minfos";
"profilPic globalInfos";
}
.profilPic{
@ -147,12 +147,10 @@
}
.moreInfos {
display:grid;
grid-template-rows:200px auto;
display:inline-grid;
column-gap:50px;
row-gap:45px;
grid-template-areas:
"minfos minfos";
"oldcursus newcursus";
grid-template-columns:600px 600px;
align-items:center;
justify-content:center;
@ -193,4 +191,12 @@
column-gap:40px;
padding-left: 25px;
}
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -5,13 +5,16 @@ import i18n from "@/i18n.js";
import {getCourse} from "@/rest/courses.js";
import {getcurriculum} from "@/rest/curriculum.js";
import {uploadFile, uploadProfilePicture} from "@/rest/uploads.js";
import {createExemptionsRequest} from "@/rest/requests.js";
import {createExemptionsRequest, getExempByUser} from "@/rest/requests.js";
import {getSelf} from "@/rest/Users.js";
const props = defineProps(["cursuslist"])
const selectedCurriculum = ref(props.cursuslist[0])
const user = await getSelf()
const windowState = defineModel("windowState")
const exempList = await getExempByUser(user.regNo)
const courseslist = ref(await getcurriculum(selectedCurriculum.value.curriculumId))
const list = ref(true)
@ -31,8 +34,13 @@ const exemptReq = reactive({
justifDocument : "",
})
async function getExemptions(){
function isExempted(course){
for (let i = 0; i < exempList.length; i++){
if (exempList[i].course.courseID === course.courseId && exempList[i].state === "Accepted"){
return true
}
return false
}
}
</script>
@ -49,20 +57,29 @@ async function getExemptions(){
<div class="firstname">{{item.owner.firstName}}</div>
<div class="lastname">{{item.owner.lastName}}</div>
<div class="credits">credits : {{item.credits}}</div>
<div class="askexemption"><button style="background-color:rgb(105,0,0);" @click="list= !list;exemptReq.courseId=item.courseId">Ask exemption</button></div>
<div class="askexemption" v-if="!isExempted(item)"><button style="background-color:rgb(105,0,0);" @click="list= !list;exemptReq.courseId=item.courseId">Ask exemption</button></div>
<div v-else class="askexemption" style="font-size: 50%">Exempted</div>
</div>
</div>
</div>
<div>
<button @click="windowState = 0">Back</button>
</div>
<div v-else>
</div>
<div v-if="list === false" class="infosContainer">
<p>Please upload the justification document for the exemption </p>
<div>
<label class="browser">
<input type="file" @change="ppData.value = $event.target.files" accept="image/*" ref="filepath">
</label>
<button style="width:15%; margin-top: 5%;" @click="postExemptionRequest(ppData.value, 'JustificationDocument');">
</div>
<button style="margin-top: 3%" @click="postExemptionRequest(ppData.value, 'JustificationDocument');">
Submit exemption request
</button>
</div>
<div v-if="list === false">
<button @click="list=!list">Back</button>
</div>
</template>
<style scoped>
@ -139,5 +156,15 @@ button{
margin-top:10px;
}
.infosContainer {
padding-bottom:50px;
border:2px solid black;
font-size:25px;
color:white;
padding:20px;
background-color:rgb(50,50,50);
border-radius:20px;
}
</style>

View File

@ -53,7 +53,7 @@
async function postExternalCurr(){
if (props.mode === 1){
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);
await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, temp.url, externalCurr.userRegNo);
//We refresh the list
extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
list.value = !list.value;
@ -77,9 +77,9 @@
<template style="margin-top:5%;">
<div v-if="list">
<div v-if="props.mode === 2||User.regNo === externalCurr.userRegNo" style="margin-left: 2%;margin-top: 2%">
<button @click="list = !list">Add external curriculum</button>
<button @click="list = !list" style="margin-left:15%;">Add external curriculum</button>
</div>
<div style="display:flex; justify-content:center; " v-for="(item, index) in extCurrList">
<div style="display:flex; justify-content:center;" v-for="(item, index) in extCurrList">
<div class="bodu">
<div class="container">
<div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
@ -229,8 +229,14 @@
z-index: 100;
font-family:sans-serif ;
color:rgb(239,60,168);
transition: 0.5;
}
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -1,6 +1,6 @@
<script setup>
import i18n from "@/i18n.js"
import {ref, vModelSelect} from 'vue'
import {ref, vModelSelect, watch} from 'vue'
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
import {
@ -13,10 +13,11 @@
import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue";
import AboutChangeCurriculum from "@/Apps/Inscription/AboutChangeCurriculum.vue";
import AboutExemption from "@/Apps/Inscription/AboutExemption.vue";
import {getSelf} from "@/rest/Users.js";
const requests = ref(await getAllRegisters());
let targetId = "";
const user = await getSelf()
const requestType = ref("inscription");
const filterType = ref("None");
@ -47,6 +48,13 @@
requests.value = await getAllChangeCurrReq();
}
}
//When we come back to the list we need to reload the list
watch(windowsState, () => {
if (windowsState.value === 0){
loadRequests();
}
})
</script>
@ -60,9 +68,9 @@
<span>Request type : </span>
<select v-model="requestType" @change="loadRequests()">
<option>inscription</option>
<option>scholarship</option>
<option>exemption</option>
<option>unregister</option>
<option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">scholarship</option>
<option v-if="user.role === 'Admin' || user.role === 'Teacher'">exemption</option>
<option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">unregister</option>
<option>curriculum change</option>
</select>
<span style="margin-left: 5%">
@ -76,13 +84,8 @@
</span>
</div>
<div style='display:flex; justify-content:center; min-width:1140px;' v-for="item of requests">
<div class="bodu" style="width: 95%" v-if="filterType == 'None' || filterType == item.state">
<div class="bodu" style="width: 95%" v-if="(filterType == 'None' || filterType == item.state) && requestType !== 'exemption'">
<div class="container" style="grid-template-columns:11% 15% 20% 10% 10% 9% 9%;grid-template-areas:'date state equivalencestate surname firstname accept refuse infos';" v-if="requestType === 'inscription'">
<!--
The condition below avoids an error occuring because loadRequests() finishes after the vue refresh
then submissionDate is undefined an it triggers an error in the console despite the fact that it is working
properly at the end.
-->
<div class="date" v-if="item.submissionDate !== undefined">{{item.submissionDate.slice(0, 10)}}</div>
<div class="state" style="font-size: 80%">Approval : {{item.state}}</div>
<div class="equivalencestate" style="font-size: 80%">Teacher approval : {{item.equivalenceState}}</div>
@ -99,14 +102,6 @@
<div class="reqState">{{item.state}}</div>
<div class="infos" @click="windowsState = 3; targetId=item.id;"><button>More infos</button></div>
</div>
<div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';"v-if="requestType === 'exemption'">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.user.firstName}}</div>
<div class="studentlastname">{{item.user.lastName}}</div>
<div class="course">{{item.course.title}}</div>
<div class="reqState">{{item.state}}</div>
<div class="infos"><button @click="windowsState=6;targetId=item.id">More infos</button></div>
</div>
<div class="container" v-if="requestType === 'unregister'" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.firstName}}</div>
@ -124,6 +119,16 @@
<div class="infos"><button @click="windowsState=5;targetId=item.id">More infos</button></div>
</div>
</div>
<div class="bodu" v-if="(filterType == 'None' || filterType == item.state) && requestType === 'exemption' && (item.course.owner.regNo === user.regNo || user.role === 'Admin')">
<div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.user.firstName}}</div>
<div class="studentlastname">{{item.user.lastName}}</div>
<div class="course">{{item.course.title}}</div>
<div class="reqState">{{item.state}}</div>
<div class="infos"><button @click="windowsState=6;targetId=item.id">More infos</button></div>
</div>
</div>
</div>
</div>
<div style='display:flex; justify-content:center; min-width:1140px;margin-top: 10%' v-if="windowsState === 2">
@ -134,7 +139,7 @@
<div v-if="windowsState === 3">
<AboutScholarship :req-id="targetId"></AboutScholarship>
<div>
<button style="margin-left: 30%" @click="loadRequests();windowsState=0">Back</button>
<button style="margin-left: 31%; margin-top: 5%" @click="windowsState=0">Back</button>
</div>
</div>
<div v-if="windowsState === 4">
@ -233,12 +238,11 @@
}
button{
font-size:15px;
height:50px;
width:100px;
border:none;
border-radius:20px;
background-color:rgb(239, 60, 168);
border-radius:10px;
height: 35px;
margin-top:10px;
}
.bodu {

View File

@ -4,6 +4,7 @@ import {ref} from "vue";
import {getAllPayments} from "@/rest/requests.js";
const paymentsList = await getAllPayments()
</script>
<template style="margin-top:5%;">
@ -12,7 +13,7 @@ const paymentsList = await getAllPayments()
<div class="container">
<div class="regNo"><a style="margin-left:30px">RegNo : {{item.studentRegNo}}</a></div>
<div class="client"><a>Client : {{item.client}}</a></div>
<div class="amount"><a>Amount : {{item.amount}}</a></div>
<div class="amount"><a>Amount : {{item.amount}}</a></div>
<div class="date" style="margin-left: 10%">{{item.date.slice(0,10)}}</div>
</div>
</div>

View File

@ -25,18 +25,6 @@
equivalenceState: "Unrequired"
})
const notcompletedCheck = ref(false);
const externalCurr = reactive({
inscriptionRequestId : null,
school:null,
formation :null,
completion : null,
startYear : null,
endYear: null,
justifdocUrl : null
})
//Stores some externalCurriculums in order to upload them all at the confirmation of the registration request
const externalCurrTab = ref([]);
@ -45,9 +33,6 @@
const imageSaved = ref(false)
let ppData = ""
let requiredCertif = false
//Contains the id of the newly created request (useful to link the student's formations informations to the request)
let requestId = ""
const idcardfile = ref({})
const justifcardfile = ref({})
@ -109,7 +94,7 @@
for (let item in externalCurrTab.value){
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);
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.url);
}
}
@ -306,8 +291,6 @@
z-index: 100;
font-family:sans-serif ;
color:rgb(239,60,168);
transition: 0.5;
}
.register{
@ -335,8 +318,6 @@
outline:none;
border-radius: 4px;
font-size:0.8em;
align-self: right;
}
input[type=submit],button,select{

View File

@ -197,8 +197,8 @@
</script>
<template>
<div class="body" v-if="windowState !== 12">
<div class="container" v-if="windowState!==4">
<div class="body" v-if="windowState !== 12 && windowState!==4">
<div class="container">
<div class="profilPic" v-if="windowState===0">
<img class="subContainter" :src=getPP()>
</div>
@ -211,7 +211,7 @@
E-mail: {{user.email}}
</div>
<div v-if="user.role==='Student'">
{{user.option}} {{i18n(user.role)}}
RegNo : {{user.regNo}}
</div>
<div v-else>
Role: {{i18n((user.role))}}
@ -220,12 +220,11 @@
<button @click="windowState=1; setModify(user)"> {{i18n("profile.modify.data")}} </button>
</div>
<div v-if="(user.role==='Student')">
<button @click="windowState=3">{{i18n("profile.reRegister")}}</button>
<button @click="windowState=9" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button>
</div>
<div v-if="(user.role==='Student')">
<button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
<button @click="windowState=12;refreshExtCurrList() ">Manage external curriculums</button>
<button @click="windowState=12;refreshExtCurrList();" style="margin-left: 2%">Manage external curriculums</button>
</div>
<div v-if="(user.role==='Student')">
<button @click="windowState=4">Manage Courses</button>
@ -272,6 +271,9 @@
<button @click="windowState=7">Ask for a scholarship</button>
</div>
</div>
<div v-if="windowState === 5">
<button @click="windowState=0">Back</button>
</div>
<div v-else-if="windowState === 7" class="infosContainer">
<p>Please upload the required documents</p>
<div>
@ -284,6 +286,9 @@
</div>
<button style="margin-top: 5%" @click="windowState=8;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">Submit scholarship request</button>
</div>
<div v-if="windowState === 7">
<button @click="windowState = 5">Back</button>
</div>
<div v-else-if="windowState === 8" class="infosContainer">
<div>
Your request has been sent to the inscription service you will get notified when
@ -379,29 +384,6 @@
<button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
</div>
</div>
<div v-else-if="windowState === 3" class="infosContainer">
<div>
E-mail:
<input type="email" v-model="toModify.email" />
</div>
<div>
ID :
<input type="text" v-model="toModify.id">
</div>
<div>
{{i18n("login.password")}}:
<input type="password" v-model="toModify.password">
</div>
<div>
{{i18n("login.cPassword")}}:
<input type="password" id="confirm">
</div>
<div>
<button @click=" windowState=0;">{{i18n("courses.confirm")}}</button>
<button @click=" windowState=0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
</div>
</div>
</div>
<div v-if="windowState === 0" class="moreInfos">
<div class = "oldcursus">
@ -430,14 +412,13 @@
</div>
</div>
</div>
<div v-if="windowState===4" style="width: 80%">
<CourseList :cursuslist="getActualCurriculumList()"/>
<button style="width: 10%; margin-top: 5%" @click="windowState = 0">Return to profile</button>
</div>
</div>
<div v-if="windowState===4" style="width: 80%; margin-top: 3%; margin-left: 10%">
<CourseList :cursuslist="getActualCurriculumList()" v-model:window-state="windowState"/>
</div>
<div v-if="windowState === 12">
<ExternalCurriculumList :ext-curr-list="extcurrlist" :mode="1"></ExternalCurriculumList>
<button @click="windowState = 0;refreshExtCurrList()">Back to profile</button>
<button @click="windowState = 0;refreshExtCurrList()" style="margin-left: 17%;margin-top: 3%">Back to profile</button>
</div>
</template>
<style scoped>
@ -548,7 +529,6 @@ button{
border-radius:10px;
height:35px;
margin-top:10px;
}
button:hover{

View File

@ -75,3 +75,7 @@ export async function getExempReq(id){
export async function editExempReqState(id, newstate){
return restPatch("/exemptionsreq/"+id+"/"+newstate)
}
export async function getExempByUser(userId){
return restGet("/exemptionreq/"+userId)
}