From 8ac1f7ed8b5f04ab026ac3b6aca5ab3543cb7d6a Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Sun, 21 Apr 2024 23:25:03 +0200 Subject: [PATCH 01/11] notifications forum --- .../ovh/herisson/Clyde/Services/Msg/ForumService.java | 8 ++++++++ frontend/public/i18n/EN.txt | 2 ++ frontend/public/i18n/FR.txt | 2 ++ 3 files changed, 12 insertions(+) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java index 02fca22..259f5b1 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java @@ -6,6 +6,7 @@ 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.Services.UserService; import ovh.herisson.Clyde.Tables.Course; import ovh.herisson.Clyde.Tables.User; import ovh.herisson.Clyde.Tables.Msg.Answer; @@ -16,17 +17,24 @@ import ovh.herisson.Clyde.Tables.Msg.Topic; @AllArgsConstructor public class ForumService { + private UserService userServ; private CourseRepository courseRepo; private ForumRepository forumRepo; private TopicRepository topicRepo; public void createForum(Course c, Forum f){ c.addForum(f); + for (User u: f.getRegister()) { + userServ.Notify(u, new Notification("forum.notification.forum.new", data.getSubject(), "/#/Forum")); + } courseRepo.save(c); } public void createTopic(Forum f, Topic data) { f.addTopic(data); + for (User u: f.getRegister()) { + userServ.Notify(u, new Notification("forum.notification.topic.new", data.getSubject(), "/#/Forum")); + } forumRepo.save(f); } diff --git a/frontend/public/i18n/EN.txt b/frontend/public/i18n/EN.txt index 3f4080d..566386b 100644 --- a/frontend/public/i18n/EN.txt +++ b/frontend/public/i18n/EN.txt @@ -125,6 +125,8 @@ 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 +forum.notification.topic.new=New topic created +forum.notification.forum.new=New Forum created firstname/name=Firstname/Name regNo=regNo From=From diff --git a/frontend/public/i18n/FR.txt b/frontend/public/i18n/FR.txt index 63f02e1..b7c7458 100644 --- a/frontend/public/i18n/FR.txt +++ b/frontend/public/i18n/FR.txt @@ -125,6 +125,8 @@ 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 +forum.notification.topic.new=Nouveau Topic crée +forum.notification.forum.new=Nouveau forum crée firstname/name=Prénom/Nom regNo=Matricule From=De From c717205764bedef5838a31edc0f8c05dc4aa866c Mon Sep 17 00:00:00 2001 From: Wawilski Date: Sun, 21 Apr 2024 23:36:25 +0200 Subject: [PATCH 02/11] Notifications Schedule --- .../EndPoints/LessonRequestsController.java | 19 ++++++++-------- .../ScheduleLessonRepository.java | 3 +++ .../UserCurriculumRepository.java | 4 +++- .../Clyde/Services/LessonService.java | 19 +++++++++++----- .../Clyde/Services/ScheduleLessonService.java | 22 ++++++++++++++----- .../java/ovh/herisson/Clyde/Tables/User.java | 3 ++- 6 files changed, 47 insertions(+), 23 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LessonRequestsController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LessonRequestsController.java index 68eeeeb..261d8b2 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LessonRequestsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LessonRequestsController.java @@ -12,14 +12,8 @@ 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 ovh.herisson.Clyde.Services.*; +import ovh.herisson.Clyde.Tables.*; import java.util.Map; @@ -28,11 +22,13 @@ import java.util.Map; public class LessonRequestsController { private final LessonRequestService lessonRequestServ; private final AuthenticatorService authServ; + private final UserService userServ; private final LessonService lessonServ; - public LessonRequestsController(LessonRequestService lessonRequestServer, AuthenticatorService authServ, LessonService lessonServ) { + public LessonRequestsController(LessonRequestService lessonRequestServer, AuthenticatorService authServ, UserService userServ, LessonService lessonServ) { this.lessonRequestServ = lessonRequestServer; this.authServ = authServ; + this.userServ = userServ; this.lessonServ = lessonServ; } /** @@ -113,6 +109,7 @@ public class LessonRequestsController { if(lessonRequest.getRequestType() == 0 ) { if (!lessonRequestServ.modifyCreateRequestState(lessonRequest, state, local)) return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + userServ.Notify(lessonRequest.getUser(), new Notification("Request took in charge","Request"+ state + ":" + lessonRequest.getCourse().getTitle(), "#/manage-owned-lessons")); } else if(lessonRequest.getRequestType() == 1){ @@ -122,12 +119,14 @@ public class LessonRequestsController { if(!lessonRequestServ.modifyChangeRequestState(infos,lessonRequest.getLessonId(),state)) return new ResponseEntity<>(HttpStatus.BAD_REQUEST); lessonRequest.setState(state); + userServ.Notify(lessonRequest.getUser(), new Notification("Request took in charge","Request"+ state + ":" + lessonServ.findById(lessonRequest.getLessonId()).getCourse().getTitle(), "#/manage-owned-lessons")); + } else{ + userServ.Notify(lessonRequest.getUser(), new Notification("Request took in charge","Request"+ state + ":" + lessonServ.findById(lessonRequest.getLessonId()).getCourse().getTitle(), "#/manage-owned-lessons")); lessonRequestServ.modifyDeleteRequest(lessonRequest, state); lessonRequest.setState(state); - } lessonRequestServ.save(lessonRequest); return new ResponseEntity<>(HttpStatus.OK); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScheduleLessonRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScheduleLessonRepository.java index 97e69ca..e7218ce 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScheduleLessonRepository.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScheduleLessonRepository.java @@ -22,6 +22,9 @@ public interface ScheduleLessonRepository extends CrudRepository findUsersByCurriculum(Curriculum curriculum); + ArrayList findByUserOrderByCurriculum(User student); UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual); ArrayList findByUserAndActual(User user, boolean actual); - } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java index 292a6a6..bc32b0a 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java @@ -7,10 +7,7 @@ package ovh.herisson.Clyde.Services; * @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.Repositories.*; import ovh.herisson.Clyde.Tables.*; import java.util.ArrayList; @@ -19,12 +16,17 @@ import java.util.Map; @Service public class LessonService { private final LessonRepository lessonRepo; + + private final ScheduleLessonRepository scheduleLessonRepo; private final UserCurriculumRepository userCurriculumRepo; + private final UserService userServ; private final CourseRepository courseRepo; private final CurriculumCourseRepository curriculumCourseRepo; - public LessonService(LessonRepository lessonRepo, UserCurriculumRepository userCurriculumRepo, CourseRepository courseRepo, CurriculumCourseRepository curriculumCourseRepo){ + public LessonService(LessonRepository lessonRepo, ScheduleLessonRepository scheduleLessonRepo, UserCurriculumRepository userCurriculumRepo, UserService userServ, CourseRepository courseRepo, CurriculumCourseRepository curriculumCourseRepo){ this.lessonRepo = lessonRepo; + this.scheduleLessonRepo = scheduleLessonRepo; this.userCurriculumRepo = userCurriculumRepo; + this.userServ = userServ; this.courseRepo = courseRepo; this.curriculumCourseRepo = curriculumCourseRepo; } @@ -136,7 +138,12 @@ public class LessonService { break; } } - lessonRepo.save(target); + Lesson lesson = lessonRepo.save(target); + ScheduleLesson scheduleLesson = scheduleLessonRepo.findByLesson(lesson); + Iterable users = userCurriculumRepo.findUsersByCurriculum(scheduleLesson.getSchedule().getCurriculum()); + for(User user: users){ + userServ.Notify(user, new Notification("Course modified in the schedule", "Course Modified " + lesson.getCourse().getTitle() , "/#/schedule")); + } return true; } /** diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/ScheduleLessonService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/ScheduleLessonService.java index d89fa01..9e608eb 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/ScheduleLessonService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/ScheduleLessonService.java @@ -9,22 +9,26 @@ 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.Repositories.UserCurriculumRepository; 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 UserCurriculumRepository userCurriculumRepo; + private final UserService userServ; private final LessonRepository lessonRepo; private final ScheduleRepository scheduleRepo; - public ScheduleLessonService(ScheduleLessonRepository scheduleLessonRepo, LessonRepository lessonRepo, ScheduleRepository scheduleRepo) { + public ScheduleLessonService(ScheduleLessonRepository scheduleLessonRepo, UserCurriculumRepository userCurriculumRepo, UserService userServ, LessonRepository lessonRepo, ScheduleRepository scheduleRepo) { this.scheduleLessonRepo = scheduleLessonRepo; + this.userCurriculumRepo = userCurriculumRepo; + this.userServ = userServ; this.lessonRepo = lessonRepo; this.scheduleRepo = scheduleRepo; } @@ -32,19 +36,22 @@ public class ScheduleLessonService { if(scheduleLesson == null) return false; scheduleLessonRepo.save(scheduleLesson); + Iterable users = userCurriculumRepo.findUsersByCurriculum(scheduleLesson.getSchedule().getCurriculum()); + for(User user: users){ + userServ.Notify(user, new Notification("New course in the schedule", "Course added " + scheduleLesson.getLesson().getCourse().getTitle(), "/#/schedule")); + } return true; } /** * Save a lesson to all the schedule it is linked */ - public boolean saveToAllSchedule(Lesson lesson){ + public void saveToAllSchedule(Lesson lesson){ Iterable schedules = scheduleRepo.findAllLessonSchedule(lesson.getCourse()); if(schedules == null) - return false; + return; for (Schedule schedule : schedules){ save(new ScheduleLesson(schedule, lesson)); } - return true; } /** * Delete a scheduleLesson via its lesson @@ -52,6 +59,11 @@ public class ScheduleLessonService { public boolean delete(long lessonId){ if(lessonId == 0) return false; + ScheduleLesson scheduleLesson = scheduleLessonRepo.findByLesson(lessonRepo.findById(lessonId)); + Iterable users = userCurriculumRepo.findUsersByCurriculum(scheduleLesson.getSchedule().getCurriculum()); + for(User user: users){ + userServ.Notify(user, new Notification("Course deleted in the schedule","Course deleted " + scheduleLesson.getLesson().getCourse().getTitle(), "/#/schedule")); + } scheduleLessonRepo.delete(lessonRepo.findById(lessonId)); return true; } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java index 6b724de..3a30fe7 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java @@ -11,6 +11,7 @@ import ovh.herisson.Clyde.Tables.Msg.Discussion; import ovh.herisson.Clyde.Tables.Msg.Message; import ovh.herisson.Clyde.Tables.Notification.Status; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -40,7 +41,7 @@ public class User { @JsonIgnore @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) - private List notifications; + private List notifications = new ArrayList<>(); ////// Extension Messagerie ///// @JsonIgnore From bbddcb26ad31c47adf475bd72930d8ca1a6f6ac2 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 00:03:45 +0200 Subject: [PATCH 03/11] fixup! Merge pull request 'Notifications on Schedule' (#172) from NotificationSchedule into master --- .../java/ovh/herisson/Clyde/Services/Msg/ForumService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java index 259f5b1..a747d45 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java @@ -8,6 +8,7 @@ import ovh.herisson.Clyde.Repositories.Msg.ForumRepository; import ovh.herisson.Clyde.Repositories.Msg.TopicRepository; import ovh.herisson.Clyde.Services.UserService; import ovh.herisson.Clyde.Tables.Course; +import ovh.herisson.Clyde.Tables.Notification; import ovh.herisson.Clyde.Tables.User; import ovh.herisson.Clyde.Tables.Msg.Answer; import ovh.herisson.Clyde.Tables.Msg.Forum; @@ -25,7 +26,7 @@ public class ForumService { public void createForum(Course c, Forum f){ c.addForum(f); for (User u: f.getRegister()) { - userServ.Notify(u, new Notification("forum.notification.forum.new", data.getSubject(), "/#/Forum")); + userServ.Notify(u, new Notification("forum.notification.forum.new", f.getName(), "/#/Forum")); } courseRepo.save(c); } From a03983d6258d8731a2aaaed1cda2e7890c9865cb Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 00:09:39 +0200 Subject: [PATCH 04/11] fix bar height --- frontend/src/App.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index cc62e8f..78b655e 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -162,12 +162,12 @@ window.addEventListener('hashchange', () => { margin-top: var(--header-size); top:0; left:0; - padding: 25px 0 0; + padding: 25px 0 25px 0; width: 70px ; background-color: rgb(53, 53, 53); border-right:5px; border-color:black; - height: 100%; + height: calc( 100% - var(--header-size) ); position: fixed; overflow: scroll; transition-duration: .3s; From 043f5c87d26818a54fb069429234a7b1b0779e77 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 00:12:59 +0200 Subject: [PATCH 05/11] fixup! fix bar height --- frontend/src/App.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 78b655e..07706b0 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -162,12 +162,12 @@ window.addEventListener('hashchange', () => { margin-top: var(--header-size); top:0; left:0; - padding: 25px 0 25px 0; + padding: 25px 0; width: 70px ; background-color: rgb(53, 53, 53); border-right:5px; border-color:black; - height: calc( 100% - var(--header-size) ); + height: calc( 95% - var(--header-size) ) ; position: fixed; overflow: scroll; transition-duration: .3s; From fcb48ac71a2464943cd5bfba1739a8efa123ed37 Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Mon, 22 Apr 2024 00:39:17 +0200 Subject: [PATCH 06/11] Fixing some little bugs and details --- .../main/java/ovh/herisson/Clyde/EndPoints/UserController.java | 2 +- frontend/src/Apps/Inscription/CourseList.vue | 2 +- frontend/src/Apps/Inscription/ManageRequests.vue | 2 +- frontend/src/Apps/Profil.vue | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java index 1292ad1..15f9cee 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java @@ -44,7 +44,7 @@ public class UserController { @GetMapping("/user/{id}") public ResponseEntity> getUserById(@RequestHeader("Authorization") String token, @PathVariable Long id){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService, Role.Teacher},token)) return new UnauthorizedResponse<>(null); return new ResponseEntity<>(ProtectionService.userWithoutPassword(userService.getUserById(id)), HttpStatus.OK); diff --git a/frontend/src/Apps/Inscription/CourseList.vue b/frontend/src/Apps/Inscription/CourseList.vue index 168aa14..8fcf0cb 100644 --- a/frontend/src/Apps/Inscription/CourseList.vue +++ b/frontend/src/Apps/Inscription/CourseList.vue @@ -80,7 +80,7 @@ function isExempted(course){
- +
diff --git a/frontend/src/Apps/Inscription/ManageRequests.vue b/frontend/src/Apps/Inscription/ManageRequests.vue index a2cccf1..342cc93 100644 --- a/frontend/src/Apps/Inscription/ManageRequests.vue +++ b/frontend/src/Apps/Inscription/ManageRequests.vue @@ -115,7 +115,7 @@
{{item.user.firstName}}
{{item.user.lastName}}
{{ i18n("approval")}}{{item.state}}
-
{{ i18n("teacherapproval") }} : {{item.teacherApprovalState}}
+
{{ i18n("teacherapproval") }} {{item.teacherApprovalState}}
diff --git a/frontend/src/Apps/Profil.vue b/frontend/src/Apps/Profil.vue index d9be6ff..06c5c11 100644 --- a/frontend/src/Apps/Profil.vue +++ b/frontend/src/Apps/Profil.vue @@ -253,7 +253,7 @@ {{ i18n("alreadypaid") }}
- +
From 6e0a9a46e55d5c6d621aa18d85b68a3f7553117a Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Mon, 22 Apr 2024 00:50:44 +0200 Subject: [PATCH 07/11] ok last one I promise --- frontend/public/i18n/EN.txt | 2 +- frontend/public/i18n/FR.txt | 2 +- frontend/src/Apps/Profil.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/public/i18n/EN.txt b/frontend/public/i18n/EN.txt index 30a1a0c..161fc90 100644 --- a/frontend/public/i18n/EN.txt +++ b/frontend/public/i18n/EN.txt @@ -284,7 +284,7 @@ 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 +newcurr=Actual curriculums 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 diff --git a/frontend/public/i18n/FR.txt b/frontend/public/i18n/FR.txt index 0ca8ac4..555ba30 100644 --- a/frontend/public/i18n/FR.txt +++ b/frontend/public/i18n/FR.txt @@ -282,7 +282,7 @@ 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 +newcurr=Cursus actuels 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 diff --git a/frontend/src/Apps/Profil.vue b/frontend/src/Apps/Profil.vue index 06c5c11..7565893 100644 --- a/frontend/src/Apps/Profil.vue +++ b/frontend/src/Apps/Profil.vue @@ -369,7 +369,7 @@
-
+
{{ i18n("oldcursus") }} From 82cf7cbfaf7831cfd88cf5fce18851d19c13d70a Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 01:46:46 +0200 Subject: [PATCH 08/11] removing apps spacing --- frontend/src/App.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 07706b0..32efa13 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -237,8 +237,7 @@ window.addEventListener('hashchange', () => { .text { right: 0%; width: 0%; - visibility: collapse; - opacity: 0; + display:none; color: white; font-size: 1.2em; font-weight: 600; @@ -247,7 +246,7 @@ window.addEventListener('hashchange', () => { ul.vertical:hover .text { opacity:1; - visibility:visible; + display: inline; width: 60%; transition-duration: .3s; padding-left: 15px; From 060526c20d572f149ae86d29e6d55fddddf56f7b Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 09:09:53 +0200 Subject: [PATCH 09/11] timer on notifications --- frontend/src/rest/notifications.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/rest/notifications.js b/frontend/src/rest/notifications.js index 31d0319..e3919db 100644 --- a/frontend/src/rest/notifications.js +++ b/frontend/src/rest/notifications.js @@ -2,9 +2,14 @@ import { ref } from 'vue' import { restGet, restPost } from '@/rest/restConsumer.js' export const notifications = ref([]); +let timerSet = false export function fetchNotifications(){ restGet("/notifications").then( e => notifications.value = e ); + if(!timerSet){ + timerSet = true; + setTimeout(() => {timerSet = false; fetchNotifications()}, 5000); + } } export function archiveNotification(id){ From 2cffe28720227694fe4f39b0ed8cb9850f6df5c2 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 09:22:19 +0200 Subject: [PATCH 10/11] show regno on options --- frontend/src/App.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 32efa13..c79cfae 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -2,7 +2,7 @@ import { toast } from 'vue3-toastify'; import { ref } from 'vue' import i18n, { setLang } from './i18n.js' - import { isLogged } from '@/rest/Users.js' + import { isLogged, getSelf } from '@/rest/Users.js' import { notifications, fetchNotifications, archiveNotification } from '@/rest/notifications.js' import { appList, currentView } from '@/rest/apps.js' @@ -14,9 +14,11 @@ window.onhashchange = function() { currentURL = window.location.hash; } const Logged = ref(isLogged()); +const user = ref(); if(Logged.value){ fetchNotifications(); + getSelf().then(e => user.value = e); } window.addEventListener('hashchange', () => { @@ -49,7 +51,7 @@ window.addEventListener('hashchange', () => {
  • -
    +
  • @@ -75,6 +77,7 @@ window.addEventListener('hashchange', () => { {{i18n("app.manage.profile")}}
  • + RegNo - {{ user.regNo }}
    @@ -133,10 +136,12 @@ window.addEventListener('hashchange', () => { .dropdown { + color:black; margin-top:55px; width:160px; display: inline-block; - height:110px; + /* height:110px; */ + text-align: center; font-size: 13px; position: absolute; z-index: 1; From c61a092809841d7857ec3c193e3509d6d959aeb5 Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Mon, 22 Apr 2024 09:39:48 +0200 Subject: [PATCH 11/11] Add the regNo in profile and aboutStudent --- frontend/src/Apps/Inscription/AboutStudent.vue | 3 +++ frontend/src/Apps/Profil.vue | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/Apps/Inscription/AboutStudent.vue b/frontend/src/Apps/Inscription/AboutStudent.vue index 994be70..6edf038 100644 --- a/frontend/src/Apps/Inscription/AboutStudent.vue +++ b/frontend/src/Apps/Inscription/AboutStudent.vue @@ -32,6 +32,9 @@
    {{ i18n("firstname/name") }} : {{user.firstName}} {{user.lastName}}
    +
    + {{ i18n("regNo") }} : {{user.regNo}} +
    {{ i18n("login.guest.email") }}: {{user.email}}
    diff --git a/frontend/src/Apps/Profil.vue b/frontend/src/Apps/Profil.vue index 7565893..e4e942b 100644 --- a/frontend/src/Apps/Profil.vue +++ b/frontend/src/Apps/Profil.vue @@ -192,10 +192,10 @@
    {{ i18n("login.guest.email") }}: {{user.email}}
    -
    +
    {{ i18n("regNo") }} : {{user.regNo}}
    -
    +
    {{ i18n("role") }}: {{i18n((user.role))}}