1
0
forked from PGL/Clyde

Merge pull request 'Leo/InscriptionDesEtudiant' (#161) from Leo/InscriptionDesEtudiant into master

Reviewed-on: PGL/Clyde#161
This commit is contained in:
LeoMoulin 2024-04-18 21:43:47 +02:00
commit 70a8e98a0e
35 changed files with 1260 additions and 249 deletions

View File

@ -70,6 +70,9 @@ public class ApplicationsController {
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){ if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
authorizedApps.add(Applications.UsersList);} authorizedApps.add(Applications.UsersList);}
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.InscriptionService},token)){
authorizedApps.add(Applications.Payments);}
return authorizedApps; return authorizedApps;
} }
} }

View File

@ -30,9 +30,16 @@ public class ExternalCurriculumController {
//everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service) //everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service)
@PostMapping("/externalcurriculum") @PostMapping("/externalcurriculum")
public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody Map<String, Object> externalCurrInfos){ public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody Map<String, Object> externalCurrInfos){
InscriptionRequest ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId")); //An external curriculum can either be linked to an User or to an InscriptionRequest
InscriptionRequest ir = null;
User user = null;
if (externalCurrInfos.get("inscriptionRequestId") != null){
ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId"));
}else{
user = userRepository.findById((Integer) externalCurrInfos.get("userRegNo"));
}
ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), null); ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), user);
return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK); return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK);
} }

View File

@ -34,4 +34,12 @@ public class PaymentController {
return new ResponseEntity<>(toReturn, HttpStatus.OK); return new ResponseEntity<>(toReturn, HttpStatus.OK);
} }
@GetMapping("/payment")
public ResponseEntity<ArrayList<Payment>> getAllPayments(){
ArrayList<Payment> toReturn = new ArrayList<Payment>();
paymentRepository.findAll().forEach(toReturn::add);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
} }

View File

