Compare commits
No commits in common. "8d1235be92f9b1ff9541ad86309e61085fed6b7a" and "ca6f676fb77b7217c6091af0af399b5b273db889" have entirely different histories.
8d1235be92
...
ca6f676fb7
@ -2,7 +2,7 @@
|
||||
import { toast } from 'vue3-toastify';
|
||||
import { ref, computed } from 'vue'
|
||||
import i18n, { setLang } from './i18n.js'
|
||||
|
||||
import { getUser } from './rest/Users.js'
|
||||
|
||||
// Liste des apps
|
||||
import LoginPage from './Apps/Login.vue'
|
||||
@ -51,6 +51,8 @@
|
||||
<a class="icon" href="#home">
|
||||
<div class=" fa-solid fa-house" style="margin-top: 7px; margin-bottom: 3px;"></div>
|
||||
</a></li>
|
||||
|
||||
<li><button @click="console.log(getUser())"/> </li>
|
||||
<li style="float: right;" title=login>
|
||||
<a class="icon" href="#/login">
|
||||
<div class="fa-solid fa-user" style="margin-top: 7px; margin-bottom: 3px;"></div>
|
||||
|
@ -2,7 +2,6 @@
|
||||
import { ref } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
import { login , register } from '@/rest/Users.js'
|
||||
import { getAllCurriculums } from '@/rest/curriculum.js'
|
||||
import { uploadProfilePicture } from '@/rest/uploads.js'
|
||||
import {toast} from 'vue3-toastify'
|
||||
import 'vue3-toastify/dist/index.css';
|
||||
@ -25,10 +24,8 @@
|
||||
const imageSaved = ref(false)
|
||||
const ppData = ref(false)
|
||||
|
||||
const curricula=getAllCurriculums();
|
||||
|
||||
function goBackHome(){
|
||||
window.location.href='#/home'
|
||||
window.location.href='#home'
|
||||
}
|
||||
|
||||
function verifyInputs(){
|
||||
@ -125,8 +122,9 @@
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("curriculum").toUpperCase()}}</p>
|
||||
<select v-model="curriculum">
|
||||
<option v-for="item in currcula">{{item}}</option>
|
||||
|
||||
<option value="Chemistry">Chemistry</option>
|
||||
<option value="Psycho">Psychology</option>
|
||||
<option value="IT">IT</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="align-self:center;" class="inputBox">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {ref} from 'vue'
|
||||
import { getCourses,deleteCourse,alterCourse,createCourse } from "@/rest/courses.js"
|
||||
import { getCourses } from "@/rest/courses.js"
|
||||
import { getTeachers } from "@/rest/Users.js"
|
||||
|
||||
const curriculum = await getCourses()
|
||||
@ -19,6 +19,8 @@
|
||||
|
||||
//Juste pour montrer le Create Mode
|
||||
const pattern = {
|
||||
|
||||
"id": 0,
|
||||
"name": null,
|
||||
"credits": null,
|
||||
"faculty": null,
|
||||
@ -28,26 +30,45 @@
|
||||
|
||||
let toAdd = Object.assign({}, pattern);
|
||||
|
||||
function addToCourse(){
|
||||
if (curriculum.length>0){
|
||||
let isnull= false;
|
||||
for(const [key, value] of Object.entries(toAdd)){
|
||||
if(value === null){
|
||||
isnull=true;
|
||||
}
|
||||
function addToCourse (){
|
||||
if (curriculum.length>0){
|
||||
toAdd.id=(curriculum[curriculum.length-1].id)-1;}
|
||||
else{
|
||||
toAdd.id=0;
|
||||
}
|
||||
let isnull= false;
|
||||
for(const [key, value] of Object.entries(toAdd)){
|
||||
if(value === null){
|
||||
isnull=true;
|
||||
}
|
||||
if (!isnull){
|
||||
createCourse(toAdd.name,toAdd.credits,toAdd.faculty,toAdd.teacher,toAdd.Assistants);
|
||||
}
|
||||
toAdd= Object.assign({},pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnull){
|
||||
curriculum.push(toAdd);
|
||||
}
|
||||
toAdd= Object.assign({},pattern);
|
||||
}
|
||||
|
||||
|
||||
//Juste pour montrer le Delete Mode
|
||||
let toRemove;
|
||||
|
||||
function removeCourse(course) {
|
||||
deleteCourse(course.id)
|
||||
}
|
||||
function removeCourse() {
|
||||
console.log("ok");
|
||||
console.log(toRemove);
|
||||
let rem=-1;
|
||||
for(const [key, value] of Object.entries(curriculum)){
|
||||
console.log(key);
|
||||
console.log(value)
|
||||
if(value.name === toRemove){
|
||||
rem = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log(rem)
|
||||
if (rem > -1){
|
||||
curriculum.splice(rem, 1);}
|
||||
console.log(curriculum);
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
@ -101,7 +122,7 @@
|
||||
{{i18n("login.cPassword")}} :
|
||||
<input>
|
||||
</div>
|
||||
<button class="delete" @click="deleteMod=!deleteMod;removeCourse(toRemove);"> {{i18n("courses.deleteCourse")}} </button>
|
||||
<button class="delete" @click="deleteMod=!deleteMod;removeCourse();"> {{i18n("courses.deleteCourse")}} </button>
|
||||
<button style="float:right;" @click="deleteMod=!deleteMod"> {{i18n("courses.back")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -1,11 +1,40 @@
|
||||
<script setup>
|
||||
import {reactive, ref } from 'vue'
|
||||
import {getSelf} from '../rest/Users.js'
|
||||
import {getUser} from '../rest/Users.js'
|
||||
import i18n from "@/i18n.js"
|
||||
import { uploadProfilePicture } from '@/rest/uploads.js'
|
||||
const user = getSelf();
|
||||
console.log(user.role)
|
||||
console.log("test")
|
||||
/*
|
||||
const user = getUser();
|
||||
*/
|
||||
const user=reactive({
|
||||
profilePicture:"/Clyde.png",
|
||||
lastname:"Ghost",
|
||||
firstname:"Clyde",
|
||||
role:"student",
|
||||
address: "Radiator Springs",
|
||||
email:"ClydeGhost@gmail.com",
|
||||
curriculum:[
|
||||
{
|
||||
"id": 12,
|
||||
"name": "Math pour l'info",
|
||||
"credits": 11,
|
||||
"faculty": "science",
|
||||
"teacher": 42,
|
||||
"Assistants": []},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "Fonctionnement des ordinateurs",
|
||||
"credits": 11,
|
||||
"faculty": "science",
|
||||
"teacher": 42,
|
||||
"Assistants": []},
|
||||
|
||||
],
|
||||
option:"IT",
|
||||
degree:"BAC1",
|
||||
password:"CeciEstUnMotDePasse123",
|
||||
})
|
||||
|
||||
/*
|
||||
Teacher user
|
||||
const user =reactive({
|
||||
@ -38,6 +67,8 @@ const modif = ref(false);
|
||||
const curric = ref(false);
|
||||
const unreg = ref(false);
|
||||
const reg = ref(false);
|
||||
|
||||
|
||||
const toModify = Object.assign({}, user);
|
||||
|
||||
function getPP(){
|
||||
@ -57,28 +88,28 @@ function getPP(){
|
||||
<div class="globalInfos">
|
||||
<div v-if="modif==false" class="infosContainer" >
|
||||
<div>
|
||||
{{user.firstName}} {{user.lastName}}
|
||||
{{user.firstname}} {{user.lastname.toUpperCase()}}
|
||||
</div>
|
||||
<div>
|
||||
E-mail: {{user.email}}
|
||||
</div>
|
||||
<div v-if="user.role=='Student'">
|
||||
{{user.option}} {{i18n(user.role)}}
|
||||
<div v-if="user.role==='student'">
|
||||
{{user.option}} {{i18n(user.role).toUpperCase()}}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{i18n("faculty")}}: {{user.faculty}}
|
||||
Role: {{i18n(user.role)}}
|
||||
Role: {{i18n(user.role).toUpperCase()}}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="modif=!modif"> {{i18n("profile.modify.data")}} </button>
|
||||
</div>
|
||||
<div v-if="(user.role=='student')">
|
||||
<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>
|
||||
</div>
|
||||
<div>
|
||||
<button @click="curric=!curric">{{i18n("profile.change.curriculum")}}</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div v-else class="infosContainer">
|
||||
<div>
|
||||
@ -108,7 +139,7 @@ function getPP(){
|
||||
</div>
|
||||
<div v-if="modif==false"class="moreInfos">
|
||||
|
||||
<div v-if="(user.role=='student')">
|
||||
<div v-if="(user.role==='student')">
|
||||
<div class="listTitle">
|
||||
{{i18n("profile.course.list")}}
|
||||
</div>
|
||||
@ -125,7 +156,7 @@ function getPP(){
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<div v-if="(user.role=='teacher')">
|
||||
<div v-if="(user.role==='teacher')">
|
||||
<div class="listTitle">
|
||||
{{i18n("profile.course.list")}}
|
||||
</div>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {validateRegister} from "@/rest/ServiceInscription.js"
|
||||
const props = defineProps({
|
||||
id: Number,
|
||||
type: String,
|
||||
@ -23,8 +22,8 @@
|
||||
<div class="surname"><a>{{lastName}}</a></div>
|
||||
<div class="firstname"><a>{{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(id,Accepted)" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button @click="validateRegister(id,Refused)" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
<div class="accept"><button style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -60,6 +60,8 @@ const users =[{
|
||||
password:"CeciEstUnMotDePasse123",
|
||||
}]
|
||||
|
||||
console.log(users[0])
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div v-for="item in users">
|
||||
|
@ -106,10 +106,6 @@ export async function getTeachers(){
|
||||
return restGet("/users/teacher")
|
||||
}
|
||||
|
||||
|
||||
export async function getStudents(){
|
||||
return restGet("/users/student")
|
||||
}
|
||||
/**
|
||||
* Get informations about yourself
|
||||
* - RegNo
|
||||
|
@ -2,7 +2,7 @@
|
||||
* curriculum API
|
||||
*/
|
||||
|
||||
import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
|
||||
import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* Create a new curriculum (bundle of courses)
|
||||
@ -19,10 +19,6 @@ export async function deletecurriculum(id){
|
||||
return restDelete("/curriculum/" + id);
|
||||
}
|
||||
|
||||
export async function getAllCurriculums(){
|
||||
return restGet("/curriculum");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get informations on a particular curriculum
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user