again links
This commit is contained in:
		| @ -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,8 +51,6 @@ | ||||
|             <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> | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| <script setup> | ||||
|   import i18n from "@/i18n.js" | ||||
|   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" | ||||
|  | ||||
|   const curriculum = await getCourses() | ||||
| @ -19,8 +19,6 @@ | ||||
|  | ||||
|   //Juste pour montrer le Create Mode | ||||
|   const pattern = { | ||||
|  | ||||
|   "id": 0, | ||||
|   "name": null, | ||||
|   "credits": null, | ||||
|   "faculty": null, | ||||
| @ -30,45 +28,26 @@ | ||||
|  | ||||
|   let toAdd = Object.assign({}, pattern); | ||||
|  | ||||
|   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; | ||||
|   function addToCourse(){ | ||||
|     if (curriculum.length>0){ | ||||
|       let isnull= false; | ||||
|       for(const [key, value] of Object.entries(toAdd)){ | ||||
|         if(value === null){ | ||||
|           isnull=true; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|       if (!isnull){ | ||||
|       curriculum.push(toAdd); | ||||
|       } | ||||
|       toAdd= Object.assign({},pattern); | ||||
|     }  | ||||
|    | ||||
|  | ||||
|         if (!isnull){ | ||||
|         createCourse(toAdd.name,toAdd.credits,toAdd.faculty,toAdd.teacher,toAdd.Assistants); | ||||
|         } | ||||
|         toAdd= Object.assign({},pattern); | ||||
|       }   | ||||
| } | ||||
|   //Juste pour montrer le Delete Mode | ||||
|   let toRemove; | ||||
|  | ||||
|   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); | ||||
|   } | ||||
|   function removeCourse(course) { | ||||
|      deleteCourse(course.id) | ||||
|         } | ||||
|  | ||||
| </script> | ||||
| <template> | ||||
| @ -122,7 +101,7 @@ | ||||
|           {{i18n("login.cPassword")}} :  | ||||
|         <input> | ||||
|         </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> | ||||
|       </form> | ||||
|     </div> | ||||
|  | ||||
| @ -1,40 +1,11 @@ | ||||
| <script setup> | ||||
|   import {reactive, ref } from 'vue' | ||||
|   import {getUser} from '../rest/Users.js' | ||||
|   import {getSelf} from '../rest/Users.js' | ||||
|   import i18n from "@/i18n.js" | ||||
|   import { uploadProfilePicture } from '@/rest/uploads.js' | ||||
|  /*  | ||||
|   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", | ||||
|   }) | ||||
|    | ||||
|   const user = getSelf(); | ||||
|   console.log(user.role) | ||||
|   console.log("test") | ||||
|   /* | ||||
|   Teacher user | ||||
|   const user =reactive({ | ||||
| @ -67,8 +38,6 @@ const modif = ref(false); | ||||
| const curric = ref(false); | ||||
| const unreg = ref(false); | ||||
| const reg = ref(false); | ||||
|  | ||||
|  | ||||
| const toModify = Object.assign({}, user); | ||||
|  | ||||
| function getPP(){ | ||||
| @ -88,28 +57,28 @@ function getPP(){ | ||||
|       <div class="globalInfos"> | ||||
|         <div v-if="modif==false" class="infosContainer" > | ||||
|           <div> | ||||
|             {{user.firstname}} {{user.lastname.toUpperCase()}}    | ||||
|             {{user.firstName}} {{user.lastName}}    | ||||
|           </div> | ||||
|           <div> | ||||
|             E-mail: {{user.email}}       | ||||
|           </div> | ||||
|           <div v-if="user.role==='student'"> | ||||
|             {{user.option}} {{i18n(user.role).toUpperCase()}}  | ||||
|           <div v-if="user.role=='Student'"> | ||||
|             {{user.option}} {{i18n(user.role)}}  | ||||
|           </div> | ||||
|           <div v-else> | ||||
|             {{i18n("faculty")}}: {{user.faculty}}  | ||||
|             Role:  {{i18n(user.role).toUpperCase()}}  | ||||
|             Role:  {{i18n(user.role)}}  | ||||
|           </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> | ||||
| @ -139,7 +108,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> | ||||
| @ -156,7 +125,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,5 +1,6 @@ | ||||
| <script setup> | ||||
|   import i18n from "@/i18n.js" | ||||
|   import {validateRegister} from "@/rest/ServiceInscription.js"  | ||||
|   const props = defineProps({ | ||||
|   id: Number, | ||||
|   type: String, | ||||
| @ -22,8 +23,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 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="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> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| @ -60,8 +60,6 @@ const users =[{ | ||||
|   password:"CeciEstUnMotDePasse123", | ||||
|   }] | ||||
|  | ||||
| console.log(users[0]) | ||||
|  | ||||
| </script>  | ||||
| <template> | ||||
|   <div v-for="item in users"> | ||||
|  | ||||
| @ -106,6 +106,10 @@ export async function getTeachers(){ | ||||
| 	return restGet("/users/teacher") | ||||
| } | ||||
|  | ||||
|  | ||||
| export async function getStudents(){ | ||||
|   return restGet("/users/student") | ||||
| } | ||||
| /** | ||||
|  * Get informations about yourself | ||||
|  * - RegNo | ||||
|  | ||||
		Reference in New Issue
	
	Block a user