Merge branch 'master' into tonitch/front/manageCourses/LinkToBackend
This commit is contained in:
		| @ -16,7 +16,7 @@ | ||||
|   const email=ref("") | ||||
|   const address=ref("") | ||||
|   const country=ref("") | ||||
|   const cursus=ref("") | ||||
|   const curriculum=ref("") | ||||
|   | ||||
|   const imageSaved = ref(false) | ||||
|   const ppData = ref(false) | ||||
| @ -49,7 +49,7 @@ | ||||
|         </div> | ||||
|  | ||||
|         <div v-else> | ||||
|           <form @submit.prevent="register(firstname, surname, birthday, password, mail, address, country, cursus)" class="form"> | ||||
|           <form @submit.prevent="register(firstname, surname, birthday, password, mail, address, country, curriculum)" class="form"> | ||||
|             <h1 style="color:rgb(239,60,168); font-family: sans-serif; text-align:center;"> | ||||
|               {{i18n("login.guest.welcome")}} | ||||
|             </h1> | ||||
| @ -103,7 +103,7 @@ | ||||
|               </form> | ||||
|               <div class="inputBox"> | ||||
|                 <p>{{i18n("curriculum").toUpperCase()}}</p>  | ||||
|                   <select v-model="cursus"> | ||||
|                   <select v-model="curriculum"> | ||||
|                     <option value="Chemistry">Chemistry</option> | ||||
|                     <option value="Psycho">Psychology</option> | ||||
|                     <option value="IT">IT</option> | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
|   import { getCourses } from "@/rest/courses.js" | ||||
|   import { getTeachers } from "@/rest/Users.js" | ||||
|  | ||||
|   const cursus = await getCourses() | ||||
|   const curriculum = await getCourses() | ||||
|  | ||||
|   const profList = getTeachers() | ||||
|  | ||||
| @ -31,8 +31,8 @@ | ||||
|   let toAdd = Object.assign({}, pattern); | ||||
|  | ||||
|   function addToCourse (){ | ||||
|   if (cursus.length>0){ | ||||
|     toAdd.id=(cursus[cursus.length-1].id)-1;} | ||||
|   if (curriculum.length>0){ | ||||
|     toAdd.id=(curriculum[curriculum.length-1].id)-1;} | ||||
|     else{ | ||||
|     toAdd.id=0; | ||||
|     } | ||||
| @ -43,7 +43,7 @@ | ||||
|       } | ||||
|     } | ||||
|       if (!isnull){ | ||||
|       cursus.push(toAdd); | ||||
|       curriculum.push(toAdd); | ||||
|       } | ||||
|       toAdd= Object.assign({},pattern); | ||||
|     }  | ||||
| @ -56,7 +56,7 @@ | ||||
|   console.log("ok"); | ||||
|   console.log(toRemove); | ||||
|   let rem=-1; | ||||
|   for(const [key, value] of Object.entries(cursus)){ | ||||
|   for(const [key, value] of Object.entries(curriculum)){ | ||||
|     console.log(key); | ||||
|     console.log(value) | ||||
|     if(value.name === toRemove){ | ||||
| @ -66,8 +66,8 @@ | ||||
|     } | ||||
|     console.log(rem) | ||||
|   if (rem > -1){ | ||||
|     cursus.splice(rem, 1);} | ||||
|   console.log(cursus); | ||||
|     curriculum.splice(rem, 1);} | ||||
|   console.log(curriculum); | ||||
|   } | ||||
|  | ||||
| </script> | ||||
| @ -110,7 +110,7 @@ | ||||
|         <div style="margin-bottom:20px;"> | ||||
|           {{i18n("courses.toDelete")}} : | ||||
|          <select style="max-width:200px;" class="teacher" v-model="toRemove"> | ||||
|           <option v-for="item in cursus">{{item.name}}</option> | ||||
|           <option v-for="item in curriculum">{{item.name}}</option> | ||||
|            | ||||
|         </select> | ||||
|         </div> | ||||
| @ -127,7 +127,7 @@ | ||||
|       </form> | ||||
|     </div> | ||||
|  | ||||
|     <div v-if="!createMod && !deleteMod" v-for="item in cursus" :key="item.name"> | ||||
|     <div v-if="!createMod && !deleteMod" v-for="item in curriculum" :key="item.name"> | ||||
|       <div style ="padding:15px 15px 15px 15px;"> | ||||
|       <button  v-if="editElementID !== item.name"  @click="editElementID = item.name"> | ||||
|         {{i18n("courses.modify")}} | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|   role:"student", | ||||
|   address: "Radiator Springs", | ||||
|   email:"ClydeGhost@gmail.com", | ||||
|   cursus:[ | ||||
|   curriculum:[ | ||||
|   { | ||||
|   "id": 12, | ||||
|   "name": "Math pour l'info", | ||||
| @ -132,7 +132,7 @@ const toModify = Object.assign({}, user); | ||||
|             {{i18n("profile.course.list")}} | ||||
|           </div> | ||||
|         <div  class="listElement " | ||||
|           v-for="item in user.cursus"> | ||||
|           v-for="item in user.curriculum"> | ||||
|           <div class=" containerElement"> | ||||
|             <div class="name"> {{item.name}} </div> | ||||
|             <div class="teacher">{{item.teacher}}</div>  | ||||
|  | ||||
| @ -8,7 +8,7 @@ | ||||
|   address: String, | ||||
|   country: String, | ||||
|   birthDate: String, | ||||
|   cursus:String, | ||||
|   curriculum:String, | ||||
|   degree:String,}); | ||||
| </script> | ||||
|  | ||||
|  | ||||
| @ -24,7 +24,7 @@ export async function createRegister(){ | ||||
|  * - country | ||||
|  * - birthdate | ||||
|  * - email | ||||
|  * - cursus | ||||
|  * - curriculum | ||||
|  * - degree | ||||
|  */ | ||||
| export async function getRegisters(id){ | ||||
|  | ||||
| @ -14,10 +14,10 @@ export async function login(user, pass, exp){ | ||||
|  * @param mail | ||||
|  * @param address | ||||
|  * @param country | ||||
|  * @param cursus | ||||
|  * @param curriculum  | ||||
|  * @param imageId	id of the image in database returned when uploaded | ||||
|  */ | ||||
| export async function register(firstname, lastname, birthDate, password, email, address, country, cursus, imageId){ | ||||
| export async function register(firstname, lastname, birthDate, password, email, address, country, curriculum, imageId){ | ||||
| 	return restPost("/register", { | ||||
| 		firstname: firstname, | ||||
| 		lastname: lastname, | ||||
| @ -26,7 +26,7 @@ export async function register(firstname, lastname, birthDate, password, email, | ||||
| 		email: email, | ||||
| 		address: address, | ||||
| 		country: country, | ||||
| 		cursus: cursus | ||||
| 		curriculum: curriculum | ||||
| 	}); | ||||
| } | ||||
|  | ||||
|  | ||||
							
								
								
									
										41
									
								
								frontend/src/rest/curriculum.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								frontend/src/rest/curriculum.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,41 @@ | ||||
| /** | ||||
|  * curriculum API | ||||
|  */ | ||||
|  | ||||
| import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js' | ||||
|  | ||||
| /** | ||||
|  * Create a new curriculum (bundle of courses) | ||||
|  * @param courses	list of courses | ||||
|  */ | ||||
| export async function createcurriculum(courses){ | ||||
| 	return restPost("/curriculum", {courses: courses} ); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Delete the specified curriculum | ||||
|  */ | ||||
| export async function deletecurriculum(id){ | ||||
| 	return restDelete("/curriculum/" + id); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get informations on a particular curriculum | ||||
|  * | ||||
|  * @param id	identification of the curriculum | ||||
|  * | ||||
|  * @return list of courses  | ||||
|  */ | ||||
| export async function getcurriculum(id){ | ||||
| 	return restGet("/curriculum/" + id); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Modify the courses of a curriculum | ||||
|  * | ||||
|  * @param id		the id of the curriculum | ||||
|  * @param courses	list of new courses  | ||||
|  */ | ||||
| export async function altercurriculum(id, courses){ | ||||
| 	return restPatch("/curriculum/" + id, courses); | ||||
| } | ||||
| @ -1,41 +0,0 @@ | ||||
| /** | ||||
|  * cursus API | ||||
|  */ | ||||
|  | ||||
| import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js' | ||||
|  | ||||
| /** | ||||
|  * Create a new cursus (bundle of courses) | ||||
|  * @param courses	list of courses | ||||
|  */ | ||||
| export async function createCursus(courses){ | ||||
| 	return restPost("/cursus", {courses: courses} ); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Delete the specified cursus | ||||
|  */ | ||||
| export async function deleteCursus(id){ | ||||
| 	return restDelete("/cursus/" + id); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get informations on a particular cursus | ||||
|  * | ||||
|  * @param id	identification of the cursus | ||||
|  * | ||||
|  * @return list of courses  | ||||
|  */ | ||||
| export async function getCursus(id){ | ||||
| 	return restGet("/cursus/" + id); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Modify the courses of a cursus | ||||
|  * | ||||
|  * @param id		the id of the cursus | ||||
|  * @param courses	list of new courses  | ||||
|  */ | ||||
| export async function alterCursus(id, courses){ | ||||
| 	return restPatch("/cursus/" + id, courses); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user