Compare commits
	
		
			4 Commits
		
	
	
		
			846cdedc4b
			...
			Schedule/m
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 220c891c72 | |||
| 2b9493422d | |||
| 621f568ba2 | |||
| 972d08a54d | 
							
								
								
									
										1
									
								
								Clyde
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								Clyde
									
									
									
									
									
										Submodule
									
								
							 Submodule Clyde added at bd27ffd3cb
									
								
							
							
								
								
									
										29
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								README.md
									
									
									
									
									
								
							@ -9,33 +9,10 @@ Projet du groupe 01:
 | 
			
		||||
- William Karpinski: Extension gestion des horaires
 | 
			
		||||
- Léo Moulin: Extension inscription des étudiants
 | 
			
		||||
 | 
			
		||||
## Running
 | 
			
		||||
 | 
			
		||||
Le projet peut être lancé grace à docker compose.
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
$ docker compose up 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Dans le cas ou vous modifiers des fichiers, pour éviter que les images de docker soient recrées avec les changement
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
$ docker compose up --force-recreate --build
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Dévelopement
 | 
			
		||||
 | 
			
		||||
Dans le cas ou vous êtes dans une phase de développement, il est plus simple d'utiliser gradle pour lancer le backend et frontend dans un mode de développement.
 | 
			
		||||
**Attention**: Ce mode n'est pas fait pour être utilisé en production!
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
$ ./gradlew run --parallel
 | 
			
		||||
