Leo/InscriptionDesEtudiant #161
@ -15,6 +15,7 @@ import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.ScholarshipRequest;
|
||||
import ovh.herisson.Clyde.Tables.Inscription.UninscriptionRequest;
|
||||
|
||||
import javax.swing.text.html.parser.Entity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@ -94,4 +95,25 @@ public class RequestsController {
|
||||
uninscriptionRequestRepository.save(ur);
|
||||
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;
|
||||
|
||||
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 active=ref(false)
|
||||
|
||||
|
||||
const apps = ref([])
|
||||
appList().then(e => apps.value = e)
|
||||
|
||||
@ -33,7 +32,6 @@ window.addEventListener('hashchange', () => {
|
||||
|
||||
<template>
|
||||
<div class="container">
|
||||
|
||||
<div class="topBar">
|
||||
<ul class="horizontal">
|
||||
<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 AboutRequest from "@/Apps/Inscription/AboutRequest.vue";
|
||||
import {getAllExemptionsRequest, getAllScholarShipsRequest} from "@/rest/requests.js";
|
||||
import AboutScholarship from "@/Apps/Inscription/AboutScholarship.vue";
|
||||
|
||||
const requests = ref(await getAllRegisters());
|
||||
let targetId = "";
|
||||
@ -11,7 +12,7 @@
|
||||
const requestType = ref("inscription");
|
||||
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);
|
||||
|
||||
async function upPage(id,review){
|
||||
@ -79,7 +80,7 @@
|
||||
<div class="studentfirstname">{{item.user.firstName}}</div>
|
||||
<div class="studentlastname">{{item.user.lastName}}</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 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>
|
||||
@ -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="windowsState=0;">Retour</button>
|
||||
</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>
|
||||
|
||||
<style scoped>
|
||||
|
@ -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
|
||||
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);
|
||||
|
@ -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{
|
||||
border:2px solid black;
|
||||
|
@ -23,3 +23,11 @@ export async function editEquivalenceState(id, newstate){
|
||||
export async function addUninscReq(userId, 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