1
0
forked from PGL/Clyde

Reworking, patching and cleaning the extension

This commit is contained in:
LeoMoulin 2024-04-20 21:12:17 +02:00
parent e8917cd69e
commit ef03a6bdca
17 changed files with 237 additions and 140 deletions

View File

@ -29,7 +29,7 @@ public class InscriptionController {
@GetMapping("/requests/register") @GetMapping("/requests/register")
public ResponseEntity<Iterable<Map<String,Object>>> getAllRequests(@RequestHeader("Authorization") String token){ 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); return new UnauthorizedResponse<>(null);
Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll(); Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll();
@ -41,7 +41,7 @@ public class InscriptionController {
@GetMapping("/request/register/{id}") @GetMapping("/request/register/{id}")
public ResponseEntity<Map<String,Object>> getById(@RequestHeader("Authorization") String token, @PathVariable long 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); return new UnauthorizedResponse<>(null);
InscriptionRequest foundInscriptionRequest = inscriptionServ.getById(id); InscriptionRequest foundInscriptionRequest = inscriptionServ.getById(id);
@ -87,6 +87,12 @@ public class InscriptionController {
return new UnauthorizedResponse<>(null); return new UnauthorizedResponse<>(null);
InscriptionRequest toEdit = inscriptionServ.getById(id); 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); toEdit.setEquivalenceState(newstate);
inscriptionServ.save(toEdit); 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.Repositories.UserRepository;
import ovh.herisson.Clyde.Responses.UnauthorizedResponse; import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
import ovh.herisson.Clyde.Services.AuthenticatorService; import ovh.herisson.Clyde.Services.AuthenticatorService;
import ovh.herisson.Clyde.Services.TokenService;
import ovh.herisson.Clyde.Services.UserService; import ovh.herisson.Clyde.Services.UserService;
import ovh.herisson.Clyde.Tables.*; import ovh.herisson.Clyde.Tables.*;
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
@ -28,6 +29,7 @@ import java.util.Map;
@CrossOrigin(originPatterns = "*", allowCredentials = "true") @CrossOrigin(originPatterns = "*", allowCredentials = "true")
public class RequestsController { public class RequestsController {
public final TokenService tokenService;
public final ExemptionsRequestRepository err; public final ExemptionsRequestRepository err;
public final ScholarshipRequestRepository srr; public final ScholarshipRequestRepository srr;
public final UserRepository userRepository; public final UserRepository userRepository;
@ -40,7 +42,8 @@ public class RequestsController {
public final ChangeCurriculumRequestRepository changeCurriculumRequestRepository; 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.err = err;
this.srr = srr; this.srr = srr;
this.userRepository = userRepository; this.userRepository = userRepository;
@ -78,7 +81,7 @@ public class RequestsController {
//Get all the exemptions Request //Get all the exemptions Request
@GetMapping(value = "/exemptionsreq") @GetMapping(value = "/exemptionsreq")
public ResponseEntity<ArrayList<ExemptionsRequest>> getAllExemptionsRequests(@RequestHeader("Authorization") String token){ 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); return new UnauthorizedResponse<>(null);
ArrayList<ExemptionsRequest> toReturn = new ArrayList<>(); ArrayList<ExemptionsRequest> toReturn = new ArrayList<>();
@ -90,7 +93,7 @@ public class RequestsController {
@GetMapping(value = "/exemptionsreq/{id}") @GetMapping(value = "/exemptionsreq/{id}")
public ResponseEntity<ExemptionsRequest> getExemptionRequestbyId(@RequestHeader("Authorization") String token, @PathVariable long 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); return new UnauthorizedResponse<>(null);
ExemptionsRequest exemptionsRequest = err.findById(id); ExemptionsRequest exemptionsRequest = err.findById(id);
@ -100,10 +103,15 @@ public class RequestsController {
@PatchMapping(value = "/exemptionsreq/{id}/{newstate}") @PatchMapping(value = "/exemptionsreq/{id}/{newstate}")
public ResponseEntity<String> changeExemptionReqState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState 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); return new UnauthorizedResponse<>(null);
ExemptionsRequest exemptionsRequest = err.findById(id); ExemptionsRequest exemptionsRequest = err.findById(id);
if (exemptionsRequest.getState() == RequestState.Accepted){
return new ResponseEntity<>(HttpStatus.OK);
}
exemptionsRequest.setState(newstate); exemptionsRequest.setState(newstate);
err.save(exemptionsRequest); err.save(exemptionsRequest);
@ -140,9 +148,17 @@ public class RequestsController {
} }
@PatchMapping(value = "/scholarshipreq/") @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")); 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")){ if (infos.get("state").equals("Accepted")){
scholarshipRequest.setState(RequestState.Accepted); scholarshipRequest.setState(RequestState.Accepted);
scholarshipRequest.setAmount((int) infos.get("amount")); scholarshipRequest.setAmount((int) infos.get("amount"));
@ -155,30 +171,48 @@ public class RequestsController {
} }
@GetMapping(value = "/scholarshipreq/{id}") @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); ScholarshipRequest toReturn = srr.findById(id);
return new ResponseEntity<>(toReturn, HttpStatus.OK); return new ResponseEntity<>(toReturn, HttpStatus.OK);
} }
@GetMapping(value = "/unregister") @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<>(); ArrayList<UnregisterRequest> toReturn = new ArrayList<>();
unregisterRequestRepository.findAll().forEach(toReturn::add); unregisterRequestRepository.findAll().forEach(toReturn::add);
return new ResponseEntity<>(toReturn, HttpStatus.OK); return new ResponseEntity<>(toReturn, HttpStatus.OK);
} }
@GetMapping(value = "/unregister/{id}") @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); UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
return new ResponseEntity<>(unregisterRequest, HttpStatus.OK); return new ResponseEntity<>(unregisterRequest, HttpStatus.OK);
} }
@PatchMapping(value = "/unregister/{id}/{newstate}") @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); UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
User u = userRepository.findById(unregisterRequest.getRegNo()); 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 (newstate == RequestState.Accepted){
if (unregisterRequest.getCurriculum() == null){ if (unregisterRequest.getCurriculum() == null){
ArrayList<UserCurriculum> userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u); ArrayList<UserCurriculum> userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u);
@ -193,8 +227,6 @@ public class RequestsController {
userCurriculumRepository.save(userCurriculum); userCurriculumRepository.save(userCurriculum);
} }
} }
unregisterRequestRepository.save(unregisterRequest);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ -236,7 +268,7 @@ public class RequestsController {
@GetMapping("/changecurriculumreq") @GetMapping("/changecurriculumreq")
public ResponseEntity<ArrayList <ChangeCurriculumRequest>> getAllChangeCurrReq(@RequestHeader("Authorization") String token){ 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); return new UnauthorizedResponse<>(null);
ArrayList<ChangeCurriculumRequest> toReturn = new ArrayList<>(); ArrayList<ChangeCurriculumRequest> toReturn = new ArrayList<>();
@ -248,7 +280,7 @@ public class RequestsController {
@GetMapping("/changecurriculumreq/{id}") @GetMapping("/changecurriculumreq/{id}")
public ResponseEntity<ChangeCurriculumRequest> getCCrbyId(@RequestHeader("Authorization") String token, @PathVariable long 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); return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toReturn = changeCurriculumRequestRepository.findById(id); ChangeCurriculumRequest toReturn = changeCurriculumRequestRepository.findById(id);
@ -257,37 +289,45 @@ public class RequestsController {
@PatchMapping("/changecurriculumreq/{id}/{newState}") @PatchMapping("/changecurriculumreq/{id}/{newState}")
public ResponseEntity<String> editCCReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState 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); return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id); 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 (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 //If actual curriculum is not null then we need to set that the user doesn't follow it anymore
acceptProcedure(toEdit); acceptProcedure(toEdit);
} }
changeCurriculumRequestRepository.save(toEdit);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@PatchMapping("/changecurriculumreqteacher/{id}/{newteacherstate}") @PatchMapping("/changecurriculumreqteacher/{id}/{newteacherstate}")
public ResponseEntity<String> editCCReqTeacherState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState 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); return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id); 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); toEdit.setState(newteacherstate);
changeCurriculumRequestRepository.save(toEdit);
if (newteacherstate == RequestState.Accepted && toEdit.getState() == RequestState.Accepted){ 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 //If actual curriculum is not null then we need to set that the user doesn't follow it anymore
acceptProcedure(toEdit); acceptProcedure(toEdit);
} }
changeCurriculumRequestRepository.save(toEdit);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ -311,8 +351,16 @@ public class RequestsController {
} }
@GetMapping("/exemptionreq/{userId}") @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); 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)); ucr.save(new UserCurriculum(popo, infoBab2, 2023, true));
Course progra1 = new Course(5,"Programmation et algorithmique 1",joke); 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 psycho1 = new Course(21, "Neuroreaction of isolated brain cells",joke);
Course commun = new Course(2, "cours commun",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(infoBab1, psycho1));
CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,psycho1)); CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,psycho1));
CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,commun)); CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,commun));
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1, chemistry1));
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,commun)); CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,commun));
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1)); 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 org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
import ovh.herisson.Clyde.Tables.User;
import java.util.ArrayList;
public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> { public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> {
ExemptionsRequest findById(long id); ExemptionsRequest findById(long id);
ArrayList<ExemptionsRequest> findByUser(User user);
} }

