Compare commits
105 Commits
1a266cdfbd
...
4d007534b3
Author | SHA1 | Date | |
---|---|---|---|
4d007534b3 | |||
32810a9b01 | |||
217ad7f0d1 | |||
2d20b45c3a | |||
9cbdaac09d | |||
a90243f4b9 | |||
636e17b4bf | |||
9cd54bdae9 | |||
69be9681ff | |||
98082f34b7 | |||
43883caef0 | |||
88b057e19d | |||
260191d790 | |||
05ed28626a | |||
ca10084400 | |||
fa1a2c6d3b | |||
4485dbf803 | |||
b52c50fd76 | |||
172837d6d1 | |||
9a5115f7fe | |||
0d6b4ec57c | |||
e0a3a618a1 | |||
0b9227a822 | |||
f14d41f04d | |||
43f3d66eb9 | |||
e25ead6230 | |||
70bec1a934 | |||
0837cc800a | |||
30f04b736b | |||
f83e689e4d | |||
29f13c3a3b | |||
33eb5c0f0c | |||
0621c6fe68 | |||
ecaf5e3df8 | |||
846cdedc4b | |||
881c935c00 | |||
e8bf0d953d | |||
bc87748b31 | |||
8097f5314f | |||
1e2efac5bc | |||
061f329020 | |||
892d4f0651 | |||
9e45e6a9c9 | |||
ef03a6bdca | |||
7cdbf6de74 | |||
be23c3ab91 | |||
e8917cd69e | |||
cdc3772384 | |||
e8fea7625f | |||
0ffc8077db | |||
bd1c236635 | |||
c15ddccbb0 | |||
211bf77322 | |||
3ca074a3ba | |||
7bb1df123f | |||
92cdeaebba | |||
4e14370d4f | |||
10c1c6096d | |||
69fb4e881e | |||
25575fa4e0 | |||
5a57fc78f3 | |||
70a8e98a0e | |||
a9e52d34d4 | |||
8a5a26e2ab | |||
c9556e1eea | |||
78507f798f | |||
f9b12a5061 | |||
8724748642 | |||
dff225b0f5 | |||
f8d60f40fc | |||
f19236b3f7 | |||
cba11d54ff | |||
a27cf63daf | |||
8fa29460ef | |||
1be7b4cdbe | |||
94be706226 | |||
881b30e5c9 | |||
058c53dbbc | |||
caa39696d2 | |||
b9d7950e12 | |||
a2be04bfb3 | |||
451944e4fb | |||
c434b28fe3 | |||
a89d1b192c | |||
9112004326 | |||
c6ce6d3e5b | |||
2e02cd8870 | |||
adaa828810 | |||
95ef4023d6 | |||
106bf96a98 | |||
7b0d76dae8 | |||
61e269eb27 | |||
142ea996d8 | |||
5f483216b9 | |||
5a4d066c45 | |||
f9bcff6d4f | |||
aa3e1cb868 | |||
7bd745fd5e | |||
9937a7db39 | |||
a96609d2ef | |||
cb750b8505 | |||
443cf55784 | |||
2b9493422d | |||
621f568ba2 | |||
972d08a54d |
@ -18,15 +18,3 @@ jobs:
|
||||
- uses: gradle/gradle-build-action@v3
|
||||
- name: building
|
||||
run: ./gradlew backend:build -x test
|
||||
# Test-backend:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: actions/setup-java@v3
|
||||
# with:
|
||||
# java-version: '21'
|
||||
# distribution: 'temurin'
|
||||
# - run: curl -fsSL https://get.docker.com | sh
|
||||
# - uses: gradle/gradle-build-action@v3
|
||||
# - name: testing
|
||||
# run: ./gradlew backend:test
|
||||
|
@ -39,13 +39,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
- uses: gradle/gradle-build-action@v3
|
||||
- name: building
|
||||
run: ./gradlew backend:build -x test
|
||||
- name: pushing to the server
|
||||
run: |
|
||||
echo "${{ secrets.SSH_KEY }}" > key
|
||||
@ -53,5 +46,5 @@ jobs:
|
||||
scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/
|
||||
- name: restarting the backend
|
||||
run: |
|
||||
ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'cd api/backend && docker build -t clyde/backend . && docker rm clyde_backend_prod -f || true && docker run --rm -d -u $(id -u clyde):$(id -g clyde) -v /var/run/postgresql:/var/run/postgresql --name clyde_backend_prod -p 4000:8080 clyde/backend && docker image prune -f'
|
||||
ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'cd api/ && sed -i compose.yaml -e "s/8080:8080/4001:8080/" -e "s/8000:8080/4000:8080/" && docker-compose up --force-recreate --build -d'
|
||||
- run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api"
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
@ -53,6 +52,7 @@ public class ApplicationsController {
|
||||
//if unAuthed
|
||||
authorizedApps.add(Applications.Login);
|
||||
authorizedApps.add(Applications.ListResearches);
|
||||
authorizedApps.add(Applications.Schedule);
|
||||
|
||||
User user = authServ.getUserFromToken(token);
|
||||
if(user == null)
|
||||
@ -66,6 +66,8 @@ public class ApplicationsController {
|
||||
authorizedApps.add(Applications.Rdv);
|
||||
}
|
||||
|
||||
if(!authServ.isNotIn(new Role[]{Role.Teacher,Role.Admin},token))
|
||||
authorizedApps.add(Applications.ManageOwnedLessons);
|
||||
//if Teacher or Secretary or Admin add ManageCourses App
|
||||
if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Secretary,Role.Admin},token))
|
||||
authorizedApps.add(Applications.ManageCourses);
|
||||
@ -74,12 +76,18 @@ public class ApplicationsController {
|
||||
authorizedApps.add(Applications.Requests);
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.CreateUser);
|
||||
authorizedApps.add(Applications.UsersList);}
|
||||
|
||||
if (researchesServ.getResearcherByUser(user) != null)
|
||||
authorizedApps.add(Applications.ManageResearcherProfile);
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.UsersList);
|
||||
authorizedApps.add(Applications.ManageSchedules);
|
||||
authorizedApps.add(Applications.LessonRequests);
|
||||
authorizedApps.add(Applications.CreateUser);
|
||||
}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.InscriptionService},token)){
|
||||
authorizedApps.add(Applications.Payments);}
|
||||
return authorizedApps;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,101 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
|
||||
import ovh.herisson.Clyde.Tables.Applications;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class ApplicationsController {
|
||||
|
||||
AuthenticatorService authServ;
|
||||
|
||||
ResearchesService researchesServ;
|
||||
|
||||
public ApplicationsController(AuthenticatorService authServ, ResearchesService researchesServ){
|
||||
this.researchesServ = researchesServ;
|
||||
this.authServ = authServ;
|
||||
}
|
||||
|
||||
|
||||
/** return a list of authorized applications.
|
||||
* depends on the token
|
||||
*/
|
||||
@GetMapping("/apps")
|
||||
public ResponseEntity<Iterable<Applications>> getAuthorizedApps(@RequestHeader("Authorization") String token){
|
||||
return new ResponseEntity<>(getAuthorizedApplications(token), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/apps/{identifier}")
|
||||
public ResponseEntity<Boolean> getAppAuthorization(@PathVariable Applications identifier, @RequestHeader("Authorization") String token){
|
||||
|
||||
if (getAuthorizedApplications(token).contains(identifier)){
|
||||
return new ResponseEntity<>(true, HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(false, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ArrayList<Applications> getAuthorizedApplications(String token){
|
||||
ArrayList<Applications> authorizedApps = new ArrayList<>();
|
||||
|
||||
//if unAuthed
|
||||
authorizedApps.add(Applications.Login);
|
||||
<<<<<<< HEAD
|
||||
authorizedApps.add(Applications.ListResearches);
|
||||
=======
|
||||
authorizedApps.add(Applications.Schedule);
|
||||
>>>>>>> origin/master
|
||||
|
||||
User user = authServ.getUserFromToken(token);
|
||||
if(user == null)
|
||||
return authorizedApps;
|
||||
// if authed
|
||||
authorizedApps.add(Applications.Profile);
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Student,Role.Admin},token)) {
|
||||
authorizedApps.add(Applications.Msg);
|
||||
authorizedApps.add(Applications.Forum);
|
||||
authorizedApps.add(Applications.Rdv);
|
||||
}
|
||||
|
||||
if(!authServ.isNotIn(new Role[]{Role.Teacher,Role.Admin},token))
|
||||
authorizedApps.add(Applications.ManageOwnedLessons);
|
||||
//if Teacher or Secretary or Admin add ManageCourses App
|
||||
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);
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.CreateUser);
|
||||
authorizedApps.add(Applications.UsersList);}
|
||||
|
||||
if (researchesServ.getResearcherByUser(user) != null)
|
||||
authorizedApps.add(Applications.ManageResearcherProfile);
|
||||
=======
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.UsersList);
|
||||
authorizedApps.add(Applications.ManageSchedules);
|
||||
authorizedApps.add(Applications.LessonRequests);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.InscriptionService},token)){
|
||||
authorizedApps.add(Applications.Payments);}
|
||||
>>>>>>> origin/master
|
||||
return authorizedApps;
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
|
||||
import ovh.herisson.Clyde.Tables.Applications;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class ApplicationsController {
|
||||
|
||||
AuthenticatorService authServ;
|
||||
|
||||
ResearchesService researchesServ;
|
||||
|
||||
public ApplicationsController(AuthenticatorService authServ, ResearchesService researchesServ){
|
||||
this.researchesServ = researchesServ;
|
||||
this.authServ = authServ;
|
||||
}
|
||||
|
||||
|
||||
/** return a list of authorized applications.
|
||||
* depends on the token
|
||||
*/
|
||||
@GetMapping("/apps")
|
||||
public ResponseEntity<Iterable<Applications>> getAuthorizedApps(@RequestHeader("Authorization") String token){
|
||||
return new ResponseEntity<>(getAuthorizedApplications(token), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/apps/{identifier}")
|
||||
public ResponseEntity<Boolean> getAppAuthorization(@PathVariable Applications identifier, @RequestHeader("Authorization") String token){
|
||||
|
||||
if (getAuthorizedApplications(token).contains(identifier)){
|
||||
return new ResponseEntity<>(true, HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(false, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ArrayList<Applications> getAuthorizedApplications(String token){
|
||||
ArrayList<Applications> authorizedApps = new ArrayList<>();
|
||||
|
||||
//if unAuthed
|
||||
authorizedApps.add(Applications.Login);
|
||||
<<<<<<< HEAD
|
||||
authorizedApps.add(Applications.ListResearches);
|
||||
=======
|
||||
authorizedApps.add(Applications.Schedule);
|
||||
>>>>>>> origin/master
|
||||
|
||||
User user = authServ.getUserFromToken(token);
|
||||
if(user == null)
|
||||
return authorizedApps;
|
||||
// if authed
|
||||
authorizedApps.add(Applications.Profile);
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Student,Role.Admin},token)) {
|
||||
authorizedApps.add(Applications.Msg);
|
||||
authorizedApps.add(Applications.Forum);
|
||||
authorizedApps.add(Applications.Rdv);
|
||||
}
|
||||
|
||||
if(!authServ.isNotIn(new Role[]{Role.Teacher,Role.Admin},token))
|
||||
authorizedApps.add(Applications.ManageOwnedLessons);
|
||||
//if Teacher or Secretary or Admin add ManageCourses App
|
||||
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);
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.CreateUser);
|
||||
authorizedApps.add(Applications.UsersList);}
|
||||
|
||||
if (researchesServ.getResearcherByUser(user) != null)
|
||||
authorizedApps.add(Applications.ManageResearcherProfile);
|
||||
=======
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.UsersList);
|
||||
authorizedApps.add(Applications.ManageSchedules);
|
||||
authorizedApps.add(Applications.LessonRequests);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.InscriptionService},token)){
|
||||
authorizedApps.add(Applications.Payments);}
|
||||
>>>>>>> origin/master
|
||||
return authorizedApps;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Tables.Applications;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class ApplicationsController {
|
||||
|
||||
AuthenticatorService authServ;
|
||||
|
||||
public ApplicationsController(AuthenticatorService authServ){
|
||||
this.authServ = authServ;
|
||||
}
|
||||
|
||||
|
||||
/** return a list of authorized applications.
|
||||
* depends on the token
|
||||
*/
|
||||
@GetMapping("/apps")
|
||||
public ResponseEntity<Iterable<Applications>> getAuthorizedApps(@RequestHeader("Authorization") String token){
|
||||
return new ResponseEntity<>(getAuthorizedApplications(token), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/apps/{identifier}")
|
||||
public ResponseEntity<Boolean> getAppAuthorization(@PathVariable Applications identifier, @RequestHeader("Authorization") String token){
|
||||
|
||||
if (getAuthorizedApplications(token).contains(identifier)){
|
||||
return new ResponseEntity<>(true, HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(false, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ArrayList<Applications> getAuthorizedApplications(String token){
|
||||
ArrayList<Applications> authorizedApps = new ArrayList<>();
|
||||
|
||||
//if unAuthed
|
||||
authorizedApps.add(Applications.Login);
|
||||
|
||||
User user = authServ.getUserFromToken(token);
|
||||
if(user == null)
|
||||
return authorizedApps;
|
||||
// if authed
|
||||
authorizedApps.add(Applications.Profile);
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Student,Role.Admin},token)) {
|
||||
authorizedApps.add(Applications.Msg);
|
||||
authorizedApps.add(Applications.Forum);
|
||||
authorizedApps.add(Applications.Rdv);
|
||||
}
|
||||
|
||||
//if Teacher or Secretary or Admin add ManageCourses App
|
||||
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);
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.UsersList);}
|
||||
return authorizedApps;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
|
||||
import ovh.herisson.Clyde.Tables.Applications;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class ApplicationsController {
|
||||
|
||||
AuthenticatorService authServ;
|
||||
|
||||
ResearchesService researchesServ;
|
||||
|
||||
public ApplicationsController(AuthenticatorService authServ, ResearchesService researchesServ){
|
||||
this.researchesServ = researchesServ;
|
||||
this.authServ = authServ;
|
||||
}
|
||||
|
||||
|
||||
/** return a list of authorized applications.
|
||||
* depends on the token
|
||||
*/
|
||||
@GetMapping("/apps")
|
||||
public ResponseEntity<Iterable<Applications>> getAuthorizedApps(@RequestHeader("Authorization") String token){
|
||||
return new ResponseEntity<>(getAuthorizedApplications(token), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/apps/{identifier}")
|
||||
public ResponseEntity<Boolean> getAppAuthorization(@PathVariable Applications identifier, @RequestHeader("Authorization") String token){
|
||||
|
||||
if (getAuthorizedApplications(token).contains(identifier)){
|
||||
return new ResponseEntity<>(true, HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(false, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ArrayList<Applications> getAuthorizedApplications(String token){
|
||||
ArrayList<Applications> authorizedApps = new ArrayList<>();
|
||||
|
||||
//if unAuthed
|
||||
authorizedApps.add(Applications.Login);
|
||||
authorizedApps.add(Applications.ListResearches);
|
||||
|
||||
User user = authServ.getUserFromToken(token);
|
||||
if(user == null)
|
||||
return authorizedApps;
|
||||
// if authed
|
||||
authorizedApps.add(Applications.Profile);
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Student,Role.Admin},token)) {
|
||||
authorizedApps.add(Applications.Msg);
|
||||
authorizedApps.add(Applications.Forum);
|
||||
authorizedApps.add(Applications.Rdv);
|
||||
}
|
||||
|
||||
//if Teacher or Secretary or Admin add ManageCourses App
|
||||
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);
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.CreateUser);
|
||||
authorizedApps.add(Applications.UsersList);}
|
||||
|
||||
if (researchesServ.getResearcherByUser(user) != null)
|
||||
authorizedApps.add(Applications.ManageResearcherProfile);
|
||||
return authorizedApps;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Tables.Applications;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class ApplicationsController {
|
||||
|
||||
AuthenticatorService authServ;
|
||||
|
||||
public ApplicationsController(AuthenticatorService authServ){
|
||||
this.authServ = authServ;
|
||||
}
|
||||
|
||||
|
||||
/** return a list of authorized applications.
|
||||
* depends on the token
|
||||
*/
|
||||
@GetMapping("/apps")
|
||||
public ResponseEntity<Iterable<Applications>> getAuthorizedApps(@RequestHeader("Authorization") String token){
|
||||
return new ResponseEntity<>(getAuthorizedApplications(token), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/apps/{identifier}")
|
||||
public ResponseEntity<Boolean> getAppAuthorization(@PathVariable Applications identifier, @RequestHeader("Authorization") String token){
|
||||
|
||||
if (getAuthorizedApplications(token).contains(identifier)){
|
||||
return new ResponseEntity<>(true, HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(false, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ArrayList<Applications> getAuthorizedApplications(String token){
|
||||
ArrayList<Applications> authorizedApps = new ArrayList<>();
|
||||
|
||||
//if unAuthed
|
||||
authorizedApps.add(Applications.Login);
|
||||
authorizedApps.add(Applications.Schedule);
|
||||
|
||||
User user = authServ.getUserFromToken(token);
|
||||
if(user == null)
|
||||
return authorizedApps;
|
||||
// if authed
|
||||
authorizedApps.add(Applications.Profile);
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Student,Role.Admin},token)) {
|
||||
authorizedApps.add(Applications.Msg);
|
||||
authorizedApps.add(Applications.Forum);
|
||||
authorizedApps.add(Applications.Rdv);
|
||||
}
|
||||
|
||||
if(!authServ.isNotIn(new Role[]{Role.Teacher,Role.Admin},token))
|
||||
authorizedApps.add(Applications.ManageOwnedLessons);
|
||||
//if Teacher or Secretary or Admin add ManageCourses App
|
||||
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);
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.UsersList);
|
||||
authorizedApps.add(Applications.ManageSchedules);
|
||||
authorizedApps.add(Applications.LessonRequests);}
|
||||
|
||||
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.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.Services.*;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@ -24,10 +23,23 @@ public class CourseController {
|
||||
|
||||
private final AuthenticatorService authServ;
|
||||
|
||||
public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ) {
|
||||
private final UserService userService;
|
||||
|
||||
private final CurriculumService curriculumService;
|
||||
|
||||
private final UserCurriculumService userCurriculumService;
|
||||
|
||||
private final CurriculumCourseRepository curriculumCourseRepository;
|
||||
private final CurriculumCourseService curriculumCourseService;
|
||||
public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ, UserService userService, CurriculumService curriculumService, UserCurriculumService userCurriculumService, CurriculumCourseRepository curriculumCourseRepository, CurriculumCourseService curriculumCourseService) {
|
||||
this.courseServ = courseServ;
|
||||
this.teacherCourseServ = teacherCourseServ;
|
||||
this.authServ = authServ;
|
||||
this.userService = userService;
|
||||
this.curriculumService = curriculumService;
|
||||
this.userCurriculumService = userCurriculumService;
|
||||
this.curriculumCourseRepository = curriculumCourseRepository;
|
||||
this.curriculumCourseService = curriculumCourseService;
|
||||
}
|
||||
|
||||
@GetMapping("/course/{id}")
|
||||
@ -70,19 +82,18 @@ public class CourseController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/course")
|
||||
@PostMapping("/course/curriculum/{id}")
|
||||
public ResponseEntity<Map<String ,Object>> postCourse(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Course course)
|
||||
@RequestBody Course course,@PathVariable long id)
|
||||
{
|
||||
System.out.println(course);
|
||||
System.out.println(token);
|
||||
if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Course createdCourse = courseServ.save(course);
|
||||
if (createdCourse == null)
|
||||
Curriculum curriculum = curriculumService.findById(id);
|
||||
if (createdCourse == null || curriculum == null)
|
||||
return new ResponseEntity<>(null,HttpStatus.BAD_REQUEST);
|
||||
|
||||
CurriculumCourse curriculumCourse = new CurriculumCourse(curriculum,course);
|
||||
curriculumCourseService.save(curriculumCourse);
|
||||
return new ResponseEntity<>(ProtectionService.courseWithoutPassword(createdCourse), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@ -136,4 +147,28 @@ public class CourseController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
//Get all the courses followed by an user
|
||||
@GetMapping("/usercourses")
|
||||
public ResponseEntity<List<Course>> getAllUserCourses(@RequestHeader("Authorization") String token){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
|
||||
//We get all the actual curriculums of the user
|
||||
List<UserCurriculum> userCurricula = userCurriculumService.findByStudentAndActual(u, true);
|
||||
List<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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class CurriculumController {
|
||||
|
||||
|
||||
private final CurriculumService curriculumServ;
|
||||
private final CourseService courseServ;
|
||||
private final AuthenticatorService authServ;
|
||||
|
||||
private final UserCurriculumService userCurriculumServ;
|
||||
@ -27,8 +28,9 @@ public class CurriculumController {
|
||||
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, CourseService courseServ, AuthenticatorService authServ, UserCurriculumService userCurriculumServ, CurriculumCourseService curriculumCourseServ, InscriptionRepository ir, UserService userServ, ExternalCurriculumRepository ecr){
|
||||
this.curriculumServ = curriculumServ;
|
||||
this.courseServ = courseServ;
|
||||
this.authServ = authServ;
|
||||
this.userCurriculumServ = userCurriculumServ;
|
||||
this.curriculumCourseServ = curriculumCourseServ;
|
||||
@ -60,6 +62,18 @@ public class CurriculumController {
|
||||
return new ResponseEntity<>(curriculumCourseServ.getDepthCurriculum(curriculum),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/course/curriculum/{id}")
|
||||
public ResponseEntity<Iterable<Curriculum>> getCurriculumsByCourse(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
if(authServ.isNotIn(new Role[]{Role.Admin, Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
Course course = courseServ.findById(id);
|
||||
if(course == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
Iterable<Curriculum> curriculum = curriculumCourseServ.findCurriculumByCourses(course);
|
||||
return new ResponseEntity<>(curriculum, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Return the list of all curicullums of an user
|
||||
@GetMapping("/onescurriculum/{userId}")
|
||||
@ -91,17 +105,20 @@ public class CurriculumController {
|
||||
}
|
||||
|
||||
@PostMapping("/curriculum/{id}")
|
||||
public ResponseEntity<String> postCoursesToCurriculum(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Iterable<Long> coursesIds,
|
||||
@PathVariable long id)
|
||||
{
|
||||
public ResponseEntity<String> postCourseToCurriculum(@RequestHeader("Authorization") String token,
|
||||
@RequestBody long coursesId,
|
||||
@PathVariable long id){
|
||||
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
if (!curriculumCourseServ.saveAll(coursesIds, curriculumServ.findById(id)))
|
||||
CurriculumCourse curriculumCourse = new CurriculumCourse(curriculumServ.findById(id), courseServ.findById(coursesId));
|
||||
if(curriculumCourse.getCourse() == null || curriculumCourse.getCurriculum() == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
|
||||
curriculumCourseServ.save(curriculumCourse);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,16 @@ public class ExternalCurriculumController {
|
||||
//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){
|
||||
InscriptionRequest ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId"));
|
||||
//An external curriculum can either be linked to an User or to an InscriptionRequest
|
||||
InscriptionRequest ir = null;
|
||||
User user = null;
|
||||
if (externalCurrInfos.get("inscriptionRequestId") != null){
|
||||
ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId"));
|
||||
}else{
|
||||
user = userRepository.findById((Integer) externalCurrInfos.get("userRegNo"));
|
||||
}
|
||||
|
||||
ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), null);
|
||||
ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifdocUrl"), user);
|
||||
|
||||
return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK);
|
||||
}
|
||||
|
@ -3,10 +3,12 @@ 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.CurriculumRepository;
|
||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.Inscription.InscriptionService;
|
||||
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.Role;
|
||||
@ -19,17 +21,18 @@ public class InscriptionController {
|
||||
|
||||
private final InscriptionService inscriptionServ;
|
||||
private final AuthenticatorService authServ;
|
||||
|
||||
public InscriptionController(InscriptionService inscriptionServ, AuthenticatorService authServ){
|
||||
private final CurriculumRepository curriculumRepository;
|
||||
public InscriptionController(InscriptionService inscriptionServ, AuthenticatorService authServ, CurriculumRepository curriculumRepository){
|
||||
this.inscriptionServ = inscriptionServ;
|
||||
this.authServ = authServ;
|
||||
this.curriculumRepository = curriculumRepository;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/requests/register")
|
||||
public ResponseEntity<Iterable<Map<String,Object>>> getAllRequests(@RequestHeader("Authorization") String token){
|
||||
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token))
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll();
|
||||
@ -41,7 +44,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},token))
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
InscriptionRequest foundInscriptionRequest = inscriptionServ.getById(id);
|
||||
@ -87,6 +90,12 @@ public class InscriptionController {
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
InscriptionRequest toEdit = inscriptionServ.getById(id);
|
||||
|
||||
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
|
||||
if (toEdit.getEquivalenceState() == RequestState.Accepted){
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
toEdit.setEquivalenceState(newstate);
|
||||
|
||||
inscriptionServ.save(toEdit);
|
||||
@ -97,4 +106,31 @@ public class InscriptionController {
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PatchMapping("/request/registerequivimpose/{id}/{cursusid}")
|
||||
public ResponseEntity<Object> editRegisterEquiv(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable long cursusid){
|
||||
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);
|
||||
}
|
||||
|
||||
//We impose a curriculum
|
||||
Curriculum curriculum = curriculumRepository.findById(cursusid);
|
||||
|
||||
toEdit.setCurriculumId(curriculum.getCurriculumId());
|
||||
toEdit.setEquivalenceState(RequestState.Accepted);
|
||||
|
||||
inscriptionServ.save(toEdit);
|
||||
|
||||
if (toEdit.getState() == RequestState.Accepted && (toEdit.getEquivalenceState() == RequestState.Accepted || toEdit.getEquivalenceState() == RequestState.Unrequired))
|
||||
{
|
||||
inscriptionServ.createUser(toEdit);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,12 @@ public class PaymentController {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -4,18 +4,22 @@ 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.Inscription.ExemptionsRequestRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Inscription.ScholarshipRequestRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Inscription.UninscriptionRequestRepository;
|
||||
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Inscription.*;
|
||||
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.Minerval;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,20 +27,32 @@ import java.util.Map;
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class RequestsController {
|
||||
|
||||
public final TokenService tokenService;
|
||||
public final ExemptionsRequestRepository err;
|
||||
public final ScholarshipRequestRepository srr;
|
||||
public final UserRepository userRepository;
|
||||
public final AuthenticatorService authServ;
|
||||
public final UninscriptionRequestRepository uninscriptionRequestRepository;
|
||||
public final UnregisterRequestRepository unregisterRequestRepository;
|
||||
public final CourseRepository courseRepository;
|
||||
public final UserService userService;
|
||||
public final UserCurriculumRepository userCurriculumRepository;
|
||||
public final CurriculumRepository curriculumRepository;
|
||||
public final MinervalRepository minervalRepository;
|
||||
public final ChangeCurriculumRequestRepository changeCurriculumRequestRepository;
|
||||
|
||||
public RequestsController(ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UninscriptionRequestRepository uninscriptionRequestRepository, CourseRepository courseRepository) {
|
||||
public RequestsController(TokenService tokenService, ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService, UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepository, MinervalRepository minervalRepository, ChangeCurriculumRequestRepository changeCurriculumRequestRepository) {
|
||||
this.tokenService = tokenService;
|
||||
this.err = err;
|
||||
this.srr = srr;
|
||||
this.userRepository = userRepository;
|
||||
this.authServ = authServ;
|
||||
this.uninscriptionRequestRepository = uninscriptionRequestRepository;
|
||||
this.unregisterRequestRepository = unregisterRequestRepository;
|
||||
this.courseRepository = courseRepository;
|
||||
this.userService = userService;
|
||||
this.userCurriculumRepository = userCurriculumRepository;
|
||||
this.curriculumRepository = curriculumRepository;
|
||||
this.minervalRepository = minervalRepository;
|
||||
this.changeCurriculumRequestRepository = changeCurriculumRequestRepository;
|
||||
}
|
||||
|
||||
@PostMapping(value="/exemptionreq")
|
||||
@ -64,7 +80,7 @@ public class RequestsController {
|
||||
//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.Secretary,Role.InscriptionService},token))
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
ArrayList<ExemptionsRequest> toReturn = new ArrayList<>();
|
||||
@ -74,6 +90,33 @@ public class RequestsController {
|
||||
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){
|
||||
@ -87,11 +130,244 @@ public class RequestsController {
|
||||
return new ResponseEntity<>(toReturn, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/uninscriptionreq")
|
||||
@PostMapping(value = "/unregister")
|
||||
public ResponseEntity<String> postUnregReq(@RequestBody Map<String,Object> uninscr){
|
||||
User u = userRepository.findById((int) uninscr.get("userId"));
|
||||
UninscriptionRequest ur = new UninscriptionRequest(RequestState.Pending, (String) uninscr.get("reason"), new Date(), u);
|
||||
uninscriptionRequestRepository.save(ur);
|
||||
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"));
|
||||
|
||||
User u = scholarshipRequest.getUser();
|
||||
|
||||
//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"));
|
||||
|
||||
//We then deduce then amount from the minerval
|
||||
ArrayList<Minerval> minerval = minervalRepository.getMinervalsByStudentRegNoOrderByYearDesc(u.getRegNo());
|
||||
minerval.get(0).setPaidAmount(minerval.get(0).getPaidAmount() + scholarshipRequest.getAmount());
|
||||
minerval.get(0).setToPay(minerval.get(0).getToPay() - scholarshipRequest.getAmount());
|
||||
minervalRepository.save(minerval.get(0));
|
||||
}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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,129 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
/******************************************************
|
||||
* @file LessonController.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Controller of Lessons API
|
||||
******************************************************/
|
||||
|
||||
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.LessonService;
|
||||
import ovh.herisson.Clyde.Services.ProtectionService;
|
||||
import ovh.herisson.Clyde.Services.ScheduleLessonService;
|
||||
import ovh.herisson.Clyde.Tables.Lesson;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class LessonController {
|
||||
private final LessonService lessonServ;
|
||||
|
||||
private final ScheduleLessonService scheduleLessonServ;
|
||||
private final AuthenticatorService authServ;
|
||||
|
||||
public LessonController(LessonService lessonServ, ScheduleLessonService scheduleLessonService, AuthenticatorService authServ) {
|
||||
this.lessonServ = lessonServ;
|
||||
this.scheduleLessonServ = scheduleLessonService;
|
||||
this.authServ = authServ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a lesson via its id
|
||||
*/
|
||||
@GetMapping("/lesson/{id}")
|
||||
public ResponseEntity<HashMap<String,Object>> getLesson(@PathVariable long id){
|
||||
Lesson lesson = lessonServ.findById(id);
|
||||
|
||||
if(lesson == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(ProtectionService.lessonWithoutPassword(lesson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the lessons
|
||||
*/
|
||||
@GetMapping("/lessons")
|
||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllLessons(@RequestHeader("Authorization") String token){
|
||||
if(authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
return new ResponseEntity<>(ProtectionService.lessonsWithoutPassword(lessonServ.findAll()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the lessons of a teacher's courses
|
||||
*/
|
||||
@GetMapping("/lessons/owned")
|
||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getOwnedLessons(@RequestHeader("Authorization") String token){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token)){
|
||||
return new UnauthorizedResponse<>(null);}
|
||||
return new ResponseEntity<>(ProtectionService.lessonsWithoutPassword(lessonServ.findAllOwnedLesson(authServ.getUserFromToken(token))),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
⋅* Return all the lessons of a student
|
||||
*/
|
||||
@GetMapping("/lessons/OwnCurriculum")
|
||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getOnesLessons(@RequestHeader("Authorization") String token){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Student},token)){
|
||||
return new UnauthorizedResponse<>(null);}
|
||||
return new ResponseEntity<>(ProtectionService.lessonsWithoutPassword(lessonServ.findOnesLessons(authServ.getUserFromToken(token))),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post a new lesson
|
||||
*/
|
||||
@PostMapping("/lesson")
|
||||
public ResponseEntity<HashMap<String, Object>> postLesson(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Map<String, Object> lessonInfos){
|
||||
if(authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
|
||||
Lesson lesson = lessonServ.createLesson(lessonInfos);
|
||||
Lesson createdLesson = lessonServ.save(lesson);
|
||||
scheduleLessonServ.saveToAllSchedule(lesson);
|
||||
|
||||
if(createdLesson==null)
|
||||
return new ResponseEntity<>(null,HttpStatus.BAD_REQUEST);
|
||||
return new ResponseEntity<>(ProtectionService.lessonWithoutPassword(createdLesson), HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Modify a lesson
|
||||
*/
|
||||
@PatchMapping("/lesson/{id}")
|
||||
public ResponseEntity<Lesson> patchLesson(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Map<String, Object> updates,
|
||||
@PathVariable long id){
|
||||
if(authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
if(!lessonServ.modifyData(id, updates)){
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Delete a lesson
|
||||
*/
|
||||
@DeleteMapping("lesson/{id}")
|
||||
public ResponseEntity<String> deleteLesson(@RequestHeader("Authorization") String token,
|
||||
@PathVariable Long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
Lesson toDelete = lessonServ.findById(id);
|
||||
if(toDelete == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
lessonServ.delete(toDelete);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
/******************************************************
|
||||
* @file LessonRequestsController.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Controller of lesson requests API
|
||||
******************************************************/
|
||||
|
||||
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.LessonRequestService;
|
||||
import ovh.herisson.Clyde.Services.LessonService;
|
||||
import ovh.herisson.Clyde.Services.ProtectionService;
|
||||
import ovh.herisson.Clyde.Tables.LessonChangesRequest;
|
||||
import ovh.herisson.Clyde.Tables.RequestState;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class LessonRequestsController {
|
||||
private final LessonRequestService lessonRequestServ;
|
||||
private final AuthenticatorService authServ;
|
||||
|
||||
private final LessonService lessonServ;
|
||||
public LessonRequestsController(LessonRequestService lessonRequestServer, AuthenticatorService authServ, LessonService lessonServ) {
|
||||
this.lessonRequestServ = lessonRequestServer;
|
||||
this.authServ = authServ;
|
||||
this.lessonServ = lessonServ;
|
||||
}
|
||||
/**
|
||||
* Return a lesson request via its id
|
||||
*/
|
||||
@GetMapping("/requests/lessonRequest/{id}")
|
||||
public ResponseEntity<Map<String,Object>> getById(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
LessonChangesRequest lessonRequest= lessonRequestServ.findById(id);
|
||||
|
||||
return new ResponseEntity<>(ProtectionService.lessonRequestWithoutPassword(lessonRequest), HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* return all the requests made by a user
|
||||
*/
|
||||
@GetMapping("/requests/lessonRequests/owned")
|
||||
public ResponseEntity<Iterable<Map<String, Object>>> getOwnedRequests(@RequestHeader("Authorization") String token){
|
||||
if(authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
User user = authServ.getUserFromToken(token);
|
||||
Iterable<LessonChangesRequest> lessonChangesRequests = lessonRequestServ.findOwnRequests(user);
|
||||
return new ResponseEntity<>(ProtectionService.lessonRequestsWithoutPassword(lessonChangesRequests),HttpStatus.OK);
|
||||
|
||||
}
|
||||
/**
|
||||
* Return all the lesson requests
|
||||
*/
|
||||
@GetMapping("/requests/lessonRequests")
|
||||
public ResponseEntity<Iterable<Map<String,Object>>> getAllRequests(@RequestHeader("Authorization") String token){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Iterable<LessonChangesRequest> lessonRequests= lessonRequestServ.getAll();
|
||||
|
||||
return new ResponseEntity<>(ProtectionService.lessonRequestsWithoutPassword(lessonRequests), HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Post a lesson request
|
||||
*/
|
||||
@PostMapping("/requests/lessonRequest")
|
||||
public ResponseEntity<Map<String, Object>> makeRequest(@RequestHeader("Authorization") String token, @RequestBody Map<String,Object> lessonRequestInfos){
|
||||
if(authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
LessonChangesRequest lessonChangesRequest = lessonRequestServ.createLessonRequest(lessonRequestInfos);
|
||||
LessonChangesRequest createdRequest = lessonRequestServ.save(lessonChangesRequest);
|
||||
if(createdRequest == null)
|
||||
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
|
||||
return new ResponseEntity<>(ProtectionService.lessonRequestWithoutPassword(lessonChangesRequest),HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Modify a lesson Request
|
||||
*/
|
||||
@PatchMapping("/requests/lessonRequest/{id}")
|
||||
public ResponseEntity<LessonChangesRequest> changeRequestState(@PathVariable long id,
|
||||
@RequestHeader("Authorization") String token,
|
||||
@RequestBody Map<String , Object> infos){
|
||||
if(authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
LessonChangesRequest lessonRequest = lessonRequestServ.findById(id);
|
||||
String local = "";
|
||||
RequestState state = null;
|
||||
for (Map.Entry<String, Object> entry : infos.entrySet()) {
|
||||
switch (entry.getKey()) {
|
||||
case "local":
|
||||
local = (String) entry.getValue();
|
||||
break;
|
||||
case "state":
|
||||
state = RequestState.valueOf((String)entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (state == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
if(lessonRequest.getRequestType() == 0 ) {
|
||||
if (!lessonRequestServ.modifyCreateRequestState(lessonRequest, state, local))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
else if(lessonRequest.getRequestType() == 1){
|
||||
infos.put("lessonStart", lessonRequest.getLessonStart());
|
||||
infos.put("lessonEnd", lessonRequest.getLessonEnd());
|
||||
infos.put("lessonType",lessonRequest.getLessonType());
|
||||
if(!lessonRequestServ.modifyChangeRequestState(infos,lessonRequest.getLessonId(),state))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
lessonRequest.setState(state);
|
||||
}
|
||||
|
||||
else{
|
||||
lessonRequestServ.modifyDeleteRequest(lessonRequest, state);
|
||||
lessonRequest.setState(state);
|
||||
|
||||
}
|
||||
lessonRequestServ.save(lessonRequest);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a lesson request
|
||||
*/
|
||||
@DeleteMapping("/requests/lessonRequest/{id}")
|
||||
public ResponseEntity<String> deleteRequest(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
if(authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
LessonChangesRequest lessonChangesRequest = lessonRequestServ.findById(id);
|
||||
if (lessonChangesRequest == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
lessonRequestServ.delete(lessonChangesRequest);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
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.Services.*;
|
||||
import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
@ -18,14 +18,14 @@ import ovh.herisson.Clyde.Tables.Inscription.ExternalCurriculum;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.Minerval;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
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;
|
||||
@ -35,13 +35,21 @@ public class MockController {
|
||||
public final ExternalCurriculumRepository externalCurriculumRepository;
|
||||
public final InscriptionService inscriptionService;
|
||||
|
||||
public final LessonService lessonService;
|
||||
public final ScheduleService scheduleService;
|
||||
public final ScheduleLessonService scheduleLessonService;
|
||||
|
||||
public final LessonRequestService lessonRequestService;
|
||||
ArrayList<User> mockUsers;
|
||||
|
||||
public final ResearchesService researchesService;
|
||||
public final UserCurriculumRepository ucr;
|
||||
public final MinervalRepository minervalRepository;
|
||||
public final ScholarshipRequestRepository scholarshipRequestRepository;
|
||||
|
||||
ArrayList<User> mockUsers;
|
||||
public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, ResearchesService researchesService, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository){
|
||||
public final UnregisterRequestRepository uninscriptionRequestRepository;
|
||||
public MockController(UserService userService, UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, ResearchesService researchesService, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository, UnregisterRequestRepository unregisterRequestRepository, LessonService lessonService, ScheduleService scheduleService, ScheduleLessonService scheduleLessonService, LessonRequestService lessonRequestService){
|
||||
this.userService = userService;
|
||||
this.tokenRepo = tokenRepo;
|
||||
this.userRepo = userRepo;
|
||||
this.tokenService = tokenService;
|
||||
@ -51,9 +59,14 @@ public class MockController {
|
||||
this.externalCurriculumRepository = externalCurriculumRepository;
|
||||
this.inscriptionService = inscriptionService;
|
||||
this.researchesService = researchesService;
|
||||
this.lessonService = lessonService;
|
||||
this.scheduleService = scheduleService;
|
||||
this.scheduleLessonService = scheduleLessonService;
|
||||
this.lessonRequestService = lessonRequestService;
|
||||
this.ucr = ucr;
|
||||
this.minervalRepository = minervalRepository;
|
||||
this.scholarshipRequestRepository = scholarshipRequestRepository;
|
||||
this.uninscriptionRequestRepository = unregisterRequestRepository;
|
||||
}
|
||||
|
||||
/** Saves an example of each user type by :
|
||||
@ -65,47 +78,55 @@ public class MockController {
|
||||
@PostMapping("/mock")
|
||||
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));
|
||||
|
||||
userRepo.saveAll(mockUsers);
|
||||
// user part
|
||||
User herobrine = new User("brine","hero","admin@admin.com","behind","ShadowsLand",new Date(0), null,Role.Admin,"admin");
|
||||
User joe = new User("Mama","Joe","student@student.com","roundabout","England",new Date(0), null,Role.Student,"student");
|
||||
User meh = new User("Polo","Marco","secretary@secretary.com","a Box","Monaco",new Date(0), null,Role.Secretary,"secretary");
|
||||
User joke = new User("Gaillard","Corentin","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,"teacher");
|
||||
User jojo = new User("Bridoux","Justin","teacher2@teacher2.com","lab","faculty",new Date(0), null,Role.Teacher,"teacher");
|
||||
User lena = new User("Louille","Lena","inscriptionService@InscriptionService.com","no","yes",new Date(0), null,Role.InscriptionService,"inscriptionService");
|
||||
User popo = new User("Smith", "Paul", "paulsmith@gmail.com", "306 rue du poulet", "belgique", new Date(0), null, Role.Student, "jesuispaulleroi");
|
||||
mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena,jojo, popo));
|
||||
|
||||
userService.saveAll(mockUsers);
|
||||
|
||||
ExternalCurriculum externalCurriculum = new ExternalCurriculum(null, "HEH", "Bachelier en ingénieur", "completed", 2015, 2017, null, joe);
|
||||
externalCurriculumRepository.save(externalCurriculum);
|
||||
|
||||
Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023);
|
||||
minervalRepository.save(minerval);
|
||||
// Course / Curriculum part
|
||||
|
||||
Curriculum infoBab1 = new Curriculum(1, "info");
|
||||
Curriculum chemistryBab1 = new Curriculum(1, "chemistry");
|
||||
Curriculum psychologyBab1 = new Curriculum(1, "psychology");
|
||||
Curriculum infoBab2 = new Curriculum(2, "info");
|
||||
Curriculum masterinfo1 = new Curriculum(4, "info");
|
||||
Curriculum masterinfo2 = new Curriculum(5, "info");
|
||||
Curriculum infoBab1 = new Curriculum(1,"info", false);
|
||||
Curriculum chemistryBab1 = new Curriculum(1,"chemistry", false);
|
||||
Curriculum psychologyBab1 = new Curriculum(1,"psychology", false);
|
||||
Curriculum infoBab2 = new Curriculum(2,"info", false);
|
||||
Curriculum masterinfo1 = new Curriculum(4, "info", false);
|
||||
Curriculum masterinfo2 = new Curriculum(5, "info", false);
|
||||
Curriculum chemistryBab2 = new Curriculum(2, "chemistry", false);
|
||||
Curriculum ingebab1 = new Curriculum(1, "ingénieur", true);
|
||||
|
||||
curriculumService.save(infoBab1);
|
||||
curriculumService.save(chemistryBab1);
|
||||
curriculumService.save(psychologyBab1);
|
||||
curriculumService.save(infoBab2);
|
||||
curriculumService.save(masterinfo1);
|
||||
curriculumService.save(masterinfo2);
|
||||
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));
|
||||
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023));
|
||||
ucr.save(new UserCurriculum(joe, infoBab1, 2023));
|
||||
ucr.save(new UserCurriculum(joe, psychologyBab1, 2020));
|
||||
ucr.save(new UserCurriculum(popo, infoBab1, 2022));
|
||||
ucr.save(new UserCurriculum(popo, infoBab2, 2023));
|
||||
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", joke);
|
||||
Course psycho1 = new Course(21, "Neuroreaction of isolated brain cells", joke);
|
||||
Course commun = new Course(2, "cours commun", joke);
|
||||
Course progra1 = new Course(5,"Programmation et algorithmique 1",joke);
|
||||
Course chemistry1 = new Course(12, "Thermochimie",jojo);
|
||||
Course psycho1 = new Course(21, "Neuroreaction of isolated brain cells",joke);
|
||||
Course commun = new Course(2, "cours commun",joke);
|
||||
|
||||
courseService.save(progra1);
|
||||
courseService.save(chemistry1);
|
||||
@ -115,18 +136,19 @@ public class MockController {
|
||||
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(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);
|
||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 4,RequestState.Pending,"yes.png","password", null, new Date(), RequestState.Pending, null);
|
||||
|
||||
inscriptionService.save(inscriptionRequest);
|
||||
ExternalCurriculum externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null);
|
||||
@ -161,6 +183,55 @@ public class MockController {
|
||||
researchesService.saveResearch(privateResearch);
|
||||
researchesService.saveResearch(jojoResearch);
|
||||
|
||||
|
||||
//Schedule part
|
||||
|
||||
Lesson lesson_0_progra1 = new Lesson(progra1, "Mon Apr 22 2024 08:15", "Mon Apr 22 2024 10:15","rgb(0,50,100)","A0B2","Course");
|
||||
Lesson lesson_0_chemistry1 = new Lesson(chemistry1, "Wed Mar 27 2024 08:15", "Wed Mar 27 2024 09:15","rgb(100,50,0)","A0B2","TP");
|
||||
Lesson lesson_0_psycho1 = new Lesson(psycho1, "Sun Mar 24 2024 10:30 ","Sun Mar 24 2024 12:30 ","rgb(100,50,100)", "A0B2","TD");
|
||||
Lesson lesson_1_progra1 = new Lesson(progra1, "Mon Apr 02 2024 13:30", "Mon Apr 02 2024 15:30","rgb(0,50,100)","A0B2","TP");
|
||||
Lesson lesson_0_commun = new Lesson(commun, "Mon Apr 01 2024 10:30", "Mon Apr 01 2024 12:30","rgb(0,50,100)","A0B2","Course");
|
||||
|
||||
LessonChangesRequest request1 = new LessonChangesRequest(joke,RequestState.Pending,null,null,null,null,2,null,1);
|
||||
LessonChangesRequest request2 = new LessonChangesRequest(joke,RequestState.Pending,"Fri Apr 19 2024 10:30 ","Fri Apr 19 2024 12:30 ",null,null,1,null,2);
|
||||
LessonChangesRequest request3 = new LessonChangesRequest(joke,RequestState.Pending,"Fri Apr 19 2024 13:30 ","Fri Apr 19 2024 15:30 ","Course",progra1,0,"rgb(27,49,100)",4);
|
||||
|
||||
|
||||
Schedule infoBab1Schedule = new Schedule(infoBab1);
|
||||
Schedule chemistryBab1Schedule = new Schedule(chemistryBab1);
|
||||
Schedule psychoBab1Schedule = new Schedule(psychologyBab1);
|
||||
|
||||
|
||||
scheduleService.save(infoBab1Schedule);
|
||||
scheduleService.save(chemistryBab1Schedule);
|
||||
scheduleService.save(psychoBab1Schedule);
|
||||
|
||||
lessonService.save(lesson_0_progra1);
|
||||
lessonService.save(lesson_0_chemistry1);
|
||||
lessonService.save(lesson_0_commun);
|
||||
lessonService.save(lesson_0_psycho1);
|
||||
lessonService.save(lesson_1_progra1);
|
||||
|
||||
scheduleLessonService.save(new ScheduleLesson(infoBab1Schedule,lesson_0_progra1));
|
||||
scheduleLessonService.save(new ScheduleLesson(infoBab1Schedule,lesson_1_progra1));
|
||||
scheduleLessonService.save(new ScheduleLesson(infoBab1Schedule,lesson_0_commun));
|
||||
|
||||
scheduleLessonService.save(new ScheduleLesson(chemistryBab1Schedule,lesson_0_chemistry1));
|
||||
scheduleLessonService.save(new ScheduleLesson(chemistryBab1Schedule,lesson_0_commun));
|
||||
|
||||
scheduleLessonService.save(new ScheduleLesson(psychoBab1Schedule,lesson_0_psycho1));
|
||||
scheduleLessonService.save(new ScheduleLesson(psychoBab1Schedule,lesson_0_commun));
|
||||
|
||||
|
||||
lessonRequestService.save(request1);
|
||||
lessonRequestService.save(request2);
|
||||
lessonRequestService.save(request3);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,307 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
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.Services.*;
|
||||
import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
<<<<<<< HEAD
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Access;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.PaperType;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
|
||||
import ovh.herisson.Clyde.Services.Inscription.InscriptionService;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ExternalCurriculum;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.Minerval;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
||||
=======
|
||||
import ovh.herisson.Clyde.Tables.Inscription.*;
|
||||
>>>>>>> origin/master
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class MockController {
|
||||
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;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
public final LessonService lessonService;
|
||||
public final ScheduleService scheduleService;
|
||||
public final ScheduleLessonService scheduleLessonService;
|
||||
|
||||
public final LessonRequestService lessonRequestService;
|
||||
ArrayList<User> mockUsers;
|
||||
>>>>>>> origin/master
|
||||
|
||||
public final ResearchesService researchesService;
|
||||
public final UserCurriculumRepository ucr;
|
||||
public final MinervalRepository minervalRepository;
|
||||
public final ScholarshipRequestRepository scholarshipRequestRepository;
|
||||
|
||||
<<<<<<< HEAD
|
||||
ArrayList<User> mockUsers;
|
||||
public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, ResearchesService researchesService, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository){
|
||||
=======
|
||||
public final UnregisterRequestRepository uninscriptionRequestRepository;
|
||||
public MockController(UserService userService, UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository, UnregisterRequestRepository unregisterRequestRepository, LessonService lessonService, ScheduleService scheduleService, ScheduleLessonService scheduleLessonService, LessonRequestService lessonRequestService){
|
||||
this.userService = userService;
|
||||
>>>>>>> origin/master
|
||||
this.tokenRepo = tokenRepo;
|
||||
this.userRepo = userRepo;
|
||||
this.tokenService = tokenService;
|
||||
this.CurriculumCourseService = CurriculumCourseService;
|
||||
this.curriculumService = curriculumService;
|
||||
this.courseService = courseService;
|
||||
this.externalCurriculumRepository = externalCurriculumRepository;
|
||||
this.inscriptionService = inscriptionService;
|
||||
<<<<<<< HEAD
|
||||
this.researchesService = researchesService;
|
||||
=======
|
||||
this.lessonService = lessonService;
|
||||
this.scheduleService = scheduleService;
|
||||
this.scheduleLessonService = scheduleLessonService;
|
||||
this.lessonRequestService = lessonRequestService;
|
||||
>>>>>>> origin/master
|
||||
this.ucr = ucr;
|
||||
this.minervalRepository = minervalRepository;
|
||||
this.scholarshipRequestRepository = scholarshipRequestRepository;
|
||||
this.uninscriptionRequestRepository = unregisterRequestRepository;
|
||||
}
|
||||
|
||||
/** Saves an example of each user type by :
|
||||
* email : FooRole@FooRole.com, password : FooRole and token : FooRole
|
||||
* For example the admin as "admin@admin.com" as email and "admin" as both password and token
|
||||
* They all have silly names
|
||||
*/
|
||||
|
||||
@PostMapping("/mock")
|
||||
public void postMock() {
|
||||
|
||||
<<<<<<< HEAD
|
||||
// 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));
|
||||
|
||||
userRepo.saveAll(mockUsers);
|
||||
=======
|
||||
// user part
|
||||
User herobrine = new User("brine","hero","admin@admin.com","behind","ShadowsLand",new Date(0), null,Role.Admin,"admin");
|
||||
User joe = new User("Mama","Joe","student@student.com","roundabout","England",new Date(0), null,Role.Student,"student");
|
||||
User meh = new User("Polo","Marco","secretary@secretary.com","a Box","Monaco",new Date(0), null,Role.Secretary,"secretary");
|
||||
User joke = new User("Gaillard","Corentin","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,"teacher");
|
||||
User jojo = new User("Bridoux","Justin","teacher2@teacher2.com","lab","faculty",new Date(0), null,Role.Teacher,"teacher");
|
||||
User lena = new User("Louille","Lena","inscriptionService@InscriptionService.com","no","yes",new Date(0), null,Role.InscriptionService,"inscriptionService");
|
||||
User popo = new User("Smith", "Paul", "paulsmith@gmail.com", "306 rue du poulet", "belgique", new Date(0), null, Role.Student, "jesuispaulleroi");
|
||||
mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena,jojo, popo));
|
||||
|
||||
userService.saveAll(mockUsers);
|
||||
|
||||
ExternalCurriculum externalCurriculum = new ExternalCurriculum(null, "HEH", "Bachelier en ingénieur", "completed", 2015, 2017, null, joe);
|
||||
externalCurriculumRepository.save(externalCurriculum);
|
||||
>>>>>>> origin/master
|
||||
|
||||
Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023);
|
||||
minervalRepository.save(minerval);
|
||||
// Course / Curriculum part
|
||||
|
||||
<<<<<<< HEAD
|
||||
Curriculum infoBab1 = new Curriculum(1, "info");
|
||||
Curriculum chemistryBab1 = new Curriculum(1, "chemistry");
|
||||
Curriculum psychologyBab1 = new Curriculum(1, "psychology");
|
||||
Curriculum infoBab2 = new Curriculum(2, "info");
|
||||
Curriculum masterinfo1 = new Curriculum(4, "info");
|
||||
Curriculum masterinfo2 = new Curriculum(5, "info");
|
||||
|
||||
curriculumService.save(infoBab1);
|
||||
curriculumService.save(chemistryBab1);
|
||||
curriculumService.save(psychologyBab1);
|
||||
curriculumService.save(infoBab2);
|
||||
curriculumService.save(masterinfo1);
|
||||
curriculumService.save(masterinfo2);
|
||||
|
||||
ucr.save(new UserCurriculum(joe, infoBab1, 2022));
|
||||
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023));
|
||||
ucr.save(new UserCurriculum(joe, infoBab1, 2023));
|
||||
ucr.save(new UserCurriculum(joe, psychologyBab1, 2020));
|
||||
ucr.save(new UserCurriculum(popo, infoBab1, 2022));
|
||||
ucr.save(new UserCurriculum(popo, infoBab2, 2023));
|
||||
|
||||
Course progra1 = new Course(5, "Programmation et algorithmique 1", joke);
|
||||
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);
|
||||
=======
|
||||
Curriculum infoBab1 = new Curriculum(1,"info", false);
|
||||
Curriculum chemistryBab1 = new Curriculum(1,"chemistry", false);
|
||||
Curriculum psychologyBab1 = new Curriculum(1,"psychology", false);
|
||||
Curriculum infoBab2 = new Curriculum(2,"info", false);
|
||||
Curriculum masterinfo1 = new Curriculum(4, "info", false);
|
||||
Curriculum masterinfo2 = new Curriculum(5, "info", false);
|
||||
Curriculum chemistryBab2 = new Curriculum(2, "chemistry", false);
|
||||
Curriculum ingebab1 = new Curriculum(1, "ingénieur", true);
|
||||
|
||||
curriculumService.save(infoBab1);
|
||||
curriculumService.save(chemistryBab1);
|
||||
curriculumService.save(psychologyBab1);
|
||||
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 psycho1 = new Course(21, "Neuroreaction of isolated brain cells",joke);
|
||||
Course commun = new Course(2, "cours commun",joke);
|
||||
>>>>>>> origin/master
|
||||
|
||||
courseService.save(progra1);
|
||||
courseService.save(chemistry1);
|
||||
courseService.save(psycho1);
|
||||
courseService.save(commun);
|
||||
|
||||
ScholarshipRequest ssr1 = new ScholarshipRequest(joe, RequestState.Pending, 0, new Date(), "test", "test");
|
||||
scholarshipRequestRepository.save(ssr1);
|
||||
|
||||
<<<<<<< HEAD
|
||||
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(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));
|
||||
>>>>>>> origin/master
|
||||
|
||||
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1, commun));
|
||||
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1, chemistry1));
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen", "prenom", "non", "helen@gmail.com", "america", new Date(), (long) 4, RequestState.Pending, "yes.png", "password", null, new Date(), RequestState.Pending);
|
||||
=======
|
||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 4,RequestState.Pending,"yes.png","password", null, new Date(), RequestState.Pending, null);
|
||||
>>>>>>> origin/master
|
||||
|
||||
inscriptionService.save(inscriptionRequest);
|
||||
ExternalCurriculum externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null);
|
||||
externalCurriculumRepository.save(externalCurriculum);
|
||||
|
||||
///////////////////////////
|
||||
// extension Publications Scientifiques
|
||||
Researcher jojoResearcherAccount = new Researcher(jojo, "3363-22555-AB33-T", null, "IT");
|
||||
|
||||
Researcher joResearchAccount = new Researcher(joe,"N555-321213-BED-DD",null, "Physics");
|
||||
|
||||
|
||||
Researcher output = researchesService.saveResearcher(jojoResearcherAccount);
|
||||
Researcher joOutput = researchesService.saveResearcher(joResearchAccount);
|
||||
|
||||
Set<Researcher> coAuthor = new HashSet<>();
|
||||
coAuthor.add(joOutput);
|
||||
|
||||
Research jojoResearch = new Research("Graphs : Advanced Search Algorithms", output, new Date(0),
|
||||
PaperType.Article, "test.pdf", null, "english",
|
||||
Access.OpenSource, "IT", "This Article's title speaks for itself \n We'll discuss about advanced Graph search Algorithms",coAuthor);
|
||||
Research restrictedResearch = new Research("just another Name", output, new Date(1111111111),
|
||||
PaperType.Article, "restricted", null, "english",
|
||||
Access.Restricted, "Restricted", "This Article's title speaks for itself\n We'll discuss about advanced Graph search Algorithms", new HashSet<>());
|
||||
|
||||
Research privateResearch = new Research("the great Potato War", output, new Date(),
|
||||
PaperType.Article, "private", null, "english",
|
||||
Access.Private, "private", "This Article's title speaks for itself\n We'll discuss about advanced Graph search Algorithms",null);
|
||||
|
||||
|
||||
researchesService.saveResearch(restrictedResearch);
|
||||
researchesService.saveResearch(privateResearch);
|
||||
researchesService.saveResearch(jojoResearch);
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
//Schedule part
|
||||
|
||||
Lesson lesson_0_progra1 = new Lesson(progra1, "Mon Apr 22 2024 08:15", "Mon Apr 22 2024 10:15","rgb(0,50,100)","A0B2","Course");
|
||||
Lesson lesson_0_chemistry1 = new Lesson(chemistry1, "Wed Mar 27 2024 08:15", "Wed Mar 27 2024 09:15","rgb(100,50,0)","A0B2","TP");
|
||||
Lesson lesson_0_psycho1 = new Lesson(psycho1, "Sun Mar 24 2024 10:30 ","Sun Mar 24 2024 12:30 ","rgb(100,50,100)", "A0B2","TD");
|
||||
Lesson lesson_1_progra1 = new Lesson(progra1, "Mon Apr 02 2024 13:30", "Mon Apr 02 2024 15:30","rgb(0,50,100)","A0B2","TP");
|
||||
Lesson lesson_0_commun = new Lesson(commun, "Mon Apr 01 2024 10:30", "Mon Apr 01 2024 12:30","rgb(0,50,100)","A0B2","Course");
|
||||
|
||||
LessonChangesRequest request1 = new LessonChangesRequest(joke,RequestState.Pending,null,null,null,null,2,null,1);
|
||||
LessonChangesRequest request2 = new LessonChangesRequest(joke,RequestState.Pending,"Fri Apr 19 2024 10:30 ","Fri Apr 19 2024 12:30 ",null,null,1,null,2);
|
||||
LessonChangesRequest request3 = new LessonChangesRequest(joke,RequestState.Pending,"Fri Apr 19 2024 13:30 ","Fri Apr 19 2024 15:30 ","Course",progra1,0,"rgb(27,49,100)",4);
|
||||
|
||||
|
||||
Schedule infoBab1Schedule = new Schedule(infoBab1);
|
||||
Schedule chemistryBab1Schedule = new Schedule(chemistryBab1);
|
||||
Schedule psychoBab1Schedule = new Schedule(psychologyBab1);
|
||||
|
||||
|
||||
scheduleService.save(infoBab1Schedule);
|
||||
scheduleService.save(chemistryBab1Schedule);
|
||||
scheduleService.save(psychoBab1Schedule);
|
||||
|
||||
lessonService.save(lesson_0_progra1);
|
||||
lessonService.save(lesson_0_chemistry1);
|
||||
lessonService.save(lesson_0_commun);
|
||||
lessonService.save(lesson_0_psycho1);
|
||||
lessonService.save(lesson_1_progra1);
|
||||
|
||||
scheduleLessonService.save(new ScheduleLesson(infoBab1Schedule,lesson_0_progra1));
|
||||
scheduleLessonService.save(new ScheduleLesson(infoBab1Schedule,lesson_1_progra1));
|
||||
scheduleLessonService.save(new ScheduleLesson(infoBab1Schedule,lesson_0_commun));
|
||||
|
||||
scheduleLessonService.save(new ScheduleLesson(chemistryBab1Schedule,lesson_0_chemistry1));
|
||||
scheduleLessonService.save(new ScheduleLesson(chemistryBab1Schedule,lesson_0_commun));
|
||||
|
||||
scheduleLessonService.save(new ScheduleLesson(psychoBab1Schedule,lesson_0_psycho1));
|
||||
scheduleLessonService.save(new ScheduleLesson(psychoBab1Schedule,lesson_0_commun));
|
||||
|
||||
|
||||
lessonRequestService.save(request1);
|
||||
lessonRequestService.save(request2);
|
||||
lessonRequestService.save(request3);
|
||||
|
||||
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);
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,113 @@
|
||||
package ovh.herisson.Clyde.EndPoints.Msg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
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.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 jakarta.websocket.server.PathParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import ovh.herisson.Clyde.Repositories.CourseRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Msg.AnswerRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Msg.ForumRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Msg.TopicRepository;
|
||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.CourseService;
|
||||
import ovh.herisson.Clyde.Services.Msg.ForumService;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.Token;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Answer;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Forum;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Topic;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
@AllArgsConstructor
|
||||
public class ForumController {
|
||||
|
||||
private CourseRepository courseRepo;
|
||||
private AuthenticatorService authServ;
|
||||
private ForumService forumServ;
|
||||
private ForumRepository forumRepo;
|
||||
private TopicRepository topicRepo;
|
||||
|
||||
//// Endpoints to get and create new forums
|
||||
|
||||
@GetMapping("/forums/{id}")
|
||||
public ResponseEntity<List<Forum>> getForumFromCourseId(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
if(u == null){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
return new ResponseEntity<>(courseRepo.findById(id).getForums(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forums/{id}")
|
||||
public ResponseEntity<Forum> createForumOfCourse(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Forum data){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
Course c = courseRepo.findById(id);
|
||||
if(!(c.getOwner().equals(u) || u.getRole() == Role.Admin)){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
forumServ.createForum(c, data);
|
||||
return new ResponseEntity<>(HttpStatus.ACCEPTED);
|
||||
}
|
||||
|
||||
//// Endpoints to get and create forum's topic
|
||||
|
||||
@GetMapping("/forum/{id}")
|
||||
public ResponseEntity<List<Topic>> getTopicsFromForumId(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
if(u == null){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
return new ResponseEntity<>(forumRepo.findById(id).orElse(null).getTopics(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forum/{id}")
|
||||
public ResponseEntity<Topic> postTopicToForum(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Topic data){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
Forum f = forumRepo.findById(id).orElse(null);
|
||||
if(!(f.getWriters().contains(u) || f.getCourse().getOwner().equals(u) || u.getRole() == Role.Admin)){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
forumServ.createTopic(f, data);
|
||||
return new ResponseEntity<>(HttpStatus.ACCEPTED);
|
||||
}
|
||||
|
||||
//// Endpoints related to topics and messages
|
||||
|
||||
@GetMapping("/forum/post/{id}")
|
||||
public ResponseEntity<Topic> getPost(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
if(u == null){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
Topic t = topicRepo.findById(id).orElse(null);
|
||||
return new ResponseEntity<>(t, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forum/post/{id}")
|
||||
public ResponseEntity<Topic> postTopicToForum(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Answer data){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
Topic t = topicRepo.findById(id).orElse(null);
|
||||
if(t.isLocked() && u.getRole() != Role.Admin){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
System.out.println(data);
|
||||
forumServ.answerTopic(t, data, u);
|
||||
return new ResponseEntity<>(HttpStatus.ACCEPTED);
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import ovh.herisson.Clyde.Repositories.NotificationRepository;
|
||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Tables.Notification;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
import ovh.herisson.Clyde.Tables.Notification.Status;
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class NotificationController {
|
||||
|
||||
private AuthenticatorService authServ;
|
||||
private NotificationRepository notifRepo;
|
||||
|
||||
@GetMapping("/notifications")
|
||||
public ResponseEntity<List<Notification>> getNotifications(@RequestHeader("Authorization") String token){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
if(u == null){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
ArrayList<Notification> ret = new ArrayList<>();
|
||||
for (Notification n : u.getNotifications()) {
|
||||
if(!n.getStatus().equals(Status.Archived)){
|
||||
ret.add(n);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(ret, HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/notifications/{id}")
|
||||
public ResponseEntity<Notification> archiveNotification(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
User u = authServ.getUserFromToken(token);
|
||||
Notification n = notifRepo.findById(id).orElse(null);
|
||||
if(u == null || n.getUser() != u){
|
||||
return new UnauthorizedResponse<>(null);
|
||||
}
|
||||
|
||||
n.setStatus(Status.Archived);
|
||||
notifRepo.save(n);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
/******************************************************
|
||||
* @file ScheduleController.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Controller of Schedule API
|
||||
******************************************************/
|
||||
|
||||
|
||||
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.ScheduleLessonService;
|
||||
import ovh.herisson.Clyde.Services.ScheduleService;
|
||||
import ovh.herisson.Clyde.Services.UserCurriculumService;
|
||||
import ovh.herisson.Clyde.Services.CurriculumService;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
import ovh.herisson.Clyde.Services.LessonService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class ScheduleController {
|
||||
|
||||
private final ScheduleService scheduleServ;
|
||||
private final LessonService lessonServ;
|
||||
|
||||
private final CurriculumService curriculumServ;
|
||||
private final AuthenticatorService authServ;
|
||||
|
||||
private final ScheduleLessonService scheduleLessonServ;
|
||||
|
||||
public ScheduleController(ScheduleService scheduleServ, AuthenticatorService authServ, ScheduleLessonService scheduleLessonServ, CurriculumService curriculumServ,LessonService lessonServ) {
|
||||
this.scheduleServ = scheduleServ;
|
||||
this.authServ = authServ;
|
||||
this.scheduleLessonServ = scheduleLessonServ;
|
||||
this.curriculumServ = curriculumServ;
|
||||
this.lessonServ = lessonServ;
|
||||
}
|
||||
/**
|
||||
* Return schedule via its id
|
||||
*/
|
||||
@GetMapping("/schedule/{id}")
|
||||
public ResponseEntity<Map<String,Object>> findById(@PathVariable long id){
|
||||
Schedule schedule = scheduleServ.findById(id);
|
||||
|
||||
if(schedule == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
return new ResponseEntity<>(scheduleLessonServ.getDepthScheduleBySchedule(schedule),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a schedule via its curriculum id
|
||||
*/
|
||||
@GetMapping("/schedule/curriculum/{id}")
|
||||
public ResponseEntity<Map<String, Object>> findCurriculumSchedule(@PathVariable Long id){
|
||||
Schedule schedule = scheduleLessonServ.getScheduleByCurriculum(curriculumServ.findById(id));
|
||||
if(schedule == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
return new ResponseEntity<>(scheduleLessonServ.getDepthScheduleBySchedule(schedule),HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Return all schedules
|
||||
*/
|
||||
@GetMapping("/schedules")
|
||||
public ResponseEntity<Iterable<Map<String , Object>>> findAllSchedule(){
|
||||
return new ResponseEntity<>(scheduleLessonServ.getAllSchedule(),HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Post a new schedule
|
||||
*/
|
||||
@PostMapping("/schedule")
|
||||
public ResponseEntity<Schedule> postSchedule(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Schedule schedule){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
return new ResponseEntity<>(scheduleServ.save(schedule),HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Post a lesson to a schedule
|
||||
*/
|
||||
@PostMapping("/schedule/{id}")
|
||||
public ResponseEntity<String> postLessonToSchedule(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Long lessonId,
|
||||
@PathVariable long id)
|
||||
{
|
||||
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
if (!scheduleLessonServ.save(new ScheduleLesson( scheduleServ.findById(id), lessonServ.findById(lessonId))))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* Delete a lesson from a schedule
|
||||
*/
|
||||
@DeleteMapping("/schedule/lesson/{id}")
|
||||
public ResponseEntity<String> deleteLessonFromSchedule(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Long lessonId,
|
||||
@PathVariable Long id)
|
||||
{
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
if (!scheduleLessonServ.delete(lessonId))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -104,9 +104,6 @@ public class UserController {
|
||||
|
||||
@GetMapping("/teachers")
|
||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllTeachers(@RequestHeader("Authorization") String token){
|
||||
if (authServ.getUserFromToken(token) == null)
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Iterable<User> teachers = userService.getAllTeachers();
|
||||
|
||||
return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(teachers), HttpStatus.OK);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
@ -11,7 +13,15 @@ public interface CurriculumCourseRepository extends CrudRepository<CurriculumCou
|
||||
@Query("select distinct cc.course from CurriculumCourse cc where cc.curriculum = ?1")
|
||||
Iterable<Course> findCoursesByCurriculum(Curriculum curriculum);
|
||||
|
||||
@Query("select distinct cc.curriculum from CurriculumCourse cc where cc.course = ?1")
|
||||
Iterable<Curriculum> findCurriculumByCourses(Course course);
|
||||
|
||||
@Query("select distinct cc.curriculum from CurriculumCourse cc")
|
||||
Iterable<Curriculum> findDistinctCurriculums();
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("delete from CurriculumCourse cc where cc.course =?1")
|
||||
void delete(Course course);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package ovh.herisson.Clyde.Repositories.Inscription;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ChangeCurriculumRequest;
|
||||
|
||||
public interface ChangeCurriculumRequestRepository extends CrudRepository<ChangeCurriculumRequest, Long> {
|
||||
ChangeCurriculumRequest findById(long id);
|
||||
}
|
||||
|
@ -2,7 +2,12 @@ package ovh.herisson.Clyde.Repositories.Inscription;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> {
|
||||
ExemptionsRequest findById(long id);
|
||||
|
||||
ArrayList<ExemptionsRequest> findByUser(User user);
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ 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,7 +0,0 @@
|
||||
package ovh.herisson.Clyde.Repositories.Inscription;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest;
|
||||
|
||||
public interface UninscriptionRequestRepository extends CrudRepository<UninscriptionRequest, Long> {
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package ovh.herisson.Clyde.Repositories.Inscription;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.UnregisterRequest;
|
||||
|
||||
public interface UnregisterRequestRepository extends CrudRepository<UnregisterRequest, Long> {
|
||||
public UnregisterRequest findById(long l);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
/******************************************************
|
||||
* @file LessonChangesRequestRepository.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.LessonChangesRequest;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
public interface LessonChangesRequestRepository extends CrudRepository<LessonChangesRequest, Long> {
|
||||
LessonChangesRequest findById(long id);
|
||||
|
||||
|
||||
@Query("select lr from LessonChangesRequest lr where lr.user = ?1")
|
||||
Iterable<LessonChangesRequest> findOwnRequests(User user);
|
||||
|
||||
@Query("select lr from LessonChangesRequest lr where lr.lessonId = ?1")
|
||||
Iterable<LessonChangesRequest> findRequestByLessonId(long id);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
/******************************************************
|
||||
* @file LessonRepository.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.Lesson;
|
||||
|
||||
public interface LessonRepository extends CrudRepository<Lesson, Long> {
|
||||
|
||||
Lesson findById(long id);
|
||||
|
||||
@Query("select l from Lesson l where l.course = ?1")
|
||||
Iterable<Lesson> findLessonByCourse(Course course);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package ovh.herisson.Clyde.Repositories.Msg;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import ovh.herisson.Clyde.Tables.Msg.Answer;
|
||||
|
||||
public interface AnswerRepository extends CrudRepository<Answer, Long> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package ovh.herisson.Clyde.Repositories.Msg;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import ovh.herisson.Clyde.Tables.Msg.Forum;
|
||||
|
||||
public interface ForumRepository extends CrudRepository<Forum, Long> {
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package ovh.herisson.Clyde.Repositories.Msg;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import ovh.herisson.Clyde.Tables.Msg.Topic;
|
||||
|
||||
public interface TopicRepository extends CrudRepository<Topic, Long> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import ovh.herisson.Clyde.Tables.Notification;
|
||||
|
||||
public interface NotificationRepository extends CrudRepository<Notification, Long> {}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
/******************************************************
|
||||
* @file ScheduleLessonRepository.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Curriculum;
|
||||
import ovh.herisson.Clyde.Tables.Lesson;
|
||||
import ovh.herisson.Clyde.Tables.Schedule;
|
||||
import ovh.herisson.Clyde.Tables.ScheduleLesson;
|
||||
|
||||
public interface ScheduleLessonRepository extends CrudRepository<ScheduleLesson,Long> {
|
||||
|
||||
@Query("select distinct sl.lesson from ScheduleLesson sl where sl.schedule.curriculum = ?1")
|
||||
Iterable<Lesson> findLessonByCurriculum(Curriculum curriculum);
|
||||
|
||||
@Query("select distinct sl.schedule from ScheduleLesson sl where sl.schedule.curriculum = ?1")
|
||||
Schedule findScheduleByCurriculum(Curriculum curriculum);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("delete from ScheduleLesson sl where sl.lesson =?1")
|
||||
void delete(Lesson lesson);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
/******************************************************
|
||||
* @file ScheduleRepository.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.Lesson;
|
||||
import ovh.herisson.Clyde.Tables.Schedule;
|
||||
|
||||
public interface ScheduleRepository extends CrudRepository<Schedule,Long> {
|
||||
|
||||
Schedule getById(long id);
|
||||
|
||||
|
||||
@Query("select distinct sl from Schedule sl where EXISTS (select c.curriculum from CurriculumCourse c where (sl.curriculum = c.curriculum) AND (c.course = ?1))")
|
||||
Iterable<Schedule> findAllLessonSchedule(Course course);
|
||||
}
|
@ -14,4 +14,8 @@ public interface UserCurriculumRepository extends CrudRepository<UserCurriculum,
|
||||
Curriculum findByUser(User student);
|
||||
|
||||
ArrayList<UserCurriculum> findByUserOrderByCurriculum(User student);
|
||||
UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual);
|
||||
|
||||
ArrayList<UserCurriculum> findByUserAndActual(User user, boolean actual);
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ public class AuthenticatorService {
|
||||
return tokenService.getUserFromToken(token);
|
||||
}
|
||||
|
||||
|
||||
public String login(String identifier, String password, Date expirationDate){
|
||||
User user = userService.getUser(identifier);
|
||||
if (user == null){return null;}
|
||||
|
@ -46,11 +46,15 @@ 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;
|
||||
}
|
||||
|
||||
public Iterable<Curriculum> findCurriculumByCourses(Course course){
|
||||
return curriculumCourseRepo.findCurriculumByCourses(course);
|
||||
}
|
||||
|
||||
public Iterable<Map<String, Object>> getAllDepthCurriculum(){
|
||||
|
||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||
|
@ -1,17 +1,18 @@
|
||||
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 {
|
||||
@ -25,20 +26,20 @@ public class InscriptionService {
|
||||
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){
|
||||
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);
|
||||
}
|
||||
|
||||
@ -56,6 +57,11 @@ public class InscriptionService {
|
||||
if (inscrRequest == null)
|
||||
return false;
|
||||
|
||||
//If the request is already accepted we just return ok (otherwise we would duplicate the procedure below)
|
||||
if (inscrRequest.getState() == RequestState.Accepted){
|
||||
return true;
|
||||
}
|
||||
|
||||
inscrRequest.setState(requestState);
|
||||
save(inscrRequest);
|
||||
|
||||
@ -81,11 +87,13 @@ public class InscriptionService {
|
||||
inscrRequest.getCountry(),
|
||||
inscrRequest.getBirthDate(),
|
||||
inscrRequest.getProfilePicture(),
|
||||
inscrRequest.getPassword()
|
||||
inscrRequest.getPassword(),
|
||||
inscrRequest.getIdentityCard()
|
||||
);
|
||||
|
||||
userRepo.save(userFromRequest);
|
||||
userCurriculumRepo.save(new UserCurriculum(userFromRequest, curriculumRepo.findById(inscrRequest.getCurriculumId()),0));
|
||||
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);
|
||||
|
@ -0,0 +1,177 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
/******************************************************
|
||||
* @file LeessonRequestService.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.Repositories.*;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class LessonRequestService {
|
||||
private final LessonChangesRequestRepository lessonChangesRepo;
|
||||
|
||||
private final UserRepository userRepo;
|
||||
|
||||
private final LessonRepository lessonRepo;
|
||||
|
||||
private final LessonService lessonServ;
|
||||
|
||||
private final ScheduleLessonRepository scheduleLessonRepo;
|
||||
|
||||
private final ScheduleRepository scheduleRepository;
|
||||
|
||||
private final ScheduleLessonService scheduleLessonService;
|
||||
|
||||
private final UserService userServ;
|
||||
|
||||
private final CourseRepository courseRepository;
|
||||
public LessonRequestService(LessonChangesRequestRepository lessonChangesRepo,
|
||||
UserRepository userRepo, LessonRepository lessonRepo,
|
||||
LessonService lessonServ, ScheduleLessonRepository scheduleLessonRepo,
|
||||
ScheduleRepository scheduleRepository, ScheduleLessonService scheduleLessonService,
|
||||
UserService userServ, CourseRepository courseRepository) {
|
||||
this.lessonChangesRepo = lessonChangesRepo;
|
||||
this.userRepo = userRepo;
|
||||
this.lessonRepo = lessonRepo;
|
||||
this.lessonServ = lessonServ;
|
||||
this.scheduleLessonRepo = scheduleLessonRepo;
|
||||
this.scheduleRepository = scheduleRepository;
|
||||
this.scheduleLessonService = scheduleLessonService;
|
||||
this.userServ = userServ;
|
||||
this.courseRepository = courseRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new lesson request
|
||||
*/
|
||||
public LessonChangesRequest save(LessonChangesRequest lessonRequest){
|
||||
return lessonChangesRepo.save(lessonRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all the requests made by a user
|
||||
*/
|
||||
public Iterable<LessonChangesRequest> findOwnRequests(User user){
|
||||
return lessonChangesRepo.findOwnRequests(user);
|
||||
}
|
||||
public LessonChangesRequest findById(long id){
|
||||
return lessonChangesRepo.findById(id);
|
||||
}
|
||||
/**
|
||||
* Return all the requests
|
||||
*/
|
||||
public Iterable<LessonChangesRequest> getAll(){return lessonChangesRepo.findAll();}
|
||||
|
||||
/**
|
||||
* Create a lesson if a request is accepted
|
||||
*/
|
||||
public boolean modifyCreateRequestState(LessonChangesRequest lessonRequest, RequestState state, String local ){
|
||||
if(lessonRequest == null || state == lessonRequest.getState() || state == null){
|
||||
return false;}
|
||||
if (state == RequestState.Accepted){
|
||||
Course course = courseRepository.findById(lessonRequest.getCourse().getCourseID());
|
||||
if(courseRepository.findById(lessonRequest.getCourse().getCourseID())==null|| local == null){
|
||||
return false;}
|
||||
Lesson lesson = new Lesson();
|
||||
lesson.setCourse(course);
|
||||
lesson.setLessonStart(lessonRequest.getLessonStart());
|
||||
lesson.setLessonEnd(lessonRequest.getLessonEnd());
|
||||
lesson.setColor(lessonRequest.getColor());
|
||||
lesson.setLocal(local);
|
||||
lesson.setLessonType(lessonRequest.getLessonType());
|
||||
|
||||
lesson = lessonRepo.save(lesson);
|
||||
scheduleLessonService.saveToAllSchedule(lesson);
|
||||
}
|
||||
lessonRequest.setState(state);
|
||||
save(lessonRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Iterable<LessonChangesRequest> findRequestByLessonId(long id){
|
||||
return lessonChangesRepo.findRequestByLessonId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuse all the lesson request that depends on a certain lesson
|
||||
* Used after the deletion of the lesson
|
||||
*/
|
||||
public void refuseAllByLessonId(long id){
|
||||
Iterable<LessonChangesRequest> toRefuse = findRequestByLessonId(id);
|
||||
for(LessonChangesRequest element : toRefuse)
|
||||
element.setState(RequestState.Refused);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a lesson if a request is accepted
|
||||
*/
|
||||
public boolean modifyChangeRequestState(Map<String, Object> updates, long lessonId,RequestState state){
|
||||
if(state == RequestState.Accepted){
|
||||
Lesson lesson = lessonServ.findById(lessonId);
|
||||
return lessonServ.modifyData(lesson.getLessonID(),updates);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a lesson if a request is accepted
|
||||
*/
|
||||
public void modifyDeleteRequest(LessonChangesRequest lessonChangesRequest, RequestState state){
|
||||
if(state == RequestState.Accepted){
|
||||
lessonServ.delete(lessonServ.findById(lessonChangesRequest.getLessonId()));
|
||||
refuseAllByLessonId(lessonChangesRequest.getLessonId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a lesson request
|
||||
*/
|
||||
public LessonChangesRequest createLessonRequest(Map<String,Object> lessonInfos) {
|
||||
LessonChangesRequest target = new LessonChangesRequest();
|
||||
|
||||
for (Map.Entry<String, Object> entry : lessonInfos.entrySet()) {
|
||||
System.out.println(entry.toString());
|
||||
if(entry.getValue() != null){
|
||||
switch (entry.getKey()) {
|
||||
case "requestType":
|
||||
target.setRequestType((int) entry.getValue());
|
||||
break;
|
||||
case "lessonStart":
|
||||
target.setLessonStart((String) entry.getValue());
|
||||
break;
|
||||
case "lessonEnd":
|
||||
target.setLessonEnd((String) entry.getValue());
|
||||
break;
|
||||
case "color":
|
||||
target.setColor((String) entry.getValue());
|
||||
break;
|
||||
case "user":
|
||||
target.setUser(userServ.getUserById((int) entry.getValue()));
|
||||
break;
|
||||
case "lessonType":
|
||||
target.setLessonType((String) entry.getValue());
|
||||
break;
|
||||
case "course":
|
||||
target.setCourse(courseRepository.findById((int) entry.getValue()));
|
||||
break;
|
||||
case "lessonId":
|
||||
target.setLessonId((int) entry.getValue());
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
target.setState(RequestState.Pending);
|
||||
return target;
|
||||
}
|
||||
|
||||
public void delete (LessonChangesRequest toDelete) {
|
||||
lessonChangesRepo.delete(toDelete);
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* @file LessonService.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.Repositories.CourseRepository;
|
||||
import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository;
|
||||
import ovh.herisson.Clyde.Repositories.LessonRepository;
|
||||
import ovh.herisson.Clyde.Repositories.UserCurriculumRepository;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class LessonService {
|
||||
private final LessonRepository lessonRepo;
|
||||
private final UserCurriculumRepository userCurriculumRepo;
|
||||
private final CourseRepository courseRepo;
|
||||
private final CurriculumCourseRepository curriculumCourseRepo;
|
||||
public LessonService(LessonRepository lessonRepo, UserCurriculumRepository userCurriculumRepo, CourseRepository courseRepo, CurriculumCourseRepository curriculumCourseRepo){
|
||||
this.lessonRepo = lessonRepo;
|
||||
this.userCurriculumRepo = userCurriculumRepo;
|
||||
this.courseRepo = courseRepo;
|
||||
this.curriculumCourseRepo = curriculumCourseRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a lesson
|
||||
*/
|
||||
public Lesson save(Lesson lesson){
|
||||
return lessonRepo.save(lesson);
|
||||
}
|
||||
/**
|
||||
* Find a lesson by its id
|
||||
*/
|
||||
public Lesson findById(long id){
|
||||
return lessonRepo.findById(id);
|
||||
}
|
||||
/**
|
||||
* Return all the lessons
|
||||
*/
|
||||
public Iterable<Lesson> findAll(){return lessonRepo.findAll();}
|
||||
/**
|
||||
* Return all a teacher's lessons
|
||||
*/
|
||||
public Iterable<Lesson> findAllOwnedLesson(User teacher){
|
||||
ArrayList<Lesson> toReturn = new ArrayList<>();
|
||||
ArrayList<Course> coursesOwned = (ArrayList<Course>) courseRepo.findAllOwnedCoures(teacher);
|
||||
for (Course element : coursesOwned) {
|
||||
for(Lesson lesson : lessonRepo.findLessonByCourse(element))
|
||||
toReturn.add(lesson);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
* Return all a student's lessons
|
||||
*/
|
||||
|
||||
public Iterable<Lesson> findOnesLessons(User student){
|
||||
ArrayList<Lesson> toReturn = new ArrayList<>();
|
||||
ArrayList<Course> courses = new ArrayList<>();
|
||||
ArrayList<UserCurriculum> userCurricula = userCurriculumRepo.findByUserAndActual(student, true);
|
||||
for (UserCurriculum userCurriculum : userCurricula) {
|
||||
curriculumCourseRepo.findCoursesByCurriculum(userCurriculum.getCurriculum()).forEach((item) -> {
|
||||
//We need this to eliminate clones because a course can belong to several curriculums
|
||||
if (!courses.contains(item)) {
|
||||
System.out.println(item.getTitle());
|
||||
courses.add(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
for (Course element : courses) {
|
||||
for(Lesson lesson : lessonRepo.findLessonByCourse(element))
|
||||
toReturn.add(lesson);
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
* Construct a new lesson
|
||||
*/
|
||||
public Lesson createLesson(Map<String,Object> lessonInfos) {
|
||||
Lesson target = new Lesson();
|
||||
|
||||
for (Map.Entry<String, Object> entry : lessonInfos.entrySet()) {
|
||||
switch (entry.getKey()) {
|
||||
case "lessonStart":
|
||||
target.setLessonStart((String) entry.getValue());
|
||||
break;
|
||||
case "lessonEnd":
|
||||
target.setLessonEnd((String) entry.getValue());
|
||||
case "color":
|
||||
target.setColor((String) entry.getValue());
|
||||
break;
|
||||
case "local":
|
||||
target.setLocal((String) entry.getValue());
|
||||
break;
|
||||
case "lessonType":
|
||||
target.setLessonType((String) entry.getValue());
|
||||
break;
|
||||
case "courseID":
|
||||
target.setCourse(courseRepo.findById((int) entry.getValue()));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return target;
|
||||
}
|
||||
/**
|
||||
* Modify a lesson
|
||||
*/
|
||||
public boolean modifyData(long id, Map<String ,Object> updates){
|
||||
Lesson target = lessonRepo.findById(id);
|
||||
|
||||
if(target == null)
|
||||
return false;
|
||||
|
||||
for (Map.Entry<String , Object> entry: updates.entrySet()){
|
||||
switch (entry.getKey()){
|
||||
case "lessonStart":
|
||||
target.setLessonStart((String) entry.getValue());
|
||||
break;
|
||||
case "lessonEnd":
|
||||
target.setLessonEnd((String) entry.getValue());
|
||||
break;
|
||||
case "local":
|
||||
target.setLocal((String) entry.getValue());
|
||||
break;
|
||||
case "lessonType":
|
||||
target.setLessonType((String) entry.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
lessonRepo.save(target);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Delete a lesson
|
||||
*/
|
||||
public void delete(Lesson lesson){
|
||||
lessonRepo.delete(lesson);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,6 +17,8 @@ import org.springframework.stereotype.Service;
|
||||
import com.fasterxml.jackson.databind.util.JSONPObject;
|
||||
|
||||
import ovh.herisson.Clyde.Repositories.Msg.DiscussionRepository;
|
||||
import ovh.herisson.Clyde.Services.UserService;
|
||||
import ovh.herisson.Clyde.Tables.Notification;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||
@ -26,6 +28,8 @@ public class DiscussionService {
|
||||
|
||||
@Autowired
|
||||
private DiscussionRepository discRepo;
|
||||
@Autowired
|
||||
private UserService userServ;
|
||||
|
||||
public Discussion create(String name, User author){
|
||||
return discRepo.save(new Discussion(name, author));
|
||||
@ -42,6 +46,9 @@ public class DiscussionService {
|
||||
* Create a message and link it to it's discussion
|
||||
*/
|
||||
public Discussion CreateMessage(Discussion disc, Message msg){
|
||||
for(User u: disc.getMembers()){
|
||||
userServ.Notify(u, new Notification("msg.notification.new", msg.getContent(), "/#/msg"));
|
||||
}
|
||||
disc.addMessage(msg);
|
||||
return discRepo.save(disc);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package ovh.herisson.Clyde.Services.Msg;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import ovh.herisson.Clyde.Repositories.CourseRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Msg.ForumRepository;
|
||||
import ovh.herisson.Clyde.Repositories.Msg.TopicRepository;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Answer;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Forum;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Topic;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ForumService {
|
||||
|
||||
private CourseRepository courseRepo;
|
||||
private ForumRepository forumRepo;
|
||||
private TopicRepository topicRepo;
|
||||
|
||||
public void createForum(Course c, Forum f){
|
||||
c.addForum(f);
|
||||
courseRepo.save(c);
|
||||
}
|
||||
|
||||
public void createTopic(Forum f, Topic data) {
|
||||
f.addTopic(data);
|
||||
forumRepo.save(f);
|
||||
}
|
||||
|
||||
public void answerTopic(Topic t, Answer data, User u) {
|
||||
data.setAuthor(u);
|
||||
t.addAnswer(data);
|
||||
topicRepo.save(t);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NotificationService {
|
||||
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.InscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -30,6 +29,7 @@ public class ProtectionService {
|
||||
toReturn.put("country",user.getCountry());
|
||||
toReturn.put("profilePictureUrl",user.getProfilePictureUrl());
|
||||
toReturn.put("role",user.getRole());
|
||||
toReturn.put("identityCard", user.getIdentityCardUrl());
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class ProtectionService {
|
||||
|
||||
HashMap<String ,Object> toReturn = new HashMap<>();
|
||||
|
||||
toReturn.put("courseId",course.getCourseID());
|
||||
toReturn.put("courseID",course.getCourseID());
|
||||
toReturn.put("credits",course.getCredits());
|
||||
toReturn.put("title", course.getTitle());
|
||||
toReturn.put("owner", userWithoutPassword(course.getOwner()));
|
||||
@ -69,6 +69,33 @@ public class ProtectionService {
|
||||
|
||||
}
|
||||
|
||||
public static HashMap<String , Object> lessonWithoutPassword(Lesson lesson){
|
||||
if(lesson == null)
|
||||
return null;
|
||||
|
||||
HashMap<String, Object> toReturn = new HashMap<>();
|
||||
|
||||
toReturn.put("lessonID", lesson.getLessonID());
|
||||
toReturn.put("lessonStart", lesson.getLessonStart());
|
||||
toReturn.put("lessonEnd", lesson.getLessonEnd());
|
||||
toReturn.put("course",courseWithoutPassword(lesson.getCourse()));
|
||||
toReturn.put("local",lesson.getLocal());
|
||||
toReturn.put("color", lesson.getColor());
|
||||
toReturn.put("lessonType",lesson.getLessonType());
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static Iterable<HashMap<String ,Object>> lessonsWithoutPassword(Iterable<Lesson> lessons){
|
||||
ArrayList<HashMap<String,Object>> toReturn = new ArrayList<>();
|
||||
|
||||
for (Lesson l: lessons){
|
||||
toReturn.add(ProtectionService.lessonWithoutPassword(l));
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, Object> requestWithoutPassword(InscriptionRequest inscriptionRequest) {
|
||||
|
||||
@ -90,9 +117,36 @@ public class ProtectionService {
|
||||
toReturn.put("identityCard", inscriptionRequest.getIdentityCard());
|
||||
toReturn.put("submissionDate", inscriptionRequest.getSubmissionDate());
|
||||
toReturn.put("equivalenceState", inscriptionRequest.getEquivalenceState());
|
||||
toReturn.put("admissionDocUrl", inscriptionRequest.getAdmissionDocUrl());
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static Map<String, Object> lessonRequestWithoutPassword(LessonChangesRequest lessonRequest){
|
||||
if (lessonRequest == null)
|
||||
return null;
|
||||
Map<String, Object> toReturn = new HashMap<>();
|
||||
toReturn.put("id", lessonRequest.getId());
|
||||
toReturn.put("lessonStart", lessonRequest.getLessonStart());
|
||||
toReturn.put("lessonEnd", lessonRequest.getLessonEnd());
|
||||
toReturn.put("lessonType",lessonRequest.getLessonType());
|
||||
toReturn.put("course", courseWithoutPassword(lessonRequest.getCourse()));
|
||||
toReturn.put("user", userWithoutPassword(lessonRequest.getUser()));
|
||||
toReturn.put("requestType", lessonRequest.getRequestType());
|
||||
toReturn.put("state", lessonRequest.getState());
|
||||
toReturn.put("lessonId",lessonRequest.getLessonId());
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static Iterable<Map<String, Object>> lessonRequestsWithoutPassword(Iterable<LessonChangesRequest> lessonChangesRequests){
|
||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||
|
||||
for(LessonChangesRequest lessonChangeRequest: lessonChangesRequests){
|
||||
toReturn.add(lessonRequestWithoutPassword(lessonChangeRequest));
|
||||
}
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
public static Iterable<Map<String ,Object>> requestsWithoutPasswords(Iterable<InscriptionRequest> inscriptionRequests){
|
||||
|
||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||
|
@ -0,0 +1,93 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
/******************************************************
|
||||
* @file ScheduleLessonService.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
******************************************************/
|
||||
import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.Repositories.LessonRepository;
|
||||
import ovh.herisson.Clyde.Repositories.ScheduleLessonRepository;
|
||||
import ovh.herisson.Clyde.Repositories.ScheduleRepository;
|
||||
import ovh.herisson.Clyde.Tables.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ScheduleLessonService {
|
||||
|
||||
private final ScheduleLessonRepository scheduleLessonRepo;
|
||||
|
||||
private final LessonRepository lessonRepo;
|
||||
private final ScheduleRepository scheduleRepo;
|
||||
public ScheduleLessonService(ScheduleLessonRepository scheduleLessonRepo, LessonRepository lessonRepo, ScheduleRepository scheduleRepo) {
|
||||
this.scheduleLessonRepo = scheduleLessonRepo;
|
||||
this.lessonRepo = lessonRepo;
|
||||
this.scheduleRepo = scheduleRepo;
|
||||
}
|
||||
public boolean save(ScheduleLesson scheduleLesson){
|
||||
if(scheduleLesson == null)
|
||||
return false;
|
||||
scheduleLessonRepo.save(scheduleLesson);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Save a lesson to all the schedule it is linked
|
||||
*/
|
||||
public boolean saveToAllSchedule(Lesson lesson){
|
||||
Iterable<Schedule> schedules = scheduleRepo.findAllLessonSchedule(lesson.getCourse());
|
||||
if(schedules == null)
|
||||
return false;
|
||||
for (Schedule schedule : schedules){
|
||||
save(new ScheduleLesson(schedule, lesson));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Delete a scheduleLesson via its lesson
|
||||
*/
|
||||
public boolean delete(long lessonId){
|
||||
if(lessonId == 0)
|
||||
return false;
|
||||
scheduleLessonRepo.delete(lessonRepo.findById(lessonId));
|
||||
return true;
|
||||
}
|
||||
|
||||
public Schedule getScheduleByCurriculum(Curriculum curriculum){
|
||||
return scheduleLessonRepo.findScheduleByCurriculum(curriculum);
|
||||
}
|
||||
/**
|
||||
* Return a schedule and the list of lessons that corresponds
|
||||
*/
|
||||
public Map<String , Object> getDepthScheduleBySchedule(Schedule schedule){
|
||||
if(schedule == null)
|
||||
return null;
|
||||
|
||||
HashMap<String , Object> toReturn = new HashMap<>();
|
||||
ArrayList<Map<String, Object>> lessons = new ArrayList<>();
|
||||
Iterable<Lesson> foundLessons = scheduleLessonRepo.findLessonByCurriculum(schedule.getCurriculum());
|
||||
|
||||
for (Lesson l: foundLessons){
|
||||
lessons.add(ProtectionService.lessonWithoutPassword(l));
|
||||
}
|
||||
toReturn.put("lessons",lessons);
|
||||
toReturn.put("scheduleId" , schedule.getScheduleID());
|
||||
toReturn.put("curriculum", schedule.getCurriculum());
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
* Return all the schedules
|
||||
*/
|
||||
public Iterable<Map<String,Object>> getAllSchedule(){
|
||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||
|
||||
for (Schedule schedule: scheduleRepo.findAll()){
|
||||
toReturn.add(getDepthScheduleBySchedule(schedule));
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.Repositories.ScheduleRepository;
|
||||
import ovh.herisson.Clyde.Tables.Schedule;
|
||||
|
||||
@Service
|
||||
public class ScheduleService {
|
||||
private final ScheduleRepository scheduleRepo;
|
||||
public ScheduleService(ScheduleRepository scheduleRepo) {
|
||||
this.scheduleRepo = scheduleRepo;
|
||||
}
|
||||
public Schedule save(Schedule schedule){
|
||||
return scheduleRepo.save(schedule);
|
||||
}
|
||||
public Schedule findById(long id){
|
||||
return scheduleRepo.getById(id);
|
||||
}
|
||||
public void delete(Schedule schedule){
|
||||
scheduleRepo.delete(schedule);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,11 +35,12 @@ public class UserCurriculumService {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -48,5 +49,7 @@ public class UserCurriculumService {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<UserCurriculum> findByStudentAndActual(User u, boolean actual){
|
||||
return userCurriculumRepository.findByUserAndActual(u, actual);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,9 @@ 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.Notification;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
import java.util.*;
|
||||
@ -99,11 +101,17 @@ public class UserService {
|
||||
return passwordEncoder.matches(tryingPassword, user.getPassword());
|
||||
}
|
||||
|
||||
public User save(User user){
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
public User save(User user){
|
||||
RegNoGenerator.resetCount();
|
||||
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();
|
||||
}
|
||||
@ -125,4 +133,10 @@ public class UserService {
|
||||
public void delete(User user) {
|
||||
userRepo.delete(user);
|
||||
}
|
||||
|
||||
public void Notify(User u, Notification n){
|
||||
n.setUser(u);
|
||||
u.getNotifications().add(n);
|
||||
userRepo.save(u);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,193 @@
|
||||
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.Notification;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class UserService {
|
||||
private final UserRepository userRepo;
|
||||
private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
|
||||
public UserService(UserRepository userRepo){
|
||||
this.userRepo = userRepo;
|
||||
}
|
||||
|
||||
|
||||
/** return the user identified by th identifier
|
||||
*
|
||||
* @param identifier can be an email or the RegNo
|
||||
* @return the identified user
|
||||
*/
|
||||
public User getUser(String identifier){
|
||||
if (identifier == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
int id = Integer.parseInt(identifier);
|
||||
return userRepo.findById(id);
|
||||
}
|
||||
catch (NumberFormatException nfe){
|
||||
return userRepo.findByEmail(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
/** modify the target data
|
||||
* verify the permission of modifying from the poster
|
||||
*
|
||||
* @param poster the user wanting to modify target's data
|
||||
* @param updates the changes to be made
|
||||
* @param targetId the id of the user to update
|
||||
* @return if the changes were done or not
|
||||
*/
|
||||
public User modifyData(long targetId, Map<String ,Object> updates, User poster){
|
||||
|
||||
User target = userRepo.findById(targetId);
|
||||
if (target == null)
|
||||
return null;
|
||||
|
||||
if (!target.getRegNo().equals(poster.getRegNo()) && !(poster.getRole() == Role.Secretary) &&
|
||||
!(poster.getRole() == Role.Admin))
|
||||
return null;
|
||||
|
||||
<<<<<<< HEAD
|
||||
for (Map.Entry<String, Object> entry : updates.entrySet()){
|
||||
System.out.println(entry.getValue());
|
||||
switch (entry.getKey()){
|
||||
case "firstName":
|
||||
target.setFirstName((String) entry.getValue());
|
||||
break;
|
||||
case "lastName":
|
||||
target.setLastName((String) entry.getValue());
|
||||
break;
|
||||
case "email":
|
||||
target.setEmail((String) entry.getValue());
|
||||
break;
|
||||
case "address":
|
||||
target.setAddress((String) entry.getValue());
|
||||
break;
|
||||
case "country":
|
||||
target.setCountry((String) entry.getValue());
|
||||
break;
|
||||
case "birthDate":
|
||||
target.setBirthDate((Date) entry.getValue());
|
||||
break;
|
||||
case "profilePictureUrl":
|
||||
target.setProfilePictureUrl((String) entry.getValue());
|
||||
break;
|
||||
case "password":
|
||||
target.setPassword((String) entry.getValue());
|
||||
break;
|
||||
case "role":
|
||||
//a user can't change his own role
|
||||
if (poster.getRole()==Role.Secretary || poster.getRole() == Role.Admin){
|
||||
Role wanted = Role.valueOf((String) entry.getValue());
|
||||
if (wanted == Role.Admin && poster.getRole() != Role.Admin)
|
||||
return null;
|
||||
target.setRole(wanted);
|
||||
}
|
||||
=======
|
||||
switch (entry.getKey()){
|
||||
case "firstName":
|
||||
target.setFirstName((String) entry.getValue());
|
||||
break;
|
||||
case "lastName":
|
||||
target.setLastName((String) entry.getValue());
|
||||
break;
|
||||
case "email":
|
||||
target.setEmail((String) entry.getValue());
|
||||
break;
|
||||
case "address":
|
||||
target.setAddress((String) entry.getValue());
|
||||
break;
|
||||
case "country":
|
||||
target.setCountry((String) entry.getValue());
|
||||
break;
|
||||
case "birthDate":
|
||||
target.setBirthDate((Date) entry.getValue());
|
||||
break;
|
||||
case "profilePictureUrl":
|
||||
target.setProfilePictureUrl((String) entry.getValue());
|
||||
break;
|
||||
case "password":
|
||||
target.setPassword((String) entry.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
userRepo.save(target);
|
||||
return true;
|
||||
}
|
||||
// the secretary can change roles (for example if a student becomes a teacher)
|
||||
else if (poster.getRole() == Role.Secretary)
|
||||
{
|
||||
for (Map.Entry<String, Object> entry : updates.entrySet()){
|
||||
|
||||
if ( entry.getKey().equals("role")) {
|
||||
|
||||
if (entry.getValue() == Role.Admin) {return false;}
|
||||
|
||||
target.setRole((Role) entry.getValue());
|
||||
userRepo.save(target);
|
||||
return true;
|
||||
}
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
}
|
||||
userRepo.save(target);
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
public boolean checkPassword(User user, String tryingPassword){
|
||||
return passwordEncoder.matches(tryingPassword, user.getPassword());
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public User save(User user){
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
=======
|
||||
public User save(User user){
|
||||
RegNoGenerator.resetCount();
|
||||
>>>>>>> origin/master
|
||||
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();
|
||||
}
|
||||
|
||||
public Iterable<User> getAllExceptAdmins(){
|
||||
return userRepo.findAllExceptAdmins();
|
||||
}
|
||||
|
||||
|
||||
public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
|
||||
|
||||
public Iterable<User> getAllStudents(){return userRepo.findAllStudents();}
|
||||
|
||||
|
||||
public User getUserById(long id) {
|
||||
return userRepo.findById(id);
|
||||
}
|
||||
|
||||
public void delete(User user) {
|
||||
userRepo.delete(user);
|
||||
}
|
||||
|
||||
public void Notify(User u, Notification n){
|
||||
n.setUser(u);
|
||||
u.getNotifications().add(n);
|
||||
userRepo.save(u);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package ovh.herisson.Clyde.Tables;
|
||||
public enum Applications {
|
||||
// without any token
|
||||
Login,
|
||||
Schedule,
|
||||
|
||||
// with any token
|
||||
Profile,
|
||||
@ -11,11 +12,18 @@ public enum Applications {
|
||||
Msg,
|
||||
Forum,
|
||||
Rdv,
|
||||
// teachers authorization
|
||||
|
||||
ManageOwnedLessons,
|
||||
|
||||
// teachers and Secretary authorization
|
||||
ManageCourses,
|
||||
UsersList,
|
||||
|
||||
//Secretary authorization
|
||||
ManageSchedules,
|
||||
LessonRequests,
|
||||
|
||||
// InscriptionService authorization
|
||||
Requests,
|
||||
// profile of a researcher
|
||||
@ -23,5 +31,8 @@ public enum Applications {
|
||||
ManageResearcherProfile,
|
||||
|
||||
//the list of all researches (filterable)
|
||||
ListResearches, CreateUser, StudentsList
|
||||
ListResearches,
|
||||
CreateUser,
|
||||
StudentsList,
|
||||
Payments
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
public enum Applications {
|
||||
// without any token
|
||||
Login,
|
||||
Schedule,
|
||||
|
||||
// with any token
|
||||
Profile,
|
||||
|
||||
// Students and higher authorization
|
||||
Msg,
|
||||
Forum,
|
||||
Rdv,
|
||||
// teachers authorization
|
||||
|
||||
ManageOwnedLessons,
|
||||
|
||||
// teachers and Secretary authorization
|
||||
ManageCourses,
|
||||
UsersList,
|
||||
|
||||
//Secretary authorization
|
||||
ManageSchedules,
|
||||
LessonRequests,
|
||||
|
||||
// InscriptionService authorization
|
||||
Requests,
|
||||
<<<<<<< HEAD
|
||||
// profile of a researcher
|
||||
ResearcherProfile,
|
||||
ManageResearcherProfile,
|
||||
|
||||
//the list of all researches (filterable)
|
||||
ListResearches, CreateUser, StudentsList
|
||||
=======
|
||||
StudentsList,
|
||||
Payments
|
||||
>>>>>>> origin/master
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,20 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Forum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Course {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@ -17,39 +27,19 @@ public class Course {
|
||||
@JoinColumn(name = "Users")
|
||||
private User owner;
|
||||
|
||||
//// Extension Messagerie /////
|
||||
@OneToMany(mappedBy = "course", cascade = CascadeType.ALL)
|
||||
private List<Forum> forums;
|
||||
|
||||
public void addForum(Forum f){
|
||||
f.setCourse(this);
|
||||
forums.add(f);
|
||||
}
|
||||
///////////////////////////////
|
||||
|
||||
public Course(int credits, String title, User owner){
|
||||
this.credits = credits;
|
||||
this.title = title;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public Course() {}
|
||||
|
||||
public int getCourseID() {
|
||||
return courseID;
|
||||
}
|
||||
|
||||
public int getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
||||
public void setCredits(int credits){
|
||||
this.credits = credits;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title){
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public User getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(User owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,13 @@ public class Curriculum {
|
||||
private int curriculumId;
|
||||
private int year;
|
||||
private String option;
|
||||
public Curriculum(int year, String option){
|
||||
|
||||
//True if the curriculum need an entry exam
|
||||
private boolean requireCertificate;
|
||||
public Curriculum(int year, String option, boolean requireCertificate){
|
||||
this.year = year;
|
||||
this.option = option;
|
||||
this.requireCertificate = requireCertificate;
|
||||
}
|
||||
|
||||
public Curriculum() {}
|
||||
@ -39,4 +43,11 @@ public class Curriculum {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public void setRequireCertificate(boolean requireCertificate) {
|
||||
this.requireCertificate = requireCertificate;
|
||||
}
|
||||
|
||||
public boolean isRequireCertificate() {
|
||||
return requireCertificate;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ public enum FileType {
|
||||
ProfilePicture,
|
||||
EducationCertificate,
|
||||
Research,
|
||||
|
||||
ResearchBibTex,
|
||||
JustificationDocument
|
||||
JustificationDocument,
|
||||
IdentityCard,
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
public enum FileType {
|
||||
ProfilePicture,
|
||||
EducationCertificate,
|
||||
<<<<<<< HEAD
|
||||
Research,
|
||||
|
||||
ResearchBibTex,
|
||||
JustificationDocument
|
||||
=======
|
||||
JustificationDocument,
|
||||
IdentityCard,
|
||||
>>>>>>> origin/master
|
||||
}
|
@ -80,4 +80,8 @@ public class ExemptionsRequest {
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,12 @@ public class InscriptionRequest {
|
||||
private String profilePicture;
|
||||
private String password;
|
||||
private String identityCard;
|
||||
private String admissionDocUrl;
|
||||
private Date submissionDate;
|
||||
private RequestState equivalenceState;
|
||||
public InscriptionRequest(){}
|
||||
|
||||
public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate, RequestState equivalenceState){
|
||||
public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate, RequestState equivalenceState, String admissionDocUrl){
|
||||
this.lastName = lastName;
|
||||
this.firstName = firstName;
|
||||
this.address = address;
|
||||
@ -40,6 +41,7 @@ public class InscriptionRequest {
|
||||
this.identityCard = identityCard;
|
||||
this.submissionDate = submissionDate;
|
||||
this.equivalenceState = equivalenceState;
|
||||
this.admissionDocUrl = admissionDocUrl;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
@ -149,4 +151,12 @@ public class InscriptionRequest {
|
||||
public void setEquivalenceState(RequestState equivalenceState) {
|
||||
this.equivalenceState = equivalenceState;
|
||||
}
|
||||
|
||||
public String getAdmissionDocUrl() {
|
||||
return admissionDocUrl;
|
||||
}
|
||||
|
||||
public void setAdmissionDocUrl(String admissionDocUrl) {
|
||||
this.admissionDocUrl = admissionDocUrl;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ public class Payment {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long id;
|
||||
|
||||
private long studentRegNo;
|
||||
private String card;
|
||||
private String client;
|
||||
|
@ -1,81 +0,0 @@
|
||||
package ovh.herisson.Clyde.Tables.Inscription;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
import ovh.herisson.Clyde.Tables.Curriculum;
|
||||
import ovh.herisson.Clyde.Tables.RequestState;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
@Entity
|
||||
public class ReInscriptionRequest {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Users")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Curriculum")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private Curriculum newCurriculum;
|
||||
private RequestState state;
|
||||
|
||||
//Permet de différencier les demandes de changement et une réinscription dans le même Curriculum
|
||||
//Pour la réinscription on va le mettre a 0
|
||||
private boolean type = false;
|
||||
|
||||
public ReInscriptionRequest(){}
|
||||
|
||||
public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state, boolean type){
|
||||
this.user = user;
|
||||
this.newCurriculum = newCurriculum;
|
||||
this.state = state;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state){
|
||||
this.user = user;
|
||||
this.newCurriculum = newCurriculum;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Curriculum getNewCurriculum() {
|
||||
return newCurriculum;
|
||||
}
|
||||
|
||||
public void setNewCurriculum(Curriculum newCurriculum) {
|
||||
this.newCurriculum = newCurriculum;
|
||||
}
|
||||
|
||||
public RequestState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(RequestState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean isType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(boolean type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -7,15 +7,16 @@ 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;
|
||||
|
@ -1,67 +0,0 @@
|
||||
package ovh.herisson.Clyde.Tables.Inscription;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import ovh.herisson.Clyde.Tables.RequestState;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
public class UninscriptionRequest {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long id;
|
||||
private RequestState state;
|
||||
private String reason;
|
||||
private Date date;
|
||||
|
||||
@JoinColumn(name = "Users")
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
private User user;
|
||||
|
||||
public UninscriptionRequest(RequestState state,String reason, Date date, User user){
|
||||
this.state = state;
|
||||
this.reason = reason;
|
||||
this.date = date;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public UninscriptionRequest(){}
|
||||
|
||||
public RequestState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(RequestState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,115 @@
|
||||
package ovh.herisson.Clyde.Tables.Inscription;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import ovh.herisson.Clyde.Tables.Curriculum;
|
||||
import ovh.herisson.Clyde.Tables.RequestState;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
public class UnregisterRequest {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long id;
|
||||
private RequestState state;
|
||||
private String reason;
|
||||
private Date date;
|
||||
|
||||
//We store these informations again so if the user is deleted we still have the informations for history
|
||||
private long regNo;
|
||||
|
||||
private String firstName;
|
||||
|
||||
private String lastName;
|
||||
|
||||
private String email;
|
||||
|
||||
//Null if the user unregister for the academic year, contains a curriculum if the user wants to unregister from a specific curriculum
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Curriculum")
|
||||
private Curriculum curriculum;
|
||||
|
||||
public UnregisterRequest(RequestState state, String reason, Date date, long regNo, String firstName, String lastName, String email, Curriculum curriculum){
|
||||
this.state = state;
|
||||
this.reason = reason;
|
||||
this.date = date;
|
||||
this.regNo = regNo;
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.email = email;
|
||||
this.curriculum = curriculum;
|
||||
}
|
||||
|
||||
public UnregisterRequest(){}
|
||||
|
||||
public RequestState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(RequestState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public void setRegNo(long regNo) {
|
||||
this.regNo = regNo;
|
||||
}
|
||||
|
||||
public long getRegNo() {
|
||||
return regNo;
|
||||
}
|
||||
|
||||
public void setCurriculum(Curriculum curriculum) {
|
||||
this.curriculum = curriculum;
|
||||
}
|
||||
|
||||
public Curriculum getCurriculum() {
|
||||
return curriculum;
|
||||
}
|
||||
|
||||
}
|
||||
|
101
backend/src/main/java/ovh/herisson/Clyde/Tables/Lesson.java
Normal file
101
backend/src/main/java/ovh/herisson/Clyde/Tables/Lesson.java
Normal file
@ -0,0 +1,101 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* @file Lesson.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Represent a course in a schedule
|
||||
******************************************************/
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
|
||||
@Entity
|
||||
public class Lesson {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int lessonID;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
@JoinColumn(name = "Course")
|
||||
private Course course;
|
||||
|
||||
private String lessonStart;
|
||||
|
||||
private String lessonEnd;
|
||||
|
||||
private String color;
|
||||
|
||||
private String lessonType;
|
||||
|
||||
private String local;
|
||||
|
||||
public Lesson(Course course,String start, String end ,String color,String local,String lessonType){
|
||||
this.lessonEnd = end;
|
||||
this.course = course;
|
||||
this.lessonStart = start;
|
||||
this.color = color;
|
||||
this.local = local;
|
||||
this.lessonType = lessonType;
|
||||
}
|
||||
|
||||
public Lesson() {
|
||||
}
|
||||
|
||||
public int getLessonID(){
|
||||
return lessonID;
|
||||
}
|
||||
|
||||
public void setCourse(Course course) {
|
||||
this.course = course;
|
||||
}
|
||||
|
||||
public Course getCourse(){
|
||||
return course;
|
||||
}
|
||||
|
||||
public String getLessonStart(){
|
||||
return lessonStart;
|
||||
}
|
||||
|
||||
public String getLessonEnd() {
|
||||
return lessonEnd;
|
||||
}
|
||||
|
||||
public String getColor(){
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getLocal() {
|
||||
return local;
|
||||
}
|
||||
|
||||
public String getLessonType(){
|
||||
return lessonType;
|
||||
}
|
||||
|
||||
public void setLessonStart(String start){
|
||||
this.lessonStart = start;
|
||||
}
|
||||
|
||||
public void setLessonEnd(String lessonEnd) {
|
||||
this.lessonEnd = lessonEnd;
|
||||
}
|
||||
|
||||
public void setColor(String color){
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void setLocal(String local){
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
public void setLessonType(String lessonType){
|
||||
this.lessonType = lessonType;
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* @file LessonChangesRequest.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Represent a request about changes on schedules and lessons
|
||||
******************************************************/
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class LessonChangesRequest {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Users")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private User user;
|
||||
|
||||
private long lessonId;
|
||||
|
||||
private RequestState state;
|
||||
|
||||
private String lessonStart;
|
||||
|
||||
private String lessonEnd;
|
||||
|
||||
private String color;
|
||||
@ManyToOne
|
||||
@JoinColumn(name ="Course")
|
||||
private Course course;
|
||||
|
||||
private String lessonType;
|
||||
|
||||
/**
|
||||
* Can take 3 values:
|
||||
* 0 : Request to CREATE a lesson
|
||||
* 1 : Request to MODIFY an existing lesson
|
||||
* 2 : Request to DELETE a lesson
|
||||
*/
|
||||
private int requestType;
|
||||
|
||||
public LessonChangesRequest(User user, RequestState state, String lessonStart,
|
||||
String lessonEnd, String lessonType, Course course,
|
||||
int requestType, String color,long lessonId){
|
||||
this.user = user;
|
||||
this.state = state;
|
||||
this.requestType = requestType;
|
||||
this.lessonType = lessonType;
|
||||
this.lessonStart = lessonStart;
|
||||
this.lessonEnd= lessonEnd;
|
||||
this.color = color;
|
||||
this.course = course;
|
||||
this.lessonId = lessonId;
|
||||
}
|
||||
|
||||
public LessonChangesRequest() {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public RequestState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public long getLessonId(){
|
||||
return lessonId;
|
||||
}
|
||||
|
||||
public String getLessonStart() {
|
||||
return lessonStart;
|
||||
}
|
||||
|
||||
public String getLessonEnd() {
|
||||
return lessonEnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getRequestType() {
|
||||
return requestType;
|
||||
}
|
||||
|
||||
public String getLessonType() {
|
||||
return lessonType;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public Course getCourse() {
|
||||
return course;
|
||||
}
|
||||
|
||||
public void setState(RequestState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setLessonStart(String lessonStart) {
|
||||
this.lessonStart = lessonStart;
|
||||
}
|
||||
|
||||
public void setLessonType(String lessonType) {
|
||||
this.lessonType = lessonType;
|
||||
}
|
||||
|
||||
public void setLessonEnd(String lessonEnd) {
|
||||
this.lessonEnd = lessonEnd;
|
||||
}
|
||||
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void setRequestType(int requestType) {
|
||||
this.requestType = requestType;
|
||||
}
|
||||
|
||||
|
||||
public void setLessonId(long lessonId) {
|
||||
this.lessonId = lessonId;
|
||||
}
|
||||
|
||||
public void setCourse(Course course){
|
||||
this.course = course;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package ovh.herisson.Clyde.Tables.Msg;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class Answer {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
@CreationTimestamp
|
||||
private Date creation;
|
||||
|
||||
private String content;
|
||||
|
||||
@ManyToOne(cascade=CascadeType.ALL)
|
||||
private User author;
|
||||
|
||||
private boolean anonymous;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package ovh.herisson.Clyde.Tables.Msg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class Forum {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
@ManyToOne
|
||||
@JsonIgnore
|
||||
private Course course;
|
||||
|
||||
private String name;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
private List<Topic> topics;
|
||||
|
||||
public void addTopic(Topic t) {
|
||||
topics.add(t);
|
||||
}
|
||||
|
||||
@OneToMany
|
||||
private List<User> writers; // User who are authorized to create a post
|
||||
|
||||
@OneToMany
|
||||
private List<User> register;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package ovh.herisson.Clyde.Tables.Msg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class Topic {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
private String subject, content;
|
||||
|
||||
@ManyToOne
|
||||
private User author;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
private List<Answer> answers;
|
||||
|
||||
public void addAnswer(Answer a){
|
||||
answers.add(a);
|
||||
}
|
||||
|
||||
private boolean locked; // true if new messages can be posted
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Entity
|
||||
public class Notification {
|
||||
|
||||
public enum Status {
|
||||
Unread,
|
||||
Read,
|
||||
Archived
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
private String subject;
|
||||
|
||||
private String body;
|
||||
|
||||
private Status status = Status.Unread;
|
||||
|
||||
private String link;
|
||||
|
||||
@ManyToOne
|
||||
@JsonIgnore
|
||||
private User user;
|
||||
|
||||
@CreationTimestamp
|
||||
private Date creation;
|
||||
|
||||
public Notification(String subject, @Nullable String body, @Nullable String link){
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.link = link;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* @file Schedule.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Represent a schedule linked to a curriculum
|
||||
******************************************************/
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class Schedule {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int scheduleID;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "Curriculum")
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
private Curriculum curriculum;
|
||||
|
||||
public Schedule(Curriculum curriculum){
|
||||
this.curriculum = curriculum;
|
||||
}
|
||||
|
||||
public Schedule() {}
|
||||
|
||||
|
||||
public int getScheduleID(){
|
||||
return scheduleID;
|
||||
}
|
||||
|
||||
public Curriculum getCurriculum(){
|
||||
return curriculum;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* @file ScheduleLesson.java
|
||||
* @author William Karpinski
|
||||
* @scope Extension Horaire
|
||||
*
|
||||
* Used to link schedules and lessons to each others
|
||||
******************************************************/
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
|
||||
@Entity
|
||||
public class ScheduleLesson{
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "Schedule")
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
private Schedule schedule;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
@JoinColumn(name = "Lesson")
|
||||
private Lesson lesson;
|
||||
|
||||
public ScheduleLesson(Schedule schedule,Lesson lesson){
|
||||
this.schedule = schedule;
|
||||
this.lesson = lesson;
|
||||
}
|
||||
|
||||
public ScheduleLesson() {
|
||||
}
|
||||
|
||||
public int getID(){
|
||||
return id;
|
||||
}
|
||||
|
||||
public Lesson getLesson(){
|
||||
return lesson;
|
||||
}
|
||||
|
||||
public Schedule getSchedule(){
|
||||
return schedule;
|
||||
}
|
||||
|
||||
public void setLesson(Lesson lesson){
|
||||
this.lesson = lesson;
|
||||
}
|
||||
|
||||
public void setSchedule(Schedule schedule){
|
||||
this.schedule = schedule;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,18 +1,30 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||
import ovh.herisson.Clyde.Tables.Notification.Status;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Users")
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class User {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@GenericGenerator(name = "userGen", type = ovh.herisson.Clyde.Tables.RegNoGenerator.class)
|
||||
@GeneratedValue(generator = "userGen")
|
||||
private Long regNo;
|
||||
private String lastName;
|
||||
private String firstName;
|
||||
@ -22,15 +34,24 @@ public class User {
|
||||
private String country;
|
||||
private Date birthDate;
|
||||
private String profilePictureUrl;
|
||||
private ovh.herisson.Clyde.Tables.Role role;
|
||||
private Role role;
|
||||
private String identityCardUrl;
|
||||
@JsonIgnore
|
||||
private String password;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
|
||||
private List<Notification> notifications;
|
||||
|
||||
////// Extension Messagerie /////
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "author", cascade = CascadeType.ALL)
|
||||
private List<Message> msgs;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToMany( mappedBy = "members" )
|
||||
private List<Discussion> discussions;
|
||||
/////////////////////////////////
|
||||
|
||||
/////////////////////////////////
|
||||
public User(String lastName, String firstName, String email, String address,
|
||||
@ -44,11 +65,13 @@ public class User {
|
||||
this.birthDate = birthDate;
|
||||
this.profilePictureUrl = profilePictureUrl;
|
||||
this.role = role;
|
||||
this.password = password;
|
||||
this.password = (new BCryptPasswordEncoder()).encode(password);
|
||||
}
|
||||
|
||||
|
||||
//This constructor is used to add a student
|
||||
public User(String lastName, String firstName, String email, String address,
|
||||
String country, Date birthDate, String profilePictureUrl, String password)
|
||||
String country, Date birthDate, String profilePictureUrl, String password,String identityCardUrl)
|
||||
{
|
||||
this.lastName = lastName;
|
||||
this.firstName = firstName;
|
||||
@ -57,79 +80,12 @@ public class User {
|
||||
this.country = country;
|
||||
this.birthDate = birthDate;
|
||||
this.profilePictureUrl = profilePictureUrl;
|
||||
this.password = password;
|
||||
this.password = (new BCryptPasswordEncoder()).encode(password);
|
||||
this.role = Role.Student;
|
||||
}
|
||||
public User() {}
|
||||
|
||||
public Long getRegNo(){
|
||||
return this.regNo;
|
||||
}
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
this.identityCardUrl = identityCardUrl;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public Date getBirthDate() {
|
||||
return birthDate;
|
||||
}
|
||||
|
||||
public void setBirthDate(Date birthDate) {
|
||||
this.birthDate = birthDate;
|
||||
}
|
||||
|
||||
public String getProfilePictureUrl(){return this.profilePictureUrl;}
|
||||
|
||||
public void setProfilePictureUrl(String profilePictureUrl){
|
||||
this.profilePictureUrl = profilePictureUrl;
|
||||
}
|
||||
public ovh.herisson.Clyde.Tables.Role getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(ovh.herisson.Clyde.Tables.Role role) {
|
||||
this.role = role;
|
||||
}
|
||||
public String getPassword(){
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = (new BCryptPasswordEncoder()).encode(password);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,17 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCurriculum {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@ -23,39 +30,13 @@ public class UserCurriculum {
|
||||
|
||||
private int year;
|
||||
|
||||
public UserCurriculum(User user, Curriculum curriculum, int year){
|
||||
this.user = user;
|
||||
this.curriculum = curriculum;
|
||||
this.year = year;
|
||||
}
|
||||
//True if the user has that curriculum at the moment false if not
|
||||
private boolean actual;
|
||||
|
||||
public UserCurriculum() {}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Curriculum getCurriculum() {
|
||||
return curriculum;
|
||||
}
|
||||
|
||||
public void setCurriculum(Curriculum curriculum) {
|
||||
this.curriculum = curriculum;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
public UserCurriculum(User u, Curriculum cu, int year, boolean actual){
|
||||
this.user = u;
|
||||
this.curriculum = cu;
|
||||
this.year = year;
|
||||
this.actual = actual;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ 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);
|
||||
}
|
||||
@ -34,8 +35,8 @@ public class UserRepoTest {
|
||||
}
|
||||
@Test
|
||||
public void usertest(){
|
||||
Assert.assertEquals("brine", userRepo.findById(1).getLastName());
|
||||
Assert.assertTrue(new GregorianCalendar(2005, 4, 3).getTime().equals(userRepo.findById(1).getBirthDate()));
|
||||
Assert.assertEquals("brine", userRepo.findByEmail("admin@admin.com").getLastName());
|
||||
Assert.assertTrue(new GregorianCalendar(2005, 4, 3).getTime().equals(userRepo.findByEmail("admin@admin.com").getBirthDate()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,13 @@ login.guest.lastpage=Last Page
|
||||
login.guest.submit=Submit
|
||||
login.guest.birthday=BIRTHDAY
|
||||
login.guest.confirm=CONFIRM
|
||||
login.guest.browse=Browse...
|
||||
login.guest.disclaimer=If you are already registered please connect to your account and use the change cursus/reregister function if not continue here.
|
||||
login.guest.identityCard=Identity Card :
|
||||
login.guest.attestationdisclaimer=This curriculum requires an entrance exam attestation
|
||||
login.guest.formationdisclaimer=Please add your old formations with the associated degree/attestation,your case will be check by a member of the inscription service.
|
||||
login.guest.managecareer=Manage your external formations
|
||||
login.guest.sendRegReq=Send register request
|
||||
login.cPassword=Confirm Password
|
||||
login.password=Password
|
||||
app.home=Home
|
||||
@ -22,6 +29,7 @@ app.settings=Settings
|
||||
app.messages=Messages
|
||||
app.forum=Forum
|
||||
app.schedules=Schedules
|
||||
app.manageSchedules=Manage Schedules
|
||||
app.inscription.requests=Inscription Requests
|
||||
app.manage.courses=Manage Courses
|
||||
app.language=Language
|
||||
@ -31,15 +39,76 @@ app.users=Users
|
||||
app.manage.researcherProfile=Manage researcher profile
|
||||
app.list.researches=List researches
|
||||
app.Create.User=Create User
|
||||
app.manageOwnLessons=Manage Owned Courses Schedule
|
||||
app.lessonRequests=Schedule Requests
|
||||
app.payments=Payments
|
||||
request.moreInfos=More Infos
|
||||
request.accept=Accept
|
||||
request.refuse=Refuse
|
||||
Pending=Pending
|
||||
Delete=Delete
|
||||
Modify=Modify
|
||||
Create=Créer
|
||||
requestType=Request Type
|
||||
day=Day
|
||||
start=Start
|
||||
end=End
|
||||
monday=Monday
|
||||
tuesday=Tuesday
|
||||
wednesday=Wednesday
|
||||
thursday=Thursday
|
||||
friday=Friday
|
||||
saturday=Saturday
|
||||
sunday=Sunday
|
||||
january=January
|
||||
february=February
|
||||
march=March
|
||||
april=April
|
||||
may=May
|
||||
june=June
|
||||
july=July
|
||||
august=August
|
||||
september=September
|
||||
october=October
|
||||
november=November
|
||||
december=December
|
||||
Grid=Grid
|
||||
Week=Week
|
||||
Month=Month
|
||||
List=List
|
||||
Type=Type
|
||||
Teacher=Teacher
|
||||
Course=Course
|
||||
TP=TP
|
||||
TD=TD
|
||||
Exam=Exam
|
||||
OwnSchedule=Own Schedule
|
||||
SwitchToJSON=Switch to JSON FILE
|
||||
schedule.previous=Previous
|
||||
schedule.next=Next
|
||||
schedule.current=Current
|
||||
schedule.settings=Settings
|
||||
schedule.courses=Courses
|
||||
schedule.teachers=Teacher(s)
|
||||
schedule.askChanges=Ask Changes
|
||||
schedule.askCreate=Ask to create course
|
||||
schedule.askDeletion=Ask Deletion
|
||||
schedule.createSchedule=Create Schedule
|
||||
schedule.createLesson=Create course
|
||||
schedule.deleteMod=Unable deletion
|
||||
schedule.noDeleteMod=Disable deletion
|
||||
schedule=Schedule
|
||||
old_day=Precedent day
|
||||
old_start=Precedent start
|
||||
old_end=Precedent end
|
||||
old_type=Precedent type
|
||||
courses.createCourse=Create course
|
||||
courses.deleteCourse=Delete course
|
||||
courses.modify=Modify
|
||||
courses.toDelete=Course to Delete
|
||||
courses.confirm=Confirm
|
||||
courses.back=Back
|
||||
courses.AddToCurriculum=Add to a new Curriculum
|
||||
profile.modify.data=Modify personnal data
|
||||
profile.reRegister=Re-register
|
||||
profile.unRegister=Unregister
|
||||
@ -130,3 +199,91 @@ Profile.Picture=Profile Picture
|
||||
Role=Role
|
||||
Password=Password
|
||||
Create.User=Create User
|
||||
msg.notification.new=You have a new message
|
||||
forum.create=Create forum
|
||||
forum.create.name=New forum's name
|
||||
forum.post.create.name=New post's title
|
||||
firstname/name=Firstname/Name
|
||||
regNo=regNo
|
||||
From=From
|
||||
To=To
|
||||
WantedCursus=Wanted Cursus
|
||||
seeprofile=See profile
|
||||
acceptequiv=Accept equivalence
|
||||
refuseequiv=Refuse equivalence
|
||||
course=course
|
||||
state=state
|
||||
dljustifdoc=Download justification document
|
||||
backtoreq=Back to request
|
||||
dlidentitycard=Download identity card
|
||||
dladmissiondoc=Download admission document
|
||||
seeextcur=See external curriculums
|
||||
dltaxdoc=Download tax justification document
|
||||
dlresidency=Download residency justification document
|
||||
enteramount=Please enter the amount to provide :
|
||||
oldcursus=Old curriculums
|
||||
newcursus=New curriculums
|
||||
year=Year
|
||||
reason=Reason :
|
||||
selectedcursus=Selected curriculum :
|
||||
askexemp=Ask exemption
|
||||
exemp=Exempted
|
||||
uploadjustifdoc=Please upload the justification document
|
||||
subexemreq=Submit exemption request
|
||||
addextcurr=Add external curriculum
|
||||
dldoc=Download document
|
||||
edit=Edit
|
||||
delete=Delete
|
||||
school=School
|
||||
checkifnotcompleted=Check the box if you didn't complete the formation
|
||||
wichyearstop=In which year did you stop (ex: 3rd year) ?
|
||||
startyear=Start year
|
||||
endyear=End year
|
||||
giveextcurdoc=Please upload a document that proves this formation
|
||||
uploadcurr=Upload curriculum
|
||||
editcurr=Edit curriculum
|
||||
reqtype=Request type :
|
||||
inscription=register
|
||||
scholarship=scholarship
|
||||
exemption=exemption
|
||||
unregister=unregister
|
||||
curriculumch=curriculum change
|
||||
filter=Filter :
|
||||
approval=Approval :
|
||||
teacherapproval=Teacher approval :
|
||||
surreq=Are you sure that you want to accept this request ?
|
||||
validate=Validate
|
||||
amount=Amount
|
||||
role=Role
|
||||
manageextcur=Manage external curriculum
|
||||
managecourse=Manage courses
|
||||
manageminerval=Manage school fees
|
||||
enterreason=Please enter the reason you leave
|
||||
onlycursus=I only want to unregister from a specific cursus
|
||||
plsselectcurs=Please select that cursus
|
||||
sureunreg=Are you sure that you want to unregister ?
|
||||
no=No
|
||||
yes=Yes
|
||||
reqsend=Your request has been send !
|
||||
payment=Payment
|
||||
lefttopay=left to pay
|
||||
paydeposit=Pay deposit
|
||||
payrest=Pay all the rest
|
||||
alreadypaid=Payment : School fees have already been paid this year
|
||||
askscholarship=Ask scholarship
|
||||
uploaddocs=Please upload the required documents
|
||||
taxjustdoc=Tax justification document :
|
||||
residencydoc=Residency justification document :
|
||||
reqsent=Your request has been sent to the inscription service.
|
||||
backprofile=Go back to profile
|
||||
procpayment=Proceed to payment of
|
||||
procpaybutton=Process payment
|
||||
rereg=Reregister in the next year of one of my cursus
|
||||
reregsup=Register in a supplementary cursus
|
||||
chcur=Change from a cursus to another
|
||||
iwouldlike=I would like to :
|
||||
newcurr=New curriculum
|
||||
cursusprereq=The cursus you selected has some prerequisites ensure that your external curriculum data is updated in your profile
|
||||
imposecurriculum=Impose a curriculum
|
||||
impose=Impose
|
||||
gotimposed=The selected curriculum has been imposed
|
||||
|
295
frontend/public/i18n/EN.txt.orig
Normal file
295
frontend/public/i18n/EN.txt.orig
Normal file
@ -0,0 +1,295 @@
|
||||
login.guest.signin=Sign in
|
||||
login.guest.register=Register
|
||||
login.guest.alregister=Already Registered
|
||||
login.guest.welcome=WELCOME TO THE UNIVERSITY
|
||||
login.guest.email=E-MAIL
|
||||
login.guest.firstname=FIRSTNAME
|
||||
login.guest.surname=SURNAME
|
||||
login.guest.country=COUNTRY
|
||||
login.guest.address=ADDRESS
|
||||
login.guest.password=PASSWORD
|
||||
login.guest.nextpage=Next Page
|
||||
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
|
||||
app.login=Login
|
||||
app.notifications=Notifications
|
||||
app.settings=Settings
|
||||
app.messages=Messages
|
||||
app.forum=Forum
|
||||
app.schedules=Schedules
|
||||
app.manageSchedules=Manage Schedules
|
||||
app.inscription.requests=Inscription Requests
|
||||
app.manage.courses=Manage Courses
|
||||
app.language=Language
|
||||
app.manage.profile=Manage profile
|
||||
app.studentList=Students List
|
||||
app.users=Users
|
||||
<<<<<<< HEAD
|
||||
app.manage.researcherProfile=Manage researcher profile
|
||||
app.list.researches=List researches
|
||||
app.Create.User=Create User
|
||||
=======
|
||||
app.manageOwnLessons=Manage Owned Courses Schedule
|
||||
app.lessonRequests=Schedule Requests
|
||||
app.payments=Payments
|
||||
>>>>>>> origin/master
|
||||
request.moreInfos=More Infos
|
||||
request.accept=Accept
|
||||
request.refuse=Refuse
|
||||
Pending=Pending
|
||||
Delete=Delete
|
||||
Modify=Modify
|
||||
Create=Créer
|
||||
requestType=Request Type
|
||||
day=Day
|
||||
start=Start
|
||||
end=End
|
||||
monday=Monday
|
||||
tuesday=Tuesday
|
||||
wednesday=Wednesday
|
||||
thursday=Thursday
|
||||
friday=Friday
|
||||
saturday=Saturday
|
||||
sunday=Sunday
|
||||
january=January
|
||||
february=February
|
||||
march=March
|
||||
april=April
|
||||
may=May
|
||||
june=June
|
||||
july=July
|
||||
august=August
|
||||
september=September
|
||||
october=October
|
||||
november=November
|
||||
december=December
|
||||
Grid=Grid
|
||||
Week=Week
|
||||
Month=Month
|
||||
List=List
|
||||
Type=Type
|
||||
Teacher=Teacher
|
||||
Course=Course
|
||||
TP=TP
|
||||
TD=TD
|
||||
Exam=Exam
|
||||
OwnSchedule=Own Schedule
|
||||
SwitchToJSON=Switch to JSON FILE
|
||||
schedule.previous=Previous
|
||||
schedule.next=Next
|
||||
schedule.current=Current
|
||||
schedule.settings=Settings
|
||||
schedule.courses=Courses
|
||||
schedule.teachers=Teacher(s)
|
||||
schedule.askChanges=Ask Changes
|
||||
schedule.askCreate=Ask to create course
|
||||
schedule.askDeletion=Ask Deletion
|
||||
schedule.createSchedule=Create Schedule
|
||||
schedule.createLesson=Create course
|
||||
schedule.deleteMod=Unable deletion
|
||||
schedule.noDeleteMod=Disable deletion
|
||||
schedule=Schedule
|
||||
old_day=Precedent day
|
||||
old_start=Precedent start
|
||||
old_end=Precedent end
|
||||
old_type=Precedent type
|
||||
courses.createCourse=Create course
|
||||
courses.deleteCourse=Delete course
|
||||
courses.modify=Modify
|
||||
courses.toDelete=Course to Delete
|
||||
courses.confirm=Confirm
|
||||
courses.back=Back
|
||||
courses.AddToCurriculum=Add to a new Curriculum
|
||||
profile.modify.data=Modify personnal data
|
||||
profile.reRegister=Re-register
|
||||
profile.unRegister=Unregister
|
||||
profile.course.list=Courses list
|
||||
profile.address=Address
|
||||
profile.picture=Profile picture
|
||||
profile.change.curriculum=Change curriculum
|
||||
name=Name
|
||||
Teacher=Teacher
|
||||
Student=Student
|
||||
Secretary=Secretary
|
||||
Curriculum=curriculum
|
||||
Credits=Credits
|
||||
InscriptionService=I.S.
|
||||
faculty=Faculty
|
||||
<<<<<<< HEAD
|
||||
Year=Year
|
||||
Access=Access
|
||||
Access.Restricted=Restricted
|
||||
Access.OpenSource=OpenSource
|
||||
Access.Private=Private
|
||||
Language=Language
|
||||
Month=Month
|
||||
Month.01=january
|
||||
Month.02=february
|
||||
Month.03=march
|
||||
Month.04=april
|
||||
Month.05=may
|
||||
Month.06=june
|
||||
Month.07=july
|
||||
Month.08=august
|
||||
Month.09=september
|
||||
Month.10=october
|
||||
Month.11=november
|
||||
Month.12=december
|
||||
Domain=Domain
|
||||
PaperType=PaperType
|
||||
Submit=Submit
|
||||
Search.Researches=Search For Researches
|
||||
Search.Researchers=Search For Researchers
|
||||
Filters=Filters
|
||||
Toggle.Researcher=Toggle Researcher Search
|
||||
Untoggle.Researcher=Toggle Research Search
|
||||
MoreInfo=More Info
|
||||
Modify.Research=Modify Research
|
||||
To.Change.In.Options=To change in regular account options
|
||||
Modify.Data=Modify Data
|
||||
Confirm.Changes=Confirm Changes
|
||||
Cancel.Changes=Cancel Changes
|
||||
Post.Research=Post a new Research
|
||||
Summary=Summary
|
||||
Title=Title
|
||||
Views=Number of Views
|
||||
See.Research=See Research
|
||||
SeeBibTex=See BibTex
|
||||
Author=Author
|
||||
CoAuthors=Co-Authors
|
||||
ReleaseDate=ReleaseDate
|
||||
Article.Id=Article Id
|
||||
Delete.Research=Delete Research
|
||||
Here=Here
|
||||
Stat.Type=Stat Type
|
||||
Researches=Researches
|
||||
Please.Select.Option=Please Select an Option
|
||||
Class.By=Class By
|
||||
PaperType.Article=Article
|
||||
PaperType.Book=Book
|
||||
PaperType.Book.Chapter=Book Chapter
|
||||
PaperType.Paper=Paper
|
||||
Research.Pdf=Research Pdf
|
||||
BibTex.Pdf=BibTex Pdf
|
||||
CoAuthors.List=Co-Author List
|
||||
Confirm.Publish=Confirm Publishing
|
||||
Cancel.Publish=Cancel Publishing
|
||||
Years=Years
|
||||
Months=Months
|
||||
By=By
|
||||
RegNo=RegNo
|
||||
Address=Address
|
||||
Country=Country
|
||||
BirthDate=Birth Date
|
||||
Researcher.Delete=Delete Researcher Profile
|
||||
Researcher.Add=Create Researcher Profile
|
||||
Confirm=Confirm
|
||||
Cancel=Cancel
|
||||
LastName=Last Name
|
||||
FirstName=First Name
|
||||
Profile.Picture=Profile Picture
|
||||
Role=Role
|
||||
Password=Password
|
||||
Create.User=Create User
|
||||
=======
|
||||
msg.notification.new=You have a new message
|
||||
forum.create=Create forum
|
||||
forum.create.name=New forum's name
|
||||
forum.post.create.name=New post's title
|
||||
firstname/name=Firstname/Name
|
||||
regNo=regNo
|
||||
From=From
|
||||
To=To
|
||||
WantedCursus=Wanted Cursus
|
||||
seeprofile=See profile
|
||||
acceptequiv=Accept equivalence
|
||||
refuseequiv=Refuse equivalence
|
||||
course=course
|
||||
state=state
|
||||
dljustifdoc=Download justification document
|
||||
backtoreq=Back to request
|
||||
dlidentitycard=Download identity card
|
||||
dladmissiondoc=Download admission document
|
||||
seeextcur=See external curriculums
|
||||
dltaxdoc=Download tax justification document
|
||||
dlresidency=Download residency justification document
|
||||
enteramount=Please enter the amount to provide :
|
||||
oldcursus=Old curriculums
|
||||
newcursus=New curriculums
|
||||
year=Year
|
||||
reason=Reason :
|
||||
selectedcursus=Selected curriculum :
|
||||
askexemp=Ask exemption
|
||||
exemp=Exempted
|
||||
uploadjustifdoc=Please upload the justification document
|
||||
subexemreq=Submit exemption request
|
||||
addextcurr=Add external curriculum
|
||||
dldoc=Download document
|
||||
edit=Edit
|
||||
delete=Delete
|
||||
school=School
|
||||
checkifnotcompleted=Check the box if you didn't complete the formation
|
||||
wichyearstop=In which year did you stop (ex: 3rd year) ?
|
||||
startyear=Start year
|
||||
endyear=End year
|
||||
giveextcurdoc=Please upload a document that proves this formation
|
||||
uploadcurr=Upload curriculum
|
||||
editcurr=Edit curriculum
|
||||
reqtype=Request type :
|
||||
inscription=register
|
||||
scholarship=scholarship
|
||||
exemption=exemption
|
||||
unregister=unregister
|
||||
curriculumch=curriculum change
|
||||
filter=Filter :
|
||||
approval=Approval :
|
||||
teacherapproval=Teacher approval :
|
||||
surreq=Are you sure that you want to accept this request ?
|
||||
validate=Validate
|
||||
amount=Amount
|
||||
role=Role
|
||||
manageextcur=Manage external curriculum
|
||||
managecourse=Manage courses
|
||||
manageminerval=Manage school fees
|
||||
enterreason=Please enter the reason you leave
|
||||
onlycursus=I only want to unregister from a specific cursus
|
||||
plsselectcurs=Please select that cursus
|
||||
sureunreg=Are you sure that you want to unregister ?
|
||||
no=No
|
||||
yes=Yes
|
||||
reqsend=Your request has been send !
|
||||
payment=Payment
|
||||
lefttopay=left to pay
|
||||
paydeposit=Pay deposit
|
||||
payrest=Pay all the rest
|
||||
alreadypaid=Payment : School fees have already been paid this year
|
||||
askscholarship=Ask scholarship
|
||||
uploaddocs=Please upload the required documents
|
||||
taxjustdoc=Tax justification document :
|
||||
residencydoc=Residency justification document :
|
||||
reqsent=Your request has been sent to the inscription service.
|
||||
backprofile=Go back to profile
|
||||
procpayment=Proceed to payment of
|
||||
procpaybutton=Process payment
|
||||
rereg=Reregister in the next year of one of my cursus
|
||||
reregsup=Register in a supplementary cursus
|
||||
chcur=Change from a cursus to another
|
||||
iwouldlike=I would like to :
|
||||
newcurr=New curriculum
|
||||
cursusprereq=The cursus you selected has some prerequisites ensure that your external curriculum data is updated in your profile
|
||||
imposecurriculum=Impose a curriculum
|
||||
impose=Impose
|
||||
gotimposed=The selected curriculum has been imposed
|
||||
>>>>>>> origin/master
|
@ -13,6 +13,13 @@ login.guest.lastpage=Derniere Page
|
||||
login.guest.submit=Envoyer
|
||||
login.guest.birthday=DATE DE NAISSANCE
|
||||
login.guest.confirm=CONFIRMER
|
||||
login.guest.browse=Parcourir...
|
||||
login.guest.disclaimer=Si vous êtes déja inscrits dans cette université veuillez vous connecter a votre compte et utilisez les fonctions changer de cursus/réinscription sinon continuez ici.
|
||||
login.guest.identityCard=Carte d'identité :
|
||||
login.guest.attestationdisclaimer=Ce cursus requiert une attestation de réussite d'un examen d'entrée
|
||||
login.guest.formationdisclaimer=Veuillez ajouter vos formations antérieures en y joignant les attestations/diplomes, votre dossier sera vérifié par un membre du service d'inscription.
|
||||
login.guest.managecareer=Gèrer mon parcours extérieur
|
||||
login.guest.sendRegReq=Envoyer la demande d'inscription
|
||||
login.cPassword=Confirmer mot de passe
|
||||
login.password=Mot de passe
|
||||
app.home=Home
|
||||
@ -22,6 +29,7 @@ app.settings=Options
|
||||
app.messages=Messages
|
||||
app.forum=Forum
|
||||
app.schedules=Horaires
|
||||
app.manageSchedules=Gérer les horaires
|
||||
app.inscription.requests=Demandes d'Inscription
|
||||
app.manage.courses=Gérer les cours
|
||||
app.language=Langue
|
||||
@ -31,15 +39,76 @@ app.users=Utilisateurs
|
||||
app.manage.researcherProfile= gérer son profil de chercheur
|
||||
app.list.researches=Lister les recherches
|
||||
app.Create.User=créer un utilisateur
|
||||
app.manageOwnLessons=Gérer ses horaires de cours
|
||||
app.lessonRequests=Requêtes d'horaire
|
||||
app.payments=Payements
|
||||
request.moreInfos=Plus d'Infos
|
||||
request.accept=Accepter
|
||||
request.refuse=Refuser
|
||||
Pending=En attente
|
||||
Delete=Supprimer
|
||||
Modify=Modifier
|
||||
Create=Créer
|
||||
requestType=Type de Requête
|
||||
day=Jour
|
||||
start=Début
|
||||
end=Fin
|
||||
monday=Lundi
|
||||
tuesday=Mardi
|
||||
wednesday=Mercredi
|
||||
thursday=Jeudi
|
||||
friday=Vendredi
|
||||
saturday=Samedi
|
||||
sunday=Dimanche
|
||||
january=Janvier
|
||||
february=Février
|
||||
march=Mars
|
||||
april=Avril
|
||||
may=Mai
|
||||
june=Juin
|
||||
july=Juillet
|
||||
august=Août
|
||||
september=Septembre
|
||||
october=Octobre
|
||||
november=Novembre
|
||||
december=Decembre
|
||||
Grid=Grille
|
||||
Week=Semaine
|
||||
Month=Mois
|
||||
List=Liste
|
||||
Type=Type
|
||||
Teacher=Professeur
|
||||
Course=Cours
|
||||
TP=TP
|
||||
TD=TD
|
||||
Exam=Exam
|
||||
OwnSchedule=Mon Horaire
|
||||
SwitchToJSON=Afficher le JSON
|
||||
schedule.previous=Précédent
|
||||
schedule.next=Prochain
|
||||
schedule.current=Actuel
|
||||
schedule.settings=Options
|
||||
schedule.courses=Cours
|
||||
schedule.teachers=Professeurs(s)
|
||||
schedule.askChanges=Demander Changement
|
||||
schedule.askCreate=Demander de créer un cours
|
||||
schedule.askDeletion=Demander suppression
|
||||
schedule.createSchedule=Créer Horaire
|
||||
schedule.createLesson=Créer cours
|
||||
schedule.deleteMod=Activer suppression
|
||||
schedule.noDeleteMod=Désactiver suppression
|
||||
schedule=Horaire
|
||||
old_day=Ancien Jour
|
||||
old_start=Ancien Début
|
||||
old_end=Ancienne Fin
|
||||
old_type=Ancien Type
|
||||
courses.createCourse=Créer un cours
|
||||
courses.deleteCourse=Supprimer un cours
|
||||
courses.modify=Modifier
|
||||
courses.toDelete=Cours à supprimer
|
||||
courses.confirm=Confirmer
|
||||
courses.back=Retour
|
||||
courses.AddToCurriculum=Ajouter à un cursus
|
||||
profile.modify.data=Modifier données personnelles
|
||||
profile.reRegister=Réinsciption
|
||||
profile.unRegister=Désinscription
|
||||
@ -128,3 +197,91 @@ Profile.Picture=Photo de Profil
|
||||
Role=Role
|
||||
Password=Mot de Passe
|
||||
Create.User=Créer l'utilisateur
|
||||
msg.notification.new=Vous avez un nouveau message!
|
||||
forum.create=Créer un forum
|
||||
forum.create.name=Nom du forum
|
||||
forum.post.create.name=Titre du post
|
||||
firstname/name=Prénom/Nom
|
||||
regNo=Matricule
|
||||
From=De
|
||||
To=A
|
||||
WantedCursus=Cursus voulu
|
||||
seeprofile=Voir le profil
|
||||
acceptequiv=Accepter l'équivalence
|
||||
refuseequiv=Refuser l'équivalence
|
||||
course=cours
|
||||
state=état
|
||||
dljustifdoc=Télécharger le justificatif
|
||||
backtoreq=Retour a la requête
|
||||
dlidentitycard=Télécharger la carte d'identité
|
||||
dladmissiondoc=Télécharger le certificat d'admission
|
||||
seeextcur=Voir le parcours extérieur
|
||||
dltaxdoc=Télécharger le justificatif d'impot
|
||||
dlresidency=Télécharger le justificatif de résidence
|
||||
enteramount=Veuillez entrer le montant alloué :
|
||||
oldcursus=Anciens cursus
|
||||
newcursus=Nouveaux cursus
|
||||
year=Année
|
||||
reason=Raison :
|
||||
selectedcursus=Cursus selectionné :
|
||||
askexemp=Demander une dispense
|
||||
exemp=Dispensé
|
||||
uploadjustifdoc=Veuillez soumettre le justificatif
|
||||
subexemreq=Envoyer la demande de dispense
|
||||
addextcurr=Ajouter une formation
|
||||
dldoc=Télécharger le document
|
||||
edit=Modifier
|
||||
delete=Supprimer
|
||||
school=Ecole
|
||||
checkifnotcompleted=Cochez la case si vous n'avez terminé cette formation
|
||||
wichyearstop=En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?
|
||||
startyear=Année de début
|
||||
endyear=Année de fin
|
||||
giveextcurdoc=Veuillez soumettre un document attestant de ce parcours
|
||||
uploadcurr=Ajouter la formation
|
||||
editcurr=Modifier la formation
|
||||
reqtype=Type de requête :
|
||||
inscription=inscription
|
||||
scholarship=bourse
|
||||
exemption=dispense
|
||||
unregister=désinscription
|
||||
curriculumch=changement de cursus
|
||||
filer=Filtre :
|
||||
approval=Approbation :
|
||||
teacherapproval=Approbation d'un prof :
|
||||
surreq=Etes vous sur de vouloir accepter cette demande ?
|
||||
validate=Valider
|
||||
amount=Montant
|
||||
role=Role
|
||||
manageextcur=Gérer les formations
|
||||
managecourse=Gérer les cours
|
||||
manageminerval=Gérer le minerval
|
||||
enterreason=Veuillez entrer la raison de votre départ
|
||||
onlycursus=Je veux uniquement me désinscrire d'un seul cursus
|
||||
plsselectcurs=Veuillez sélectionner ce cursus
|
||||
sureunreg=Etes-vous sur de vouloir vous désinscrire ?
|
||||
no=Non
|
||||
yes=Oui
|
||||
reqsend=Votre requête a été envoyée !
|
||||
payment=Payement
|
||||
lefttopay=restants a payer
|
||||
paydeposit=Payer l'acompte
|
||||
payrest=Payer le reste
|
||||
alreadypaid=Payement : les frais ont déja été payés cette année
|
||||
askscholarship=Demander une bourse
|
||||
uploaddocs=Veuillez soumettre les documents requis
|
||||
taxjustdoc=Justificatif d'impôts :
|
||||
residencydoc=Justificatif de résidence :
|
||||
reqsent=Votre requête a été envoyée au service d'inscription.
|
||||
backprofile=Retour au profil
|
||||
procpayment=Procéder au payement de
|
||||
procpaybutton=Procéder au payement
|
||||
rereg=Me réinscrire dans l'année supérieure
|
||||
reregsup=M'inscrire dans un cursus supplémentaire
|
||||
chcur=Changer d'un cursus vers un autre
|
||||
iwouldlike=Je voudrais :
|
||||
newcurr=Nouveau cursus
|
||||
cursusprereq=Le cursus que vous avez selectionné a des prérequis assurez vous que votre dossier de parcours est a jour dans votre profil
|
||||
imposecurriculum=Imposer un cursusgotimposed
|
||||
impose=Imposer
|
||||
gotimposed=Le cursus selectionné a été imposé
|
||||
|
293
frontend/public/i18n/FR.txt.orig
Normal file
293
frontend/public/i18n/FR.txt.orig
Normal file
@ -0,0 +1,293 @@
|
||||
login.guest.signin=SE CONNECTER
|
||||
login.guest.register=S'enregistrer
|
||||
login.guest.alregister=Déjà Enregistré
|
||||
login.guest.welcome=BIENVENUE A L'UNIVERSITE
|
||||
login.guest.email=E-MAIL
|
||||
login.guest.firstname=PRENOM
|
||||
login.guest.surname=NOM
|
||||
login.guest.country=PAYS
|
||||
login.guest.address=ADRESSE
|
||||
login.guest.password=MOT DE PASSE
|
||||
login.guest.nextpage=Prochaine Page
|
||||
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
|
||||
app.login=Se connecter
|
||||
app.notifications=Notifications
|
||||
app.settings=Options
|
||||
app.messages=Messages
|
||||
app.forum=Forum
|
||||
app.schedules=Horaires
|
||||
app.manageSchedules=Gérer les horaires
|
||||
app.inscription.requests=Demandes d'Inscription
|
||||
app.manage.courses=Gérer les cours
|
||||
app.language=Langue
|
||||
app.manage.profile=Gérer le profil
|
||||
app.studentList=Liste des étudiants
|
||||
app.users=Utilisateurs
|
||||
<<<<<<< HEAD
|
||||
app.manage.researcherProfile= gérer son profil de chercheur
|
||||
app.list.researches=Lister les recherches
|
||||
app.Create.User=créer un utilisateur
|
||||
=======
|
||||
app.manageOwnLessons=Gérer ses horaires de cours
|
||||
app.lessonRequests=Requêtes d'horaire
|
||||
app.payments=Payements
|
||||
>>>>>>> origin/master
|
||||
request.moreInfos=Plus d'Infos
|
||||
request.accept=Accepter
|
||||
request.refuse=Refuser
|
||||
Pending=En attente
|
||||
Delete=Supprimer
|
||||
Modify=Modifier
|
||||
Create=Créer
|
||||
requestType=Type de Requête
|
||||
day=Jour
|
||||
start=Début
|
||||
end=Fin
|
||||
monday=Lundi
|
||||
tuesday=Mardi
|
||||
wednesday=Mercredi
|
||||
thursday=Jeudi
|
||||
friday=Vendredi
|
||||
saturday=Samedi
|
||||
sunday=Dimanche
|
||||
january=Janvier
|
||||
february=Février
|
||||
march=Mars
|
||||
april=Avril
|
||||
may=Mai
|
||||
june=Juin
|
||||
july=Juillet
|
||||
august=Août
|
||||
september=Septembre
|
||||
october=Octobre
|
||||
november=Novembre
|
||||
december=Decembre
|
||||
Grid=Grille
|
||||
Week=Semaine
|
||||
Month=Mois
|
||||
List=Liste
|
||||
Type=Type
|
||||
Teacher=Professeur
|
||||
Course=Cours
|
||||
TP=TP
|
||||
TD=TD
|
||||
Exam=Exam
|
||||
OwnSchedule=Mon Horaire
|
||||
SwitchToJSON=Afficher le JSON
|
||||
schedule.previous=Précédent
|
||||
schedule.next=Prochain
|
||||
schedule.current=Actuel
|
||||
schedule.settings=Options
|
||||
schedule.courses=Cours
|
||||
schedule.teachers=Professeurs(s)
|
||||
schedule.askChanges=Demander Changement
|
||||
schedule.askCreate=Demander de créer un cours
|
||||
schedule.askDeletion=Demander suppression
|
||||
schedule.createSchedule=Créer Horaire
|
||||
schedule.createLesson=Créer cours
|
||||
schedule.deleteMod=Activer suppression
|
||||
schedule.noDeleteMod=Désactiver suppression
|
||||
schedule=Horaire
|
||||
old_day=Ancien Jour
|
||||
old_start=Ancien Début
|
||||
old_end=Ancienne Fin
|
||||
old_type=Ancien Type
|
||||
courses.createCourse=Créer un cours
|
||||
courses.deleteCourse=Supprimer un cours
|
||||
courses.modify=Modifier
|
||||
courses.toDelete=Cours à supprimer
|
||||
courses.confirm=Confirmer
|
||||
courses.back=Retour
|
||||
courses.AddToCurriculum=Ajouter à un cursus
|
||||
profile.modify.data=Modifier données personnelles
|
||||
profile.reRegister=Réinsciption
|
||||
profile.unRegister=Désinscription
|
||||
profile.course.list=Liste des cours
|
||||
profile.address=Adresse
|
||||
profile.picture=Photo de profil
|
||||
profile.change.curriculum=Changer cursus
|
||||
name=Nom
|
||||
Teacher=Enseignant
|
||||
Student=Etudiant
|
||||
Secretary=Secrétaire
|
||||
Curriculum=Cursus
|
||||
Credits=Credits
|
||||
InscriptionService=S.I.
|
||||
faculty=Faculté
|
||||
<<<<<<< HEAD
|
||||
Year=Année
|
||||
Access=Accès
|
||||
Access.Restricted=Restreint
|
||||
Access.OpenSource=Libre
|
||||
Access.Private=Privé
|
||||
Language=Langue
|
||||
Month=Mois
|
||||
Month.01=janvier
|
||||
Month.02=fevrier
|
||||
Month.03=mars
|
||||
Month.04=avril
|
||||
Month.05=mai
|
||||
Month.06=juin
|
||||
Month.07=juillet
|
||||
Month.08=août
|
||||
Month.09=septembre
|
||||
Month.10=octobre
|
||||
Month.11=novembre
|
||||
Month.12=decembre
|
||||
Domain=Domaine
|
||||
PaperType=Type de recherche
|
||||
Submit=Envoyer
|
||||
Search.Researches=Chercher Par Recherche
|
||||
Search.Researchers=Chercher Par Chercheur
|
||||
Filters=Filtres
|
||||
Toggle.Researcher=Activer la recherche par chercheur
|
||||
Untoggle.Researcher=Désactiver la recherche par chercheur
|
||||
MoreInfo=Plus d'info
|
||||
Modify.Research=Modifer l'article
|
||||
To.Change.In.Options=À changer dans les options
|
||||
Modify.Data=Modifier
|
||||
Confirm.Changes=Confirmer les Changements
|
||||
Cancel.Changes=Abandonner les Changements
|
||||
Post.Research=Poster un nouvel article
|
||||
Summary=Résumé
|
||||
Title=Titre
|
||||
Views=Nombre de Vues
|
||||
See.Research=Ouvrir l'article
|
||||
SeeBibTex=Ouvrir le BibTex
|
||||
Author=Autheur
|
||||
CoAuthors=Co-Autheurs
|
||||
ReleaseDate=Date de Parution
|
||||
Article.Id=Id de l'article
|
||||
Delete.Research=Supprimer l'article
|
||||
Here=Ici
|
||||
Stat.Type=Type de Stat
|
||||
Researches=Recherches
|
||||
Please.Select.Option=Selectionnez des Options
|
||||
Class.By=Classifer Par
|
||||
PaperType.Article=Article
|
||||
PaperType.Book=Livre
|
||||
PaperType.Book.Chapter=Chapitre de Livre
|
||||
PaperType.Paper=Papier
|
||||
Research.Pdf=Pdf de la Recherche
|
||||
BibTex.Pdf=BibTex de la Recherche
|
||||
CoAuthors.List=Liste des Co-Autheurs
|
||||
Confirm.Publish=Confirmer la Publication
|
||||
Cancel.Publish=Annuler la Publication
|
||||
Years=Années
|
||||
Months=Mois
|
||||
By=par
|
||||
RegNo=Matricule
|
||||
Address=Adresse
|
||||
Country=Pays
|
||||
BirthDate=Date de Naissance
|
||||
Confirm=Confirmer
|
||||
Cancel=Annuler
|
||||
LastName=Nom de Famille
|
||||
FirstName=Prénom
|
||||
Profile.Picture=Photo de Profil
|
||||
Role=Role
|
||||
Password=Mot de Passe
|
||||
Create.User=Créer l'utilisateur
|
||||
=======
|
||||
msg.notification.new=Vous avez un nouveau message!
|
||||
forum.create=Créer un forum
|
||||
forum.create.name=Nom du forum
|
||||
forum.post.create.name=Titre du post
|
||||
firstname/name=Prénom/Nom
|
||||
regNo=Matricule
|
||||
From=De
|
||||
To=A
|
||||
WantedCursus=Cursus voulu
|
||||
seeprofile=Voir le profil
|
||||
acceptequiv=Accepter l'équivalence
|
||||
refuseequiv=Refuser l'équivalence
|
||||
course=cours
|
||||
state=état
|
||||
dljustifdoc=Télécharger le justificatif
|
||||
backtoreq=Retour a la requête
|
||||
dlidentitycard=Télécharger la carte d'identité
|
||||
dladmissiondoc=Télécharger le certificat d'admission
|
||||
seeextcur=Voir le parcours extérieur
|
||||
dltaxdoc=Télécharger le justificatif d'impot
|
||||
dlresidency=Télécharger le justificatif de résidence
|
||||
enteramount=Veuillez entrer le montant alloué :
|
||||
oldcursus=Anciens cursus
|
||||
newcursus=Nouveaux cursus
|
||||
year=Année
|
||||
reason=Raison :
|
||||
selectedcursus=Cursus selectionné :
|
||||
askexemp=Demander une dispense
|
||||
exemp=Dispensé
|
||||
uploadjustifdoc=Veuillez soumettre le justificatif
|
||||
subexemreq=Envoyer la demande de dispense
|
||||
addextcurr=Ajouter une formation
|
||||
dldoc=Télécharger le document
|
||||
edit=Modifier
|
||||
delete=Supprimer
|
||||
school=Ecole
|
||||
checkifnotcompleted=Cochez la case si vous n'avez terminé cette formation
|
||||
wichyearstop=En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?
|
||||
startyear=Année de début
|
||||
endyear=Année de fin
|
||||
giveextcurdoc=Veuillez soumettre un document attestant de ce parcours
|
||||
uploadcurr=Ajouter la formation
|
||||
editcurr=Modifier la formation
|
||||
reqtype=Type de requête :
|
||||
inscription=inscription
|
||||
scholarship=bourse
|
||||
exemption=dispense
|
||||
unregister=désinscription
|
||||
curriculumch=changement de cursus
|
||||
filer=Filtre :
|
||||
approval=Approbation :
|
||||
teacherapproval=Approbation d'un prof :
|
||||
surreq=Etes vous sur de vouloir accepter cette demande ?
|
||||
validate=Valider
|
||||
amount=Montant
|
||||
role=Role
|
||||
manageextcur=Gérer les formations
|
||||
managecourse=Gérer les cours
|
||||
manageminerval=Gérer le minerval
|
||||
enterreason=Veuillez entrer la raison de votre départ
|
||||
onlycursus=Je veux uniquement me désinscrire d'un seul cursus
|
||||
plsselectcurs=Veuillez sélectionner ce cursus
|
||||
sureunreg=Etes-vous sur de vouloir vous désinscrire ?
|
||||
no=Non
|
||||
yes=Oui
|
||||
reqsend=Votre requête a été envoyée !
|
||||
payment=Payement
|
||||
lefttopay=restants a payer
|
||||
paydeposit=Payer l'acompte
|
||||
payrest=Payer le reste
|
||||
alreadypaid=Payement : les frais ont déja été payés cette année
|
||||
askscholarship=Demander une bourse
|
||||
uploaddocs=Veuillez soumettre les documents requis
|
||||
taxjustdoc=Justificatif d'impôts :
|
||||
residencydoc=Justificatif de résidence :
|
||||
reqsent=Votre requête a été envoyée au service d'inscription.
|
||||
backprofile=Retour au profil
|
||||
procpayment=Procéder au payement de
|
||||
procpaybutton=Procéder au payement
|
||||
rereg=Me réinscrire dans l'année supérieure
|
||||
reregsup=M'inscrire dans un cursus supplémentaire
|
||||
chcur=Changer d'un cursus vers un autre
|
||||
iwouldlike=Je voudrais :
|
||||
newcurr=Nouveau cursus
|
||||
cursusprereq=Le cursus que vous avez selectionné a des prérequis assurez vous que votre dossier de parcours est a jour dans votre profil
|
||||
imposecurriculum=Imposer un cursusgotimposed
|
||||
impose=Imposer
|
||||
gotimposed=Le cursus selectionné a été imposé
|
||||
>>>>>>> origin/master
|
@ -3,6 +3,7 @@
|
||||
import { ref } from 'vue'
|
||||
import i18n, { setLang } from './i18n.js'
|
||||
import { isLogged } from '@/rest/Users.js'
|
||||
import { notifications, fetchNotifications, archiveNotification } from '@/rest/notifications.js'
|
||||
|
||||
import { appList, currentView } from '@/rest/apps.js'
|
||||
var prevURL;
|
||||
@ -14,17 +15,20 @@ window.onhashchange = function() {
|
||||
}
|
||||
const Logged = ref(isLogged());
|
||||
|
||||
if(Logged.value){
|
||||
fetchNotifications();
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
if((location.hash === "#/home" && prevURL === "#/login") || (location.hash === "#/home" && prevURL === "#/profil")){
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
const home=ref(i18n("app.home"))
|
||||
const notifications=ref(i18n("app.notifications"))
|
||||
const settings=ref(i18n("app.settings"))
|
||||
const login=ref(i18n("app.login"))
|
||||
const active=ref(false)
|
||||
|
||||
const notification = ref(false)
|
||||
|
||||
const apps = ref([])
|
||||
appList().then(e => apps.value = e)
|
||||
@ -33,7 +37,6 @@ window.addEventListener('hashchange', () => {
|
||||
|
||||
<template>
|
||||
<div class="container">
|
||||
|
||||
<div class="topBar">
|
||||
<ul class="horizontal">
|
||||
<li title=home>
|
||||
@ -46,14 +49,17 @@ window.addEventListener('hashchange', () => {
|
||||
</a></li>
|
||||
<li style="float: right;" title=login>
|
||||
<a class="icon" href="#/login">
|
||||
<div class="fa-solid fa-user" :style="Logged ? 'color: orange' : 'haha'" style="margin-top: 7px; margin-bottom: 3px; "></div>
|
||||
<div class="fa-solid fa-user" :style="Logged ? 'color: red' : ''" style="margin-top: 7px; margin-bottom: 3px; "></div>
|
||||
</a></li>
|
||||
<li style="float: right;" title=notifications>
|
||||
<a class="icon" href="#Notifications">
|
||||
<div class="fa-solid fa-bell" style="margin-top: 7px; margin-bottom: 3px;"></div>
|
||||
<li style="float: right;" title=notifications @click="notification = !notification">
|
||||
<a class="icon">
|
||||
<div class="fa-solid fa-bell" :style="notifications.length != 0 ? 'color:orange': '' " style="margin-top: 7px; margin-bottom: 3px;"></div>
|
||||
<ul v-if=notification id="notification">
|
||||
<li v-for="notif in notifications" @click="archiveNotification(notif.id)"> {{ i18n(notif.subject) }} - {{ notif.body }}</li>
|
||||
</ul>
|
||||
</a></li>
|
||||
<li @click="active=!active" class="option"style="float: right;" title=settings>
|
||||
<a class="icon" >
|
||||
<a class="icon">
|
||||
<div class="fa-solid fa-gear" style="margin-top: 7px; margin-bottom: 3px;"></div>
|
||||
<div v-if="active" class="dropdown">
|
||||
<div class="dropdown-content">{{i18n("app.language")}}</div>
|
||||
@ -69,7 +75,6 @@ window.addEventListener('hashchange', () => {
|
||||
{{i18n("app.manage.profile")}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</a></li>
|
||||
</ul>
|
||||
@ -99,20 +104,19 @@ 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]61px[firstRow-end secondRow-start] auto [endRow];
|
||||
|
||||
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-areas:
|
||||
"topBar topBar"
|
||||
"leftBar page";
|
||||
row-gap:0px;
|
||||
column-gap:0px;
|
||||
|
||||
}
|
||||
|
||||
.page {
|
||||
grid-area:page;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
place-self:center;
|
||||
}
|
||||
|
||||
.topBar{
|
||||
@ -155,7 +159,7 @@ window.addEventListener('hashchange', () => {
|
||||
|
||||
ul.vertical{
|
||||
list-style-type: none;
|
||||
margin-top: 61px;
|
||||
margin-top: var(--header-size);
|
||||
top:0;
|
||||
left:0;
|
||||
padding: 25px 0 0;
|
||||
@ -203,7 +207,7 @@ window.addEventListener('hashchange', () => {
|
||||
left:0;
|
||||
|
||||
position: fixed;
|
||||
height:61px;
|
||||
height:var(--header-size);
|
||||
width: 100%;
|
||||
background-color: rgb(24, 24, 24);
|
||||
}
|
||||
@ -219,8 +223,6 @@ window.addEventListener('hashchange', () => {
|
||||
background-color: black;
|
||||
border-radius:6px;
|
||||
color:white;
|
||||
transform: translate(0px ,1px);
|
||||
|
||||
}
|
||||
|
||||
ul.vertical:hover {
|
||||
@ -235,6 +237,7 @@ window.addEventListener('hashchange', () => {
|
||||
.text {
|
||||
right: 0%;
|
||||
width: 0%;
|
||||
visibility: collapse;
|
||||
opacity: 0;
|
||||
color: white;
|
||||
font-size: 1.2em;
|
||||
@ -243,7 +246,8 @@ window.addEventListener('hashchange', () => {
|
||||
}
|
||||
|
||||
ul.vertical:hover .text {
|
||||
opacity: 1;
|
||||
opacity:1;
|
||||
visibility:visible;
|
||||
width: 60%;
|
||||
transition-duration: .3s;
|
||||
padding-left: 15px;
|
||||
@ -253,6 +257,32 @@ window.addEventListener('hashchange', () => {
|
||||
content: url("./assets/angry_clyde.png")
|
||||
}
|
||||
|
||||
#notification{
|
||||
position: absolute;
|
||||
top: 61px;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
width: 300px;
|
||||
height: 600px;
|
||||
border-radius: 10px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#notification > li{
|
||||
color: black;
|
||||
list-style: none;
|
||||
font-size: 0.4em;
|
||||
display: block;
|
||||
background-color: #00FF00A0;
|
||||
margin: 1px;
|
||||
border-radius: 42px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#notification > li:hover{
|
||||
background-color: #00FF0000
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<!-- vim:set noet sts=0 sw=4 ts=2: -->
|
||||
|
215
frontend/src/Apps/Forums.vue
Normal file
215
frontend/src/Apps/Forums.vue
Normal file
@ -0,0 +1,215 @@
|
||||
<!----------------------------------------------------
|
||||
File: Forums.vue
|
||||
Author: Anthony Debucquoy
|
||||
Scope: Extension messagerie
|
||||
Description: Forum des étudiants
|
||||
----------------------------------------------------->
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
import { getCourses, getUserActualCourses } from '@/rest/courses.js'
|
||||
import { ForumsOfCurrentCourse, getForumsOfCourse, createForum } from '@/rest/forum.js'
|
||||
import { PostsOfCurrentForum, getPostsOfForum, createPost } from '@/rest/forum.js'
|
||||
import { fetchedPost, fetchPost, sendAnswer } from '@/rest/forum.js'
|
||||
import { getSelf } from '@/rest/Users.js'
|
||||
|
||||
const Role = (await getSelf()).role;
|
||||
const courses = Role === 'Admin' || Role === 'Secretary' || Role === 'Teacher' ? await reactive(getCourses(Role)) : await reactive(getUserActualCourses());
|
||||
const selectedCourse = ref();
|
||||
const selectedForum = ref();
|
||||
|
||||
const addForumName = ref("");
|
||||
const addPost = ref(false);
|
||||
const addPostSubject = ref("");
|
||||
const addPostContent = ref("");
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="app">
|
||||
<div id="ForumSelector">
|
||||
<select id="cours" value="" v-model="selectedCourse" @change="getForumsOfCourse(selectedCourse)">
|
||||
<option v-for="course in courses" :value="course.courseID">{{course.title}}</option>
|
||||
</select>
|
||||
|
||||
<select id="forum" value="" v-model="selectedForum" @change="getPostsOfForum(selectedForum !== 'create' ? selectedForum : null)" v-if="ForumsOfCurrentCourse != null">
|
||||
<option v-for="forum in ForumsOfCurrentCourse" :value=forum.id>{{forum.name}}</option>
|
||||
<option v-if="(Role === 'Admin' || Role === 'Teacher') && ForumsOfCurrentCourse != null" value="create">{{ i18n("forum.create") }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="PostSelector" v-if="PostsOfCurrentForum != null">
|
||||
<div @click="fetchPost(post.id)" class="postItem" v-for="post in PostsOfCurrentForum" :key="post.id">{{ post.subject }}</div>
|
||||
<button v-if="Role === 'Admin' || Role === 'Teacher' " id="createPost" @click="addPost = true">+</button>
|
||||
</div>
|
||||
<div id="PostViewer" v-if="fetchedPost != null">
|
||||
<div id="Post">
|
||||
<h1>{{ fetchedPost.subject }}</h1>
|
||||
{{fetchedPost.content}}
|
||||
</div>
|
||||
<div id="Messages">
|
||||
<p v-for="msg in fetchedPost.answers">{{msg.author.firtName}} {{msg.author.lastName}} - {{msg.content}}</p>
|
||||
<input v-if=!fetchedPost.locked type="text" placeholder="response" @keyup.enter="sendAnswer(fetchedPost.id, $event.target.value); $event.target.value = ''"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=popup v-if="selectedForum === 'create' || addPost" @click.self="selectedForum = ''; addPost = false" >
|
||||
|
||||
<!-- Popup to add forum -->
|
||||
<div id="addForumForm" v-if="selectedForum === 'create'" @keyup.enter="createForum(selectedCourse, addForumName); selectedForum = '';">
|
||||
<label>{{ i18n("forum.create.name") }}</label>
|
||||
<input type="text" placeholder="Name" v-model=addForumName />
|
||||
</div>
|
||||
|
||||
<!-- Popup to add Post -->
|
||||
<div id="addPostForm" v-if=addPost>
|
||||
<label>{{ i18n("forum.post.create.name") }}</label>
|
||||
<input type="text" placeholder="subject" v-model=addPostSubject @keyup.enter="createPost(selectedForum, addPostSubject, addPostContent); addPost = false;"/>
|
||||
<textarea v-model="addPostContent" placeholder=content></textarea>
|
||||
<input type="submit" value="send" @click="createPost(selectedForum, addPostSubject, addPostContent); addPost = false;">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.popup{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #00000022;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
#addForumForm{
|
||||
position: relative;
|
||||
width: 30%;
|
||||
left: calc(50% - 30% / 2);
|
||||
top: calc(50% - 10% / 2);
|
||||
border-radius: 10px;
|
||||
height: 10%;
|
||||
background-color: white;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#addPostForm{
|
||||
position: relative;
|
||||
width: 30%;
|
||||
left: calc(50% - 30% / 2);
|
||||
top: calc(50% - 50% / 2);
|
||||
border-radius: 10px;
|
||||
height: 50%;
|
||||
background-color: white;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#app{
|
||||
display: grid;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
grid-template: 5em auto / 25% 75%;
|
||||
}
|
||||
|
||||
#ForumSelector{
|
||||
background-color: #FFFFFF0E;
|
||||
grid-column: 1 / 3;
|
||||
border-radius: 100px;
|
||||
margin: 10px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
#ForumSelector select{
|
||||
background-color: #ffa000;
|
||||
border: none;
|
||||
margin: 10px;
|
||||
border-radius: 10px;
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#PostSelector button{
|
||||
background-color: green;
|
||||
color: white;
|
||||
border: none;
|
||||
height: 4vh;
|
||||
margin: 5px;
|
||||
border-radius: 0 30px 30px 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#PostSelector{
|
||||
background-color: #FFFFFF0E;
|
||||
border-radius: 0 25px 25px 0;
|
||||
margin: 10px 0 10px 10px;
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
|
||||
.postItem{
|
||||
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;
|
||||
}
|
||||
|
||||
.postItem:hover{
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
#PostViewer{
|
||||
background-color: #FFFFFF0E;
|
||||
border-radius: 25px;
|
||||
margin: 10px;
|
||||
|
||||
max-height: 100%;
|
||||
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#Post{
|
||||
padding: 25px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#Post > h1{
|
||||
text-align: center;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#Messages{
|
||||
padding: 25px;
|
||||
border-top: 3px dotted white;
|
||||
|
||||
}
|
||||
|
||||
#Messages > p {
|
||||
|
||||
background-color: orange;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
121
frontend/src/Apps/Inscription/AboutChangeCurriculum.vue
Normal file
121
frontend/src/Apps/Inscription/AboutChangeCurriculum.vue
Normal file
@ -0,0 +1,121 @@
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
editChangeCurrReq, editChangeCurrReqTeacherState,
|
||||
getChangeCurrReqById,
|
||||
} from "@/rest/requests.js";
|
||||
import i18n from "@/i18n.js";
|
||||
import {getSelf} from "@/rest/Users.js";
|
||||
import {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";
|
||||
}
|
||||
|
||||
.globalInfos {
|
||||
grid-area:globalInfos;
|
||||
align-self :center;
|
||||
|
||||
}
|
||||
|
||||
.body {
|
||||
min-width:960px;
|
||||
width:100%;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
margin-top:7%;
|
||||
}
|
||||
|
||||
.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>
|
108
frontend/src/Apps/Inscription/AboutExemption.vue
Normal file
108
frontend/src/Apps/Inscription/AboutExemption.vue
Normal file
@ -0,0 +1,108 @@
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
editExempReqState,
|
||||
getExempReq,
|
||||
} from "@/rest/requests.js";
|
||||
import i18n from "@/i18n.js";
|
||||
import {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><a :href="req.justifDocument">{{ i18n("dljustifdoc") }}</a></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";
|
||||
}
|
||||
|
||||
.globalInfos {
|
||||
grid-area:globalInfos;
|
||||
align-self :center;
|
||||
|
||||
}
|
||||
|
||||
.body {
|
||||
min-width:960px;
|
||||
width:100%;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
margin-top:7%;
|
||||
}
|
||||
|
||||
.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,21 +1,26 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {getSelf, getUser} from '../../rest/Users.js'
|
||||
import {getcurriculum,getSomeonesCurriculumList} from "@/rest/curriculum.js";
|
||||
import {getSelf} from '../../rest/Users.js'
|
||||
import {getAllCurriculums, 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";
|
||||
import {editEquivalenceState, imposeCurriculum} from "@/rest/requests.js";
|
||||
|
||||
const curriculums = await getAllCurriculums()
|
||||
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)
|
||||
const impose = ref(false)
|
||||
const imposeCurr = ref(0)
|
||||
const imposed = ref(false)
|
||||
|
||||
//Get the parent page windowState to display the correct button
|
||||
const windowState = defineModel("windowState")
|
||||
function getPP(){
|
||||
if(request.profilePictureUrl === null){
|
||||
return "/Clyde.png"
|
||||
@ -26,10 +31,14 @@ function getPP(){
|
||||
async function editEquivalence(id, newstate){
|
||||
await editEquivalenceState(id, newstate)
|
||||
}
|
||||
|
||||
async function refreshCursus(){
|
||||
cursus.value = await getcurriculum(request.curriculum)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="body" v-if="list == false">
|
||||
<div class="body" v-if="list == false" style="margin-top: 10%;">
|
||||
<div class="container">
|
||||
<div class="profilPic">
|
||||
<img class="subContainter" :src=getPP()>
|
||||
@ -37,36 +46,54 @@ async function editEquivalence(id, newstate){
|
||||
<div class = "globalInfos">
|
||||
<div class="infosContainer">
|
||||
<div>
|
||||
FirstName/Name : {{request.firstName}} {{request.lastName}}
|
||||
{{ i18n("firstname/name") }} : {{request.firstName}} {{request.lastName}}
|
||||
</div>
|
||||
<div>
|
||||
E-mail: {{request.email}}
|
||||
{{ i18n("login.guest.email") }}: {{request.email}}
|
||||
</div>
|
||||
<div>
|
||||
Adresse : {{request.address}}
|
||||
{{ i18n("login.guest.address") }} : {{request.address}}
|
||||
</div>
|
||||
<div>
|
||||
Pays : {{request.country}}
|
||||
{{ i18n("login.guest.country") }} : {{request.country}}
|
||||
</div>
|
||||
<div>
|
||||
Date de naissance : {{request.birthDate}}
|
||||
{{ i18n("login.guest.birthday") }} : {{request.birthDate.slice(0,10)}}
|
||||
</div>
|
||||
<div>
|
||||
Cursus voulu : BAB {{cursus.year}} {{cursus.option}}
|
||||
{{ i18n("WantedCursus") }} : BAB {{cursus.year}} {{cursus.option}}
|
||||
</div>
|
||||
<div v-if="cursus.year > 1">
|
||||
<button style="background-color:rgb(105,05,105);margin-left: 5%" @click="list=!list" v-if="(user.role == 'Teacher' || user.role == 'Admin')&& request.equivalenceState == 'Pending'">See external curriculums</button>
|
||||
<div style="margin-top: 3%">
|
||||
<button><a :href="request.identityCard">{{ i18n("dlidentitycard") }}</a></button>
|
||||
<button style="margin-left: 3%" v-if="request.admissionDocUrl != null"><a :href="request.admissionDocUrl">{{ i18n("dladmissiondoc") }}</a></button>
|
||||
</div>
|
||||
<div>
|
||||
<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" :inscr-req-id="request.id"></ExternalCurriculumList>
|
||||
<ExternalCurriculumList :ext-curr-list="externalCurriculum" :mode="0"></ExternalCurriculumList>
|
||||
<div style="margin-left: 15%;margin-top: 5%;">
|
||||
<button style="margin-left: 2%" @click="list = false;editEquivalence(request.id, 'Accepted'); request.equivalenceState='Accepted'">Accept Equivalence</button>
|
||||
<button style="margin-left: 2%" @click="list = false;editEquivalence(request.id, 'Refused'); request.equivalenceState='Refused'">Refuse Equivalence</button>
|
||||
<button style="margin-left: 2%" @click="list=false">Return to profile</button>
|
||||
<button style="margin-left: 2%" v-if="request.equivalenceState === 'Pending' && !impose" @click="list = false;editEquivalence(request.id, 'Accepted'); request.equivalenceState='Accepted'">{{i18n("acceptequiv")}}</button>
|
||||
<button style="margin-left: 2%;margin-right: 3%" v-if="request.equivalenceState === 'Pending' && !impose" @click="list = false;editEquivalence(request.id, 'Refused'); request.equivalenceState='Refused'">{{i18n("refuseequiv")}}</button>
|
||||
<div v-if="!imposed && request.equivalenceState !== 'Accepted'" style="margin-top: 3%;margin-left: 1%">
|
||||
{{i18n("imposecurriculum")}}
|
||||
<input type="checkbox" v-model="impose" v-if="!imposed">
|
||||
<select v-if="impose" v-model="imposeCurr">
|
||||
<option v-for="item in curriculums" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<button v-if="impose && !imposed" style="margin-left: 2%" @click="imposeCurriculum(request.id, imposeCurr);request.equivalenceState='Accepted';imposed=true;">{{ i18n("impose") }}</button>
|
||||
<div v-if="imposed">
|
||||
{{ i18n("gotimposed") }}
|
||||
</div>
|
||||
<button style="margin-left: 2%" @click="list=false;refreshCursus()">{{ i18n("courses.back") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -123,10 +150,10 @@ async function editEquivalence(id, newstate){
|
||||
}
|
||||
|
||||
button{
|
||||
font-size:15px;
|
||||
height:50px;
|
||||
width:100px;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
background-color:rgb(239, 60, 168);
|
||||
border-radius:10px;
|
||||
height:35px;
|
||||
margin-top:10px;
|
||||
}
|
||||
</style>
|
131
frontend/src/Apps/Inscription/AboutScholarship.vue
Normal file
131
frontend/src/Apps/Inscription/AboutScholarship.vue
Normal file
@ -0,0 +1,131 @@
|
||||
<script setup>
|
||||
|
||||
import {editScholarshipReq, getScholarshipReqById} from "@/rest/requests.js";
|
||||
import i18n from "@/i18n.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><a :href="req.taxDocUrl">{{ i18n("dltaxdoc") }}</a></button>
|
||||
<button style="margin-left: 2%"><a :href="req.residencyDocUrl">{{ i18n("dlresidency") }}</a></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,6 +1,6 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {getUser} from '../../rest/Users.js'
|
||||
import {getSelf, getUser} from '../../rest/Users.js'
|
||||
import {getSomeonesCurriculumList} from "@/rest/curriculum.js";
|
||||
import {ref} from "vue";
|
||||
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
|
||||
@ -12,23 +12,13 @@
|
||||
const externalcurrlist = await getExternalCurriculumByUser(user.regNo)
|
||||
const extercurrlist = ref(false)
|
||||
|
||||
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>
|
||||
@ -40,47 +30,50 @@
|
||||
<div class = "globalInfos">
|
||||
<div class="infosContainer">
|
||||
<div>
|
||||
FirstName/Name : {{user.firstName}} {{user.lastName}}
|
||||
{{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
|
||||
</div>
|
||||
<div>
|
||||
E-mail: {{user.email}}
|
||||
{{ i18n("login.guest.email") }}: {{user.email}}
|
||||
</div>
|
||||
<div>
|
||||
Adresse : {{user.address}}
|
||||
{{ i18n("login.guest.address") }} : {{user.address}}
|
||||
</div>
|
||||
<div>
|
||||
Pays : {{user.country}}
|
||||
{{ i18n("login.guest.country") }} : {{user.country}}
|
||||
</div>
|
||||
<div>
|
||||
Date de naissance : {{user.birthDate}}
|
||||
{{ i18n("login.guest.birthday") }} : {{user.birthDate}}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="extercurrlist=!extercurrlist">See external curriculums</button>
|
||||
<button v-if="watchingUser.role === 'Admin' || watchingUser.role === 'InscriptionService' || watchingUser.role === 'Secretary' || watchingUser.regNo === user.regNo"><a :href="user.identityCard">{{i18n("dlidentitycard")}}</a></button>
|
||||
</div>
|
||||
<div>
|
||||
<button @click="extercurrlist=!extercurrlist">{{i18n("seeextcur")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="moreInfos">
|
||||
<div class="moreInfos" style="margin-top: 15%">
|
||||
<div class = "oldcursus">
|
||||
<div class="listTitle">
|
||||
Anciens Cursus
|
||||
{{ i18n("oldcursus") }}
|
||||
</div>
|
||||
<div class="listElement">
|
||||
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList">
|
||||
<div class="year" v-if="parseInt(item.dateyear) !== getYear()">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="parseInt(item.dateyear) !== getYear()">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="parseInt(item.dateyear) !== getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
<div class="year" v-if="item.actual === false">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="item.actual === false">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="item.actual === false">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="newcursus">
|
||||
<div class="listTitle">
|
||||
Cursus Actuel
|
||||
{{ i18n("newcursus") }}
|
||||
</div>
|
||||
<div class="listElement">
|
||||
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList" >
|
||||
<div class="year" v-if="parseInt(item.dateyear) === getYear()">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="parseInt(item.dateyear) === getYear()">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="parseInt(item.dateyear) === getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
<div class="year" v-if="item.actual === true">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="item.actual === true">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="item.actual === true">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -88,12 +81,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="extercurrlist==true">
|
||||
<ExternalCurriculumList :ext-curr-list="externalcurrlist"></ExternalCurriculumList>
|
||||
<ExternalCurriculumList :ext-curr-list="externalcurrlist" :mode="1"></ExternalCurriculumList>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
|
||||
.container{
|
||||
min-width:675px;
|
||||
display:grid;
|
||||
@ -102,8 +96,7 @@
|
||||
column-gap:2.7%;
|
||||
row-gap:45px;
|
||||
grid-template-areas:
|
||||
"profilPic globalInfos"
|
||||
"minfos minfos";
|
||||
"profilPic globalInfos";
|
||||
}
|
||||
|
||||
.profilPic{
|
||||
@ -143,12 +136,10 @@
|
||||
}
|
||||
|
||||
.moreInfos {
|
||||
display:grid;
|
||||
grid-template-rows:200px auto;
|
||||
display:inline-grid;
|
||||
column-gap:50px;
|
||||
row-gap:45px;
|
||||
grid-template-areas:
|
||||
"minfos minfos";
|
||||
"oldcursus newcursus";
|
||||
grid-template-columns:600px 600px;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
@ -189,4 +180,12 @@
|
||||
column-gap:40px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
button{
|
||||
border:none;
|
||||
background-color:rgb(239, 60, 168);
|
||||
border-radius:10px;
|
||||
height:35px;
|
||||
margin-top:10px;
|
||||
}
|
||||
</style>
|
85
frontend/src/Apps/Inscription/AboutUnregister.vue
Normal file
85
frontend/src/Apps/Inscription/AboutUnregister.vue
Normal file
@ -0,0 +1,85 @@
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
editUnregReq,
|
||||
getUnregisterbyId
|
||||
} from "@/rest/requests.js";
|
||||
import i18n from "@/i18n.js";
|
||||
import {ref} from "vue";
|
||||
|
||||
const props = defineProps(["reqId"])
|
||||
const req = ref(await getUnregisterbyId(props.reqId))
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
.globalInfos {
|
||||
grid-area:globalInfos;
|
||||
align-self :center;
|
||||
}
|
||||
|
||||
.body {
|
||||
min-width:960px;
|
||||
width:100%;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
margin-top:7%;
|
||||
}
|
||||
|
||||
.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>
|
@ -2,16 +2,18 @@
|
||||
|
||||
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} from "@/rest/requests.js";
|
||||
import {uploadFile} 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 submitted = ref(false)
|
||||
const courseslist = ref(await getcurriculum(selectedCurriculum.value.curriculumId))
|
||||
const list = ref(true)
|
||||
|
||||
@ -30,11 +32,20 @@ const exemptReq = reactive({
|
||||
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>Selected Cursus : </span>
|
||||
<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>
|
||||
@ -45,19 +56,31 @@ const exemptReq = reactive({
|
||||
<div class="firstname">{{item.owner.firstName}}</div>
|
||||
<div class="lastname">{{item.owner.lastName}}</div>
|
||||
<div class="credits">credits : {{item.credits}}</div>
|
||||
<div class="askexemption"><button style="background-color:rgb(105,0,0);" @click="list= !list;exemptReq.courseId=item.courseId">Ask exemption</button></div>
|
||||
<div class="askexemption" v-if="!isExempted(item)"><button style="background-color:rgb(105,0,0);" @click="list= !list;exemptReq.courseId=item.courseID;">{{i18n("askexemp")}}</button></div>
|
||||
<div v-else class="askexemption" style="font-size: 50%">{{ i18n("exemp") }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button @click="windowState = 0">{{ i18n("courses.back")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Please upload the justification document for the exemption </p>
|
||||
<label class="browser">
|
||||
<input type="file" @change="ppData.value = $event.target.files" accept="image/*" ref="filepath">
|
||||
<div v-if="list === false" class="infosContainer">
|
||||
<p v-if="!submitted">{{ i18n("uploadjustifdoc") }} </p>
|
||||
<div>
|
||||
<label class="browser" v-if="!submitted">
|
||||
<input type="file" @change="ppData.value = $event.target.files" ref="filepath">
|
||||
</label>
|
||||
<button style="width:15%; margin-top: 5%;" @click="postExemptionRequest(ppData.value, 'JustificationDocument');">
|
||||
Submit exemption request
|
||||
</div>
|
||||
<button style="margin-top: 3%" v-if="!submitted" @click="postExemptionRequest(ppData.value, 'JustificationDocument');submitted=!submitted">
|
||||
{{ i18n("subexemreq") }}
|
||||
</button>
|
||||
<div v-if="submitted">
|
||||
{{i18n("reqsent")}}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="list === false">
|
||||
<button @click="list=!list;submitted=!submitted">{{ i18n("courses.back") }}</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -135,5 +158,15 @@ button{
|
||||
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,25 +1,133 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js";
|
||||
import {ref} from "vue";
|
||||
import {reactive, ref} from "vue";
|
||||
import {getSelf} from "@/rest/Users.js";
|
||||
import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
|
||||
import {uploadFile} from "@/rest/uploads.js";
|
||||
|
||||
const props = defineProps(["extCurrList"])
|
||||
//mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user, 2 inscription procedure
|
||||
const props = defineProps(["extCurrList", "mode"])
|
||||
|
||||
const extCurrList = ref(props.extCurrList)
|
||||
console.log(extCurrList)
|
||||
//Only usefull to pass the external curr array in the inscription procedure
|
||||
const externalCurrTab = defineModel();
|
||||
|
||||
const extCurrList = ref({})
|
||||
let extNum = 0
|
||||
const User = ref({})
|
||||
|
||||
if (props.mode === 1){
|
||||
User.value = await getSelf()
|
||||
}
|
||||
|
||||
|
||||
const 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 : "",
|
||||
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
|
||||
}
|
||||
|
||||
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 style="display:flex; justify-content:center; " v-for="item 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>Download document</button></div>
|
||||
<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" v-if="props.mode!==2"><button><a :href="item.justifdocUrl">{{ i18n("dldoc") }}</a></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>
|
||||
@ -28,9 +136,9 @@
|
||||
height:100px;
|
||||
font-size:30px;
|
||||
display:grid;
|
||||
grid-template-columns:15% 10% 20% 15% 13.1%;
|
||||
grid-template-columns:5% 10% 20% 15% 20% 10%;
|
||||
grid-template-areas:
|
||||
"status school formation completion download";
|
||||
"status school formation completion download edit delete";
|
||||
column-gap:10px;
|
||||
}
|
||||
|
||||
@ -40,6 +148,15 @@
|
||||
font-size: 70%;
|
||||
}
|
||||
|
||||
.edit{
|
||||
grid-area: edit;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.delete{
|
||||
grid-area: delete;
|
||||
align-self: center;
|
||||
}
|
||||
.school{
|
||||
grid-area:school;
|
||||
align-self:center;
|
||||
@ -61,18 +178,12 @@
|
||||
font-size: 70%;
|
||||
}
|
||||
|
||||
|
||||
.download{
|
||||
grid-area: download;
|
||||
align-self:center;
|
||||
}
|
||||
button{
|
||||
font-size:15px;
|
||||
height:50px;
|
||||
width:75%;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
|
||||
}
|
||||
|
||||
.bodu {
|
||||
margin-top:2%;
|
||||
@ -82,6 +193,49 @@ button{
|
||||
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,18 +1,28 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {ref} from 'vue'
|
||||
import {ref, watch} from 'vue'
|
||||
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
|
||||
import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
|
||||
import {getAllExemptionsRequest, getAllScholarShipsRequest} from "@/rest/requests.js";
|
||||
import {
|
||||
getAllChangeCurrReq,
|
||||
getAllExemptionsRequest,
|
||||
getAllScholarShipsRequest,
|
||||
getAllUnregisters
|
||||
} from "@/rest/requests.js";
|
||||
import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue";
|
||||
import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue";
|
||||
import AboutChangeCurriculum from "@/Apps/Inscription/AboutChangeCurriculum.vue";
|
||||
import AboutExemption from "@/Apps/Inscription/AboutExemption.vue";
|
||||
import {getSelf} from "@/rest/Users.js";
|
||||
|
||||
const requests = ref(await getAllRegisters());
|
||||
let targetId = "";
|
||||
|
||||
const requestType = ref("inscription");
|
||||
const user = await getSelf()
|
||||
const requestType = ref(i18n("inscription"));
|
||||
const filterType = ref("None");
|
||||
|
||||
//0 = liste, 1 = détails, 2 = sure?
|
||||
let windowsState = ref(0);
|
||||
//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);
|
||||
@ -21,34 +31,50 @@
|
||||
}
|
||||
|
||||
async function loadRequests(){
|
||||
if (requestType.value === "inscription"){
|
||||
requests.value = await getAllRegisters();
|
||||
}
|
||||
if (requestType.value === "scholarship"){
|
||||
requests.value = await getAllScholarShipsRequest();
|
||||
}
|
||||
if(requestType.value === "exemption"){
|
||||
requests.value = await getAllExemptionsRequest();
|
||||
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"></AboutRequest>
|
||||
<AboutRequest :target="targetId" v-model:window-state="windowsState"></AboutRequest>
|
||||
</div>
|
||||
<div v-if="windowsState === 0">
|
||||
<div style="margin-top: 2%;margin-left: 2%">
|
||||
<span>Request type : </span>
|
||||
<span>{{ i18n("reqtype") }} : </span>
|
||||
<select v-model="requestType" @change="loadRequests()">
|
||||
<option>inscription</option>
|
||||
<option>scholarship</option>
|
||||
<option>exemption</option>
|
||||
<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%">
|
||||
Filter :
|
||||
{{ i18n("filter") }}
|
||||
<select v-model="filterType">
|
||||
<option>None</option>
|
||||
<option>Pending</option>
|
||||
@ -58,44 +84,75 @@
|
||||
</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">
|
||||
<div class="container" style="grid-template-columns:11% 15% 20% 10% 10% 9% 9%;grid-template-areas:'date state equivalencestate surname firstname accept refuse infos';" v-if="requestType === 'inscription'">
|
||||
<!--
|
||||
The condition below avoids an error occuring because loadRequests() finishes after the vue refresh
|
||||
then submissionDate is undefined an it triggers an error in the console despite the fact that it is working
|
||||
properly at the end.
|
||||
-->
|
||||
<div class="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%">Approval : {{item.state}}</div>
|
||||
<div class="equivalencestate" style="font-size: 80%">Teacher approval : {{item.equivalenceState}}</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="accept" v-if="item.state === 'Pending' && (user.role === 'Admin' || user.role === 'InscriptionService')"><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' && (user.role === 'Admin' || user.role === 'InscriptionService')"><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 === 'scholarship'">
|
||||
<div class="container" style="grid-template-columns:25% 15% 15% 25% 14.2%;grid-template-areas:'date reqState studentfirstname studentlastname infos';" v-if="requestType === i18n('scholarship')">
|
||||
<div class="date" v-if="item.date !== undefined"> {{item.date.slice(0,10)}}</div>
|
||||
<div class="studentfirstname">{{item.user.firstName}}</div>
|
||||
<div class="studentlastname">{{item.user.lastName}}</div>
|
||||
<div class="reqState">{{item.state}}</div>
|
||||
<div class="infos"><button>More infos</button></div>
|
||||
<div class="infos" @click="windowsState = 3; targetId=item.id;"><button>{{ i18n("request.moreInfos") }}</button></div>
|
||||
</div>
|
||||
<div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';"v-if="requestType === 'exemption'">
|
||||
<div class="container" v-if="requestType === i18n('unregister')" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';">
|
||||
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
|
||||
<div class="studentfirstname">{{item.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>More infos</button></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>Etes vous sur de vouloir accepter cette demande ?</p>
|
||||
<button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">Valider</button>
|
||||
<button style="background-color:rgb(105,05,105);" @click="windowsState=0;">Retour</button>
|
||||
<div class="infosContainer" style='margin-left:15%;display:flex; justify-content:center; width: 70%;margin-top: 10%' v-if="windowsState === 2">
|
||||
<p>{{ i18n("surreq") }}</p>
|
||||
<div style="margin-left: 10%; margin-top: 1.5%; width: 30%">
|
||||
<button style="background-color:rgb(105,05,105);margin-right: 2%" @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>
|
||||
<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>
|
||||
|
||||
@ -112,6 +169,11 @@
|
||||
grid-area: equivalencestate;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.teacherApproval{
|
||||
grid-area: teacherApproval;
|
||||
align-self: center;
|
||||
}
|
||||
.studentfirstname{
|
||||
grid-area: studentfirstname;
|
||||
align-self: center;
|
||||
@ -151,6 +213,10 @@
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.regno{
|
||||
grid-area: regno;
|
||||
align-self: center;
|
||||
}
|
||||
.state{
|
||||
grid-area:state;
|
||||
margin-left:40px;
|
||||
@ -174,12 +240,11 @@
|
||||
}
|
||||
|
||||
button{
|
||||
font-size:15px;
|
||||
height:50px;
|
||||
width:100px;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
|
||||
background-color:rgb(239, 60, 168);
|
||||
border-radius:10px;
|
||||
height: 35px;
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
.bodu {
|
||||
@ -190,7 +255,15 @@
|
||||
background-color:rgb(50,50,50);
|
||||
}
|
||||
|
||||
|
||||
.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>
|
||||
|
||||
|
||||
|
77
frontend/src/Apps/Inscription/PaymentInfo.vue
Normal file
77
frontend/src/Apps/Inscription/PaymentInfo.vue
Normal file
@ -0,0 +1,77 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js";
|
||||
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>
|
||||
|
218
frontend/src/Apps/LessonRequests.vue
Normal file
218
frontend/src/Apps/LessonRequests.vue
Normal file
@ -0,0 +1,218 @@
|
||||
|
||||
<!----------------------------------------------------
|
||||
File: LessonRequests.vue
|
||||
Author: William Karpinski
|
||||
Scope: Extension Horaire
|
||||
Description: Lesson Requests Management Page
|
||||
----------------------------------------------------->
|
||||
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {ref} from 'vue'
|
||||
import {changeRequestState, getAllRequests} from "@/rest/LessonRequests.js";
|
||||
import {getLesson} from "@/rest/lessonSchedule.js";
|
||||
import {formatDate, getHoursMinutes} from "@/scheduleFunctions.js";
|
||||
|
||||
const requests = ref(await getAllRequests());
|
||||
const AcceptMod = ref(false);
|
||||
const moreInfosMod = ref(false);
|
||||
const requestTypes = ["Create", "Modify", "Delete"]
|
||||
const editElementID = ref('');
|
||||
const chosenLocal = ref("");
|
||||
const locals = ["A0B1","A1B1","A2B1","A0B2"];
|
||||
const moreInfos = ref({});
|
||||
|
||||
|
||||
/*
|
||||
* Change a request's state and refreshes the requests '
|
||||
*/
|
||||
|
||||
async function upPage(id,review){
|
||||
await changeRequestState(id, review) ;
|
||||
requests.value = await getAllRequests();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set correctly the variables after clicking on the ACCEPT button
|
||||
*/
|
||||
|
||||
async function AcceptSetup(id,type){
|
||||
if(type !== 2 ){
|
||||
editElementID.value = id
|
||||
AcceptMod.value = true;
|
||||
}
|
||||
else{
|
||||
await upPage(id,{local: null,state:'Accepted'});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the infos to show when clicking MORE INFOS
|
||||
*/
|
||||
async function setMoreInfos(item){
|
||||
|
||||
moreInfos.value = Object.assign({},{})
|
||||
moreInfos.value["requestType"] = requestTypes[item.requestType]
|
||||
if(item.requestType == 0 || item.requestType == 1){
|
||||
moreInfos.value["day"] = item.lessonStart == null ? null : formatDate(new Date(item.lessonStart))
|
||||
moreInfos.value["start"] = item.lessonStart == null ? null : getHoursMinutes(new Date(item.lessonStart))
|
||||
moreInfos.value["end"] = item.lessonEnd == null ? null : getHoursMinutes(new Date(item.lessonEnd))
|
||||
moreInfos.value["lessonType"] = item.lessonType;
|
||||
moreInfos.value["course"] = item["course"] == null ? null:item.course.title}
|
||||
if (item.requestType==1 || item.requestType == 2){
|
||||
let temp = await getLesson(item.lessonId);
|
||||
if(item.requestType == 1 || item.requestType == 2){
|
||||
moreInfos.value["course"] = temp.course.title;
|
||||
moreInfos.value[item.requestType == 2 ? "day" : "old_day"] = formatDate(new Date(temp.lessonStart));
|
||||
moreInfos.value[item.requestType == 2 ? "start" : "old_start"] = getHoursMinutes(new Date(temp.lessonStart));
|
||||
moreInfos.value[item.requestType == 2 ? "end":"old_end"] = getHoursMinutes(new Date(temp.lessonEnd));
|
||||
moreInfos.value[item.requestType == 2 ? "lessonType":"old_type"] = temp.lessonType;
|
||||
}}
|
||||
editElementID.value = item.id ;
|
||||
moreInfosMod.value =true;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<template>
|
||||
|
||||
<div class="body">
|
||||
<div v-for="item of requests" :key="item.id" :style="{width:[moreInfosMod ? 95:70] + '%'}" class="center">
|
||||
|
||||
<button v-if="moreInfosMod && editElementID == item.id" @click="moreInfosMod = false; editElementID = ''; moreInfos='';">{{i18n("courses.back")}}</button>
|
||||
<div v-if ="item.state === 'Pending'" class="listElement">
|
||||
<div class="containerElement" v-if="editElementID !== item.id">
|
||||
<div class="id">{{i18n(requestTypes[item.requestType].toString())}}</div>
|
||||
<div class="surname">{{i18n(item.state.toString())}}</div>
|
||||
<div class="firstname">{{item.user.lastName}}</div>
|
||||
|
||||
<div class="infos">
|
||||
<button @click=" setMoreInfos(item);" style="background-color:rgb(105,05,105);" >
|
||||
{{i18n("request.moreInfos")}}
|
||||
</button></div>
|
||||
<div class="accept"><button @click="AcceptSetup(item.id,item.requestType);" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button @click="upPage(item.id,{local: null,state:'Refused'})" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
</div>
|
||||
|
||||
<div v-else class="containerElement" style="width:auto; height:auto;">
|
||||
<div v-if="AcceptMod" style="margin-left:20%;">
|
||||
Local:
|
||||
<select v-model="chosenLocal">
|
||||
<option v-for="item in locals">{{item}}</option>
|
||||
</select>
|
||||
<button @click="AcceptMod = false;upPage(item.id,{local: chosenLocal, state:'Accepted'})">{{i18n("request.accept")}}</button>
|
||||
</div>
|
||||
<template v-if="moreInfosMod" v-for="(key,value) in moreInfos">
|
||||
|
||||
<div class="container" v-if="key != null" style="align-self:center;">
|
||||
<div style="margin:0 auto 0 auto">
|
||||
{{i18n(value.toString())}}:
|
||||
{{key}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
|
||||
.center{
|
||||
margin:0 auto 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.containerElement{
|
||||
justify-content:center;
|
||||
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";
|
||||
column-gap:10px; }
|
||||
|
||||
.container{
|
||||
padding-left:50px;
|
||||
font-size:.8em;
|
||||
justify-content:center;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
grid-template-rows: repeat(auto-fill, 120px);
|
||||
grid-row-gap: 1em;
|
||||
|
||||
grid-column-gap: 0.2em;
|
||||
|
||||
}
|
||||
|
||||
.listElement{
|
||||
min-width:625px;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
margin-bottom:10px;
|
||||
|
||||
}
|
||||
.infos {
|
||||
grid-area:infos;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.accept{
|
||||
grid-area:accept;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.refuse{
|
||||
grid-area:refuse;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.id{
|
||||
grid-area:id;
|
||||
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{
|
||||
font-size:15px;
|
||||
height:50px;
|
||||
width:100px;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
|
||||
}
|
||||
|
||||
.body {
|
||||
width:100%;
|
||||
margin-top:3.5%;
|
||||
}
|
||||
button:hover{
|
||||
opacity:0.8;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
@ -2,11 +2,12 @@
|
||||
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 { uploadProfilePicture } from '@/rest/uploads.js'
|
||||
import {getAllCurriculums} from '@/rest/curriculum.js'
|
||||
import {uploadFile, 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)
|
||||
@ -15,7 +16,7 @@
|
||||
surname:null,
|
||||
firstname:null,
|
||||
password:null,
|
||||
birthday:null,
|
||||
birthday:"1990-01-01",
|
||||
email:null,
|
||||
address:null,
|
||||
country:null,
|
||||
@ -23,18 +24,6 @@
|
||||
equivalenceState: "Unrequired"
|
||||
})
|
||||
|
||||
const notcompletedCheck = ref(false);
|
||||
|
||||
const externalCurr = reactive({
|
||||
inscriptionRequestId : null,
|
||||
school:null,
|
||||
formation :null,
|
||||
completion : null,
|
||||
startYear : null,
|
||||
endYear: null,
|
||||
justifdocUrl : null
|
||||
})
|
||||
|
||||
//Stores some externalCurriculums in order to upload them all at the confirmation of the registration request
|
||||
const externalCurrTab = ref([]);
|
||||
|
||||
@ -42,18 +31,19 @@
|
||||
const passwordConfirm=ref("")
|
||||
|
||||
const imageSaved = ref(false)
|
||||
let ppData = ""
|
||||
|
||||
//Contains the id of the newly created request (useful to link the student's formations informations to the request)
|
||||
let requestId = ""
|
||||
|
||||
const ppData = ref({})
|
||||
const idcardfile = ref({})
|
||||
const justifcardfile = ref({})
|
||||
const allfileshere = ref(0)
|
||||
const curricula= await getAllCurriculums();
|
||||
|
||||
function goBackHome(){
|
||||
setTimeout(() => {
|
||||
window.location.href="#/home";
|
||||
}, "500");
|
||||
}
|
||||
}
|
||||
function verifyInputs(pass){
|
||||
if(pass==passwordConfirm.value){
|
||||
page.value++;
|
||||
@ -69,11 +59,6 @@
|
||||
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){
|
||||
@ -83,31 +68,50 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function getCurriculumYear(curriculumId){
|
||||
const curriculum = await getcurriculum(curriculumId);
|
||||
return parseInt(curriculum.year);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Post the register request and return the id of the newly created request and also post the external curriculum list in the database
|
||||
async function postRegisterReq(){
|
||||
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, null, new Date(), outputs.equivalenceState);
|
||||
//We upload the two files and we get their paths on the server
|
||||
const identityCardFile = await uploadFile(idcardfile.value, "IdentityCard")
|
||||
const justifFile = ref(null)
|
||||
|
||||
|
||||
const profilepic = ref(null)
|
||||
if (imageSaved){
|
||||
profilepic.value = await uploadProfilePicture(ppData.value)
|
||||
}
|
||||
|
||||
|
||||
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, profilepic.value.url, identityCardFile.url, new Date(), outputs.equivalenceState, justif);
|
||||
|
||||
for (let item in externalCurrTab.value){
|
||||
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, externalCurrTab.value[item].justifdocUrl);
|
||||
const temp = await uploadFile(externalCurrTab.value[item].justifdocUrl, "JustificationDocument")
|
||||
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, temp.url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function deleteExtCursus(extcursus){
|
||||
externalCurrTab.value.splice(externalCurrTab.value.indexOf(extcursus),1)
|
||||
function everyfilehere(){
|
||||
if(allfileshere.value === 2 || (allfileshere.value === 1 && curricula[outputs.curriculum-1].requireCertificate === false)){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<div class="setup">
|
||||
<div v-if="loginPage">
|
||||
<div class="setup" v-if="page !== 4">
|
||||
<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;">
|
||||
@ -125,7 +129,7 @@
|
||||
<a @click="loginPage=!loginPage">{{i18n("login.guest.register")}}</a>
|
||||
</div>
|
||||
<div class="inputBox" style="margin-bottom:35px;">
|
||||
<input type="submit" v-model="submitValue">
|
||||
<input v-model="submitValue" type="submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -147,7 +151,7 @@
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.birthday")}}</p>
|
||||
<input type="date" v-model="outputs.birthday">
|
||||
<input type="date" v-model="outputs.birthday" value="1990-01-05" min="1912-01-01" max="2024-01-01">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.password")}}</p>
|
||||
@ -159,7 +163,7 @@
|
||||
</div>
|
||||
|
||||
<div class="switchpage">
|
||||
<button @click="verifyInputs(outputs.password);">{{i18n("login.guest.nextpage")}}</button>
|
||||
<button @click="verifyInputs(outputs.password);idcardfile={};justifcardfile={}">{{i18n("login.guest.nextpage")}}</button>
|
||||
|
||||
</div>
|
||||
<div @click="(loginPage=!loginPage) && (page=0)" class="register">
|
||||
@ -182,14 +186,7 @@
|
||||
<form class="inputBox" novalidate enctype="multipart/form-data">
|
||||
<p>{{i18n("profile.picture").toUpperCase()}}</p>
|
||||
</form>
|
||||
<label class="browser">
|
||||
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">
|
||||
<p>{{i18n("profile.picture").toUpperCase()}}</p>
|
||||
<input type="file" @change="uploadPP($event.target.files); imageSaved = true;" accept="image/*">
|
||||
</form>
|
||||
<input style="color:rgb(239,60,168);" type="file" name="picture" @change="ppData = $event.target.files;imageSaved=true" accept="image/*">
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
||||
<select v-model="outputs.curriculum">
|
||||
@ -197,8 +194,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<p style="color:rgb(239,60,168);">
|
||||
Si vous êtes déja inscrits dans cette université veuillez vous connecter a votre compte et utilisez les fonctions
|
||||
changer de cursus/réinscription sinon continuez ici.
|
||||
{{i18n("login.guest.disclaimer")}}
|
||||
</p>
|
||||
<div style="align-self:center;" class="inputBox">
|
||||
<button style="margin-top:25px;" @click="page++;">
|
||||
@ -213,67 +209,35 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="page === 2">
|
||||
<form novalidate enctype="multipart/form-data" class="inputBox">
|
||||
Carte d'identité :
|
||||
</form>
|
||||
<button @click="page++">{{i18n("login.guest.nextpage")}}</button>
|
||||
<p style="color:rgb(239,60,168);">{{i18n("login.guest.identityCard")}}</p>
|
||||
<input style="color:rgb(239,60,168);margin-bottom: 3%" type="file" @change="idcardfile = $event.target.files;allfileshere = Math.min(allfileshere+1, 2)">
|
||||
<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>
|
||||
<input style=" color:rgb(239,60,168);" type="file" @change="justifcardfile = $event.target.files;allfileshere = Math.min(allfileshere+1, 2)">
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="everyfilehere()"><button @click="page++;" style="margin-top: 10%">{{i18n("login.guest.nextpage")}}</button></div>
|
||||
<div v-else style="color: rgb(239,60,168); margin-top: 5%; margin-bottom: 5%">Please upload all the required files</div>
|
||||
</div>
|
||||
<div v-if="page === 3">
|
||||
<p>
|
||||
Vous avez séléctionné un cursus qui possède des prérequis veuillez ajouter vos formations antérieures
|
||||
dans l'enseignement supérieur, votre dossier sera vérifié par un membre du service d'inscription.
|
||||
<p style="color:rgb(239,60,168);margin-bottom: 5%">
|
||||
{{i18n("login.guest.formationdisclaimer")}}
|
||||
</p>
|
||||
<button @click="page++">Ajouter une formation</button>
|
||||
<button @click="postRegisterReq();">Envoyer la demande d'inscription</button>
|
||||
</div>
|
||||
<div v-if="page===4">
|
||||
<form @submit.prevent=""class="form">
|
||||
<div class="inputBox">
|
||||
<p>Ecole</p>
|
||||
<input type="text" v-model="externalCurr.school">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>Formation</p>
|
||||
<input type="text" v-model="externalCurr.formation">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>Cochez la case si vous n'avez terminé cette formation</p>
|
||||
<input v-model="notcompletedCheck" type="checkbox" id="checkboxformation">
|
||||
<div v-if="notcompletedCheck">
|
||||
<p>En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?</p>
|
||||
<input type="text" v-model="externalCurr.completion">
|
||||
</div>
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>Année de début</p>
|
||||
<input type="text" v-model="externalCurr.startYear">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>Année de fin</p>
|
||||
<input type="text" v-model="externalCurr.endYear">
|
||||
</div>
|
||||
<div class="inputBox" style="margin-bottom:35px;">
|
||||
<input type="submit" v-model="submitValue" @click="externalCurrTab.push({inscriptionReqId:null, school:externalCurr.school, formation:externalCurr.formation, completion:externalCurr.completion, startYear:externalCurr.startYear, endYear:externalCurr.endYear, justifdocUrl:externalCurr.justifdocUrl});console.log(externalCurrTab);page--;">
|
||||
</div>
|
||||
</form>
|
||||
<button @click="page++">{{i18n("login.guest.managecareer")}}</button>
|
||||
<button @click="postRegisterReq();page+=2">{{ i18n("login.guest.sendRegReq") }}</button>
|
||||
</div>
|
||||
<div v-if="page===5" style="margin-left: 7%">
|
||||
<p style="color: rgb(239,60,168);">{{i18n("reqsent")}}</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; justify-content:center; " v-for="item in externalCurrTab" v-if="page===3">
|
||||
<div class="bodu">
|
||||
<div class="container">
|
||||
<div class="school"><a style="margin-left:30px;">{{item.school}}</a></div>
|
||||
<div class="formation"><a>{{item.formation}}</a></div>
|
||||
<div class="edit">
|
||||
<button style="background-color:rgb(105,05,105);font-size:15px;height:50px;width:75%;border:none;border-radius:20px;" @click="externalCurr.school=item.school; externalCurr.completion=item.completion; externalCurr.formation=item.formation;externalCurr.endYear=item.endYear; externalCurr.startYear=item.startYear; externalCurr.justifdocUrl;page++;">Edit </button>
|
||||
</div>
|
||||
<div class="remove">
|
||||
<button style="background-color:rgb(105,05,105);font-size:15px;height:50px;width:75%;border:none;border-radius:20px;" @click="deleteExtCursus(item)">Remove </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div 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>
|
||||
|
||||
@ -295,7 +259,6 @@
|
||||
justify-content: center;
|
||||
border-radius: 5%;
|
||||
box-shadow:0 5px 25px #000000;
|
||||
|
||||
}
|
||||
.form {
|
||||
position:relative;
|
||||
@ -325,8 +288,6 @@
|
||||
z-index: 100;
|
||||
font-family:sans-serif ;
|
||||
color:rgb(239,60,168);
|
||||
transition: 0.5;
|
||||
|
||||
}
|
||||
|
||||
.register{
|
||||
@ -337,13 +298,7 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bodu {
|
||||
margin-top:2%;
|
||||
width:50%;
|
||||
border:2px solid black;
|
||||
border-radius:9px;
|
||||
background-color:rgb(50,50,50);
|
||||
}
|
||||
|
||||
|
||||
.switchpage{
|
||||
width:100px;
|
||||
@ -354,8 +309,6 @@
|
||||
outline:none;
|
||||
border-radius: 4px;
|
||||
font-size:0.8em;
|
||||
align-self: right;
|
||||
|
||||
}
|
||||
|
||||
input[type=submit],button,select{
|
||||
@ -369,9 +322,6 @@ input[type=submit],button,select{
|
||||
|
||||
}
|
||||
|
||||
input[type=file]{
|
||||
display:none;
|
||||
}
|
||||
|
||||
.browser{
|
||||
display:inline-block;
|
||||
@ -384,22 +334,8 @@ 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>
|
||||
|
@ -3,26 +3,27 @@
|
||||
import {reactive , ref} from 'vue'
|
||||
import { getCourses,deleteCourse,alterCourse,createCourse } from "@/rest/courses.js"
|
||||
import {getUser, getSelf, getTeachers } from "@/rest/Users.js"
|
||||
import {addCourseToCurriculum, getAllCurriculums, getCurriculumsByCourse} from "@/rest/curriculum.js";
|
||||
|
||||
|
||||
const self = await getSelf();
|
||||
|
||||
const curriculum = ref(await getCourses(self.role));
|
||||
const profList = await getTeachers();
|
||||
|
||||
const allCurriculums = ref(await getAllCurriculums());
|
||||
const curriculumToAdd = ref();
|
||||
|
||||
const createMod = ref(false)
|
||||
const deleteMod = ref(false)
|
||||
|
||||
const editElementID = ref("")
|
||||
const editAddCourse = ref("");
|
||||
|
||||
function editItem(id){
|
||||
editElementID = id;
|
||||
}
|
||||
|
||||
//Juste pour montrer le Create Mode
|
||||
const curriculumToAddId = ref()
|
||||
|
||||
const pattern = {
|
||||
"id":null,
|
||||
"title":null,
|
||||
"credits":null,
|
||||
"owner":null,
|
||||
@ -35,21 +36,46 @@
|
||||
let isnull= false;
|
||||
|
||||
for(const [key, value] of Object.entries(toAdd)){
|
||||
console.log(toAdd.owner);
|
||||
if(value === null){
|
||||
isnull=true;
|
||||
}
|
||||
|
||||
}
|
||||
if (!isnull){
|
||||
await createCourse(toAdd.title,toAdd.credits,toAdd.owner);
|
||||
await createCourse(toAdd.id,toAdd.title,toAdd.credits,toAdd.owner);
|
||||
|
||||
toAdd= Object.assign({},pattern);
|
||||
|
||||
curriculum.value = await getCourses(self.role);
|
||||
|
||||
|
||||
}}
|
||||
async function setAddToCurriculum(item){
|
||||
let temp = [];
|
||||
let courseCurriculum = await getCurriculumsByCourse(item.courseID);
|
||||
let isIn = false;
|
||||
for (let element in allCurriculums.value){
|
||||
for (let item in courseCurriculum){
|
||||
if((courseCurriculum[item].option == allCurriculums.value[element].option) && (courseCurriculum[item].year == allCurriculums.value[element].year) ){
|
||||
isIn = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if(!isIn){
|
||||
temp.push(allCurriculums.value[element])
|
||||
}
|
||||
isIn = false;
|
||||
}
|
||||
curriculumToAdd.value = temp.slice();
|
||||
}
|
||||
|
||||
async function addToCurriculum(item){
|
||||
await addCourseToCurriculum(curriculumToAddId.value,item.courseID);
|
||||
curriculumToAddId.value = null;
|
||||
curriculumToAdd.value = null;
|
||||
allCurriculums.value = await getAllCurriculums();
|
||||
}
|
||||
function setModify(item){
|
||||
for(const el in profList){
|
||||
|
||||
@ -64,17 +90,14 @@
|
||||
|
||||
async function patchCourse(course){
|
||||
for (let element in toModify){
|
||||
console.log(toModify,1)
|
||||
console.log(toModify[element],2)
|
||||
|
||||
if (element =="owner" && (toModify[element].regNo != course.owner.regNo)){
|
||||
await alterCourse(course.courseId,{owner:toModify[element].regNo});
|
||||
await alterCourse(course.courseID,{owner:toModify[element].regNo});
|
||||
}
|
||||
else if(element == "title" && (toModify[element] != course.title)){
|
||||
await alterCourse(course.courseId,{title:toModify[element]});
|
||||
await alterCourse(course.courseID,{title:toModify[element]});
|
||||
}
|
||||
else if(element == "credits" && (parseInt(toModify[element]) != course.credits)){
|
||||
await alterCourse(course.courseId,{credits:parseInt(toModify[element])});
|
||||
await alterCourse(course.courseID,{credits:parseInt(toModify[element])});
|
||||
}
|
||||
}
|
||||
toModify= Object.assign({},pattern);
|
||||
@ -100,13 +123,18 @@
|
||||
<button class="create" @click="editElementID= '';createMod = true;">
|
||||
{{i18n("courses.createCourse")}}
|
||||
</button>
|
||||
<button class="delete" @click="deleteMod=true" >
|
||||
<button class="delete" @click="deleteMod=true">
|
||||
{{i18n("courses.deleteCourse")}}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="createMod">
|
||||
<form class="listElement" style="width:40%;margin-right:auto;margin-left:auto;">
|
||||
|
||||
<div style="margin-bottom: 20px">
|
||||
{{i18n("Curriculum")}}
|
||||
<select v-model="toAdd.id">
|
||||
<option v-for="element in allCurriculums" :value="element.curriculumId">{{element.option}}-{{element.year}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("name")}} :
|
||||
<input v-model="toAdd.title">
|
||||
@ -140,32 +168,49 @@
|
||||
</div>
|
||||
|
||||
<div v-if="!createMod && !deleteMod" v-for="item in curriculum" :key="item.title" style="width:50%;margin-left:auto; margin-right:auto;">
|
||||
<div v-if="editElementID !== item.title" style ="padding:15px 15px 15px 15px;">
|
||||
<button @click="editElementID = item.title; setModify(item); ">
|
||||
<div v-if="editElementID !== item.title && editAddCourse !== item.title" style ="padding:15px 15px 15px 15px;">
|
||||
<button @click="editElementID = item.title; editAddCourse = ''; setModify(item); ">
|
||||
{{i18n("courses.modify")}}
|
||||
</button>
|
||||
<button v-if="self.role !== 'Teacher'"@click="editAddCourse = item.title; editElementID ='';setAddToCurriculum(item)">Add to a new Curriculum</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="editElementID == item.title">
|
||||
<button @click="editElementID= '';patchCourse(item)"> {{i18n("courses.confirm")}} </button>
|
||||
<button @click="editElementID= '';"> {{i18n("courses.back")}} </button>
|
||||
</div>
|
||||
<div class="listElement" >
|
||||
<div v-if="editAddCourse == item.title">
|
||||
<button @click="editAddCourse= '';addToCurriculum(item)"> {{i18n("courses.confirm")}} </button>
|
||||
<button @click="editAddCourse= '';"> {{i18n("courses.back")}} </button>
|
||||
</div>
|
||||
<div class="listElement">
|
||||
|
||||
<div class="containerElement" v-if="editElementID !== item.title" >
|
||||
<div class="containerElement" v-if="editElementID !== item.title && editAddCourse !== item.title" >
|
||||
|
||||
<div class="name"> {{item.title}} </div>
|
||||
<div class="teacher">{{item.owner.lastName}}</div>
|
||||
<div class="credits">{{i18n("Credits")}}:{{item.credits}}</div>
|
||||
</div>
|
||||
<div class="containerElement"v-else>
|
||||
|
||||
<div class="containerElement" v-if="editAddCourse == item.title" >
|
||||
{{i18n("Curriculum")}}:
|
||||
<select v-model="curriculumToAddId">
|
||||
<option v-for="element in curriculumToAdd" :value="element.curriculumId">
|
||||
{{element.option}}-{{element.year}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="containerElement" v-if="editElementID == item.title">
|
||||
|
||||
<input style="max-width:200px;" class="name" v-model="toModify.title">
|
||||
<select v-if="self.role === 'Secretary'" style="max-width:200px;" class="teacher" v-model="toModify.owner">
|
||||
<select v-if="self.role != 'Secretary'" style="max-width:200px;" class="teacher" v-model="toModify.owner">
|
||||
<option v-for="(item,index) in profList" :value='item'>{{item.lastName}}</option>
|
||||
</select>
|
||||
<div v-else class="teacher">{{item.owner.lastName}}</div>
|
||||
<input v-if="self.role==='Secretary'"style="max-width:100px;"class="credits" v-model="toModify.credits">
|
||||
<input v-if="self.role !='Secretary'"style="max-width:100px;"class="credits" v-model="toModify.credits">
|
||||
<div v-else class="credits">{{i18n("Credits")}}:{{item.credits}}</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -177,17 +222,6 @@
|
||||
margin-top:3.5%;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.containerElement{
|
||||
justify-content:center;
|
||||
display:grid;
|
||||
|
277
frontend/src/Apps/ManageOwnLessons.vue
Normal file
277
frontend/src/Apps/ManageOwnLessons.vue
Normal file
@ -0,0 +1,277 @@
|
||||
<!----------------------------------------------------
|
||||
File: LessonRequests.vue
|
||||
Author: William Karpinski
|
||||
Scope: Extension Horaire
|
||||
Description: Lessons Management Page for the teachers
|
||||
----------------------------------------------------->
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
import {formatDate,invertedFormatDate,getHoursMinutes,sortByDate, createLessonEvent} from '../scheduleFunctions.js'
|
||||
import {getOwnedLessons} from "@/rest/lessonSchedule.js";
|
||||
import {getSelf} from "@/rest/Users.js";
|
||||
import {createRequest} from "@/rest/LessonRequests.js"
|
||||
import {getcurriculum} from "@/rest/curriculum.js";
|
||||
import {getAllSchedule} from "@/rest/scheduleRest.js";
|
||||
|
||||
|
||||
const curriculum = ref();
|
||||
const allSchedules = ref(await getAllSchedule());
|
||||
const schedule = ref(await getOwnedLessons());
|
||||
schedule.value.sort((a,b) => sortByDate(b,a))
|
||||
const createMod = ref(false);
|
||||
const user = await getSelf();
|
||||
const editElementID = ref();
|
||||
const requestType = ref(0);
|
||||
const currentDate = new Date();
|
||||
const types = ["TP","TD","Course","Exam"];
|
||||
const colors = {"TP":"rgb(36,175,255)","TD":"rgb(255,36,175)","Exam":"rgb(175,255,36)","Course":"rgb(255,36,175)"}
|
||||
const courses = ref();
|
||||
|
||||
const maxDate = ref(invertedFormatDate(new Date([currentDate.getMonth()<7 ? currentDate.getFullYear() : (currentDate.getFullYear())+1],7,31)));
|
||||
|
||||
const minDate = ref(invertedFormatDate((new Date()).setDate(currentDate.getDate()+1)))
|
||||
|
||||
/*
|
||||
* Checks if a lesson is in the future or not
|
||||
*/
|
||||
function inFuture(lesson){
|
||||
let toCompare = new Date(lesson.lessonStart);
|
||||
let current = new Date();
|
||||
return (current < toCompare)
|
||||
}
|
||||
|
||||
|
||||
async function setCourses(){
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses
|
||||
}
|
||||
|
||||
const pattern = {
|
||||
"lessonId":null,
|
||||
"course": null,
|
||||
"day":null,
|
||||
"lessonStart": null,
|
||||
"lessonEnd": null,
|
||||
"lessonType": null,
|
||||
}
|
||||
const patternRequest ={
|
||||
"user": user.regNo,
|
||||
"state": "Pending",
|
||||
"requestType": 0,
|
||||
"lessonId":null,
|
||||
"lessonType":null,
|
||||
"lessonStart":null,
|
||||
"lessonEnd":null,
|
||||
"color":null,
|
||||
"course":0,}
|
||||
|
||||
const toModify = ref(Object.assign({}, pattern));
|
||||
const requestBuffer = ref(Object.assign({},patternRequest));
|
||||
|
||||
function setModify(lesson){
|
||||
toModify.value.lessonId = editElementID.value;
|
||||
toModify.value.day = invertedFormatDate(new Date(lesson.lessonStart));
|
||||
toModify.value.lessonStart = getHoursMinutes(lesson.lessonStart);
|
||||
toModify.value.lessonEnd = getHoursMinutes(lesson.lessonEnd);
|
||||
toModify.value.lessonType = lesson.lessonType
|
||||
}
|
||||
|
||||
function setCreate(){
|
||||
toModify.value = ref(Object.assign({},pattern));
|
||||
createMod.value = !createMod.value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructs a request and posts it
|
||||
*/
|
||||
async function createLessonRequest(){
|
||||
if(requestType.value === 0 || requestType.value === 1){
|
||||
//modify
|
||||
requestBuffer.value.color = colors[toModify.value.lessonType] ;
|
||||
requestBuffer.value.requestType = requestType.value;
|
||||
requestBuffer.value.course = toModify.value.course;
|
||||
let start = createLessonEvent(toModify.value.day,toModify.value.lessonStart)
|
||||
let end = createLessonEvent(toModify.value.day,toModify.value.lessonEnd)
|
||||
for (let element in toModify.value){
|
||||
if(element !== "day" && element !== "lessonStart" && element !== "lessonEnd"){
|
||||
requestBuffer.value[element] = toModify.value[element];
|
||||
}
|
||||
if(element === "lessonStart"){
|
||||
requestBuffer.value.lessonStart = start;
|
||||
}
|
||||
if(element === "lessonEnd"){
|
||||
requestBuffer.value.lessonEnd = end;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(requestType.value === 2 || requestType.value === 1) {
|
||||
//delete
|
||||
requestBuffer.value.lessonId = editElementID;
|
||||
requestBuffer.value.requestType = requestType.value;
|
||||
}
|
||||
await createRequest(requestBuffer.value);
|
||||
editElementID.value = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a request of a certain type
|
||||
* 0 = CREATE REQUEST
|
||||
* 1 = MODIFY REQUEST
|
||||
* 2 = DELETE REQUEST
|
||||
*/
|
||||
async function askChanges(i){
|
||||
requestType.value= i;
|
||||
await createLessonRequest()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<div class="body">
|
||||
<div v-if="createMod">
|
||||
<form class="listElement" style="width:40%; margin:0 auto 0 auto;">
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("schedule")}} :
|
||||
<select @change="setCourses()"v-model="curriculum">
|
||||
<option v-for="item in allSchedules" :value='item.curriculum'>{{item.curriculum.option}}-{{item.curriculum.year}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("course")}}:
|
||||
<select v-if="curriculum != null" v-model="toModify.course">
|
||||
<option v-for="item in courses" :value='item.courseID'>{{item.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("day")}}:
|
||||
<input type="date" :min="minDate" :max="maxDate" v-model="toModify.day">
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("start")}}:
|
||||
<input v-model="toModify.lessonStart" type="time" min="08:00" max="18:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("end")}}:
|
||||
<input v-model="toModify.lessonEnd" type="time" min="10:00" max="20:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Type:
|
||||
<select v-model="toModify.lessonType">
|
||||
<option v-for="item in types" :value='item'>{{i18n(item)}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<button class="create" @click="createMod=!createMod; askChanges(0);"> {{i18n("courses.confirm")}} </button>
|
||||
<button style="float:right;" @click="createMod=!createMod">{{i18n("courses.back")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<button v-if="!createMod" @click="setCreate()" style="display:flex; margin:0 auto 0 auto;">{{i18n("schedule.askCreate")}}</button>
|
||||
<div v-if="!createMod"v-for="element in schedule" style="width:50%;margin-left:auto; margin-right:auto;" >
|
||||
<div v-if="editElementID !== element.lessonID" style ="padding:15px 15px 15px 15px;">
|
||||
<button v-if="inFuture(element)" @click="editElementID = element.lessonID;setModify(element);">
|
||||
{{i18n("schedule.askChanges")}}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button @click="askChanges(1);"> {{i18n("courses.confirm")}} </button>
|
||||
<button @click="editElementID= '';"> {{i18n("courses.back")}} </button>
|
||||
</div>
|
||||
<div class="listElement">
|
||||
<div v-if="editElementID !== element.lessonID">
|
||||
<div>
|
||||
{{element.course.title}}
|
||||
</div>
|
||||
<div>{{formatDate(element.lessonStart)}}</div>
|
||||
<div>{{getHoursMinutes(element.lessonStart)}}-{{getHoursMinutes(element.lessonEnd)}}
|
||||
</div>
|
||||
<div>{{element.local}}</div>
|
||||
<div>{{i18n(element.lessonType)}}</div>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div>{{element.course.title}}</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("day")}}:
|
||||
<input type="date" :min="minDate" :max="maxDate" v-model="toModify.day">
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("start")}}:
|
||||
<input v-model="toModify.lessonStart" type="time" min="8:00" max="20:00"/>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("end")}}:
|
||||
<input v-model="toModify.lessonEnd" type="time" min="10:00" max="20:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("Type")}}:
|
||||
<select v-model="toModify.lessonType">
|
||||
<option v-for="item in types" :value='item'>{{i18n(item)}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Local:
|
||||
{{element.local}}
|
||||
<div style="float:right;">
|
||||
<button @click="askChanges(2)" class="delete"> {{i18n("schedule.askDeletion")}} </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.body {
|
||||
width:100%;
|
||||
margin-top:3.5%;
|
||||
}
|
||||
|
||||
.listElement{
|
||||
min-width:625px;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
margin-bottom:10px;
|
||||
|
||||
}
|
||||
|
||||
input, select{
|
||||
padding:10px 10px 10px 10px;
|
||||
font-size:25px;
|
||||
cursor: pointer;
|
||||
border:none;
|
||||
border-radius:15px;
|
||||
}
|
||||
button{
|
||||
font-size:15px;
|
||||
height:auto;
|
||||
width:100px;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
|
||||
}
|
||||
|
||||
.delete{
|
||||
grid-area:delete;
|
||||
background-color:rgb(200,0,0);
|
||||
}
|
||||
button:hover{
|
||||
opacity:0.8;
|
||||
}
|
||||
|
||||
</style>
|
506
frontend/src/Apps/ManageSchedule.vue
Normal file
506
frontend/src/Apps/ManageSchedule.vue
Normal file
@ -0,0 +1,506 @@
|
||||
|
||||
<!----------------------------------------------------
|
||||
File: LessonRequests.vue
|
||||
Author: William Karpinski
|
||||
Scope: Extension Horaire
|
||||
Description: Lessons Management Page for the secretary
|
||||
----------------------------------------------------->
|
||||
|
||||
<script setup>
|
||||
|
||||
import { ref } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
import {formatDate,getHoursMinutes, invertedFormatDate, createLessonEvent} from '../scheduleFunctions.js'
|
||||
import {getAllSchedule, deleteLessonFromSchedule ,getSchedule, createSchedule} from "@/rest/scheduleRest.js";
|
||||
import {getLessons, createLesson, alterLesson, deleteLesson} from "@/rest/lessonSchedule.js"
|
||||
import {getTeachers} from "@/rest/Users.js"
|
||||
import {getcurriculum, getAllCurriculums} from "@/rest/curriculum.js"
|
||||
|
||||
const trueSchedule = ref()
|
||||
const schedule = ref();
|
||||
const lessonFinder = ref();
|
||||
const curriculum = ref();
|
||||
const allSchedules = ref(await getAllSchedule());
|
||||
const filter = ref("null");
|
||||
const subFilter = ref("null");
|
||||
const filters = ["Type","Teacher","Course"];
|
||||
const types = ["TP","TD","Course","Exam"];
|
||||
const locals = ["A0B1","A1B1","A2B1","A0B2"]
|
||||
const teachers = await getTeachers() ;
|
||||
const allCurriculum = ref();
|
||||
const courses = ref();
|
||||
|
||||
const createScheduleMod = ref(false);
|
||||
const createMod = ref(false);
|
||||
const deleteMod = ref(false);
|
||||
|
||||
const colors = {"TP":"rgb(36,175,255)","TD":"rgb(255,36,175)","Exam":"rgb(175,255,36)","Course":"rgb(255,36,175)"}
|
||||
const currentDate = new Date();
|
||||
|
||||
const editElementID = ref();
|
||||
|
||||
const maxDate = ref(invertedFormatDate(new Date([currentDate.getMonth()<7 ? currentDate.getFullYear() : (currentDate.getFullYear())+1],7,31)));
|
||||
|
||||
const minDate = ref(invertedFormatDate((new Date()).setDate(currentDate.getDate()+1)))
|
||||
|
||||
|
||||
const pattern = {
|
||||
"course": null,
|
||||
"day":null,
|
||||
"lessonStart": null,
|
||||
"lessonEnd": null,
|
||||
"lessonType": null,
|
||||
"local": null,
|
||||
"color": null,
|
||||
}
|
||||
|
||||
const lessonCreator = {
|
||||
"courseID" : null,
|
||||
"lessonStart":null,
|
||||
"lessonEnd":null,
|
||||
"lessonType":null,
|
||||
"local":null,
|
||||
"color":null,
|
||||
}
|
||||
|
||||
const patternModify = {
|
||||
"day": null,
|
||||
"lessonStart": null,
|
||||
"lesssonEnd": null,
|
||||
"local":null,
|
||||
"lessonType":null,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets up allCurriculum to contain only the curriculums that don't have any schedule
|
||||
*/
|
||||
async function setCurriculum(){
|
||||
const temp = await getAllCurriculums();
|
||||
let isIn = false;
|
||||
let toReturn =[] ;
|
||||
for (let element in temp){
|
||||
for (let item in allSchedules.value){
|
||||
console.log(allSchedules.value[item])
|
||||
console.log(temp[element])
|
||||
if((allSchedules.value[item].curriculum.option == temp[element].option) && (allSchedules.value[item].curriculum.year == temp[element].year)){
|
||||
|
||||
isIn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isIn){
|
||||
toReturn.push(temp[element])
|
||||
}
|
||||
isIn = false;
|
||||
}
|
||||
allCurriculum.value = toReturn.slice();
|
||||
}
|
||||
|
||||
|
||||
const toModify = ref(Object.assign({}, pattern));
|
||||
const lessonBuffer = ref(Object.assign({}, pattern));
|
||||
const lessonCreatorBuffer = ref(Object.assign({},lessonCreator));
|
||||
|
||||
|
||||
function setModify(lesson){
|
||||
toModify.value.day = invertedFormatDate(new Date(lesson.lessonStart));
|
||||
toModify.value.lessonStart = getHoursMinutes(lesson.lessonStart);
|
||||
toModify.value.lessonEnd = getHoursMinutes(lesson.lessonEnd);
|
||||
toModify.value.local = lesson.local;
|
||||
toModify.value.lessonType = lesson.lessonType;
|
||||
}
|
||||
|
||||
function inFuture(lesson){
|
||||
let toCompare = new Date(lesson.lessonStart);
|
||||
let current = new Date();
|
||||
return (current < toCompare)
|
||||
}
|
||||
|
||||
async function setCourses(){
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses
|
||||
}
|
||||
|
||||
/*
|
||||
* Sort the lessons via a criteria
|
||||
*/
|
||||
function sortSchedule(){
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
if(filter.value =="Teacher"){
|
||||
schedule.value = sortByTeacher(schedule.value,subFilter.value);
|
||||
|
||||
}
|
||||
else if(filter.value =="Type"){
|
||||
schedule.value = sortByType(schedule.value,subFilter.value);
|
||||
}
|
||||
else if(filter.value =="Course"){
|
||||
schedule.value = sortByCourse(schedule.value,subFilter.value);
|
||||
}
|
||||
}
|
||||
|
||||
function sortByType(lessons,type){
|
||||
if(type == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].lessonType == type){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
return matrix
|
||||
}
|
||||
|
||||
function sortByCourse(lessons,course){
|
||||
if(course == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].course.courseID == course.courseID){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
return matrix
|
||||
}
|
||||
|
||||
function sortByTeacher(lessons, teacher){
|
||||
if(teacher == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].course.owner.regNo == teacher.regNo){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
return matrix
|
||||
}
|
||||
|
||||
/*
|
||||
* Change the schedule filter
|
||||
*/
|
||||
async function changeSchedule(){
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
curriculum.value = trueSchedule.value.curriculum;
|
||||
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
||||
filter.value = "null";
|
||||
subFilter.value = "null"
|
||||
}
|
||||
|
||||
|
||||
async function newLesson(){
|
||||
let isnull = false;
|
||||
if (lessonBuffer.value.lessonType != null){
|
||||
lessonBuffer.value.color = colors[lessonBuffer.value.lessonType];
|
||||
for(let element in lessonBuffer.value){
|
||||
if(lessonBuffer.value[element] == null){
|
||||
isnull=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isnull){
|
||||
|
||||
let start = createLessonEvent(lessonBuffer.value.day,lessonBuffer.value.lessonStart)
|
||||
let end = createLessonEvent(lessonBuffer.value.day,lessonBuffer.value.lessonEnd)
|
||||
|
||||
lessonCreatorBuffer.value.lessonStart = start;
|
||||
lessonCreatorBuffer.value.lessonEnd = end;
|
||||
lessonCreatorBuffer.value.color = lessonBuffer.value.color;
|
||||
lessonCreatorBuffer.value.lessonType =lessonBuffer.value.lessonType;
|
||||
lessonCreatorBuffer.value.local = lessonBuffer.value.local;
|
||||
lessonCreatorBuffer.value.courseID = lessonBuffer.value.course.courseID;
|
||||
|
||||
await createLesson(lessonCreatorBuffer.value);
|
||||
|
||||
lessonFinder.value = await getLessons();
|
||||
|
||||
}
|
||||
}
|
||||
lessonBuffer.value = Object.assign({}, pattern);
|
||||
lessonFinder.value = null;
|
||||
lessonCreatorBuffer.value = Object.assign({},lessonCreator)
|
||||
trueSchedule.value = null;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Modify a lesson
|
||||
*/
|
||||
|
||||
async function patchLesson(lesson){
|
||||
|
||||
for (let element in toModify.value){
|
||||
if (element =="lessonType" && (toModify.value[element] != lesson[element])){
|
||||
await alterLesson(lesson.lessonID,{lessonType:toModify.value[element]});
|
||||
}
|
||||
if (element =="local" && (toModify.value[element] != lesson[element])){
|
||||
await alterLesson(lesson.lessonID,{local:toModify.value[element]});
|
||||
}
|
||||
if (element =="lessonStart" && (toModify.value[element] != lesson[element])){
|
||||
await alterLesson(lesson.lessonID,{lessonStart:createLessonEvent(toModify.value.day,toModify.value[element])
|
||||
});
|
||||
}
|
||||
if (element =="lessonEnd" && (toModify.value[element] != lesson[element])){
|
||||
await alterLesson(lesson.lessonID,{lessonEnd:createLessonEvent(toModify.value.day,toModify.value[element])
|
||||
});
|
||||
}
|
||||
if(element == "day" && (toModify.value[element] != invertedFormatDate(new Date(lesson.lessonStart))) ){
|
||||
|
||||
if(toModify.value.lessonStart == lesson.lessonStart){
|
||||
await alterLesson(lesson.lessonID,{lessonStart:createLessonEvent(toModify.value.day,lesson.lessonStart)
|
||||
});}
|
||||
if(toModify.value.lessonEnd == lesson.lessonEnd){
|
||||
await alterLesson(lesson.lessonID,{lessonStart:createLessonEvent(toModify.value.day,lesson.lessonStart)});
|
||||
}
|
||||
}
|
||||
}
|
||||
toModify.value= Object.assign({},patternModify);
|
||||
trueSchedule.value = await getSchedule(trueSchedule.value.scheduleId);
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
editElementID.value= '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function removeLesson() {
|
||||
await deleteLessonFromSchedule(trueSchedule.value.scheduleId, editElementID.value)
|
||||
await deleteLesson(editElementID.value);
|
||||
trueSchedule.value = await getSchedule(trueSchedule.value.scheduleId);
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
editElementID.value= '';
|
||||
|
||||
}
|
||||
/*
|
||||
* Create a new Schedule
|
||||
*/
|
||||
async function newSchedule(){
|
||||
await createSchedule(curriculum.value);
|
||||
allSchedules.value = await getAllSchedule();
|
||||
setCurriculum();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="body">
|
||||
<div class="listTitle buttonGrid"v-if="!createMod && !createScheduleMod" >
|
||||
<button class="create" @click="setCurriculum();createScheduleMod = true"> {{i18n("schedule.createSchedule")}}</button>
|
||||
<button class="create" @click="createMod = true;">{{i18n("schedule.createLesson")}}</button>
|
||||
<button class="delete" @click="deleteMod = !deleteMod;">{{!deleteMod ? i18n("schedule.deleteMod") : i18n("schedule.noDeleteMod")}}</button>
|
||||
|
||||
</div>
|
||||
<div v-if="createMod">
|
||||
<form class="listElement" style="width:40%; margin:0 auto 0 auto;">
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("schedule")}} :
|
||||
<select @change="setCourses()"v-model="curriculum">
|
||||
<option v-for="item in allSchedules" :value='item.curriculum'>{{item.curriculum.option}} - {{item.curriculum.year}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("Course")}} :
|
||||
<select v-if="curriculum != null" v-model="lessonBuffer.course">
|
||||
<option v-for="item in courses" :value='item'>{{item.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("day")}}:
|
||||
<input type="date" :min="minDate" :max="maxDate" v-model="lessonBuffer.day">
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("start")}}:
|
||||
<input v-model="lessonBuffer.lessonStart" type="time" min="08:00" max="18:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("end")}}:
|
||||
<input v-model="lessonBuffer.lessonEnd" type="time" min="10:00" max="20:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Type:
|
||||
<select v-model="lessonBuffer.lessonType">
|
||||
<option v-for="item in types" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Local:
|
||||
<select v-model="lessonBuffer.local">
|
||||
<option v-for="item in locals" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button class="create" @click="createMod=!createMod; newLesson();"> {{i18n("courses.confirm")}} </button>
|
||||
<button style="float:right;" @click="createMod=!createMod">{{i18n("courses.back")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div v-if="createScheduleMod">
|
||||
<form class="listElement" style="width:40%; margin:0 auto 0 auto;">
|
||||
<div style="margin-bottom:20px;">
|
||||
{{i18n("schedule")}} :
|
||||
<select v-model="curriculum">
|
||||
<option v-for="item in allCurriculum" :value='item'>{{item.option}} - {{item.year}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="create" @click="createScheduleMod=!createScheduleMod ;newSchedule();"> {{i18n("courses.confirm")}} </button>
|
||||
<button style="float:right;" @click="createScheduleMod=!createScheduleMod;">{{i18n("courses.back")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div v-if="!createMod && !createScheduleMod">
|
||||
<select @change="changeSchedule()" v-model="trueSchedule">
|
||||
<option v-for="item in allSchedules" :value='item'>{{item.curriculum.option}} - {{item.curriculum.year}}</option>
|
||||
</select>
|
||||
<select v-if="schedule != null" @change="subFilter = 'null'" v-model="filter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in filters" :value="item">{{i18n(item.toString())}}</option>
|
||||
</select>
|
||||
<select @change="sortSchedule()" v-if="filter == 'Teacher'" v-model="subFilter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in teachers" :value=item>{{item.lastName}}</option>
|
||||
</select>
|
||||
<select @change="sortSchedule()" v-if="filter == 'Course'" v-model="subFilter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in courses" :value=item>{{item.title}}</option>
|
||||
</select>
|
||||
<select @change="sortSchedule()" v-if="filter == 'Type'" v-model="subFilter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in types" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div v-if="!createMod && !createScheduleMod" :key="element.lessonID" v-for="element in schedule" style="width:50%;margin-left:auto; margin-right:auto;" >
|
||||
<div v-if="editElementID !== element.lessonID" style ="padding:15px 15px 15px 15px;">
|
||||
<button v-if="inFuture(element)" @click="editElementID = element.lessonID;setModify(element);">
|
||||
{{i18n("courses.modify")}}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button @click="patchLesson(element);"> {{i18n("courses.confirm")}} </button>
|
||||
<button @click="editElementID= '';"> {{i18n("courses.back")}} </button>
|
||||
</div>
|
||||
<div class="listElement">
|
||||
<div v-if="editElementID != element.lessonID">
|
||||
<div>
|
||||
{{element.course.title}}
|
||||
</div>
|
||||
<div>{{formatDate(element.lessonStart)}}</div>
|
||||
<div>{{getHoursMinutes(element.lessonStart)}}-{{getHoursMinutes(element.lessonEnd)}}
|
||||
</div>
|
||||
<div>{{element.local}}</div>
|
||||
<div>{{element.lessonType}}</div>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div>{{element.course.title}}</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Day:
|
||||
<input type="date" :min="minDate" :max="maxDate" v-model="toModify.day">
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Start:
|
||||
<input v-model="toModify.lessonStart" type="time" min="8:00" max="20:00"/>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
End:
|
||||
<input v-model="toModify.lessonEnd" type="time" min="10:00" max="20:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Type:
|
||||
<select v-model="toModify.lessonType">
|
||||
<option v-for="item in types" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Local:
|
||||
<select v-model="toModify.local">
|
||||
<option v-for="item in locals" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
<div v-if="deleteMod" style="float:right;">
|
||||
<button class="delete" @click="removeLesson(element);"> {{i18n("courses.deleteCourse")}} </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.body {
|
||||
width:100%;
|
||||
margin-top:3.5%;
|
||||
}
|
||||
|
||||
.listElement{
|
||||
min-width:625px;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
margin-bottom:10px;
|
||||
|
||||
}
|
||||
|
||||
input, select{
|
||||
padding:10px 10px 10px 10px;
|
||||
font-size:25px;
|
||||
cursor: pointer;
|
||||
border:none;
|
||||
border-radius:15px;
|
||||
}
|
||||
button{
|
||||
font-size:15px;
|
||||
height:50px;
|
||||
width:100px;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
|
||||
}
|
||||
|
||||
.buttonGrid{
|
||||
display:grid;
|
||||
grid-template-columns: auto auto;
|
||||
column-gap:50px;
|
||||
grid-template-areas:
|
||||
"create delete";
|
||||
}
|
||||
|
||||
.create{
|
||||
grid-area:create;
|
||||
|
||||
background-color:rgb(0,200,0);
|
||||
|
||||
}
|
||||
|
||||
.delete{
|
||||
grid-area:delete;
|
||||
background-color:rgb(200,0,0);
|
||||
}
|
||||
|
||||
.listTitle{
|
||||
min-width:380px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:25%;
|
||||
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;
|
||||
|
||||
button:hover{
|
||||
opacity:0.8;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,19 +1,23 @@
|
||||
<script setup>
|
||||
import {reactive, ref } from 'vue'
|
||||
import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js'
|
||||
import {getSelfCurriculum, getAllCurriculums, getSomeonesCurriculumList} from '../rest/curriculum.js'
|
||||
import {getSelf,alterSelf} from '../rest/Users.js'
|
||||
import {getAllCurriculums, getSomeonesCurriculumList, getcurriculum} 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} from "@/rest/requests.js";
|
||||
import {addUninscReq, createScholarshipRequest, postChangeCurrReq} from "@/rest/requests.js";
|
||||
import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
|
||||
import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
|
||||
|
||||
const user = ref(await getSelf());
|
||||
const 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);
|
||||
@ -22,17 +26,15 @@
|
||||
if(user.role === "Teacher"){
|
||||
UserCurriculum.value = await getCourses("Teacher");
|
||||
}
|
||||
const modif = ref(false);
|
||||
const curric = ref(false);
|
||||
const reg = ref(false);
|
||||
const courseslist = ref(false);
|
||||
const minerval = ref(false);
|
||||
const paymentPage = ref(false);
|
||||
const scholarship = ref(false);
|
||||
const scholarshipinfos = ref(false);
|
||||
const uninscr = ref(false);
|
||||
|
||||
const sure = ref(0);
|
||||
|
||||
//0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister, 12 manage external curriculums
|
||||
const windowState = ref(0);
|
||||
|
||||
const isChecked = ref(false);
|
||||
const reRegState = ref(0);
|
||||
|
||||
const pattern = {
|
||||
profilPictureUrl:null,
|
||||
email:null,
|
||||
@ -67,32 +69,41 @@
|
||||
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
|
||||
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]});
|
||||
}
|
||||
}
|
||||
@ -108,36 +119,21 @@
|
||||
toModify.password= item.password;
|
||||
}
|
||||
|
||||
|
||||
async function unRegister(){
|
||||
deleteUser(user.value.regNo);
|
||||
disconnect()
|
||||
setTimeout(() => {
|
||||
window.location.href="#/home";
|
||||
}, "500");
|
||||
|
||||
}
|
||||
|
||||
function getPP(){
|
||||
if(user.value.profilePictureUrl === null){
|
||||
return "/Clyde.png"
|
||||
}
|
||||
return user.profilePictureUrl
|
||||
return user.value.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].dateyear === getYear()){
|
||||
if (UserCurriculum.value.curriculumList[i].actual === true){
|
||||
actualCurriculumList.push(UserCurriculum.value.curriculumList[i]);
|
||||
}
|
||||
}
|
||||
@ -155,96 +151,139 @@
|
||||
|
||||
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">
|
||||
<div class="container" v-if="courseslist == false">
|
||||
<div class="profilPic">
|
||||
<div class="body" v-if="windowState !== 12 && windowState!==4">
|
||||
<div class="container">
|
||||
<div class="profilPic" v-if="windowState===0">
|
||||
<img class="subContainter" :src=getPP()>
|
||||
</div>
|
||||
<div class="globalInfos">
|
||||
<div v-if="modif==false && curric==false && reg==false && minerval==false && paymentPage == false && scholarship==false && uninscr == false" class="infosContainer">
|
||||
<div v-if="windowState === 0" class="infosContainer">
|
||||
<div>
|
||||
{{user.firstName}} {{user.lastName}}
|
||||
</div>
|
||||
<div>
|
||||
E-mail: {{user.email}}
|
||||
{{ i18n("login.guest.email") }}: {{user.email}}
|
||||
</div>
|
||||
<div v-if="user.role==='Student'">
|
||||
{{user.option}} {{i18n(user.role)}}
|
||||
{{ i18n("regNo") }} : {{user.regNo}}
|
||||
</div>
|
||||
<div v-else>
|
||||
Role: {{i18n((user.role))}}
|
||||
{{ i18n("role") }}: {{i18n((user.role))}}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="modif=!modif; setModify(user)"> {{i18n("profile.modify.data")}} </button>
|
||||
<button @click="windowState=1; setModify(user)"> {{i18n("profile.modify.data")}} </button>
|
||||
</div>
|
||||
<div v-if="(user.role==='Student')">
|
||||
<button @click="reg=!reg">{{i18n("profile.reRegister")}}</button>
|
||||
<button @click="uninscr = !uninscr" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button>
|
||||
<button @click="windowState=9" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button>
|
||||
</div>
|
||||
<div v-if="(user.role==='Student')">
|
||||
<button @click="curric=!curric">{{i18n("profile.change.curriculum")}}</button>
|
||||
<button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
|
||||
<button @click="windowState=12;refreshExtCurrList();" style="margin-left: 2%">{{ i18n("manageextcur") }}</button>
|
||||
</div>
|
||||
<div v-if="(user.role==='Student')">
|
||||
<button @click="courseslist=!courseslist">Manage Courses</button>
|
||||
<button @click="minerval = !minerval" style="margin-left: 2%">Manage minerval</button>
|
||||
<button @click="windowState=4">{{ i18n("managecourse") }}</button>
|
||||
<button @click="windowState=5" style="margin-left: 2%">{{ i18n("manageminerval") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="uninscr" class="infosContainer">
|
||||
<div v-if="sure != 2">Please enter the reason you leave the university</div>
|
||||
<textarea v-if="sure != 2" v-model="uninscriptionData.reason"></textarea>
|
||||
<div v-if="sure != 2">
|
||||
<button @click="sure++">Submit</button>
|
||||
<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">
|
||||
Are you sure that you want to unregister ?
|
||||
<button @click="addUninscReq(uninscriptionData.userId, uninscriptionData.reason);sure++">Yes</button>
|
||||
<button @click="sure=0">No</button>
|
||||
{{ 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">You request has been send !</p>
|
||||
<p v-if="sure==2">{{ i18n("reqsend") }}</p>
|
||||
</div>
|
||||
<div v-else-if="minerval" class="infosContainer">
|
||||
<div v-if="minerv.value.toPay != 0">
|
||||
Payment : {{minerv.value.toPay}}€ left to pay
|
||||
<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="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = 50">Pay deposit (50€)</button>
|
||||
<button @click="windowState=6; paymentAmount = 50">{{ i18n("paydeposit") }} (50€)</button>
|
||||
</div>
|
||||
<div>
|
||||
<button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}}€)</button>
|
||||
<button @click="windowState=6; paymentAmount = minerv.value.toPay">{{ i18n("payrest") }} ({{minerv.value.toPay}}€)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
Payment : School fees have already been paid this year
|
||||
{{ i18n("alreadypaid") }}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="scholarship=!scholarship; minerval=!minerval">Ask for a scholarship</button>
|
||||
<button @click="windowState=7" v-if="minerv.value.toPay <= 0">{{ i18n("askscholarship") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="scholarship && !scholarshipinfos" class="infosContainer">
|
||||
<p>Please upload the required documents</p>
|
||||
<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>
|
||||
Tax justification document :
|
||||
{{ i18n("taxjustdoc") }}
|
||||
<input type="file" @change="scholarshipData.taxDocUrl = $event.target.files">
|
||||
</div>
|
||||
<div>
|
||||
Residency justification document :
|
||||
{{i18n("residencydoc")}}
|
||||
<input type="file" style="margin-top:2%" @change="scholarshipData.residencyDocUrl = $event.target.files">
|
||||
</div>
|
||||
<button style="margin-top: 5%" @click="scholarshipinfos = !scholarshipinfos;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">Submit scholarship request</button>
|
||||
<button style="margin-top: 5%" @click="windowState=8;postScholarshipRequest(scholarshipData.taxDocUrl, 'JustificationDocument',scholarshipData.residencyDocUrl, 'JustificationDocument');">{{i18n("login.guest.submit")}}</button>
|
||||
</div>
|
||||
<div v-else-if="scholarship && scholarshipinfos" class="infosContainer">
|
||||
<div v-if="windowState === 7">
|
||||
<button @click="windowState = 5">{{ i18n("courses.back") }}</button>
|
||||
</div>
|
||||
<div v-else-if="windowState === 8" class="infosContainer">
|
||||
<div>
|
||||
Your request has been sent to the inscription service you will get notified when
|
||||
the request is reviewed.
|
||||
{{i18n("reqsent")}}
|
||||
</div>
|
||||
<button @click="scholarshipinfos=!scholarshipinfos; scholarship=!scholarship">
|
||||
Go back to profile
|
||||
<button @click="windowState = 0">
|
||||
{{ i18n("backprofile") }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else-if="paymentPage" class="infosContainer">
|
||||
Proceed to payment of {{paymentAmount}}€
|
||||
<div v-else-if="windowState === 6" class="infosContainer">
|
||||
{{ i18n("procpayment") }} {{paymentAmount}}€
|
||||
<div style="margin-top: 1%">
|
||||
Client:
|
||||
<input type="text" v-model="paymentData.client">
|
||||
@ -258,20 +297,20 @@
|
||||
<input type="date" v-model="paymentData.expDate">
|
||||
</div>
|
||||
<div style="margin-top: 1%">
|
||||
<button @click="paymentPage=!paymentPage;minerval=!minerval;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">Process Payment</button>
|
||||
<button @click="windowState=5;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">{{i18n("procpaybutton")}}</button>
|
||||
</div>
|
||||
<div>
|
||||
<button @click="minerval = !minerval; paymentPage = !paymentPage;">Back</button>
|
||||
<button @click="windowState = 5">{{ i18n("courses.back") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="modif" class="infosContainer">
|
||||
<div v-else-if="windowState === 1" class="infosContainer">
|
||||
<div>
|
||||
{{i18n("profile.picture")}}:
|
||||
<input type="file" @change="user.profilPicture = uploadProfilePicture($event.target.files);" accept="image/*">
|
||||
</div>
|
||||
<div>
|
||||
E-mail:
|
||||
<input type="mail" v-model="toModify.email" />
|
||||
{{ i18n("login.guest.email")}}
|
||||
<input type="email" v-model="toModify.email" />
|
||||
</div>
|
||||
<div>
|
||||
{{i18n("profile.address")}}:
|
||||
@ -286,79 +325,85 @@
|
||||
<input type="password" v-model="toModify.passwordConfirm">
|
||||
</div>
|
||||
<div>
|
||||
<button @click=" modif=!modif; ChangeInfos();">{{i18n("courses.confirm")}}</button>
|
||||
<button @click="modif=!modif; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
<button @click="windowState = 0; ChangeInfos();">{{i18n("courses.confirm")}}</button>
|
||||
<button @click="windowState = 0; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<div v-else-if="windowState === 2" class="infosContainer">
|
||||
<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>
|
||||
<button @click=" curric=!curric;">{{i18n("courses.confirm")}}</button>
|
||||
<button @click="curric=!curric; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
<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>
|
||||
<div v-else-if="reg" class="infosContainer">
|
||||
<div>
|
||||
E-mail:
|
||||
<input type="mail" v-model="toModify.email" />
|
||||
<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>
|
||||
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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="user.role == 'Student' && modif==false && curric==false && reg==false && minerval==false && scholarship == false && uninscr == false" class="moreInfos">
|
||||
<div v-if="windowState === 0" class="moreInfos">
|
||||
<div class = "oldcursus">
|
||||
<div class="listTitle">
|
||||
Anciens Cursus
|
||||
{{ i18n("oldcursus") }}
|
||||
</div>
|
||||
<div class="listElement">
|
||||
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList">
|
||||
<div class="year" v-if="parseInt(item.dateyear) !== getYear()">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="parseInt(item.dateyear) !== getYear()">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="parseInt(item.dateyear) !== getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
<div class="year" v-if="item.actual === false">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="item.actual === false">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="item.actual === false">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actualcursus">
|
||||
<div class="listTitle">
|
||||
Cursus Actuel
|
||||
{{ i18n("newcurr") }}
|
||||
</div>
|
||||
<div class="listElement">
|
||||
<div class=" containerElement" v-for="item in UserCurriculum.curriculumList" >
|
||||
<div class="year" v-if="parseInt(item.dateyear) === getYear()">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="parseInt(item.dateyear) === getYear()">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="parseInt(item.dateyear) === getYear()">Année {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
<div class="year" v-if="item.actual === true">Bac {{item.year}}</div>
|
||||
<div class="option" v-if="item.actual === true">{{item.option}}</div>
|
||||
<div class="dateyear" v-if="item.actual === true">{{ i18n("year") }} {{item.dateyear}}-{{item.dateyear+1}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="courseslist === true" style="width: 80%">
|
||||
<CourseList :cursuslist="getActualCurriculumList()"/>
|
||||
<button style="width: 10%; margin-top: 5%" @click="courseslist = false">Return to profile</button>
|
||||
</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>
|
||||
|
||||
@ -439,21 +484,6 @@
|
||||
|
||||
}
|
||||
|
||||
.name {
|
||||
grid-area:name;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.teacher{
|
||||
grid-area:teacher;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.credits{
|
||||
grid-area:credits;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
|
||||
.listElement{
|
||||
border:2px solid black;
|
||||
@ -483,7 +513,6 @@ button{
|
||||
border-radius:10px;
|
||||
height:35px;
|
||||
margin-top:10px;
|
||||
|
||||
}
|
||||
|
||||
button:hover{
|
||||
|
802
frontend/src/Apps/Schedule.vue
Normal file
802
frontend/src/Apps/Schedule.vue
Normal file
@ -0,0 +1,802 @@
|
||||
|
||||
<!----------------------------------------------------
|
||||
File: Schedule.vue
|
||||
Author: William Karpinski
|
||||
Scope: Extension Horaire
|
||||
Description: Schedules Page accessed by everyone
|
||||
----------------------------------------------------->
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,weekFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList, durationCourse} from '../scheduleFunctions.js'
|
||||
import {getAllSchedule} from "@/rest/scheduleRest.js";
|
||||
import {getOnesLessons, getOwnedLessons } from "@/rest/lessonSchedule.js"
|
||||
import {isLogged, getSelf,getTeachers} from "@/rest/Users.js"
|
||||
import {getUserActualCourses} from "@/rest/courses.js";
|
||||
import {getcurriculum} from "@/rest/curriculum.js";
|
||||
import i18n from "../i18n.js";
|
||||
|
||||
const trueSchedule = ref()
|
||||
const log = await isLogged();
|
||||
const schedule = ref();
|
||||
const importedJSON = ref();
|
||||
const jsonSchedule = ref();
|
||||
const jsonMod = ref(false);
|
||||
const curriculum = ref();
|
||||
const shift = ref(getFirstDay(new Date()).getDay());
|
||||
let value = 1;
|
||||
let done = false;
|
||||
const len = ref(lastDateOfMonth(new Date()));
|
||||
const scheduleByWeek = ref();
|
||||
const month = ref();
|
||||
const mondayOfWeek =ref(getMonday(new Date()))
|
||||
const currentDate = ref(new Date())
|
||||
const allSchedules = await getAllSchedule();
|
||||
let counter = 0;
|
||||
const ownSchedule = ref();
|
||||
const filter = ref("null");
|
||||
const subFilter = ref("null");
|
||||
const focus = ref();
|
||||
const focusLessons = ref();
|
||||
let user;
|
||||
|
||||
if(log){
|
||||
user = await getSelf();
|
||||
if(user.role == "Teacher" || user.role == "Student"){
|
||||
|
||||
if(user.role == "Teacher"){
|
||||
ownSchedule.value = await getOwnedLessons();
|
||||
}
|
||||
|
||||
if(user.role == "Student"){
|
||||
let test = await getUserActualCourses();
|
||||
console.log(test);
|
||||
ownSchedule.value = await getOnesLessons();}
|
||||
|
||||
schedule.value = ownSchedule.value;
|
||||
|
||||
schedule.value.sort((a,b) => sortByDate(a,b));
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(schedule.value,new Date().getMonth());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const display =ref("Week");
|
||||
const format = ref("Grid");
|
||||
const filters = ["Type","Teacher","Course"];
|
||||
const types = ["TP","TD","Course","Exam"];
|
||||
const teachers = await getTeachers() ;
|
||||
const courses = ref();
|
||||
|
||||
|
||||
if(curriculum.value != null){
|
||||
courses.value = curriculum.value.courses;
|
||||
}
|
||||
const days = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];
|
||||
const months = ["january","february","march","april",'may',"june","july","august","september","october","november","december"]
|
||||
const firstDayOfMonth = ref(getFirstDay(new Date()))
|
||||
const monthDone = ref(false);
|
||||
function getMonday(d) {
|
||||
d = new Date(d);
|
||||
d.setHours(0,0,0);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
function verifUser(){
|
||||
if(log)
|
||||
return (user.role == "Student" || user.role == "Teacher");
|
||||
return false
|
||||
}
|
||||
function displayOwnSchedule(){
|
||||
schedule.value = ownSchedule.value;
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||
value = 1;
|
||||
counter=0;
|
||||
done = false;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a JSON from a schedule
|
||||
*/
|
||||
function createJSON(){
|
||||
const json = {"data":[]};
|
||||
for(let element in schedule.value){
|
||||
let item = {};
|
||||
item["title"] = schedule.value[element].course.title + "\n" + schedule.value[element].course.owner.lastName+ "\n" + schedule.value[element].local
|
||||
item["start"] = schedule.value[element].lessonStart;
|
||||
item["end"] = schedule.value[element].lessonEnd;
|
||||
item["color"] = schedule.value[element].color;
|
||||
json.data.push(item)
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
||||
/*
|
||||
* Export a JSON
|
||||
*/
|
||||
|
||||
function exportJSON(){
|
||||
let json = createJSON();
|
||||
const data = JSON.stringify(json);
|
||||
const blob = new Blob([data], {type:"application/json"});
|
||||
const a = document.createElement('a');
|
||||
a.href = URL.createObjectURL(blob);
|
||||
a.download = "Schedule.json";
|
||||
a.click();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Used to convert a JSON imported to an object
|
||||
*/
|
||||
function onFileChange(e) {
|
||||
let files = e.target.files || e.dataTransfer.files;
|
||||
if (!files.length) return;
|
||||
readFile(files[0]);
|
||||
}
|
||||
function readFile(file) {
|
||||
let reader = new FileReader();
|
||||
reader.onload = e => {
|
||||
let json = JSON.parse(e.target.result);
|
||||
importedJSON.value = json
|
||||
createScheduleFromJSON();
|
||||
jsonMod.value= true;
|
||||
};
|
||||
reader.readAsText(file);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function createScheduleFromJSON(){
|
||||
let jsonBrut = importedJSON.value;
|
||||
let toEventList = [];
|
||||
for(let element in jsonBrut["data"]){
|
||||
let temp = {}
|
||||
temp["title"] = jsonBrut["data"][element].title;
|
||||
temp["lessonStart"] = jsonBrut["data"][element].start;
|
||||
temp["lessonEnd"] = jsonBrut["data"][element].end;
|
||||
temp["color"] = jsonBrut["data"][element].color;
|
||||
toEventList.push(temp);
|
||||
}
|
||||
jsonSchedule.value = toEventList;
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(jsonSchedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(jsonSchedule.value,new Date().getMonth());
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the JSON on the schedule
|
||||
*/
|
||||
function switchToJSON(){
|
||||
jsonMod.value = true;
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(jsonSchedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(jsonSchedule.value,new Date().getMonth());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* used to focus on a lesson when we click on it
|
||||
*/
|
||||
function lessonFocus(element){
|
||||
if(!jsonMod.value){
|
||||
focus.value = element;
|
||||
var lessonsList = [];
|
||||
for (let element in schedule.value){
|
||||
if (schedule.value[element].course.courseID == focus.value.course.courseID){
|
||||
lessonsList.push(schedule.value[element]);
|
||||
}
|
||||
}
|
||||
focusLessons.value = lessonsList;}
|
||||
}
|
||||
|
||||
/*
|
||||
* convert the current date to a DATE object
|
||||
*/
|
||||
function dateOfMonth(i){
|
||||
|
||||
return new Date(currentDate.value.getFullYear(),currentDate.value.getMonth(),i);
|
||||
}
|
||||
|
||||
function sortSchedule(){
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
if(filter.value =="Teacher"){
|
||||
schedule.value = sortByTeacher(schedule.value,subFilter.value);
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||
value = 1;
|
||||
counter=0;
|
||||
|
||||
|
||||
}
|
||||
else if(filter.value =="Type"){
|
||||
schedule.value = sortByType(schedule.value,subFilter.value);
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||
value = 1;
|
||||
counter=0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if(filter.value =="Course"){
|
||||
schedule.value = sortByCourse(schedule.value,subFilter.value);
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||
value = 1;
|
||||
counter=0;
|
||||
}
|
||||
|
||||
if(focus.value != null){
|
||||
lessonFocus(focus.value)
|
||||
}
|
||||
}
|
||||
|
||||
function sortByType(lessons,type){
|
||||
if(type == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].lessonType == type){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
return matrix
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function sortByCourse(lessons,course){
|
||||
if(course == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].course.courseID == course.courseID){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
return matrix
|
||||
}
|
||||
|
||||
function sortByTeacher(lessons, teacher){
|
||||
if(teacher == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].course.owner.regNo == teacher.regNo){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
return matrix
|
||||
}
|
||||
|
||||
/*
|
||||
* Change the schedule filter
|
||||
*/
|
||||
async function changeSchedule(){
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
curriculum.value = trueSchedule.value.curriculum;
|
||||
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value,mondayOfWeek.value));
|
||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||
value = 1;
|
||||
counter=0;
|
||||
done = false;
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
||||
filter.value = "null";
|
||||
subFilter.value = "null"
|
||||
focus.value = null;
|
||||
focusLessons.value = null;
|
||||
jsonMod.value = false;
|
||||
}
|
||||
/*
|
||||
* change the week to display
|
||||
*/
|
||||
function changeWeek(i){
|
||||
const temp = getAnyDays(i);
|
||||
mondayOfWeek.value = temp;
|
||||
if(scheduleByWeek.value != null)
|
||||
if(jsonMod.value){
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(jsonSchedule.value, mondayOfWeek.value))}
|
||||
else{
|
||||
scheduleByWeek.value = sundayToTheEnd(weekFromList(schedule.value, mondayOfWeek.value))}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* change the month to display
|
||||
*/
|
||||
function changeMonth(i){
|
||||
const temp = currentDate.value;
|
||||
currentDate.value = new Date( ( 0< temp.getMonth()+i < 13 ? temp.getFullYear() : temp.getFullYear()+i), (0< temp.getMonth()+i <13 ? temp.getMonth()+i : 12 ),1);
|
||||
shift.value= getFirstDay(currentDate.value).getDay();
|
||||
len.value= lastDateOfMonth(currentDate.value);
|
||||
value = 1;
|
||||
counter = 0;
|
||||
done=false;
|
||||
if(month.value != null){
|
||||
if(jsonMod.value){
|
||||
month.value = monthFromList(jsonSchedule.value,currentDate.value.getMonth())}
|
||||
}
|
||||
else{
|
||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth())}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* used to display correctly the dates of a month
|
||||
*/
|
||||
|
||||
function isAValue(){
|
||||
if(value-shift.value<0 ){
|
||||
counter++;
|
||||
value++;
|
||||
return false;
|
||||
}
|
||||
if(value-shift.value<len.value){
|
||||
value++;
|
||||
counter++;
|
||||
return true;}
|
||||
|
||||
if(value-shift.value==len.value){
|
||||
done = true;
|
||||
counter++;
|
||||
|
||||
|
||||
if(counter> 35){
|
||||
counter=1;
|
||||
value = 2;
|
||||
done = false;
|
||||
return true; }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="grid">
|
||||
<div class="schedule" v-if="format == 'Grid'">
|
||||
<template v-if="display=='Week'">
|
||||
<table class="table">
|
||||
<tr style="background-color:rgb(24,24,24)">
|
||||
<th>
|
||||
<button @click="changeWeek(-7)">{{i18n("schedule.previous")}}</button>
|
||||
<button @click="changeWeek(7)">{{i18n("schedule.next")}}</button>
|
||||
<button @click="mondayOfWeek = getMonday(new Date());
|
||||
scheduleByWeek != null ? scheduleByWeek = sundayToTheEnd(weekFromList(schedule.value, mondayOfWeek)) : null;">{{i18n("schedule.current")}}</button>
|
||||
|
||||
</th>
|
||||
<th class="header" v-for='d,index in 7' >
|
||||
<p class="childHeader">
|
||||
{{i18n(days[index])}}
|
||||
</p>
|
||||
<p class="childHeader">
|
||||
{{formatDate(getAnyDays(index))}}
|
||||
</p>
|
||||
</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 v-if="scheduleByWeek != null " class="courseGrid">
|
||||
<div class="dayCourse" v-for="element in scheduleByWeek">
|
||||
<template v-for="i,index in element.length">
|
||||
<div class="course" @click.native="lessonFocus(element[index])" v-bind:style="{background:element[index].color,
|
||||
|
||||
height:((getDifferenceTime(element[index].lessonEnd,element[index].lessonStart)/7.2)-0.5)+'%', top:((getMarginTop(element, index, index-1)/7.20))+'%'}">
|
||||
<div class="hourStart">
|
||||
{{getHoursMinutes(element[index].lessonStart)}}
|
||||
|
||||
</div>
|
||||
<div class="infos">
|
||||
<p class="childInfos" >{{jsonMod ? element[index].title : element[index].course.title}}</p>
|
||||
<p class="childInfos"v-if="!jsonMod">{{element[index].local}}</p>
|
||||
<p class="childInfos"v-if="!jsonMod">{{element[index].lessonType}}</p>
|
||||
<p class="childInfos"v-if="!jsonMod">{{element[index].course.owner.lastName}}</p>
|
||||
|
||||
</div>
|
||||
<div class="hourEnd">
|
||||
{{getHoursMinutes(element[index].lessonEnd)}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<table class="table">
|
||||
<tr style="background-color:rgb(24,24,24); height:8.33%;">
|
||||
<th colspan="7" class="header">
|
||||
<div>{{i18n(months[currentDate.getMonth()])}} {{currentDate.getFullYear()}}</div>
|
||||
<button style="position:absolute; top:0; left:0;" @click="changeMonth(-1)">{{i18n("schedule.previous")}}</button>
|
||||
<button style="position:absolute; bottom:0; left:0;"@click="changeMonth(1)">{{i18n("schedule.next")}}</button>
|
||||
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
<tr style="background-color:rgb(24,24,24); height:8.33%;" >
|
||||
<th class="header" v-for='d,index in 7' >
|
||||
{{i18n(days[index])}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr v-for="n in 5" style="height:16.67%;">
|
||||
<td v-for="m,i in 7" style="height:16.67%; position:relative;">
|
||||
<div v-if="isAValue()" style="top:0; right:2%; border-radius:20%;color:rgb(200,200,200) ; position:absolute;z-index:50;">{{value-shift}}</div>
|
||||
<div v-if="month != null" style="overflow-y:scroll; height:100%;" >
|
||||
<template v-for="element in month[value-shift]">
|
||||
<div v-if="!done"class="course" @click.native="lessonFocus(element)" v-bind:style="{background:element.color, height:100+'%'}">
|
||||
|
||||
<div class="hourStart">
|
||||
{{getHoursMinutes(element.lessonStart)}}
|
||||
</div>
|
||||
<div class="infos">
|
||||
<p class="childInfos" >{{jsonMod ? element.title : element.course.title}}</p>
|
||||
<p class="childInfos"v-if="!jsonMod">{{element.local}}</p>
|
||||
<p class="childInfos"v-if="!jsonMod">{{element.lessonType}}</p>
|
||||
<p class="childInfos"v-if="!jsonMod">{{element.course.owner.lastName}}</p>
|
||||
|
||||
</div>
|
||||
<div class="hourEnd">
|
||||
{{getHoursMinutes(element.lessonEnd)}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
</div>
|
||||
<div class="schedule" v-else>
|
||||
|
||||
<div v-if="display == 'Week'">
|
||||
<button @click="changeWeek(-7)">Previous</button>
|
||||
<button @click="changeWeek(7)">Next</button>
|
||||
<button @click="mondayOfWeek = getMonday(new Date());
|
||||
scheduleByWeek != null ? scheduleByWeek = sundayToTheEnd(weekFromList(schedule.value, mondayOfWeek)) : null;">Current</button>
|
||||
|
||||
|
||||
<template v-for="i,index in 7">
|
||||
<div class="body" style="background-color:#181818;">{{i18n(days[index])}} {{formatDate(getAnyDays(index))}}
|
||||
</div>
|
||||
<template v-if="scheduleByWeek != null">
|
||||
<div class="body" style="background-color:#353535;" >
|
||||
<div class="containerList"v-for="n,j in scheduleByWeek[index].length" @click.native="lessonFocus(scheduleByWeek[index][j])" >
|
||||
<div class="colorList" v-bind:style="{background:scheduleByWeek[index][j].color}"></div>
|
||||
<div class="hoursList">{{ getHoursMinutes(scheduleByWeek[index][j].lessonStart)}}-{{getHoursMinutes(scheduleByWeek[index][j].lessonEnd)}}</div>
|
||||
<div class="titleList">{{scheduleByWeek[index][j].course.title}}</div>
|
||||
<div class="teacherList">{{scheduleByWeek[index][j].course.owner.lastName}}</div>
|
||||
<div class="localList">{{scheduleByWeek[index][j].local}}</div>
|
||||
<div class="typeList">{{scheduleByWeek[index][j].lessonType}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div v-if="display == 'Month'">
|
||||
<button @click="changeMonth(-1)">Previous</button>
|
||||
<button @click="changeMonth(1)">Next</button>
|
||||
<div class="body" >{{i18n(months[currentDate.getMonth()])}} {{currentDate.getFullYear()}}</div>
|
||||
|
||||
<template v-for="i,index in lastDateOfMonth(currentDate.getMonth())-1">
|
||||
<div class="body" style="background-color:#181818;">{{ dateOfMonth(i).getDay()-1== -1 ? i18n(days[6]) : i18n(days[dateOfMonth(i).getDay()-1]) }} {{formatDate(dateOfMonth(i))}}
|
||||
</div>
|
||||
<template v-if="scheduleByWeek != null">
|
||||
<div class="body" style="background-color:#353535;" >
|
||||
<div class="containerList" v-for="n,j in month[i].length" @click.native="lessonFocus( month[i][j])">
|
||||
<div class="colorList" v-bind:style="{background:month[i][j].color}"></div>
|
||||
<div class="hoursList">{{ getHoursMinutes(month[i][j].lessonStart)}}-{{getHoursMinutes(month[i][j].lessonEnd)}}</div>
|
||||
<div class="titleList">{{month[i][j].course.title}}</div>
|
||||
<div class="teacherList">{{month[i][j].course.owner.lastName}}</div>
|
||||
<div class="localList">{{month[i][j].local}}</div>
|
||||
<div class="typeList">{{month[i][j].lessonType}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="options">
|
||||
<div class="settings">
|
||||
<div class="body" style="background-color:rgb(50,50,50);margin:5% 0 5% 0;">{{i18n("schedule.settings")}}</div>
|
||||
<select @change="changeSchedule()" v-model="trueSchedule">
|
||||
<option v-for="item in allSchedules" :value='item'>{{item.curriculum.option}}-{{item.curriculum.year}}</option>
|
||||
</select>
|
||||
<button v-if="display=='Week'" @click="display='Month'">{{i18n("Week")}}</button>
|
||||
<button v-if="display=='Month'" @click="display='Week'; value=1;">{{i18("Month")}}</button>
|
||||
<button v-if="format == 'Grid'" @click="format ='List'">{{i18n("Grid")}}</button>
|
||||
<button v-if="format == 'List'" @click ="format = 'Grid'">{{i18n("List")}}</button>
|
||||
<button v-if="verifUser()" @click="jsonMod=false ;displayOwnSchedule();">{{i18n("OwnSchedule")}}</button>
|
||||
<button v-if="importedJSON != null" @click="switchToJSON()">{{i18n("SwitchToJSON")}}</button>
|
||||
|
||||
<select v-if="schedule != null && !jsonMod" @change="subFilter = 'null'" v-model="filter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in filters" :value="item">{{i18n(item)}}</option>
|
||||
</select>
|
||||
<select @change="sortSchedule()" v-if="filter == 'Teacher'" v-model="subFilter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in teachers" :value=item>{{item.lastName}}</option>
|
||||
</select>
|
||||
<select @change="sortSchedule()" v-if="filter == 'Course'" v-model="subFilter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in courses" :value=item>{{item.title}}</option>
|
||||
</select>
|
||||
<select @change="sortSchedule()" v-if="filter == 'Type'" v-model="subFilter">
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in types" :value='item'>{{i18n(item)}}</option>
|
||||
</select>
|
||||
<button @click="exportJSON()" >Export JSON</button>
|
||||
|
||||
<div style="color:white;">IMPORT JSON</div>
|
||||
<input type="file" @change="onFileChange" accept="application/JSON" ></input>
|
||||
|
||||
|
||||
</div>
|
||||
<div v-if="focus != null && !jsonMod" class="moreInfos">
|
||||
<div class="body" style="background-color:rgb(50,50,50); height:10%; font-size:2em;" >{{i18n("request.moreInfos")}}</div>
|
||||
<div class="body" :style="{background:focus.color,height:auto,fontSize:1.2+'em', alignItems:center}">
|
||||
{{focus.course.title}}</div>
|
||||
|
||||
<div class="body" style="background-color:rgb(50,50,50);">{{i18n("schedule.teachers")}}</div>
|
||||
<div class="body" style="background-color:#484848;">
|
||||
<div>{{focus.course.owner.lastName}}</div>
|
||||
<div v-for="element in focus.course.assistants">
|
||||
{{element.lastName}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="body" style="background-color:rgb(50,50,50);">{{i18n("schedule.courses")}}</div>
|
||||
<div class="body" style="background-color:#484848;"v-for="lesson in focusLessons">
|
||||
{{ getHoursMinutes(lesson.lessonStart)}}-{{getHoursMinutes(lesson.lessonEnd)}}
|
||||
{{ lesson.local}}
|
||||
{{i18n(lesson.lessonType.toString())}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.grid{
|
||||
min-width:1400px;
|
||||
display:grid;
|
||||
margin-top:2%;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
grid-template-columns:72% 14.5%;
|
||||
column-gap:2vw;
|
||||
overflow:hidden;
|
||||
grid-template-areas:"schedule options";
|
||||
}
|
||||
.schedule{
|
||||
min-width:900px;
|
||||
position:relative;
|
||||
overflow-y:scroll;
|
||||
border-radius:20px;
|
||||
grid-area:schedule;
|
||||
width:100%;
|
||||
height:85vh;
|
||||
background-color:rgba(255,255,255,0.1);
|
||||
}
|
||||
.options{
|
||||
display:grid;
|
||||
border-radius:20px;
|
||||
grid-area:options;
|
||||
background-color:rgba(255,255,255,0.1);
|
||||
width:100%;
|
||||
height:85vh;
|
||||
min-width:240px;
|
||||
|
||||
grid-template-rows:40% 60%;
|
||||
}
|
||||
|
||||
.settings{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
width:80%;
|
||||
margin:0 auto 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.settings select,.settings button{
|
||||
margin-top:2%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.moreInfos{
|
||||
width:90%;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
margin:0 auto 0 auto;
|
||||
overflow-y:scroll;
|
||||
overflow-x:hidden;
|
||||
}
|
||||
|
||||
.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{
|
||||
width:12.5%;
|
||||
color:#FFFFFF;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
|
||||
.childHeader{
|
||||
margin-top:0;
|
||||
margin-bottom:0;
|
||||
max-height:14.28%
|
||||
|
||||
}
|
||||
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{
|
||||
position:relative;
|
||||
border: 1px solid black;
|
||||
border-radius:10px;
|
||||
width:90%;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
display:grid;
|
||||
grid-template-rows:1fr 1fr 1fr;
|
||||
}
|
||||
|
||||
.dayCourse{
|
||||
display:block;
|
||||
}
|
||||
|
||||
.infos{
|
||||
height:100%;
|
||||
width:100%;
|
||||
font-size:0.75em;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
.childInfos{
|
||||
text-align:center;
|
||||
margin-top:0%;
|
||||
margin-bottom:0%;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.hourStart{
|
||||
background-color:rgb(200,200,200);
|
||||
border-radius:5px;
|
||||
position:absolute;
|
||||
top:2%;
|
||||
left:2%;
|
||||
font-size:0.75em;
|
||||
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.hourEnd{
|
||||
background-color:rgb(200,200,200);
|
||||
border-radius:3px;
|
||||
position:absolute;
|
||||
bottom:2%;
|
||||
left:2%;
|
||||
font-size:0.7em;
|
||||
}
|
||||
|
||||
.containerList{
|
||||
color:white;
|
||||
height:100px;
|
||||
font-size:20px;
|
||||
display:grid;
|
||||
grid-template-columns:5vw auto auto auto auto auto;
|
||||
grid-template-areas:
|
||||
"color hours title teacher local type";
|
||||
|
||||
}
|
||||
|
||||
.colorList{
|
||||
grid-area:color;
|
||||
align-self:center;
|
||||
|
||||
width:75%;
|
||||
height:75%;
|
||||
border:1px solid black;
|
||||
border-radius:20%;
|
||||
}
|
||||
|
||||
.hoursList{
|
||||
grid-area:hours;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
|
||||
.titleList{
|
||||
grid-area:title;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.teacherList {
|
||||
grid-area:teacher;
|
||||
align-self:center;
|
||||
}
|
||||
.localList{
|
||||
grid-area:local;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.typeList{
|
||||
grid-area:type;
|
||||
align-self:center;
|
||||
}
|
||||
.body {
|
||||
color:white;
|
||||
margin-top:2%;
|
||||
width:98%;
|
||||
border:2px solid black;
|
||||
border-radius:9px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user