Compare commits

..

No commits in common. "8d1235be92f9b1ff9541ad86309e61085fed6b7a" and "ca6f676fb77b7217c6091af0af399b5b273db889" have entirely different histories.

8 changed files with 95 additions and 50 deletions

View File

@ -2,7 +2,7 @@
import { toast } from 'vue3-toastify'; import { toast } from 'vue3-toastify';
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import i18n, { setLang } from './i18n.js' import i18n, { setLang } from './i18n.js'
import { getUser } from './rest/Users.js'
// Liste des apps // Liste des apps
import LoginPage from './Apps/Login.vue' import LoginPage from './Apps/Login.vue'
@ -51,6 +51,8 @@
<a class="icon" href="#home"> <a class="icon" href="#home">
<div class=" fa-solid fa-house" style="margin-top: 7px; margin-bottom: 3px;"></div> <div class=" fa-solid fa-house" style="margin-top: 7px; margin-bottom: 3px;"></div>
</a></li> </a></li>
<li><button @click="console.log(getUser())"/> </li>
<li style="float: right;" title=login> <li style="float: right;" title=login>
<a class="icon" href="#/login"> <a class="icon" href="#/login">
<div class="fa-solid fa-user" style="margin-top: 7px; margin-bottom: 3px;"></div> <div class="fa-solid fa-user" style="margin-top: 7px; margin-bottom: 3px;"></div>

View File

