Login Finished, add curricula and apps
This commit is contained in:
		@ -61,10 +61,17 @@ public class ApplicationsController {
 | 
			
		||||
            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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,9 @@ public enum Applications {
 | 
			
		||||
 | 
			
		||||
    // teachers and Secretary authorization
 | 
			
		||||
    ManageCourses,
 | 
			
		||||
    UsersList,
 | 
			
		||||
 | 
			
		||||
    // InscriptionService authorization
 | 
			
		||||
    Inscription
 | 
			
		||||
    Inscription,
 | 
			
		||||
    StudentsList
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,22 @@
 | 
			
		||||
  import { isLogged } from '@/rest/Users.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 notifications=ref(i18n("app.notifications"))
 | 
			
		||||
@ -66,7 +82,7 @@
 | 
			
		||||
    <div class="leftBar">
 | 
			
		||||
    <ul class="vertical">
 | 
			
		||||
        <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="text">{{app.text}}</div>
 | 
			
		||||
						</a>
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
  import Req from "./Request.vue"
 | 
			
		||||
  import { getRegisters } from '@/rest/ServiceInscription.js'
 | 
			
		||||
 | 
			
		||||
  const requests_example = getRegisters();
 | 
			
		||||
  const requests_example = await getRegisters();
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import { ref } from 'vue'
 | 
			
		||||
  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 { uploadProfilePicture } from '@/rest/uploads.js'
 | 
			
		||||
  import {toast} from 'vue3-toastify'
 | 
			
		||||
@ -25,12 +25,14 @@
 | 
			
		||||
  const imageSaved = ref(false)
 | 
			
		||||
  const ppData = ref(false)
 | 
			
		||||
 | 
			
		||||
  const curricula=getAllCurriculums();
 | 
			
		||||
  const curricula= await getAllCurriculums();
 | 
			
		||||
  
 | 
			
		||||
  function goBackHome(){
 | 
			
		||||
     window.location.href='#/home'
 | 
			
		||||
    setTimeout(() => {
 | 
			
		||||
      console.log("Delayed for 1 second.");
 | 
			
		||||
      window.location.href="#/home";
 | 
			
		||||
      }, "500");
 | 
			
		||||
 } 
 | 
			
		||||
 | 
			
		||||
  function verifyInputs(){
 | 
			
		||||
    if(password.value==passwordConfirm.value){
 | 
			
		||||
      page.value++;
 | 
			
		||||
@ -42,7 +44,9 @@
 | 
			
		||||
    return toast('Password and Confirm Password are different',{type: "error",});
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  disconnect()
 | 
			
		||||
  if (isLogged()){
 | 
			
		||||
  disconnect();
 | 
			
		||||
  window.location.reload();}
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
@ -127,12 +131,12 @@
 | 
			
		||||
              <div class="inputBox">
 | 
			
		||||
                <p>{{i18n("curriculum").toUpperCase()}}</p> 
 | 
			
		||||
                  <select v-model="curriculum">
 | 
			
		||||
                    <option v-for="item in currcula">{{item}}</option>
 | 
			
		||||
                    <option v-for="item in curricula">{{item.option}}</option>
 | 
			
		||||
                    
 | 
			
		||||
                  </select>
 | 
			
		||||
              </div>
 | 
			
		||||
              <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")}}
 | 
			
		||||
                </button>
 | 
			
		||||
              </div>
 | 
			
		||||
 | 
			
		||||
@ -7,12 +7,16 @@ import LoginPage from '@/Apps/Login.vue'
 | 
			
		||||
import Inscription from "@/Apps/Inscription.vue"
 | 
			
		||||
import Profil from "@/Apps/Profil.vue"
 | 
			
		||||
import Courses from "@/Apps/ManageCourses.vue"
 | 
			
		||||
import Users from "@/Apps/UsersList.vue"
 | 
			
		||||
import Students from "@/Apps/StudentsList.vue"
 | 
			
		||||
 | 
			
		||||
const apps = {
 | 
			
		||||
		'/login': LoginPage,
 | 
			
		||||
		'/inscription': Inscription,
 | 
			
		||||
		'/profil': Profil,
 | 
			
		||||
		'/manage-courses' : Courses,
 | 
			
		||||
		'/users-list' : Users,
 | 
			
		||||
		'/students-list' : Students,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const appsList = {
 | 
			
		||||
@ -22,6 +26,8 @@ const appsList = {
 | 
			
		||||
		'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
 | 
			
		||||
		'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
 | 
			
		||||
		'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
 | 
			
		||||
		'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
 | 
			
		||||
		'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const currentPath = ref(window.location.hash)
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ export async function deletecurriculum(id){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getAllCurriculums(){
 | 
			
		||||
  return restGet("/curriculum");
 | 
			
		||||
  return restGet("/curriculums");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user