Add the gestion of scholarshipRequest (accept and refuse and select the amount)
This commit is contained in:
parent
05bff0fa77
commit
a89d1b192c
@ -15,6 +15,7 @@ import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
|
|||||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
||||||
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest;
|
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest;
|
||||||
|
|
||||||
|
import javax.swing.text.html.parser.Entity;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -94,4 +95,25 @@ public class RequestsController {
|
|||||||
uninscriptionRequestRepository.save(ur);
|
uninscriptionRequestRepository.save(ur);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PatchMapping(value = "/scholarshipreq/")
|
||||||
|
public ResponseEntity<String> editScholReq(@RequestBody Map<String,Object> infos){
|
||||||
|
ScholarshipRequest scholarshipRequest = srr.findById((Integer) infos.get("id"));
|
||||||
|
|
||||||
|
if (infos.get("state").equals("Accepted")){
|
||||||
|
scholarshipRequest.setState(RequestState.Accepted);
|
||||||
|
scholarshipRequest.setAmount((int) infos.get("amount"));
|
||||||
|
}else{
|
||||||
|
scholarshipRequest.setState(RequestState.Refused);
|
||||||
|
}
|
||||||
|
|
||||||
|
srr.save(scholarshipRequest);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/scholarshipreq/{id}")
|
||||||
|
public ResponseEntity<ScholarshipRequest> getScholReqbyId(@PathVariable long id){
|
||||||
|
ScholarshipRequest toReturn = srr.findById(id);
|
||||||
|
return new ResponseEntity<>(toReturn, HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ import org.springframework.data.repository.CrudRepository;
|
|||||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
||||||
|
|
||||||
public interface ScholarshipRequestRepository extends CrudRepository<ScholarshipRequest, Long> {
|
public interface ScholarshipRequestRepository extends CrudRepository<ScholarshipRequest, Long> {
|
||||||
|
public ScholarshipRequest findById(long id);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ window.addEventListener('hashchange', () => {
|
|||||||
const login=ref(i18n("app.login"))
|
const login=ref(i18n("app.login"))
|
||||||
const active=ref(false)
|
const active=ref(false)
|
||||||
|
|
||||||
|
|
||||||
const apps = ref([])
|
const apps = ref([])
|
||||||
appList().then(e => apps.value = e)
|
appList().then(e => apps.value = e)
|
||||||
|
|
||||||
@ -33,7 +32,6 @@ window.addEventListener('hashchange', () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div class="topBar">
|
<div class="topBar">
|
||||||
<ul class="horizontal">
|
<ul class="horizontal">
|
||||||
<li title=home>
|
<li title=home>
|
||||||
|
124
frontend/src/Apps/Inscription/AboutScholarship.vue
Normal file
124
frontend/src/Apps/Inscription/AboutScholarship.vue
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
import {addUninscReq, editScholarshipReq, getScholarshipReqById} from "@/rest/requests.js";
|
||||||
|
import i18n from "@/i18n.js";
|
||||||
|
import {getUser} from "@/rest/Users.js";
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
|
||||||
|
const props = defineProps(["reqId"])
|
||||||
|
const req = ref(await getScholarshipReqById(props.reqId))
|
||||||
|
|
||||||
|
const user = req.value.user;
|
||||||
|
|
||||||
|
const scholarshipData = reactive({
|
||||||
|
amount : 0,
|
||||||
|
id : req.value.id,
|
||||||
|
state : ""
|
||||||
|
})
|
||||||
|
|
||||||
|
function getPP(){
|
||||||
|
if(user.profilePictureUrl === null){
|
||||||
|
return "/Clyde.png"
|
||||||
|
}
|
||||||
|
return user.profilePictureUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
async function uploadandrefreshScholarshipRequest(){
|
||||||
|
await editScholarshipReq(scholarshipData);
|
||||||
|
req.value = await getScholarshipReqById(props.reqId);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="body">
|
||||||
|
<div class="container">
|
||||||
|
<div class="profilPic">
|
||||||
|
<img class="subContainter" :src=getPP()>
|
||||||
|
</div>
|
||||||
|
<div class="globalInfos">
|
||||||
|
<div class="infosContainer">
|
||||||
|
<div>
|
||||||
|
Firstname/Name : {{user.firstName}} {{user.lastName}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
E-mail: {{user.email}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Adresse : {{user.address}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Country : {{user.country}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Birthdate : {{user.birthDate.slice(0,10)}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button>Download tax justif document</button>
|
||||||
|
<button style="margin-left: 2%">Download residency justif document</button>
|
||||||
|
</div>
|
||||||
|
<div v-if="req.state == 'Pending'">
|
||||||
|
Please enter the amount to provide :
|
||||||
|
<input type="number" v-model="scholarshipData.amount">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button v-if="req.state === 'Pending'" @click="scholarshipData.state='Accepted';uploadandrefreshScholarshipRequest()">Accept</button>
|
||||||
|
<button v-if="req.state === 'Pending'" @click="scholarshipData.state='Refused';uploadandrefreshScholarshipRequest()" style="margin-left: 2%;">Refuse</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
@ -4,6 +4,7 @@
|
|||||||
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
|
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
|
||||||
import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
|
import AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
|
||||||
import {getAllExemptionsRequest, getAllScholarShipsRequest} from "@/rest/requests.js";
|
import {getAllExemptionsRequest, getAllScholarShipsRequest} from "@/rest/requests.js";
|
||||||
|
import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue";
|
||||||
|
|
||||||
const requests = ref(await getAllRegisters());
|
const requests = ref(await getAllRegisters());
|
||||||
let targetId = "";
|
let targetId = "";
|
||||||
@ -11,7 +12,7 @@
|
|||||||
const requestType = ref("inscription");
|
const requestType = ref("inscription");
|
||||||
const filterType = ref("None");
|
const filterType = ref("None");
|
||||||
|
|
||||||
//0 = liste, 1 = détails, 2 = sure?
|
//0 = liste, 1 = détails, 2 = sure?, 3 = manage scholarship
|
||||||
let windowsState = ref(0);
|
let windowsState = ref(0);
|
||||||
|
|
||||||
async function upPage(id,review){
|
async function upPage(id,review){
|
||||||
@ -79,7 +80,7 @@
|
|||||||
<div class="studentfirstname">{{item.user.firstName}}</div>
|
<div class="studentfirstname">{{item.user.firstName}}</div>
|
||||||
<div class="studentlastname">{{item.user.lastName}}</div>
|
<div class="studentlastname">{{item.user.lastName}}</div>
|
||||||
<div class="reqState">{{item.state}}</div>
|
<div class="reqState">{{item.state}}</div>
|
||||||
<div class="infos"><button>More infos</button></div>
|
<div class="infos" @click="windowsState = 3; targetId=item.id;"><button>More infos</button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';"v-if="requestType === 'exemption'">
|
<div class="container" style="grid-template-columns:17% 15% 12% 15% 25%;grid-template-areas:'date reqState studentfirstname studentlastname course infos';"v-if="requestType === 'exemption'">
|
||||||
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
|
<div class="date" v-if="item.date != undefined">{{item.date.slice(0,10)}}</div>
|
||||||
@ -97,6 +98,12 @@
|
|||||||
<button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">Valider</button>
|
<button style="background-color:rgb(105,05,105);" @click="upPage(targetId,'Accepted');windowsState=0;">Valider</button>
|
||||||
<button style="background-color:rgb(105,05,105);" @click="windowsState=0;">Retour</button>
|
<button style="background-color:rgb(105,05,105);" @click="windowsState=0;">Retour</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="windowsState == 3">
|
||||||
|
<AboutScholarship :req-id="targetId"></AboutScholarship>
|
||||||
|
<div>
|
||||||
|
<button style="margin-left: 30%" @click="loadRequests();windowsState=0">Back</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href="#/home";
|
window.location.href="#/home";
|
||||||
}, "500");
|
}, "500");
|
||||||
}
|
}
|
||||||
function verifyInputs(pass){
|
function verifyInputs(pass){
|
||||||
if(pass==passwordConfirm.value){
|
if(pass==passwordConfirm.value){
|
||||||
page.value++;
|
page.value++;
|
||||||
@ -83,13 +83,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCurriculumYear(curriculumId){
|
|
||||||
const curriculum = await getcurriculum(curriculumId);
|
|
||||||
return parseInt(curriculum.year);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Post the register request and return the id of the newly created request and also post the external curriculum list in the database
|
//Post the register request and return the id of the newly created request and also post the external curriculum list in the database
|
||||||
async function postRegisterReq(){
|
async function postRegisterReq(){
|
||||||
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, null, new Date(), outputs.equivalenceState);
|
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, null, new Date(), outputs.equivalenceState);
|
||||||
|
@ -439,21 +439,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
|
||||||
grid-area:name;
|
|
||||||
align-self:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.teacher{
|
|
||||||
grid-area:teacher;
|
|
||||||
align-self:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.credits{
|
|
||||||
grid-area:credits;
|
|
||||||
align-self:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.listElement{
|
.listElement{
|
||||||
border:2px solid black;
|
border:2px solid black;
|
||||||
|
@ -23,3 +23,11 @@ export async function editEquivalenceState(id, newstate){
|
|||||||
export async function addUninscReq(userId, reason){
|
export async function addUninscReq(userId, reason){
|
||||||
return restPost("/uninscriptionreq", {"userId" : userId, "reason" : reason})
|
return restPost("/uninscriptionreq", {"userId" : userId, "reason" : reason})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function editScholarshipReq(body){
|
||||||
|
return restPatch("/scholarshipreq/", body)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getScholarshipReqById(id){
|
||||||
|
return restGet("/scholarshipreq/"+id)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user