<script setup> import { editExempReqState, getExempReq, } from "@/rest/requests.js"; import i18n from "@/i18n.js"; import {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> {{ i18n("firstname/name") }} : {{req.user.firstName}} {{req.user.lastName}} </div> <div> {{ i18n("course") }}: {{req.course.title}} </div> <div> {{ i18n("state") }} : {{req.state}} </div> <div> <button @click="profile = !profile">{{ i18n("seeprofile") }}</button> </div> <div> <button><a :href="req.justifDocument">{{ i18n("dljustifdoc") }}</a></button> </div> <div> <button v-if="req.state === 'Pending'" @click="req.state='Accepted';editExemp('Accepted')">{{ i18n("request.accept") }}</button> <button v-if="req.state === 'Pending'" @click="req.state='Refused';editExemp('Refused')" style="margin-left: 2%;">{{ i18n("request.refuse") }}</button> </div> </div> </div> </div> </div> <div v-else> <AboutStudent :target="req.user.regNo"></AboutStudent> <button @click="profile=!profile" style="margin-left: 17%;margin-top: 3%">{{ i18n("backtoreq") }}</button> </div> <div> <button v-if="profile===false" @click="windowState = 0" style="margin-left: 31%">{{ i18n("courses.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"; } .globalInfos { grid-area:globalInfos; align-self :center; } .body { min-width:960px; width:100%; display:flex; align-items:center; justify-content:center; margin-top:7%; } .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; } button{ border:none; background-color:rgb(239, 60, 168); border-radius:10px; height:35px; margin-top:10px; } </style>