1
0
forked from PGL/Clyde

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:
Debucquoy Anthony 2024-03-16 10:17:04 +01:00
parent e2da7271af
commit 17d0ae7ccc
Signed by untrusted user: tonitch
GPG Key ID: A78D6421F083D42E
8 changed files with 60 additions and 60 deletions

View File

@ -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>

View File

@ -1,7 +1,7 @@
<script setup>
import i18n from "@/i18n.js"
import {ref} from 'vue'
const cursus=[
const curriculum=[
{
"id": 12,
"name": "Math pour l'info",
@ -51,8 +51,8 @@ const cursus=[
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;
}
@ -63,7 +63,7 @@ const cursus=[
}
}
if (!isnull){
cursus.push(toAdd);
curriculum.push(toAdd);
}
toAdd= Object.assign({},pattern);
}
@ -76,7 +76,7 @@ const cursus=[
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){
@ -86,8 +86,8 @@ const cursus=[
}
console.log(rem)
if (rem > -1){
cursus.splice(rem, 1);}
console.log(cursus);
curriculum.splice(rem, 1);}
console.log(curriculum);
}
</script>
@ -130,7 +130,7 @@ const cursus=[
<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>
@ -147,7 +147,7 @@ const cursus=[
</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")}}

View File

@ -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>

View File

@ -8,7 +8,7 @@
address: String,
country: String,
birthDate: String,
cursus:String,
curriculum:String,
degree:String,});
</script>

View File

@ -24,7 +24,7 @@ export async function createRegister(){
* - country
* - birthdate
* - email
* - cursus
* - curriculum
* - degree
*/
export async function getRegisters(id){

View File

@ -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
});
}

View 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);
}

View File

@ -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);
}