Refactoring: cursus -> curriculum frontend
I hope I didn't missed anything, this commit is following the previous one in this branch
This commit is contained in:
parent
e2da7271af
commit
17d0ae7ccc
@ -16,7 +16,7 @@
|
|||||||
const email=ref("")
|
const email=ref("")
|
||||||
const address=ref("")
|
const address=ref("")
|
||||||
const country=ref("")
|
const country=ref("")
|
||||||
const cursus=ref("")
|
const curriculum=ref("")
|
||||||
|
|
||||||
const imageSaved = ref(false)
|
const imageSaved = ref(false)
|
||||||
const ppData = ref(false)
|
const ppData = ref(false)
|
||||||
@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else>
|
<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;">
|
<h1 style="color:rgb(239,60,168); font-family: sans-serif; text-align:center;">
|
||||||
{{i18n("login.guest.welcome")}}
|
{{i18n("login.guest.welcome")}}
|
||||||
</h1>
|
</h1>
|
||||||
@ -103,7 +103,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<div class="inputBox">
|
<div class="inputBox">
|
||||||
<p>{{i18n("curriculum").toUpperCase()}}</p>
|
<p>{{i18n("curriculum").toUpperCase()}}</p>
|
||||||
<select v-model="cursus">
|
<select v-model="curriculum">
|
||||||
<option value="Chemistry">Chemistry</option>
|
<option value="Chemistry">Chemistry</option>
|
||||||
<option value="Psycho">Psychology</option>
|
<option value="Psycho">Psychology</option>
|
||||||
<option value="IT">IT</option>
|
<option value="IT">IT</option>
|
||||||
|
@ -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'
|
||||||
const cursus=[
|
const curriculum=[
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"name": "Math pour l'info",
|
"name": "Math pour l'info",
|
||||||
@ -51,8 +51,8 @@ const cursus=[
|
|||||||
let toAdd = Object.assign({}, pattern);
|
let toAdd = Object.assign({}, pattern);
|
||||||
|
|
||||||
function addToCourse (){
|
function addToCourse (){
|
||||||
if (cursus.length>0){
|
if (curriculum.length>0){
|
||||||
toAdd.id=(cursus[cursus.length-1].id)-1;}
|
toAdd.id=(curriculum[curriculum.length-1].id)-1;}
|
||||||
else{
|
else{
|
||||||
toAdd.id=0;
|
toAdd.id=0;
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ const cursus=[
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isnull){
|
if (!isnull){
|
||||||
cursus.push(toAdd);
|
curriculum.push(toAdd);
|
||||||
}
|
}
|
||||||
toAdd= Object.assign({},pattern);
|
toAdd= Object.assign({},pattern);
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ const cursus=[
|
|||||||
console.log("ok");
|
console.log("ok");
|
||||||
console.log(toRemove);
|
console.log(toRemove);
|
||||||
let rem=-1;
|
let rem=-1;
|
||||||
for(const [key, value] of Object.entries(cursus)){
|
for(const [key, value] of Object.entries(curriculum)){
|
||||||
console.log(key);
|
console.log(key);
|
||||||
console.log(value)
|
console.log(value)
|
||||||
if(value.name === toRemove){
|
if(value.name === toRemove){
|
||||||
@ -86,8 +86,8 @@ const cursus=[
|
|||||||
}
|
}
|
||||||
console.log(rem)
|
console.log(rem)
|
||||||
if (rem > -1){
|
if (rem > -1){
|
||||||
cursus.splice(rem, 1);}
|
curriculum.splice(rem, 1);}
|
||||||
console.log(cursus);
|
console.log(curriculum);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -130,7 +130,7 @@ const cursus=[
|
|||||||
<div style="margin-bottom:20px;">
|
<div style="margin-bottom:20px;">
|
||||||
{{i18n("courses.toDelete")}} :
|
{{i18n("courses.toDelete")}} :
|
||||||
<select style="max-width:200px;" class="teacher" v-model="toRemove">
|
<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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -147,7 +147,7 @@ const cursus=[
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</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;">
|
<div style ="padding:15px 15px 15px 15px;">
|
||||||
<button v-if="editElementID !== item.name" @click="editElementID = item.name">
|
<button v-if="editElementID !== item.name" @click="editElementID = item.name">
|
||||||
{{i18n("courses.modify")}}
|
{{i18n("courses.modify")}}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
role:"student",
|
role:"student",
|
||||||
address: "Radiator Springs",
|
address: "Radiator Springs",
|
||||||
email:"ClydeGhost@gmail.com",
|
email:"ClydeGhost@gmail.com",
|
||||||
cursus:[
|
curriculum:[
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"name": "Math pour l'info",
|
"name": "Math pour l'info",
|
||||||
@ -132,7 +132,7 @@ const toModify = Object.assign({}, user);
|
|||||||
{{i18n("profile.course.list")}}
|
{{i18n("profile.course.list")}}
|
||||||
</div>
|
</div>
|
||||||
<div class="listElement "
|
<div class="listElement "
|
||||||
v-for="item in user.cursus">
|
v-for="item in user.curriculum">
|
||||||
<div class=" containerElement">
|
<div class=" containerElement">
|
||||||
<div class="name"> {{item.name}} </div>
|
<div class="name"> {{item.name}} </div>
|
||||||
<div class="teacher">{{item.teacher}}</div>
|
<div class="teacher">{{item.teacher}}</div>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
address: String,
|
address: String,
|
||||||
country: String,
|
country: String,
|
||||||
birthDate: String,
|
birthDate: String,
|
||||||
cursus:String,
|
curriculum:String,
|
||||||
degree:String,});
|
degree:String,});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ export async function createRegister(){
|
|||||||
* - country
|
* - country
|
||||||
* - birthdate
|
* - birthdate
|
||||||
* - email
|
* - email
|
||||||
* - cursus
|
* - curriculum
|
||||||
* - degree
|
* - degree
|
||||||
*/
|
*/
|
||||||
export async function getRegisters(id){
|
export async function getRegisters(id){
|
||||||
|
@ -14,10 +14,10 @@ export async function login(user, pass, exp){
|
|||||||
* @param mail
|
* @param mail
|
||||||
* @param address
|
* @param address
|
||||||
* @param country
|
* @param country
|
||||||
* @param cursus
|
* @param curriculum
|
||||||
* @param imageId id of the image in database returned when uploaded
|
* @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", {
|
return restPost("/register", {
|
||||||
firstname: firstname,
|
firstname: firstname,
|
||||||
lastname: lastname,
|
lastname: lastname,
|
||||||
@ -26,7 +26,7 @@ export async function register(firstname, lastname, birthDate, password, email,
|
|||||||
email: email,
|
email: email,
|
||||||
address: address,
|
address: address,
|
||||||
country: country,
|
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);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user