1
0
forked from PGL/Clyde

Merge remote-tracking branch 'origin/master' into forum

This commit is contained in:
Debucquoy Anthony 2024-04-21 09:04:58 +02:00
commit ecaf5e3df8
34 changed files with 1008 additions and 452 deletions

View File

@ -3,14 +3,15 @@ package ovh.herisson.Clyde.EndPoints;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository;
import ovh.herisson.Clyde.Responses.UnauthorizedResponse; import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
import ovh.herisson.Clyde.Services.AuthenticatorService; import ovh.herisson.Clyde.Services.*;
import ovh.herisson.Clyde.Services.CourseService;
import ovh.herisson.Clyde.Services.ProtectionService;
import ovh.herisson.Clyde.Services.TeacherCourseService;
import ovh.herisson.Clyde.Tables.Course; import ovh.herisson.Clyde.Tables.Course;
import ovh.herisson.Clyde.Tables.Role; import ovh.herisson.Clyde.Tables.Role;
import ovh.herisson.Clyde.Tables.User; import ovh.herisson.Clyde.Tables.User;
import ovh.herisson.Clyde.Tables.UserCurriculum;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -24,10 +25,20 @@ public class CourseController {
private final AuthenticatorService authServ; 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.courseServ = courseServ;
this.teacherCourseServ = teacherCourseServ; this.teacherCourseServ = teacherCourseServ;
this.authServ = authServ; this.authServ = authServ;
this.userService = userService;
this.userCurriculumService = userCurriculumService;
this.curriculumCourseRepository = curriculumCourseRepository;
this.curriculumCourseService = curriculumCourseService;
} }
@GetMapping("/course/{id}") @GetMapping("/course/{id}")
@ -136,4 +147,28 @@ public class CourseController {
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
//Get all the courses followed by an user
@GetMapping("/usercourses/{userId}")
public ResponseEntity<ArrayList<Course>> getAllUserCourses(@PathVariable long userId){
User u = userService.getUserById(userId);
//We get all the actual curriculums of the user
ArrayList<UserCurriculum> userCurricula = userCurriculumService.findByStudentAndActual(u, true);
ArrayList<Course> 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);
}
} }

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<>();
@ -88,6 +91,33 @@ public class RequestsController {
return new ResponseEntity<>(toReturn, HttpStatus.OK); return new ResponseEntity<>(toReturn, HttpStatus.OK);
} }
@GetMapping(value = "/exemptionsreq/{id}")
public ResponseEntity<ExemptionsRequest> 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<String> 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 //Get all the scholarships requests
@GetMapping(value = "/scholarshipreq") @GetMapping(value = "/scholarshipreq")
public ResponseEntity<ArrayList<ScholarshipRequest>> getAllScholarshipRequests(@RequestHeader("Authorization") String token){ public ResponseEntity<ArrayList<ScholarshipRequest>> getAllScholarshipRequests(@RequestHeader("Authorization") String token){
@ -118,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"));
@ -133,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);
@ -171,11 +227,19 @@ public class RequestsController {
userCurriculumRepository.save(userCurriculum); userCurriculumRepository.save(userCurriculum);
} }
} }
unregisterRequestRepository.save(unregisterRequest);
return new ResponseEntity<>(HttpStatus.OK); 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<UserCurriculum> 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") @PostMapping("/changecurriculumreq")
public ResponseEntity<String> addChangeCurrReq(@RequestBody Map<String,Object> reqInfos){ public ResponseEntity<String> addChangeCurrReq(@RequestBody Map<String,Object> reqInfos){
User user = userRepository.findById((Integer) reqInfos.get("userId")); User user = userRepository.findById((Integer) reqInfos.get("userId"));
@ -191,8 +255,12 @@ public class RequestsController {
Curriculum destinationCurriculum = curriculumRepository.findById((Integer) reqInfos.get("newcursus")); 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); changeCurriculumRequestRepository.save(changeCurriculumRequest);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
@ -200,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<>();
@ -212,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);
@ -221,15 +289,49 @@ 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);
}
if (newState == RequestState.Accepted){ 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 //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<String> 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(); User u = toEdit.getUser();
if (toEdit.getActualCurriculum() != null){ if (toEdit.getActualCurriculum() != null){
ArrayList<UserCurriculum> listcurr = userCurriculumRepository.findByUserOrderByCurriculum(u); ArrayList<UserCurriculum> listcurr = userCurriculumRepository.findByUserOrderByCurriculum(u);
@ -248,7 +350,17 @@ public class RequestsController {
userCurriculumRepository.save(userCurriculum); userCurriculumRepository.save(userCurriculum);
} }
changeCurriculumRequestRepository.save(toEdit); @GetMapping("/exemptionreq/{userId}")
return new ResponseEntity<>(HttpStatus.OK); 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);
ArrayList<ExemptionsRequest> exList = err.findByUser(u);
return new ResponseEntity<>(exList, HttpStatus.OK);
} }
} }

View File

@ -83,13 +83,15 @@ public class MockController {
minervalRepository.save(minerval); minervalRepository.save(minerval);
// Course / Curriculum part // Course / Curriculum part
Curriculum infoBab1 = new Curriculum(1,"info"); Curriculum infoBab1 = new Curriculum(1,"info", false);
Curriculum chemistryBab1 = new Curriculum(1,"chemistry"); Curriculum chemistryBab1 = new Curriculum(1,"chemistry", false);
Curriculum psychologyBab1 = new Curriculum(1,"psychology"); Curriculum psychologyBab1 = new Curriculum(1,"psychology", false);
Curriculum infoBab2 = new Curriculum(2,"info"); Curriculum infoBab2 = new Curriculum(2,"info", false);
Curriculum masterinfo1 = new Curriculum(4, "info"); Curriculum masterinfo1 = new Curriculum(4, "info", false);
Curriculum masterinfo2 = new Curriculum(5, "info"); Curriculum masterinfo2 = new Curriculum(5, "info", false);
Curriculum chemistryBab2 = new Curriculum(2, "chemistry"); Curriculum chemistryBab2 = new Curriculum(2, "chemistry", false);
Curriculum ingebab1 = new Curriculum(1, "ingénieur", true);
curriculumService.save(infoBab1); curriculumService.save(infoBab1);
curriculumService.save(chemistryBab1); curriculumService.save(chemistryBab1);
curriculumService.save(psychologyBab1); curriculumService.save(psychologyBab1);
@ -97,6 +99,7 @@ public class MockController {
curriculumService.save(masterinfo1); curriculumService.save(masterinfo1);
curriculumService.save(masterinfo2); curriculumService.save(masterinfo2);
curriculumService.save(chemistryBab2); curriculumService.save(chemistryBab2);
curriculumService.save(ingebab1);
ucr.save(new UserCurriculum(joe, infoBab1, 2022, false)); ucr.save(new UserCurriculum(joe, infoBab1, 2022, false));
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true)); ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true));
@ -106,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);
@ -123,13 +126,12 @@ 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));
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);
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);
inscriptionService.save(inscriptionRequest); inscriptionService.save(inscriptionRequest);

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);
ArrayList<ExemptionsRequest> findByUser(User user);
} }

View File

@ -16,4 +16,6 @@ public interface UserCurriculumRepository extends CrudRepository<UserCurriculum,
ArrayList<UserCurriculum> findByUserOrderByCurriculum(User student); ArrayList<UserCurriculum> findByUserOrderByCurriculum(User student);
UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual); UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual);
ArrayList<UserCurriculum> findByUserAndActual(User user, boolean actual);
} }

View File

@ -46,7 +46,7 @@ public class CurriculumCourseService {
toReturn.put("curriculumId", curriculum.getCurriculumId()); toReturn.put("curriculumId", curriculum.getCurriculumId());
toReturn.put("year", curriculum.getYear()); toReturn.put("year", curriculum.getYear());
toReturn.put("option", curriculum.getOption()); toReturn.put("option", curriculum.getOption());
toReturn.put("requireCertificate", curriculum.isRequireCertificate());
return toReturn; return toReturn;
} }

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

@ -49,5 +49,7 @@ public class UserCurriculumService {
return toReturn; return toReturn;
} }
public ArrayList<UserCurriculum> findByStudentAndActual(User u, boolean actual){
return userCurriculumRepository.findByUserAndActual(u, actual);
}
} }

View File