@ -4,18 +4,23 @@ 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.CourseRepository; import ovh.herisson.Clyde.Repositories.CourseRepository;
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
import ovh.herisson.Clyde.Repositories.Inscription.ChangeCurriculumRequestRepository;
import ovh.herisson.Clyde.Repositories.Inscription.ExemptionsRequestRepository; import ovh.herisson.Clyde.Repositories.Inscription.ExemptionsRequestRepository;
import ovh.herisson.Clyde.Repositories.Inscription.ScholarshipRequestRepository; import ovh.herisson.Clyde.Repositories.Inscription.ScholarshipRequestRepository;
import ovh.herisson.Clyde.Repositories.Inscription.UninscriptionRequestRepository; import ovh.herisson.Clyde.Repositories.Inscription.UnregisterRequestRepository;
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.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;
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest; import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest; import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -27,16 +32,25 @@ public class RequestsController {
public final ScholarshipRequestRepository srr; public final ScholarshipRequestRepository srr;
public final UserRepository userRepository; public final UserRepository userRepository;
public final AuthenticatorService authServ; public final AuthenticatorService authServ;
public final UninscriptionRequestRepository uninscriptionRequestRepository; public final UnregisterRequestRepository unregisterRequestRepository;
public final CourseRepository courseRepository; public final CourseRepository courseRepository;
public final UserService userService;
public final UserCurriculumRepository userCurriculumRepository;
public final CurriculumRepository curriculumRepository;
public RequestsController(ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UninscriptionRequestRepository uninscriptionRequestRepository, CourseRepository courseRepository) { 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) {
this.err = err; this.err = err;
this.srr = srr; this.srr = srr;
this.userRepository = userRepository; this.userRepository = userRepository;
this.authServ = authServ; this.authServ = authServ;
this.uninscriptionRequestRepository = uninscriptionRequestRepository; this.unregisterRequestRepository = unregisterRequestRepository;
this.courseRepository = courseRepository; this.courseRepository = courseRepository;
this.userService = userService;
this.userCurriculumRepository = userCurriculumRepository;
this.curriculumRepository = curriculumRepository;
this.changeCurriculumRequestRepository = changeCurriculumRequestRepository;
} }
@PostMapping(value="/exemptionreq") @PostMapping(value="/exemptionreq")
@ -87,11 +101,154 @@ public class RequestsController {
return new ResponseEntity<>(toReturn, HttpStatus.OK); return new ResponseEntity<>(toReturn, HttpStatus.OK);
} }
@PostMapping(value = "/uninscriptionreq") @PostMapping(value = "/unregister")
public ResponseEntity<String> postUnregReq(@RequestBody Map<String,Object> uninscr){ public ResponseEntity<String> postUnregReq(@RequestBody Map<String,Object> uninscr){
User u = userRepository.findById((int) uninscr.get("userId")); User u = userRepository.findById((int) uninscr.get("userId"));
UninscriptionRequest ur = new UninscriptionRequest(RequestState.Pending, (String) uninscr.get("reason"), new Date(), u); Curriculum c;
uninscriptionRequestRepository.save(ur);
if (uninscr.get("curriculumId") == null){
c = null;
}else{
c = curriculumRepository.findById((Integer) uninscr.get("curriculumId"));
}
UnregisterRequest ur = new UnregisterRequest(RequestState.Pending, (String) uninscr.get("reason"), new Date(), u.getRegNo(), u.getFirstName(), u.getLastName(), u.getEmail(), c);
unregisterRequestRepository.save(ur);
return new ResponseEntity<>(HttpStatus.OK);
}
@PatchMapping(value = "/scholarshipreq/")
public ResponseEntity<String> editScholReq(@RequestBody Map<String,Object> infos){
ScholarshipRequest scholarshipRequest = srr.findById((Integer) infos.get("id"));
if (infos.get("state").equals("Accepted")){
scholarshipRequest.setState(RequestState.Accepted);
scholarshipRequest.setAmount((int) infos.get("amount"));
}else{
scholarshipRequest.setState(RequestState.Refused);
}
srr.save(scholarshipRequest);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping(value = "/scholarshipreq/{id}")
public ResponseEntity<ScholarshipRequest> getScholReqbyId(@PathVariable long id){
ScholarshipRequest toReturn = srr.findById(id);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
@GetMapping(value = "/unregister")
public ResponseEntity<ArrayList<UnregisterRequest>> getAllUnregReq(){
ArrayList<UnregisterRequest> toReturn = new ArrayList<>();
unregisterRequestRepository.findAll().forEach(toReturn::add);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
@GetMapping(value = "/unregister/{id}")
public ResponseEntity<UnregisterRequest> getUnregbyId(@PathVariable long id){
UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
return new ResponseEntity<>(unregisterRequest, HttpStatus.OK);
}
@PatchMapping(value = "/unregister/{id}/{newstate}")
public ResponseEntity<String> pathUnregReq(@PathVariable long id, @PathVariable RequestState newstate){
UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
User u = userRepository.findById(unregisterRequest.getRegNo());
unregisterRequest.setState(newstate);
if (newstate == RequestState.Accepted){
if (unregisterRequest.getCurriculum() == null){
ArrayList<UserCurriculum> userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u);
for (int i = 0; i < userCurricula.size(); i++){
userCurricula.get(i).setActual(false);
}
userCurriculumRepository.saveAll(userCurricula);
}else{
//This usercurriculum will contain the usercurriculum to set false
UserCurriculum userCurriculum = userCurriculumRepository.findByUserAndCurriculumAndActual(u, unregisterRequest.getCurriculum(), true);
userCurriculum.setActual(false);
userCurriculumRepository.save(userCurriculum);
}
}
unregisterRequestRepository.save(unregisterRequest);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/changecurriculumreq")
public ResponseEntity<String> addChangeCurrReq(@RequestBody Map<String,Object> reqInfos){
User user = userRepository.findById((Integer) reqInfos.get("userId"));
Curriculum actualCurriculum;
//If null then it means we are in a supplementary cursus case
if (reqInfos.get("actualcursus") == null){
actualCurriculum = null;
}else{
actualCurriculum = curriculumRepository.findById((Integer) reqInfos.get("actualcursus"));
}
Curriculum destinationCurriculum = curriculumRepository.findById((Integer) reqInfos.get("newcursus"));
ChangeCurriculumRequest changeCurriculumRequest = new ChangeCurriculumRequest(user, actualCurriculum, destinationCurriculum, new Date(), RequestState.Pending);
changeCurriculumRequestRepository.save(changeCurriculumRequest);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/changecurriculumreq")
public ResponseEntity<ArrayList <ChangeCurriculumRequest>> getAllChangeCurrReq(@RequestHeader("Authorization") String token){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ArrayList<ChangeCurriculumRequest> toReturn = new ArrayList<>();
changeCurriculumRequestRepository.findAll().forEach(toReturn::add);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
@GetMapping("/changecurriculumreq/{id}")
public ResponseEntity<ChangeCurriculumRequest> getCCrbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toReturn = changeCurriculumRequestRepository.findById(id);
return new ResponseEntity<>(toReturn, HttpStatus.OK);
}
@PatchMapping("/changecurriculumreq/{id}/{newState}")
public ResponseEntity<String> editCCReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newState){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
return new UnauthorizedResponse<>(null);
ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id);
toEdit.setState(newState);
if (newState == RequestState.Accepted){
//If actual curriculum is not null then we need to set that the user doesn't follow it anymore
User u = toEdit.getUser();
if (toEdit.getActualCurriculum() != null){
ArrayList<UserCurriculum> listcurr = userCurriculumRepository.findByUserOrderByCurriculum(u);
for (int i = 0; i < listcurr.size(); i++){
if (listcurr.get(i).getCurriculum() == toEdit.getActualCurriculum()){
listcurr.get(i).setActual(false);
}
}
userCurriculumRepository.saveAll(listcurr);
}
Calendar c = Calendar.getInstance();
UserCurriculum userCurriculum = new UserCurriculum(u, toEdit.getDestinationCurriculum(), c.get(Calendar.YEAR), true);
userCurriculumRepository.save(userCurriculum);
}
changeCurriculumRequestRepository.save(toEdit);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
} }

View File

@ -6,13 +6,11 @@ import ovh.herisson.Clyde.Repositories.*;
import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository; import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository;
import ovh.herisson.Clyde.Repositories.Inscription.MinervalRepository; import ovh.herisson.Clyde.Repositories.Inscription.MinervalRepository;
import ovh.herisson.Clyde.Repositories.Inscription.ScholarshipRequestRepository; import ovh.herisson.Clyde.Repositories.Inscription.ScholarshipRequestRepository;
import ovh.herisson.Clyde.Repositories.Inscription.UnregisterRequestRepository;
import ovh.herisson.Clyde.Services.*; import ovh.herisson.Clyde.Services.*;
import ovh.herisson.Clyde.Services.Inscription.InscriptionService; import ovh.herisson.Clyde.Services.Inscription.InscriptionService;
import ovh.herisson.Clyde.Tables.*; import ovh.herisson.Clyde.Tables.*;
import ovh.herisson.Clyde.Tables.Inscription.ExternalCurriculum; import ovh.herisson.Clyde.Tables.Inscription.*;
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
import ovh.herisson.Clyde.Tables.Inscription.Minerval;
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -40,7 +38,8 @@ public class MockController {
public final ScholarshipRequestRepository scholarshipRequestRepository; public final ScholarshipRequestRepository scholarshipRequestRepository;
public MockController(UserService userService, UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository){ public final UnregisterRequestRepository uninscriptionRequestRepository;
public MockController(UserService userService, UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository, UnregisterRequestRepository unregisterRequestRepository){
this.userService = userService; this.userService = userService;
this.tokenRepo = tokenRepo; this.tokenRepo = tokenRepo;
this.userRepo = userRepo; this.userRepo = userRepo;
@ -53,6 +52,7 @@ public class MockController {
this.ucr = ucr; this.ucr = ucr;
this.minervalRepository = minervalRepository; this.minervalRepository = minervalRepository;
this.scholarshipRequestRepository = scholarshipRequestRepository; this.scholarshipRequestRepository = scholarshipRequestRepository;
this.uninscriptionRequestRepository = unregisterRequestRepository;
} }
/** Saves an example of each user type by : /** Saves an example of each user type by :
@ -76,6 +76,9 @@ public class MockController {
userService.saveAll(mockUsers); userService.saveAll(mockUsers);
ExternalCurriculum externalCurriculum = new ExternalCurriculum(null, "HEH", "Bachelier en ingénieur", "completed", 2015, 2017, null, joe);
externalCurriculumRepository.save(externalCurriculum);
Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023); Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023);
minervalRepository.save(minerval); minervalRepository.save(minerval);
// Course / Curriculum part // Course / Curriculum part
@ -86,20 +89,21 @@ public class MockController {
Curriculum infoBab2 = new Curriculum(2,"info"); Curriculum infoBab2 = new Curriculum(2,"info");
Curriculum masterinfo1 = new Curriculum(4, "info"); Curriculum masterinfo1 = new Curriculum(4, "info");
Curriculum masterinfo2 = new Curriculum(5, "info"); Curriculum masterinfo2 = new Curriculum(5, "info");
Curriculum chemistryBab2 = new Curriculum(2, "chemistry");
curriculumService.save(infoBab1); curriculumService.save(infoBab1);
curriculumService.save(chemistryBab1); curriculumService.save(chemistryBab1);
curriculumService.save(psychologyBab1); curriculumService.save(psychologyBab1);
curriculumService.save(infoBab2); curriculumService.save(infoBab2);
curriculumService.save(masterinfo1); curriculumService.save(masterinfo1);
curriculumService.save(masterinfo2); curriculumService.save(masterinfo2);
curriculumService.save(chemistryBab2);
ucr.save(new UserCurriculum(joe, infoBab1, 2022)); ucr.save(new UserCurriculum(joe, infoBab1, 2022, false));
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023)); ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true));
ucr.save(new UserCurriculum(joe, infoBab1, 2023)); ucr.save(new UserCurriculum(joe, infoBab1, 2023, true));
ucr.save(new UserCurriculum(joe, psychologyBab1, 2020)); ucr.save(new UserCurriculum(joe, psychologyBab1, 2020, false));
ucr.save(new UserCurriculum(popo, infoBab1, 2022)); ucr.save(new UserCurriculum(popo, infoBab1, 2022, false));
ucr.save(new UserCurriculum(popo, infoBab2, 2023)); 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",joke);
@ -129,7 +133,10 @@ public class MockController {
inscriptionService.save(inscriptionRequest); inscriptionService.save(inscriptionRequest);
ExternalCurriculum externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null); UnregisterRequest unregisterRequest = new UnregisterRequest(RequestState.Pending, "je veux partir", new Date(), joe.getRegNo(), joe.getFirstName(), joe.getLastName(), joe.getEmail(), null);
uninscriptionRequestRepository.save(unregisterRequest);
externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null);
externalCurriculumRepository.save(externalCurriculum); externalCurriculumRepository.save(externalCurriculum);
} }
} }

View File

@ -0,0 +1,9 @@
package ovh.herisson.Clyde.Repositories.Inscription;
import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.ChangeCurriculumRequest;
public interface ChangeCurriculumRequestRepository extends CrudRepository<ChangeCurriculumRequest, Long> {
ChangeCurriculumRequest findById(long id);
}

View File

@ -4,5 +4,5 @@ import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest; import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
public interface ScholarshipRequestRepository extends CrudRepository<ScholarshipRequest, Long> { public interface ScholarshipRequestRepository extends CrudRepository<ScholarshipRequest, Long> {
public ScholarshipRequest findById(long id);
} }

View File

@ -1,7 +0,0 @@
package ovh.herisson.Clyde.Repositories.Inscription;
import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest;
public interface UninscriptionRequestRepository extends CrudRepository<UninscriptionRequest, Long> {
}

View File

@ -0,0 +1,8 @@
package ovh.herisson.Clyde.Repositories.Inscription;
import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest;
public interface UnregisterRequestRepository extends CrudRepository<UnregisterRequest, Long> {
public UnregisterRequest findById(long l);
}

View File

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

View File

@ -13,6 +13,7 @@ import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
import ovh.herisson.Clyde.Tables.Inscription.Minerval; import ovh.herisson.Clyde.Tables.Inscription.Minerval;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
@Service @Service
public class InscriptionService { public class InscriptionService {
@ -87,7 +88,8 @@ public class InscriptionService {
); );
userService.save(userFromRequest); userService.save(userFromRequest);
userCurriculumRepo.save(new UserCurriculum(userFromRequest, curriculumRepo.findById(inscrRequest.getCurriculumId()),0)); Calendar c = Calendar.getInstance();
userCurriculumRepo.save(new UserCurriculum(userFromRequest, curriculumRepo.findById(inscrRequest.getCurriculumId()),c.get(Calendar.YEAR), true));
//Create a minerval for the new student //Create a minerval for the new student
Minerval minerval = new Minerval(userFromRequest.getRegNo(), 0, 852, 2023); Minerval minerval = new Minerval(userFromRequest.getRegNo(), 0, 852, 2023);

View File

@ -35,11 +35,12 @@ public class UserCurriculumService {
HashMap<String, Object> element = new HashMap<>(); HashMap<String, Object> element = new HashMap<>();
Curriculum c = list.get(i).getCurriculum(); Curriculum c = list.get(i).getCurriculum();
element.put("curriculumId", c.getCurriculumId()); element.put("curriculumId", c.getCurriculumId());
element.put("year", c.getYear()); element.put("year", c.getYear());
element.put("option", c.getOption()); element.put("option", c.getOption());
element.put("dateyear", list.get(i).getYear()); element.put("dateyear", list.get(i).getYear());
element.put("actual", list.get(i).isActual());
curriculumlist.add(element); curriculumlist.add(element);
} }

View File

@ -19,5 +19,6 @@ public enum Applications {
// InscriptionService authorization // InscriptionService authorization
Requests, Requests,
StudentsList StudentsList,
Payments
} }

View File

@ -0,0 +1,83 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.*;
import java.util.Date;
@Entity
public class ChangeCurriculumRequest {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@ManyToOne
@JoinColumn(name="Users")
private User user;
@ManyToOne
@JoinColumn(name = "ActualCurriculum")
private Curriculum actualCurriculum;
@ManyToOne
@JoinColumn(name = "DestCurriculum")
private Curriculum destinationCurriculum;
private Date date;
private RequestState state;
public ChangeCurriculumRequest(){}
public ChangeCurriculumRequest(User user, Curriculum actualCurriculum, Curriculum destinationCurriculum, Date date, RequestState state){
this.user = user;
this.actualCurriculum = actualCurriculum;
this.destinationCurriculum = destinationCurriculum;
this.date = date;
this.state = state;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Curriculum getActualCurriculum() {
return actualCurriculum;
}
public void setActualCurriculum(Curriculum actualCurriculum) {
this.actualCurriculum = actualCurriculum;
}
public Curriculum getDestinationCurriculum() {
return destinationCurriculum;
}
public void setDestinationCurriculum(Curriculum destinationCurriculum) {
this.destinationCurriculum = destinationCurriculum;
}
public void setDate(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
public RequestState getState() {
return state;
}
public void setState(RequestState state) {
this.state = state;
}
public int getId() {
return id;
}
}

View File

@ -12,7 +12,6 @@ public class Payment {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long id; private long id;
private long studentRegNo; private long studentRegNo;
private String card; private String card;
private String client; private String client;

View File

@ -7,15 +7,16 @@ import ovh.herisson.Clyde.Tables.RequestState;
import ovh.herisson.Clyde.Tables.User; import ovh.herisson.Clyde.Tables.User;
import java.util.Date; import java.util.Date;
import java.util.Map;
@Entity @Entity
public class ScholarshipRequest { public class ScholarshipRequest {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long id; private long id;
@JoinColumn(name="Users") @JoinColumn(name="Users")
@ManyToOne(fetch = FetchType.EAGER) @ManyToOne(fetch = FetchType.EAGER)
@OnDelete(action = OnDeleteAction.CASCADE)
private User user; private User user;
private RequestState state; private RequestState state;
private Date date; private Date date;

View File

@ -1,67 +0,0 @@
package ovh.herisson.Clyde.Tables.Inscription;
import jakarta.persistence.*;
import ovh.herisson.Clyde.Tables.RequestState;
import ovh.herisson.Clyde.Tables.User;
import java.util.Date;
@Entity
public class UninscriptionRequest {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private RequestState state;
private String reason;
private Date date;
@JoinColumn(name = "Users")
@ManyToOne(fetch = FetchType.EAGER)
private User user;
public UninscriptionRequest(RequestState state,String reason, Date date, User user){
this.state = state;
this.reason = reason;
this.date = date;
this.user = user;
}
public UninscriptionRequest(){}
public RequestState getState() {
return state;
}
public void setState(RequestState state) {
this.state = state;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public long getId() {
return id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public void setDate(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
}

View File

@ -0,0 +1,115 @@
package ovh.herisson.Clyde.Tables.Inscription;
import jakarta.persistence.*;
import ovh.herisson.Clyde.Tables.Curriculum;
import ovh.herisson.Clyde.Tables.RequestState;
import ovh.herisson.Clyde.Tables.User;
import java.util.Date;
@Entity
public class UnregisterRequest {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private RequestState state;
private String reason;
private Date date;
//We store these informations again so if the user is deleted we still have the informations for history
private long regNo;
private String firstName;
private String lastName;
private String email;
//Null if the user unregister for the academic year, contains a curriculum if the user wants to unregister from a specific curriculum
@ManyToOne
@JoinColumn(name = "Curriculum")
private Curriculum curriculum;
public UnregisterRequest(RequestState state, String reason, Date date, long regNo, String firstName, String lastName, String email, Curriculum curriculum){
this.state = state;
this.reason = reason;
this.date = date;
this.regNo = regNo;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.curriculum = curriculum;
}
public UnregisterRequest(){}
public RequestState getState() {
return state;
}
public void setState(RequestState state) {
this.state = state;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public long getId() {
return id;
}
public void setDate(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
public String getEmail() {
return email;
}
public String getLastName() {
return lastName;
}
public String getFirstName() {
return firstName;
}
public void setEmail(String email) {
this.email = email;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setRegNo(long regNo) {
this.regNo = regNo;
}
public long getRegNo() {
return regNo;
}
public void setCurriculum(Curriculum curriculum) {
this.curriculum = curriculum;
}
public Curriculum getCurriculum() {
return curriculum;
}
}

View File

@ -1,6 +1,9 @@
package ovh.herisson.Clyde.Tables; package ovh.herisson.Clyde.Tables;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*; import jakarta.persistence.*;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import ovh.herisson.Clyde.Tables.Msg.Discussion; import ovh.herisson.Clyde.Tables.Msg.Discussion;
import ovh.herisson.Clyde.Tables.Msg.Message; import ovh.herisson.Clyde.Tables.Msg.Message;
@ -8,9 +11,6 @@ import ovh.herisson.Clyde.Tables.Msg.Message;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity @Entity
@Table(name = "Users") @Table(name = "Users")
public class User { public class User {
@ -27,6 +27,7 @@ public class User {
private Date birthDate; private Date birthDate;
private String profilePictureUrl; private String profilePictureUrl;
private Role role; private Role role;
@JsonIgnore @JsonIgnore
private String password; private String password;

View File

@ -23,10 +23,14 @@ public class UserCurriculum {
private int year; private int year;
public UserCurriculum(User user, Curriculum curriculum, int year){ //True if the user has that curriculum at the moment false if not
private boolean actual;
public UserCurriculum(User user, Curriculum curriculum, int year, boolean actual){
this.user = user; this.user = user;
this.curriculum = curriculum; this.curriculum = curriculum;
this.year = year; this.year = year;
this.actual = actual;
} }
public UserCurriculum() {} public UserCurriculum() {}
@ -58,4 +62,12 @@ public class UserCurriculum {
public void setYear(int year) { public void setYear(int year) {
this.year = year; this.year = year;
} }
public void setActual(boolean actual) {
this.actual = actual;
}
public boolean isActual() {
return actual;
}
} }

View File

@ -28,6 +28,7 @@ app.language=Language
app.manage.profile=Manage profile app.manage.profile=Manage profile
app.studentList=Students List app.studentList=Students List
app.users=Users app.users=Users
app.payments = Payments
request.moreInfos=More Infos request.moreInfos=More Infos
request.accept=Accept request.accept=Accept
request.refuse=Refuse request.refuse=Refuse

View File

@ -28,6 +28,7 @@ app.language=Langue
app.manage.profile=Gérer le profil app.manage.profile=Gérer le profil
app.studentList=Liste des étudiants app.studentList=Liste des étudiants
app.users=Utilisateurs app.users=Utilisateurs
app.payments = Payements
request.moreInfos=Plus d'Infos request.moreInfos=Plus d'Infos
request.accept=Accepter request.accept=Accepter
request.refuse=Refuser request.refuse=Refuser
@ -52,3 +53,4 @@ Curriculum=Cursus
Credits=Credits Credits=Credits
InscriptionService=S.I. InscriptionService=S.I.
faculty=Faculté faculty=Faculté

View File

@ -25,7 +25,6 @@ window.addEventListener('hashchange', () => {
const login=ref(i18n("app.login")) const login=ref(i18n("app.login"))
const active=ref(false) const active=ref(false)
const apps = ref([]) const apps = ref([])
appList().then(e => apps.value = e) appList().then(e => apps.value = e)
@ -33,7 +32,6 @@ window.addEventListener('hashchange', () => {
<template> <template>
<div class="container"> <div class="container">
<div class="topBar"> <div class="topBar">
<ul class="horizontal"> <ul class="horizontal">
<li title=home> <li title=home>
@ -69,7 +67,6 @@ window.addEventListener('hashchange', () => {
{{i18n("app.manage.profile")}} {{i18n("app.manage.profile")}}
</a> </a>
</div> </div>
</div> </div>
</a></li> </a></li>
</ul> </ul>

View File

@ -0,0 +1,115 @@
<script setup>
import {
addUninscReq, editChangeCurrReq,
editScholarshipReq,
editUnregReq, getChangeCurrReqById,
getScholarshipReqById,
getUnregisterbyId
} 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 getChangeCurrReqById(props.reqId))
//0 liste, 1 profil
const windowstate = ref(0);
const tag = req.value.user.regNo
async function uploadandrefreshChangeRequest(state){
await editChangeCurrReq(req.value.id, state);
}
</script>
<template>
<div class="body" v-if="windowstate === 0">
<div class="container">
<div class="globalInfos">
<div class="infosContainer">
<div>
Firstname/Name : {{req.user.firstName}} {{req.user.lastName}}
</div>
<div>
regNo : {{req.user.regNo}}
</div>
<div v-if="req.actualCurriculum !== null">
From : Bac {{req.actualCurriculum.year}} {{req.actualCurriculum.option}}
To : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
</div>
<div v-else>
Wanted cursus : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
</div>
<div>
<button @click="windowstate++"> See profile </button>
</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='Refused';uploadandrefreshChangeRequest('Refused')" style="margin-left: 2%;">Refuse</button>
</div>
</div>
</div>
</div>
</div>
<div v-if="windowstate === 1">
<AboutStudent :target="tag"></AboutStudent>
<button @click="windowstate--;">Return to request</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;
}
</style>

View File

@ -0,0 +1,124 @@
<script setup>
import {addUninscReq, editScholarshipReq, getScholarshipReqById} from "@/rest/requests.js";
import i18n from "@/i18n.js";
import {getUser} from "@/rest/Users.js";
import {reactive, ref} from "vue";
const props = defineProps(["reqId"])
const req = ref(await getScholarshipReqById(props.reqId))
const user = req.value.user;
const scholarshipData = reactive({
amount : 0,
id : req.value.id,
state : ""
})
function getPP(){
if(user.profilePictureUrl === null){
return "/Clyde.png"
}
return user.profilePictureUrl
}
async function uploadandrefreshScholarshipRequest(){
await editScholarshipReq(scholarshipData);
req.value = await getScholarshipReqById(props.reqId);
}
</script>
<template>
<div class="body">
<div class="container">
<div class="profilPic">
<img class="subContainter" :src=getPP()>
</div>
<div class="globalInfos">
<div class="infosContainer">
<div>
Firstname/Name : {{user.firstName}} {{user.lastName}}
</div>
<div>
E-mail: {{user.email}}
</div>
<div>
Adresse : {{user.address}}
</div>
<div>
Country : {{user.country}}
</div>
<div>
Birthdate : {{user.birthDate.slice(0,10)}}
</div>
<div>
<button>Download tax justif document</button>
<button style="margin-left: 2%">Download residency justif document</button>
</div>
<div v-if="req.state == 'Pending'">
Please enter the amount to provide :
<input type="number" v-model="scholarshipData.amount">
</div>
<div>
<button v-if="req.state === 'Pending'" @click="scholarshipData.state='Accepted';uploadandrefreshScholarshipRequest()">Accept</button>
<button v-if="req.state === 'Pending'" @click="scholarshipData.state='Refused';uploadandrefreshScholarshipRequest()" style="margin-left: 2%;">Refuse</button>
</div>
</div>
</div>
</div>
</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;
}
</style>

View File

@ -66,9 +66,9 @@
</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="parseInt(item.dateyear) !== getYear()">Bac {{item.year}}</div> <div class="year" v-if="item.actual === false">Bac {{item.year}}</div>
<div class="option" v-if="parseInt(item.dateyear) !== getYear()">{{item.option}}</div> <div class="option" v-if="item.actual === false">{{item.option}}</div>
<div class="dateyear" v-if="parseInt(item.dateyear) !== getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === false">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -78,9 +78,9 @@
</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="parseInt(item.dateyear) === getYear()">Bac {{item.year}}</div> <div class="year" v-if="item.actual === true">Bac {{item.year}}</div>
<div class="option" v-if="parseInt(item.dateyear) === getYear()">{{item.option}}</div> <div class="option" v-if="item.actual === true">{{item.option}}</div>
<div class="dateyear" v-if="parseInt(item.dateyear) === getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === true">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -88,7 +88,7 @@
</div> </div>
</div> </div>
<div v-if="extercurrlist==true"> <div v-if="extercurrlist==true">
<ExternalCurriculumList :ext-curr-list="externalcurrlist"></ExternalCurriculumList> <ExternalCurriculumList :ext-curr-list="externalcurrlist" :mode="1"></ExternalCurriculumList>
</div> </div>
</template> </template>

View File

@ -0,0 +1,109 @@
<script setup>
import {
addUninscReq,
editScholarshipReq,
editUnregReq,
getScholarshipReqById,
getUnregisterbyId
} from "@/rest/requests.js";
import i18n from "@/i18n.js";
import {getUser} from "@/rest/Users.js";
import {reactive, ref} from "vue";
const props = defineProps(["reqId"])
const req = ref(await getUnregisterbyId(props.reqId))
function getPP(){
if(user.profilePictureUrl === null){
return "/Clyde.png"
}
return user.profilePictureUrl
}
async function uploadandrefreshUnregRequest(state){
await editUnregReq(req.value.id, state)
req.value.state = state
}
</script>
<template>
<div class="body">
<div class="container">
<div class="globalInfos">
<div class="infosContainer">
<div>
Firstname/Name : {{req.firstName}} {{req.lastName}}
</div>
<div>
E-mail: {{req.email}}
</div>
<div>
regNo : {{req.regNo}}
</div>
<div>
Reason :
<input type="text" v-model="req.reason" readonly/>
</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='Refused';uploadandrefreshUnregRequest('Refused')" style="margin-left: 2%;">Refuse</button>
</div>
</div>
</div>
</div>
</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;
}
</style>

View File

@ -1,25 +1,91 @@
<script setup> <script setup>
import i18n from "@/i18n.js"; import i18n from "@/i18n.js";
import {ref} from "vue"; import {reactive, ref} from "vue";
import {getSelf} from "@/rest/Users.js";
import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
const props = defineProps(["extCurrList"]) //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user
const props = defineProps(["extCurrList", "mode"])
const extCurrList = ref(props.extCurrList) const extCurrList = ref(props.extCurrList)
console.log(extCurrList)
const User = await getSelf()
const list = ref(true)
const notcompletedCheck = ref(false);
const externalCurr = reactive({
inscriptionRequestId : null,
school:null,
formation :null,
completion : "completed",
startYear : 0,
endYear: 0,
justifdocUrl : null,
userRegNo : null
})
if (props.mode === 1){
externalCurr.userRegNo = props.extCurrList[0].user.regNo
}
async function postExternalCurr(){
await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo);
//We refresh the list
extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
list.value = !list.value;
}
</script> </script>
<template style="margin-top:5%;"> <template style="margin-top:5%;">
<div style="display:flex; justify-content:center; " v-for="item in extCurrList"> <div v-if="list">
<div class="bodu"> <div v-if="User.regNo === externalCurr.userRegNo" style="margin-left: 2%;margin-top: 2%">
<div class="container"> <button @click="list = !list">Add external curriculum</button>
<div class="status"><a style="margin-left:30px">{{item.state}}</a></div> </div>
<div class="school"><a>{{item.school}}</a></div> <div style="display:flex; justify-content:center; " v-for="item in extCurrList">
<div class="formation"><a>{{item.formation}}</a></div> <div class="bodu">
<div class="completion"><a>{{item.completion}}</a></div> <div class="container">
<div class="download"><button>Download document</button></div> <div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
<div class="school"><a>{{item.school}}</a></div>
<div class="formation"><a>{{item.formation}}</a></div>
<div class="completion"><a>{{item.completion}}</a></div>
<div class="download"><button>Download document</button></div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div v-else class="loginbox" style="margin-left: 35%; margin-top: 3%">
<form class="form">
<div class="inputBox">
<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="number" v-model="externalCurr.startYear">
</div>
<div class="inputBox">
<p>Année de fin</p>
<input type="number" v-model="externalCurr.endYear">
</div>
<div class="inputBox" style="margin-top: 3%; margin-bottom: 3%">
<input type="submit" value="Upload curriculum" @click="postExternalCurr()">
</div>
</form>
</div>
</template> </template>
<style scoped> <style scoped>
@ -61,18 +127,12 @@
font-size: 70%; font-size: 70%;
} }
.download{ .download{
grid-area: download; grid-area: download;
align-self:center; align-self:center;
} }
button{
font-size:15px;
height:50px;
width:75%;
border:none;
border-radius:20px;
}
.bodu { .bodu {
margin-top:2%; margin-top:2%;
@ -82,6 +142,43 @@ button{
background-color:rgb(50,50,50); background-color:rgb(50,50,50);
} }
.loginbox {
background-color: rgb(24,24,24);
width: 400px;
display:flex;
justify-content: center;
border-radius: 5%;
box-shadow:0 5px 25px #000000;
}
.form {
position:relative;
width:100%;
display: flex;
flex-direction: column;
align-items:center;
gap: 3%;
}
.inputBox input,select {
width:100%;
border: none;
margin-right: 12.5%;
padding-left: 2.5%;
padding-top:2.5%;
padding-bottom:2.5%;
outline:none;
border-radius: 10px;
font-size:1.35em;
}
.inputBox p{
position:relative;
z-index: 100;
font-family:sans-serif ;
color:rgb(239,60,168);
transition: 0.5;
}
</style> </style>

View File

@ -3,7 +3,15 @@
import {ref} from 'vue' import {ref} 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 {getAllExemptionsRequest, getAllScholarShipsRequest} from "@/rest/requests.js"; import {
getAllChangeCurrReq,
getAllExemptionsRequest,
getAllScholarShipsRequest,
getAllUnregisters
} from "@/rest/requests.js";
import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue";
import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue";
import AboutChangeCurriculum from "@/Apps/Inscription/AboutChangeCurriculum.vue";
const requests = ref(await getAllRegisters()); const requests = ref(await getAllRegisters());
let targetId = ""; let targetId = "";
@ -11,7 +19,7 @@
const requestType = ref("inscription"); const requestType = ref("inscription");
const filterType = ref("None"); const filterType = ref("None");
//0 = liste, 1 = détails, 2 = sure? //0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister, 5 = manage curriculum change
let windowsState = ref(0); let windowsState = ref(0);
async function upPage(id,review){ async function upPage(id,review){
@ -21,14 +29,21 @@
} }
async function loadRequests(){ async function loadRequests(){
if (requestType.value === "inscription"){ switch (requestType.value){
requests.value = await getAllRegisters(); case "inscription":
} requests.value = await getAllRegisters();
if (requestType.value === "scholarship"){ break;
requests.value = await getAllScholarShipsRequest(); case "scholarship":
} requests.value = await getAllScholarShipsRequest();
if(requestType.value === "exemption"){ break;
requests.value = await getAllExemptionsRequest(); case "exemption":
requests.value = await getAllExemptionsRequest();
break;
case "unregister":
requests.value = await getAllUnregisters();
break;
case "curriculum change":
requests.value = await getAllChangeCurrReq();
} }
} }
</script> </script>
@ -46,6 +61,8 @@
<option>inscription</option> <option>inscription</option>
<option>scholarship</option> <option>scholarship</option>
<option>exemption</option> <option>exemption</option>
<option>unregister</option>
<option>curriculum change</option>
</select> </select>
<span style="margin-left: 5%"> <span style="margin-left: 5%">
Filter : Filter :
@ -79,7 +96,7 @@
<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"><button>More infos</button></div> <div class="infos" @click="windowsState = 3; targetId=item.id;"><button>More infos</button></div>
</div> </div>
<div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';"v-if="requestType === 'exemption'"> <div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';"v-if="requestType === 'exemption'">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div> <div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
@ -89,6 +106,21 @@
<div class="reqState">{{item.state}}</div> <div class="reqState">{{item.state}}</div>
<div class="infos"><button>More infos</button></div> <div class="infos"><button>More infos</button></div>
</div> </div>
<div class="container" v-if="requestType === 'unregister'" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';">
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
<div class="studentfirstname">{{item.firstName}}</div>
<div class="studentlastname">{{item.lastName}}</div>
<div class="regno">id : {{item.regNo}}</div>
<div class="reqState">{{item.state}}</div>
<div class="infos"><button @click="windowsState=4;targetId=item.id">More infos</button></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="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="reqState">{{item.state}}</div>
<div class="infos"><button @click="windowsState=5;targetId=item.id">More infos</button></div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -97,6 +129,18 @@
<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;">Valider</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;">Retour</button>
</div> </div>
<div v-if="windowsState === 3">
<AboutScholarship :req-id="targetId"></AboutScholarship>
<div>
<button style="margin-left: 30%" @click="loadRequests();windowsState=0">Back</button>
</div>
</div>
<div v-if="windowsState === 4">
<AboutUnregister :req-id="targetId"></AboutUnregister>
</div>
<div v-if="windowsState === 5">
<AboutChangeCurriculum :req-id="targetId"></AboutChangeCurriculum>
</div>
</template> </template>
<style scoped> <style scoped>
@ -151,6 +195,10 @@
align-self:center; align-self:center;
} }
.regno{
grid-area: regno;
align-self: center;
}
.state{ .state{
grid-area:state; grid-area:state;
margin-left:40px; margin-left:40px;

View File

@ -0,0 +1,77 @@
<script setup>
import i18n from "@/i18n.js";
import {ref} from "vue";
import {getAllPayments} from "@/rest/requests.js";
const paymentsList = await getAllPayments()
</script>
<template style="margin-top:5%;">
<div style="display:flex; justify-content:center; " v-for="item in paymentsList">
<div class="bodu">
<div class="container">
<div class="regNo"><a style="margin-left:30px">RegNo : {{item.studentRegNo}}</a></div>
<div class="client"><a>Client : {{item.client}}</a></div>
<div class="amount"><a>Amount : {{item.amount}}</a></div>
<div class="date" style="margin-left: 10%">{{item.date.slice(0,10)}}</div>
</div>
</div>
</div>
</template>
<style scoped>
.container{
color:white;
height:100px;
font-size:30px;
display:grid;
grid-template-columns:20% 25% 15% 17%;
grid-template-areas:
"date regNo client amount";
column-gap:10px;
}
.regNo {
grid-area:regNo;
align-self:center;
font-size: 70%;
}
.client{
grid-area:client;
align-self:center;
font-size: 70%;
}
.amount{
grid-area:amount;
align-self:center;
font-size: 70%;
}
.date{
grid-area:date;
align-self:center;
font-size: 70%;
}
button{
font-size:15px;
height:50px;
width:75%;
border:none;
border-radius:20px;
}
.bodu {
margin-top:2%;
width:66%;
border:2px solid black;
border-radius:9px;
background-color:rgb(50,50,50);
}
</style>

View File

@ -53,7 +53,7 @@
setTimeout(() => { setTimeout(() => {
window.location.href="#/home"; window.location.href="#/home";
}, "500"); }, "500");
} }
function verifyInputs(pass){ function verifyInputs(pass){
if(pass==passwordConfirm.value){ if(pass==passwordConfirm.value){
page.value++; page.value++;
@ -83,13 +83,6 @@
} }
} }
async function getCurriculumYear(curriculumId){
const curriculum = await getcurriculum(curriculumId);
return parseInt(curriculum.year);
}
//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); 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);
@ -107,7 +100,7 @@
<template> <template>
<div class="setup"> <div class="setup">
<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">
<h1 style="color:rgb(239,60,168); font-family: sans-serif;"> <h1 style="color:rgb(239,60,168); font-family: sans-serif;">
@ -295,7 +288,6 @@
justify-content: center; justify-content: center;
border-radius: 5%; border-radius: 5%;
box-shadow:0 5px 25px #000000; box-shadow:0 5px 25px #000000;
} }
.form { .form {
position:relative; position:relative;

View File

@ -1,19 +1,23 @@
<script setup> <script setup>
import {reactive, ref } from 'vue' import {reactive, ref } from 'vue'
import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js' import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js'
import {getSelfCurriculum, getAllCurriculums, getSomeonesCurriculumList} from '../rest/curriculum.js' import {getSelfCurriculum, getAllCurriculums, getSomeonesCurriculumList, getcurriculum} from '../rest/curriculum.js'
import {getCourses} from "../rest/courses.js" import {getCourses} from "../rest/courses.js"
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js' import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js'
import CourseList from "@/Apps/Inscription/CourseList.vue"; import CourseList from "@/Apps/Inscription/CourseList.vue";
import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js"; import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js";
import {postPayment} from "@/rest/payment.js"; import {postPayment} from "@/rest/payment.js";
import {addUninscReq, createScholarshipRequest} from "@/rest/requests.js"; import {addUninscReq, createScholarshipRequest, postChangeCurrReq} from "@/rest/requests.js";
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
const user = ref(await getSelf()); const user = ref(await getSelf());
const UserCurriculum = ref(""); const UserCurriculum = ref("");
const curricula = ref (await getAllCurriculums()); const curricula = ref (await getAllCurriculums());
const minerv = ref({}); const minerv = ref({});
const extcurrlist = ref(await getExternalCurriculumByUser(user.value.regNo))
if(user.value.role === "Student"){ if(user.value.role === "Student"){
minerv.value = ref(await getCurrentMinerval(user.value.regNo)); minerv.value = ref(await getCurrentMinerval(user.value.regNo));
UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo); UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo);
@ -22,17 +26,15 @@
if(user.role === "Teacher"){ if(user.role === "Teacher"){
UserCurriculum.value = await getCourses("Teacher"); UserCurriculum.value = await getCourses("Teacher");
} }
const modif = ref(false);
const curric = ref(false);
const reg = ref(false);
const courseslist = ref(false);
const minerval = ref(false);
const paymentPage = ref(false);
const scholarship = ref(false);
const scholarshipinfos = ref(false);
const uninscr = ref(false);
const sure = ref(0); const sure = ref(0);
//0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister, 12 manage external curriculums
const windowState = ref(0);
const isChecked = ref(false);
const reRegState = ref(0);
const pattern = { const pattern = {
profilPictureUrl:null, profilPictureUrl:null,
email:null, email:null,
@ -67,32 +69,41 @@
residencyDocUrl : "" residencyDocUrl : ""
}) })
const changecurrdata = reactive({
userId : user.value.regNo,
actualcursus:null,
newcursus:1
})
//Used to post a uninscription request //Used to post a uninscription request
const uninscriptionData = reactive({ const uninscriptionData = reactive({
reason : null, reason : null,
userId : user.value.regNo userId : user.value.regNo,
curriculumId:null
}) })
const paymentAmount = ref(0); const paymentAmount = ref(0);
let toModify= Object.assign({}, pattern); let toModify= Object.assign({}, pattern);
let personnalInfos = Object.assign({}, patternInfos); let personnalInfos = Object.assign({}, patternInfos);
//Used to store the year of the new cursus selected in change cursus feature
const selectedYear = ref(0);
function resetInputs(inputs,list){ function resetInputs(inputs,list){
inputs=Object.assign({},list); inputs=Object.assign({},list);
} }
async function ChangeInfos(){ async function ChangeInfos(){
for (let element in toModify){ for (let element in toModify){
if (element =="email" && (toModify[element] !== null)){ if (element ==="email" && (toModify[element] !== null)){
await alterSelf(user.value.regNo,{email : toModify[element]}); await alterSelf(user.value.regNo,{email : toModify[element]});
} }
if (element =="profilPictureUrl" && (toModify[element] !== null)){ if (element ==="profilPictureUrl" && (toModify[element] !== null)){
await alterSelf(user.value.regNo,{ profilPictureUrl : toModify[element]}); await alterSelf(user.value.regNo,{ profilPictureUrl : toModify[element]});
} }
else if(element == "address" && (toModify[element] !== null)){ else if(element === "address" && (toModify[element] !== null)){
await alterSelf(user.value.regNo,{address : toModify[element]}); await alterSelf(user.value.regNo,{address : toModify[element]});
} }
else if(element == "password" && (toModify[element] !== null)){ else if(element === "password" && (toModify[element] !== null)){
await alterSelf(user.value.regNo,{password : toModify[element]}); await alterSelf(user.value.regNo,{password : toModify[element]});
} }
} }
@ -133,11 +144,14 @@
return date.getFullYear() return date.getFullYear()
} }
async function refreshExtCurrList(){
extcurrlist.value = await getExternalCurriculumByUser(user.value.regNo)
}
//This function travels through the student cursus array and extract the current cursus of the student //This function travels through the student cursus array and extract the current cursus of the student
function getActualCurriculumList(){ function getActualCurriculumList(){
let actualCurriculumList = []; let actualCurriculumList = [];
for (let i = 0; i < UserCurriculum.value.curriculumList.length; i++){ for (let i = 0; i < UserCurriculum.value.curriculumList.length; i++){
if (UserCurriculum.value.curriculumList[i].dateyear === getYear()){ if (UserCurriculum.value.curriculumList[i].actual === true){
actualCurriculumList.push(UserCurriculum.value.curriculumList[i]); actualCurriculumList.push(UserCurriculum.value.curriculumList[i]);
} }
} }
@ -155,16 +169,41 @@
await createScholarshipRequest(scholarshipData) await createScholarshipRequest(scholarshipData)
} }
//1 = previous 0 = next
function getCurriculumsNextYear(){
const currlist = getActualCurriculumList()
let list = []
for (let i = 0; i < currlist.length; i++){
for (let j = 0; j < curricula.value.length; j++){
if (curricula.value[j].option === currlist[i].option && curricula.value[j].year === currlist[i].year + 1){
list.push(curricula.value[j])
}
}
}
return list
}
async function getActualCurr(curr){
const cursus = await getcurriculum(curr);
for (let i = 0; i < curricula.value.length; i++){
if (curricula.value[i].option === cursus.option && curricula.value[i].year === cursus.year - 1){
changecurrdata.actualcursus = curricula.value[i].curriculumId;
}
}
}
</script> </script>
<template> <template>
<div class="body"> <div class="body" v-if="windowState !== 12">
<div class="container" v-if="courseslist == false"> <div class="container" v-if="windowState!==4">
<div class="profilPic"> <div class="profilPic" v-if="windowState===0">
<img class="subContainter" :src=getPP()> <img class="subContainter" :src=getPP()>
</div> </div>
<div class="globalInfos"> <div class="globalInfos">
<div v-if="modif==false && curric==false && reg==false && minerval==false && paymentPage == false && scholarship==false && uninscr == false" class="infosContainer"> <div v-if="windowState === 0" class="infosContainer">
<div> <div>
{{user.firstName}} {{user.lastName}} {{user.firstName}} {{user.lastName}}
</div> </div>
@ -178,51 +217,62 @@
Role: {{i18n((user.role))}} Role: {{i18n((user.role))}}
</div> </div>
<div> <div>
<button @click="modif=!modif; 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="reg=!reg">{{i18n("profile.reRegister")}}</button> <button @click="windowState=3">{{i18n("profile.reRegister")}}</button>
<button @click="uninscr = !uninscr" 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="curric=!curric">{{i18n("profile.change.curriculum")}}</button> <button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
<button @click="windowState=12;refreshExtCurrList() ">Manage external curriculums</button>
</div> </div>
<div v-if="(user.role==='Student')"> <div v-if="(user.role==='Student')">
<button @click="courseslist=!courseslist">Manage Courses</button> <button @click="windowState=4">Manage Courses</button>
<button @click="minerval = !minerval" style="margin-left: 2%">Manage minerval</button> <button @click="windowState=5" style="margin-left: 2%">Manage minerval</button>
</div> </div>
</div> </div>
<div v-else-if="uninscr" class="infosContainer"> <div v-else-if="windowState === 9" class="infosContainer">
<div v-if="sure != 2">Please enter the reason you leave the university</div> <div v-if="sure !== 2">Please enter the reason you leave</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
<input type="checkbox" v-model="isChecked">
</div>
<div v-if="sure !== 2 && isChecked">
Please select that cursus
<select v-model="uninscriptionData.curriculumId">
<option v-for="item in getActualCurriculumList()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select>
</div>
<div v-if="sure !== 2">
<button @click="sure++">Submit</button> <button @click="sure++">Submit</button>
</div> </div>
<div v-if="sure==1"> <div v-if="sure==1">
Are you sure that you want to unregister ? Are you sure that you want to unregister ?
<button @click="addUninscReq(uninscriptionData.userId, uninscriptionData.reason);sure++">Yes</button> <button @click="addUninscReq(uninscriptionData.userId, uninscriptionData.reason, uninscriptionData.curriculumId);sure++">Yes</button>
<button @click="sure=0">No</button> <button @click="sure=0">No</button>
</div> </div>
<p v-if="sure==2">You request has been send !</p> <p v-if="sure==2">You request has been send !</p>
</div> </div>
<div v-else-if="minerval" 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 Payment : {{minerv.value.toPay}} left to pay
<div v-if="minerv.value.paidAmount <= 50"> <div v-if="minerv.value.paidAmount <= 50">
<button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = 50">Pay deposit (50)</button> <button @click="windowState=6; paymentAmount = 50">Pay deposit (50)</button>
</div> </div>
<div> <div>
<button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}})</button> <button @click="windowState=6; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}})</button>
</div> </div>
</div> </div>
<div v-else> <div v-else>
Payment : School fees have already been paid this year Payment : School fees have already been paid this year
</div> </div>
<div> <div>
<button @click="scholarship=!scholarship; minerval=!minerval">Ask for a scholarship</button> <button @click="windowState=7">Ask for a scholarship</button>
</div> </div>
</div> </div>
<div v-else-if="scholarship && !scholarshipinfos" class="infosContainer"> <div v-else-if="windowState === 7" class="infosContainer">
<p>Please upload the required documents</p> <p>Please upload the required documents</p>
<div> <div>
Tax justification document : Tax justification document :
@ -232,18 +282,18 @@
Residency justification document : Residency justification document :
<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="scholarshipinfos = !scholarshipinfos;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">Submit scholarship request</button> <button style="margin-top: 5%" @click="windowState=8;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">Submit scholarship request</button>
</div> </div>
<div v-else-if="scholarship && scholarshipinfos" class="infosContainer"> <div v-else-if="windowState === 8" class="infosContainer">
<div> <div>
Your request has been sent to the inscription service you will get notified when Your request has been sent to the inscription service you will get notified when
the request is reviewed. the request is reviewed.
</div> </div>
<button @click="scholarshipinfos=!scholarshipinfos; scholarship=!scholarship"> <button @click="windowState = 0">
Go back to profile Go back to profile
</button> </button>
</div> </div>
<div v-else-if="paymentPage" class="infosContainer"> <div v-else-if="windowState === 6" class="infosContainer">
Proceed to payment of {{paymentAmount}} Proceed to payment of {{paymentAmount}}
<div style="margin-top: 1%"> <div style="margin-top: 1%">
Client: Client:
@ -258,20 +308,20 @@
<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="paymentPage=!paymentPage;minerval=!minerval;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)">Process Payment</button>
</div> </div>
<div> <div>
<button @click="minerval = !minerval; paymentPage = !paymentPage;">Back</button> <button @click="windowState = 5">Back</button>
</div> </div>
</div> </div>
<div v-else-if="modif" class="infosContainer"> <div v-else-if="windowState === 1" class="infosContainer">
<div> <div>
{{i18n("profile.picture")}}: {{i18n("profile.picture")}}:
<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: E-mail:
<input type="mail" v-model="toModify.email" /> <input type="email" v-model="toModify.email" />
</div> </div>
<div> <div>
{{i18n("profile.address")}}: {{i18n("profile.address")}}:
@ -286,27 +336,53 @@
<input type="password" v-model="toModify.passwordConfirm"> <input type="password" v-model="toModify.passwordConfirm">
</div> </div>
<div> <div>
<button @click=" modif=!modif; ChangeInfos();">{{i18n("courses.confirm")}}</button> <button @click="windowState = 0; ChangeInfos();">{{i18n("courses.confirm")}}</button>
<button @click="modif=!modif; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button> <button @click="windowState = 0; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button>
</div> </div>
</div> </div>
<div v-else-if="curric" class="infosContainer"> <div v-else-if="windowState === 2" class="infosContainer">
<div style="height:40px;"> <div>
{{i18n("Curriculum")}}: I would like to :
<select v-model="curriculum" > <select v-model="reRegState">
<option v-for="item in curricula" style="font-size:20px;" :value="item">{{item.option}}</option> <option :value="1">Reregister in the next year of one of my cursus</option>
<option :value="2">Register for a supplementary cursus</option>
<option :value="3">Change from a cursus to another</option>
</select> </select>
</div> </div>
<div style="height:40px;" v-if="reRegState === 3">
{{i18n("Curriculum")}}:
<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>
</select>
New Curriculum :
<select v-model="changecurrdata.newcursus">
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select>
</div>
<div style="height:40px;" v-if="reRegState === 2">
New Curriculum :
<select v-model="changecurrdata.newcursus">
<option v-for="item in curricula" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select>
</div>
<div style="height:40px;" v-if="reRegState === 1">
New Curriculum :
<select v-model="changecurrdata.newcursus" @change="getActualCurr(changecurrdata.newcursus);">
<option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
</select>
</div>
<div v-if="curricula[changecurrdata.newcursus-1].year > 1 && reRegState !== 1">
The cursus you selected has some prerequisites
</div>
<div> <div>
<button @click=" curric=!curric;">{{i18n("courses.confirm")}}</button> <button @click=" windowState = 0;postChangeCurrReq(changecurrdata);changecurrdata.actualcursus=null;changecurrdata.newcursus=null">{{i18n("courses.confirm")}}</button>
<button @click="curric=!curric; 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="reg" class="infosContainer"> <div v-else-if="windowState === 3" class="infosContainer">
<div> <div>
E-mail: E-mail:
<input type="mail" v-model="toModify.email" /> <input type="email" v-model="toModify.email" />
</div> </div>
<div> <div>
ID : ID :
@ -322,21 +398,21 @@
</div> </div>
<div> <div>
<button @click=" reg=!reg;">{{i18n("courses.confirm")}}</button> <button @click=" windowState=0;">{{i18n("courses.confirm")}}</button>
<button @click=" reg=!reg; 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> </div>
<div v-if="user.role == 'Student' && modif==false && curric==false && reg==false && minerval==false && scholarship == false && uninscr == false" class="moreInfos"> <div v-if="windowState === 0" class="moreInfos">
<div class = "oldcursus"> <div class = "oldcursus">
<div class="listTitle"> <div class="listTitle">
Anciens Cursus Anciens Cursus
</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="parseInt(item.dateyear) !== getYear()">Bac {{item.year}}</div> <div class="year" v-if="item.actual === false">Bac {{item.year}}</div>
<div class="option" v-if="parseInt(item.dateyear) !== getYear()">{{item.option}}</div> <div class="option" v-if="item.actual === false">{{item.option}}</div>
<div class="dateyear" v-if="parseInt(item.dateyear) !== getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === false">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -346,19 +422,23 @@
</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="parseInt(item.dateyear) === getYear()">Bac {{item.year}}</div> <div class="year" v-if="item.actual === true">Bac {{item.year}}</div>
<div class="option" v-if="parseInt(item.dateyear) === getYear()">{{item.option}}</div> <div class="option" v-if="item.actual === true">{{item.option}}</div>
<div class="dateyear" v-if="parseInt(item.dateyear) === getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div> <div class="dateyear" v-if="item.actual === true">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="courseslist === true" style="width: 80%"> <div v-if="windowState===4" style="width: 80%">
<CourseList :cursuslist="getActualCurriculumList()"/> <CourseList :cursuslist="getActualCurriculumList()"/>
<button style="width: 10%; margin-top: 5%" @click="courseslist = false">Return to profile</button> <button style="width: 10%; margin-top: 5%" @click="windowState = 0">Return to profile</button>
</div> </div>
</div> </div>
<div v-if="windowState === 12">
<ExternalCurriculumList :ext-curr-list="extcurrlist" :mode="1"></ExternalCurriculumList>
<button @click="windowState = 0;refreshExtCurrList()">Back to profile</button>
</div>
</template> </template>
<style scoped> <style scoped>
@ -439,21 +519,6 @@
} }
.name {
grid-area:name;
align-self:center;
}
.teacher{
grid-area:teacher;
align-self:center;
}
.credits{
grid-area:credits;
align-self:center;
}
.listElement{ .listElement{
border:2px solid black; border:2px solid black;

View File

@ -4,13 +4,12 @@ import i18n from '@/i18n.js'
// Liste des apps // Liste des apps
import LoginPage from '@/Apps/Login.vue' import LoginPage from '@/Apps/Login.vue'
import Inscription from "@/Apps/Inscription/ManageRequests.vue"
import Profil from "@/Apps/Profil.vue" import Profil from "@/Apps/Profil.vue"
import Courses from "@/Apps/ManageCourses.vue" import Courses from "@/Apps/ManageCourses.vue"
import Users from "@/Apps/UsersList.vue" import Users from "@/Apps/UsersList.vue"
import Students from "@/Apps/StudentsList.vue" import Students from "@/Apps/StudentsList.vue"
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
import Msg from "@/Apps/Msg.vue" import Msg from "@/Apps/Msg.vue"
import Payments from "@/Apps/Inscription/PaymentInfo.vue";
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue"; import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
const apps = { const apps = {
@ -21,6 +20,7 @@ const apps = {
'/users-list' : Users, '/users-list' : Users,
'/students-list' : Students, '/students-list' : Students,
'/msg' : Msg, '/msg' : Msg,
'/payments': Payments
} }
const appsList = { const appsList = {
@ -32,6 +32,7 @@ const appsList = {
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") }, 'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")}, 'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")}, 'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
'Payments':{path: '#/payments', icon:'fa-users', text:i18n("app.payments")}
} }
const currentPath = ref(window.location.hash) const currentPath = ref(window.location.hash)

View File

@ -1,15 +1,16 @@
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js"; import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js"; import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){ export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl, userRegNo){
return restPost("/externalcurriculum", { return restPost("/externalcurriculum", {
inscriptionRequestId: inscriptionRequestId, inscriptionRequestId: inscriptionRequestId,
school:school, school:school,
formation :formation, formation :formation,
completion : completion, completion : completion,
startYear : parseInteger(startYear), startYear : startYear,
endYear: parseInteger(endYear), endYear: endYear,
justifdocUrl : justifdocUrl justifdocUrl : justifdocUrl,
userRegNo : userRegNo
}) })
} }

View File

@ -20,6 +20,46 @@ export async function editEquivalenceState(id, newstate){
return restPatch("/request/registerequiv/"+id+"/"+newstate) return restPatch("/request/registerequiv/"+id+"/"+newstate)
} }
export async function addUninscReq(userId, reason){ export async function addUninscReq(userId, reason, curriculumId){
return restPost("/uninscriptionreq", {"userId" : userId, "reason" : reason}) return restPost("/unregister", {"userId" : userId, "reason" : reason, "curriculumId":curriculumId})
}
export async function editScholarshipReq(body){
return restPatch("/scholarshipreq/", body)
}
export async function getScholarshipReqById(id){
return restGet("/scholarshipreq/"+id)
}
export async function getAllUnregisters(){
return restGet("/unregister")
}
export async function getUnregisterbyId(id){
return restGet("/unregister/"+id)
}
export async function editUnregReq(id, newstate){
return restPatch("/unregister/"+id+"/"+newstate)
}
export async function getAllPayments(){
return restGet("/payment")
}
export async function postChangeCurrReq(item){
return restPost("/changecurriculumreq", item)
}
export async function getAllChangeCurrReq(){
return restGet("/changecurriculumreq")
}
export async function getChangeCurrReqById(id){
return restGet("/changecurriculumreq/"+id)
}
export async function editChangeCurrReq(id, newState){
return restPatch("/changecurriculumreq/"+id+"/"+newState)
} }