diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java index 474e2cb..3dd81fd 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java @@ -3,14 +3,15 @@ package ovh.herisson.Clyde.EndPoints; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository; import ovh.herisson.Clyde.Responses.UnauthorizedResponse; -import ovh.herisson.Clyde.Services.AuthenticatorService; -import ovh.herisson.Clyde.Services.CourseService; -import ovh.herisson.Clyde.Services.ProtectionService; -import ovh.herisson.Clyde.Services.TeacherCourseService; +import ovh.herisson.Clyde.Services.*; import ovh.herisson.Clyde.Tables.Course; import ovh.herisson.Clyde.Tables.Role; import ovh.herisson.Clyde.Tables.User; +import ovh.herisson.Clyde.Tables.UserCurriculum; + +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -24,10 +25,20 @@ public class CourseController { private final AuthenticatorService authServ; - public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ) { + private final UserService userService; + + private final UserCurriculumService userCurriculumService; + + private final CurriculumCourseRepository curriculumCourseRepository; + private final CurriculumCourseService curriculumCourseService; + public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ, UserService userService, UserCurriculumService userCurriculumService, CurriculumCourseRepository curriculumCourseRepository, CurriculumCourseService curriculumCourseService) { this.courseServ = courseServ; this.teacherCourseServ = teacherCourseServ; this.authServ = authServ; + this.userService = userService; + this.userCurriculumService = userCurriculumService; + this.curriculumCourseRepository = curriculumCourseRepository; + this.curriculumCourseService = curriculumCourseService; } @GetMapping("/course/{id}") @@ -136,4 +147,28 @@ public class CourseController { return new ResponseEntity<>(HttpStatus.OK); } + + //Get all the courses followed by an user + @GetMapping("/usercourses/{userId}") + public ResponseEntity> getAllUserCourses(@PathVariable long userId){ + User u = userService.getUserById(userId); + + //We get all the actual curriculums of the user + ArrayList userCurricula = userCurriculumService.findByStudentAndActual(u, true); + ArrayList toReturn = new ArrayList<>(); + + //We iterate through all the curriculums and we extract the courses + for (int i = 0; i < userCurricula.size(); i++){ + curriculumCourseRepository.findCoursesByCurriculum(userCurricula.get(i).getCurriculum()).forEach((item) -> { + //We need this to eliminate clones because a course can belong to several curriculums + if(!toReturn.contains(item)){ + toReturn.add(item); + } + }); + } + + return new ResponseEntity<>(toReturn, HttpStatus.OK); + } + + } diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java index 60f4585..eb283e8 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java @@ -29,7 +29,7 @@ public class InscriptionController { @GetMapping("/requests/register") public ResponseEntity>> 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 inscriptionRequests = inscriptionServ.getAll(); @@ -41,7 +41,7 @@ public class InscriptionController { @GetMapping("/request/register/{id}") public ResponseEntity> 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); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java index f423984..b21a6ca 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java @@ -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> 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 toReturn = new ArrayList<>(); @@ -88,6 +91,33 @@ public class RequestsController { return new ResponseEntity<>(toReturn, HttpStatus.OK); } + @GetMapping(value = "/exemptionsreq/{id}") + public ResponseEntity getExemptionRequestbyId(@RequestHeader("Authorization") String token, @PathVariable long id){ + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + + ExemptionsRequest exemptionsRequest = err.findById(id); + + return new ResponseEntity<>(exemptionsRequest, HttpStatus.OK); + } + + @PatchMapping(value = "/exemptionsreq/{id}/{newstate}") + public ResponseEntity changeExemptionReqState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){ + 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); + + return new ResponseEntity<>(HttpStatus.OK); + } + //Get all the scholarships requests @GetMapping(value = "/scholarshipreq") public ResponseEntity> getAllScholarshipRequests(@RequestHeader("Authorization") String token){ @@ -118,9 +148,17 @@ public class RequestsController { } @PatchMapping(value = "/scholarshipreq/") - public ResponseEntity editScholReq(@RequestBody Map infos){ + public ResponseEntity editScholReq(@RequestHeader("Authorization") String token, @RequestBody Map 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")); @@ -133,30 +171,48 @@ public class RequestsController { } @GetMapping(value = "/scholarshipreq/{id}") - public ResponseEntity getScholReqbyId(@PathVariable long id){ + public ResponseEntity 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> getAllUnregReq(){ + public ResponseEntity> getAllUnregReq(@RequestHeader("Authorization") String token){ + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + ArrayList toReturn = new ArrayList<>(); unregisterRequestRepository.findAll().forEach(toReturn::add); return new ResponseEntity<>(toReturn, HttpStatus.OK); } @GetMapping(value = "/unregister/{id}") - public ResponseEntity getUnregbyId(@PathVariable long id){ + public ResponseEntity 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 pathUnregReq(@PathVariable long id, @PathVariable RequestState newstate){ + public ResponseEntity 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 userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u); @@ -171,11 +227,19 @@ public class RequestsController { userCurriculumRepository.save(userCurriculum); } } - - unregisterRequestRepository.save(unregisterRequest); return new ResponseEntity<>(HttpStatus.OK); } + //We look in the usercursus table if the student has already the previous year of a curriculum + public boolean studentHasPrevYear(Curriculum curriculum, User user){ + ArrayList userCurrList = userCurriculumRepository.findByUserOrderByCurriculum(user); + for (int i = 0; i < userCurrList.size(); i++){ + if (userCurrList.get(i).getCurriculum().getOption().equals(curriculum.getOption()) && userCurrList.get(i).getCurriculum().getYear() == curriculum.getYear()-1){ + return true; + } + } + return false; + } @PostMapping("/changecurriculumreq") public ResponseEntity addChangeCurrReq(@RequestBody Map reqInfos){ User user = userRepository.findById((Integer) reqInfos.get("userId")); @@ -191,8 +255,12 @@ public class RequestsController { Curriculum destinationCurriculum = curriculumRepository.findById((Integer) reqInfos.get("newcursus")); - ChangeCurriculumRequest changeCurriculumRequest = new ChangeCurriculumRequest(user, actualCurriculum, destinationCurriculum, new Date(), RequestState.Pending); + ChangeCurriculumRequest changeCurriculumRequest = new ChangeCurriculumRequest(user, actualCurriculum, destinationCurriculum, new Date(), RequestState.Pending, RequestState.Unrequired); + //Si l'année du cursus est plus grande que 1 et que l'étudiant n'a pas dans sa liste de cursus l'année d'en dessous alors on demande l'accord du prof + if (destinationCurriculum.getYear() > 1 && !studentHasPrevYear(destinationCurriculum, user)){ + changeCurriculumRequest.setTeacherApprovalState(RequestState.Pending); + } changeCurriculumRequestRepository.save(changeCurriculumRequest); return new ResponseEntity<>(HttpStatus.OK); @@ -200,7 +268,7 @@ public class RequestsController { @GetMapping("/changecurriculumreq") public ResponseEntity> 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 toReturn = new ArrayList<>(); @@ -212,7 +280,7 @@ public class RequestsController { @GetMapping("/changecurriculumreq/{id}") public ResponseEntity 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); @@ -221,34 +289,78 @@ public class RequestsController { @PatchMapping("/changecurriculumreq/{id}/{newState}") public ResponseEntity 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 (newState == RequestState.Accepted){ - //If actual curriculum is not null then we need to set that the user doesn't follow it anymore - User u = toEdit.getUser(); - if (toEdit.getActualCurriculum() != null){ - ArrayList listcurr = userCurriculumRepository.findByUserOrderByCurriculum(u); - - for (int i = 0; i < listcurr.size(); i++){ - if (listcurr.get(i).getCurriculum() == toEdit.getActualCurriculum()){ - listcurr.get(i).setActual(false); - } - } - - userCurriculumRepository.saveAll(listcurr); - } - - Calendar c = Calendar.getInstance(); - UserCurriculum userCurriculum = new UserCurriculum(u, toEdit.getDestinationCurriculum(), c.get(Calendar.YEAR), true); - userCurriculumRepository.save(userCurriculum); + //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); + } + return new ResponseEntity<>(HttpStatus.OK); } + + @PatchMapping("/changecurriculumreqteacher/{id}/{newteacherstate}") + public ResponseEntity editCCReqTeacherState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newteacherstate){ + 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); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + private void acceptProcedure(ChangeCurriculumRequest toEdit) { + User u = toEdit.getUser(); + if (toEdit.getActualCurriculum() != null){ + ArrayList listcurr = userCurriculumRepository.findByUserOrderByCurriculum(u); + + for (int i = 0; i < listcurr.size(); i++){ + if (listcurr.get(i).getCurriculum() == toEdit.getActualCurriculum()){ + listcurr.get(i).setActual(false); + } + } + + userCurriculumRepository.saveAll(listcurr); + } + + Calendar c = Calendar.getInstance(); + UserCurriculum userCurriculum = new UserCurriculum(u, toEdit.getDestinationCurriculum(), c.get(Calendar.YEAR), true); + userCurriculumRepository.save(userCurriculum); + } + + @GetMapping("/exemptionreq/{userId}") + public ResponseEntity> 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); + + ArrayList exList = err.findByUser(u); + return new ResponseEntity<>(exList, HttpStatus.OK); + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java index 6ff0707..ee215c9 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java @@ -83,13 +83,15 @@ public class MockController { minervalRepository.save(minerval); // Course / Curriculum part - Curriculum infoBab1 = new Curriculum(1,"info"); - Curriculum chemistryBab1 = new Curriculum(1,"chemistry"); - Curriculum psychologyBab1 = new Curriculum(1,"psychology"); - Curriculum infoBab2 = new Curriculum(2,"info"); - Curriculum masterinfo1 = new Curriculum(4, "info"); - Curriculum masterinfo2 = new Curriculum(5, "info"); - Curriculum chemistryBab2 = new Curriculum(2, "chemistry"); + Curriculum infoBab1 = new Curriculum(1,"info", false); + Curriculum chemistryBab1 = new Curriculum(1,"chemistry", false); + Curriculum psychologyBab1 = new Curriculum(1,"psychology", false); + Curriculum infoBab2 = new Curriculum(2,"info", false); + Curriculum masterinfo1 = new Curriculum(4, "info", false); + Curriculum masterinfo2 = new Curriculum(5, "info", false); + Curriculum chemistryBab2 = new Curriculum(2, "chemistry", false); + Curriculum ingebab1 = new Curriculum(1, "ingénieur", true); + curriculumService.save(infoBab1); curriculumService.save(chemistryBab1); curriculumService.save(psychologyBab1); @@ -97,6 +99,7 @@ public class MockController { curriculumService.save(masterinfo1); curriculumService.save(masterinfo2); curriculumService.save(chemistryBab2); + curriculumService.save(ingebab1); ucr.save(new UserCurriculum(joe, infoBab1, 2022, false)); ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true)); @@ -106,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); @@ -123,13 +126,12 @@ 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)); - - InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 4,RequestState.Pending,"yes.png","password", null, new Date(), RequestState.Pending); + InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 4,RequestState.Pending,"yes.png","password", null, new Date(), RequestState.Pending, null); inscriptionService.save(inscriptionRequest); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java index 3f66e80..7682d11 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java @@ -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 findById(long id); + ArrayList findByUser(User user); } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java index 75922fa..0e119f1 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java @@ -16,4 +16,6 @@ public interface UserCurriculumRepository extends CrudRepository findByUserOrderByCurriculum(User student); UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual); + ArrayList findByUserAndActual(User user, boolean actual); + } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/CurriculumCourseService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/CurriculumCourseService.java index 19549d0..b522da3 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/CurriculumCourseService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/CurriculumCourseService.java @@ -46,7 +46,7 @@ public class CurriculumCourseService { toReturn.put("curriculumId", curriculum.getCurriculumId()); toReturn.put("year", curriculum.getYear()); toReturn.put("option", curriculum.getOption()); - + toReturn.put("requireCertificate", curriculum.isRequireCertificate()); return toReturn; } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java index 208471d..534fb88 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java @@ -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); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java index 2861a6e..4dbdea3 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java @@ -49,5 +49,7 @@ public class UserCurriculumService { return toReturn; } - + public ArrayList findByStudentAndActual(User u, boolean actual){ + return userCurriculumRepository.findByUserAndActual(u, actual); + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/ChangeCurriculumRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/ChangeCurriculumRequest.java index 72feebd..a309023 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/ChangeCurriculumRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/ChangeCurriculumRequest.java @@ -26,14 +26,16 @@ public class ChangeCurriculumRequest { private RequestState state; + private RequestState teacherApprovalState; public ChangeCurriculumRequest(){} - public ChangeCurriculumRequest(User user, Curriculum actualCurriculum, Curriculum destinationCurriculum, Date date, RequestState state){ + public ChangeCurriculumRequest(User user, Curriculum actualCurriculum, Curriculum destinationCurriculum, Date date, RequestState state, RequestState teacherApprovalState){ this.user = user; this.actualCurriculum = actualCurriculum; this.destinationCurriculum = destinationCurriculum; this.date = date; this.state = state; + this.teacherApprovalState = teacherApprovalState; } public User getUser() { @@ -80,4 +82,14 @@ public class ChangeCurriculumRequest { public int getId() { return id; } + + public RequestState getTeacherApprovalState() { + return teacherApprovalState; + } + + public void setTeacherApprovalState(RequestState teacherApprovalState) { + this.teacherApprovalState = teacherApprovalState; + } } + + diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Curriculum.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Curriculum.java index 67075d1..4bcac40 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Curriculum.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Curriculum.java @@ -12,9 +12,13 @@ public class Curriculum { private int curriculumId; private int year; private String option; - public Curriculum(int year, String option){ + + //True if the curriculum need an entry exam + private boolean requireCertificate; + public Curriculum(int year, String option, boolean requireCertificate){ this.year = year; this.option = option; + this.requireCertificate = requireCertificate; } public Curriculum() {} @@ -39,4 +43,11 @@ public class Curriculum { this.option = option; } + public void setRequireCertificate(boolean requireCertificate) { + this.requireCertificate = requireCertificate; + } + + public boolean isRequireCertificate() { + return requireCertificate; + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/FileType.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/FileType.java index e7a081b..ad5eab4 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/FileType.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/FileType.java @@ -3,5 +3,6 @@ package ovh.herisson.Clyde.Tables; public enum FileType { ProfilePicture, EducationCertificate, - JustificationDocument + JustificationDocument, + IdentityCard, } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java index 75ee926..8942bb6 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java @@ -80,4 +80,8 @@ public class ExemptionsRequest { public void setDate(Date date) { this.date = date; } + + public int getId() { + return id; + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/InscriptionRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/InscriptionRequest.java index 07c720f..1d0271c 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/InscriptionRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/InscriptionRequest.java @@ -22,11 +22,12 @@ public class InscriptionRequest { private String profilePicture; private String password; private String identityCard; + private String admissionDocUrl; private Date submissionDate; private RequestState equivalenceState; public InscriptionRequest(){} - public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate, RequestState equivalenceState){ + public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate, RequestState equivalenceState, String admissionDocUrl){ this.lastName = lastName; this.firstName = firstName; this.address = address; @@ -40,6 +41,7 @@ public class InscriptionRequest { this.identityCard = identityCard; this.submissionDate = submissionDate; this.equivalenceState = equivalenceState; + this.admissionDocUrl = admissionDocUrl; } public int getId() { @@ -149,4 +151,12 @@ public class InscriptionRequest { public void setEquivalenceState(RequestState equivalenceState) { this.equivalenceState = equivalenceState; } + + public String getAdmissionDocUrl() { + return admissionDocUrl; + } + + public void setAdmissionDocUrl(String admissionDocUrl) { + this.admissionDocUrl = admissionDocUrl; + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ReInscriptionRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ReInscriptionRequest.java deleted file mode 100644 index cafffe6..0000000 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ReInscriptionRequest.java +++ /dev/null @@ -1,81 +0,0 @@ -package ovh.herisson.Clyde.Tables.Inscription; - -import jakarta.persistence.*; -import org.hibernate.annotations.OnDelete; -import org.hibernate.annotations.OnDeleteAction; -import ovh.herisson.Clyde.Tables.Curriculum; -import ovh.herisson.Clyde.Tables.RequestState; -import ovh.herisson.Clyde.Tables.User; - -@Entity -public class ReInscriptionRequest { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private int id; - - @ManyToOne - @JoinColumn(name = "Users") - @OnDelete(action = OnDeleteAction.CASCADE) - private User user; - - @ManyToOne - @JoinColumn(name = "Curriculum") - @OnDelete(action = OnDeleteAction.CASCADE) - private Curriculum newCurriculum; - private RequestState state; - - //Permet de différencier les demandes de changement et une réinscription dans le même Curriculum - //Pour la réinscription on va le mettre a 0 - private boolean type = false; - - public ReInscriptionRequest(){} - - public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state, boolean type){ - this.user = user; - this.newCurriculum = newCurriculum; - this.state = state; - this.type = type; - } - - public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state){ - this.user = user; - this.newCurriculum = newCurriculum; - this.state = state; - } - - public int getId() { - return id; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public Curriculum getNewCurriculum() { - return newCurriculum; - } - - public void setNewCurriculum(Curriculum newCurriculum) { - this.newCurriculum = newCurriculum; - } - - public RequestState getState() { - return state; - } - - public void setState(RequestState state) { - this.state = state; - } - - public boolean isType() { - return type; - } - - public void setType(boolean type) { - this.type = type; - } -} diff --git a/frontend/public/i18n/EN.txt b/frontend/public/i18n/EN.txt index 45807f1..0d7fa4a 100644 --- a/frontend/public/i18n/EN.txt +++ b/frontend/public/i18n/EN.txt @@ -13,6 +13,13 @@ login.guest.lastpage=Last Page login.guest.submit=Submit login.guest.birthday=BIRTHDAY login.guest.confirm=CONFIRM +login.guest.browse=Browse... +login.guest.disclaimer=If you are already registered please connect to your account and use the change cursus/reregister function if not continue here. +login.guest.identityCard=Identity Card : +login.guest.attestationdisclaimer=This curriculum requires an entrance exam attestation +login.guest.formationdisclaimer=Please add your old formations with the associated degree/attestation,your case will be check by a member of the inscription service. +login.guest.managecareer=Manage your external formations +login.guest.sendRegReq=Send register request login.cPassword=Confirm Password login.password=Password app.home=Home @@ -56,3 +63,84 @@ faculty=Faculty forum.create=Create forum forum.create.name=New forum's name forum.post.create.name=New post's title +firstname/name=Firstname/Name +regNo=regNo +From=From +To=To +WantedCursus=Wanted Cursus +seeprofile=See profile +acceptequiv=Accept equivalence +refuseequiv=Refuse equivalence +course=course +state=state +dljustifdoc=Download justification document +backtoreq=Back to request +dlidentitycard=Download identity card +dladmissiondoc=Download admission document +seeextcur=See external curriculums +dltaxdoc=Download tax justification document +dlresidency=Download residency justification document +enteramount=Please enter the amount to provide : +oldcursus=Old curriculums +newcursus = New curriculums +year=Year +reason=Reason : +selectedcursus=Selected curriculum : +askexemp=Ask exemption +exemp=Exempted +uploadjustifdoc=Please upload the justification document +subexemreq=Submit exemption request +addextcurr=Add external curriculum +dldoc=Download document +edit=Edit +delete=Delete +school=School +checkifnotcompleted=Check the box if you didn't complete the formation +wichyearstop=In which year did you stop (ex: 3rd year) ? +startyear=Start year +endyear=End year +giveextcurdoc=Please upload a document that proves this formation +uploadcurr=Upload curriculum +editcurr=Edit curriculum +reqtype=Request type : +inscription=register +scholarship=scholarship +exemption=exemption +unregister=unregister +curriculumch=curriculum change +filter=Filter : +approval=Approval : +teacherapproval=Teacher approval : +surreq=Are you sure that you want to accept this request ? +validate=Validate +amount=Amount +role=Role +manageextcur=Manage external curriculum +managecourse=Manage courses +manageminerval=Manage school fees +enterreason=Please enter the reason you leave +onlycursus=I only want to unregister from a specific cursus +plsselectcurs=Please select that cursus +sureunreg=Are you sure that you want to unregister ? +no=No +yes=Yes +reqsend=Your request has been send ! +payment=Payment +lefttopay=left to pay +paydeposit=Pay deposit +payrest=Pay all the rest +alreadypaid=Payment : School fees have already been paid this year +askscholarship=Ask scholarship +uploaddocs=Please upload the required documents +taxjustdoc=Tax justification document : +residencydoc=Residency justification document : +reqsent=Your request has been sent to the inscription service. +backprofile=Go back to profile +procpayment=Proceed to payment of +procpaybutton=Process payment +rereg=Reregister in the next year of one of my cursus +reregsup=Register in a supplementary cursus +chcur=Change from a cursus to another +iwouldlike=I would like to : +newcurr=New curriculum +cursusprereq=The cursus you selected has some prerequisites ensure that your external curriculum data is updated in your profile diff --git a/frontend/public/i18n/FR.txt b/frontend/public/i18n/FR.txt index 34bf63b..dd4e591 100644 --- a/frontend/public/i18n/FR.txt +++ b/frontend/public/i18n/FR.txt @@ -13,6 +13,13 @@ login.guest.lastpage=Derniere Page login.guest.submit=Envoyer login.guest.birthday=DATE DE NAISSANCE login.guest.confirm=CONFIRMER +login.guest.browse=Parcourir... +login.guest.disclaimer=Si vous êtes déja inscrits dans cette université veuillez vous connecter a votre compte et utilisez les fonctions changer de cursus/réinscription sinon continuez ici. +login.guest.identityCard=Carte d'identité : +login.guest.attestationdisclaimer=Ce cursus requiert une attestation de réussite d'un examen d'entrée +login.guest.formationdisclaimer=Veuillez ajouter vos formations antérieures en y joignant les attestations/diplomes, votre dossier sera vérifié par un membre du service d'inscription. +login.guest.managecareer=Gèrer mon parcours extérieur +login.guest.sendRegReq=Envoyer la demande d'inscription login.cPassword=Confirmer mot de passe login.password=Mot de passe app.home=Home @@ -56,3 +63,84 @@ faculty=Faculté forum.create=Créer un forum forum.create.name=Nom du forum forum.post.create.name=Titre du post +firstname/name=Prénom/Nom +regNo=Matricule +From=De +To=A +WantedCursus=Cursus voulu +seeprofile=Voir le profil +acceptequiv=Accepter l'équivalence +refuseequiv=Refuser l'équivalence +course=cours +state=état +dljustifdoc=Télécharger le justificatif +backtoreq=Retour a la requête +dlidentitycard=Télécharger la carte d'identité +dladmissiondoc=Télécharger le certificat d'admission +seeextcur=Voir le parcours extérieur +dltaxdoc=Télécharger le justificatif d'impot +dlresidency=Télécharger le justificatif de résidence +enteramount=Veuillez entrer le montant alloué : +oldcursus=Anciens cursus +newcursus=Nouveaux cursus +year=Année +reason=Raison : +selectedcursus=Cursus selectionné : +askexemp=Demander une dispense +exemp=Dispensé +uploadjustifdoc=Veuillez soumettre le justificatif +subexemreq=Envoyer la demande de dispense +addextcurr=Ajouter une formation +dldoc=Télécharger le document +edit=Modifier +delete=Supprimer +school=Ecole +checkifnotcompleted=Cochez la case si vous n'avez terminé cette formation +wichyearstop=En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ? +startyear=Année de début +endyear=Année de fin +giveextcurdoc=Veuillez soumettre un document attestant de ce parcours +uploadcurr=Ajouter la formation +editcurr=Modifier la formation +reqtype=Type de requête : +inscription=inscription +scholarship=bourse +exemption=dispense +unregister=désinscription +curriculumch=changement de cursus +filer=Filtre : +approval=Approbation : +teacherapproval=Approbation d'un prof : +surreq=Etes vous sur de vouloir accepter cette demande ? +validate=Valider +amount=Montant +role=Role +manageextcur=Gérer les formations +managecourse=Gérer les cours +manageminerval=Gérer le minerval +enterreason=Veuillez entrer la raison de votre départ +onlycursus=Je veux uniquement me désinscrire d'un seul cursus +plsselectcurs=Veuillez sélectionner ce cursus +sureunreg=Etes-vous sur de vouloir vous désinscrire ? +no=Non +yes=Oui +reqsend=Votre requête a été envoyée ! +payment=Payement +lefttopay=restants a payer +paydeposit=Payer l'acompte +payrest=Payer le reste +alreadypaid=Payement : les frais ont déja été payés cette année +askscholarship=Demander une bourse +uploaddocs=Veuillez soumettre les documents requis +taxjustdoc=Justificatif d'impôts : +residencydoc=Justificatif de résidence : +reqsent=Votre requête a été envoyée au service d'inscription. +backprofile=Retour au profil +procpayment=Procéder au payement de +procpaybutton=Procéder au payement +rereg=Me réinscrire dans l'année supérieure +reregsup=M'inscrire dans un cursus supplémentaire +chcur=Changer d'un cursus vers un autre +iwouldlike=Je voudrais : +newcurr=Nouveau cursus +cursusprereq=Le cursus que vous avez selectionné a des prérequis assurez vous que votre dossier de parcours est a jour dans votre profil diff --git a/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue b/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue index 1427446..0f2e21d 100644 --- a/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue +++ b/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue @@ -1,64 +1,77 @@ @@ -112,4 +125,12 @@ async function uploadandrefreshChangeRequest(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; +} \ No newline at end of file diff --git a/frontend/src/Apps/Inscription/AboutExemption.vue b/frontend/src/Apps/Inscription/AboutExemption.vue new file mode 100644 index 0000000..f4cdc98 --- /dev/null +++ b/frontend/src/Apps/Inscription/AboutExemption.vue @@ -0,0 +1,124 @@ + + + + + + \ No newline at end of file diff --git a/frontend/src/Apps/Inscription/AboutRequest.vue b/frontend/src/Apps/Inscription/AboutRequest.vue index 15c72f5..4d8a11b 100644 --- a/frontend/src/Apps/Inscription/AboutRequest.vue +++ b/frontend/src/Apps/Inscription/AboutRequest.vue @@ -1,7 +1,7 @@ @@ -123,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; } \ No newline at end of file diff --git a/frontend/src/Apps/Inscription/AboutScholarship.vue b/frontend/src/Apps/Inscription/AboutScholarship.vue index c48cf90..45c9e36 100644 --- a/frontend/src/Apps/Inscription/AboutScholarship.vue +++ b/frontend/src/Apps/Inscription/AboutScholarship.vue @@ -39,31 +39,31 @@ async function uploadandrefreshScholarshipRequest(){
- Firstname/Name : {{user.firstName}} {{user.lastName}} + {{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
- E-mail: {{user.email}} + {{ i18n("login.guest.email") }}: {{user.email}}
- Adresse : {{user.address}} + {{ i18n("login.guest.address") }} : {{user.address}}
- Country : {{user.country}} + {{ i18n("login.guest.country") }} : {{user.country}}
- Birthdate : {{user.birthDate.slice(0,10)}} + {{ i18n("login.guest.birthday") }} : {{user.birthDate.slice(0,10)}}
- - + +
-
- Please enter the amount to provide : +
+ {{i18n("enteramount")}}
- - + +
@@ -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; +} \ No newline at end of file diff --git a/frontend/src/Apps/Inscription/AboutStudent.vue b/frontend/src/Apps/Inscription/AboutStudent.vue index 91fb89f..c5b825e 100644 --- a/frontend/src/Apps/Inscription/AboutStudent.vue +++ b/frontend/src/Apps/Inscription/AboutStudent.vue @@ -1,10 +1,11 @@ diff --git a/frontend/src/Apps/Inscription/ExternalCurriculumList.vue b/frontend/src/Apps/Inscription/ExternalCurriculumList.vue index eba1cdf..8336b5e 100644 --- a/frontend/src/Apps/Inscription/ExternalCurriculumList.vue +++ b/frontend/src/Apps/Inscription/ExternalCurriculumList.vue @@ -3,16 +3,25 @@ import {reactive, ref} from "vue"; import {getSelf} from "@/rest/Users.js"; import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js"; + import {uploadFile} from "@/rest/uploads.js"; - //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user + //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user, 2 inscription procedure const props = defineProps(["extCurrList", "mode"]) - const extCurrList = ref(props.extCurrList) + //Only usefull to pass the external curr array in the inscription procedure + const externalCurrTab = defineModel(); + + const extCurrList = ref({}) + let extNum = 0 + const User = ref({}) + + if (props.mode === 1){ + User.value = await getSelf() + } - const User = await getSelf() const list = ref(true) - + const editmode = ref(false) const notcompletedCheck = ref(false); const externalCurr = reactive({ @@ -28,29 +37,58 @@ if (props.mode === 1){ externalCurr.userRegNo = props.extCurrList[0].user.regNo + }else if(props.mode === 2){ + extCurrList.value = externalCurrTab.value + } + + if(props.mode !== 2){ + extCurrList.value = props.extCurrList + console.log("oe") + } + + function deleteExtCursus(extcursus){ + externalCurrTab.value.splice(externalCurrTab.value.indexOf(extcursus),1) } async function postExternalCurr(){ - await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo); - //We refresh the list - extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); - list.value = !list.value; + 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.url, externalCurr.userRegNo); + //We refresh the list + extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); + list.value = !list.value; + }else if (props.mode === 2){ + externalCurrTab.value.push({ + inscriptionRequestId : externalCurr.inscriptionRequestId, + school:externalCurr.school, + formation :externalCurr.formation, + completion : externalCurr.completion, + startYear : externalCurr.startYear, + endYear: externalCurr.endYear, + justifdocUrl : externalCurr.justifdocUrl, + userRegNo : externalCurr.userRegNo + }); + extCurrList.value = externalCurrTab.value + list.value = !list.value; + } }