@ -2,7 +2,6 @@
import { ref } from 'vue' import { ref } from 'vue'
import i18n from '@/i18n.js' import i18n from '@/i18n.js'
import { login , register } from '@/rest/Users.js' import { login , register } from '@/rest/Users.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'
import 'vue3-toastify/dist/index.css'; import 'vue3-toastify/dist/index.css';
@ -25,10 +24,8 @@
const imageSaved = ref(false) const imageSaved = ref(false)
const ppData = ref(false) const ppData = ref(false)
const curricula=getAllCurriculums();
function goBackHome(){ function goBackHome(){
window.location.href='#/home' window.location.href='#home'
} }
function verifyInputs(){ function verifyInputs(){
@ -125,8 +122,9 @@
<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 value="Chemistry">Chemistry</option>
<option value="Psycho">Psychology</option>
<option value="IT">IT</option>
</select> </select>
</div> </div>
<div style="align-self:center;" class="inputBox"> <div style="align-self:center;" class="inputBox">

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {ref} from 'vue' 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" import { getTeachers } from "@/rest/Users.js"
const curriculum = await getCourses() const curriculum = await getCourses()
@ -19,6 +19,8 @@
//Juste pour montrer le Create Mode //Juste pour montrer le Create Mode
const pattern = { const pattern = {
"id": 0,
"name": null, "name": null,
"credits": null, "credits": null,
"faculty": null, "faculty": null,
@ -28,8 +30,12 @@
let toAdd = Object.assign({}, pattern); let toAdd = Object.assign({}, pattern);
function addToCourse(){ function addToCourse (){
if (curriculum.length>0){ if (curriculum.length>0){
toAdd.id=(curriculum[curriculum.length-1].id)-1;}
else{
toAdd.id=0;
}
let isnull= false; let isnull= false;
for(const [key, value] of Object.entries(toAdd)){ for(const [key, value] of Object.entries(toAdd)){
if(value === null){ if(value === null){
@ -37,16 +43,31 @@
} }
} }
if (!isnull){ if (!isnull){
createCourse(toAdd.name,toAdd.credits,toAdd.faculty,toAdd.teacher,toAdd.Assistants); curriculum.push(toAdd);
} }
toAdd= Object.assign({},pattern); toAdd= Object.assign({},pattern);
} }
}
//Juste pour montrer le Delete Mode //Juste pour montrer le Delete Mode
let toRemove; let toRemove;
function removeCourse(course) { function removeCourse() {
deleteCourse(course.id) 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> </script>
@ -101,7 +122,7 @@
{{i18n("login.cPassword")}} : {{i18n("login.cPassword")}} :
<input> <input>
</div> </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> <button style="float:right;" @click="deleteMod=!deleteMod"> {{i18n("courses.back")}}</button>
</form> </form>
</div> </div>

View File

@ -1,11 +1,40 @@
<script setup> <script setup>
import {reactive, ref } from 'vue' import {reactive, ref } from 'vue'
import {getSelf} from '../rest/Users.js' import {getUser} from '../rest/Users.js'
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import { uploadProfilePicture } from '@/rest/uploads.js' import { uploadProfilePicture } from '@/rest/uploads.js'
const user = getSelf(); /*
console.log(user.role) const user = getUser();
console.log("test") */
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 Teacher user
const user =reactive({ const user =reactive({
@ -38,6 +67,8 @@ const modif = ref(false);
const curric = ref(false); const curric = ref(false);
const unreg = ref(false); const unreg = ref(false);
const reg = ref(false); const reg = ref(false);
const toModify = Object.assign({}, user); const toModify = Object.assign({}, user);
function getPP(){ function getPP(){
@ -57,28 +88,28 @@ function getPP(){
<div class="globalInfos"> <div class="globalInfos">
<div v-if="modif==false" class="infosContainer" > <div v-if="modif==false" class="infosContainer" >
<div> <div>
{{user.firstName}} {{user.lastName}} {{user.firstname}} {{user.lastname.toUpperCase()}}
</div> </div>
<div> <div>
E-mail: {{user.email}} E-mail: {{user.email}}
</div> </div>
<div v-if="user.role=='Student'"> <div v-if="user.role==='student'">
{{user.option}} {{i18n(user.role)}} {{user.option}} {{i18n(user.role).toUpperCase()}}
</div> </div>
<div v-else> <div v-else>
{{i18n("faculty")}}: {{user.faculty}} {{i18n("faculty")}}: {{user.faculty}}
Role: {{i18n(user.role)}} Role: {{i18n(user.role).toUpperCase()}}
</div> </div>
<div> <div>
<button @click="modif=!modif"> {{i18n("profile.modify.data")}} </button> <button @click="modif=!modif"> {{i18n("profile.modify.data")}} </button>
</div> </div>
<div v-if="(user.role=='student')"> <div v-if="(user.role==='student')">
<button @click="reg=!reg">{{i18n("profile.reRegister")}}</button> <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="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> <button @click="curric=!curric">{{i18n("profile.change.curriculum")}}</button>
</div> </div>
</div> </div>
<div v-else class="infosContainer"> <div v-else class="infosContainer">
<div> <div>
@ -108,7 +139,7 @@ function getPP(){
</div> </div>
<div v-if="modif==false"class="moreInfos"> <div v-if="modif==false"class="moreInfos">
<div v-if="(user.role=='student')"> <div v-if="(user.role==='student')">
<div class="listTitle"> <div class="listTitle">
{{i18n("profile.course.list")}} {{i18n("profile.course.list")}}
</div> </div>
@ -125,7 +156,7 @@ function getPP(){
<div> <div>
</div> </div>
<div v-if="(user.role=='teacher')"> <div v-if="(user.role==='teacher')">
<div class="listTitle"> <div class="listTitle">
{{i18n("profile.course.list")}} {{i18n("profile.course.list")}}
</div> </div>

View File

@ -1,6 +1,5 @@
<script setup> <script setup>
import i18n from "@/i18n.js" import i18n from "@/i18n.js"
import {validateRegister} from "@/rest/ServiceInscription.js"
const props = defineProps({ const props = defineProps({
id: Number, id: Number,
type: String, type: String,
@ -23,8 +22,8 @@
<div class="surname"><a>{{lastName}}</a></div> <div class="surname"><a>{{lastName}}</a></div>
<div class="firstname"><a>{{firstName}}</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="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="accept"><button 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="refuse"><button style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
</div> </div>
</div> </div>
</template> </template>

View File

@ -60,6 +60,8 @@ const users =[{
password:"CeciEstUnMotDePasse123", password:"CeciEstUnMotDePasse123",
}] }]
console.log(users[0])
</script> </script>
<template> <template>
<div v-for="item in users"> <div v-for="item in users">

View File

@ -106,10 +106,6 @@ export async function getTeachers(){
return restGet("/users/teacher") return restGet("/users/teacher")
} }
export async function getStudents(){
return restGet("/users/student")
}
/** /**
* Get informations about yourself * Get informations about yourself
* - RegNo * - RegNo

View File

@ -2,7 +2,7 @@
* curriculum API * 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) * Create a new curriculum (bundle of courses)
@ -19,10 +19,6 @@ export async function deletecurriculum(id){
return restDelete("/curriculum/" + id); return restDelete("/curriculum/" + id);
} }
export async function getAllCurriculums(){
return restGet("/curriculum");
}
/** /**
* Get informations on a particular curriculum * Get informations on a particular curriculum
* *