Nearly finish
This commit is contained in:
parent
c35f675a11
commit
25c5c1b018
@ -53,6 +53,7 @@ public class MockController {
|
||||
User joe = new User("Mama","Joe","student@student.com","roundabout","DaWarudo",new Date(0), null,Role.Student,passwordEncoder.encode("student"));
|
||||
User meh = new User("Inspiration","lackOf","secretary@secretary.com","a Box","the street",new Date(0), null,Role.Secretary,passwordEncoder.encode("secretary"));
|
||||
User joke = new User("CthemBalls","Lemme","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
|
||||
User joke = new User("hhoo","yeay","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"));
|
||||
mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena));
|
||||
|
||||
@ -91,7 +92,7 @@ public class MockController {
|
||||
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1));
|
||||
|
||||
|
||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Refused,"yes.png","password");
|
||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Pending,"yes.png","password");
|
||||
|
||||
inscriptionService.save(inscriptionRequest);
|
||||
|
||||
|
@ -12,8 +12,10 @@ window.onhashchange = function() {
|
||||
prevURL = currentURL;
|
||||
currentURL = window.location.hash;
|
||||
}
|
||||
const Logged = ref(isLogged());
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
if(location.hash === "#/home" && prevURL === "#/login"){
|
||||
if((location.hash === "#/home" && prevURL === "#/login") || location.hash === "#/home" && prevURL === "#/profil" && !Logged)){
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
@ -24,7 +26,6 @@ window.addEventListener('hashchange', () => {
|
||||
const login=ref(i18n("app.login"))
|
||||
const active=ref(false)
|
||||
|
||||
const Logged = ref(isLogged());
|
||||
|
||||
const apps = ref([])
|
||||
appList().then(e => apps.value = e)
|
||||
|
@ -1,15 +1,22 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {ref} from 'vue'
|
||||
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
|
||||
|
||||
const requests_example = await getAllRegisters();
|
||||
console.log(requests_example);
|
||||
const requests = ref(await getAllRegisters());
|
||||
console.log(requests);
|
||||
|
||||
async function upPage(id,review){
|
||||
await validateRegister(id,review);
|
||||
requests.value = await getAllRegisters();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<template>
|
||||
<div v-for="item of requests_example">
|
||||
<div v-for="item of requests">
|
||||
<div class="bodu" v-if="item.state === 'Pending'">
|
||||
<div class="container">
|
||||
|
||||
@ -17,8 +24,8 @@
|
||||
<div class="surname"><a>{{item.lastName}}</a></div>
|
||||
<div class="firstname"><a>{{item.firstName}}</a></div>
|
||||
<div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}}</button></div>
|
||||
<div class="accept"><button @click="validateRegister(item.id,'Accepted')" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button @click="validateRegister(item.id,'Refused')" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
<div class="accept"><button @click="upPage(item.id,'Accepted')" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button @click="upPage(item.id,'Refused')" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,16 +1,27 @@
|
||||
<script setup>
|
||||
import {reactive, ref } from 'vue'
|
||||
import {getSelf,alterSelf} from '../rest/Users.js'
|
||||
import {getSelf,alterSelf,disconnect,deleteUser} from '../rest/Users.js'
|
||||
import {getSelfCurriculum, getAllCurriculums} from '../rest/curriculum.js'
|
||||
import {getCourses} from "../rest/courses.js"
|
||||
import i18n from "@/i18n.js"
|
||||
import { uploadProfilePicture } from '@/rest/uploads.js'
|
||||
|
||||
const user = await getSelf();
|
||||
console.log(user);
|
||||
const UserCurriculum = ref("");
|
||||
const curricula = ref (await getAllCurriculums());
|
||||
console.log(curricula)
|
||||
console.log(user.role === "Teacher")
|
||||
if(user.role === "Student"){
|
||||
UserCurriculum.value = await getSelfCurriculum();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(user.role === "Teacher"){
|
||||
UserCurriculum.value = await getCourses("Teacher");
|
||||
console.log(UserCurriculum.value)
|
||||
}
|
||||
const modif = ref(false);
|
||||
const curric = ref(false);
|
||||
const unreg = ref(false);
|
||||
const reg = ref(false);
|
||||
|
||||
const pattern = {
|
||||
@ -44,7 +55,16 @@
|
||||
toModify= Object.assign({}, pattern);
|
||||
}
|
||||
|
||||
async function unRegister(){
|
||||
await deleteUser(user.regNo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getPP(){
|
||||
if(user.profilePictureUrl === null){
|
||||
return "/Clyde.png"
|
||||
}
|
||||
return user.profilePictureUrl
|
||||
}
|
||||
</script>
|
||||
@ -57,7 +77,7 @@
|
||||
|
||||
</div>
|
||||
<div class="globalInfos">
|
||||
<div v-if="modif==false && curric==false && unreg==false && reg==false " class="infosContainer" >
|
||||
<div v-if="modif==false && curric==false && reg==false " class="infosContainer" >
|
||||
<div>
|
||||
{{user.firstName}} {{user.lastName}}
|
||||
</div>
|
||||
@ -65,17 +85,17 @@
|
||||
E-mail: {{user.email}}
|
||||
</div>
|
||||
<div v-if="user.role==='Student'">
|
||||
{{user.option}} {{i18n(user.role.toLowerCase())}}
|
||||
{{user.option}} {{i18n(user.role)}}
|
||||
</div>
|
||||
<div v-else>
|
||||
Role: {{i18n((user.role).toLowerCase())}}
|
||||
Role: {{i18n((user.role))}}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="modif=!modif"> {{i18n("profile.modify.data")}} </button>
|
||||
</div>
|
||||
<div v-if="(user.role==='Student')">
|
||||
<button @click="reg=!reg">{{i18n("profile.reRegister")}}</button>
|
||||
<button @click="unreg=!unreg" style="float:right;background-color:rgb(150,0,0);">{{i18n("profile.unRegister")}}</button>
|
||||
<button @click="unRegister()" 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>
|
||||
@ -108,28 +128,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="curric" class="infosContainer">
|
||||
<div>
|
||||
{{i18n("curriculum")}}:
|
||||
<select v-model="curriculum">
|
||||
<option v-for="item in currcula">{{item}}</option>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
E-mail:
|
||||
<input type="mail" v-model="mail">
|
||||
</div>
|
||||
<div>
|
||||
{{i18n("login.password")}}:
|
||||
<input type="password" v-model="assword">
|
||||
</div>
|
||||
<div>
|
||||
{{i18n("login.cPassword")}}:
|
||||
<input type="password" id="confirm">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button @click=" curric=!curric;">{{i18n("courses.confirm")}}</button>
|
||||
<button @click="curric=!curric; resetInputs(personnalInfos,patternInfos);console.log(pattern)" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
<button @click="curric=!curric; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="reg" class="infosContainer">
|
||||
@ -155,43 +163,19 @@
|
||||
<button @click=" reg=!reg; resetInputs(personnalInfos,patternInfos);console.log(pattern)" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="unreg" class="infosContainer">
|
||||
<div>
|
||||
E-mail:
|
||||
<input type="mail" v-model="toModify.email" />
|
||||
</div>
|
||||
<div>
|
||||
{{i18n("profile.address")}}:
|
||||
<input type="text" v-model="toModify.address">
|
||||
</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=" unreg=!unreg;">{{i18n("courses.confirm")}}</button>
|
||||
<button @click=" unreg=!unreg; resetInputs(personnalInfos,patternInfos);console.log(pattern)" style="float:right;">{{i18n("courses.back")}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="modif==false && curric==false && unreg==false && reg==false "class="moreInfos">
|
||||
<div v-if="modif==false && curric==false && reg==false "class="moreInfos">
|
||||
|
||||
<div v-if="(user.role==='Student')">
|
||||
<div v-if="(user.role ==='Student')">
|
||||
<div class="listTitle">
|
||||
{{i18n("profile.course.list")}}
|
||||
</div>
|
||||
<div class="listElement "
|
||||
v-for="item in user.curriculum">
|
||||
<div class="listElement" v-for="item in UserCurriculum.courses">
|
||||
<div class=" containerElement">
|
||||
<div class="name"> {{item.name}} </div>
|
||||
<div class="teacher">{{item.teacher}}</div>
|
||||
<div class="name"> {{item.title}} </div>
|
||||
<div class="teacher">{{item.owner.lastName}}</div>
|
||||
<div class="credits">Credits:{{item.credits}}</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -200,14 +184,6 @@
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<div v-if="(user.role==='Teacher')">
|
||||
<div class="listTitle">
|
||||
{{i18n("profile.course.list")}}
|
||||
</div>
|
||||
<div class="listElement " v-for="item in user.coursesOwned">
|
||||
{{item.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { restGet, restPost, restPatch} from './restConsumer.js'
|
||||
import { restGet, restPost, restPatch, restDelete} from './restConsumer.js'
|
||||
import { getCookie, setCookie } from '@/utils.js'
|
||||
|
||||
export async function login(user, pass, exp){
|
||||
@ -143,3 +143,9 @@ export async function getSelf(){
|
||||
export async function alterSelf(data){
|
||||
return restPatch("/user", data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export async function deleteUser(id){
|
||||
return restDelete("/user/" + id)
|
||||
}
|
||||
|
@ -43,3 +43,8 @@ export async function getcurriculum(id){
|
||||
export async function altercurriculum(id, courses){
|
||||
return restPatch("/curriculum/" + id, courses);
|
||||
}
|
||||
|
||||
|
||||
export async function getSelfCurriculum(){
|
||||
return restGet("/curriculum");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user