Compare commits
	
		
			2 Commits
		
	
	
		
			a762b6875d
			...
			73d50f3f50
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 73d50f3f50 | |||
| 0871d2971d | 
@ -57,7 +57,6 @@ public class InscriptionController {
 | 
			
		||||
                                                                 @RequestHeader("Authorization") String token,
 | 
			
		||||
                                                                 @RequestBody RequestState state)
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println(requestState);
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@
 | 
			
		||||
 | 
			
		||||
<template> 
 | 
			
		||||
  <div  v-for="item of requests_example">
 | 
			
		||||
  <div class="bodu">
 | 
			
		||||
  <div class="bodu" v-if="item.state === 'Pending'">
 | 
			
		||||
  <div class="container">
 | 
			
		||||
 
 | 
			
		||||
    <div class="id"><a>{{item.id}}</a></div>
 | 
			
		||||
@ -18,7 +18,7 @@
 | 
			
		||||
    <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="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>
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,9 @@
 | 
			
		||||
    if (!isnull){
 | 
			
		||||
       createCourse(toAdd.title,toAdd.credits,toAdd.owner);
 | 
			
		||||
       toAdd= Object.assign({},pattern);
 | 
			
		||||
       setTimeout(() => {
 | 
			
		||||
      window.location.reload();
 | 
			
		||||
      }, "250");
 | 
			
		||||
      }  
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
@ -64,22 +67,26 @@
 | 
			
		||||
 | 
			
		||||
  function patchCourse(course){
 | 
			
		||||
    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});
 | 
			
		||||
        }
 | 
			
		||||
        else if(element == "title" && (toModify[element] != course.title)){
 | 
			
		||||
        alterCourse(course.courseId,{title:toModify[element]});
 | 
			
		||||
        }
 | 
			
		||||
        else if(element == "credits" && (toModify[element] != course.credits)){
 | 
			
		||||
          alterCourse(course.courseId,{credits:toModify[element]});
 | 
			
		||||
        else if(element == "credits" && (parseInt(toModify[element]) != course.credits)){
 | 
			
		||||
          alterCourse(course.courseId,{credits:parseInt(toModify[element])});
 | 
			
		||||
        }
 | 
			
		||||
        console.log(toModify[element])
 | 
			
		||||
         
 | 
			
		||||
      
 | 
			
		||||
    
 | 
			
		||||
    }toModify = Object.assign({},pattern);
 | 
			
		||||
 | 
			
		||||
    setTimeout(() => {
 | 
			
		||||
      window.location.reload();
 | 
			
		||||
      }, "500");
 | 
			
		||||
  }
 | 
			
		||||
  //Juste pour montrer le Delete Mode
 | 
			
		||||
  let toRemove;
 | 
			
		||||
@ -92,7 +99,7 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="body">
 | 
			
		||||
    <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")}}
 | 
			
		||||
      </button>
 | 
			
		||||
      <button class="delete" @click="deleteMod=true" >
 | 
			
		||||
@ -108,7 +115,7 @@
 | 
			
		||||
        <div style="margin-bottom:20px;">
 | 
			
		||||
          {{i18n("Teacher")}} : 
 | 
			
		||||
         <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>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div style="margin-bottom:20px;">
 | 
			
		||||
@ -161,7 +168,7 @@
 | 
			
		||||
      <div class="containerElement"v-else>
 | 
			
		||||
        <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">
 | 
			
		||||
          <option v-for="item in profList">{{item.lastName}}</option>
 | 
			
		||||
          <option v-for="(item,index) in profList" :value='item'>{{item.lastName}}</option>
 | 
			
		||||
        </select>
 | 
			
		||||
        <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">  
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
@ -7,8 +7,10 @@ import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
 | 
			
		||||
/**
 | 
			
		||||
 * Create a new course
 | 
			
		||||
 */
 | 
			
		||||
export async function createCourse(name, credits, teacher){
 | 
			
		||||
	return restPost("/course", {title: name, credits: credits, owner: teacher} )
 | 
			
		||||
export async function createCourse(name, credits, owner){
 | 
			
		||||
  console.log(owner);
 | 
			
		||||
  
 | 
			
		||||
	return restPost("/course", {title: name, credits: credits, owner} )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,6 @@ export async function restPost(endPoint, data) {
 | 
			
		||||
	return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export async function restPostFile(endPoint, file){
 | 
			
		||||
	let headers = new 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)});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function restPatchInfo(endPoint, data){
 | 
			
		||||
	return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: data});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * backbone for the request made by the frontend
 | 
			
		||||
 *
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user