base
This commit is contained in:
@ -52,3 +52,4 @@ Curriculum=curriculum
|
||||
Credits=Credits
|
||||
InscriptionService=I.S.
|
||||
faculty=Faculty
|
||||
msg.notification.new=You have a new message
|
||||
|
@ -52,3 +52,4 @@ Curriculum=Cursus
|
||||
Credits=Credits
|
||||
InscriptionService=S.I.
|
||||
faculty=Faculté
|
||||
msg.notification.new=Vous avez un nouveau message!
|
||||
|
@ -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,16 +15,20 @@ window.onhashchange = function() {
|
||||
}
|
||||
const Logged = ref(isLogged());
|
||||
|
||||
if(Logged){
|
||||
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([])
|
||||
@ -46,11 +51,14 @@ 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: orange' : ''" 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>
|
||||
<a class="icon" @click.cancel="notification = !notification">
|
||||
<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"> {{ i18n(notif.subject) }} - {{ notif.body }}</li>
|
||||
</ul>
|
||||
</a></li>
|
||||
<li @click="active=!active" class="option"style="float: right;" title=settings>
|
||||
<a class="icon" >
|
||||
@ -219,8 +227,6 @@ window.addEventListener('hashchange', () => {
|
||||
background-color: black;
|
||||
border-radius:6px;
|
||||
color:white;
|
||||
transform: translate(0px ,1px);
|
||||
|
||||
}
|
||||
|
||||
ul.vertical:hover {
|
||||
@ -252,6 +258,15 @@ window.addEventListener('hashchange', () => {
|
||||
.clyde:hover{
|
||||
content: url("./assets/angry_clyde.png")
|
||||
}
|
||||
|
||||
#notification{
|
||||
position: absolute;
|
||||
top: 61px;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
width: 300px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
12
frontend/src/rest/notifications.js
Normal file
12
frontend/src/rest/notifications.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { ref } from 'vue'
|
||||
import { restGet, restPost } from '@/rest/restConsumer.js'
|
||||
|
||||
export const notifications = ref({});
|
||||
|
||||
export function fetchNotifications(){
|
||||
restGet("/notifications").then( e => notifications.value = e );
|
||||
}
|
||||
|
||||
export function archiveNotification(id){
|
||||
restPost("/notifications/" + id).then( e => fetchNotifications() );
|
||||
}
|
Reference in New Issue
Block a user