@ -26,14 +26,16 @@ public class ChangeCurriculumRequest {
private RequestState state; private RequestState state;
private RequestState teacherApprovalState;
public ChangeCurriculumRequest(){} 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.user = user;
this.actualCurriculum = actualCurriculum; this.actualCurriculum = actualCurriculum;
this.destinationCurriculum = destinationCurriculum; this.destinationCurriculum = destinationCurriculum;
this.date = date; this.date = date;
this.state = state; this.state = state;
this.teacherApprovalState = teacherApprovalState;
} }
public User getUser() { public User getUser() {
@ -80,4 +82,14 @@ public class ChangeCurriculumRequest {
public int getId() { public int getId() {
return id; return id;
} }
public RequestState getTeacherApprovalState() {
return teacherApprovalState;
}
public void setTeacherApprovalState(RequestState teacherApprovalState) {
this.teacherApprovalState = teacherApprovalState;
}
} }

View File

@ -12,9 +12,13 @@ public class Curriculum {
private int curriculumId; private int curriculumId;
private int year; private int year;
private String option; 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.year = year;
this.option = option; this.option = option;
this.requireCertificate = requireCertificate;
} }
public Curriculum() {} public Curriculum() {}
@ -39,4 +43,11 @@ public class Curriculum {
this.option = option; this.option = option;
} }
public void setRequireCertificate(boolean requireCertificate) {
this.requireCertificate = requireCertificate;
}
public boolean isRequireCertificate() {
return requireCertificate;
}
} }

View File

@ -3,5 +3,6 @@ package ovh.herisson.Clyde.Tables;
public enum FileType { public enum FileType {
ProfilePicture, ProfilePicture,
EducationCertificate, EducationCertificate,
JustificationDocument JustificationDocument,
IdentityCard,
} }

View File

@ -80,4 +80,8 @@ public class ExemptionsRequest {
public void setDate(Date date) { public void setDate(Date date) {
this.date = date; this.date = date;
} }
public int getId() {
return id;
}
} }

View File

@ -22,11 +22,12 @@ public class InscriptionRequest {
private String profilePicture; private String profilePicture;
private String password; private String password;
private String identityCard; private String identityCard;
private String admissionDocUrl;
private Date submissionDate; private Date submissionDate;
private RequestState equivalenceState; private RequestState equivalenceState;
public InscriptionRequest(){} 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.lastName = lastName;
this.firstName = firstName; this.firstName = firstName;
this.address = address; this.address = address;
@ -40,6 +41,7 @@ public class InscriptionRequest {
this.identityCard = identityCard; this.identityCard = identityCard;
this.submissionDate = submissionDate; this.submissionDate = submissionDate;
this.equivalenceState = equivalenceState; this.equivalenceState = equivalenceState;
this.admissionDocUrl = admissionDocUrl;
} }
public int getId() { public int getId() {
@ -149,4 +151,12 @@ public class InscriptionRequest {
public void setEquivalenceState(RequestState equivalenceState) { public void setEquivalenceState(RequestState equivalenceState) {
this.equivalenceState = equivalenceState; this.equivalenceState = equivalenceState;
} }
public String getAdmissionDocUrl() {
return admissionDocUrl;
}
public void setAdmissionDocUrl(String admissionDocUrl) {
this.admissionDocUrl = admissionDocUrl;
}
} }

View File

@ -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;
}
}

View File

@ -13,6 +13,13 @@ login.guest.lastpage=Last Page
login.guest.submit=Submit login.guest.submit=Submit
login.guest.birthday=BIRTHDAY login.guest.birthday=BIRTHDAY
login.guest.confirm=CONFIRM 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.cPassword=Confirm Password
login.password=Password login.password=Password
app.home=Home app.home=Home
@ -56,3 +63,84 @@ faculty=Faculty
forum.create=Create forum forum.create=Create forum
forum.create.name=New forum's name forum.create.name=New forum's name
forum.post.create.name=New post's title 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

View File

@ -13,6 +13,13 @@ login.guest.lastpage=Derniere Page
login.guest.submit=Envoyer login.guest.submit=Envoyer
login.guest.birthday=DATE DE NAISSANCE login.guest.birthday=DATE DE NAISSANCE
login.guest.confirm=CONFIRMER 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.cPassword=Confirmer mot de passe
login.password=Mot de passe login.password=Mot de passe
app.home=Home app.home=Home
@ -56,3 +63,84 @@ faculty=Faculté
forum.create=Créer un forum forum.create=Créer un forum
forum.create.name=Nom du forum forum.create.name=Nom du forum
forum.post.create.name=Titre du post 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

View File