```
 | 
			
		||||
$ ./gradlew backend:run frontend:run --parallel
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
permet de lancer le frontend sur [http://localhost:5173](http://localhost:5173) ansi que le frontend sur [http://localhost:8080](http://localhost:8080) 
 | 
			
		||||
 | 
			
		||||
Ceci requière également docker pour lancer une instance de postgresql pris en charge par spring.
 | 
			
		||||
 | 
			
		||||
Il est possible de se passer entièrement de docker en supprimant la dépendance dans le fichier `backend/build.gradle.kts`: ~~`developmentOnly("org.springframework.boot:spring-boot-docker-compose")`~~
 | 
			
		||||
Il est alors nécéssaire d'avoir une instance de postgresql tournant sur `localhost:5432` avec une table `clyde`, utilisateur: `devel` et password: `devel`
 | 
			
		||||
(cette configuration peut également être changée dans le fichier resources/application.properties de spring)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,6 @@
 | 
			
		||||
## Building phase
 | 
			
		||||
FROM gradle:jdk21-alpine AS BUILD
 | 
			
		||||
WORKDIR /backend
 | 
			
		||||
  
 | 
			
		||||
COPY . .
 | 
			
		||||
RUN gradle build -x test
 | 
			
		||||
 | 
			
		||||
## Running Phase
 | 
			
		||||
FROM eclipse-temurin:21-jdk-alpine
 | 
			
		||||
WORKDIR /backend
 | 
			
		||||
VOLUME /tmp
 | 
			
		||||
VOLUME /cdn
 | 
			
		||||
# ENV SPRING_PROFILES_ACTIVE=prod
 | 
			
		||||
COPY --from=BUILD /backend/build/libs/Clyde-0.0.1-SNAPSHOT.jar /backend/app.jar
 | 
			
		||||
EXPOSE 8080
 | 
			
		||||
ENTRYPOINT ["java", "-jar", "/backend/app.jar"]
 | 
			
		||||
ENV SPRING_PROFILES_ACTIVE=prod
 | 
			
		||||
COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar
 | 
			
		||||
ENTRYPOINT ["java", "-jar", "/app.jar"]
 | 
			
		||||
 | 
			
		||||
@ -16,8 +16,6 @@ repositories {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
	compileOnly("org.projectlombok:lombok")
 | 
			
		||||
	annotationProcessor("org.projectlombok:lombok")
 | 
			
		||||
	implementation("org.springframework.boot:spring-boot-starter-jdbc")
 | 
			
		||||
	implementation("org.springframework.boot:spring-boot-starter-data-jpa")
 | 
			
		||||
	implementation("org.springframework.boot:spring-boot-starter-mail")
 | 
			
		||||
@ -27,7 +25,6 @@ dependencies {
 | 
			
		||||
	implementation("com.kohlschutter.junixsocket:junixsocket-core:2.9.0")
 | 
			
		||||
	// implementation("org.springframework.session:spring-session-jdbc")
 | 
			
		||||
	developmentOnly("org.springframework.boot:spring-boot-devtools")
 | 
			
		||||
	developmentOnly("org.springframework.boot:spring-boot-docker-compose")
 | 
			
		||||
	runtimeOnly("org.postgresql:postgresql")
 | 
			
		||||
	testImplementation("org.springframework.boot:spring-boot-starter-test")
 | 
			
		||||
	testImplementation("org.springframework.boot:spring-boot-testcontainers")
 | 
			
		||||
 | 
			
		||||
@ -1,13 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file was generated by the Gradle 'init' task.
 | 
			
		||||
 *
 | 
			
		||||
 * The settings file is used to specify which projects to include in your build.
 | 
			
		||||
 * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.6/userguide/multi_project_builds.html in the Gradle documentation.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
plugins {
 | 
			
		||||
    // Apply the foojay-resolver plugin to allow automatic download of JDKs
 | 
			
		||||
    id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rootProject.name = "Clyde"
 | 
			
		||||
@ -1,34 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.DTO.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file DiscussionDTO.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * File to format a discussion using messageDTO 
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
 | 
			
		||||
import ovh.herisson.Clyde.DTO.Msg.MessagesDTO;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class DiscussionDTO {
 | 
			
		||||
	private long id;
 | 
			
		||||
	private String name;
 | 
			
		||||
	private List<User> members;
 | 
			
		||||
	private List<MessagesDTO> msgs;
 | 
			
		||||
 | 
			
		||||
	public static DiscussionDTO construct(Discussion d, User u){
 | 
			
		||||
		List<MessagesDTO> msgsdto = new ArrayList<>();
 | 
			
		||||
		d.getMsgs().forEach(x -> msgsdto.add(MessagesDTO.construct(x, u)));
 | 
			
		||||
		return new DiscussionDTO(d.getId(), d.getName(), d.getMembers(), msgsdto);
 | 
			
		||||
	} 
 | 
			
		||||
}
 | 
			
		||||
@ -1,33 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.DTO.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file MessagesDTO.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * File to Format the response adding the sender field
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Message;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class MessagesDTO {
 | 
			
		||||
	private long id;
 | 
			
		||||
	private String content; 
 | 
			
		||||
	private User author;
 | 
			
		||||
	private boolean sender;
 | 
			
		||||
	private Date created;
 | 
			
		||||
	//TODO: Attachment
 | 
			
		||||
 | 
			
		||||
	public static MessagesDTO construct(Message m, User user){
 | 
			
		||||
		boolean sender = false;
 | 
			
		||||
		if(m.getAuthor().equals(user))
 | 
			
		||||
			sender = true;
 | 
			
		||||
		return new MessagesDTO(m.getId(), m.getContent(), m.getAuthor(), sender, m.getCreated());
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -47,6 +47,7 @@ public class ApplicationsController {
 | 
			
		||||
 | 
			
		||||
        //if unAuthed
 | 
			
		||||
        authorizedApps.add(Applications.Login);
 | 
			
		||||
        authorizedApps.add(Applications.Schedule);
 | 
			
		||||
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null)
 | 
			
		||||
@ -64,15 +65,12 @@ public class ApplicationsController {
 | 
			
		||||
        if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Secretary,Role.Admin},token))
 | 
			
		||||
            authorizedApps.add(Applications.ManageCourses);
 | 
			
		||||
 | 
			
		||||
        if (!authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin, Role.Teacher},token)){
 | 
			
		||||
            authorizedApps.add(Applications.Requests);
 | 
			
		||||
        if (!authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token)){
 | 
			
		||||
            authorizedApps.add(Applications.Inscription);
 | 
			
		||||
            authorizedApps.add(Applications.StudentsList);}
 | 
			
		||||
 | 
			
		||||
        if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){ 
 | 
			
		||||
          authorizedApps.add(Applications.UsersList);}
 | 
			
		||||
 | 
			
		||||
        if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.InscriptionService},token)){
 | 
			
		||||
            authorizedApps.add(Applications.Payments);}
 | 
			
		||||
        return authorizedApps;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -3,15 +3,14 @@ package ovh.herisson.Clyde.EndPoints;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.*;
 | 
			
		||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.CourseService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.ProtectionService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.TeacherCourseService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Course;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Role;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.UserCurriculum;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@ -25,20 +24,10 @@ public class CourseController {
 | 
			
		||||
 | 
			
		||||
    private final 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) {
 | 
			
		||||
    public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ) {
 | 
			
		||||
        this.courseServ = courseServ;
 | 
			
		||||
        this.teacherCourseServ = teacherCourseServ;
 | 
			
		||||
        this.authServ = authServ;
 | 
			
		||||
        this.userService = userService;
 | 
			
		||||
        this.userCurriculumService = userCurriculumService;
 | 
			
		||||
        this.curriculumCourseRepository = curriculumCourseRepository;
 | 
			
		||||
        this.curriculumCourseService = curriculumCourseService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/course/{id}")
 | 
			
		||||
@ -146,29 +135,4 @@ public class CourseController {
 | 
			
		||||
        courseServ.delete(courseServ.findById(id));
 | 
			
		||||
        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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,13 +4,11 @@ package ovh.herisson.Clyde.EndPoints;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.InscriptionRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Curriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Role;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@ -23,18 +21,12 @@ public class CurriculumController {
 | 
			
		||||
 | 
			
		||||
    private final UserCurriculumService userCurriculumServ;
 | 
			
		||||
    private final CurriculumCourseService curriculumCourseServ;
 | 
			
		||||
    private final InscriptionRepository ir;
 | 
			
		||||
    private final UserService userServ;
 | 
			
		||||
 | 
			
		||||
    private final ExternalCurriculumRepository ecr;
 | 
			
		||||
    public CurriculumController(CurriculumService curriculumServ, AuthenticatorService authServ, UserCurriculumService userCurriculumServ, CurriculumCourseService curriculumCourseServ, InscriptionRepository ir, UserService userServ, ExternalCurriculumRepository ecr){
 | 
			
		||||
    public CurriculumController(CurriculumService curriculumServ, AuthenticatorService authServ, UserCurriculumService userCurriculumServ, CurriculumCourseService curriculumCourseServ){
 | 
			
		||||
        this.curriculumServ = curriculumServ;
 | 
			
		||||
        this.authServ = authServ;
 | 
			
		||||
        this.userCurriculumServ = userCurriculumServ;
 | 
			
		||||
        this.curriculumCourseServ = curriculumCourseServ;
 | 
			
		||||
        this.ir = ir;
 | 
			
		||||
        this.userServ = userServ;
 | 
			
		||||
        this.ecr = ecr;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/curriculum/{id}")
 | 
			
		||||
@ -60,22 +52,6 @@ public class CurriculumController {
 | 
			
		||||
        return new ResponseEntity<>(curriculumCourseServ.getDepthCurriculum(curriculum),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //Return the list of all curicullums of an user
 | 
			
		||||
    @GetMapping("/onescurriculum/{userId}")
 | 
			
		||||
    public ResponseEntity<Map<String ,Object>> findOnesCurriculum(@RequestHeader("Authorization") String token, @PathVariable String userId){
 | 
			
		||||
        if (authServ.getUserFromToken(token) == null)
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        User u = userServ.getUserById(Long.parseLong(userId));
 | 
			
		||||
        HashMap<String,Object> toReturn = userCurriculumServ.findAllCurriculumByStudent(u);
 | 
			
		||||
 | 
			
		||||
        if (toReturn == null)
 | 
			
		||||
            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(toReturn,HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/curriculums")
 | 
			
		||||
    public ResponseEntity<Iterable<Map<String, Object>>> findAllIndDepth(){
 | 
			
		||||
        return new ResponseEntity<>(curriculumCourseServ.getAllDepthCurriculum(),HttpStatus.OK);
 | 
			
		||||
@ -118,5 +94,4 @@ public class CurriculumController {
 | 
			
		||||
        curriculumServ.delete(toDelete);
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,62 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.InscriptionRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ExternalCurriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
			
		||||
public class ExternalCurriculumController {
 | 
			
		||||
 | 
			
		||||
    public final ExternalCurriculumRepository ecr;
 | 
			
		||||
    public final InscriptionRepository inscriptionRepository;
 | 
			
		||||
    public final UserRepository userRepository;
 | 
			
		||||
 | 
			
		||||
    public ExternalCurriculumController(ExternalCurriculumRepository ecr, InscriptionRepository inscriptionRepository, UserRepository userRepository) {
 | 
			
		||||
        this.ecr = ecr;
 | 
			
		||||
        this.inscriptionRepository = inscriptionRepository;
 | 
			
		||||
        this.userRepository = userRepository;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service)
 | 
			
		||||
    @PostMapping("/externalcurriculum")
 | 
			
		||||
    public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody Map<String, Object> externalCurrInfos){
 | 
			
		||||
        //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"), user);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/externalcurriculum/{inscReqId}")
 | 
			
		||||
    public ResponseEntity<ArrayList<ExternalCurriculum>> getExternalCurrListByInscrReq(@PathVariable long inscReqId){
 | 
			
		||||
        InscriptionRequest ir = inscriptionRepository.findById(inscReqId);
 | 
			
		||||
 | 
			
		||||
        ArrayList<ExternalCurriculum> toReturn = ecr.getExternalCurriculumByInscriptionRequest(ir);
 | 
			
		||||
        return new ResponseEntity<>(toReturn, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/externalcurriculumbyuser/{userId}")
 | 
			
		||||
    public ResponseEntity<ArrayList<ExternalCurriculum>> getExternalCurrByUser(@PathVariable long userId){
 | 
			
		||||
        User user = userRepository.findById(userId);
 | 
			
		||||
 | 
			
		||||
        ArrayList<ExternalCurriculum> toReturn = ecr.getExternalCurriculumByUser(user);
 | 
			
		||||
        return new ResponseEntity<>(toReturn, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,55 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.MinervalRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.Minerval;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Role;
 | 
			
		||||
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
			
		||||
public class MinervalController {
 | 
			
		||||
    private final AuthenticatorService authServ;
 | 
			
		||||
    private final MinervalRepository mr;
 | 
			
		||||
 | 
			
		||||
    public MinervalController(AuthenticatorService authServ, MinervalRepository mr) {
 | 
			
		||||
        this.authServ = authServ;
 | 
			
		||||
        this.mr = mr;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //A new minerval entry is posted when the inscription service accept a registration request
 | 
			
		||||
    @PostMapping("/minerval/{studentRegNo}")
 | 
			
		||||
    public ResponseEntity<Object> postMinerval(@RequestHeader("Authorization") String token, @PathVariable long studentRegNo){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        Calendar c = new GregorianCalendar();
 | 
			
		||||
 | 
			
		||||
        mr.save(new Minerval(studentRegNo, 0, 835, c.get(Calendar.YEAR)));
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/minerval/{studentRegNo}")
 | 
			
		||||
    public ResponseEntity<Minerval> getCurrentMinervalbyRegNo(@PathVariable long studentRegNo){
 | 
			
		||||
        ArrayList<Minerval> mlist = mr.getMinervalsByStudentRegNoOrderByYearDesc(studentRegNo);
 | 
			
		||||
 | 
			
		||||
        //The list is ordered by year in descending order then the index 0 contains the actual minerval (for this year)
 | 
			
		||||
        Minerval m = mlist.get(0);
 | 
			
		||||
        return new ResponseEntity<>(m, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PatchMapping("/minerval")
 | 
			
		||||
    public ResponseEntity<Object> updateMinerval(@RequestBody Minerval updatedMinerval){
 | 
			
		||||
        Minerval minerval = mr.findById(updatedMinerval.getId());
 | 
			
		||||
 | 
			
		||||
        minerval.setPaidAmount(updatedMinerval.getPaidAmount());
 | 
			
		||||
        minerval.setToPay(updatedMinerval.getToPay());
 | 
			
		||||
        mr.save(minerval);
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,45 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints.Inscription;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.PaymentRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.Payment;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
			
		||||
public class PaymentController {
 | 
			
		||||
 | 
			
		||||
    private final PaymentRepository paymentRepository;
 | 
			
		||||
 | 
			
		||||
    public PaymentController(PaymentRepository paymentRepository){
 | 
			
		||||
        this.paymentRepository = paymentRepository;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Post a payment record
 | 
			
		||||
    @PostMapping("/payment")
 | 
			
		||||
    public ResponseEntity<Object> postPayment(@RequestBody Payment payment){
 | 
			
		||||
        paymentRepository.save(payment);
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //Get all payment records of a student
 | 
			
		||||
    @GetMapping("/payment/{studentRegNo}")
 | 
			
		||||
    public ResponseEntity<ArrayList<Payment>> getPaymentsByUser(@PathVariable long studentRegNo){
 | 
			
		||||
        ArrayList<Payment> toReturn = paymentRepository.getPaymentsByStudentRegNo(studentRegNo);
 | 
			
		||||
        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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,366 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
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.ScholarshipRequestRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.UnregisterRequestRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.TokenService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.UserService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Calendar;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
			
		||||
public class RequestsController {
 | 
			
		||||
 | 
			
		||||
    public final TokenService tokenService;
 | 
			
		||||
    public final ExemptionsRequestRepository err;
 | 
			
		||||
    public final ScholarshipRequestRepository srr;
 | 
			
		||||
    public final UserRepository userRepository;
 | 
			
		||||
    public final AuthenticatorService authServ;
 | 
			
		||||
    public final UnregisterRequestRepository unregisterRequestRepository;
 | 
			
		||||
    public final CourseRepository courseRepository;
 | 
			
		||||
    public final UserService userService;
 | 
			
		||||
    public final UserCurriculumRepository userCurriculumRepository;
 | 
			
		||||
    public final CurriculumRepository curriculumRepository;
 | 
			
		||||
 | 
			
		||||
    public final ChangeCurriculumRequestRepository changeCurriculumRequestRepository;
 | 
			
		||||
 | 
			
		||||
    public RequestsController(TokenService tokenService, ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService, UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepository, ChangeCurriculumRequestRepository changeCurriculumRequestRepository) {
 | 
			
		||||
        this.tokenService = tokenService;
 | 
			
		||||
        this.err = err;
 | 
			
		||||
        this.srr = srr;
 | 
			
		||||
        this.userRepository = userRepository;
 | 
			
		||||
        this.authServ = authServ;
 | 
			
		||||
        this.unregisterRequestRepository = unregisterRequestRepository;
 | 
			
		||||
        this.courseRepository = courseRepository;
 | 
			
		||||
        this.userService = userService;
 | 
			
		||||
        this.userCurriculumRepository = userCurriculumRepository;
 | 
			
		||||
        this.curriculumRepository = curriculumRepository;
 | 
			
		||||
        this.changeCurriculumRequestRepository = changeCurriculumRequestRepository;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value="/exemptionreq")
 | 
			
		||||
    public ResponseEntity<String> createExemptionReq(@RequestBody Map<String, Object> exemptionsRequestInfo){
 | 
			
		||||
        User user = userRepository.findById((Integer) exemptionsRequestInfo.get("userRegNo"));
 | 
			
		||||
        Course course = courseRepository.findById((Integer) exemptionsRequestInfo.get("courseId"));
 | 
			
		||||
 | 
			
		||||
        ExemptionsRequest exemptionsRequest = new ExemptionsRequest(user, course, (String) exemptionsRequestInfo.get("justifDocument"), RequestState.Pending, new Date());
 | 
			
		||||
 | 
			
		||||
        err.save(exemptionsRequest);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value="/scholarshipreq")
 | 
			
		||||
    public ResponseEntity<String> createScholarshipReq(@RequestBody Map<String, Object> scholarshipRequestInfo){
 | 
			
		||||
        User user = userRepository.findById((Integer)scholarshipRequestInfo.get("userId"));
 | 
			
		||||
        ScholarshipRequest toCreate = new ScholarshipRequest(user, RequestState.Pending, 0, new Date(), (String) scholarshipRequestInfo.get("taxDocUrl"), (String) scholarshipRequestInfo.get("residencyDocUrl"));
 | 
			
		||||
 | 
			
		||||
        srr.save(toCreate);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Get all the exemptions Request
 | 
			
		||||
    @GetMapping(value = "/exemptionsreq")
 | 
			
		||||
    public ResponseEntity<ArrayList<ExemptionsRequest>> getAllExemptionsRequests(@RequestHeader("Authorization") String token){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        ArrayList<ExemptionsRequest> toReturn = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        err.findAll().forEach(toReturn::add);
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
    @GetMapping(value = "/scholarshipreq")
 | 
			
		||||
    public ResponseEntity<ArrayList<ScholarshipRequest>> getAllScholarshipRequests(@RequestHeader("Authorization") String token){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        ArrayList<ScholarshipRequest> toReturn = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        srr.findAll().forEach(toReturn::add);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(toReturn, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "/unregister")
 | 
			
		||||
    public ResponseEntity<String> postUnregReq(@RequestBody Map<String,Object> uninscr){
 | 
			
		||||
        User u = userRepository.findById((int) uninscr.get("userId"));
 | 
			
		||||
        Curriculum c;
 | 
			
		||||
 | 
			
		||||
        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(@RequestHeader("Authorization") String token, @RequestBody Map<String,Object> infos){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        ScholarshipRequest scholarshipRequest = srr.findById((Integer) infos.get("id"));
 | 
			
		||||
 | 
			
		||||
        //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
 | 
			
		||||
        if (scholarshipRequest.getState() == RequestState.Accepted){
 | 
			
		||||
            return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (infos.get("state").equals("Accepted")){
 | 
			
		||||
            scholarshipRequest.setState(RequestState.Accepted);
 | 
			
		||||
            scholarshipRequest.setAmount((int) infos.get("amount"));
 | 
			
		||||
        }else{
 | 
			
		||||
            scholarshipRequest.setState(RequestState.Refused);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        srr.save(scholarshipRequest);
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = "/scholarshipreq/{id}")
 | 
			
		||||
    public ResponseEntity<ScholarshipRequest> getScholReqbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin, Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        ScholarshipRequest toReturn = srr.findById(id);
 | 
			
		||||
        return new ResponseEntity<>(toReturn, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = "/unregister")
 | 
			
		||||
    public ResponseEntity<ArrayList<UnregisterRequest>> getAllUnregReq(@RequestHeader("Authorization") String token){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        ArrayList<UnregisterRequest> toReturn = new ArrayList<>();
 | 
			
		||||
        unregisterRequestRepository.findAll().forEach(toReturn::add);
 | 
			
		||||
        return new ResponseEntity<>(toReturn, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = "/unregister/{id}")
 | 
			
		||||
    public ResponseEntity<UnregisterRequest> getUnregbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
 | 
			
		||||
        return new ResponseEntity<>(unregisterRequest, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PatchMapping(value = "/unregister/{id}/{newstate}")
 | 
			
		||||
    public ResponseEntity<String> pathUnregReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id);
 | 
			
		||||
        User u = userRepository.findById(unregisterRequest.getRegNo());
 | 
			
		||||
 | 
			
		||||
        //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
 | 
			
		||||
        if (unregisterRequest.getState() == RequestState.Accepted){
 | 
			
		||||
            return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        unregisterRequest.setState(newstate);
 | 
			
		||||
        unregisterRequestRepository.save(unregisterRequest);
 | 
			
		||||
        if (newstate == RequestState.Accepted){
 | 
			
		||||
            if (unregisterRequest.getCurriculum() == null){
 | 
			
		||||
                ArrayList<UserCurriculum> userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u);
 | 
			
		||||
                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);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        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")
 | 
			
		||||
    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, RequestState.Unrequired);
 | 
			
		||||
 | 
			
		||||
        //Si l'année du cursus est plus grande que 1 et que l'étudiant n'a pas dans sa liste de cursus l'année d'en dessous alors on demande l'accord du prof
 | 
			
		||||
        if (destinationCurriculum.getYear() > 1 && !studentHasPrevYear(destinationCurriculum, user)){
 | 
			
		||||
            changeCurriculumRequest.setTeacherApprovalState(RequestState.Pending);
 | 
			
		||||
        }
 | 
			
		||||
        changeCurriculumRequestRepository.save(changeCurriculumRequest);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/changecurriculumreq")
 | 
			
		||||
    public  ResponseEntity<ArrayList <ChangeCurriculumRequest>> getAllChangeCurrReq(@RequestHeader("Authorization") String token){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},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.Teacher,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.InscriptionService},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.getState() == RequestState.Accepted){
 | 
			
		||||
            return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        toEdit.setState(newState);
 | 
			
		||||
        changeCurriculumRequestRepository.save(toEdit);
 | 
			
		||||
        if (newState == RequestState.Accepted && (toEdit.getTeacherApprovalState() == RequestState.Accepted || toEdit.getTeacherApprovalState() == RequestState.Unrequired)){
 | 
			
		||||
            //If actual curriculum is not null then we need to set that the user doesn't follow it anymore
 | 
			
		||||
            acceptProcedure(toEdit);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PatchMapping("/changecurriculumreqteacher/{id}/{newteacherstate}")
 | 
			
		||||
    public ResponseEntity<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();
 | 
			
		||||
        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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/exemptionreq/{userId}")
 | 
			
		||||
    public ResponseEntity<ArrayList<ExemptionsRequest>> getExReqByuser(@RequestHeader("Authorization") String token, @PathVariable long userId){
 | 
			
		||||
        User currentUser = tokenService.getUserFromToken(token);
 | 
			
		||||
 | 
			
		||||
        //Only admin, teacher, secretary and the student himself can access a student's data here
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher, Role.Secretary},token) && currentUser.getRegNo() != userId)
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        User u = userRepository.findById(userId);
 | 
			
		||||
 | 
			
		||||
        ArrayList<ExemptionsRequest> exList = err.findByUser(u);
 | 
			
		||||
        return new ResponseEntity<>(exList, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,13 +1,13 @@
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints.Inscription;
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints;
 | 
			
		||||
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.Inscription.InscriptionService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.InscriptionService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.ProtectionService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.RequestState;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Role;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
@ -29,7 +29,7 @@ public class InscriptionController {
 | 
			
		||||
    @GetMapping("/requests/register")
 | 
			
		||||
    public ResponseEntity<Iterable<Map<String,Object>>> getAllRequests(@RequestHeader("Authorization") String token){
 | 
			
		||||
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll();
 | 
			
		||||
@ -41,7 +41,7 @@ public class InscriptionController {
 | 
			
		||||
    @GetMapping("/request/register/{id}")
 | 
			
		||||
    public ResponseEntity<Map<String,Object>> getById(@RequestHeader("Authorization") String token, @PathVariable long id){
 | 
			
		||||
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        InscriptionRequest foundInscriptionRequest = inscriptionServ.getById(id);
 | 
			
		||||
@ -79,28 +79,4 @@ public class InscriptionController {
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //Allow teacher or admin to accept or refuse the equivalence
 | 
			
		||||
    @PatchMapping("/request/registerequiv/{id}/{newstate}")
 | 
			
		||||
    public ResponseEntity<Object> editRegisterEquiv(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher}, token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        InscriptionRequest toEdit = inscriptionServ.getById(id);
 | 
			
		||||
 | 
			
		||||
        //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
 | 
			
		||||
        if (toEdit.getEquivalenceState() == RequestState.Accepted){
 | 
			
		||||
            return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        toEdit.setEquivalenceState(newstate);
 | 
			
		||||
 | 
			
		||||
        inscriptionServ.save(toEdit);
 | 
			
		||||
 | 
			
		||||
        if (toEdit.getState() == RequestState.Accepted && (toEdit.getEquivalenceState() == RequestState.Accepted || toEdit.getEquivalenceState() == RequestState.Unrequired))
 | 
			
		||||
        {
 | 
			
		||||
            inscriptionServ.createUser(toEdit);
 | 
			
		||||
        }
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -5,14 +5,10 @@ import org.springframework.http.HttpHeaders;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.ProtectionService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Curriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.RequestState;
 | 
			
		||||
 | 
			
		||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@ -20,7 +16,7 @@ import java.util.Map;
 | 
			
		||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
			
		||||
public class LoginController {
 | 
			
		||||
    private final AuthenticatorService authServ;
 | 
			
		||||
    private final CurriculumRepository curriculumRepository;
 | 
			
		||||
 | 
			
		||||
    static public class RequestLogin{
 | 
			
		||||
        private final String identifier;
 | 
			
		||||
        private final String password;
 | 
			
		||||
@ -33,9 +29,8 @@ public class LoginController {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public LoginController(AuthenticatorService authServ, CurriculumRepository curriculumRepository){
 | 
			
		||||
    public LoginController(AuthenticatorService authServ){
 | 
			
		||||
        this.authServ = authServ;
 | 
			
		||||
        this.curriculumRepository = curriculumRepository;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "/login")
 | 
			
		||||
@ -53,18 +48,9 @@ public class LoginController {
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/register")
 | 
			
		||||
    public ResponseEntity<Map<String,Object>> register(@RequestBody InscriptionRequest inscriptionRequest){
 | 
			
		||||
        //We ensure here that if the targeted cursus year is more than first grade then we need the teacher equivalence approval
 | 
			
		||||
        Curriculum curr = curriculumRepository.findById(inscriptionRequest.getCurriculumId());
 | 
			
		||||
 | 
			
		||||
        if (curr.getYear() > 1){
 | 
			
		||||
            inscriptionRequest.setEquivalenceState(RequestState.Pending);
 | 
			
		||||
        }else{
 | 
			
		||||
            inscriptionRequest.setEquivalenceState(RequestState.Unrequired);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        InscriptionRequest returnedInscriptionRequest = authServ.register(inscriptionRequest);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(ProtectionService.requestWithoutPassword(returnedInscriptionRequest), HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2,16 +2,10 @@ package ovh.herisson.Clyde.EndPoints;
 | 
			
		||||
 | 
			
		||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.MinervalRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.ScholarshipRequestRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.UnregisterRequestRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.TokenRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Services.*;
 | 
			
		||||
import ovh.herisson.Clyde.Services.Inscription.InscriptionService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.*;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
@ -21,38 +15,26 @@ import java.util.Date;
 | 
			
		||||
 | 
			
		||||
public class MockController {
 | 
			
		||||
    private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
 | 
			
		||||
    public final UserService userService;
 | 
			
		||||
 | 
			
		||||
    public final UserRepository userRepo;
 | 
			
		||||
    public final TokenRepository tokenRepo;
 | 
			
		||||
    public final TokenService tokenService;
 | 
			
		||||
    public final CurriculumCourseService CurriculumCourseService;
 | 
			
		||||
    public final CurriculumService curriculumService;
 | 
			
		||||
    public final CourseService courseService;
 | 
			
		||||
    public final ExternalCurriculumRepository externalCurriculumRepository;
 | 
			
		||||
 | 
			
		||||
    public final InscriptionService inscriptionService;
 | 
			
		||||
    ArrayList<User> mockUsers;
 | 
			
		||||
 | 
			
		||||
    public final UserCurriculumRepository ucr;
 | 
			
		||||
 | 
			
		||||
    public final MinervalRepository minervalRepository;
 | 
			
		||||
 | 
			
		||||
    public final 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;
 | 
			
		||||
    public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, InscriptionService inscriptionService){
 | 
			
		||||
        this.tokenRepo = tokenRepo;
 | 
			
		||||
        this.userRepo = userRepo;
 | 
			
		||||
        this.tokenService = tokenService;
 | 
			
		||||
        this.CurriculumCourseService = CurriculumCourseService;
 | 
			
		||||
        this.curriculumService = curriculumService;
 | 
			
		||||
        this.courseService = courseService;
 | 
			
		||||
        this.externalCurriculumRepository = externalCurriculumRepository;
 | 
			
		||||
        this.inscriptionService = inscriptionService;
 | 
			
		||||
        this.ucr = ucr;
 | 
			
		||||
        this.minervalRepository = minervalRepository;
 | 
			
		||||
        this.scholarshipRequestRepository = scholarshipRequestRepository;
 | 
			
		||||
        this.uninscriptionRequestRepository = unregisterRequestRepository;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** Saves an example of each user type by :
 | 
			
		||||
@ -65,51 +47,31 @@ public class MockController {
 | 
			
		||||
    public void postMock(){
 | 
			
		||||
 | 
			
		||||
        // user part
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        User herobrine = new User("brine","hero","admin@admin.com","behind","ShadowsLand",new Date(0), null,Role.Admin,passwordEncoder.encode("admin"));
 | 
			
		||||
        User joe = new User("Mama","Joe","student@student.com","roundabout","England",new Date(0), null,Role.Student,passwordEncoder.encode("student"));
 | 
			
		||||
        User meh = new User("Polo","Marco","secretary@secretary.com","a Box","Monaco",new Date(0), null,Role.Secretary,passwordEncoder.encode("secretary"));
 | 
			
		||||
        User joke = new User("Gaillard","Corentin","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
 | 
			
		||||
        User jojo = new User("Bridoux","Justin","teacher2@teacher2.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
 | 
			
		||||
        User lena = new User("Louille","Lena","inscriptionService@InscriptionService.com","no","yes",new Date(0), null,Role.InscriptionService,passwordEncoder.encode("inscriptionService"));
 | 
			
		||||
        User popo = new User("Smith", "Paul", "paulsmith@gmail.com", "306 rue du poulet", "belgique", new Date(0), null, Role.Student, passwordEncoder.encode("jesuispaulleroi"));
 | 
			
		||||
        mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena,jojo, popo));
 | 
			
		||||
        mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena,jojo));
 | 
			
		||||
 | 
			
		||||
        userService.saveAll(mockUsers);
 | 
			
		||||
        userRepo.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);
 | 
			
		||||
        minervalRepository.save(minerval);
 | 
			
		||||
        // Course / Curriculum part
 | 
			
		||||
 | 
			
		||||
        Curriculum infoBab1 = new Curriculum(1,"info", false);
 | 
			
		||||
        Curriculum chemistryBab1 = new Curriculum(1,"chemistry", false);
 | 
			
		||||
        Curriculum psychologyBab1 = new Curriculum(1,"psychology", false);
 | 
			
		||||
        Curriculum infoBab2 = new Curriculum(2,"info", false);
 | 
			
		||||
        Curriculum masterinfo1 = new Curriculum(4, "info", false);
 | 
			
		||||
        Curriculum masterinfo2 = new Curriculum(5, "info", false);
 | 
			
		||||
        Curriculum chemistryBab2 = new Curriculum(2, "chemistry", false);
 | 
			
		||||
        Curriculum ingebab1 = new Curriculum(1, "ingénieur", true);
 | 
			
		||||
        Curriculum infoBab1 = new Curriculum(1,"info");
 | 
			
		||||
        Curriculum chemistryBab1 = new Curriculum(1,"chemistry");
 | 
			
		||||
        Curriculum psychologyBab1 = new Curriculum(1,"psychology");
 | 
			
		||||
 | 
			
		||||
        curriculumService.save(infoBab1);
 | 
			
		||||
        curriculumService.save(chemistryBab1);
 | 
			
		||||
        curriculumService.save(psychologyBab1);
 | 
			
		||||
        curriculumService.save(infoBab2);
 | 
			
		||||
        curriculumService.save(masterinfo1);
 | 
			
		||||
        curriculumService.save(masterinfo2);
 | 
			
		||||
        curriculumService.save(chemistryBab2);
 | 
			
		||||
        curriculumService.save(ingebab1);
 | 
			
		||||
 | 
			
		||||
        ucr.save(new UserCurriculum(joe, infoBab1, 2022, false));
 | 
			
		||||
        ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true));
 | 
			
		||||
        ucr.save(new UserCurriculum(joe, infoBab1, 2023, true));
 | 
			
		||||
        ucr.save(new UserCurriculum(joe, psychologyBab1, 2020, false));
 | 
			
		||||
        ucr.save(new UserCurriculum(popo, infoBab1, 2022, false));
 | 
			
		||||
        ucr.save(new UserCurriculum(popo, infoBab2, 2023, true));
 | 
			
		||||
 | 
			
		||||
        Course progra1 = new Course(5,"Programmation et algorithmique 1",joke);
 | 
			
		||||
        Course chemistry1 = new Course(12, "Thermochimie",jojo);
 | 
			
		||||
        Course chemistry1 = new Course(12, "Thermochimie",joke);
 | 
			
		||||
        Course psycho1 = new Course(21, "Neuroreaction of isolated brain cells",joke);
 | 
			
		||||
        Course commun = new Course(2, "cours commun",joke);
 | 
			
		||||
 | 
			
		||||
@ -118,28 +80,22 @@ public class MockController {
 | 
			
		||||
        courseService.save(psycho1);
 | 
			
		||||
        courseService.save(commun);
 | 
			
		||||
 | 
			
		||||
        ScholarshipRequest ssr1 = new ScholarshipRequest(joe, RequestState.Pending, 0, new Date(), "test", "test");
 | 
			
		||||
        scholarshipRequestRepository.save(ssr1);
 | 
			
		||||
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(infoBab1,progra1));
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(infoBab1,commun));
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(infoBab1, psycho1));
 | 
			
		||||
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,psycho1));
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,commun));
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(chemistryBab1, chemistry1));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,commun));
 | 
			
		||||
        CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1));
 | 
			
		||||
 | 
			
		||||
        InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 4,RequestState.Pending,"yes.png","password", null, new Date(), RequestState.Pending, null);
 | 
			
		||||
 | 
			
		||||
        InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Pending,"yes.png","password");
 | 
			
		||||
 | 
			
		||||
        inscriptionService.save(inscriptionRequest);
 | 
			
		||||
 | 
			
		||||
        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);
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,126 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.EndPoints.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file MessagesController.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * Entry point for the messages application
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.web.bind.annotation.CrossOrigin;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PatchMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PathVariable;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestHeader;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import ovh.herisson.Clyde.DTO.Msg.DiscussionDTO;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Msg.DiscussionRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
			
		||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.UserService;
 | 
			
		||||
import ovh.herisson.Clyde.Services.Msg.DiscussionService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Message;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class MessagesController {
 | 
			
		||||
 | 
			
		||||
	private AuthenticatorService authServ;
 | 
			
		||||
	private DiscussionService discServ;
 | 
			
		||||
	private DiscussionRepository discRepo;
 | 
			
		||||
	private UserService userServ;
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/discussions")
 | 
			
		||||
	public ResponseEntity<Iterable<Discussion>> getDiscussions(@RequestHeader("Authorization") String token ){
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null){
 | 
			
		||||
			return new UnauthorizedResponse<>(null);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Iterable<Discussion> mock = discServ.getOwned(authServ.getUserFromToken(token));
 | 
			
		||||
 | 
			
		||||
		return new ResponseEntity<>(mock, HttpStatus.OK); 
 | 
			
		||||
	} 
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/discussion/{id}")
 | 
			
		||||
	public ResponseEntity<DiscussionDTO> getDiscussion(@RequestHeader("Authorization") String token, @PathVariable long id){
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null || !discServ.hasDiscussion(user, id) ){
 | 
			
		||||
			return new UnauthorizedResponse<>(null);
 | 
			
		||||
		}
 | 
			
		||||
		return new ResponseEntity<>(DiscussionDTO.construct(discRepo.findById(id).orElse(null), authServ.getUserFromToken(token)), HttpStatus.OK);
 | 
			
		||||
	} 
 | 
			
		||||
 | 
			
		||||
	@PatchMapping("/discussion/{id}")
 | 
			
		||||
	public ResponseEntity<Discussion> AlterDiscussion(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Discussion data){
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null){
 | 
			
		||||
			return new UnauthorizedResponse<>(null);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Discussion disc = discRepo.findById(id).orElse(null);
 | 
			
		||||
		disc.setName(data.getName());
 | 
			
		||||
		discRepo.save(disc);
 | 
			
		||||
		return new ResponseEntity<>(disc, HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PatchMapping("/discussion/{id}/add")
 | 
			
		||||
	public ResponseEntity<Discussion> invite(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody User data){
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null){
 | 
			
		||||
			return new UnauthorizedResponse<>(null);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Discussion disc = discRepo.findById(id).orElse(null);
 | 
			
		||||
		User invited = userServ.getUserById(data.getRegNo());
 | 
			
		||||
		disc.addMember(invited);
 | 
			
		||||
		discRepo.save(disc);
 | 
			
		||||
		return new ResponseEntity<>(disc, HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PatchMapping("/discussion/{id}/remove")
 | 
			
		||||
	public ResponseEntity<Discussion> removeMember(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody User data){
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null){
 | 
			
		||||
			return new UnauthorizedResponse<>(null);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Discussion disc = discRepo.findById(id).orElse(null);
 | 
			
		||||
		User member = userServ.getUserById(data.getRegNo());
 | 
			
		||||
		disc.delMember(member);
 | 
			
		||||
		discRepo.save(disc);
 | 
			
		||||
		return new ResponseEntity<>(disc, HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/discussion/{id}")
 | 
			
		||||
	public ResponseEntity<Discussion> sendMessage(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Message msg){
 | 
			
		||||
		User user = authServ.getUserFromToken(token);
 | 
			
		||||
		if(user == null){
 | 
			
		||||
			return new UnauthorizedResponse<>(null);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Discussion disc = discRepo.findById(id).orElse(null);
 | 
			
		||||
		msg.setAuthor(user);
 | 
			
		||||
		if(disc != null)
 | 
			
		||||
			discServ.CreateMessage(disc, msg);
 | 
			
		||||
		return new ResponseEntity<>(disc, HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/discussion")
 | 
			
		||||
	public ResponseEntity<Discussion> createDiscussion(@RequestHeader("Authorization") String token, @RequestBody Discussion data){
 | 
			
		||||
		return new ResponseEntity<>(discServ.create(data.getName(), authServ.getUserFromToken(token)), HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
package ovh.herisson.Clyde;
 | 
			
		||||
 | 
			
		||||
import javax.sql.DataSource;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.context.annotation.Profile;
 | 
			
		||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
 | 
			
		||||
import org.springframework.scheduling.annotation.EnableScheduling;
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
@EnableScheduling
 | 
			
		||||
public class JdbcConfig {
 | 
			
		||||
 | 
			
		||||
	@Bean
 | 
			
		||||
	@Profile("!prod")
 | 
			
		||||
	public DataSource psqlSource(){
 | 
			
		||||
		DriverManagerDataSource source = new DriverManagerDataSource();
 | 
			
		||||
		source.setDriverClassName("org.postgresql.Driver");
 | 
			
		||||
		source.setUrl("jdbc:postgresql://localhost:5442/clyde");
 | 
			
		||||
		source.setUsername("devel");
 | 
			
		||||
		source.setPassword("devel");
 | 
			
		||||
 | 
			
		||||
		return source;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Bean
 | 
			
		||||
	@Profile("prod")
 | 
			
		||||
	public DataSource psqlSourceProd(){
 | 
			
		||||
		DriverManagerDataSource source = new DriverManagerDataSource();
 | 
			
		||||
		source.setDriverClassName("org.postgresql.Driver");
 | 
			
		||||
		source.setUrl("jdbc:postgresql:clyde?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432");
 | 
			
		||||
		source.setUsername("clyde");
 | 
			
		||||
 | 
			
		||||
		return source;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -1,9 +0,0 @@
 | 
			
		||||
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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,13 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> {
 | 
			
		||||
    ExemptionsRequest findById(long id);
 | 
			
		||||
 | 
			
		||||
    ArrayList<ExemptionsRequest> findByUser(User user);
 | 
			
		||||
}
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ExternalCurriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public interface ExternalCurriculumRepository extends CrudRepository<ExternalCurriculum, Long> {
 | 
			
		||||
    ArrayList<ExternalCurriculum> getExternalCurriculumByInscriptionRequest(InscriptionRequest ir);
 | 
			
		||||
 | 
			
		||||
    ArrayList<ExternalCurriculum> getExternalCurriculumByUser(User user);
 | 
			
		||||
    ExternalCurriculum getExternalCurriculumById(long id);
 | 
			
		||||
}
 | 
			
		||||
@ -1,12 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.Minerval;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public interface MinervalRepository extends CrudRepository<Minerval, Long> {
 | 
			
		||||
    public ArrayList<Minerval> getMinervalsByStudentRegNoOrderByYearDesc(Long studentRegNo);
 | 
			
		||||
 | 
			
		||||
    public Minerval findById(long id);
 | 
			
		||||
}
 | 
			
		||||
@ -1,10 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.Payment;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public interface PaymentRepository extends CrudRepository<Payment, Long> {
 | 
			
		||||
    public ArrayList<Payment> getPaymentsByStudentRegNo(long regNo);
 | 
			
		||||
}
 | 
			
		||||
@ -1,8 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
 | 
			
		||||
 | 
			
		||||
public interface ScholarshipRequestRepository extends CrudRepository<ScholarshipRequest, Long> {
 | 
			
		||||
    public ScholarshipRequest findById(long id);
 | 
			
		||||
}
 | 
			
		||||
@ -1,8 +0,0 @@
 | 
			
		||||
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);
 | 
			
		||||
}
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Inscription;
 | 
			
		||||
package ovh.herisson.Clyde.Repositories;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public interface InscriptionRepository extends CrudRepository<InscriptionRequest,Long> {
 | 
			
		||||
@ -1,23 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file DiscussionRepository.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * Repository of Discussion allowing to fetch discussion by user 
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.jpa.repository.Query;
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
 | 
			
		||||
 | 
			
		||||
public interface DiscussionRepository extends CrudRepository<Discussion, Long>{
 | 
			
		||||
 | 
			
		||||
	@Query("SELECT d FROM Discussion d INNER JOIN FETCH d.members dm WHERE dm.id = ?1")
 | 
			
		||||
	List<Discussion> findByMembership(long userid);
 | 
			
		||||
}
 | 
			
		||||
@ -1,14 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Repositories.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file MessageRepository.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Message;
 | 
			
		||||
 | 
			
		||||
public interface MessageRepository extends CrudRepository<Message, Long> {}
 | 
			
		||||
@ -6,16 +6,8 @@ import ovh.herisson.Clyde.Tables.Curriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.UserCurriculum;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public interface UserCurriculumRepository extends CrudRepository<UserCurriculum, Long> {
 | 
			
		||||
 | 
			
		||||
    @Query("select uc.curriculum from UserCurriculum uc where uc.user = ?1")
 | 
			
		||||
    Curriculum findByUser(User student);
 | 
			
		||||
 | 
			
		||||
    ArrayList<UserCurriculum> findByUserOrderByCurriculum(User student);
 | 
			
		||||
    UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual);
 | 
			
		||||
 | 
			
		||||
    ArrayList<UserCurriculum> findByUserAndActual(User user, boolean actual);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,7 @@
 | 
			
		||||
package ovh.herisson.Clyde.Services;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import ovh.herisson.Clyde.Services.Inscription.InscriptionService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
 | 
			
		||||
@ -46,7 +46,7 @@ public class CurriculumCourseService {
 | 
			
		||||
        toReturn.put("curriculumId", curriculum.getCurriculumId());
 | 
			
		||||
        toReturn.put("year", curriculum.getYear());
 | 
			
		||||
        toReturn.put("option", curriculum.getOption());
 | 
			
		||||
        toReturn.put("requireCertificate", curriculum.isRequireCertificate());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return  toReturn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@ public class CurriculumService {
 | 
			
		||||
    public Curriculum findById(long id){
 | 
			
		||||
        return curriculumRepo.findById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void delete(Curriculum curriculum) {
 | 
			
		||||
        curriculumRepo.delete(curriculum);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,114 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Services.Inscription;
 | 
			
		||||
 | 
			
		||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.*;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.InscriptionRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.MinervalRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Services.UserService;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.ExternalCurriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.Minerval;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Calendar;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
public class InscriptionService {
 | 
			
		||||
 | 
			
		||||
    private final InscriptionRepository inscriptionRepo;
 | 
			
		||||
 | 
			
		||||
    private final UserRepository userRepo;
 | 
			
		||||
 | 
			
		||||
    private final UserCurriculumRepository userCurriculumRepo;
 | 
			
		||||
 | 
			
		||||
    private final CurriculumRepository curriculumRepo;
 | 
			
		||||
 | 
			
		||||
    private final MinervalRepository minervalRepository;
 | 
			
		||||
    private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
 | 
			
		||||
    private final ExternalCurriculumRepository externalCurriculumRepository;
 | 
			
		||||
    private final UserService userService;
 | 
			
		||||
    public InscriptionService(InscriptionRepository inscriptionRepo, UserRepository userRepo, UserCurriculumRepository userCurriculumRepo, CurriculumRepository curriculumRepo, MinervalRepository minervalRepository, ExternalCurriculumRepository externalCurriculumRepository, UserService userService){
 | 
			
		||||
        this.inscriptionRepo = inscriptionRepo;
 | 
			
		||||
        this.userRepo = userRepo;
 | 
			
		||||
        this.userCurriculumRepo = userCurriculumRepo;
 | 
			
		||||
        this.curriculumRepo = curriculumRepo;
 | 
			
		||||
        this.minervalRepository = minervalRepository;
 | 
			
		||||
        this.externalCurriculumRepository = externalCurriculumRepository;
 | 
			
		||||
        this.userService = userService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public InscriptionRequest save(InscriptionRequest inscriptionRequest){
 | 
			
		||||
        inscriptionRequest.setPassword(passwordEncoder.encode(inscriptionRequest.getPassword()));
 | 
			
		||||
        return inscriptionRepo.save(inscriptionRequest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public InscriptionRequest getById(long id){
 | 
			
		||||
        return inscriptionRepo.findById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Iterable<InscriptionRequest> getAll(){
 | 
			
		||||
        return inscriptionRepo.findAll();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean modifyState(long id, RequestState requestState) {
 | 
			
		||||
        InscriptionRequest inscrRequest = getById(id);
 | 
			
		||||
 | 
			
		||||
        if (inscrRequest == null)
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
        //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
 | 
			
		||||
        if (inscrRequest.getState() == RequestState.Accepted){
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        inscrRequest.setState(requestState);
 | 
			
		||||
        save(inscrRequest);
 | 
			
		||||
 | 
			
		||||
        //saves the user from the request if accepted from teacher and inscription services
 | 
			
		||||
        if (requestState == RequestState.Accepted && (inscrRequest.getEquivalenceState() == RequestState.Accepted || inscrRequest.getEquivalenceState() == RequestState.Unrequired))
 | 
			
		||||
        {
 | 
			
		||||
            return createUser(inscrRequest);
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean createUser(InscriptionRequest inscrRequest){
 | 
			
		||||
        //We must send an email here
 | 
			
		||||
 | 
			
		||||
        if (curriculumRepo.findById(inscrRequest.getCurriculumId()) == null)
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
        User userFromRequest = new User(
 | 
			
		||||
                inscrRequest.getLastName(),
 | 
			
		||||
                inscrRequest.getFirstName(),
 | 
			
		||||
                inscrRequest.getEmail(),
 | 
			
		||||
                inscrRequest.getAddress(),
 | 
			
		||||
                inscrRequest.getCountry(),
 | 
			
		||||
                inscrRequest.getBirthDate(),
 | 
			
		||||
                inscrRequest.getProfilePicture(),
 | 
			
		||||
                inscrRequest.getPassword()
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        userService.save(userFromRequest);
 | 
			
		||||
        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
 | 
			
		||||
        Minerval minerval = new Minerval(userFromRequest.getRegNo(), 0, 852, 2023);
 | 
			
		||||
        minervalRepository.save(minerval);
 | 
			
		||||
 | 
			
		||||
        //Assign the externals curriculums from the inscription request to newly created student
 | 
			
		||||
        ArrayList<ExternalCurriculum> extCurrList = externalCurriculumRepository.getExternalCurriculumByInscriptionRequest(inscrRequest);
 | 
			
		||||
        for (int i = 0; i < extCurrList.size(); i++){
 | 
			
		||||
            extCurrList.get(i).setUser(userFromRequest);
 | 
			
		||||
            externalCurriculumRepository.save(extCurrList.get(i));
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    public void delete(InscriptionRequest toDelete) {
 | 
			
		||||
        inscriptionRepo.delete(toDelete);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,94 @@
 | 
			
		||||
package ovh.herisson.Clyde.Services;
 | 
			
		||||
 | 
			
		||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.InscriptionRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.RequestState;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.UserCurriculum;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
public class InscriptionService {
 | 
			
		||||
 | 
			
		||||
    private final InscriptionRepository inscriptionRepo;
 | 
			
		||||
 | 
			
		||||
    private final UserRepository userRepo;
 | 
			
		||||
 | 
			
		||||
    private final UserCurriculumRepository userCurriculumRepo;
 | 
			
		||||
 | 
			
		||||
    private final CurriculumRepository curriculumRepo;
 | 
			
		||||
 | 
			
		||||
    private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public InscriptionService(InscriptionRepository inscriptionRepo, UserRepository userRepo, UserCurriculumRepository userCurriculumRepo, CurriculumRepository curriculumRepo){
 | 
			
		||||
        this.inscriptionRepo = inscriptionRepo;
 | 
			
		||||
        this.userRepo = userRepo;
 | 
			
		||||
        this.userCurriculumRepo = userCurriculumRepo;
 | 
			
		||||
        this.curriculumRepo = curriculumRepo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public InscriptionRequest save(InscriptionRequest inscriptionRequest){
 | 
			
		||||
        inscriptionRequest.setPassword(passwordEncoder.encode(inscriptionRequest.getPassword()));
 | 
			
		||||
        return inscriptionRepo.save(inscriptionRequest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public InscriptionRequest getById(long id){
 | 
			
		||||
        return inscriptionRepo.findById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Iterable<InscriptionRequest> getAll(){
 | 
			
		||||
        return inscriptionRepo.findAll();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean modifyState(long id, RequestState requestState) {
 | 
			
		||||
        InscriptionRequest inscrRequest = getById(id);
 | 
			
		||||
 | 
			
		||||
        if (inscrRequest == null)
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
        // if th state is the same we don't send an email
 | 
			
		||||
        if (requestState == inscrRequest.getState())
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
        /** todo send an email to tell the poster of the inscrRequest (inscrRequest.getEmail())
 | 
			
		||||
         *  to notify them that the state of their request changed
 | 
			
		||||
         *  FooEmailFormat toSend = (String.format("Your request state changed from %s to %s"),
 | 
			
		||||
         *                                              inscrRequest.getState(), requestState)
 | 
			
		||||
         * FooEmailSender.send(toSend, inscrRequest.getEmail())
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //saves the user from the request if accepted
 | 
			
		||||
        if (requestState == RequestState.Accepted)
 | 
			
		||||
        {
 | 
			
		||||
            if (curriculumRepo.findById(inscrRequest.getCurriculumId()) == null)
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
            User userFromRequest = new User(
 | 
			
		||||
                    inscrRequest.getLastName(),
 | 
			
		||||
                    inscrRequest.getFirstName(),
 | 
			
		||||
                    inscrRequest.getEmail(),
 | 
			
		||||
                    inscrRequest.getAddress(),
 | 
			
		||||
                    inscrRequest.getCountry(),
 | 
			
		||||
                    inscrRequest.getBirthDate(),
 | 
			
		||||
                    inscrRequest.getProfilePicture(),
 | 
			
		||||
                    inscrRequest.getPassword()
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            userRepo.save(userFromRequest);
 | 
			
		||||
            userCurriculumRepo.save(new UserCurriculum(userFromRequest, curriculumRepo.findById(inscrRequest.getCurriculumId())));
 | 
			
		||||
        }
 | 
			
		||||
        inscrRequest.setState(requestState);
 | 
			
		||||
        save(inscrRequest);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void delete(InscriptionRequest toDelete) {
 | 
			
		||||
        inscriptionRepo.delete(toDelete);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,57 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Services.Msg;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file DiscussionService.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * Various function utilised by the messages application
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.databind.util.JSONPObject;
 | 
			
		||||
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Msg.DiscussionRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Message;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
public class DiscussionService {
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private DiscussionRepository discRepo;
 | 
			
		||||
 | 
			
		||||
	public Discussion create(String name, User author){
 | 
			
		||||
		return discRepo.save(new Discussion(name, author));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * list discussions owned by a certain user
 | 
			
		||||
	 */
 | 
			
		||||
	public Iterable<Discussion> getOwned(User author){
 | 
			
		||||
		return discRepo.findByMembership(author.getRegNo());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Create a message and link it to it's discussion
 | 
			
		||||
	 */
 | 
			
		||||
	public Discussion CreateMessage(Discussion disc, Message msg){
 | 
			
		||||
		disc.addMessage(msg);
 | 
			
		||||
		return discRepo.save(disc);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Check if a user is in a discussion
 | 
			
		||||
	 */
 | 
			
		||||
    public boolean hasDiscussion(User user, long id) {
 | 
			
		||||
		Discussion disc = discRepo.findById(id).orElse(null);
 | 
			
		||||
		List<User> members = disc.getMembers();
 | 
			
		||||
		return members.contains(user);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
package ovh.herisson.Clyde.Services;
 | 
			
		||||
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Course;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@ -87,9 +87,7 @@ public class ProtectionService {
 | 
			
		||||
        toReturn.put("curriculum", inscriptionRequest.getCurriculumId());
 | 
			
		||||
        toReturn.put("state", inscriptionRequest.getState());
 | 
			
		||||
        toReturn.put("profilePictureUrl", inscriptionRequest.getProfilePicture());
 | 
			
		||||
        toReturn.put("identityCard", inscriptionRequest.getIdentityCard());
 | 
			
		||||
        toReturn.put("submissionDate", inscriptionRequest.getSubmissionDate());
 | 
			
		||||
        toReturn.put("equivalenceState", inscriptionRequest.getEquivalenceState());
 | 
			
		||||
 | 
			
		||||
        return toReturn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,55 +1,20 @@
 | 
			
		||||
package ovh.herisson.Clyde.Services;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.Inscription.ExternalCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserCurriculumRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.*;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Curriculum;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
public class UserCurriculumService {
 | 
			
		||||
 | 
			
		||||
    private final UserCurriculumRepository userCurriculumRepository;
 | 
			
		||||
    private final CurriculumRepository curriculumRepo;
 | 
			
		||||
 | 
			
		||||
    private final ExternalCurriculumRepository externalCurriculumRepo;
 | 
			
		||||
    public UserCurriculumService(UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepo, ExternalCurriculumRepository externalCurriculumRepo) {
 | 
			
		||||
    public UserCurriculumService(UserCurriculumRepository userCurriculumRepository) {
 | 
			
		||||
        this.userCurriculumRepository = userCurriculumRepository;
 | 
			
		||||
        this.curriculumRepo = curriculumRepo;
 | 
			
		||||
        this.externalCurriculumRepo = externalCurriculumRepo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Curriculum findByUser(User student){
 | 
			
		||||
        return userCurriculumRepository.findByUser(student);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public HashMap<String,Object> findAllCurriculumByStudent(User student) {
 | 
			
		||||
        ArrayList<UserCurriculum> list = userCurriculumRepository.findByUserOrderByCurriculum(student);
 | 
			
		||||
 | 
			
		||||
        ArrayList<HashMap<String, Object>> curriculumlist = new ArrayList<HashMap<String, Object>>();
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < list.size(); i++) {
 | 
			
		||||
            HashMap<String, Object> element = new HashMap<>();
 | 
			
		||||
            Curriculum c = list.get(i).getCurriculum();
 | 
			
		||||
 | 
			
		||||
            element.put("curriculumId", c.getCurriculumId());
 | 
			
		||||
            element.put("year", c.getYear());
 | 
			
		||||
            element.put("option", c.getOption());
 | 
			
		||||
            element.put("dateyear", list.get(i).getYear());
 | 
			
		||||
            element.put("actual", list.get(i).isActual());
 | 
			
		||||
 | 
			
		||||
            curriculumlist.add(element);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        HashMap<String, Object> toReturn = new HashMap<String, Object>();
 | 
			
		||||
        toReturn.put("curriculumList", curriculumlist);
 | 
			
		||||
        return toReturn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ArrayList<UserCurriculum> findByStudentAndActual(User u, boolean actual){
 | 
			
		||||
        return userCurriculumRepository.findByUserAndActual(u, actual);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,6 @@ package ovh.herisson.Clyde.Services;
 | 
			
		||||
 | 
			
		||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.RegNoGenerator;
 | 
			
		||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Role;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
@ -107,17 +106,10 @@ public class UserService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public User save(User  user){
 | 
			
		||||
        RegNoGenerator.resetCount();
 | 
			
		||||
        user.setPassword(passwordEncoder.encode(user.getPassword()));
 | 
			
		||||
        return userRepo.save(user);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void saveAll(ArrayList<User> list){
 | 
			
		||||
        //S'assure que le compteur est bien a 0
 | 
			
		||||
        RegNoGenerator.resetCount();
 | 
			
		||||
        userRepo.saveAll(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Iterable<User> getAll(){
 | 
			
		||||
        return userRepo.findAll();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ package ovh.herisson.Clyde.Tables;
 | 
			
		||||
public enum Applications {
 | 
			
		||||
    // without any token
 | 
			
		||||
    Login,
 | 
			
		||||
    Schedule,
 | 
			
		||||
 | 
			
		||||
    // with any token
 | 
			
		||||
    Profile,
 | 
			
		||||
@ -18,7 +19,6 @@ public enum Applications {
 | 
			
		||||
    UsersList,
 | 
			
		||||
 | 
			
		||||
    // InscriptionService authorization
 | 
			
		||||
    Requests,
 | 
			
		||||
    StudentsList,
 | 
			
		||||
    Payments
 | 
			
		||||
    Inscription,
 | 
			
		||||
    StudentsList
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,95 +0,0 @@
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
    private RequestState teacherApprovalState;
 | 
			
		||||
    public ChangeCurriculumRequest(){}
 | 
			
		||||
 | 
			
		||||
    public ChangeCurriculumRequest(User user, Curriculum actualCurriculum, Curriculum destinationCurriculum, Date date, RequestState state, RequestState teacherApprovalState){
 | 
			
		||||
        this.user = user;
 | 
			
		||||
        this.actualCurriculum = actualCurriculum;
 | 
			
		||||
        this.destinationCurriculum = destinationCurriculum;
 | 
			
		||||
        this.date = date;
 | 
			
		||||
        this.state = state;
 | 
			
		||||
        this.teacherApprovalState = teacherApprovalState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public User getUser() {
 | 
			
		||||
        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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public RequestState getTeacherApprovalState() {
 | 
			
		||||
        return teacherApprovalState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTeacherApprovalState(RequestState teacherApprovalState) {
 | 
			
		||||
        this.teacherApprovalState = teacherApprovalState;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,13 +12,9 @@ public class Curriculum {
 | 
			
		||||
    private int curriculumId;
 | 
			
		||||
    private int year;
 | 
			
		||||
    private String option;
 | 
			
		||||
 | 
			
		||||
    //True if the curriculum need an entry exam
 | 
			
		||||
    private boolean requireCertificate;
 | 
			
		||||
    public Curriculum(int year, String option, boolean requireCertificate){
 | 
			
		||||
    public Curriculum(int year, String option){
 | 
			
		||||
        this.year = year;
 | 
			
		||||
        this.option = option;
 | 
			
		||||
        this.requireCertificate = requireCertificate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Curriculum() {}
 | 
			
		||||
@ -43,11 +39,4 @@ public class Curriculum {
 | 
			
		||||
        this.option = option;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRequireCertificate(boolean requireCertificate) {
 | 
			
		||||
        this.requireCertificate = requireCertificate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isRequireCertificate() {
 | 
			
		||||
        return requireCertificate;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables;
 | 
			
		||||
 | 
			
		||||
public enum FileType {
 | 
			
		||||
 | 
			
		||||
    ProfilePicture,
 | 
			
		||||
    EducationCertificate,
 | 
			
		||||
    JustificationDocument,
 | 
			
		||||
    IdentityCard,
 | 
			
		||||
 | 
			
		||||
    EducationCertificate
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,87 +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.Course;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.RequestState;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
public class ExemptionsRequest {
 | 
			
		||||
    @Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private int id;
 | 
			
		||||
 | 
			
		||||
    @JoinColumn(name = "Users")
 | 
			
		||||
    @ManyToOne(fetch = FetchType.EAGER)
 | 
			
		||||
    private User user;
 | 
			
		||||
 | 
			
		||||
    @JoinColumn(name = "Course")
 | 
			
		||||
    @ManyToOne(fetch = FetchType.EAGER)
 | 
			
		||||
    private Course course;
 | 
			
		||||
    private String justifDocument;
 | 
			
		||||
 | 
			
		||||
    private RequestState state;
 | 
			
		||||
 | 
			
		||||
    private Date date;
 | 
			
		||||
 | 
			
		||||
    public ExemptionsRequest(User user, Course course, String justifDocument, RequestState state, Date date){
 | 
			
		||||
        this.user = user;
 | 
			
		||||
        this.course = course;
 | 
			
		||||
        this.justifDocument = justifDocument;
 | 
			
		||||
        this.state = state;
 | 
			
		||||
        this.date = date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public ExemptionsRequest(){}
 | 
			
		||||
 | 
			
		||||
    public User getUser() {
 | 
			
		||||
        return user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUser(User user) {
 | 
			
		||||
        this.user = user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Course getCourse() {
 | 
			
		||||
        return course;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCourse(Course course) {
 | 
			
		||||
        this.course = course;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getJustifDocument() {
 | 
			
		||||
        return justifDocument;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setJustifDocument(String justifDocument) {
 | 
			
		||||
        this.justifDocument = justifDocument;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public RequestState getState() {
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setState(RequestState state) {
 | 
			
		||||
        this.state = state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Date getDate() {
 | 
			
		||||
        return date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setDate(Date date) {
 | 
			
		||||
        this.date = date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,114 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables.Inscription;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
//This table stores a student's curriculum from another university
 | 
			
		||||
@Entity
 | 
			
		||||
public class ExternalCurriculum {
 | 
			
		||||
    @Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private int id;
 | 
			
		||||
 | 
			
		||||
    //An external curriculum is first linked to an inscription request and when it is accepted and the user is created we link it to the user
 | 
			
		||||
    @ManyToOne(fetch = FetchType.EAGER)
 | 
			
		||||
    @JoinColumn(name="InscriptionRequest")
 | 
			
		||||
    private InscriptionRequest inscriptionRequest;
 | 
			
		||||
 | 
			
		||||
    @ManyToOne(fetch = FetchType.EAGER)
 | 
			
		||||
    @JoinColumn(name="Users")
 | 
			
		||||
    private User user;
 | 
			
		||||
 | 
			
		||||
    private String school;
 | 
			
		||||
 | 
			
		||||
    private String formation;
 | 
			
		||||
 | 
			
		||||
    //This string denotes the completion of the external formation or the last year completed by the student in this formation
 | 
			
		||||
    private String completion;
 | 
			
		||||
 | 
			
		||||
    private int startYear;
 | 
			
		||||
    private int endYear;
 | 
			
		||||
    private String justifdocUrl;
 | 
			
		||||
 | 
			
		||||
    public ExternalCurriculum(){}
 | 
			
		||||
 | 
			
		||||
    public ExternalCurriculum(InscriptionRequest ir, String school, String formation, String completion, int startYear, int endYear, String justifdocUrl,User user){
 | 
			
		||||
        this.inscriptionRequest = ir;
 | 
			
		||||
        this.school = school;
 | 
			
		||||
        this.formation = formation;
 | 
			
		||||
        this.completion = completion;
 | 
			
		||||
        this.startYear = startYear;
 | 
			
		||||
        this.endYear = endYear;
 | 
			
		||||
        this.justifdocUrl = justifdocUrl;
 | 
			
		||||
        this.user = user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public InscriptionRequest getInscriptionRequest() {
 | 
			
		||||
        return inscriptionRequest;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setInscriptionRequest(InscriptionRequest inscriptionRequest) {
 | 
			
		||||
        this.inscriptionRequest = inscriptionRequest;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSchool() {
 | 
			
		||||
        return school;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSchool(String school) {
 | 
			
		||||
        this.school = school;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getFormation() {
 | 
			
		||||
        return formation;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setFormation(String formation) {
 | 
			
		||||
        this.formation = formation;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCompletion(){
 | 
			
		||||
        return completion;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCompletion(String completion) {
 | 
			
		||||
        this.completion = completion;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getStartYear() {
 | 
			
		||||
        return startYear;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setStartYear(int startYear) {
 | 
			
		||||
        this.startYear = startYear;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getEndYear() {
 | 
			
		||||
        return endYear;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setEndYear(int endYear) {
 | 
			
		||||
        this.endYear = endYear;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setJustifdocUrl(String justifdocUrl) {
 | 
			
		||||
        this.justifdocUrl = justifdocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getJustifdocUrl() {
 | 
			
		||||
        return justifdocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUser(User user) {
 | 
			
		||||
        this.user = user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public User getUser() {
 | 
			
		||||
        return user;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,64 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables.Inscription;
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.Entity;
 | 
			
		||||
import jakarta.persistence.GeneratedValue;
 | 
			
		||||
import jakarta.persistence.GenerationType;
 | 
			
		||||
import jakarta.persistence.Id;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
public class Minerval {
 | 
			
		||||
    @Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private long id;
 | 
			
		||||
 | 
			
		||||
    private long studentRegNo;
 | 
			
		||||
    private int paidAmount;
 | 
			
		||||
    private int toPay;
 | 
			
		||||
 | 
			
		||||
    //If the academic year is 2023-2024 then 2023 will be stored here (we take the lowest year)
 | 
			
		||||
    private int year;
 | 
			
		||||
    public Minerval(){}
 | 
			
		||||
 | 
			
		||||
    public Minerval(long studentRegNo, int paidAmount, int toPay, int year){
 | 
			
		||||
        this.studentRegNo = studentRegNo;
 | 
			
		||||
        this.paidAmount = paidAmount;
 | 
			
		||||
        this.toPay = toPay;
 | 
			
		||||
        this.year = year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getStudentRegNo() {
 | 
			
		||||
        return studentRegNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setStudentRegNo(long studentRegNo) {
 | 
			
		||||
        this.studentRegNo = studentRegNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getPaidAmount() {
 | 
			
		||||
        return paidAmount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPaidAmount(int paidAmount) {
 | 
			
		||||
        this.paidAmount = paidAmount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getToPay() {
 | 
			
		||||
        return toPay;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setToPay(int toPay) {
 | 
			
		||||
        this.toPay = toPay;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getYear() {
 | 
			
		||||
        return year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setYear(int year) {
 | 
			
		||||
        this.year = year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,83 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables.Inscription;
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.Entity;
 | 
			
		||||
import jakarta.persistence.GeneratedValue;
 | 
			
		||||
import jakarta.persistence.GenerationType;
 | 
			
		||||
import jakarta.persistence.Id;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
public class Payment {
 | 
			
		||||
    @Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private long id;
 | 
			
		||||
    private long studentRegNo;
 | 
			
		||||
    private String card;
 | 
			
		||||
    private String client;
 | 
			
		||||
    private Date expDate;
 | 
			
		||||
    private int amount;
 | 
			
		||||
    private Date date;
 | 
			
		||||
    public Payment(){}
 | 
			
		||||
 | 
			
		||||
    public Payment(long studentRegNo, String card, String client, Date expDate, int amount, Date date){
 | 
			
		||||
        this.studentRegNo = studentRegNo;
 | 
			
		||||
        this.card = card;
 | 
			
		||||
        this.client = client;
 | 
			
		||||
        this.expDate = expDate;
 | 
			
		||||
        this.amount = amount;
 | 
			
		||||
        this.date = date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getStudentRegNo() {
 | 
			
		||||
        return studentRegNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setStudentRegNo(long studentRegNo) {
 | 
			
		||||
        this.studentRegNo = studentRegNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCard() {
 | 
			
		||||
        return card;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCard(String card) {
 | 
			
		||||
        this.card = card;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getClient() {
 | 
			
		||||
        return client;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setClient(String client) {
 | 
			
		||||
        this.client = client;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Date getExpDate() {
 | 
			
		||||
        return expDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setExpDate(Date expDate) {
 | 
			
		||||
        this.expDate = expDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getAmount() {
 | 
			
		||||
        return amount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAmount(int amount) {
 | 
			
		||||
        this.amount = amount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Date getDate() {
 | 
			
		||||
        return date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setDate(Date date) {
 | 
			
		||||
        this.date = date;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,89 +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.RequestState;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
public class ScholarshipRequest {
 | 
			
		||||
    @Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private long id;
 | 
			
		||||
    @JoinColumn(name="Users")
 | 
			
		||||
    @ManyToOne(fetch = FetchType.EAGER)
 | 
			
		||||
    @OnDelete(action = OnDeleteAction.CASCADE)
 | 
			
		||||
    private User user;
 | 
			
		||||
    private RequestState state;
 | 
			
		||||
    private Date date;
 | 
			
		||||
    private int amount;
 | 
			
		||||
    private String taxDocUrl;
 | 
			
		||||
    private String residencyDocUrl;
 | 
			
		||||
 | 
			
		||||
    public ScholarshipRequest(User user, RequestState state, int amount, Date date, String taxDocUrl, String residencyDocUrl){
 | 
			
		||||
        this.user = user;
 | 
			
		||||
        this.state = state;
 | 
			
		||||
        this.amount = amount;
 | 
			
		||||
        this.date = date;
 | 
			
		||||
        this.taxDocUrl = taxDocUrl;
 | 
			
		||||
        this.residencyDocUrl = residencyDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ScholarshipRequest(){}
 | 
			
		||||
 | 
			
		||||
    public User getUser() {
 | 
			
		||||
        return user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUser(User user) {
 | 
			
		||||
        this.user = user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public RequestState getState() {
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setState(RequestState state) {
 | 
			
		||||
        this.state = state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getAmount() {
 | 
			
		||||
        return amount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAmount(int amount) {
 | 
			
		||||
        this.amount = amount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Date getDate() {
 | 
			
		||||
        return date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setDate(Date date) {
 | 
			
		||||
        this.date = date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getResidencyDocUrl() {
 | 
			
		||||
        return residencyDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setResidencyDocUrl(String residencyDocUrl) {
 | 
			
		||||
        this.residencyDocUrl = residencyDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getTaxDocUrl() {
 | 
			
		||||
        return taxDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTaxDocUrl(String taxDocUrl) {
 | 
			
		||||
        this.taxDocUrl = taxDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,115 +0,0 @@
 | 
			
		||||
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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,6 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables.Inscription;
 | 
			
		||||
package ovh.herisson.Clyde.Tables;
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.*;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.RequestState;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,17 +15,14 @@ public class InscriptionRequest {
 | 
			
		||||
    private String email;
 | 
			
		||||
    private String country;
 | 
			
		||||
    private Date birthDate;
 | 
			
		||||
 | 
			
		||||
    private Long curriculumId;
 | 
			
		||||
    private RequestState state;
 | 
			
		||||
    private String profilePicture;
 | 
			
		||||
    private String password;
 | 
			
		||||
    private String identityCard;
 | 
			
		||||
    private String admissionDocUrl;
 | 
			
		||||
    private Date submissionDate;
 | 
			
		||||
    private RequestState equivalenceState;
 | 
			
		||||
    public InscriptionRequest(){}
 | 
			
		||||
 | 
			
		||||
    public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate, RequestState equivalenceState, String admissionDocUrl){
 | 
			
		||||
    private String password;
 | 
			
		||||
    public InscriptionRequest(){}
 | 
			
		||||
    public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password){
 | 
			
		||||
        this.lastName = lastName;
 | 
			
		||||
        this.firstName = firstName;
 | 
			
		||||
        this.address = address;
 | 
			
		||||
@ -38,10 +33,6 @@ public class InscriptionRequest {
 | 
			
		||||
        this.state = state;
 | 
			
		||||
        this.profilePicture = profilePicture;
 | 
			
		||||
        this.password = password;
 | 
			
		||||
        this.identityCard = identityCard;
 | 
			
		||||
        this.submissionDate = submissionDate;
 | 
			
		||||
        this.equivalenceState = equivalenceState;
 | 
			
		||||
        this.admissionDocUrl = admissionDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getId() {
 | 
			
		||||
@ -127,36 +118,4 @@ public class InscriptionRequest {
 | 
			
		||||
    public void setPassword(String password) {
 | 
			
		||||
        this.password = password;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getIdentityCard() {
 | 
			
		||||
        return identityCard;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setIdentityCard(String identityCard) {
 | 
			
		||||
        this.identityCard = identityCard;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Date getSubmissionDate() {
 | 
			
		||||
        return submissionDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSubmissionDate(Date submissionDate) {
 | 
			
		||||
        this.submissionDate = submissionDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public RequestState getEquivalenceState() {
 | 
			
		||||
        return equivalenceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setEquivalenceState(RequestState equivalenceState) {
 | 
			
		||||
        this.equivalenceState = equivalenceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getAdmissionDocUrl() {
 | 
			
		||||
        return admissionDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAdmissionDocUrl(String admissionDocUrl) {
 | 
			
		||||
        this.admissionDocUrl = admissionDocUrl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,72 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file Discussion.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * Discussion allow to regroupe multiple user in and message together
 | 
			
		||||
 * for the messages application to work
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.CascadeType;
 | 
			
		||||
import jakarta.persistence.Entity;
 | 
			
		||||
import jakarta.persistence.GeneratedValue;
 | 
			
		||||
import jakarta.persistence.GenerationType;
 | 
			
		||||
import jakarta.persistence.Id;
 | 
			
		||||
import jakarta.persistence.JoinColumn;
 | 
			
		||||
import jakarta.persistence.JoinTable;
 | 
			
		||||
import jakarta.persistence.ManyToMany;
 | 
			
		||||
import jakarta.persistence.OneToMany;
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.Setter;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
@Getter
 | 
			
		||||
@Setter
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
public class Discussion{
 | 
			
		||||
 | 
			
		||||
	@Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
	private long id;
 | 
			
		||||
	private String name;
 | 
			
		||||
 | 
			
		||||
    @ManyToMany
 | 
			
		||||
	@JoinTable(
 | 
			
		||||
		name = "discussion_members",
 | 
			
		||||
		joinColumns = @JoinColumn(name = "discussion_id"),
 | 
			
		||||
		inverseJoinColumns = @JoinColumn(name = "user_id")
 | 
			
		||||
	)
 | 
			
		||||
	private List<User> members;
 | 
			
		||||
 | 
			
		||||
	@OneToMany(mappedBy="discussion", orphanRemoval = true, cascade = CascadeType.ALL)
 | 
			
		||||
	private List<Message> msgs;
 | 
			
		||||
 | 
			
		||||
	public Discussion(String name){
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Discussion(String name, User user){
 | 
			
		||||
		this.name = name;
 | 
			
		||||
		this.members = List.of(user);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void addMessage(Message msg){
 | 
			
		||||
		msg.setDiscussion(this);
 | 
			
		||||
		msgs.add(msg);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    public void addMember(User user) {
 | 
			
		||||
		members.add(user);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void delMember(User user) {
 | 
			
		||||
		members.remove(user);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,66 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables.Msg;
 | 
			
		||||
 | 
			
		||||
/******************************************************
 | 
			
		||||
 * @file Message.java
 | 
			
		||||
 * @author Anthony Debucquoy
 | 
			
		||||
 * @scope Extension messagerie
 | 
			
		||||
 *
 | 
			
		||||
 * Represent a message sent to a discussion
 | 
			
		||||
 ******************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import org.hibernate.annotations.CreationTimestamp;
 | 
			
		||||
import org.hibernate.annotations.UpdateTimestamp;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonIgnore;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.CascadeType;
 | 
			
		||||
import jakarta.persistence.Column;
 | 
			
		||||
import jakarta.persistence.Entity;
 | 
			
		||||
import jakarta.persistence.GeneratedValue;
 | 
			
		||||
import jakarta.persistence.GenerationType;
 | 
			
		||||
import jakarta.persistence.Id;
 | 
			
		||||
import jakarta.persistence.ManyToOne;
 | 
			
		||||
import jakarta.persistence.OneToMany;
 | 
			
		||||
import jakarta.persistence.OneToOne;
 | 
			
		||||
import jakarta.persistence.PrePersist;
 | 
			
		||||
import jakarta.persistence.Temporal;
 | 
			
		||||
import jakarta.persistence.TemporalType;
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.Setter;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.User;
 | 
			
		||||
 | 
			
		||||
@Getter
 | 
			
		||||
@Setter
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
@Entity
 | 
			
		||||
public class Message {
 | 
			
		||||
	
 | 
			
		||||
	@Id
 | 
			
		||||
	@GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
	private long id;
 | 
			
		||||
	private String content; 
 | 
			
		||||
 | 
			
		||||
	@CreationTimestamp
 | 
			
		||||
	@Column(nullable = false)
 | 
			
		||||
	private Date created;
 | 
			
		||||
 | 
			
		||||
	@ManyToOne
 | 
			
		||||
	private User author;
 | 
			
		||||
 | 
			
		||||
	public User getAuthor() {
 | 
			
		||||
        return author;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @OneToOne
 | 
			
		||||
	private Message response;
 | 
			
		||||
 | 
			
		||||
	@ManyToOne(optional = false)
 | 
			
		||||
	@JsonIgnore
 | 
			
		||||
	private Discussion discussion;
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,78 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables;
 | 
			
		||||
 | 
			
		||||
import jakarta.persistence.*;
 | 
			
		||||
import org.hibernate.annotations.OnDelete;
 | 
			
		||||
import org.hibernate.annotations.OnDeleteAction;
 | 
			
		||||
 | 
			
		||||
@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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,46 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables;
 | 
			
		||||
 | 
			
		||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
 | 
			
		||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
 | 
			
		||||
import org.hibernate.id.IdentifierGenerator;
 | 
			
		||||
 | 
			
		||||
import java.sql.*;
 | 
			
		||||
import java.util.Calendar;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.GregorianCalendar;
 | 
			
		||||
 | 
			
		||||
public class RegNoGenerator implements IdentifierGenerator {
 | 
			
		||||
    private static int count = 0;
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object generate(SharedSessionContractImplementor session, Object object) {
 | 
			
		||||
        try{
 | 
			
		||||
            JdbcConnectionAccess jdbccon = session.getJdbcConnectionAccess();
 | 
			
		||||
            Connection conn = jdbccon.obtainConnection();
 | 
			
		||||
 | 
			
		||||
            Statement statement = conn.createStatement();
 | 
			
		||||
 | 
			
		||||
            Calendar c = new GregorianCalendar();
 | 
			
		||||
            int y = c.get(Calendar.YEAR);
 | 
			
		||||
            String query = "select count(reg_no) + "+count+" from Users where reg_no/10000 = " + y%1000;
 | 
			
		||||
 | 
			
		||||
            ResultSet set = statement.executeQuery(query);
 | 
			
		||||
            long resp = 0;
 | 
			
		||||
            if(set.next()){
 | 
			
		||||
                resp = set.getLong(1)+((y%1000)*10000);
 | 
			
		||||
                count += 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            conn.close();
 | 
			
		||||
            statement.close();
 | 
			
		||||
 | 
			
		||||
            return resp;
 | 
			
		||||
 | 
			
		||||
        } catch (SQLException e) {
 | 
			
		||||
            throw new RuntimeException(e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void resetCount(){
 | 
			
		||||
        count = 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -3,6 +3,5 @@ package ovh.herisson.Clyde.Tables;
 | 
			
		||||
public enum RequestState {
 | 
			
		||||
    Accepted,
 | 
			
		||||
    Refused,
 | 
			
		||||
    Pending,
 | 
			
		||||
    Unrequired
 | 
			
		||||
    Pending
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,22 +1,14 @@
 | 
			
		||||
package ovh.herisson.Clyde.Tables;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonIgnore;
 | 
			
		||||
import jakarta.persistence.*;
 | 
			
		||||
import org.hibernate.annotations.OnDelete;
 | 
			
		||||
import org.hibernate.annotations.OnDeleteAction;
 | 
			
		||||
import org.hibernate.annotations.GenericGenerator;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
 | 
			
		||||
import ovh.herisson.Clyde.Tables.Msg.Message;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
@Table(name = "Users")
 | 
			
		||||
public class User {
 | 
			
		||||
    @Id
 | 
			
		||||
    @GenericGenerator(name = "userGen", type = ovh.herisson.Clyde.Tables.RegNoGenerator.class)
 | 
			
		||||
    @GeneratedValue(generator = "userGen")
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private Long regNo;
 | 
			
		||||
    private String lastName;
 | 
			
		||||
    private String firstName;
 | 
			
		||||
@ -26,19 +18,8 @@ public class User {
 | 
			
		||||
    private String country;
 | 
			
		||||
    private Date birthDate;
 | 
			
		||||
    private String profilePictureUrl;
 | 
			
		||||
    private Role role;
 | 
			
		||||
 | 
			
		||||
	@JsonIgnore
 | 
			
		||||
    private ovh.herisson.Clyde.Tables.Role role;
 | 
			
		||||
    private String password;
 | 
			
		||||
 | 
			
		||||
	////// Extension Messagerie /////
 | 
			
		||||
	@OneToMany(mappedBy = "author", cascade = CascadeType.ALL)
 | 
			
		||||
	private List<Message> msgs;
 | 
			
		||||
	/////////////////////////////////
 | 
			
		||||
 | 
			
		||||
	@ManyToMany( mappedBy = "members" )
 | 
			
		||||
	private List<Discussion> discussions;
 | 
			
		||||
 | 
			
		||||
    public User(String lastName, String firstName, String email, String address,
 | 
			
		||||
                String country, Date birthDate, String profilePictureUrl, Role role, String password)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -21,16 +21,9 @@ public class UserCurriculum {
 | 
			
		||||
    @OnDelete(action = OnDeleteAction.CASCADE)
 | 
			
		||||
    private Curriculum curriculum;
 | 
			
		||||
 | 
			
		||||
    private 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){
 | 
			
		||||
    public UserCurriculum(User user, Curriculum curriculum){
 | 
			
		||||
        this.user = user;
 | 
			
		||||
        this.curriculum = curriculum;
 | 
			
		||||
        this.year = year;
 | 
			
		||||
        this.actual = actual;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public UserCurriculum() {}
 | 
			
		||||
@ -54,20 +47,4 @@ public class UserCurriculum {
 | 
			
		||||
    public void setCurriculum(Curriculum curriculum) {
 | 
			
		||||
        this.curriculum = curriculum;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getYear() {
 | 
			
		||||
        return year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setYear(int year) {
 | 
			
		||||
        this.year = year;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setActual(boolean actual) {
 | 
			
		||||
        this.actual = actual;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isActual() {
 | 
			
		||||
        return actual;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,3 @@
 | 
			
		||||
spring.jpa.hibernate.ddl-auto=create-drop
 | 
			
		||||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
 | 
			
		||||
spring.sql.init.mode=always
 | 
			
		||||
 | 
			
		||||
# spring.datasource.url=jdbc:postgresql://localhost:5442/clyde
 | 
			
		||||
spring.datasource.url=jdbc:postgresql://db:5432/clyde
 | 
			
		||||
spring.datasource.username=devel
 | 
			
		||||
spring.datasource.password=devel
 | 
			
		||||
 | 
			
		||||
# spring.config.activate.on-profile=prod
 | 
			
		||||
# spring.datasource.url=jdbc:postgresql:clyde?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432
 | 
			
		||||
# spring.datasource.username=clyde
 | 
			
		||||
spring.sql.init.mode=always
 | 
			
		||||
@ -24,7 +24,6 @@ public class UserRepoTest {
 | 
			
		||||
 | 
			
		||||
    @BeforeEach
 | 
			
		||||
    public void setup(){
 | 
			
		||||
        userRepo.deleteAll();
 | 
			
		||||
        User herobrine = new User("brine","hero","admin@admin.com","in your WalLs","ShadowsLand", new GregorianCalendar(2005, 4, 3).getTime(), null, Role.Admin,"admin");
 | 
			
		||||
        userRepo.save(herobrine);
 | 
			
		||||
    }
 | 
			
		||||
@ -35,8 +34,8 @@ public class UserRepoTest {
 | 
			
		||||
    }
 | 
			
		||||
    @Test
 | 
			
		||||
    public void usertest(){
 | 
			
		||||
        Assert.assertEquals("brine", userRepo.findByEmail("admin@admin.com").getLastName());
 | 
			
		||||
        Assert.assertTrue(new GregorianCalendar(2005, 4, 3).getTime().equals(userRepo.findByEmail("admin@admin.com").getBirthDate()));
 | 
			
		||||
        Assert.assertEquals("brine", userRepo.findById(1).getLastName());
 | 
			
		||||
        Assert.assertTrue(new GregorianCalendar(2005, 4, 3).getTime().equals(userRepo.findById(1).getBirthDate()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										29
									
								
								compose.yaml
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								compose.yaml
									
									
									
									
									
								
							@ -1,29 +0,0 @@
 | 
			
		||||
services: 
 | 
			
		||||
  db:
 | 
			
		||||
    image: 'postgres:16'
 | 
			
		||||
    environment:
 | 
			
		||||
      - 'POSTGRES_DB=clyde'
 | 
			
		||||
      - 'POSTGRES_USER=devel'
 | 
			
		||||
      - 'POSTGRES_PASSWORD=devel'
 | 
			
		||||
    # Uncomment this to allow connections to the db from outside the container
 | 
			
		||||
    # ports: 
 | 
			
		||||
    #   - '5442:5432'
 | 
			
		||||
  back:
 | 
			
		||||
    build: backend/.
 | 
			
		||||
    ports:
 | 
			
		||||
      - "8080:8080"
 | 
			
		||||
    volumes:
 | 
			
		||||
      - cdn:/backend/cdn
 | 
			
		||||
    ulimits:
 | 
			
		||||
      nofile:
 | 
			
		||||
        soft: 65536
 | 
			
		||||
        hard: 65536
 | 
			
		||||
  front:
 | 
			
		||||
    build: frontend/.
 | 
			
		||||
    volumes:
 | 
			
		||||
      - cdn:/app/front/dist/cdn
 | 
			
		||||
    ports:
 | 
			
		||||
      - "8000:8080"
 | 
			
		||||
 | 
			
		||||
volumes:
 | 
			
		||||
  cdn:
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
# https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app
 | 
			
		||||
FROM node:lts-alpine
 | 
			
		||||
RUN npm install -g http-server
 | 
			
		||||
WORKDIR /app/front
 | 
			
		||||
COPY package*.json ./
 | 
			
		||||
RUN npm install
 | 
			
		||||
COPY . .
 | 
			
		||||
ENV VITE_CLYDE_MODE=container
 | 
			
		||||
RUN npm run build
 | 
			
		||||
EXPOSE 8080
 | 
			
		||||
CMD [ "http-server", "dist" ]
 | 
			
		||||
@ -13,13 +13,6 @@ login.guest.lastpage=Last Page
 | 
			
		||||
login.guest.submit=Submit
 | 
			
		||||
login.guest.birthday=BIRTHDAY
 | 
			
		||||
login.guest.confirm=CONFIRM
 | 
			
		||||
login.guest.browse=Browse...
 | 
			
		||||
login.guest.disclaimer=If you are already registered please connect to your account and use the change cursus/reregister function if not continue here.
 | 
			
		||||
login.guest.identityCard=Identity Card :
 | 
			
		||||
login.guest.attestationdisclaimer=This curriculum requires an entrance exam attestation
 | 
			
		||||
login.guest.formationdisclaimer=Please add your old formations with the associated degree/attestation,your case will be check by a member of the inscription service.
 | 
			
		||||
login.guest.managecareer=Manage your external formations
 | 
			
		||||
login.guest.sendRegReq=Send register request
 | 
			
		||||
login.cPassword=Confirm Password
 | 
			
		||||
login.password=Password
 | 
			
		||||
app.home=Home
 | 
			
		||||
@ -35,7 +28,6 @@ app.language=Language
 | 
			
		||||
app.manage.profile=Manage profile
 | 
			
		||||
app.studentList=Students List
 | 
			
		||||
app.users=Users
 | 
			
		||||
app.payments = Payments
 | 
			
		||||
request.moreInfos=More Infos
 | 
			
		||||
request.accept=Accept
 | 
			
		||||
request.refuse=Refuse
 | 
			
		||||
@ -60,84 +52,3 @@ Curriculum=curriculum
 | 
			
		||||
Credits=Credits
 | 
			
		||||
InscriptionService=I.S.
 | 
			
		||||
faculty=Faculty
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@ -13,13 +13,6 @@ login.guest.lastpage=Derniere Page
 | 
			
		||||
login.guest.submit=Envoyer
 | 
			
		||||
login.guest.birthday=DATE DE NAISSANCE
 | 
			
		||||
login.guest.confirm=CONFIRMER
 | 
			
		||||
login.guest.browse=Parcourir...
 | 
			
		||||
login.guest.disclaimer=Si vous êtes déja inscrits dans cette université veuillez vous connecter a votre compte et utilisez les fonctions changer de cursus/réinscription sinon continuez ici.
 | 
			
		||||
login.guest.identityCard=Carte d'identité :
 | 
			
		||||
login.guest.attestationdisclaimer=Ce cursus requiert une attestation de réussite d'un examen d'entrée
 | 
			
		||||
login.guest.formationdisclaimer=Veuillez ajouter vos formations antérieures en y joignant les attestations/diplomes, votre dossier sera vérifié par un membre du service d'inscription.
 | 
			
		||||
login.guest.managecareer=Gèrer mon parcours extérieur
 | 
			
		||||
login.guest.sendRegReq=Envoyer la demande d'inscription
 | 
			
		||||
login.cPassword=Confirmer mot de passe
 | 
			
		||||
login.password=Mot de passe
 | 
			
		||||
app.home=Home
 | 
			
		||||
@ -35,7 +28,6 @@ app.language=Langue
 | 
			
		||||
app.manage.profile=Gérer le profil
 | 
			
		||||
app.studentList=Liste des étudiants
 | 
			
		||||
app.users=Utilisateurs
 | 
			
		||||
app.payments = Payements
 | 
			
		||||
request.moreInfos=Plus d'Infos
 | 
			
		||||
request.accept=Accepter
 | 
			
		||||
request.refuse=Refuser
 | 
			
		||||
@ -60,84 +52,3 @@ Curriculum=Cursus
 | 
			
		||||
Credits=Credits
 | 
			
		||||
InscriptionService=S.I.
 | 
			
		||||
faculty=Faculté
 | 
			
		||||
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
 | 
			
		||||
@ -32,6 +32,7 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="container">
 | 
			
		||||
 | 
			
		||||
    <div class="topBar">
 | 
			
		||||
      <ul class="horizontal">
 | 
			
		||||
        <li title=home>
 | 
			
		||||
@ -67,6 +68,7 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
                    {{i18n("app.manage.profile")}}
 | 
			
		||||
                  </a>
 | 
			
		||||
                  </div>
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </a></li>
 | 
			
		||||
      </ul>
 | 
			
		||||
@ -96,19 +98,20 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
			height: 100%;
 | 
			
		||||
			width: 100%;
 | 
			
		||||
    display:grid;
 | 
			
		||||
 | 
			
		||||
    grid-template-columns:[firstCol-start]70px[firstCol-end secondCol-start] auto [endCol];
 | 
			
		||||
    grid-template-rows:[firstRow-start] var(--header-size) [firstRow-end secondRow-start] calc(100% - var(--header-size)) [endRow];
 | 
			
		||||
    grid-template-columns:[firstCol-start]70px[firstCol-end secondCol-start]auto[endCol];
 | 
			
		||||
    grid-template-rows:[firstRow-start]61px[firstRow-end secondRow-start] auto [endRow];
 | 
			
		||||
    grid-template-areas:
 | 
			
		||||
    "topBar topBar" 
 | 
			
		||||
    "leftBar page";
 | 
			
		||||
 | 
			
		||||
    row-gap:0px;
 | 
			
		||||
    column-gap:0px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .page {
 | 
			
		||||
    grid-area:page;
 | 
			
		||||
		height: 100%;
 | 
			
		||||
		width: 100%;
 | 
			
		||||
    place-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .topBar{
 | 
			
		||||
@ -151,7 +154,7 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
 | 
			
		||||
	ul.vertical{
 | 
			
		||||
		list-style-type: none;
 | 
			
		||||
		margin-top: var(--header-size);
 | 
			
		||||
		margin-top: 61px;
 | 
			
		||||
    top:0;
 | 
			
		||||
    left:0;
 | 
			
		||||
		padding: 25px 0 0;
 | 
			
		||||
@ -199,7 +202,7 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
    left:0;
 | 
			
		||||
    
 | 
			
		||||
		position: fixed;
 | 
			
		||||
		height:var(--header-size);
 | 
			
		||||
		height:61px;
 | 
			
		||||
		width: 100%;
 | 
			
		||||
		background-color: rgb(24, 24, 24);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										111
									
								
								frontend/src/Apps/Inscription.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								frontend/src/Apps/Inscription.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,111 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import i18n from "@/i18n.js"
 | 
			
		||||
  import {ref} from 'vue'
 | 
			
		||||
  import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
 | 
			
		||||
 | 
			
		||||
  const requests = ref(await getAllRegisters());
 | 
			
		||||
  console.log(requests);
 | 
			
		||||
 | 
			
		||||
  async function upPage(id,review){
 | 
			
		||||
    await validateRegister(id,review);
 | 
			
		||||
    requests.value = await getAllRegisters();
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<template> 
 | 
			
		||||
  <div style='display:flex; justify-content:center; min-width:1140px;' v-for="item of requests">
 | 
			
		||||
  <div class="bodu" v-if="item.state === 'Pending'">
 | 
			
		||||
  <div class="container">
 | 
			
		||||
    <div class="id"><a>{{item.id}}</a></div>
 | 
			
		||||
    <div class="surname"><a>{{item.lastName}}</a></div>
 | 
			
		||||
    <div class="firstname"><a>{{item.firstName}}</a></div>
 | 
			
		||||
    <div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}}</button></div>
 | 
			
		||||
    <div class="accept"><button @click="upPage(item.id,'Accepted')" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
 | 
			
		||||
    <div class="refuse"><button @click="upPage(item.id,'Refused')" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
 | 
			
		||||
  </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
  .container{
 | 
			
		||||
    color:white;
 | 
			
		||||
    height:100px;
 | 
			
		||||
    font-size:20px;
 | 
			
		||||
    display:grid;
 | 
			
		||||
    grid-template-columns:10% 14.2% 19% 14.2% 14.2% 14.2% 14.2%;
 | 
			
		||||
    grid-template-areas:
 | 
			
		||||
    "id type surname firstname infos accept refuse"; 
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  .infos {
 | 
			
		||||
    grid-area:infos;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .accept{
 | 
			
		||||
    grid-area:accept;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .refuse{
 | 
			
		||||
    grid-area:refuse;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .titles {
 | 
			
		||||
    grid-area:titles;
 | 
			
		||||
    background-color:rgb(215,215,215);
 | 
			
		||||
  }
 | 
			
		||||
  .id{
 | 
			
		||||
    grid-area:id;
 | 
			
		||||
    margin-left:40px;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .type{
 | 
			
		||||
    grid-area:type;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .surname{
 | 
			
		||||
    grid-area:surname;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    text-overflow:ellipsis;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .firstname{
 | 
			
		||||
    grid-area:firstname;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    text-overflow:ellipsis;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  button{
 | 
			
		||||
    font-size:15px;
 | 
			
		||||
     height:50px;
 | 
			
		||||
     width:100px;
 | 
			
		||||
    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>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,136 +0,0 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
 | 
			
		||||
import {
 | 
			
		||||
  addUninscReq, editChangeCurrReq, editChangeCurrReqTeacherState,
 | 
			
		||||
  editScholarshipReq,
 | 
			
		||||
  editUnregReq, getChangeCurrReqById,
 | 
			
		||||
  getScholarshipReqById,
 | 
			
		||||
  getUnregisterbyId
 | 
			
		||||
} from "@/rest/requests.js";
 | 
			
		||||
import i18n from "@/i18n.js";
 | 
			
		||||
import {getSelf, 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))
 | 
			
		||||
 | 
			
		||||
const user = await getSelf()
 | 
			
		||||
//0 liste, 1 profil
 | 
			
		||||
const localwindowstate = ref(0);
 | 
			
		||||
 | 
			
		||||
const tag = req.value.user.regNo
 | 
			
		||||
 | 
			
		||||
const windowState = defineModel("windowState")
 | 
			
		||||
 | 
			
		||||
async function uploadandrefreshChangeRequest(state){
 | 
			
		||||
    await editChangeCurrReq(req.value.id, state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function editChangeCurrReqTeacherApproval(state){
 | 
			
		||||
    await editChangeCurrReqTeacherState(req.value.id, state)
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="body" v-if="localwindowstate === 0">
 | 
			
		||||
    <div class="container">
 | 
			
		||||
      <div class="globalInfos">
 | 
			
		||||
        <div class="infosContainer">
 | 
			
		||||
          <div>
 | 
			
		||||
            {{i18n("firstname/name")}} : {{req.user.firstName}} {{req.user.lastName}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{i18n("regNo")}} : {{req.user.regNo}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="req.actualCurriculum !== null">
 | 
			
		||||
            {{i18n("From")}} : Bac {{req.actualCurriculum.year}} {{req.actualCurriculum.option}}
 | 
			
		||||
            {{i18n("To")}} : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-else>
 | 
			
		||||
            {{i18n("WantedCursus")}} : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click="localwindowstate++"> {{ i18n("seeprofile") }} </button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <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%;">{{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 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>
 | 
			
		||||
    <button @click="localwindowstate--;" style="margin-left: 10%">{{ 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>
 | 
			
		||||
@ -1,124 +0,0 @@
 | 
			
		||||
<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>
 | 
			
		||||
@ -1,141 +0,0 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
import i18n from "@/i18n.js"
 | 
			
		||||
import {getSelf, getUser} from '../../rest/Users.js'
 | 
			
		||||
import {getcurriculum} from "@/rest/curriculum.js";
 | 
			
		||||
import {getRegisters} from "@/rest/ServiceInscription.js";
 | 
			
		||||
import {get} from "jsdom/lib/jsdom/named-properties-tracker.js";
 | 
			
		||||
import {getExternalCurriculumByInscrReq} from "@/rest/externalCurriculum.js";
 | 
			
		||||
import {ref} from "vue";
 | 
			
		||||
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
 | 
			
		||||
import {editEquivalenceState} from "@/rest/requests.js";
 | 
			
		||||
 | 
			
		||||
const props = defineProps(['target']);
 | 
			
		||||
const request = await getRegisters(props.target);
 | 
			
		||||
const cursus = await getcurriculum(request.curriculum);
 | 
			
		||||
const user = await getSelf();
 | 
			
		||||
const list = ref(false);
 | 
			
		||||
const externalCurriculum = await getExternalCurriculumByInscrReq(request.id)
 | 
			
		||||
 | 
			
		||||
//Get the parent page windowState to display the correct button
 | 
			
		||||
const windowState = defineModel("windowState")
 | 
			
		||||
function getPP(){
 | 
			
		||||
  if(request.profilePictureUrl === null){
 | 
			
		||||
    return "/Clyde.png"
 | 
			
		||||
  }
 | 
			
		||||
  return request.profilePictureUrl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function editEquivalence(id, newstate){
 | 
			
		||||
  await editEquivalenceState(id, newstate)
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="body" v-if="list == false" style="margin-top: 10%;">
 | 
			
		||||
    <div class="container">
 | 
			
		||||
      <div class="profilPic">
 | 
			
		||||
        <img class="subContainter" :src=getPP()>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class = "globalInfos">
 | 
			
		||||
        <div class="infosContainer">
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("firstname/name") }} : {{request.firstName}} {{request.lastName}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.email") }}: {{request.email}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.address") }} : {{request.address}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.country") }} : {{request.country}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.birthday") }} : {{request.birthDate}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ 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 v-if="cursus.year > 1">
 | 
			
		||||
            <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 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">
 | 
			
		||||
    <ExternalCurriculumList :ext-curr-list="externalCurriculum" :mode="0"></ExternalCurriculumList>
 | 
			
		||||
    <div style="margin-left: 15%;margin-top: 5%;">
 | 
			
		||||
      <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%" 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">Back</button>
 | 
			
		||||
    </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{
 | 
			
		||||
  grid-area:profilPic;
 | 
			
		||||
  width:100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.globalInfos {
 | 
			
		||||
  grid-area:globalInfos;
 | 
			
		||||
  align-self :center;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.body {
 | 
			
		||||
  min-width:960px;
 | 
			
		||||
  width:100%;
 | 
			
		||||
  display:flex;
 | 
			
		||||
  align-items:center;
 | 
			
		||||
  justify-content:center;
 | 
			
		||||
  margin-top:5%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.subContainter{
 | 
			
		||||
  width:100%;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
  border-radius:20px;
 | 
			
		||||
  border:4px solid black;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.infosContainer {
 | 
			
		||||
  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>
 | 
			
		||||
@ -1,132 +0,0 @@
 | 
			
		||||
<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>
 | 
			
		||||
            {{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.email") }}: {{user.email}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.address") }} : {{user.address}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.country") }} : {{user.country}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.birthday") }} : {{user.birthDate.slice(0,10)}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click="">{{ i18n("dltaxdoc") }}</button>
 | 
			
		||||
            <button style="margin-left: 2%">{{ i18n("dlresidency") }}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="req.state == 'Pending'" style="margin-top: 2%; margin-bottom: 2%;">
 | 
			
		||||
            {{i18n("enteramount")}}
 | 
			
		||||
            <input type="number" v-model="scholarshipData.amount">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <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%;">{{i18n("request.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:10%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.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>
 | 
			
		||||
@ -1,206 +0,0 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import i18n from "@/i18n.js"
 | 
			
		||||
  import {getSelf, getUser} from '../../rest/Users.js'
 | 
			
		||||
  import {getSomeonesCurriculumList} from "@/rest/curriculum.js";
 | 
			
		||||
  import {ref} from "vue";
 | 
			
		||||
  import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
 | 
			
		||||
  import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
 | 
			
		||||
  import {getUserActualCourses} from "@/rest/courses.js";
 | 
			
		||||
 | 
			
		||||
  const props = defineProps(['target'])
 | 
			
		||||
  const user = await getUser(props.target)
 | 
			
		||||
  const UserCurriculum = await getSomeonesCurriculumList(props.target)
 | 
			
		||||
  const externalcurrlist = await getExternalCurriculumByUser(user.regNo)
 | 
			
		||||
  const extercurrlist = ref(false)
 | 
			
		||||
 | 
			
		||||
  const courselist = await getUserActualCourses(user.regNo)
 | 
			
		||||
  console.log(courselist)
 | 
			
		||||
 | 
			
		||||
  const watchingUser = await getSelf()
 | 
			
		||||
  function getPP(){
 | 
			
		||||
    if(user.profilePictureUrl === null){
 | 
			
		||||
      return "/Clyde.png"
 | 
			
		||||
    }
 | 
			
		||||
    return user.profilePictureUrl
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //Cette function renvoie l'année académique concernée si on est dans l'année 2023-2024 elle renvoie 2023
 | 
			
		||||
  //car dans la db l'année scolaire 2023-2024 est representée juste par 2023 (le même système s'applique pour chaque années on prend la borne inférieure
 | 
			
		||||
  function getYear(){
 | 
			
		||||
    let date = new Date();
 | 
			
		||||
    if (date.getMonth() <= 6){
 | 
			
		||||
      return date.getFullYear()-1
 | 
			
		||||
    }
 | 
			
		||||
    return date.getFullYear()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="body" v-if="extercurrlist==false">
 | 
			
		||||
    <div class="container">
 | 
			
		||||
      <div class="profilPic">
 | 
			
		||||
        <img class="subContainter" :src=getPP()>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class = "globalInfos">
 | 
			
		||||
        <div class="infosContainer">
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.email") }}: {{user.email}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.address") }} : {{user.address}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.country") }} : {{user.country}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.birthday") }} : {{user.birthDate}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <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 class="moreInfos" style="margin-top: 15%">
 | 
			
		||||
        <div class = "oldcursus">
 | 
			
		||||
          <div class="listTitle">
 | 
			
		||||
            {{ i18n("oldcursus") }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div  class="listElement">
 | 
			
		||||
            <div class=" containerElement" v-for="item in UserCurriculum.curriculumList">
 | 
			
		||||
              <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="dateyear" v-if="item.actual === false">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="newcursus">
 | 
			
		||||
          <div class="listTitle">
 | 
			
		||||
            {{ i18n("newcursus") }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div  class="listElement">
 | 
			
		||||
            <div class=" containerElement" v-for="item in UserCurriculum.curriculumList" >
 | 
			
		||||
                <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="dateyear" v-if="item.actual === true">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="extercurrlist==true">
 | 
			
		||||
      <ExternalCurriculumList :ext-curr-list="externalcurrlist" :mode="1"></ExternalCurriculumList>
 | 
			
		||||
  </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";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.profilPic{
 | 
			
		||||
  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:5%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.subContainter{
 | 
			
		||||
  width:100%;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
  border-radius:20px;
 | 
			
		||||
  border:4px solid black;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.infosContainer {
 | 
			
		||||
  padding-bottom:50px;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  font-size:25px;
 | 
			
		||||
  color:white;
 | 
			
		||||
  padding:20px;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
  border-radius:20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.moreInfos {
 | 
			
		||||
  display:inline-grid;
 | 
			
		||||
  column-gap:50px;
 | 
			
		||||
  grid-template-areas:
 | 
			
		||||
  "oldcursus newcursus";
 | 
			
		||||
  grid-template-columns:600px 600px;
 | 
			
		||||
  align-items:center;
 | 
			
		||||
  justify-content:center;
 | 
			
		||||
  margin-left: 320%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.listTitle{
 | 
			
		||||
  display: flex;
 | 
			
		||||
  justify-content: center;
 | 
			
		||||
  align-items: center;
 | 
			
		||||
  width:250px;
 | 
			
		||||
  margin-left:auto;
 | 
			
		||||
  margin-right:auto;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  font-size:25px;
 | 
			
		||||
  color:white;
 | 
			
		||||
  padding:20px;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
  border-radius:20px;margin-bottom:10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.listElement{
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  font-size:25px;
 | 
			
		||||
  color:white;
 | 
			
		||||
  padding:20px;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
  border-radius:20px;
 | 
			
		||||
  margin-bottom:10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.containerElement{
 | 
			
		||||
  justify-content:center;
 | 
			
		||||
  display:grid;
 | 
			
		||||
  grid-template-columns:100px 100px 300px;
 | 
			
		||||
  grid-template-areas:
 | 
			
		||||
    "year option dateyear";
 | 
			
		||||
  column-gap:40px;
 | 
			
		||||
  padding-left: 25px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button{
 | 
			
		||||
  border:none;
 | 
			
		||||
  background-color:rgb(239, 60, 168);
 | 
			
		||||
  border-radius:10px;
 | 
			
		||||
  height:35px;
 | 
			
		||||
  margin-top:10px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@ -1,109 +0,0 @@
 | 
			
		||||
<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>
 | 
			
		||||
            {{ i18n("firstname/name") }} : {{req.firstName}} {{req.lastName}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.email") }}: {{req.email}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("regNo") }} : {{req.regNo}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("reason") }}
 | 
			
		||||
            <input type="text" v-model="req.reason" readonly/>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <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%;">{{i18n("request.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>
 | 
			
		||||
@ -1,170 +0,0 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
 | 
			
		||||
import {reactive, ref} from "vue";
 | 
			
		||||
import i18n from "@/i18n.js";
 | 
			
		||||
import {getCourse} from "@/rest/courses.js";
 | 
			
		||||
import {getcurriculum} from "@/rest/curriculum.js";
 | 
			
		||||
import {uploadFile, uploadProfilePicture} from "@/rest/uploads.js";
 | 
			
		||||
import {createExemptionsRequest, getExempByUser} from "@/rest/requests.js";
 | 
			
		||||
import {getSelf} from "@/rest/Users.js";
 | 
			
		||||
 | 
			
		||||
const props = defineProps(["cursuslist"])
 | 
			
		||||
const selectedCurriculum = ref(props.cursuslist[0])
 | 
			
		||||
const user = await getSelf()
 | 
			
		||||
 | 
			
		||||
const windowState = defineModel("windowState")
 | 
			
		||||
const exempList = await getExempByUser(user.regNo)
 | 
			
		||||
 | 
			
		||||
const courseslist = ref(await getcurriculum(selectedCurriculum.value.curriculumId))
 | 
			
		||||
const list = ref(true)
 | 
			
		||||
 | 
			
		||||
const ppData = ref({})
 | 
			
		||||
async function updateCourseList(){
 | 
			
		||||
  courseslist.value = await getcurriculum(selectedCurriculum.value.curriculumId)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function postExemptionRequest(file, type){
 | 
			
		||||
  const a = await uploadFile(file, type);
 | 
			
		||||
  exemptReq.justifDocument = a.url
 | 
			
		||||
  await createExemptionsRequest(exemptReq)
 | 
			
		||||
}
 | 
			
		||||
const exemptReq = reactive({
 | 
			
		||||
  userRegNo : user.regNo,
 | 
			
		||||
  courseId : null,
 | 
			
		||||
  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>
 | 
			
		||||
 | 
			
		||||
<template style="margin-top:5%;">
 | 
			
		||||
  <div v-if="list == true">
 | 
			
		||||
    <span>{{i18n("selectedcursus")}} :   </span>
 | 
			
		||||
    <select v-model="selectedCurriculum" @change="updateCourseList">
 | 
			
		||||
      <option v-for="item in props.cursuslist" :value="item">Bac {{item.year}} {{item.option}}</option>
 | 
			
		||||
    </select>
 | 
			
		||||
    <div style="display:flex; justify-content:center;" v-for="item in courseslist.courses">
 | 
			
		||||
      <div class="bodu">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
          <div class="title">{{item.title}}</div>
 | 
			
		||||
          <div class="firstname">{{item.owner.firstName}}</div>
 | 
			
		||||
          <div class="lastname">{{item.owner.lastName}}</div>
 | 
			
		||||
          <div class="credits">credits : {{item.credits}}</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>
 | 
			
		||||
      <button @click="windowState = 0">{{ i18n("courses.back")}}</button>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="list === false" class="infosContainer">
 | 
			
		||||
      <p>{{ i18n("uploadjustifdoc") }} </p>
 | 
			
		||||
    <div>
 | 
			
		||||
    <label class="browser">
 | 
			
		||||
      <input  type="file" @change="ppData.value = $event.target.files" accept="image/*" ref="filepath">
 | 
			
		||||
    </label>
 | 
			
		||||
    </div>
 | 
			
		||||
    <button style="margin-top: 3%" @click="postExemptionRequest(ppData.value, 'JustificationDocument');">
 | 
			
		||||
      {{ i18n("subexemreq") }}
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="list === false">
 | 
			
		||||
    <button @click="list=!list">{{ i18n("courses.back") }}</button>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.container{
 | 
			
		||||
  color:white;
 | 
			
		||||
  height:100px;
 | 
			
		||||
  font-size:30px;
 | 
			
		||||
  display:grid;
 | 
			
		||||
  grid-template-columns:30% 20% 15% 15% 15%;
 | 
			
		||||
  grid-template-areas:"title firstname lastname credits askexemption";
 | 
			
		||||
  column-gap:10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.title {
 | 
			
		||||
  grid-area:title;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
  font-size: 50%;
 | 
			
		||||
  margin-left:30px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.credits {
 | 
			
		||||
  grid-area:credits;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
  font-size: 50%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.askexemption {
 | 
			
		||||
  grid-area:askexemption;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
}
 | 
			
		||||
.lastname{
 | 
			
		||||
  grid-area:lastname;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
  font-size: 50%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.firstname{
 | 
			
		||||
  grid-area:firstname;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
  font-size: 50%;
 | 
			
		||||
  padding-left: 30%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.bodu {
 | 
			
		||||
  margin-top:2%;
 | 
			
		||||
  width:100%;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  border-radius:9px;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button{
 | 
			
		||||
  border:none;
 | 
			
		||||
  background-color:rgb(239, 60, 168);
 | 
			
		||||
  border-radius:10px;
 | 
			
		||||
  height:35px;
 | 
			
		||||
  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>
 | 
			
		||||
 | 
			
		||||
@ -1,242 +0,0 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import i18n from "@/i18n.js";
 | 
			
		||||
  import {reactive, ref} from "vue";
 | 
			
		||||
  import {getSelf} from "@/rest/Users.js";
 | 
			
		||||
  import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
 | 
			
		||||
  import {uploadFile} from "@/rest/uploads.js";
 | 
			
		||||
 | 
			
		||||
  //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user, 2 inscription procedure
 | 
			
		||||
  const props = defineProps(["extCurrList", "mode"])
 | 
			
		||||
 | 
			
		||||
  //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 list = ref(true)
 | 
			
		||||
  const editmode = ref(false)
 | 
			
		||||
  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
 | 
			
		||||
  }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(){
 | 
			
		||||
    if (props.mode === 1){
 | 
			
		||||
      const temp = await uploadFile(externalCurr.justifdocUrl, "JustificationDocument")
 | 
			
		||||
      await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, temp.url, externalCurr.userRegNo);
 | 
			
		||||
      //We refresh the list
 | 
			
		||||
      extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo);
 | 
			
		||||
      list.value = !list.value;
 | 
			
		||||
    }else if (props.mode === 2){
 | 
			
		||||
      externalCurrTab.value.push({
 | 
			
		||||
        inscriptionRequestId : externalCurr.inscriptionRequestId,
 | 
			
		||||
          school:externalCurr.school,
 | 
			
		||||
          formation :externalCurr.formation,
 | 
			
		||||
          completion : externalCurr.completion,
 | 
			
		||||
          startYear : externalCurr.startYear,
 | 
			
		||||
          endYear: externalCurr.endYear,
 | 
			
		||||
          justifdocUrl : externalCurr.justifdocUrl,
 | 
			
		||||
          userRegNo : externalCurr.userRegNo
 | 
			
		||||
      });
 | 
			
		||||
      extCurrList.value = externalCurrTab.value
 | 
			
		||||
      list.value = !list.value;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template style="margin-top:5%;">
 | 
			
		||||
  <div v-if="list">
 | 
			
		||||
    <div v-if="props.mode === 2||User.regNo === externalCurr.userRegNo" style="margin-left: 2%;margin-top: 2%">
 | 
			
		||||
      <button @click="list = !list" style="margin-left:15%;">{{ i18n("addextcurr") }}</button>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div style="display:flex; justify-content:center;" v-for="(item, index) in extCurrList">
 | 
			
		||||
      <div class="bodu">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
          <div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
 | 
			
		||||
          <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>{{ 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 v-else class="loginbox" style="margin-left: 35%; margin-top: 3%">
 | 
			
		||||
    <form class="form">
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>{{ i18n("school") }}</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>{{i18n("checkifnotcompleted")}}</p>
 | 
			
		||||
        <input v-model="notcompletedCheck" type="checkbox" id="checkboxformation">
 | 
			
		||||
        <div v-if="notcompletedCheck">
 | 
			
		||||
          <p>{{i18n("wichyearstop")}}</p>
 | 
			
		||||
          <input type="text" v-model="externalCurr.completion">
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>{{ i18n("startyear") }}</p>
 | 
			
		||||
        <input type="number" v-model="externalCurr.startYear">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>{{ i18n("endyear") }}</p>
 | 
			
		||||
        <input type="number" v-model="externalCurr.endYear">
 | 
			
		||||
      </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%">
 | 
			
		||||
        <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>
 | 
			
		||||
    </form>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.container{
 | 
			
		||||
  color:white;
 | 
			
		||||
  height:100px;
 | 
			
		||||
  font-size:30px;
 | 
			
		||||
  display:grid;
 | 
			
		||||
  grid-template-columns:5% 10% 20% 15% 20% 10%;
 | 
			
		||||
  grid-template-areas:
 | 
			
		||||
    "status school formation completion download edit delete";
 | 
			
		||||
  column-gap:10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.status {
 | 
			
		||||
  grid-area:status;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  font-size: 70%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.edit{
 | 
			
		||||
  grid-area: edit;
 | 
			
		||||
  align-self: center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.delete{
 | 
			
		||||
  grid-area: delete;
 | 
			
		||||
  align-self: center;
 | 
			
		||||
}
 | 
			
		||||
.school{
 | 
			
		||||
  grid-area:school;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  font-size: 70%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.formation{
 | 
			
		||||
  grid-area:formation;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  font-size: 70%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.completion{
 | 
			
		||||
  grid-area:completion;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
  white-space: nowrap;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
  font-size: 70%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.download{
 | 
			
		||||
  grid-area: download;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.bodu {
 | 
			
		||||
  margin-top:2%;
 | 
			
		||||
  width:66%;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  border-radius:9px;
 | 
			
		||||
  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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button{
 | 
			
		||||
  border:none;
 | 
			
		||||
  background-color:rgb(239, 60, 168);
 | 
			
		||||
  border-radius:10px;
 | 
			
		||||
  height:35px;
 | 
			
		||||
  margin-top:10px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
@ -1,259 +0,0 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import i18n from "@/i18n.js"
 | 
			
		||||
  import {ref, vModelSelect, watch} from 'vue'
 | 
			
		||||
  import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
 | 
			
		||||
  import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
 | 
			
		||||
  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";
 | 
			
		||||
  import AboutExemption from "@/Apps/Inscription/AboutExemption.vue";
 | 
			
		||||
  import {getSelf} from "@/rest/Users.js";
 | 
			
		||||
 | 
			
		||||
  const requests = ref(await getAllRegisters());
 | 
			
		||||
  let targetId = "";
 | 
			
		||||
  const user = await getSelf()
 | 
			
		||||
  const requestType = ref("inscription");
 | 
			
		||||
  const filterType = ref("None");
 | 
			
		||||
 | 
			
		||||
  //0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister, 5 = manage curriculum change, 6 = manage exemptions
 | 
			
		||||
  const windowsState = ref(0);
 | 
			
		||||
 | 
			
		||||
  async function upPage(id,review){
 | 
			
		||||
    await validateRegister(id,review);
 | 
			
		||||
 | 
			
		||||
    requests.value = await getAllRegisters();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async function loadRequests(){
 | 
			
		||||
    switch (requestType.value){
 | 
			
		||||
      case i18n("inscription"):
 | 
			
		||||
        requests.value = await getAllRegisters();
 | 
			
		||||
        break;
 | 
			
		||||
      case i18n("scholarship"):
 | 
			
		||||
        requests.value = await getAllScholarShipsRequest();
 | 
			
		||||
        break;
 | 
			
		||||
      case i18n("exemption"):
 | 
			
		||||
        requests.value = await getAllExemptionsRequest();
 | 
			
		||||
        break;
 | 
			
		||||
      case i18n("unregister"):
 | 
			
		||||
        requests.value = await getAllUnregisters();
 | 
			
		||||
        break;
 | 
			
		||||
      case i18n("curriculumch"):
 | 
			
		||||
        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>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div v-if="windowsState === 1">
 | 
			
		||||
    <AboutRequest :target="targetId" v-model:window-state="windowsState"></AboutRequest>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="windowsState === 0">
 | 
			
		||||
    <div style="margin-top: 2%;margin-left: 2%">
 | 
			
		||||
      <span>{{ i18n("reqtype") }} :   </span>
 | 
			
		||||
      <select v-model="requestType" @change="loadRequests()">
 | 
			
		||||
        <option>{{ i18n("inscription") }}</option>
 | 
			
		||||
        <option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">{{ i18n("scholarship") }}</option>
 | 
			
		||||
        <option v-if="user.role === 'Admin' || user.role === 'Teacher'">{{ i18n("exemption") }}</option>
 | 
			
		||||
        <option v-if="user.role === 'Admin' || user.role === 'InscriptionService'">{{ i18n("unregister") }}</option>
 | 
			
		||||
        <option>{{ i18n("curriculumch") }}</option>
 | 
			
		||||
      </select>
 | 
			
		||||
      <span style="margin-left: 5%">
 | 
			
		||||
        {{ i18n("filter") }}
 | 
			
		||||
        <select v-model="filterType">
 | 
			
		||||
          <option>None</option>
 | 
			
		||||
          <option>Pending</option>
 | 
			
		||||
          <option>Accepted</option>
 | 
			
		||||
          <option>Refused</option>
 | 
			
		||||
      </select>
 | 
			
		||||
      </span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div style='display:flex; justify-content:center; min-width:1140px;' v-for="item of requests">
 | 
			
		||||
      <div class="bodu" style="width: 95%" v-if="(filterType == 'None' || filterType == item.state) && 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 === i18n('inscription')">
 | 
			
		||||
          <div class="date" v-if="item.submissionDate !== undefined">{{item.submissionDate.slice(0, 10)}}</div>
 | 
			
		||||
          <div class="state" style="font-size: 80%">{{ i18n("approval") }} {{item.state}}</div>
 | 
			
		||||
          <div class="equivalencestate" style="font-size: 80%">{{ i18n("teacherapproval") }} {{item.equivalenceState}}</div>
 | 
			
		||||
          <div class="surname">{{item.lastName}}</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="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>
 | 
			
		||||
        <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="studentfirstname">{{item.user.firstName}}</div>
 | 
			
		||||
          <div class="studentlastname">{{item.user.lastName}}</div>
 | 
			
		||||
          <div class="reqState">{{item.state}}</div>
 | 
			
		||||
          <div class="infos" @click="windowsState = 3; targetId=item.id;"><button>{{ i18n("request.moreInfos") }}</button></div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <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.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">{{ i18n("request.moreInfos") }}</button></div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <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="studentfirstname">{{item.user.firstName}}</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="infos"><button @click="windowsState=6;targetId=item.id">{{ i18n("request.moreInfos") }}</button></div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div style='display:flex; justify-content:center; min-width:1140px;margin-top: 10%' v-if="windowsState === 2">
 | 
			
		||||
    <p>{{ i18n("surreq") }}</p>
 | 
			
		||||
    <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;">{{ i18n("courses.back")}}</button>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="windowsState === 3">
 | 
			
		||||
    <AboutScholarship :req-id="targetId"></AboutScholarship>
 | 
			
		||||
    <div>
 | 
			
		||||
      <button style="margin-left: 31%; margin-top: 5%" @click="windowsState=0">{{ i18n("courses.back")}}</button>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="windowsState === 4">
 | 
			
		||||
    <AboutUnregister :req-id="targetId"></AboutUnregister>
 | 
			
		||||
    <button @click="windowsState=0" style="margin-left: 31%">{{ i18n("courses.back")}}</button>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="windowsState === 5">
 | 
			
		||||
    <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>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
  .container{
 | 
			
		||||
    color:white;
 | 
			
		||||
    height:100px;
 | 
			
		||||
    font-size:20px;
 | 
			
		||||
    display:grid;
 | 
			
		||||
    column-gap:10px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .equivalencestate{
 | 
			
		||||
    grid-area: equivalencestate;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .teacherApproval{
 | 
			
		||||
    grid-area: teacherApproval;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
  .studentfirstname{
 | 
			
		||||
    grid-area: studentfirstname;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .studentlastname{
 | 
			
		||||
    grid-area: studentlastname;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .course{
 | 
			
		||||
    grid-area: course;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
  .reqState{
 | 
			
		||||
    grid-area: reqState;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
  .infos {
 | 
			
		||||
    grid-area:infos;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .accept{
 | 
			
		||||
    grid-area:accept;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .refuse{
 | 
			
		||||
    grid-area:refuse;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .date{
 | 
			
		||||
    grid-area:date;
 | 
			
		||||
    margin-left:40px;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .regno{
 | 
			
		||||
    grid-area: regno;
 | 
			
		||||
    align-self: center;
 | 
			
		||||
  }
 | 
			
		||||
  .state{
 | 
			
		||||
    grid-area:state;
 | 
			
		||||
    margin-left:40px;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .surname{
 | 
			
		||||
    grid-area:surname;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    text-overflow:ellipsis;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .firstname{
 | 
			
		||||
    grid-area:firstname;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    text-overflow:ellipsis;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  button{
 | 
			
		||||
    border:none;
 | 
			
		||||
    background-color:rgb(239, 60, 168);
 | 
			
		||||
    border-radius:10px;
 | 
			
		||||
    height: 35px;
 | 
			
		||||
    margin-top:10px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .bodu {
 | 
			
		||||
    margin-top:2%;
 | 
			
		||||
    width:66%;
 | 
			
		||||
    border:2px solid black;
 | 
			
		||||
    border-radius:9px;
 | 
			
		||||
    background-color:rgb(50,50,50);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,78 +0,0 @@
 | 
			
		||||
<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">{{ i18n("regNo") }} : {{item.studentRegNo}}</a></div>
 | 
			
		||||
        <div class="client"><a>Client : {{item.client}}</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>
 | 
			
		||||
    </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>
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,16 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import {reactive, ref } from 'vue'
 | 
			
		||||
  import i18n from '@/i18n.js'
 | 
			
		||||
  import {login, register, disconnect, isLogged} from '@/rest/Users.js'
 | 
			
		||||
  import {getAllCurriculums, getcurriculum} from '@/rest/curriculum.js'
 | 
			
		||||
  import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js'
 | 
			
		||||
  import { login , register , disconnect, isLogged} from '@/rest/Users.js'
 | 
			
		||||
  import { getAllCurriculums } from '@/rest/curriculum.js'
 | 
			
		||||
  import { uploadProfilePicture } from '@/rest/uploads.js'
 | 
			
		||||
  import {toast} from 'vue3-toastify'
 | 
			
		||||
  import 'vue3-toastify/dist/index.css';
 | 
			
		||||
  import {createExternalCurriculum} from "@/rest/externalCurriculum.js";
 | 
			
		||||
  import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  const loginPage= ref(true)
 | 
			
		||||
  const page = ref(0)
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  const outputs = reactive({
 | 
			
		||||
    surname:null,
 | 
			
		||||
    firstname:null,
 | 
			
		||||
@ -21,20 +20,13 @@
 | 
			
		||||
    address:null,
 | 
			
		||||
    country:null,
 | 
			
		||||
    curriculum:null,
 | 
			
		||||
    equivalenceState: "Unrequired"
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  //Stores some externalCurriculums in order to upload them all at the confirmation of the registration request
 | 
			
		||||
  const externalCurrTab = ref([]);
 | 
			
		||||
 | 
			
		||||
  const submitValue= ref(i18n("login.guest.submit"))
 | 
			
		||||
  const passwordConfirm=ref("")
 | 
			
		||||
 
 | 
			
		||||
  const imageSaved = ref(false)
 | 
			
		||||
  let ppData = ""
 | 
			
		||||
 | 
			
		||||
  const idcardfile = ref({})
 | 
			
		||||
  const justifcardfile = ref({})
 | 
			
		||||
  const ppData = ref(false)
 | 
			
		||||
 | 
			
		||||
  const curricula= await getAllCurriculums();
 | 
			
		||||
  
 | 
			
		||||
@ -42,7 +34,7 @@
 | 
			
		||||
    setTimeout(() => {
 | 
			
		||||
      window.location.href="#/home";
 | 
			
		||||
      }, "500");
 | 
			
		||||
  }
 | 
			
		||||
 } 
 | 
			
		||||
  function verifyInputs(pass){
 | 
			
		||||
    if(pass==passwordConfirm.value){
 | 
			
		||||
      page.value++;
 | 
			
		||||
@ -58,50 +50,14 @@
 | 
			
		||||
  disconnect();
 | 
			
		||||
  window.location.reload();}
 | 
			
		||||
 | 
			
		||||
  async function uploadPP(arg){
 | 
			
		||||
    const data = await uploadProfilePicture(arg);
 | 
			
		||||
    ppData = data.url;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //This functions makes the distinction between a master cursus (year 4 or more) and a bachelor cursus (year 3 or less)
 | 
			
		||||
  function getCursusDisplay(cursus){
 | 
			
		||||
    if (cursus.year <= 3){
 | 
			
		||||
      return "BAB " + cursus.year + " " + cursus.option;
 | 
			
		||||
    }else{
 | 
			
		||||
      return "MA" + (parseInt(cursus.year)-3).toString() + " " + cursus.option;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //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(){
 | 
			
		||||
    //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){
 | 
			
		||||
      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);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="setup" v-if="page !== 4">
 | 
			
		||||
      <div v-if="loginPage">
 | 
			
		||||
    <div class="setup">
 | 
			
		||||
        <div v-if="loginPage">
 | 
			
		||||
      <div class='loginBox' style="margin-top:30%;">
 | 
			
		||||
          <form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form">
 | 
			
		||||
            <h1 style="color:rgb(239,60,168); font-family: sans-serif;">
 | 
			
		||||
@ -119,7 +75,7 @@
 | 
			
		||||
              <a @click="loginPage=!loginPage">{{i18n("login.guest.register")}}</a>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="inputBox" style="margin-bottom:35px;">
 | 
			
		||||
              <input v-model="submitValue" type="submit">
 | 
			
		||||
              <input type="submit" v-model="submitValue">
 | 
			
		||||
            </div>
 | 
			
		||||
          </form>
 | 
			
		||||
        </div>
 | 
			
		||||
@ -160,7 +116,7 @@
 | 
			
		||||
                <a>{{i18n("login.guest.alregister")}}</a>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-if="page === 1">
 | 
			
		||||
            <div v-else>
 | 
			
		||||
              <div class="inputBox">
 | 
			
		||||
                <p>{{i18n("login.guest.email")}}</p>
 | 
			
		||||
                <input type="mail" v-model="outputs.email">
 | 
			
		||||
@ -173,28 +129,23 @@
 | 
			
		||||
                <p>{{i18n("login.guest.country")}}</p>
 | 
			
		||||
                <input type="text" v-model="outputs.country">
 | 
			
		||||
              </div>
 | 
			
		||||
              <form class="inputBox" novalidate enctype="multipart/form-data">
 | 
			
		||||
              <form class="inputBox"novalidate enctype="multipart/form-data">
 | 
			
		||||
              	<p>{{i18n("profile.picture").toUpperCase()}}</p>
 | 
			
		||||
              </form>
 | 
			
		||||
              <label class="browser">
 | 
			
		||||
                {{i18n("login.guest.browse")}}
 | 
			
		||||
                Parcourir . . .
 | 
			
		||||
				        <input  type="file" :disabled="imageSaved" @change="ppData = uploadProfilePicture($event.target.files); imageSaved = true;" accept="image/*">
 | 
			
		||||
              </label>
 | 
			
		||||
              <form novalidate enctype="multipart/form-data" class="inputBox">
 | 
			
		||||
				        <input type="file" @change="uploadPP($event.target.files); imageSaved = true;" accept="image/*">
 | 
			
		||||
              </form>
 | 
			
		||||
              <div class="inputBox">
 | 
			
		||||
                <p>{{i18n("Curriculum").toUpperCase()}}</p> 
 | 
			
		||||
                  <select v-model="outputs.curriculum">
 | 
			
		||||
                    <option v-for="item in curricula" :value="item.curriculumId">{{getCursusDisplay(item)}}</option>
 | 
			
		||||
                    <option v-for="item in curricula">{{item.curriculumId}}</option>
 | 
			
		||||
                    
 | 
			
		||||
                  </select>
 | 
			
		||||
              </div>
 | 
			
		||||
              <p style="color:rgb(239,60,168);">
 | 
			
		||||
                {{i18n("login.guest.disclaimer")}}
 | 
			
		||||
              </p>
 | 
			
		||||
              <div style="align-self:center;" class="inputBox">
 | 
			
		||||
                <button style="margin-top:25px;" @click="page++;">
 | 
			
		||||
                  {{i18n("login.guest.nextpage")}}
 | 
			
		||||
                <button style="margin-top:25px;" @click="register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData);">
 | 
			
		||||
                  {{i18n("login.guest.submit")}}
 | 
			
		||||
                </button>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div  class="switchpage">
 | 
			
		||||
@ -204,40 +155,10 @@
 | 
			
		||||
                <a>{{i18n("login.guest.alregister")}}</a>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-if="page === 2">
 | 
			
		||||
              <p style="color:rgb(239,60,168);">{{i18n("login.guest.identityCard")}}</p>
 | 
			
		||||
              <label class="browser">
 | 
			
		||||
                {{i18n("login.guest.browse")}}
 | 
			
		||||
                <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 v-if="page === 3">
 | 
			
		||||
              <p style="color:rgb(239,60,168);margin-bottom: 5%">
 | 
			
		||||
                {{i18n("login.guest.formationdisclaimer")}}
 | 
			
		||||
              </p>
 | 
			
		||||
              <button @click="page++">{{i18n("login.guest.managecareer")}}</button>
 | 
			
		||||
              <button @click="postRegisterReq();">{{ i18n("login.guest.sendRegReq") }}</button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </form>
 | 
			
		||||
         </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="page===4">
 | 
			
		||||
    <ExternalCurriculumList v-model="externalCurrTab" :mode="2"></ExternalCurriculumList>
 | 
			
		||||
    <button style="margin-top: 2%;width: 5%; margin-left: 2%" @click="page--">{{i18n("courses.back")}}</button>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
@ -246,18 +167,18 @@
 | 
			
		||||
  margin-left: auto;
 | 
			
		||||
  margin-right:auto;
 | 
			
		||||
  min-width:400px;
 | 
			
		||||
  width:25%;
 | 
			
		||||
  height:50%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  width:25%;
 | 
			
		||||
  height:60%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.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;
 | 
			
		||||
@ -287,6 +208,8 @@
 | 
			
		||||
  z-index: 100;
 | 
			
		||||
  font-family:sans-serif ; 
 | 
			
		||||
  color:rgb(239,60,168);
 | 
			
		||||
  transition:0.5;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.register{
 | 
			
		||||
@ -297,16 +220,9 @@
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.bodu {
 | 
			
		||||
  margin-top:2%;
 | 
			
		||||
  width:50%;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  border-radius:9px;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.switchpage{
 | 
			
		||||
  width:100px;
 | 
			
		||||
  background:rgb(255, 0 255);
 | 
			
		||||
  border: none;
 | 
			
		||||
  padding-right:0;
 | 
			
		||||
  padding-top:10px;
 | 
			
		||||
@ -314,6 +230,8 @@
 | 
			
		||||
  outline:none;
 | 
			
		||||
  border-radius: 4px;
 | 
			
		||||
  font-size:0.8em;
 | 
			
		||||
  align-self:right;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input[type=submit],button,select{
 | 
			
		||||
@ -342,22 +260,11 @@ input[type=file]{
 | 
			
		||||
  background:#FFFFFF;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.container{
 | 
			
		||||
  margin-top: 2%;
 | 
			
		||||
  color:white;
 | 
			
		||||
  height:60px;
 | 
			
		||||
  font-size:30px;
 | 
			
		||||
  display:grid;
 | 
			
		||||
  grid-template-columns:30% 30% 20% 20%;
 | 
			
		||||
  grid-template-areas:
 | 
			
		||||
    "school formation completion edit remove";
 | 
			
		||||
  column-gap:10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button:active ,.switchpage:active{
 | 
			
		||||
  opacity:0.8;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
  const editElementID = ref("")
 | 
			
		||||
 | 
			
		||||
  function editItem(id){
 | 
			
		||||
    editElementID.value = id;
 | 
			
		||||
    editElementID = id;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //Juste pour montrer le Create Mode
 | 
			
		||||
 | 
			
		||||
@ -1,213 +0,0 @@
 | 
			
		||||
<!----------------------------------------------------
 | 
			
		||||
	File:  Msg.vue
 | 
			
		||||
	Author: Anthony Debucquoy
 | 
			
		||||
	Scope: Extension messagerie
 | 
			
		||||
	Description: Main msg page
 | 
			
		||||
----------------------------------------------------->
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
	import { ref, reactive } from 'vue'
 | 
			
		||||
	import { discussionsList, currentDiscussion, fetchDiscussion, createDiscussion, sendMessage, updateDiscussionName, invite, removeMember} from '@/rest/msg.js'
 | 
			
		||||
 | 
			
		||||
	const msgContent = ref("");
 | 
			
		||||
	const addMember = ref(false);
 | 
			
		||||
	const currentTitle = ref("");
 | 
			
		||||
 | 
			
		||||
	function formatTime(date){
 | 
			
		||||
		return date.getHours() + ":" + date.getMinutes() + " " + date.getDate() + "/" + date.getMonth();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<div id="msg">
 | 
			
		||||
		<div id="discList">
 | 
			
		||||
			<div @click="fetchDiscussion(discussion.id).then(e => currentTitle = currentDiscussion.name)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
 | 
			
		||||
			<button id="createDiscussion" @click="createDiscussion('New Discussion')">+</button>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div id="discussion" v-if="currentDiscussion.length != 0">
 | 
			
		||||
			<h1 id=msgName ><input class="InputTitle" type="text" @change="updateDiscussionName(currentDiscussion.id, currentTitle)" v-model="currentTitle"></h1>
 | 
			
		||||
			<div id=msgs>
 | 
			
		||||
				<div class="msg" v-for="msg in currentDiscussion.msgs" :sender="msg.sender" :key="msg.id">
 | 
			
		||||
					{{ msg.content }}<br/>
 | 
			
		||||
					<span class="sender"><span v-if="!msg.sender">{{ msg.author.firstName }} {{ msg.author.lastName.toUpperCase() }}</span> {{formatTime(new Date(msg.created))}}</span>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div id=messageBox>
 | 
			
		||||
				<input type="text" @keyup.enter="sendMessage(currentDiscussion.id, msgContent, null); msgContent = ''" v-model="msgContent">
 | 
			
		||||
				<input type="submit" @click="sendMessage(currentDiscussion.id, msgContent, null); msgContent = ''" value="send">
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div id="members" v-if="currentDiscussion.length != 0">
 | 
			
		||||
			<div class="memberItem" v-for="member in currentDiscussion.members" @click="removeMember(currentDiscussion.id, member.regNo)" :key="member.id"><span>{{ member.firstName }} {{ member.lastName.toUpperCase() }}</span></div>
 | 
			
		||||
			<input type=text id="addMembers" @focus="addMember = true" @blur="addMember = false;$event.target.value = ''" @change="invite(currentDiscussion.id, $event.target.value)" :placeholder="addMember ? 'Regno' : '+'"/>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
 | 
			
		||||
div#msg{
 | 
			
		||||
	position: relative;
 | 
			
		||||
	width: 100%;
 | 
			
		||||
	height: 100%;
 | 
			
		||||
 | 
			
		||||
	display: grid;
 | 
			
		||||
	grid-template-columns: 20% auto 10%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div#discList{
 | 
			
		||||
	margin: 30px 0 30px 30px;
 | 
			
		||||
	background-color: rgba(255, 255, 255, 0.05);
 | 
			
		||||
	border-radius: 10px;
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
	padding: 10px;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div#members{
 | 
			
		||||
	margin: 30px 0;
 | 
			
		||||
	border-radius: 10px 0 0 10px;
 | 
			
		||||
	background-color: red;
 | 
			
		||||
	background-color: rgba(255, 255, 255, 0.05);
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	padding: 10px 0 0 10px;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.InputTitle{
 | 
			
		||||
	all: inherit;
 | 
			
		||||
	margin: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.discItem{
 | 
			
		||||
	color: darkorange;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	font-family: sans-serif;
 | 
			
		||||
	font-weight: bold;
 | 
			
		||||
	height: 4vh;
 | 
			
		||||
	margin: 5px;
 | 
			
		||||
	border-radius: 0 30px 30px 0;
 | 
			
		||||
	align-items: center;
 | 
			
		||||
	justify-content: center;
 | 
			
		||||
	border: 1px solid darkorange;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.memberItem{
 | 
			
		||||
	color: darkorange;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	font-family: sans-serif;
 | 
			
		||||
	font-weight: bold;
 | 
			
		||||
	height: 4vh;
 | 
			
		||||
	margin: 5px;
 | 
			
		||||
	border-radius: 30px 0 0 30px;
 | 
			
		||||
	align-items: center;
 | 
			
		||||
	justify-content: center;
 | 
			
		||||
	border: 1px solid darkorange;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.memberItem:hover span{
 | 
			
		||||
	display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.memberItem:hover{
 | 
			
		||||
	background-color: red;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.memberItem:hover:before{
 | 
			
		||||
	color: white;
 | 
			
		||||
	content: "X"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#createDiscussion{
 | 
			
		||||
	height: 4vh;
 | 
			
		||||
	margin: 5px;
 | 
			
		||||
	color: white;
 | 
			
		||||
	background-color: green;
 | 
			
		||||
	border-radius: 0 30px 30px 0;
 | 
			
		||||
	border: none;
 | 
			
		||||
	font-weight: 900;
 | 
			
		||||
	font-size: 2em;
 | 
			
		||||
}
 | 
			
		||||
#addMembers{
 | 
			
		||||
	height: 4vh;
 | 
			
		||||
	margin: 5px;
 | 
			
		||||
	text-align: center;
 | 
			
		||||
	color: white;
 | 
			
		||||
	background-color: green;
 | 
			
		||||
	border-radius: 30px 0 0 30px;
 | 
			
		||||
	border: none;
 | 
			
		||||
	font-weight: 900;
 | 
			
		||||
	font-size: 2em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div#discussion{
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
	margin: 30px;
 | 
			
		||||
	background-color: rgba(255, 255, 255, 0.05);
 | 
			
		||||
	border-radius: 10px;
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#msgName{
 | 
			
		||||
	text-align: center;
 | 
			
		||||
	display: block;
 | 
			
		||||
	background-color: #2a1981;
 | 
			
		||||
	border-radius: 5px;
 | 
			
		||||
	color: white;
 | 
			
		||||
	width: 75%;
 | 
			
		||||
	margin: 30px auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.discItem:hover{
 | 
			
		||||
	background-color: gray;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#msgs{
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-grow: 1;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.msg {
 | 
			
		||||
	background-color: aliceblue;
 | 
			
		||||
	font-family: sans-serif;
 | 
			
		||||
	margin: 10px;
 | 
			
		||||
	padding: 5px;
 | 
			
		||||
	border-radius: 3px;
 | 
			
		||||
	max-width: 50%;
 | 
			
		||||
	align-self: start;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.sender{
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	color: gray;
 | 
			
		||||
	font-size: 0.5em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.msg[sender=true]{
 | 
			
		||||
	background-color: darkorange;
 | 
			
		||||
	align-self: end;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#messageBox{
 | 
			
		||||
	width: 100%;
 | 
			
		||||
	height: 30px;
 | 
			
		||||
	background-color: white;
 | 
			
		||||
	display: flex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#messageBox input[type="text"]{
 | 
			
		||||
	all: inherit;
 | 
			
		||||
	padding: 0 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#messageBox input[type="submit"]{
 | 
			
		||||
	border: inherit;
 | 
			
		||||
	padding: 0 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
@ -1,39 +1,24 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import {reactive, ref } from 'vue'
 | 
			
		||||
  import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js'
 | 
			
		||||
  import {getSelfCurriculum, getAllCurriculums, getSomeonesCurriculumList, getcurriculum} from '../rest/curriculum.js'
 | 
			
		||||
  import {getSelfCurriculum, getAllCurriculums} from '../rest/curriculum.js'
 | 
			
		||||
  import {getCourses} from "../rest/courses.js"
 | 
			
		||||
  import i18n from "@/i18n.js"
 | 
			
		||||
  import {uploadFile, uploadProfilePicture} from '@/rest/uploads.js'
 | 
			
		||||
  import CourseList from "@/Apps/Inscription/CourseList.vue";
 | 
			
		||||
  import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js";
 | 
			
		||||
  import {postPayment} from "@/rest/payment.js";
 | 
			
		||||
  import {addUninscReq, createScholarshipRequest, postChangeCurrReq} from "@/rest/requests.js";
 | 
			
		||||
  import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
 | 
			
		||||
  import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
 | 
			
		||||
  import { uploadProfilePicture } from '@/rest/uploads.js'
 | 
			
		||||
 | 
			
		||||
  const user = ref(await getSelf());
 | 
			
		||||
  const UserCurriculum = ref(""); 
 | 
			
		||||
  const curricula = ref (await getAllCurriculums());
 | 
			
		||||
  const minerv = ref({});
 | 
			
		||||
  const extcurrlist = ref(await getExternalCurriculumByUser(user.value.regNo))
 | 
			
		||||
 | 
			
		||||
  if(user.value.role === "Student"){
 | 
			
		||||
    minerv.value = ref(await getCurrentMinerval(user.value.regNo));
 | 
			
		||||
    UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo);
 | 
			
		||||
    UserCurriculum.value = await getSelfCurriculum();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(user.role === "Teacher"){
 | 
			
		||||
    UserCurriculum.value = await getCourses("Teacher");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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 modif = ref(false);
 | 
			
		||||
  const curric = ref(false);
 | 
			
		||||
  const reg = ref(false);
 | 
			
		||||
 | 
			
		||||
  const pattern = {
 | 
			
		||||
    profilPictureUrl:null,
 | 
			
		||||
@ -49,61 +34,27 @@
 | 
			
		||||
    id:null,
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //Used to modelize a payment
 | 
			
		||||
  const paymentData={
 | 
			
		||||
    studentRegNo: user.value.regNo,
 | 
			
		||||
    date:null,
 | 
			
		||||
    card:null,
 | 
			
		||||
    client:null,
 | 
			
		||||
    expDate:null,
 | 
			
		||||
    amount: null
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //Used to modelize a scholarship request
 | 
			
		||||
  const scholarshipData=reactive({
 | 
			
		||||
    userId: user.value.regNo,
 | 
			
		||||
    state:null,
 | 
			
		||||
    date:null,
 | 
			
		||||
    amount:0,
 | 
			
		||||
    taxDocUrl : "",
 | 
			
		||||
    residencyDocUrl : ""
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  const changecurrdata = reactive({
 | 
			
		||||
    userId : user.value.regNo,
 | 
			
		||||
    actualcursus:null,
 | 
			
		||||
    newcursus:1
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  //Used to post a uninscription request
 | 
			
		||||
  const uninscriptionData = reactive({
 | 
			
		||||
    reason : null,
 | 
			
		||||
    userId : user.value.regNo,
 | 
			
		||||
    curriculumId:null
 | 
			
		||||
  })
 | 
			
		||||
  const paymentAmount = ref(0);
 | 
			
		||||
  
 | 
			
		||||
  let toModify= Object.assign({}, pattern);
 | 
			
		||||
  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){
 | 
			
		||||
    inputs=Object.assign({},list); 
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  async function ChangeInfos(){
 | 
			
		||||
    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]});
 | 
			
		||||
        }      
 | 
			
		||||
 | 
			
		||||
        if (element ==="profilPictureUrl" && (toModify[element] !== null)){
 | 
			
		||||
        if (element =="profilPictureUrl" && (toModify[element] !== null)){
 | 
			
		||||
          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]});
 | 
			
		||||
        }
 | 
			
		||||
        else if(element === "password" && (toModify[element] !== null)){
 | 
			
		||||
        else if(element == "password" && (toModify[element] !== null)){
 | 
			
		||||
          await  alterSelf(user.value.regNo,{password : toModify[element]});
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -135,200 +86,48 @@
 | 
			
		||||
    }
 | 
			
		||||
    return user.profilePictureUrl
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function getYear(){
 | 
			
		||||
    let date = new Date();
 | 
			
		||||
    if (date.getMonth() <= 6){
 | 
			
		||||
      return date.getFullYear()-1
 | 
			
		||||
    }
 | 
			
		||||
    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
 | 
			
		||||
  function getActualCurriculumList(){
 | 
			
		||||
    let actualCurriculumList = [];
 | 
			
		||||
    for (let i = 0; i < UserCurriculum.value.curriculumList.length; i++){
 | 
			
		||||
      if (UserCurriculum.value.curriculumList[i].actual === true){
 | 
			
		||||
        actualCurriculumList.push(UserCurriculum.value.curriculumList[i]);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return actualCurriculumList
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async function postScholarshipRequest(file1, type1, file2, type2){
 | 
			
		||||
    const a = await uploadFile(file1, type1)
 | 
			
		||||
    scholarshipData.taxDocUrl =  a.url;
 | 
			
		||||
 | 
			
		||||
    const b = await uploadFile(file2, type2)
 | 
			
		||||
    scholarshipData.residencyDocUrl = b.url;
 | 
			
		||||
 | 
			
		||||
    scholarshipData.date = Date.now();
 | 
			
		||||
 | 
			
		||||
    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>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="body" v-if="windowState !== 12 && windowState!==4">
 | 
			
		||||
  <div class="body">
 | 
			
		||||
  <div class="container">
 | 
			
		||||
    <div class="profilPic" v-if="windowState===0">
 | 
			
		||||
    <div class="profilPic">
 | 
			
		||||
      <img class="subContainter" :src=getPP()>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
      <div class="globalInfos">
 | 
			
		||||
        <div v-if="windowState === 0" class="infosContainer">
 | 
			
		||||
        <div v-if="modif==false && curric==false && reg==false " class="infosContainer" >
 | 
			
		||||
          <div>
 | 
			
		||||
            {{user.firstName}} {{user.lastName}}   
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.email") }}: {{user.email}}
 | 
			
		||||
            E-mail: {{user.email}}      
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="user.role==='Student'">
 | 
			
		||||
            {{ i18n("regNo") }} :  {{user.regNo}}
 | 
			
		||||
            {{user.option}} {{i18n(user.role)}} 
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-else>
 | 
			
		||||
            {{ i18n("role") }}:  {{i18n((user.role))}}
 | 
			
		||||
            Role:  {{i18n((user.role))}} 
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click="windowState=1; setModify(user)"> {{i18n("profile.modify.data")}} </button>
 | 
			
		||||
            <button @click="modif=!modif; setModify(user)"> {{i18n("profile.modify.data")}} </button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="(user.role==='Student')">
 | 
			
		||||
            <button @click="windowState=9" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button>
 | 
			
		||||
            <button @click="reg=!reg">{{i18n("profile.reRegister")}}</button>
 | 
			
		||||
            <button @click="unRegister()" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="(user.role==='Student')">
 | 
			
		||||
            <button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
 | 
			
		||||
            <button @click="windowState=12;refreshExtCurrList();" style="margin-left: 2%">{{ i18n("manageextcur") }}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="(user.role==='Student')">
 | 
			
		||||
            <button @click="windowState=4">{{ i18n("managecourse") }}</button>
 | 
			
		||||
            <button @click="windowState=5" style="margin-left: 2%">{{ i18n("manageminerval") }}</button>
 | 
			
		||||
            <button @click="curric=!curric">{{i18n("profile.change.curriculum")}}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="windowState === 9" class="infosContainer">
 | 
			
		||||
            <div v-if="sure !== 2">{{ i18n("enterreason") }}</div>
 | 
			
		||||
            <textarea v-if="sure !== 2" v-model="uninscriptionData.reason"></textarea>
 | 
			
		||||
            <div v-if="sure !== 2">
 | 
			
		||||
              {{i18n("onlycursus")}}
 | 
			
		||||
            <input type="checkbox" v-model="isChecked">
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-if="sure !== 2 && isChecked">
 | 
			
		||||
              {{ i18n("plsselectcurs") }}
 | 
			
		||||
              <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++">{{ i18n("login.guest.submit") }}</button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-if="sure==1">
 | 
			
		||||
              {{ i18n("sureunreg") }}
 | 
			
		||||
              <button @click="addUninscReq(uninscriptionData.userId, uninscriptionData.reason, uninscriptionData.curriculumId);sure++">{{i18n("yes")}}</button>
 | 
			
		||||
              <button @click="sure=0">{{ i18n("no") }}</button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <p v-if="sure==2">{{ i18n("reqsend") }}</p>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-if="windowState === 9">
 | 
			
		||||
          <button @click="windowState=0">{{i18n("courses.back")}}</button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="windowState === 5" class="infosContainer">
 | 
			
		||||
          <div v-if="minerv.value.toPay !== 0">
 | 
			
		||||
            {{ i18n("payment") }} : {{minerv.value.toPay}}€ {{ i18n("lefttopay") }}
 | 
			
		||||
            <div v-if="minerv.value.paidAmount <= 50">
 | 
			
		||||
              <button @click="windowState=6; paymentAmount = 50">{{ i18n("paydeposit") }} (50€)</button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div>
 | 
			
		||||
              <button @click="windowState=6; paymentAmount = minerv.value.toPay">{{ i18n("payrest") }} ({{minerv.value.toPay}}€)</button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-else>
 | 
			
		||||
            {{ i18n("alreadypaid") }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click="windowState=7">{{ i18n("askscholarship") }}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-if="windowState === 5">
 | 
			
		||||
          <button @click="windowState=0">{{ i18n("courses.back") }}</button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="windowState === 7" class="infosContainer">
 | 
			
		||||
          <p>{{i18n("uploaddocs")}}</p>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("taxjustdoc") }}
 | 
			
		||||
            <input type="file" @change="scholarshipData.taxDocUrl = $event.target.files">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{i18n("residencydoc")}}
 | 
			
		||||
            <input type="file" style="margin-top:2%" @change="scholarshipData.residencyDocUrl = $event.target.files">
 | 
			
		||||
          </div>
 | 
			
		||||
          <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 v-else-if="windowState === 8" class="infosContainer">
 | 
			
		||||
          <div>
 | 
			
		||||
            {{i18n("reqsent")}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <button @click="windowState = 0">
 | 
			
		||||
            {{ i18n("backprofile") }}
 | 
			
		||||
          </button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="windowState === 6" class="infosContainer">
 | 
			
		||||
          {{ i18n("procpayment") }} {{paymentAmount}}€
 | 
			
		||||
          <div style="margin-top: 1%">
 | 
			
		||||
            Client:
 | 
			
		||||
            <input type="text" v-model="paymentData.client">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div style="margin-top: 1%">
 | 
			
		||||
            Card:
 | 
			
		||||
            <input type="text" v-model="paymentData.card">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div style="margin-top: 1%">
 | 
			
		||||
            ExpDate:
 | 
			
		||||
            <input type="date" v-model="paymentData.expDate">
 | 
			
		||||
          </div>
 | 
			
		||||
          <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)">{{i18n("procpaybutton")}}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click="windowState = 5">{{ i18n("courses.back") }}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="windowState === 1" class="infosContainer">
 | 
			
		||||
        <div v-else-if="modif" class="infosContainer">
 | 
			
		||||
          <div>
 | 
			
		||||
            {{i18n("profile.picture")}}:
 | 
			
		||||
            <input type="file" @change="user.profilPicture = uploadProfilePicture($event.target.files);" accept="image/*">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("login.guest.email")}}
 | 
			
		||||
            <input type="email" v-model="toModify.email" />
 | 
			
		||||
            E-mail:  
 | 
			
		||||
            <input type="mail" v-model="toModify.email" />
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            {{i18n("profile.address")}}:
 | 
			
		||||
@ -343,85 +142,70 @@
 | 
			
		||||
            <input type="password" v-model="toModify.passwordConfirm">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click="windowState = 0; ChangeInfos();">{{i18n("courses.confirm")}}</button>
 | 
			
		||||
            <button @click="windowState = 0; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button>
 | 
			
		||||
            <button @click=" modif=!modif; ChangeInfos();">{{i18n("courses.confirm")}}</button>
 | 
			
		||||
            <button @click="modif=!modif; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="windowState === 2" class="infosContainer">
 | 
			
		||||
        <div v-else-if="curric" class="infosContainer">
 | 
			
		||||
          <div style="height:40px;">
 | 
			
		||||
            {{i18n("Curriculum")}}:  
 | 
			
		||||
            <select v-model="curriculum" >
 | 
			
		||||
              <option v-for="item in curricula" style="font-size:20px;" :value="item">{{item.option}}</option>        
 | 
			
		||||
            </select>
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          <div>
 | 
			
		||||
            {{ i18n("iwouldlike") }}
 | 
			
		||||
            <select v-model="reRegState">
 | 
			
		||||
              <option :value="1">{{ i18n("rereg") }}</option>
 | 
			
		||||
              <option :value="2">{{ i18n("reregsup") }}</option>
 | 
			
		||||
              <option :value="3">{{ i18n("chcur") }}</option>
 | 
			
		||||
            </select>
 | 
			
		||||
          </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>
 | 
			
		||||
            {{ i18n("newcurr") }} :
 | 
			
		||||
            <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">
 | 
			
		||||
            {{ i18n("newcurr") }} :
 | 
			
		||||
            <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">
 | 
			
		||||
            {{ i18n("newcurr") }} :
 | 
			
		||||
            <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">
 | 
			
		||||
            {{i18n("cursusprereq")}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <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=" curric=!curric;">{{i18n("courses.confirm")}}</button>
 | 
			
		||||
            <button @click="curric=!curric; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="reg" class="infosContainer">
 | 
			
		||||
          <div>
 | 
			
		||||
            E-mail:  
 | 
			
		||||
            <input type="mail" 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=" reg=!reg;">{{i18n("courses.confirm")}}</button>
 | 
			
		||||
            <button @click=" reg=!reg; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
      </div>
 | 
			
		||||
      <div v-if="windowState === 0" class="moreInfos">
 | 
			
		||||
        <div class = "oldcursus">
 | 
			
		||||
            <div class="listTitle">
 | 
			
		||||
              {{ i18n("oldcursus") }}
 | 
			
		||||
            </div>
 | 
			
		||||
            <div  class="listElement">
 | 
			
		||||
              <div class=" containerElement" v-for="item in UserCurriculum.curriculumList">
 | 
			
		||||
                <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="dateyear" v-if="item.actual === false">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
      
 | 
			
		||||
      <div v-if="modif==false && curric==false && reg==false "class="moreInfos">
 | 
			
		||||
 | 
			
		||||
        <div v-if="(user.role ==='Student')">
 | 
			
		||||
          <div class="listTitle">
 | 
			
		||||
            {{i18n("profile.course.list")}}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="actualcursus">
 | 
			
		||||
            <div class="listTitle">
 | 
			
		||||
              {{ i18n("newcurr") }}
 | 
			
		||||
            </div>
 | 
			
		||||
            <div  class="listElement">
 | 
			
		||||
              <div class=" containerElement" v-for="item in UserCurriculum.curriculumList" >
 | 
			
		||||
                <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="dateyear" v-if="item.actual === true">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          <div  class="listElement" v-for="item in UserCurriculum.courses">
 | 
			
		||||
          <div class=" containerElement">
 | 
			
		||||
            <div class="name"> {{item.title}} </div>
 | 
			
		||||
            <div class="teacher">{{item.owner.lastName}}</div> 
 | 
			
		||||
            <div class="credits">Credits:{{item.credits}}</div>  
 | 
			
		||||
          </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        
 | 
			
		||||
        <div>
 | 
			
		||||
        </div>
 | 
			
		||||
    
 | 
			
		||||
      </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">
 | 
			
		||||
    <ExternalCurriculumList :ext-curr-list="extcurrlist" :mode="1"></ExternalCurriculumList>
 | 
			
		||||
    <button @click="windowState = 0;refreshExtCurrList()" style="margin-left: 17%;margin-top: 3%">{{ i18n("backprofile") }}</button>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
 | 
			
		||||
@ -456,32 +240,7 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.moreInfos {
 | 
			
		||||
  margin-top: 50%;
 | 
			
		||||
  display:grid;
 | 
			
		||||
  grid-template-rows:200px auto;
 | 
			
		||||
  column-gap:50px;
 | 
			
		||||
  row-gap:45px;
 | 
			
		||||
  grid-template-areas:
 | 
			
		||||
  "minfos minfos";
 | 
			
		||||
  grid-template-columns:600px 600px;
 | 
			
		||||
  align-items:center;
 | 
			
		||||
  justify-content:center;
 | 
			
		||||
  margin-left: 320%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.listTitle{
 | 
			
		||||
  display: flex;
 | 
			
		||||
  justify-content: center;
 | 
			
		||||
  align-items: center;
 | 
			
		||||
  width:250px;
 | 
			
		||||
  margin-left:auto;
 | 
			
		||||
  margin-right:auto;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  font-size:25px;
 | 
			
		||||
  color:white;
 | 
			
		||||
  padding:20px;
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
  border-radius:20px;margin-bottom:10px;
 | 
			
		||||
  grid-area:minfos;
 | 
			
		||||
}
 | 
			
		||||
.body {
 | 
			
		||||
    min-width:960px;
 | 
			
		||||
@ -489,21 +248,51 @@
 | 
			
		||||
    display:flex;
 | 
			
		||||
    align-items:center;
 | 
			
		||||
    justify-content:center;
 | 
			
		||||
    margin-top:7%;
 | 
			
		||||
    margin-top:5%;
 | 
			
		||||
  }
 | 
			
		||||
 .containerElement{
 | 
			
		||||
 .containerElement{ 
 | 
			
		||||
   justify-content:center;
 | 
			
		||||
   display:grid;
 | 
			
		||||
   grid-template-columns:100px 100px 300px;
 | 
			
		||||
   grid-template-areas:
 | 
			
		||||
    "year option dateyear";
 | 
			
		||||
   column-gap:40px;
 | 
			
		||||
   padding-left: 25px;
 | 
			
		||||
    display:grid;
 | 
			
		||||
    grid-template-columns:38.8% 38.8% 22.4%;
 | 
			
		||||
    grid-template-areas:
 | 
			
		||||
    "name teacher credits"; 
 | 
			
		||||
    column-gap:10px;
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  .name {
 | 
			
		||||
    grid-area:name;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .teacher{
 | 
			
		||||
    grid-area:teacher;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .credits{
 | 
			
		||||
    grid-area:credits;
 | 
			
		||||
    align-self:center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
.listTitle{
 | 
			
		||||
    min-width:197px;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    justify-content: center;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
    width:8vw;
 | 
			
		||||
    margin-left:auto;
 | 
			
		||||
    margin-right:auto;
 | 
			
		||||
    border:2px solid black;
 | 
			
		||||
    font-size:25px;
 | 
			
		||||
    color:white;
 | 
			
		||||
    padding:20px;
 | 
			
		||||
    background-color:rgb(50,50,50);
 | 
			
		||||
    border-radius:20px;margin-bottom:10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.listElement{
 | 
			
		||||
  min-width:625px;
 | 
			
		||||
  border:2px solid black;
 | 
			
		||||
  font-size:25px;
 | 
			
		||||
  color:white;
 | 
			
		||||
@ -531,6 +320,7 @@ button{
 | 
			
		||||
  border-radius:10px;
 | 
			
		||||
  height:35px;
 | 
			
		||||
  margin-top:10px;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button:hover{
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										211
									
								
								frontend/src/Apps/Schedule.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								frontend/src/Apps/Schedule.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,211 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import { ref } from 'vue'
 | 
			
		||||
 
 | 
			
		||||
  const schedule = [
 | 
			
		||||
    {course:"Math Pour L'info",
 | 
			
		||||
     start:"Wed Mar 27 2024 10:15 GMT+0100",
 | 
			
		||||
     end:"Wed Mar 27 2024 12:15 GMT+0100"},
 | 
			
		||||
    {
 | 
			
		||||
      course:"Calculus",
 | 
			
		||||
      start:"Wed Mar 27 2024 08:00 GMT+0100",
 | 
			
		||||
      end:"Wed Mar 27 2024 10:00 GMT+0100"
 | 
			
		||||
      
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
      course:"Physique II",
 | 
			
		||||
      start:"Tue Mar 26 2024 10:15 GMT+0100",
 | 
			
		||||
      end:"Tue Mar 26 2024 12:15 GMT+0100"      
 | 
			
		||||
  },
 | 
			
		||||
    {
 | 
			
		||||
      course:"Math Pour L'info",
 | 
			
		||||
      start:"Thu Mar 28 2024 10:15 GMT+0100",
 | 
			
		||||
      end:"Thu Mar 28 2024 12:15 GMT+0100"      
 | 
			
		||||
  }]
 | 
			
		||||
  function formatDate(date) {
 | 
			
		||||
    var d = new Date(date),
 | 
			
		||||
        month = '' + (d.getMonth() + 1),
 | 
			
		||||
        day = '' + d.getDate(),
 | 
			
		||||
        year = d.getFullYear();
 | 
			
		||||
 | 
			
		||||
    if (month.length < 2) 
 | 
			
		||||
        month = '0' + month;
 | 
			
		||||
    if (day.length < 2) 
 | 
			
		||||
        day = '0' + day;
 | 
			
		||||
 | 
			
		||||
    return [day, month, year].join('-');
 | 
			
		||||
  }
 | 
			
		||||
  function getMonday(d) {
 | 
			
		||||
    d = new Date(d);
 | 
			
		||||
    var day = d.getDay(),
 | 
			
		||||
    diff = d.getDate() - day + (day == 0 ? -6 : 1);
 | 
			
		||||
    return new Date(d.setDate(diff));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function getAnyDays(d){
 | 
			
		||||
 | 
			
		||||
    var day = new Date(mondayOfWeek.value);
 | 
			
		||||
    day.setDate(day.getDate() + d );
 | 
			
		||||
 | 
			
		||||
    return day;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const mondayOfWeek=ref(getMonday(new Date(schedule[1].start)))
 | 
			
		||||
 | 
			
		||||
  function isNotCourse(element){
 | 
			
		||||
    return element==null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function durationCourse(element){
 | 
			
		||||
    const hour = element.end.substring(3,5) -element.start.substring(3,5);
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    return (element.end - element.start)%2;
 | 
			
		||||
  }
 | 
			
		||||
  function sortByDate(a, b) {
 | 
			
		||||
    const nameA = a.start; // ignore upper and lowercase
 | 
			
		||||
    const nameB = b.start; // ignore upper and lowercase
 | 
			
		||||
    
 | 
			
		||||
    if (nameA < nameB) {
 | 
			
		||||
      return -1;
 | 
			
		||||
    }
 | 
			
		||||
    if (nameA > nameB) {
 | 
			
		||||
      return 1;
 | 
			
		||||
    }
 | 
			
		||||
    return 0; 
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
  function transpose(a) {
 | 
			
		||||
    const trans = [[],[],[],[],[],[]];
 | 
			
		||||
    for(let i = 0; i < 6;i++){
 | 
			
		||||
      for(let j=0; j< 7; j++){
 | 
			
		||||
        if(a[j][i] !== null){
 | 
			
		||||
          trans[i].push(a[j][i]);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return trans;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  function matrixFromList(list){
 | 
			
		||||
    const matrix = [[],[],[],[],[],[],[]];
 | 
			
		||||
    for(let key in list){
 | 
			
		||||
      const temp = [];
 | 
			
		||||
      const day = new Date(list[key].start);
 | 
			
		||||
      matrix[day.getDay()].push(list[key]);
 | 
			
		||||
      matrix[day.getDay()].sort((a,b) => sortByDate(a,b));
 | 
			
		||||
    }
 | 
			
		||||
      return matrix;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  const schedule2 = matrixFromList(schedule);
 | 
			
		||||
  const scheduleByWeek = transpose(schedule2);
 | 
			
		||||
  
 | 
			
		||||
  console.log(scheduleByWeek)
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="grid">
 | 
			
		||||
    <div class="options" >
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="schedule">
 | 
			
		||||
      <table class="table">
 | 
			
		||||
        <tr style="background-color:rgb(24,24,24)">
 | 
			
		||||
          <th/>
 | 
			
		||||
          <th class="header">Lundi {{formatDate(getAnyDays(0))}}</th>
 | 
			
		||||
          <th class="header">Mardi {{formatDate(getAnyDays(1))}}</th>
 | 
			
		||||
          <th class="header">Mercredi {{formatDate(getAnyDays(2))}}</th>
 | 
			
		||||
          <th class="header">Jeudi {{formatDate(getAnyDays(3))}}</th>
 | 
			
		||||
          <th class="header">Vendredi {{formatDate(getAnyDays(4))}}</th>
 | 
			
		||||
          <th class="header">Samedi {{formatDate(getAnyDays(5))}}</th>
 | 
			
		||||
          <th class="header">Dimanche {{formatDate(getAnyDays(6))}}</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr v-for="(n,index) in 12">
 | 
			
		||||
          <th class="hour">{{8 + index}}:00-{{9+index}}:00</th>
 | 
			
		||||
            <td v-for="m in 7"></td>
 | 
			
		||||
        </tr>
 | 
			
		||||
      </table>
 | 
			
		||||
      <div class="courseGrid">
 | 
			
		||||
        <div v-for="i in 7">
 | 
			
		||||
          Test
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
  .grid{
 | 
			
		||||
    display:grid;
 | 
			
		||||
    margin-top:2%;
 | 
			
		||||
    align-items:center;
 | 
			
		||||
    justify-content:center;
 | 
			
		||||
    grid-template-columns:15vw 70vw;
 | 
			
		||||
    column-gap:2.5vw;
 | 
			
		||||
 | 
			
		||||
    grid-template-areas:"options schedule";
 | 
			
		||||
  }
 | 
			
		||||
  .schedule{
 | 
			
		||||
    position:relative;  
 | 
			
		||||
    border-radius:20px;
 | 
			
		||||
    grid-area:schedule;
 | 
			
		||||
    width:100%;
 | 
			
		||||
    height:85vh;
 | 
			
		||||
    background-color:rgba(255,255,255,0.1);    
 | 
			
		||||
  }
 | 
			
		||||
  .options{
 | 
			
		||||
    border-radius:20px;
 | 
			
		||||
    grid-area:options;
 | 
			
		||||
    background-color:rgba(255,255,255,0.1);
 | 
			
		||||
    width:100%;
 | 
			
		||||
    height:85vh;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .table{
 | 
			
		||||
    width:100%;
 | 
			
		||||
    height:100%;
 | 
			
		||||
    border-spacing:0;
 | 
			
		||||
    border-collapse:separate;
 | 
			
		||||
    border-radius: 20px;
 | 
			
		||||
    border: 2px solid black
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  .hour{
 | 
			
		||||
    background-color:rgb(72,72,72)
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  .header{
 | 
			
		||||
    align-items:center;
 | 
			
		||||
    width:12.5%;
 | 
			
		||||
    color:#FFFFFF;
 | 
			
		||||
  }
 | 
			
		||||
  table th:not(:last-child),
 | 
			
		||||
  table td:not(:last-child) {
 | 
			
		||||
  border-right: 1px solid black;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  table tr:not(:last-child)>td,
 | 
			
		||||
  table tr:not(:last-child)>th
 | 
			
		||||
  {
 | 
			
		||||
    border-bottom:1px solid black;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  .courseGrid{
 | 
			
		||||
    top:13.75%;   
 | 
			
		||||
    left:12.5%;
 | 
			
		||||
    position:absolute;
 | 
			
		||||
    width:87.5%;
 | 
			
		||||
    height:86.25%; 
 | 
			
		||||
    display:grid;
 | 
			
		||||
    grid-template-columns:repeat(7,1fr);
 | 
			
		||||
      }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  .course{
 | 
			
		||||
    width:100%;
 | 
			
		||||
    height:100%;
 | 
			
		||||
    background-color:rgb(100,0,100);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
</style>
 | 
			
		||||
@ -1,29 +1,19 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import i18n from "@/i18n.js"
 | 
			
		||||
  import {provide, reactive, ref} from 'vue'
 | 
			
		||||
  import { reactive  } from 'vue'
 | 
			
		||||
  import { getStudents } from '../rest/Users.js'
 | 
			
		||||
  import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
 | 
			
		||||
 | 
			
		||||
  const users = await getStudents();
 | 
			
		||||
 | 
			
		||||
  let targetRegNo = "";
 | 
			
		||||
  let list = ref(true);
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
</script> 
 | 
			
		||||
<template style="margin-top:5%;">
 | 
			
		||||
  <div v-if="list === false">
 | 
			
		||||
    <AboutStudent :target=targetRegNo />
 | 
			
		||||
    <button style="background-color:rgb(105,05,105);width:5%; margin-left: 10%;" @click="list = true;">{{ i18n("courses.back") }}</button>
 | 
			
		||||
  </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">
 | 
			
		||||
    <div class="bodu">
 | 
			
		||||
      <div class="container">
 | 
			
		||||
        <div class="status"><a style="margin-left:30px">{{item.status}}</a></div>
 | 
			
		||||
        <div class="option"><a>{{item.role}}</a></div>
 | 
			
		||||
        <div class="surname"><a>{{item.lastName}}</a></div>
 | 
			
		||||
        <div class="firstname"><a>{{item.firstName}}</a></div>
 | 
			
		||||
        <div class="infos">
 | 
			
		||||
          <button style="background-color:rgb(105,05,105);" @click="list = false; targetRegNo = item.regNo;">{{i18n("request.moreInfos")}} </button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}}   </button></div>
 | 
			
		||||
    </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
@ -35,10 +25,10 @@
 | 
			
		||||
    height:100px;
 | 
			
		||||
    font-size:30px;
 | 
			
		||||
    display:grid;
 | 
			
		||||
    grid-template-columns:21.7% 21.7% 21.7% 20% 13.1%;
 | 
			
		||||
    grid-template-columns:21.7% 21.7% 21.7% 21.7% 13.1%;
 | 
			
		||||
    grid-template-areas:
 | 
			
		||||
    "status option surname firstname infos"; 
 | 
			
		||||
    column-gap:10px;
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  .infos {
 | 
			
		||||
@ -74,8 +64,8 @@
 | 
			
		||||
 | 
			
		||||
  button{
 | 
			
		||||
    font-size:15px;
 | 
			
		||||
    height:50px;
 | 
			
		||||
    width:75%;
 | 
			
		||||
     height:50px;
 | 
			
		||||
     width:75%;
 | 
			
		||||
    border:none;
 | 
			
		||||
    border-radius:20px;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,3 @@
 | 
			
		||||
:root {
 | 
			
		||||
	--header-size: 61px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
body {
 | 
			
		||||
   background-color: rgb(53, 25, 60);
 | 
			
		||||
   margin:0;
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 * TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
 | 
			
		||||
 */
 | 
			
		||||
import {restGet, restPatch, restPost} from './restConsumer.js'
 | 
			
		||||
import {restGet, restPatch} from './restConsumer.js'
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * create a new register requests that can be recovered by the registering service
 | 
			
		||||
@ -43,4 +43,3 @@ export async function getAllRegisters(){
 | 
			
		||||
export async function validateRegister(id, state){
 | 
			
		||||
  return restPatch("/request/register/" + id, state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,7 @@ export function disconnect(){
 | 
			
		||||
 * @param curriculum 
 | 
			
		||||
 * @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,admissionDocUrl){
 | 
			
		||||
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId){
 | 
			
		||||
	return restPost("/register", {
 | 
			
		||||
		firstName: firstname,
 | 
			
		||||
		lastName: lastname,
 | 
			
		||||
@ -36,11 +36,7 @@ export async function register(firstname, lastname, birthDate, password, email,
 | 
			
		||||
		address: address,
 | 
			
		||||
		country: country,
 | 
			
		||||
		curriculumId: curriculumId,
 | 
			
		||||
    	profilePicture: imageId,
 | 
			
		||||
		identityCard : identityCardId,
 | 
			
		||||
		submissionDate : submissionDate,
 | 
			
		||||
		equivalenceState : equivalence,
 | 
			
		||||
		admissionDocUrl: admissionDocUrl
 | 
			
		||||
    profilePictureUrl: imageId,
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -56,7 +52,7 @@ export async function register(firstname, lastname, birthDate, password, email,
 | 
			
		||||
 * @param country
 | 
			
		||||
 * @param imageId	id of the image in database returned when uploaded
 | 
			
		||||
 *
 | 
			
		||||
 * PS: the password is not required as it is generated by the backend and sent to the user
 | 
			
		||||
 * PS: the password is not is not required as it is generated by the backend and sent to the user
 | 
			
		||||
 * by mail. it's up to the user to change it if he cares about security
 | 
			
		||||
 */
 | 
			
		||||
export async function createUser(firstname, lastname, birthDate, email, address, country, role, imageId){
 | 
			
		||||
 | 
			
		||||
@ -4,23 +4,21 @@ import i18n from '@/i18n.js'
 | 
			
		||||
 | 
			
		||||
// Liste des apps
 | 
			
		||||
import LoginPage from '@/Apps/Login.vue'
 | 
			
		||||
import Inscription from "@/Apps/Inscription.vue"
 | 
			
		||||
import Profil from "@/Apps/Profil.vue"
 | 
			
		||||
import Courses from "@/Apps/ManageCourses.vue"
 | 
			
		||||
import Users from "@/Apps/UsersList.vue"
 | 
			
		||||
import Students from "@/Apps/StudentsList.vue"
 | 
			
		||||
import Msg from "@/Apps/Msg.vue"
 | 
			
		||||
import Payments from "@/Apps/Inscription/PaymentInfo.vue";
 | 
			
		||||
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
 | 
			
		||||
import Schedule from "@/Apps/Schedule.vue"
 | 
			
		||||
 | 
			
		||||
const apps = {
 | 
			
		||||
		'/schedule': Schedule,
 | 
			
		||||
		'/login': LoginPage,
 | 
			
		||||
		'/requests': ManageRequests,
 | 
			
		||||
		'/inscription': Inscription,
 | 
			
		||||
		'/profil': Profil,
 | 
			
		||||
		'/manage-courses' : Courses,
 | 
			
		||||
		'/users-list' : Users,
 | 
			
		||||
		'/students-list' : Students,
 | 
			
		||||
		'/msg' : Msg,
 | 
			
		||||
		'/payments': Payments
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const appsList = {
 | 
			
		||||
@ -28,11 +26,10 @@ const appsList = {
 | 
			
		||||
		'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") },
 | 
			
		||||
		'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") },
 | 
			
		||||
		'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
 | 
			
		||||
		'Requests': { path: '#/requests', icon: 'fa-users', text: "Requests" },
 | 
			
		||||
		'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
 | 
			
		||||
		'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
 | 
			
		||||
		'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
 | 
			
		||||
		'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)
 | 
			
		||||
 | 
			
		||||
@ -71,11 +71,3 @@ export async function getCourses(role){
 | 
			
		||||
export async function alterCourse(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)
 | 
			
		||||
}
 | 
			
		||||
@ -48,9 +48,3 @@ export async function altercurriculum(id, courses){
 | 
			
		||||
export async function getSelfCurriculum(){
 | 
			
		||||
  return restGet("/curriculum");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getSomeonesCurriculumList(user){
 | 
			
		||||
	return restGet("/onescurriculum/"+user)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,24 +0,0 @@
 | 
			
		||||
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
 | 
			
		||||
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
 | 
			
		||||
 | 
			
		||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl, userRegNo){
 | 
			
		||||
    return restPost("/externalcurriculum", {
 | 
			
		||||
        inscriptionRequestId: inscriptionRequestId,
 | 
			
		||||
        school:school,
 | 
			
		||||
        formation :formation,
 | 
			
		||||
        completion : completion,
 | 
			
		||||
        startYear : startYear,
 | 
			
		||||
        endYear: endYear,
 | 
			
		||||
        justifdocUrl : justifdocUrl,
 | 
			
		||||
        userRegNo : userRegNo
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getExternalCurriculumByInscrReq(inscrReqId){
 | 
			
		||||
    return restGet("/externalcurriculum/"+inscrReqId)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getExternalCurriculumByUser(userId){
 | 
			
		||||
    return restGet("/externalcurriculumbyuser/"+userId)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,9 +0,0 @@
 | 
			
		||||
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
 | 
			
		||||
 | 
			
		||||
export async function getCurrentMinerval(userRegNo){
 | 
			
		||||
    return restGet("/minerval/"+userRegNo)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function editMinerval(updatedMinerval){
 | 
			
		||||
    return restPatch("/minerval", updatedMinerval)
 | 
			
		||||
}
 | 
			
		||||
@ -1,60 +0,0 @@
 | 
			
		||||
/*******************************************************
 | 
			
		||||
 * File: msg.js
 | 
			
		||||
 * Author: Anthony Debucquoy
 | 
			
		||||
 * Scope: Extension messagerie
 | 
			
		||||
 * Description: Messages frontend api consumer
 | 
			
		||||
 *******************************************************/
 | 
			
		||||
 | 
			
		||||
import { restGet, restPost, restPatch } from './restConsumer.js'
 | 
			
		||||
import { ref } from 'vue'
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * - id
 | 
			
		||||
 * - name
 | 
			
		||||
 * - members
 | 
			
		||||
 */
 | 
			
		||||
export const discussionsList = ref();
 | 
			
		||||
export const currentDiscussion = ref([]);
 | 
			
		||||
let timerSet = false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export async function createDiscussion(name){
 | 
			
		||||
	let disc = await restPost("/discussion", {name: name});
 | 
			
		||||
	discussionsList.value.push(disc);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export async function invite(id, regNo){
 | 
			
		||||
	restPatch("/discussion/"+ id+ "/add", {regNo: parseInt(regNo)}).then(() => fetchDiscussion(id))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function removeMember(id, regNo){
 | 
			
		||||
	restPatch("/discussion/"+ id+ "/remove", {regNo: parseInt(regNo)}).then(() => fetchDiscussion(id))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function sendMessage(id, content, responseId){
 | 
			
		||||
	let data = {
 | 
			
		||||
		content: content,
 | 
			
		||||
		response: responseId,
 | 
			
		||||
	}
 | 
			
		||||
	restPost("/discussion/" + id, data).then(() => fetchDiscussion(id));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function updateDiscussionName(id, name){
 | 
			
		||||
	restPatch("/discussion/" + id, {name: name}).then(() => fetchDiscussions());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async function fetchDiscussions(){
 | 
			
		||||
	discussionsList.value = await restGet("/discussions");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function fetchDiscussion(id){
 | 
			
		||||
	currentDiscussion.value = await restGet("/discussion/" + id);
 | 
			
		||||
	if(!timerSet){
 | 
			
		||||
		timerSet = true;
 | 
			
		||||
		setTimeout(() => {timerSet = false;fetchDiscussion(currentDiscussion.value.id)} , 5000);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
await fetchDiscussions();
 | 
			
		||||
@ -1,6 +0,0 @@
 | 
			
		||||
import {restPost} from "@/rest/restConsumer.js";
 | 
			
		||||
 | 
			
		||||
export async function postPayment(payment){
 | 
			
		||||
    return restPost("/payment", payment)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,81 +0,0 @@
 | 
			
		||||
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
 | 
			
		||||
 | 
			
		||||
export async function createExemptionsRequest(exempReq){
 | 
			
		||||
    return restPost("/exemptionreq", exempReq)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function createScholarshipRequest(reqInfo){
 | 
			
		||||
    return restPost("/scholarshipreq", reqInfo)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getAllScholarShipsRequest(){
 | 
			
		||||
    return restGet("/scholarshipreq")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getAllExemptionsRequest(){
 | 
			
		||||
    return restGet("/exemptionsreq")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function editEquivalenceState(id, newstate){
 | 
			
		||||
    return restPatch("/request/registerequiv/"+id+"/"+newstate)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function addUninscReq(userId, reason, curriculumId){
 | 
			
		||||
    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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
}
 | 
			
		||||
@ -1,27 +1,27 @@
 | 
			
		||||
import { getCookie } from '../utils.js'
 | 
			
		||||
import { toast } from 'vue3-toastify'
 | 
			
		||||
 | 
			
		||||
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8080": import.meta.env.DEV ? "http://localhost:8080" : "https://clyde.herisson.ovh/api"
 | 
			
		||||
const restURL = import.meta.env.PROD ? "https://clyde.herisson.ovh/api" : "http://localhost:8080"
 | 
			
		||||
 | 
			
		||||
export function restGet(endPoint) {
 | 
			
		||||
	return _rest(endPoint, {method: "GET"});
 | 
			
		||||
export async function restGet(endPoint) {
 | 
			
		||||
	return await _rest(endPoint, {method: "GET"});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function restPost(endPoint, data) {
 | 
			
		||||
	return _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
 | 
			
		||||
export async function restPost(endPoint, data) {
 | 
			
		||||
	return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function restPostFile(endPoint, file){
 | 
			
		||||
export async function restPostFile(endPoint, file){
 | 
			
		||||
	let headers = new Headers();
 | 
			
		||||
	return _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
 | 
			
		||||
	return await _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function restDelete(endPoint) {
 | 
			
		||||
	return _rest(endPoint, {method: "DELETE"});
 | 
			
		||||
export async function restDelete(endPoint) {
 | 
			
		||||
	return await _rest(endPoint, {method: "DELETE"});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function restPatch(endPoint, data) {
 | 
			
		||||
	return _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
 | 
			
		||||
export async function restPatch(endPoint, data) {
 | 
			
		||||
	return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -33,7 +33,7 @@ export function restPatch(endPoint, data) {
 | 
			
		||||
 *
 | 
			
		||||
 *  @Example _rest("/ping", {user: data}) -> {id:0, txt:"pong"}
 | 
			
		||||
 */
 | 
			
		||||
function _rest(endPoint, config){
 | 
			
		||||
async function _rest(endPoint, config){
 | 
			
		||||
	endPoint.at(0) != "/" ? console.error("Carefull, you certainly should put a / at the begenning of your endPoint ") : true;
 | 
			
		||||
	let session_token = getCookie("session_token");
 | 
			
		||||
	let headers = new Headers({
 | 
			
		||||
@ -41,16 +41,13 @@ function _rest(endPoint, config){
 | 
			
		||||
		'Content-Type': 'application/json',
 | 
			
		||||
	});
 | 
			
		||||
	config['headers'] = config['headers'] == null ? headers : config['headers'];
 | 
			
		||||
 | 
			
		||||
	let ret = fetch(restURL + endPoint, config);
 | 
			
		||||
	if(config['toast']){
 | 
			
		||||
		ret = toast.promise(ret,
 | 
			
		||||
	return toast.promise(fetch(restURL + endPoint, config),
 | 
			
		||||
		{
 | 
			
		||||
			pending: config['pending'] != null ? config['pending'] : 'pending',
 | 
			
		||||
			error: config['error'] != null ? config['error'] : 'Network Failure...',
 | 
			
		||||
			success: config['success'] != null ? config['success'] : {render(res){
 | 
			
		||||
				return res.data.ok ? "Success" : "error";
 | 
			
		||||
			}}})
 | 
			
		||||
	}
 | 
			
		||||
	return ret.then( e => e.json()).catch( e => e );
 | 
			
		||||
			}},
 | 
			
		||||
		})
 | 
			
		||||
		.then( e => e.json()).catch( e => e );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,17 +7,5 @@ import { restPostFile } from '@/rest/restConsumer.js'
 | 
			
		||||
export async function uploadProfilePicture(file){
 | 
			
		||||
	const formData = new FormData();
 | 
			
		||||
	formData.append("file", file[0]);
 | 
			
		||||
 | 
			
		||||
	return restPostFile("/upload/ProfilePicture", formData);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * More generic version of the uploadProfilePicture method
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
export async function uploadFile(file, type){
 | 
			
		||||
	const formData = new FormData();
 | 
			
		||||
	formData.append("file", file[0]);
 | 
			
		||||
	return restPostFile("/upload/"+type, formData)
 | 
			
		||||
	return restPostFile("/upload/ProfilePicture", formData)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user