View File

@ -59,6 +59,11 @@ public class InscriptionService {
if (inscrRequest == null) if (inscrRequest == null)
return false; 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); inscrRequest.setState(requestState);
save(inscrRequest); save(inscrRequest);

View File

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

View File

@ -56,10 +56,10 @@ async function editExemp(newstate){
</div> </div>
<div v-else> <div v-else>
<AboutStudent :target="req.user.regNo"></AboutStudent> <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>
<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> </div>
</template> </template>
@ -113,4 +113,12 @@ async function editExemp(newstate){
background-color:rgb(50,50,50); background-color:rgb(50,50,50);
border-radius:20px; border-radius:20px;
} }
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style> </style>

View File

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

View File

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

View File

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

View File

@ -5,13 +5,16 @@ import i18n from "@/i18n.js";
import {getCourse} from "@/rest/courses.js"; import {getCourse} from "@/rest/courses.js";
import {getcurriculum} from "@/rest/curriculum.js"; import {getcurriculum} from "@/rest/curriculum.js";
import {uploadFile, uploadProfilePicture} from "@/rest/uploads.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"; import {getSelf} from "@/rest/Users.js";
const props = defineProps(["cursuslist"]) const props = defineProps(["cursuslist"])
const selectedCurriculum = ref(props.cursuslist[0]) const selectedCurriculum = ref(props.cursuslist[0])
const user = await getSelf() const user = await getSelf()
const windowState = defineModel("windowState")
const exempList = await getExempByUser(user.regNo)
const courseslist = ref(await getcurriculum(selectedCurriculum.value.curriculumId)) const courseslist = ref(await getcurriculum(selectedCurriculum.value.curriculumId))
const list = ref(true) const list = ref(true)
@ -31,8 +34,13 @@ const exemptReq = reactive({
justifDocument : "", 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> </script>
@ -49,20 +57,29 @@ async function getExemptions(){
<div class="firstname">{{item.owner.firstName}}</div> <div class="firstname">{{item.owner.firstName}}</div>
<div class="lastname">{{item.owner.lastName}}</div> <div class="lastname">{{item.owner.lastName}}</div>
<div class="credits">credits : {{item.credits}}</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>
</div> </div>
<div>
<button @click="windowState = 0">Back</button>
</div> </div>
<div v-else> </div>
<div v-if="list === false" class="infosContainer">
<p>Please upload the justification document for the exemption </p> <p>Please upload the justification document for the exemption </p>
<div>
<label class="browser"> <label class="browser">
<input type="file" @change="ppData.value = $event.target.files" accept="image/*" ref="filepath"> <input type="file" @change="ppData.value = $event.target.files" accept="image/*" ref="filepath">
</label> </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 Submit exemption request
</button> </button>
</div> </div>
<div v-if="list === false">
<button @click="list=!list">Back</button>
</div>
</template> </template>
<style scoped> <style scoped>
@ -139,5 +156,15 @@ button{
margin-top:10px; 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> </style>

View File

@ -53,7 +53,7 @@
async function postExternalCurr(){ async function postExternalCurr(){
if (props.mode === 1){ if (props.mode === 1){
const temp = await uploadFile(externalCurr.justifdocUrl, "JustificationDocument") 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 //We refresh the list
extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
list.value = !list.value; list.value = !list.value;
@ -77,9 +77,9 @@
<template style="margin-top:5%;"> <template style="margin-top:5%;">
<div v-if="list"> <div v-if="list">
<div v-if="props.mode === 2||User.regNo === externalCurr.userRegNo" style="margin-left: 2%;margin-top: 2%"> <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>
<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="bodu">
<div class="container"> <div class="container">
<div class="status"><a style="margin-left:30px">{{item.state}}</a></div> <div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
@ -229,8 +229,14 @@
z-index: 100; z-index: 100;
font-family:sans-serif ; font-family:sans-serif ;
color:rgb(239,60,168); 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> </style>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {ref, vModelSelect} from 'vue' import {ref, vModelSelect, watch} from 'vue'
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js' import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
import AboutRequest from "@/Apps/Inscription/AboutRequest.vue"; import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
import { import {
@ -13,10 +13,11 @@
import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue"; import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue";
import AboutChangeCurriculum from "@/Apps/Inscription/AboutChangeCurriculum.vue"; import AboutChangeCurriculum from "@/Apps/Inscription/AboutChangeCurriculum.vue";
import AboutExemption from "@/Apps/Inscription/AboutExemption.vue"; import AboutExemption from "@/Apps/Inscription/AboutExemption.vue";
import {getSelf} from "@/rest/Users.js";
const requests = ref(await getAllRegisters()); const requests = ref(await getAllRegisters());
let targetId = ""; let targetId = "";
const user = await getSelf()
const requestType = ref("inscription"); const requestType = ref("inscription");
const filterType = ref("None"); const filterType = ref("None");
@ -47,6 +48,13 @@
requests.value = await getAllChangeCurrReq(); 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> </script>
@ -60,9 +68,9 @@
<span>Request type : </span> <span>Request type : </span>
<select v-model="requestType" @change="loadRequests()"> <select v-model="requestType" @change="loadRequests()">
<option>inscription</option> <option>inscription</option>
<option>scholarship</option> <option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">scholarship</option>
<option>exemption</option> <option v-if="user.role === 'Admin' || user.role === 'Teacher'">exemption</option>
<option>unregister</option> <option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">unregister</option>
<option>curriculum change</option> <option>curriculum change</option>
</select> </select>
<span style="margin-left: 5%"> <span style="margin-left: 5%">
@ -76,13 +84,8 @@
</span> </span>
</div> </div>
<div style='display:flex; justify-content:center; min-width:1140px;' v-for="item of requests"> <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'"> <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="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="state" style="font-size: 80%">Approval : {{item.state}}</div>
<div class="equivalencestate" style="font-size: 80%">Teacher approval : {{item.equivalenceState}}</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="reqState">{{item.state}}</div>
<div class="infos" @click="windowsState = 3; targetId=item.id;"><button>More infos</button></div> <div class="infos" @click="windowsState = 3; targetId=item.id;"><button>More infos</button></div>
</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="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="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.firstName}}</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 class="infos"><button @click="windowsState=5;targetId=item.id">More infos</button></div>
</div> </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> </div>
<div style='display:flex; justify-content:center; min-width:1140px;margin-top: 10%' v-if="windowsState === 2"> <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"> <div v-if="windowsState === 3">
<AboutScholarship :req-id="targetId"></AboutScholarship> <AboutScholarship :req-id="targetId"></AboutScholarship>
<div> <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> </div>
<div v-if="windowsState === 4"> <div v-if="windowsState === 4">
@ -233,12 +238,11 @@
} }
button{ button{
font-size:15px;
height:50px;
width:100px;
border:none; border:none;
border-radius:20px; background-color:rgb(239, 60, 168);
border-radius:10px;
height: 35px;
margin-top:10px;
} }
.bodu { .bodu {

View File

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

View File

@ -25,18 +25,6 @@
equivalenceState: "Unrequired" 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 //Stores some externalCurriculums in order to upload them all at the confirmation of the registration request
const externalCurrTab = ref([]); const externalCurrTab = ref([]);
@ -45,9 +33,6 @@
const imageSaved = ref(false) const imageSaved = ref(false)
let ppData = "" 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 idcardfile = ref({})
const justifcardfile = ref({}) const justifcardfile = ref({})
@ -109,7 +94,7 @@
for (let item in externalCurrTab.value){ for (let item in externalCurrTab.value){
const temp = await uploadFile(externalCurrTab.value[item].justifdocUrl, "JustificationDocument") 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; z-index: 100;
font-family:sans-serif ; font-family:sans-serif ;
color:rgb(239,60,168); color:rgb(239,60,168);
transition: 0.5;
} }
.register{ .register{
@ -335,8 +318,6 @@
outline:none; outline:none;
border-radius: 4px; border-radius: 4px;
font-size:0.8em; font-size:0.8em;
align-self: right;
} }
input[type=submit],button,select{ input[type=submit],button,select{

View File

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

View File

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