@ -1,64 +1,77 @@
<script setup> <script setup>
import { import {
addUninscReq, editChangeCurrReq, addUninscReq, editChangeCurrReq, editChangeCurrReqTeacherState,
editScholarshipReq, editScholarshipReq,
editUnregReq, getChangeCurrReqById, editUnregReq, getChangeCurrReqById,
getScholarshipReqById, getScholarshipReqById,
getUnregisterbyId getUnregisterbyId
} from "@/rest/requests.js"; } from "@/rest/requests.js";
import i18n from "@/i18n.js"; import i18n from "@/i18n.js";
import {getUser} from "@/rest/Users.js"; import {getSelf, getUser} from "@/rest/Users.js";
import {reactive, ref} from "vue"; import {reactive, ref} from "vue";
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue"; import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
const props = defineProps(["reqId"]) const props = defineProps(["reqId"])
const req = ref(await getChangeCurrReqById(props.reqId)) const req = ref(await getChangeCurrReqById(props.reqId))
const user = await getSelf()
//0 liste, 1 profil //0 liste, 1 profil
const windowstate = ref(0); const localwindowstate = ref(0);
const tag = req.value.user.regNo const tag = req.value.user.regNo
const windowState = defineModel("windowState")
async function uploadandrefreshChangeRequest(state){ async function uploadandrefreshChangeRequest(state){
await editChangeCurrReq(req.value.id, state); await editChangeCurrReq(req.value.id, state);
} }
async function editChangeCurrReqTeacherApproval(state){
await editChangeCurrReqTeacherState(req.value.id, state)
}
</script> </script>
<template> <template>
<div class="body" v-if="windowstate === 0"> <div class="body" v-if="localwindowstate === 0">
<div class="container"> <div class="container">
<div class="globalInfos"> <div class="globalInfos">
<div class="infosContainer"> <div class="infosContainer">
<div> <div>
Firstname/Name : {{req.user.firstName}} {{req.user.lastName}} {{i18n("firstname/name")}} : {{req.user.firstName}} {{req.user.lastName}}
</div> </div>
<div> <div>
regNo : {{req.user.regNo}} {{i18n("regNo")}} : {{req.user.regNo}}
</div> </div>
<div v-if="req.actualCurriculum !== null"> <div v-if="req.actualCurriculum !== null">
From : Bac {{req.actualCurriculum.year}} {{req.actualCurriculum.option}} {{i18n("From")}} : Bac {{req.actualCurriculum.year}} {{req.actualCurriculum.option}}
To : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}} {{i18n("To")}} : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
</div> </div>
<div v-else> <div v-else>
Wanted cursus : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}} {{i18n("WantedCursus")}} : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
</div> </div>
<div> <div>
<button @click="windowstate++"> See profile </button> <button @click="localwindowstate++"> {{ i18n("seeprofile") }} </button>
</div> </div>
<div> <div>
<button v-if="req.state === 'Pending'" @click="req.state='Accepted';uploadandrefreshChangeRequest('Accepted')">Accept</button> <button v-if="req.state === 'Pending'" @click="req.state='Accepted';uploadandrefreshChangeRequest('Accepted')">{{ i18n("request.accept") }}</button>
<button v-if="req.state === 'Pending'" @click="req.state='Refused';uploadandrefreshChangeRequest('Refused')" style="margin-left: 2%;">Refuse</button> <button v-if="req.state === 'Pending'" @click="req.state='Refused';uploadandrefreshChangeRequest('Refused')" style="margin-left: 2%;">{{i18n("request.refuse")}}</button>
</div>
<div v-if="user.role === 'Teacher' || user.role === 'Admin'">
<button v-if="req.teacherApprovalState === 'Pending'" @click="req.teacherApprovalState='Accepted';editChangeCurrReqTeacherApproval('Accepted')">{{i18n("acceptequiv")}}</button>
<button v-if="req.teacherApprovalState === 'Pending'" @click="req.teacherApprovalState='Refused';editChangeCurrReqTeacherApproval('Refused')">{{i18n("refuseequiv")}}</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="windowstate === 1"> <div v-if="localwindowstate === 0" style="margin-left: 23%">
<button @click="windowState = 0" style="margin-left: 10%">{{ i18n("courses.back") }}</button>
</div>
<div v-if="localwindowstate === 1">
<AboutStudent :target="tag"></AboutStudent> <AboutStudent :target="tag"></AboutStudent>
<button @click="windowstate--;">Return to request</button> <button @click="localwindowstate--;" style="margin-left: 10%">{{ i18n("courses.back") }}</button>
</div> </div>
</template> </template>
@ -112,4 +125,12 @@ async function uploadandrefreshChangeRequest(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

@ -0,0 +1,124 @@
<script setup>
import {
addUninscReq,
editExempReqState,
editScholarshipReq,
getExempReq,
getScholarshipReqById
} from "@/rest/requests.js";
import i18n from "@/i18n.js";
import {getUser} from "@/rest/Users.js";
import {reactive, ref} from "vue";
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
const props = defineProps(["reqId"])
const req = ref(await getExempReq(props.reqId))
const profile = ref(false)
const windowState = defineModel("windowState")
async function editExemp(newstate){
await editExempReqState(req.value.id, newstate)
}
</script>
<template>
<div class="body" v-if="profile === false">
<div class="container">
<div class="globalInfos">
<div class="infosContainer">
<div>
{{ i18n("firstname/name") }} : {{req.user.firstName}} {{req.user.lastName}}
</div>
<div>
{{ i18n("course") }}: {{req.course.title}}
</div>
<div>
{{ i18n("state") }} : {{req.state}}
</div>
<div>
<button @click="profile = !profile">{{ i18n("seeprofile") }}</button>
</div>
<div>
<button>{{ i18n("dljustifdoc") }}</button>
</div>
<div>
<button v-if="req.state === 'Pending'" @click="req.state='Accepted';editExemp('Accepted')">{{ i18n("request.accept") }}</button>
<button v-if="req.state === 'Pending'" @click="req.state='Refused';editExemp('Refused')" style="margin-left: 2%;">{{ i18n("request.refuse") }}</button>
</div>
</div>
</div>
</div>
</div>
<div v-else>
<AboutStudent :target="req.user.regNo"></AboutStudent>
<button @click="profile=!profile" style="margin-left: 17%;margin-top: 3%">{{ i18n("backtoreq") }}</button>
</div>
<div>
<button v-if="profile===false" @click="windowState = 0" style="margin-left: 31%">{{ i18n("courses.back") }}</button>
</div>
</template>
<style scoped>
.container{
min-width:675px;
display:grid;
grid-template-columns:10vw 50vw;
grid-template-rows:200px auto;
column-gap:2.7%;
row-gap:45px;
grid-template-areas:
"profilPic globalInfos"
"minfos minfos";
}
.profilPic{
width:100%;
grid-area:profilPic;
}
.globalInfos {
grid-area:globalInfos;
align-self :center;
}
.body {
min-width:960px;
width:100%;
display:flex;
align-items:center;
justify-content:center;
margin-top:7%;
}
.subContainter{
width:100%;
background-color:rgb(50,50,50);
border-radius:20px;
border:4px solid black;
}
.infosContainer {
min-width:350px;
padding-bottom:50px;
border:2px solid black;
font-size:25px;
color:white;
padding:20px;
background-color:rgb(50,50,50);
border-radius:20px;
}
button{
border:none;
background-color:rgb(239, 60, 168);
border-radius:10px;
height:35px;
margin-top:10px;
}
</style>

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {getSelf, getUser} from '../../rest/Users.js' import {getSelf, getUser} from '../../rest/Users.js'
import {getcurriculum,getSomeonesCurriculumList} from "@/rest/curriculum.js"; import {getcurriculum} from "@/rest/curriculum.js";
import {getRegisters} from "@/rest/ServiceInscription.js"; import {getRegisters} from "@/rest/ServiceInscription.js";
import {get} from "jsdom/lib/jsdom/named-properties-tracker.js"; import {get} from "jsdom/lib/jsdom/named-properties-tracker.js";
import {getExternalCurriculumByInscrReq} from "@/rest/externalCurriculum.js"; import {getExternalCurriculumByInscrReq} from "@/rest/externalCurriculum.js";
@ -16,6 +16,8 @@ const user = await getSelf();
const list = ref(false); const list = ref(false);
const externalCurriculum = await getExternalCurriculumByInscrReq(request.id) const externalCurriculum = await getExternalCurriculumByInscrReq(request.id)
//Get the parent page windowState to display the correct button
const windowState = defineModel("windowState")
function getPP(){ function getPP(){
if(request.profilePictureUrl === null){ if(request.profilePictureUrl === null){
return "/Clyde.png" return "/Clyde.png"
@ -29,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()>
@ -37,36 +39,43 @@ async function editEquivalence(id, newstate){
<div class = "globalInfos"> <div class = "globalInfos">
<div class="infosContainer"> <div class="infosContainer">
<div> <div>
FirstName/Name : {{request.firstName}} {{request.lastName}} {{ i18n("firstname/name") }} : {{request.firstName}} {{request.lastName}}
</div> </div>
<div> <div>
E-mail: {{request.email}} {{ i18n("login.guest.email") }}: {{request.email}}
</div> </div>
<div> <div>
Adresse : {{request.address}} {{ i18n("login.guest.address") }} : {{request.address}}
</div> </div>
<div> <div>
Pays : {{request.country}} {{ i18n("login.guest.country") }} : {{request.country}}
</div> </div>
<div> <div>
Date de naissance : {{request.birthDate}} {{ i18n("login.guest.birthday") }} : {{request.birthDate}}
</div> </div>
<div> <div>
Cursus voulu : BAB {{cursus.year}} {{cursus.option}} {{ i18n("WantedCursus") }} : BAB {{cursus.year}} {{cursus.option}}
</div>
<div style="margin-top: 3%">
<a :href="request.identityCard">{{ i18n("dlidentitycard") }}</a>
<button v-if="request.admissionDocUrl != null">{{ i18n("dladmissiondoc") }}</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')">{{ i18n("seeextcur") }}</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="list == false" style="margin-left: 30%; margin-top: 5%">
<button @click="windowState = 0">{{ i18n("courses.back") }}</button>
</div>
<div v-if="list==true"> <div v-if="list==true">
<ExternalCurriculumList :ext-curr-list="externalCurriculum" :inscr-req-id="request.id"></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'">{{i18n("acceptequiv")}}</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'">{{i18n("refuseequiv")}}</button>
<button style="margin-left: 2%" @click="list=false">Return to profile</button> <button style="margin-left: 2%" @click="list=false">Back</button>
</div> </div>
</div> </div>
</template> </template>
@ -123,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

@ -39,31 +39,31 @@ async function uploadandrefreshScholarshipRequest(){
<div class="globalInfos"> <div class="globalInfos">
<div class="infosContainer"> <div class="infosContainer">
<div> <div>
Firstname/Name : {{user.firstName}} {{user.lastName}} {{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
</div> </div>
<div> <div>
E-mail: {{user.email}} {{ i18n("login.guest.email") }}: {{user.email}}
</div> </div>
<div> <div>
Adresse : {{user.address}} {{ i18n("login.guest.address") }} : {{user.address}}
</div> </div>
<div> <div>
Country : {{user.country}} {{ i18n("login.guest.country") }} : {{user.country}}
</div> </div>
<div> <div>
Birthdate : {{user.birthDate.slice(0,10)}} {{ i18n("login.guest.birthday") }} : {{user.birthDate.slice(0,10)}}
</div> </div>
<div> <div>
<button>Download tax justif document</button> <button @click="">{{ i18n("dltaxdoc") }}</button>
<button style="margin-left: 2%">Download residency justif document</button> <button style="margin-left: 2%">{{ i18n("dlresidency") }}</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 : {{i18n("enteramount")}}
<input type="number" v-model="scholarshipData.amount"> <input type="number" v-model="scholarshipData.amount">
</div> </div>
<div> <div>
<button v-if="req.state === 'Pending'" @click="scholarshipData.state='Accepted';uploadandrefreshScholarshipRequest()">Accept</button> <button v-if="req.state === 'Pending'" @click="scholarshipData.state='Accepted';uploadandrefreshScholarshipRequest()">{{i18n("request.accept")}}</button>
<button v-if="req.state === 'Pending'" @click="scholarshipData.state='Refused';uploadandrefreshScholarshipRequest()" style="margin-left: 2%;">Refuse</button> <button v-if="req.state === 'Pending'" @click="scholarshipData.state='Refused';uploadandrefreshScholarshipRequest()" style="margin-left: 2%;">{{i18n("request.refuse")}}</button>
</div> </div>
</div> </div>
</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

@ -1,10 +1,11 @@
<script setup> <script setup>
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {getUser} from '../../rest/Users.js' import {getSelf, getUser} from '../../rest/Users.js'
import {getSomeonesCurriculumList} from "@/rest/curriculum.js"; import {getSomeonesCurriculumList} from "@/rest/curriculum.js";
import {ref} from "vue"; import {ref} from "vue";
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue"; import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js"; import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
import {getUserActualCourses} from "@/rest/courses.js";
const props = defineProps(['target']) const props = defineProps(['target'])
const user = await getUser(props.target) const user = await getUser(props.target)
@ -12,6 +13,10 @@
const externalcurrlist = await getExternalCurriculumByUser(user.regNo) const externalcurrlist = await getExternalCurriculumByUser(user.regNo)
const extercurrlist = ref(false) const extercurrlist = ref(false)
const courselist = await getUserActualCourses(user.regNo)
console.log(courselist)
const watchingUser = await getSelf()
function getPP(){ function getPP(){
if(user.profilePictureUrl === null){ if(user.profilePictureUrl === null){
return "/Clyde.png" return "/Clyde.png"
@ -40,47 +45,50 @@
<div class = "globalInfos"> <div class = "globalInfos">
<div class="infosContainer"> <div class="infosContainer">
<div> <div>
FirstName/Name : {{user.firstName}} {{user.lastName}} {{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
</div> </div>
<div> <div>
E-mail: {{user.email}} {{ i18n("login.guest.email") }}: {{user.email}}
</div> </div>
<div> <div>
Adresse : {{user.address}} {{ i18n("login.guest.address") }} : {{user.address}}
</div> </div>
<div> <div>
Pays : {{user.country}} {{ i18n("login.guest.country") }} : {{user.country}}
</div> </div>
<div> <div>
Date de naissance : {{user.birthDate}} {{ i18n("login.guest.birthday") }} : {{user.birthDate}}
</div> </div>
<div> <div>
<button @click="extercurrlist=!extercurrlist">See external curriculums</button> <button v-if="watchingUser.role === 'Admin' || watchingUser.role === 'InscriptionService' || watchingUser.role === 'Secretary' || watchingUser.regNo === user.regNo">{{i18n("dlidentitycard")}}</button>
</div>
<div>
<button @click="extercurrlist=!extercurrlist">{{i18n("seeextcur")}}</button>
</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 {{ i18n("oldcursus") }}
</div> </div>
<div class="listElement"> <div class="listElement">
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList"> <div class=" containerElement" v-for="item in UserCurriculum.curriculumList">
<div class="year" v-if="item.actual === false">Bac {{item.year}}</div> <div class="year" v-if="item.actual === false">Bac {{item.year}}</div>
<div class="option" v-if="item.actual === false">{{item.option}}</div> <div class="option" v-if="item.actual === false">{{item.option}}</div>
<div class="dateyear" v-if="item.actual === false">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === false">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
<div class="newcursus"> <div class="newcursus">
<div class="listTitle"> <div class="listTitle">
Cursus Actuel {{ i18n("newcursus") }}
</div> </div>
<div class="listElement"> <div class="listElement">
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList" > <div class=" containerElement" v-for="item in UserCurriculum.curriculumList" >
<div class="year" v-if="item.actual === true">Bac {{item.year}}</div> <div class="year" v-if="item.actual === true">Bac {{item.year}}</div>
<div class="option" v-if="item.actual === true">{{item.option}}</div> <div class="option" v-if="item.actual === true">{{item.option}}</div>
<div class="dateyear" v-if="item.actual === true">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === true">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -94,6 +102,7 @@
<style scoped> <style scoped>
.container{ .container{
min-width:675px; min-width:675px;
display:grid; display:grid;
@ -102,8 +111,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{
@ -143,12 +151,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;
@ -189,4 +195,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

@ -34,21 +34,21 @@ async function uploadandrefreshUnregRequest(state){
<div class="globalInfos"> <div class="globalInfos">
<div class="infosContainer"> <div class="infosContainer">
<div> <div>
Firstname/Name : {{req.firstName}} {{req.lastName}} {{ i18n("firstname/name") }} : {{req.firstName}} {{req.lastName}}
</div> </div>
<div> <div>
E-mail: {{req.email}} {{ i18n("login.guest.email") }}: {{req.email}}
</div> </div>
<div> <div>
regNo : {{req.regNo}} {{ i18n("regNo") }} : {{req.regNo}}
</div> </div>
<div> <div>
Reason : {{ i18n("reason") }}
<input type="text" v-model="req.reason" readonly/> <input type="text" v-model="req.reason" readonly/>
</div> </div>
<div> <div>
<button v-if="req.state === 'Pending'" @click="req.state='Accepted';uploadandrefreshUnregRequest('Accepted')">Accept</button> <button v-if="req.state === 'Pending'" @click="req.state='Accepted';uploadandrefreshUnregRequest('Accepted')">{{i18n("request.accept")}}</button>
<button v-if="req.state === 'Pending'" @click="req.state='Refused';uploadandrefreshUnregRequest('Refused')" style="margin-left: 2%;">Refuse</button> <button v-if="req.state === 'Pending'" @click="req.state='Refused';uploadandrefreshUnregRequest('Refused')" style="margin-left: 2%;">{{i18n("request.refuse")}}</button>
</div> </div>
</div> </div>
</div> </div>

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)
@ -30,11 +33,20 @@ const exemptReq = reactive({
courseId : null, courseId : null,
justifDocument : "", justifDocument : "",
}) })
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>
<template style="margin-top:5%;"> <template style="margin-top:5%;">
<div v-if="list == true"> <div v-if="list == true">
<span>Selected Cursus : </span> <span>{{i18n("selectedcursus")}} : </span>
<select v-model="selectedCurriculum" @change="updateCourseList"> <select v-model="selectedCurriculum" @change="updateCourseList">
<option v-for="item in props.cursuslist" :value="item">Bac {{item.year}} {{item.option}}</option> <option v-for="item in props.cursuslist" :value="item">Bac {{item.year}} {{item.option}}</option>
</select> </select>
@ -45,20 +57,29 @@ const exemptReq = reactive({
<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">{{i18n("askexemp")}}</button></div>
<div v-else class="askexemption" style="font-size: 50%">{{ i18n("exemp") }}</div>
</div> </div>
</div> </div>
</div> </div>
<div>
<button @click="windowState = 0">{{ i18n("courses.back")}}</button>
</div> </div>
<div v-else> </div>
<p>Please upload the justification document for the exemption </p> <div v-if="list === false" class="infosContainer">
<p>{{ i18n("uploadjustifdoc") }} </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>
Submit exemption request <button style="margin-top: 3%" @click="postExemptionRequest(ppData.value, 'JustificationDocument');">
{{ i18n("subexemreq") }}
</button> </button>
</div> </div>
<div v-if="list === false">
<button @click="list=!list">{{ i18n("courses.back") }}</button>
</div>
</template> </template>
<style scoped> <style scoped>
@ -135,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

@ -3,16 +3,25 @@
import {reactive, ref} from "vue"; import {reactive, ref} from "vue";
import {getSelf} from "@/rest/Users.js"; import {getSelf} from "@/rest/Users.js";
import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.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 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 list = ref(true)
const editmode = ref(false)
const notcompletedCheck = ref(false); const notcompletedCheck = ref(false);
const externalCurr = reactive({ const externalCurr = reactive({
@ -28,29 +37,58 @@
if (props.mode === 1){ if (props.mode === 1){
externalCurr.userRegNo = props.extCurrList[0].user.regNo 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(){ async function postExternalCurr(){
await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo); 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 //We refresh the list
extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
list.value = !list.value; 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;
}
} }
</script> </script>
<template style="margin-top:5%;"> <template style="margin-top:5%;">
<div v-if="list"> <div v-if="list">
<div v-if="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%;">{{ i18n("addextcurr") }}</button>
</div> </div>
<div style="display:flex; justify-content:center; " v-for="item 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>
<div class="school"><a>{{item.school}}</a></div> <div class="school"><a>{{item.school}}</a></div>
<div class="formation"><a>{{item.formation}}</a></div> <div class="formation"><a>{{item.formation}}</a></div>
<div class="completion"><a>{{item.completion}}</a></div> <div class="completion"><a>{{item.completion}}</a></div>
<div class="download"><button>Download document</button></div> <div class="download"><button>{{ i18n("dldoc") }}</button></div>
<div class="edit" v-if="props.mode === 2"><button @click="list=!list;externalCurr.justifdocUrl=item.justifDocUrl; externalCurr.endYear = item.endYear; externalCurr.startYear = item.startYear; externalCurr.school = item.school;externalCurr.completion = item.completion;externalCurr.formation=item.formation;editmode=!editmode;extNum=index">{{i18n("edit")}}</button></div>
<div class="delete" v-if="props.mode === 2"><button @click="deleteExtCursus(item)">{{ i18n("delete") }}</button></div>
</div> </div>
</div> </div>
</div> </div>
@ -58,7 +96,7 @@
<div v-else class="loginbox" style="margin-left: 35%; margin-top: 3%"> <div v-else class="loginbox" style="margin-left: 35%; margin-top: 3%">
<form class="form"> <form class="form">
<div class="inputBox"> <div class="inputBox">
<p>Ecole</p> <p>{{ i18n("school") }}</p>
<input type="text" v-model="externalCurr.school"> <input type="text" v-model="externalCurr.school">
</div> </div>
<div class="inputBox"> <div class="inputBox">
@ -66,23 +104,28 @@
<input type="text" v-model="externalCurr.formation"> <input type="text" v-model="externalCurr.formation">
</div> </div>
<div class="inputBox"> <div class="inputBox">
<p>Cochez la case si vous n'avez terminé cette formation</p> <p>{{i18n("checkifnotcompleted")}}</p>
<input v-model="notcompletedCheck" type="checkbox" id="checkboxformation"> <input v-model="notcompletedCheck" type="checkbox" id="checkboxformation">
<div v-if="notcompletedCheck"> <div v-if="notcompletedCheck">
<p>En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?</p> <p>{{i18n("wichyearstop")}}</p>
<input type="text" v-model="externalCurr.completion"> <input type="text" v-model="externalCurr.completion">
</div> </div>
</div> </div>
<div class="inputBox"> <div class="inputBox">
<p>Année de début</p> <p>{{ i18n("startyear") }}</p>
<input type="number" v-model="externalCurr.startYear"> <input type="number" v-model="externalCurr.startYear">
</div> </div>
<div class="inputBox"> <div class="inputBox">
<p>Année de fin</p> <p>{{ i18n("endyear") }}</p>
<input type="number" v-model="externalCurr.endYear"> <input type="number" v-model="externalCurr.endYear">
</div> </div>
<div class="inputBox">
<p>{{i18n("giveextcurdoc")}}</p>
<input type="file" @change="externalCurr.justifdocUrl = $event.target.files">
</div>
<div class="inputBox" style="margin-top: 3%; margin-bottom: 3%"> <div class="inputBox" style="margin-top: 3%; margin-bottom: 3%">
<input type="submit" value="Upload curriculum" @click="postExternalCurr()"> <input v-if="!editmode" type="submit" value="upload" @click="postExternalCurr()">
<input v-else type="submit" value="edit" @click="externalCurrTab[extNum] = {inscriptionRequestId : externalCurr.inscriptionRequestId,school:externalCurr.school,formation :externalCurr.formation,completion : externalCurr.completion,startYear : externalCurr.startYear,endYear: externalCurr.endYear,justifdocUrl : externalCurr.justifdocUrl,userRegNo : externalCurr.userRegNo};editmode=!editmode;list=!list">
</div> </div>
</form> </form>
</div> </div>
@ -94,9 +137,9 @@
height:100px; height:100px;
font-size:30px; font-size:30px;
display:grid; display:grid;
grid-template-columns:15% 10% 20% 15% 13.1%; grid-template-columns:5% 10% 20% 15% 20% 10%;
grid-template-areas: grid-template-areas:
"status school formation completion download"; "status school formation completion download edit delete";
column-gap:10px; column-gap:10px;
} }
@ -106,6 +149,15 @@
font-size: 70%; font-size: 70%;
} }
.edit{
grid-area: edit;
align-self: center;
}
.delete{
grid-area: delete;
align-self: center;
}
.school{ .school{
grid-area:school; grid-area:school;
align-self:center; align-self:center;
@ -177,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} 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 {
@ -12,15 +12,17 @@
import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue"; import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue";
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 {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");
//0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister, 5 = manage curriculum change //0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister, 5 = manage curriculum change, 6 = manage exemptions
let windowsState = ref(0); const windowsState = ref(0);
async function upPage(id,review){ async function upPage(id,review){
await validateRegister(id,review); await validateRegister(id,review);
@ -30,42 +32,49 @@
async function loadRequests(){ async function loadRequests(){
switch (requestType.value){ switch (requestType.value){
case "inscription": case i18n("inscription"):
requests.value = await getAllRegisters(); requests.value = await getAllRegisters();
break; break;
case "scholarship": case i18n("scholarship"):
requests.value = await getAllScholarShipsRequest(); requests.value = await getAllScholarShipsRequest();
break; break;
case "exemption": case i18n("exemption"):
requests.value = await getAllExemptionsRequest(); requests.value = await getAllExemptionsRequest();
break; break;
case "unregister": case i18n("unregister"):
requests.value = await getAllUnregisters(); requests.value = await getAllUnregisters();
break; break;
case "curriculum change": case i18n("curriculumch"):
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>
<template> <template>
<div v-if="windowsState === 1"> <div v-if="windowsState === 1">
<AboutRequest :target="targetId"></AboutRequest> <AboutRequest :target="targetId" v-model:window-state="windowsState"></AboutRequest>
</div> </div>
<div v-if="windowsState === 0"> <div v-if="windowsState === 0">
<div style="margin-top: 2%;margin-left: 2%"> <div style="margin-top: 2%;margin-left: 2%">
<span>Request type : </span> <span>{{ i18n("reqtype") }} : </span>
<select v-model="requestType" @change="loadRequests()"> <select v-model="requestType" @change="loadRequests()">
<option>inscription</option> <option>{{ i18n("inscription") }}</option>
<option>scholarship</option> <option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">{{ i18n("scholarship") }}</option>
<option>exemption</option> <option v-if="user.role === 'Admin' || user.role === 'Teacher'">{{ i18n("exemption") }}</option>
<option>unregister</option> <option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">{{ i18n("unregister") }}</option>
<option>curriculum change</option> <option>{{ i18n("curriculumch") }}</option>
</select> </select>
<span style="margin-left: 5%"> <span style="margin-left: 5%">
Filter : {{ i18n("filter") }}
<select v-model="filterType"> <select v-model="filterType">
<option>None</option> <option>None</option>
<option>Pending</option> <option>Pending</option>
@ -75,71 +84,73 @@
</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 !== i18n('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 === i18n('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%">{{ i18n("approval") }} {{item.state}}</div>
<div class="equivalencestate" style="font-size: 80%">Teacher approval : {{item.equivalenceState}}</div> <div class="equivalencestate" style="font-size: 80%">{{ i18n("teacherapproval") }} {{item.equivalenceState}}</div>
<div class="surname">{{item.lastName}}</div> <div class="surname">{{item.lastName}}</div>
<div class="firstname">{{item.firstName}}</div> <div class="firstname">{{item.firstName}}</div>
<div class="accept" v-if="item.state === 'Pending'"><button @click="windowsState=2;targetId=item.id;" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div> <div class="accept" v-if="item.state === 'Pending'"><button @click="windowsState=2;targetId=item.id;" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
<div class="refuse" v-if="item.state === 'Pending'"><button @click="upPage(item.id,'Refused')" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div> <div class="refuse" v-if="item.state === 'Pending'"><button @click="upPage(item.id,'Refused')" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
<div class="infos"><button style="background-color:rgb(105,05,105);" @click="targetId=item.id;windowsState=1;">{{i18n("request.moreInfos")}}</button></div> <div class="infos"><button style="background-color:rgb(105,05,105);" @click="targetId=item.id;windowsState=1;">{{i18n("request.moreInfos")}}</button></div>
</div> </div>
<div class="container" style="grid-template-columns:25% 15% 15% 25% 14.2%;grid-template-areas:'date reqState studentfirstname studentlastname infos';" v-if="requestType === 'scholarship'"> <div class="container" style="grid-template-columns:25% 15% 15% 25% 14.2%;grid-template-areas:'date reqState studentfirstname studentlastname infos';" v-if="requestType === i18n('scholarship')">
<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.user.firstName}}</div> <div class="studentfirstname">{{item.user.firstName}}</div>
<div class="studentlastname">{{item.user.lastName}}</div> <div class="studentlastname">{{item.user.lastName}}</div>
<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>{{ i18n("request.moreInfos") }}</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="container" v-if="requestType === i18n('unregister')" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.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>More infos</button></div>
</div>
<div class="container" v-if="requestType === 'unregister'" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div> <div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.firstName}}</div> <div class="studentfirstname">{{item.firstName}}</div>
<div class="studentlastname">{{item.lastName}}</div> <div class="studentlastname">{{item.lastName}}</div>
<div class="regno">id : {{item.regNo}}</div> <div class="regno">id : {{item.regNo}}</div>
<div class="reqState">{{item.state}}</div> <div class="reqState">{{item.state}}</div>
<div class="infos"><button @click="windowsState=4;targetId=item.id">More infos</button></div> <div class="infos"><button @click="windowsState=4;targetId=item.id">{{ i18n("request.moreInfos") }}</button></div>
</div> </div>
<div class="container" v-if="requestType === 'curriculum change'" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';"> <div class="container" v-if="requestType === i18n('curriculumch')" style="grid-template-columns:17% 20% 15% 5%;grid-template-areas:'date reqState teacherApproval 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.user.firstName}}</div> <div class="studentfirstname">{{item.user.firstName}}</div>
<div class="studentlastname">{{item.user.lastName}}</div> <div class="studentlastname">{{item.user.lastName}}</div>
<div class="reqState">{{ i18n("approval")}}{{item.state}}</div>
<div class="teacherApproval">{{ i18n("teacherapproval") }} : {{item.teacherApprovalState}}</div>
<div class="infos"><button @click="windowsState=5;targetId=item.id">{{ i18n("request.moreInfos") }}</button></div>
</div>
</div>
<div class="bodu" v-if="(filterType == 'None' || filterType == item.state) && requestType === i18n('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="reqState">{{item.state}}</div>
<div class="infos"><button @click="windowsState=5;targetId=item.id">More infos</button></div> <div class="infos"><button @click="windowsState=6;targetId=item.id">{{ i18n("request.moreInfos") }}</button></div>
</div> </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">
<p>Etes vous sur de vouloir accepter cette demande ?</p> <p>{{ i18n("surreq") }}</p>
<button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">Valider</button> <button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">{{ i18n("validate") }}</button>
<button style="background-color:rgb(105,05,105);" @click="windowsState=0;">Retour</button> <button style="background-color:rgb(105,05,105);" @click="windowsState=0;">{{ i18n("courses.back")}}</button>
</div> </div>
<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">{{ i18n("courses.back")}}</button>
</div> </div>
</div> </div>
<div v-if="windowsState === 4"> <div v-if="windowsState === 4">
<AboutUnregister :req-id="targetId"></AboutUnregister> <AboutUnregister :req-id="targetId"></AboutUnregister>
<button @click="windowsState=0" style="margin-left: 31%">{{ i18n("courses.back")}}</button>
</div> </div>
<div v-if="windowsState === 5"> <div v-if="windowsState === 5">
<AboutChangeCurriculum :req-id="targetId"></AboutChangeCurriculum> <AboutChangeCurriculum :req-id="targetId" v-model:window-state="windowsState"></AboutChangeCurriculum>
</div>
<div v-if="windowsState === 6">
<AboutExemption :req-id="targetId" v-model:window-state="windowsState"></AboutExemption>
</div> </div>
</template> </template>
@ -156,6 +167,11 @@
grid-area: equivalencestate; grid-area: equivalencestate;
align-self: center; align-self: center;
} }
.teacherApproval{
grid-area: teacherApproval;
align-self: center;
}
.studentfirstname{ .studentfirstname{
grid-area: studentfirstname; grid-area: studentfirstname;
align-self: center; align-self: center;
@ -222,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,15 +4,16 @@ 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%;">
<div style="display:flex; justify-content:center; " v-for="item in paymentsList"> <div style="display:flex; justify-content:center; " v-for="item in paymentsList">
<div class="bodu"> <div class="bodu">
<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">{{ i18n("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>{{ i18n("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

@ -3,10 +3,11 @@
import i18n from '@/i18n.js' import i18n from '@/i18n.js'
import {login, register, disconnect, isLogged} from '@/rest/Users.js' import {login, register, disconnect, isLogged} from '@/rest/Users.js'
import {getAllCurriculums, getcurriculum} from '@/rest/curriculum.js' import {getAllCurriculums, getcurriculum} from '@/rest/curriculum.js'
import { uploadProfilePicture } from '@/rest/uploads.js' import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js'
import {toast} from 'vue3-toastify' import {toast} from 'vue3-toastify'
import 'vue3-toastify/dist/index.css'; import 'vue3-toastify/dist/index.css';
import {createExternalCurriculum} from "@/rest/externalCurriculum.js"; import {createExternalCurriculum} from "@/rest/externalCurriculum.js";
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
const loginPage= ref(true) const loginPage= ref(true)
const page = ref(0) const page = ref(0)
@ -23,18 +24,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([]);
@ -44,8 +33,8 @@
const imageSaved = ref(false) const imageSaved = ref(false)
let ppData = "" let ppData = ""
//Contains the id of the newly created request (useful to link the student's formations informations to the request) const idcardfile = ref({})
let requestId = "" const justifcardfile = ref({})
const curricula= await getAllCurriculums(); const curricula= await getAllCurriculums();
@ -85,21 +74,33 @@
//Post the register request and return the id of the newly created request and also post the external curriculum list in the database //Post the register request and return the id of the newly created request and also post the external curriculum list in the database
async function postRegisterReq(){ async function postRegisterReq(){
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, null, new Date(), outputs.equivalenceState); //We upload the two files and we get their paths on the server
const identityCardFile = await uploadFile(idcardfile.value, "IdentityCard")
const justifFile = ref(null)
if (curricula[outputs.curriculum-1].requireCertificate){
justifFile.value = await uploadFile(justifcardfile.value, "JustificationDocument")
}
let justif;
if (justifFile.value !== null){
justif = justifFile.value.url
}else{
justif = null
}
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, identityCardFile.url, new Date(), outputs.equivalenceState, justif);
for (let item in externalCurrTab.value){ for (let item in externalCurrTab.value){
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, externalCurrTab.value[item].justifdocUrl); 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.url);
} }
} }
function deleteExtCursus(extcursus){
externalCurrTab.value.splice(externalCurrTab.value.indexOf(extcursus),1)
}
</script> </script>
<template> <template>
<div class="setup"> <div class="setup" v-if="page !== 4">
<div v-if="loginPage"> <div v-if="loginPage">
<div class='loginBox' style="margin-top:30%;"> <div class='loginBox' style="margin-top:30%;">
<form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form"> <form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form">
@ -118,7 +119,7 @@
<a @click="loginPage=!loginPage">{{i18n("login.guest.register")}}</a> <a @click="loginPage=!loginPage">{{i18n("login.guest.register")}}</a>
</div> </div>
<div class="inputBox" style="margin-bottom:35px;"> <div class="inputBox" style="margin-bottom:35px;">
<input type="submit" v-model="submitValue"> <input v-model="submitValue" type="submit">
</div> </div>
</form> </form>
</div> </div>
@ -176,11 +177,10 @@
<p>{{i18n("profile.picture").toUpperCase()}}</p> <p>{{i18n("profile.picture").toUpperCase()}}</p>
</form> </form>
<label class="browser"> <label class="browser">
Parcourir . . . {{i18n("login.guest.browse")}}
<input type="file" :disabled="imageSaved" @change="ppData = uploadProfilePicture($event.target.files); imageSaved = true;" accept="image/*"> <input type="file" :disabled="imageSaved" @change="ppData = uploadProfilePicture($event.target.files); imageSaved = true;" accept="image/*">
</label> </label>
<form novalidate enctype="multipart/form-data" class="inputBox"> <form novalidate enctype="multipart/form-data" class="inputBox">
<p>{{i18n("profile.picture").toUpperCase()}}</p>
<input type="file" @change="uploadPP($event.target.files); imageSaved = true;" accept="image/*"> <input type="file" @change="uploadPP($event.target.files); imageSaved = true;" accept="image/*">
</form> </form>
<div class="inputBox"> <div class="inputBox">
@ -190,8 +190,7 @@
</select> </select>
</div> </div>
<p style="color:rgb(239,60,168);"> <p style="color:rgb(239,60,168);">
Si vous êtes déja inscrits dans cette université veuillez vous connecter a votre compte et utilisez les fonctions {{i18n("login.guest.disclaimer")}}
changer de cursus/réinscription sinon continuez ici.
</p> </p>
<div style="align-self:center;" class="inputBox"> <div style="align-self:center;" class="inputBox">
<button style="margin-top:25px;" @click="page++;"> <button style="margin-top:25px;" @click="page++;">
@ -206,67 +205,38 @@
</div> </div>
</div> </div>
<div v-if="page === 2"> <div v-if="page === 2">
<form novalidate enctype="multipart/form-data" class="inputBox"> <p style="color:rgb(239,60,168);">{{i18n("login.guest.identityCard")}}</p>
Carte d'identité : <label class="browser">
</form> {{i18n("login.guest.browse")}}
<button @click="page++">{{i18n("login.guest.nextpage")}}</button> <input type="file" @change="idcardfile = $event.target.files">
</label>
<div v-if="curricula[outputs.curriculum-1].requireCertificate === true" style="margin-top: 3%; margin-bottom: 4%">
<p style="color:rgb(239,60,168);">{{ i18n("login.guest.attestationdisclaimer") }}</p>
<div style="margin-top: 2%">
<p style="color:rgb(239,60,168);">Attestation:</p>
<label class="browser">
{{i18n("login.guest.browse")}}
<input type="file" @change="justifcardfile = $event.target.files">
</label>
</div>
</div>
<button @click="page++;" style="margin-top: 10%">{{i18n("login.guest.nextpage")}}</button>
</div> </div>
<div v-if="page === 3"> <div v-if="page === 3">
<p> <p style="color:rgb(239,60,168);margin-bottom: 5%">
Vous avez séléctionné un cursus qui possède des prérequis veuillez ajouter vos formations antérieures {{i18n("login.guest.formationdisclaimer")}}
dans l'enseignement supérieur, votre dossier sera vérifié par un membre du service d'inscription.
</p> </p>
<button @click="page++">Ajouter une formation</button> <button @click="page++">{{i18n("login.guest.managecareer")}}</button>
<button @click="postRegisterReq();">Envoyer la demande d'inscription</button> <button @click="postRegisterReq();">{{ i18n("login.guest.sendRegReq") }}</button>
</div>
</form>
</div>
</div>
</div> </div>
<div v-if="page===4"> <div v-if="page===4">
<form @submit.prevent=""class="form"> <ExternalCurriculumList v-model="externalCurrTab" :mode="2"></ExternalCurriculumList>
<div class="inputBox"> <button style="margin-top: 2%;width: 5%; margin-left: 2%" @click="page--">{{i18n("courses.back")}}</button>
<p>Ecole</p>
<input type="text" v-model="externalCurr.school">
</div>
<div class="inputBox">
<p>Formation</p>
<input type="text" v-model="externalCurr.formation">
</div>
<div class="inputBox">
<p>Cochez la case si vous n'avez terminé cette formation</p>
<input v-model="notcompletedCheck" type="checkbox" id="checkboxformation">
<div v-if="notcompletedCheck">
<p>En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?</p>
<input type="text" v-model="externalCurr.completion">
</div>
</div>
<div class="inputBox">
<p>Année de début</p>
<input type="text" v-model="externalCurr.startYear">
</div>
<div class="inputBox">
<p>Année de fin</p>
<input type="text" v-model="externalCurr.endYear">
</div>
<div class="inputBox" style="margin-bottom:35px;">
<input type="submit" v-model="submitValue" @click="externalCurrTab.push({inscriptionReqId:null, school:externalCurr.school, formation:externalCurr.formation, completion:externalCurr.completion, startYear:externalCurr.startYear, endYear:externalCurr.endYear, justifdocUrl:externalCurr.justifdocUrl});console.log(externalCurrTab);page--;">
</div>
</form>
</div>
</form>
</div>
</div>
</div>
<div style="display:flex; justify-content:center; " v-for="item in externalCurrTab" v-if="page===3">
<div class="bodu">
<div class="container">
<div class="school"><a style="margin-left:30px;">{{item.school}}</a></div>
<div class="formation"><a>{{item.formation}}</a></div>
<div class="edit">
<button style="background-color:rgb(105,05,105);font-size:15px;height:50px;width:75%;border:none;border-radius:20px;" @click="externalCurr.school=item.school; externalCurr.completion=item.completion; externalCurr.formation=item.formation;externalCurr.endYear=item.endYear; externalCurr.startYear=item.startYear; externalCurr.justifdocUrl;page++;">Edit </button>
</div>
<div class="remove">
<button style="background-color:rgb(105,05,105);font-size:15px;height:50px;width:75%;border:none;border-radius:20px;" @click="deleteExtCursus(item)">Remove </button>
</div>
</div>
</div>
</div> </div>
</template> </template>
@ -317,8 +287,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{
@ -346,8 +314,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>
@ -208,93 +208,100 @@
{{user.firstName}} {{user.lastName}} {{user.firstName}} {{user.lastName}}
</div> </div>
<div> <div>
E-mail: {{user.email}} {{ i18n("login.guest.email") }}: {{user.email}}
</div> </div>
<div v-if="user.role==='Student'"> <div v-if="user.role==='Student'">
{{user.option}} {{i18n(user.role)}} {{ i18n("regNo") }} : {{user.regNo}}
</div> </div>
<div v-else> <div v-else>
Role: {{i18n((user.role))}} {{ i18n("role") }}: {{i18n((user.role))}}
</div> </div>
<div> <div>
<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%">{{ i18n("manageextcur") }}</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">{{ i18n("managecourse") }}</button>
<button @click="windowState=5" style="margin-left: 2%">Manage minerval</button> <button @click="windowState=5" style="margin-left: 2%">{{ i18n("manageminerval") }}</button>
</div> </div>
</div> </div>
<div v-else-if="windowState === 9" class="infosContainer"> <div v-else-if="windowState === 9" class="infosContainer">
<div v-if="sure !== 2">Please enter the reason you leave</div> <div v-if="sure !== 2">{{ i18n("enterreason") }}</div>
<textarea v-if="sure !== 2" v-model="uninscriptionData.reason"></textarea> <textarea v-if="sure !== 2" v-model="uninscriptionData.reason"></textarea>
<div v-if="sure !== 2"> <div v-if="sure !== 2">
I only want to unregister from a specific cursus {{i18n("onlycursus")}}
<input type="checkbox" v-model="isChecked"> <input type="checkbox" v-model="isChecked">
</div> </div>
<div v-if="sure !== 2 && isChecked"> <div v-if="sure !== 2 && isChecked">
Please select that cursus {{ i18n("plsselectcurs") }}
<select v-model="uninscriptionData.curriculumId"> <select v-model="uninscriptionData.curriculumId">
<option v-for="item in getActualCurriculumList()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option> <option v-for="item in getActualCurriculumList()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select> </select>
</div> </div>
<div v-if="sure !== 2"> <div v-if="sure !== 2">
<button @click="sure++">Submit</button> <button @click="sure++">{{ i18n("login.guest.submit") }}</button>
</div> </div>
<div v-if="sure==1"> <div v-if="sure==1">
Are you sure that you want to unregister ? {{ i18n("sureunreg") }}
<button @click="addUninscReq(uninscriptionData.userId, uninscriptionData.reason, uninscriptionData.curriculumId);sure++">Yes</button> <button @click="addUninscReq(uninscriptionData.userId, uninscriptionData.reason, uninscriptionData.curriculumId);sure++">{{i18n("yes")}}</button>
<button @click="sure=0">No</button> <button @click="sure=0">{{ i18n("no") }}</button>
</div> </div>
<p v-if="sure==2">You request has been send !</p> <p v-if="sure==2">{{ i18n("reqsend") }}</p>
</div>
<div v-if="windowState === 9">
<button @click="windowState=0">{{i18n("courses.back")}}</button>
</div> </div>
<div v-else-if="windowState === 5" class="infosContainer"> <div v-else-if="windowState === 5" class="infosContainer">
<div v-if="minerv.value.toPay !== 0"> <div v-if="minerv.value.toPay !== 0">
Payment : {{minerv.value.toPay}} left to pay {{ i18n("payment") }} : {{minerv.value.toPay}} {{ i18n("lefttopay") }}
<div v-if="minerv.value.paidAmount <= 50"> <div v-if="minerv.value.paidAmount <= 50">
<button @click="windowState=6; paymentAmount = 50">Pay deposit (50)</button> <button @click="windowState=6; paymentAmount = 50">{{ i18n("paydeposit") }} (50)</button>
</div> </div>
<div> <div>
<button @click="windowState=6; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}})</button> <button @click="windowState=6; paymentAmount = minerv.value.toPay">{{ i18n("payrest") }} ({{minerv.value.toPay}})</button>
</div> </div>
</div> </div>
<div v-else> <div v-else>
Payment : School fees have already been paid this year {{ i18n("alreadypaid") }}
</div> </div>
<div> <div>
<button @click="windowState=7">Ask for a scholarship</button> <button @click="windowState=7">{{ i18n("askscholarship") }}</button>
</div> </div>
</div> </div>
<div v-if="windowState === 5">
<button @click="windowState=0">{{ i18n("courses.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>{{i18n("uploaddocs")}}</p>
<div> <div>
Tax justification document : {{ i18n("taxjustdoc") }}
<input type="file" @change="scholarshipData.taxDocUrl = $event.target.files"> <input type="file" @change="scholarshipData.taxDocUrl = $event.target.files">
</div> </div>
<div> <div>
Residency justification document : {{i18n("residencydoc")}}
<input type="file" style="margin-top:2%" @change="scholarshipData.residencyDocUrl = $event.target.files"> <input type="file" style="margin-top:2%" @change="scholarshipData.residencyDocUrl = $event.target.files">
</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');">{{i18n("login.guest.submit")}}</button>
</div>
<div v-if="windowState === 7">
<button @click="windowState = 5">{{ i18n("courses.back") }}</button>
</div> </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 {{i18n("reqsent")}}
the request is reviewed.
</div> </div>
<button @click="windowState = 0"> <button @click="windowState = 0">
Go back to profile {{ i18n("backprofile") }}
</button> </button>
</div> </div>
<div v-else-if="windowState === 6" class="infosContainer"> <div v-else-if="windowState === 6" class="infosContainer">
Proceed to payment of {{paymentAmount}} {{ i18n("procpayment") }} {{paymentAmount}}
<div style="margin-top: 1%"> <div style="margin-top: 1%">
Client: Client:
<input type="text" v-model="paymentData.client"> <input type="text" v-model="paymentData.client">
@ -308,10 +315,10 @@
<input type="date" v-model="paymentData.expDate"> <input type="date" v-model="paymentData.expDate">
</div> </div>
<div style="margin-top: 1%"> <div style="margin-top: 1%">
<button @click="windowState=5;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">Process Payment</button> <button @click="windowState=5;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">{{i18n("procpaybutton")}}</button>
</div> </div>
<div> <div>
<button @click="windowState = 5">Back</button> <button @click="windowState = 5">{{ i18n("courses.back") }}</button>
</div> </div>
</div> </div>
<div v-else-if="windowState === 1" class="infosContainer"> <div v-else-if="windowState === 1" class="infosContainer">
@ -320,7 +327,7 @@
<input type="file" @change="user.profilPicture = uploadProfilePicture($event.target.files);" accept="image/*"> <input type="file" @change="user.profilPicture = uploadProfilePicture($event.target.files);" accept="image/*">
</div> </div>
<div> <div>
E-mail: {{ i18n("login.guest.email")}}
<input type="email" v-model="toModify.email" /> <input type="email" v-model="toModify.email" />
</div> </div>
<div> <div>
@ -342,11 +349,11 @@
</div> </div>
<div v-else-if="windowState === 2" class="infosContainer"> <div v-else-if="windowState === 2" class="infosContainer">
<div> <div>
I would like to : {{ i18n("iwouldlike") }}
<select v-model="reRegState"> <select v-model="reRegState">
<option :value="1">Reregister in the next year of one of my cursus</option> <option :value="1">{{ i18n("rereg") }}</option>
<option :value="2">Register for a supplementary cursus</option> <option :value="2">{{ i18n("reregsup") }}</option>
<option :value="3">Change from a cursus to another</option> <option :value="3">{{ i18n("chcur") }}</option>
</select> </select>
</div> </div>
<div style="height:40px;" v-if="reRegState === 3"> <div style="height:40px;" v-if="reRegState === 3">
@ -354,90 +361,66 @@
<select v-model="changecurrdata.actualcursus" style="margin-right: 3%"> <select v-model="changecurrdata.actualcursus" style="margin-right: 3%">
<option v-for="item in getActualCurriculumList()" style="font-size:20px;" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option> <option v-for="item in getActualCurriculumList()" style="font-size:20px;" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select> </select>
New Curriculum : {{ i18n("newcurr") }} :
<select v-model="changecurrdata.newcursus"> <select v-model="changecurrdata.newcursus">
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option> <option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select> </select>
</div> </div>
<div style="height:40px;" v-if="reRegState === 2"> <div style="height:40px;" v-if="reRegState === 2">
New Curriculum : {{ i18n("newcurr") }} :
<select v-model="changecurrdata.newcursus"> <select v-model="changecurrdata.newcursus">
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option> <option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select> </select>
</div> </div>
<div style="height:40px;" v-if="reRegState === 1"> <div style="height:40px;" v-if="reRegState === 1">
New Curriculum : {{ i18n("newcurr") }} :
<select v-model="changecurrdata.newcursus" @change="getActualCurr(changecurrdata.newcursus);"> <select v-model="changecurrdata.newcursus" @change="getActualCurr(changecurrdata.newcursus);">
<option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option> <option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select> </select>
</div> </div>
<div v-if="curricula[changecurrdata.newcursus-1].year > 1 && reRegState !== 1"> <div v-if="curricula[changecurrdata.newcursus-1].year > 1 && reRegState !== 1">
The cursus you selected has some prerequisites {{i18n("cursusprereq")}}
</div> </div>
<div> <div>
<button @click=" windowState = 0;postChangeCurrReq(changecurrdata);changecurrdata.actualcursus=null;changecurrdata.newcursus=null">{{i18n("courses.confirm")}}</button> <button @click=" windowState = 0;postChangeCurrReq(changecurrdata);changecurrdata.actualcursus=null;changecurrdata.newcursus=1">{{i18n("courses.confirm")}}</button>
<button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button> <button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
</div> </div>
</div> </div>
<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">
<div class="listTitle"> <div class="listTitle">
Anciens Cursus {{ i18n("oldcursus") }}
</div> </div>
<div class="listElement"> <div class="listElement">
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList"> <div class=" containerElement" v-for="item in UserCurriculum.curriculumList">
<div class="year" v-if="item.actual === false">Bac {{item.year}}</div> <div class="year" v-if="item.actual === false">Bac {{item.year}}</div>
<div class="option" v-if="item.actual === false">{{item.option}}</div> <div class="option" v-if="item.actual === false">{{item.option}}</div>
<div class="dateyear" v-if="item.actual === false">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === false">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
<div class="actualcursus"> <div class="actualcursus">
<div class="listTitle"> <div class="listTitle">
Cursus Actuel {{ i18n("newcurr") }}
</div> </div>
<div class="listElement"> <div class="listElement">
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList" > <div class=" containerElement" v-for="item in UserCurriculum.curriculumList" >
<div class="year" v-if="item.actual === true">Bac {{item.year}}</div> <div class="year" v-if="item.actual === true">Bac {{item.year}}</div>
<div class="option" v-if="item.actual === true">{{item.option}}</div> <div class="option" v-if="item.actual === true">{{item.option}}</div>
<div class="dateyear" v-if="item.actual === true">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === true">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</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%">{{ i18n("backprofile") }}</button>
</div> </div>
</template> </template>
<style scoped> <style scoped>
@ -548,7 +531,6 @@ button{
border-radius:10px; border-radius:10px;
height:35px; height:35px;
margin-top:10px; margin-top:10px;
} }
button:hover{ button:hover{

View File

@ -12,7 +12,7 @@
<template style="margin-top:5%;"> <template style="margin-top:5%;">
<div v-if="list === false"> <div v-if="list === false">
<AboutStudent :target=targetRegNo /> <AboutStudent :target=targetRegNo />
<button style="background-color:rgb(105,05,105);width:5%; margin-left: 10%;" @click="list = true;">Back</button> <button style="background-color:rgb(105,05,105);width:5%; margin-left: 10%;" @click="list = true;">{{ i18n("courses.back") }}</button>
</div> </div>
<div style="display:flex; justify-content:center; " v-for="item in users" v-if="list === true"> <div style="display:flex; justify-content:center; " v-for="item in users" v-if="list === true">
<div class="bodu"> <div class="bodu">

View File

@ -26,7 +26,7 @@ export function disconnect(){
* @param curriculum * @param curriculum
* @param imageId id of the image in database returned when uploaded * @param imageId id of the image in database returned when uploaded
*/ */
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate, equivalence){ export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate, equivalence,admissionDocUrl){
return restPost("/register", { return restPost("/register", {
firstName: firstname, firstName: firstname,
lastName: lastname, lastName: lastname,
@ -39,7 +39,8 @@ export async function register(firstname, lastname, birthDate, password, email,
profilePicture: imageId, profilePicture: imageId,
identityCard : identityCardId, identityCard : identityCardId,
submissionDate : submissionDate, submissionDate : submissionDate,
equivalenceState : equivalence equivalenceState : equivalence,
admissionDocUrl: admissionDocUrl
}); });
} }

View File

@ -71,3 +71,11 @@ export async function getCourses(role){
export async function alterCourse(id, changes){ export async function alterCourse(id, changes){
return restPatch("/course/" + id, changes); return restPatch("/course/" + id, changes);
} }
/**
* Return a list containing all the actual courses of a user
*/
export async function getUserActualCourses(userId){
return restGet("/usercourses/"+userId)
}

View File

@ -63,3 +63,19 @@ export async function getChangeCurrReqById(id){
export async function editChangeCurrReq(id, newState){ export async function editChangeCurrReq(id, newState){
return restPatch("/changecurriculumreq/"+id+"/"+newState) return restPatch("/changecurriculumreq/"+id+"/"+newState)
} }
export async function editChangeCurrReqTeacherState(id, newState){
return restPatch("/changecurriculumreqteacher/"+id+"/"+newState)
}
export async function getExempReq(id){
return restGet("/exemptionsreq/"+id)
}
export async function editExempReqState(id, newstate){
return restPatch("/exemptionsreq/"+id+"/"+newstate)
}
export async function getExempByUser(userId){
return restGet("/exemptionreq/"+userId)
}

View File

@ -13,7 +13,7 @@ export async function uploadProfilePicture(file){
/** /**
* More generic version of the upload method * More generic version of the uploadProfilePicture method
*/ */
export async function uploadFile(file, type){ export async function uploadFile(file, type){