1
0
forked from PGL/Clyde

again links

This commit is contained in:
Wawilski 2024-03-16 14:31:44 +01:00
parent e84e34d735
commit 8d1235be92
6 changed files with 39 additions and 90 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,8 +51,6 @@
<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

@ -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 } from "@/rest/courses.js" import { getCourses,deleteCourse,alterCourse,createCourse } 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,8 +19,6 @@
//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,
@ -30,45 +28,26 @@
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;} let isnull= false;
else{ for(const [key, value] of Object.entries(toAdd)){
toAdd.id=0; if(value === null){
} isnull=true;
let isnull= false; }
for(const [key, value] of Object.entries(toAdd)){
if(value === null){
isnull=true;
} }
} 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() { function removeCourse(course) {
console.log("ok"); deleteCourse(course.id)
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>
<template> <template>
@ -122,7 +101,7 @@
{{i18n("login.cPassword")}} : {{i18n("login.cPassword")}} :
<input> <input>
</div> </div>
<button class="delete" @click="deleteMod=!deleteMod;removeCourse();"> {{i18n("courses.deleteCourse")}} </button> <button class="delete" @click="deleteMod=!deleteMod;removeCourse(toRemove);"> {{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,40 +1,11 @@
<script setup> <script setup>
import {reactive, ref } from 'vue' import {reactive, ref } from 'vue'
import {getUser} from '../rest/Users.js' import {getSelf} 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();
const user = getUser(); console.log(user.role)
*/ 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({
@ -67,8 +38,6 @@ 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(){
@ -88,28 +57,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.toUpperCase()}} {{user.firstName}} {{user.lastName}}
</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).toUpperCase()}} {{user.option}} {{i18n(user.role)}}
</div> </div>
<div v-else> <div v-else>
{{i18n("faculty")}}: {{user.faculty}} {{i18n("faculty")}}: {{user.faculty}}
Role: {{i18n(user.role).toUpperCase()}} Role: {{i18n(user.role)}}
</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>
@ -139,7 +108,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>
@ -156,7 +125,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,5 +1,6 @@
<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,
@ -22,8 +23,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 style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</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 style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div> <div class="refuse"><button @click="validateRegister(id,Refused)" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
</div> </div>
</div> </div>
</template> </template>

View File

@ -60,8 +60,6 @@ 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,6 +106,10 @@ 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