1
0
forked from PGL/Clyde

Implements the school fees gestion for a student and a payment table containing a history of all the financial transactions of the system

This commit is contained in:
2024-04-08 14:50:37 +02:00
parent 194b14f02b
commit e6e147af26
11 changed files with 238 additions and 15 deletions

View File

@ -12,6 +12,9 @@
async function upPage(id,review){
await validateRegister(id,review);
if (review == "Accepted"){
}
requests.value = await getAllRegisters();
}
</script>

View File

@ -6,12 +6,15 @@
import i18n from "@/i18n.js"
import { uploadProfilePicture } from '@/rest/uploads.js'
import CourseList from "@/Apps/CourseList.vue";
import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js";
import {postPayment} from "@/rest/payment.js";
const user = ref(await getSelf());
const UserCurriculum = ref("");
const curricula = ref (await getAllCurriculums());
const minerv = ref({});
if(user.value.role === "Student"){
minerv.value = ref(await getCurrentMinerval(user.value.regNo));
UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo);
}
@ -22,7 +25,8 @@
const curric = ref(false);
const reg = ref(false);
const courseslist = ref(false);
const minerval = ref(false);
const paymentPage = ref(false);
const pattern = {
profilPictureUrl:null,
email:null,
@ -37,7 +41,16 @@
id:null,
}
//Used to modelize a payment
const paymentData={
studentRegNo: user.value.regNo,
date:null,
card:null,
client:null,
expDate:null,
amount: null
}
const paymentAmount = ref(0);
let toModify= Object.assign({}, pattern);
let personnalInfos = Object.assign({}, patternInfos);
@ -117,7 +130,7 @@
<img class="subContainter" :src=getPP()>
</div>
<div class="globalInfos">
<div v-if="modif==false && curric==false && reg==false" class="infosContainer">
<div v-if="modif==false && curric==false && reg==false && minerval==false && paymentPage == false" class="infosContainer">
<div>
{{user.firstName}} {{user.lastName}}
</div>
@ -142,6 +155,42 @@
</div>
<div v-if="(user.role==='Student')">
<button @click="courseslist=!courseslist">Manage Courses</button>
<button @click="minerval = !minerval" style="margin-left: 2%">Manage minerval</button>
</div>
</div>
<div v-else-if="minerval" class="infosContainer">
<div v-if="minerv.value.toPay != 0">
Payment : {{minerv.value.toPay}} left to pay
<div v-if="minerv.value.paidAmount <= 50">
<button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = 50">Pay deposit (50)</button>
</div>
<div>
<button @click="minerval = !minerval; paymentPage = !paymentPage; paymentAmount = minerv.value.toPay">Pay all the rest ({{minerv.value.toPay}})</button>
</div>
</div>
<div v-else>
Payment : School fees have already been paid this year
</div>
</div>
<div v-else-if="paymentPage" class="infosContainer">
Proceed to payment of {{paymentAmount}}
<div style="margin-top: 1%">
Client:
<input type="text" v-model="paymentData.client">
</div>
<div style="margin-top: 1%">
Card:
<input type="text" v-model="paymentData.card">
</div>
<div style="margin-top: 1%">
ExpDate:
<input type="date" v-model="paymentData.expDate">
</div>
<div style="margin-top: 1%">
<button @click="paymentPage=!paymentPage;minerval=!minerval;paymentData.amount=paymentAmount;paymentData.date=new Date();postPayment(paymentData);minerv.value.toPay -= paymentAmount; minerv.value.paidAmount += paymentAmount; editMinerval(minerv.value)">Process Payment</button>
</div>
<div>
<button @click="minerval = !minerval; paymentPage = !paymentPage;">Back</button>
</div>
</div>
<div v-else-if="modif" class="infosContainer">
@ -207,7 +256,7 @@
</div>
</div>
</div>
<div v-if="modif==false && curric==false && reg==false "class="moreInfos">
<div v-if="modif==false && curric==false && reg==false && minerval==false"class="moreInfos">
<div class = "oldcursus">
<div class="listTitle">
Anciens Cursus

View File

@ -0,0 +1,9 @@
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
export async function getCurrentMinerval(userRegNo){
return restGet("/minerval/"+userRegNo)
}
export async function editMinerval(updatedMinerval){
return restPatch("/minerval", updatedMinerval)
}

View File

@ -0,0 +1,6 @@
import {restPost} from "@/rest/restConsumer.js";
export async function postPayment(payment){
return restPost("/payment", payment)
}