Add the exemptions gestion and improve the navigation between requests
This commit is contained in:
parent
69fb4e881e
commit
4e14370d4f
@ -88,6 +88,28 @@ public class RequestsController {
|
||||
return new ResponseEntity<>(toReturn, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/exemptionsreq/{id}")
|
||||
public ResponseEntity<ExemptionsRequest> getExemptionRequestbyId(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
ExemptionsRequest exemptionsRequest = err.findById(id);
|
||||
|
||||
return new ResponseEntity<>(exemptionsRequest, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PatchMapping(value = "/exemptionsreq/{id}/{newstate}")
|
||||
public ResponseEntity<String> changeExemptionReqState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
ExemptionsRequest exemptionsRequest = err.findById(id);
|
||||
exemptionsRequest.setState(newstate);
|
||||
err.save(exemptionsRequest);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
//Get all the scholarships requests
|
||||
@GetMapping(value = "/scholarshipreq")
|
||||
public ResponseEntity<ArrayList<ScholarshipRequest>> getAllScholarshipRequests(@RequestHeader("Authorization") String token){
|
||||
|
@ -4,5 +4,5 @@ import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
|
||||
|
||||
public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> {
|
||||
|
||||
ExemptionsRequest findById(long id);
|
||||
}
|
||||
|
@ -80,4 +80,8 @@ public class ExemptionsRequest {
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ const req = ref(await getChangeCurrReqById(props.reqId))
|
||||
|
||||
const user = await getSelf()
|
||||
//0 liste, 1 profil
|
||||
const windowstate = ref(0);
|
||||
const localwindowstate = ref(0);
|
||||
|
||||
const tag = req.value.user.regNo
|
||||
|
||||
const windowState = defineModel("windowState")
|
||||
|
||||
async function uploadandrefreshChangeRequest(state){
|
||||
await editChangeCurrReq(req.value.id, state);
|
||||
}
|
||||
@ -32,7 +34,7 @@ async function editChangeCurrReqTeacherApproval(state){
|
||||
|
||||
|
||||
<template>
|
||||
<div class="body" v-if="windowstate === 0">
|
||||
<div class="body" v-if="localwindowstate === 0">
|
||||
<div class="container">
|
||||
<div class="globalInfos">
|
||||
<div class="infosContainer">
|
||||
@ -50,7 +52,7 @@ async function editChangeCurrReqTeacherApproval(state){
|
||||
Wanted cursus : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="windowstate++"> See profile </button>
|
||||
<button @click="localwindowstate++"> See profile </button>
|
||||
</div>
|
||||
<div>
|
||||
<button v-if="req.state === 'Pending'" @click="req.state='Accepted';uploadandrefreshChangeRequest('Accepted')">Accept</button>
|
||||
@ -64,9 +66,12 @@ async function editChangeCurrReqTeacherApproval(state){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="windowstate === 1">
|
||||
<div v-if="localwindowstate === 0">
|
||||
<button @click="windowState = 0" style="margin-left: 10%">Back</button>
|
||||
</div>
|
||||
<div v-if="localwindowstate === 1">
|
||||
<AboutStudent :target="tag"></AboutStudent>
|
||||
<button @click="windowstate--;">Return to request</button>
|
||||
<button @click="localwindowstate--;">Back</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
116
frontend/src/Apps/Inscription/AboutExemption.vue
Normal file
116
frontend/src/Apps/Inscription/AboutExemption.vue
Normal file
@ -0,0 +1,116 @@
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
addUninscReq,
|
||||
editExempReqState,
|
||||
editScholarshipReq,
|
||||
getExempReq,
|
||||
getScholarshipReqById
|
||||
} from "@/rest/requests.js";
|
||||
import i18n from "@/i18n.js";
|
||||
import {getUser} from "@/rest/Users.js";
|
||||
import {reactive, ref} from "vue";
|
||||
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
|
||||
|
||||
const props = defineProps(["reqId"])
|
||||
|
||||
const req = ref(await getExempReq(props.reqId))
|
||||
|
||||
const profile = ref(false)
|
||||
|
||||
const windowState = defineModel("windowState")
|
||||
|
||||
async function editExemp(newstate){
|
||||
await editExempReqState(req.value.id, newstate)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<div class="body" v-if="profile === false">
|
||||
<div class="container">
|
||||
<div class="globalInfos">
|
||||
<div class="infosContainer">
|
||||
<div>
|
||||
Firstname/Name : {{req.user.firstName}} {{req.user.lastName}}
|
||||
</div>
|
||||
<div>
|
||||
Course: {{req.course.title}}
|
||||
</div>
|
||||
<div>
|
||||
State : {{req.state}}
|
||||
</div>
|
||||
<div>
|
||||
<button @click="profile = !profile">Voir le profil</button>
|
||||
</div>
|
||||
<div>
|
||||
<button>Download justification document</button>
|
||||
</div>
|
||||
<div>
|
||||
<button v-if="req.state === 'Pending'" @click="req.state='Accepted';editExemp('Accepted')">Accept</button>
|
||||
<button v-if="req.state === 'Pending'" @click="req.state='Refused';editExemp('Refused')" style="margin-left: 2%;">Refuse</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<AboutStudent :target="req.user.regNo"></AboutStudent>
|
||||
<button @click="profile=!profile">Back</button>
|
||||
</div>
|
||||
<div>
|
||||
<button v-if="profile===false" @click="windowState = 0" style="margin-left: 30%">Back</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container{
|
||||
min-width:675px;
|
||||
display:grid;
|
||||
grid-template-columns:10vw 50vw;
|
||||
grid-template-rows:200px auto;
|
||||
column-gap:2.7%;
|
||||
row-gap:45px;
|
||||
grid-template-areas:
|
||||
"profilPic globalInfos"
|
||||
"minfos minfos";
|
||||
}
|
||||
|
||||
.profilPic{
|
||||
width:100%;
|
||||
grid-area:profilPic;
|
||||
}
|
||||
|
||||
.globalInfos {
|
||||
grid-area:globalInfos;
|
||||
align-self :center;
|
||||
|
||||
}
|
||||
|
||||
.body {
|
||||
min-width:960px;
|
||||
width:100%;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
margin-top:7%;
|
||||
}
|
||||
|
||||
.subContainter{
|
||||
width:100%;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
border:4px solid black;
|
||||
}
|
||||
|
||||
.infosContainer {
|
||||
min-width:350px;
|
||||
padding-bottom:50px;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
}
|
||||
</style>
|
@ -16,6 +16,8 @@ const user = await getSelf();
|
||||
const list = ref(false);
|
||||
const externalCurriculum = await getExternalCurriculumByInscrReq(request.id)
|
||||
|
||||
//Get the parent page windowState to display the correct button
|
||||
const windowState = defineModel("windowState")
|
||||
function getPP(){
|
||||
if(request.profilePictureUrl === null){
|
||||
return "/Clyde.png"
|
||||
@ -61,12 +63,15 @@ async function editEquivalence(id, newstate){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="list == false">
|
||||
<button @click="windowState = 0">Back</button>
|
||||
</div>
|
||||
<div v-if="list==true">
|
||||
<ExternalCurriculumList :ext-curr-list="externalCurriculum" :mode="0"></ExternalCurriculumList>
|
||||
<div style="margin-left: 15%;margin-top: 5%;">
|
||||
<button style="margin-left: 2%" @click="list = false;editEquivalence(request.id, 'Accepted'); request.equivalenceState='Accepted'">Accept Equivalence</button>
|
||||
<button style="margin-left: 2%" @click="list = false;editEquivalence(request.id, 'Refused'); request.equivalenceState='Refused'">Refuse Equivalence</button>
|
||||
<button style="margin-left: 2%" @click="list=false">Return to profile</button>
|
||||
<button style="margin-left: 2%" @click="list=false">Back</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import {ref} from 'vue'
|
||||
import {ref, vModelSelect} from 'vue'
|
||||
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
|
||||
import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
|
||||
import {
|
||||
@ -12,6 +12,7 @@
|
||||
import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue";
|
||||
import AboutUnregister from "@/Apps/Inscription/AboutUnregister.vue";
|
||||
import AboutChangeCurriculum from "@/Apps/Inscription/AboutChangeCurriculum.vue";
|
||||
import AboutExemption from "@/Apps/Inscription/AboutExemption.vue";
|
||||
|
||||
const requests = ref(await getAllRegisters());
|
||||
let targetId = "";
|
||||
@ -19,8 +20,8 @@
|
||||
const requestType = ref("inscription");
|
||||
const filterType = ref("None");
|
||||
|
||||
//0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister, 5 = manage curriculum change
|
||||
let windowsState = ref(0);
|
||||
//0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship, 4 manage unregister, 5 = manage curriculum change, 6 = manage exemptions
|
||||
const windowsState = ref(0);
|
||||
|
||||
async function upPage(id,review){
|
||||
await validateRegister(id,review);
|
||||
@ -52,7 +53,7 @@
|
||||
|
||||
<template>
|
||||
<div v-if="windowsState === 1">
|
||||
<AboutRequest :target="targetId"></AboutRequest>
|
||||
<AboutRequest :target="targetId" v-model:window-state="windowsState"></AboutRequest>
|
||||
</div>
|
||||
<div v-if="windowsState === 0">
|
||||
<div style="margin-top: 2%;margin-left: 2%">
|
||||
@ -104,7 +105,7 @@
|
||||
<div class="studentlastname">{{item.user.lastName}}</div>
|
||||
<div class="course">{{item.course.title}}</div>
|
||||
<div class="reqState">{{item.state}}</div>
|
||||
<div class="infos"><button>More infos</button></div>
|
||||
<div class="infos"><button @click="windowsState=6;targetId=item.id">More infos</button></div>
|
||||
</div>
|
||||
<div class="container" v-if="requestType === 'unregister'" style="grid-template-columns:17% 15% 12% 15%;grid-template-areas:'date reqState regno studentfirstname studentlastname infos';">
|
||||
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
|
||||
@ -138,9 +139,13 @@
|
||||
</div>
|
||||
<div v-if="windowsState === 4">
|
||||
<AboutUnregister :req-id="targetId"></AboutUnregister>
|
||||
<button @click="windowsState=0">Back</button>
|
||||
</div>
|
||||
<div v-if="windowsState === 5">
|
||||
<AboutChangeCurriculum :req-id="targetId"></AboutChangeCurriculum>
|
||||
<AboutChangeCurriculum :req-id="targetId" v-model:window-state="windowsState"></AboutChangeCurriculum>
|
||||
</div>
|
||||
<div v-if="windowsState === 6">
|
||||
<AboutExemption :req-id="targetId" v-model:window-state="windowsState"></AboutExemption>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -66,4 +66,12 @@ export async function editChangeCurrReq(id, newState){
|
||||
|
||||
export async function editChangeCurrReqTeacherState(id, newState){
|
||||
return restPatch("/changecurriculumreqteacher/"+id+"/"+newState)
|
||||
}
|
||||
|
||||
export async function getExempReq(id){
|
||||
return restGet("/exemptionsreq/"+id)
|
||||
}
|
||||
|
||||
export async function editExempReqState(id, newstate){
|
||||
return restPatch("/exemptionsreq/"+id+"/"+newstate)
|
||||
}
|
Loading…
Reference in New Issue
Block a user