Login Finished, add curricula and apps
This commit is contained in:
parent
5a7934b2a3
commit
b67b25b4a4
@ -61,10 +61,17 @@ public class ApplicationsController {
|
|||||||
authorizedApps.add(Applications.Rdv);
|
authorizedApps.add(Applications.Rdv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (posterRole == Role.Teacher || posterRole == Role.Secretary || posterRole == Role.Admin) authorizedApps.add(Applications.ManageCourses);
|
if (posterRole == Role.Teacher || posterRole == Role.Secretary || posterRole == Role.Admin){
|
||||||
|
authorizedApps.add(Applications.ManageCourses);
|
||||||
|
}
|
||||||
|
|
||||||
if (posterRole == Role.InscriptionService || posterRole == Role.Admin) authorizedApps.add(Applications.Inscription);
|
if (posterRole == Role.InscriptionService || posterRole == Role.Admin) {
|
||||||
|
authorizedApps.add(Applications.Inscription);
|
||||||
|
authorizedApps.add(Applications.StudentsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posterRole == Role.Secretary || posterRole == Role.Admin){
|
||||||
|
authorizedApps.add(Applications.UsersList);}
|
||||||
return authorizedApps;
|
return authorizedApps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@ public enum Applications {
|
|||||||
|
|
||||||
// teachers and Secretary authorization
|
// teachers and Secretary authorization
|
||||||
ManageCourses,
|
ManageCourses,
|
||||||
|
UsersList,
|
||||||
|
|
||||||
// InscriptionService authorization
|
// InscriptionService authorization
|
||||||
Inscription
|
Inscription,
|
||||||
|
StudentsList
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,22 @@
|
|||||||
import { isLogged } from '@/rest/Users.js'
|
import { isLogged } from '@/rest/Users.js'
|
||||||
|
|
||||||
import { appList, currentView } from '@/rest/apps.js'
|
import { appList, currentView } from '@/rest/apps.js'
|
||||||
|
var prevURL;
|
||||||
|
var currentURL = window.location.hash;
|
||||||
|
|
||||||
|
window.onhashchange = function() {
|
||||||
|
prevURL = currentURL;
|
||||||
|
currentURL = window.location.hash;
|
||||||
|
}
|
||||||
|
console.log(location)
|
||||||
|
window.addEventListener('hashchange', () => {
|
||||||
|
console.log(prevURL)
|
||||||
|
console.log(location.hash)
|
||||||
|
console.log(isLogged())
|
||||||
|
if(location.hash === "#/home" && prevURL === "#/login"){
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const home=ref(i18n("app.home"))
|
const home=ref(i18n("app.home"))
|
||||||
const notifications=ref(i18n("app.notifications"))
|
const notifications=ref(i18n("app.notifications"))
|
||||||
@ -66,7 +82,7 @@
|
|||||||
<div class="leftBar">
|
<div class="leftBar">
|
||||||
<ul class="vertical">
|
<ul class="vertical">
|
||||||
<li v-for="app in apps">
|
<li v-for="app in apps">
|
||||||
<a href="app.path">
|
<a :href="app.path">
|
||||||
<div class="fa-solid" :class="app.icon" style="font-size: 40px;"></div>
|
<div class="fa-solid" :class="app.icon" style="font-size: 40px;"></div>
|
||||||
<div class="text">{{app.text}}</div>
|
<div class="text">{{app.text}}</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import Req from "./Request.vue"
|
import Req from "./Request.vue"
|
||||||
import { getRegisters } from '@/rest/ServiceInscription.js'
|
import { getRegisters } from '@/rest/ServiceInscription.js'
|
||||||
|
|
||||||
const requests_example = getRegisters();
|
const requests_example = await getRegisters();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import i18n from '@/i18n.js'
|
import i18n from '@/i18n.js'
|
||||||
import { login , register , disconnect} from '@/rest/Users.js'
|
import { login , register , disconnect, isLogged} from '@/rest/Users.js'
|
||||||
import { getAllCurriculums } from '@/rest/curriculum.js'
|
import { getAllCurriculums } from '@/rest/curriculum.js'
|
||||||
import { uploadProfilePicture } from '@/rest/uploads.js'
|
import { uploadProfilePicture } from '@/rest/uploads.js'
|
||||||
import {toast} from 'vue3-toastify'
|
import {toast} from 'vue3-toastify'
|
||||||
@ -25,12 +25,14 @@
|
|||||||
const imageSaved = ref(false)
|
const imageSaved = ref(false)
|
||||||
const ppData = ref(false)
|
const ppData = ref(false)
|
||||||
|
|
||||||
const curricula=getAllCurriculums();
|
const curricula= await getAllCurriculums();
|
||||||
|
|
||||||
function goBackHome(){
|
function goBackHome(){
|
||||||
window.location.href='#/home'
|
setTimeout(() => {
|
||||||
|
console.log("Delayed for 1 second.");
|
||||||
|
window.location.href="#/home";
|
||||||
|
}, "500");
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyInputs(){
|
function verifyInputs(){
|
||||||
if(password.value==passwordConfirm.value){
|
if(password.value==passwordConfirm.value){
|
||||||
page.value++;
|
page.value++;
|
||||||
@ -42,7 +44,9 @@
|
|||||||
return toast('Password and Confirm Password are different',{type: "error",});
|
return toast('Password and Confirm Password are different',{type: "error",});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnect()
|
if (isLogged()){
|
||||||
|
disconnect();
|
||||||
|
window.location.reload();}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -51,7 +55,7 @@
|
|||||||
<div class='loginBox'>
|
<div class='loginBox'>
|
||||||
|
|
||||||
<div v-if="loginPage">
|
<div v-if="loginPage">
|
||||||
<form @submit.prevent="login(email, password);goBackHome();"class="form">
|
<form @submit.prevent=" login(email,password);goBackHome();"class="form">
|
||||||
<h1 style="color:rgb(239,60,168); font-family: sans-serif;">
|
<h1 style="color:rgb(239,60,168); font-family: sans-serif;">
|
||||||
{{i18n("login.guest.signin")}}
|
{{i18n("login.guest.signin")}}
|
||||||
</h1>
|
</h1>
|
||||||
@ -127,12 +131,12 @@
|
|||||||
<div class="inputBox">
|
<div class="inputBox">
|
||||||
<p>{{i18n("curriculum").toUpperCase()}}</p>
|
<p>{{i18n("curriculum").toUpperCase()}}</p>
|
||||||
<select v-model="curriculum">
|
<select v-model="curriculum">
|
||||||
<option v-for="item in currcula">{{item}}</option>
|
<option v-for="item in curricula">{{item.option}}</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div style="align-self:center;" class="inputBox">
|
<div style="align-self:center;" class="inputBox">
|
||||||
<button style="margin-top:25px;" @click="console.log(outputs);register(firstname, surname, birthday, password, mail, address, country, curriculum);">
|
<button style="margin-top:25px;" @click="console.log(outputs);register(firstname, surname, birthday, password, mail, address, country, curriculum);goBackHome();">
|
||||||
{{i18n("login.guest.submit")}}
|
{{i18n("login.guest.submit")}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,12 +7,16 @@ import LoginPage from '@/Apps/Login.vue'
|
|||||||
import Inscription from "@/Apps/Inscription.vue"
|
import Inscription from "@/Apps/Inscription.vue"
|
||||||
import Profil from "@/Apps/Profil.vue"
|
import Profil from "@/Apps/Profil.vue"
|
||||||
import Courses from "@/Apps/ManageCourses.vue"
|
import Courses from "@/Apps/ManageCourses.vue"
|
||||||
|
import Users from "@/Apps/UsersList.vue"
|
||||||
|
import Students from "@/Apps/StudentsList.vue"
|
||||||
|
|
||||||
const apps = {
|
const apps = {
|
||||||
'/login': LoginPage,
|
'/login': LoginPage,
|
||||||
'/inscription': Inscription,
|
'/inscription': Inscription,
|
||||||
'/profil': Profil,
|
'/profil': Profil,
|
||||||
'/manage-courses' : Courses,
|
'/manage-courses' : Courses,
|
||||||
|
'/users-list' : Users,
|
||||||
|
'/students-list' : Students,
|
||||||
}
|
}
|
||||||
|
|
||||||
const appsList = {
|
const appsList = {
|
||||||
@ -22,6 +26,8 @@ const appsList = {
|
|||||||
'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
|
'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
|
||||||
'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
|
'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
|
||||||
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
|
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
|
||||||
|
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
|
||||||
|
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentPath = ref(window.location.hash)
|
const currentPath = ref(window.location.hash)
|
||||||
|
@ -20,7 +20,7 @@ export async function deletecurriculum(id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getAllCurriculums(){
|
export async function getAllCurriculums(){
|
||||||
return restGet("/curriculum");
|
return restGet("/curriculums");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user