Compare commits

...

2 Commits

Author SHA1 Message Date
73d50f3f50 Merge remote-tracking branch 'refs/remotes/origin/wal/front/listingUsers' into wal/front/listingUsers
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 1m59s
Build and test backend / Test-backend (pull_request) Successful in 2m2s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 26s
2024-03-18 14:52:29 +01:00
0871d2971d manage Course finished 2024-03-18 14:51:27 +01:00
6 changed files with 22 additions and 19 deletions

View File

@ -57,7 +57,6 @@ public class InscriptionController {
@RequestHeader("Authorization") String token, @RequestHeader("Authorization") String token,
@RequestBody RequestState state) @RequestBody RequestState state)
{ {
System.out.println(requestState);
if (authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token)) if (authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token))
return new UnauthorizedResponse<>(null); return new UnauthorizedResponse<>(null);

View File

@ -10,7 +10,7 @@
<template> <template>
<div v-for="item of requests_example"> <div v-for="item of requests_example">
<div class="bodu"> <div class="bodu" v-if="item.state === 'Pending'">
<div class="container"> <div class="container">
<div class="id"><a>{{item.id}}</a></div> <div class="id"><a>{{item.id}}</a></div>
@ -18,7 +18,7 @@
<div class="firstname"><a>{{item.firstName}}</a></div> <div class="firstname"><a>{{item.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 @click="validateRegister(item.id,'Accepted')" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div> <div class="accept"><button @click="validateRegister(item.id,'Accepted')" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
<div class="refuse"><button @click="validateRegister(item.id,Refused)" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div> <div class="refuse"><button @click="validateRegister(item.id,'Refused')" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -47,6 +47,9 @@
if (!isnull){ if (!isnull){
createCourse(toAdd.title,toAdd.credits,toAdd.owner); createCourse(toAdd.title,toAdd.credits,toAdd.owner);
toAdd= Object.assign({},pattern); toAdd= Object.assign({},pattern);
setTimeout(() => {
window.location.reload();
}, "250");
} }
} }
@ -64,22 +67,26 @@
function patchCourse(course){ function patchCourse(course){
for (let element in toModify){ for (let element in toModify){
console.log(course.credits) console.log(toModify,1)
console.log(toModify[element],2)
if (element =="owner" && (toModify[element] != course.owner.regNo)){ if (element =="owner" && (toModify[element].regNo != course.owner.regNo)){
alterCourse(course.courseId,{owner:toModify[element].regNo}); alterCourse(course.courseId,{owner:toModify[element].regNo});
} }
else if(element == "title" && (toModify[element] != course.title)){ else if(element == "title" && (toModify[element] != course.title)){
alterCourse(course.courseId,{title:toModify[element]}); alterCourse(course.courseId,{title:toModify[element]});
} }
else if(element == "credits" && (toModify[element] != course.credits)){ else if(element == "credits" && (parseInt(toModify[element]) != course.credits)){
alterCourse(course.courseId,{credits:toModify[element]}); alterCourse(course.courseId,{credits:parseInt(toModify[element])});
} }
console.log(toModify[element])
}toModify = Object.assign({},pattern); }toModify = Object.assign({},pattern);
setTimeout(() => {
window.location.reload();
}, "500");
} }
//Juste pour montrer le Delete Mode //Juste pour montrer le Delete Mode
let toRemove; let toRemove;
@ -92,7 +99,7 @@
<template> <template>
<div class="body"> <div class="body">
<div v-if="!deleteMod && !createMod && (self.role !== 'Teacher')" class="listTitle buttonGrid"> <div v-if="!deleteMod && !createMod && (self.role !== 'Teacher')" class="listTitle buttonGrid">
<button class="create" @click="createMod = true"> <button class="create" @click="editElementID= '';createMod = true;">
{{i18n("courses.createCourse")}} {{i18n("courses.createCourse")}}
</button> </button>
<button class="delete" @click="deleteMod=true" > <button class="delete" @click="deleteMod=true" >
@ -108,7 +115,7 @@
<div style="margin-bottom:20px;"> <div style="margin-bottom:20px;">
{{i18n("Teacher")}} : {{i18n("Teacher")}} :
<select style="max-width:200px;" class="teacher" v-model="toAdd.owner"> <select style="max-width:200px;" class="teacher" v-model="toAdd.owner">
<option v-for="item in profList">{{item}}</option> <option v-for="item in profList" :value="item">{{item.lastName}}</option>
</select> </select>
</div> </div>
<div style="margin-bottom:20px;"> <div style="margin-bottom:20px;">
@ -161,7 +168,7 @@
<div class="containerElement"v-else> <div class="containerElement"v-else>
<input style="max-width:200px;" class="name" v-model="toModify.title"> <input style="max-width:200px;" class="name" v-model="toModify.title">
<select v-if="self.role === 'Secretary'" style="max-width:200px;" class="teacher" v-model="toModify.owner"> <select v-if="self.role === 'Secretary'" style="max-width:200px;" class="teacher" v-model="toModify.owner">
<option v-for="item in profList">{{item.lastName}}</option> <option v-for="(item,index) in profList" :value='item'>{{item.lastName}}</option>
</select> </select>
<div v-else class="teacher">{{item.owner.lastName}}</div> <div v-else class="teacher">{{item.owner.lastName}}</div>
<input v-if="self.role==='Secretary'"style="max-width:100px;"class="credits" v-model="toModify.credits"> <input v-if="self.role==='Secretary'"style="max-width:100px;"class="credits" v-model="toModify.credits">

View File

@ -3,7 +3,7 @@
* *
* TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future. * TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
*/ */
import {restGet, restPatch,restPatchInfo} from './restConsumer.js' import {restGet, restPatch} from './restConsumer.js'
/** /**
* create a new register requests that can be recovered by the registering service * create a new register requests that can be recovered by the registering service

View File

@ -7,8 +7,10 @@ import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
/** /**
* Create a new course * Create a new course
*/ */
export async function createCourse(name, credits, teacher){ export async function createCourse(name, credits, owner){
return restPost("/course", {title: name, credits: credits, owner: teacher} ) console.log(owner);
return restPost("/course", {title: name, credits: credits, owner} )
} }
/** /**

View File

@ -11,7 +11,6 @@ export async function restPost(endPoint, data) {
return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)}); return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
} }
export async function restPostFile(endPoint, file){ export async function restPostFile(endPoint, file){
let headers = new Headers(); let headers = new Headers();
return await _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers }); return await _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
@ -25,10 +24,6 @@ export async function restPatch(endPoint, data) {
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)}); return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
} }
export async function restPatchInfo(endPoint, data){
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: data});
}
/** /**
* backbone for the request made by the frontend * backbone for the request made by the frontend
* *