From 5a57fc78f3e318669a3cc02a98a82e1cf4be08d9 Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Fri, 19 Apr 2024 09:31:55 +0200 Subject: [PATCH 1/4] Generalize the ExternalCurriculumList interface so it fits for inscriptionRequest, Studentlist, and inscriptionform --- .../src/Apps/Inscription/AboutRequest.vue | 2 +- .../Inscription/ExternalCurriculumList.vue | 73 +++++++++++++++---- frontend/src/Apps/Login.vue | 58 ++------------- 3 files changed, 68 insertions(+), 65 deletions(-) diff --git a/frontend/src/Apps/Inscription/AboutRequest.vue b/frontend/src/Apps/Inscription/AboutRequest.vue index 15c72f5..ec8ed74 100644 --- a/frontend/src/Apps/Inscription/AboutRequest.vue +++ b/frontend/src/Apps/Inscription/AboutRequest.vue @@ -62,7 +62,7 @@ async function editEquivalence(id, newstate){
- +
diff --git a/frontend/src/Apps/Inscription/ExternalCurriculumList.vue b/frontend/src/Apps/Inscription/ExternalCurriculumList.vue index eba1cdf..c467853 100644 --- a/frontend/src/Apps/Inscription/ExternalCurriculumList.vue +++ b/frontend/src/Apps/Inscription/ExternalCurriculumList.vue @@ -4,15 +4,23 @@ import {getSelf} from "@/rest/Users.js"; import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js"; - //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user + //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user, 2 inscription procedure const props = defineProps(["extCurrList", "mode"]) - const extCurrList = ref(props.extCurrList) + //Only usefull to pass the external curr array in the inscription procedure + const externalCurrTab = defineModel(); + + const extCurrList = ref({}) + let extNum = 0 + const User = ref({}) + + if (props.mode === 1){ + User.value = await getSelf() + } - const User = await getSelf() const list = ref(true) - + const editmode = ref(false) const notcompletedCheck = ref(false); const externalCurr = reactive({ @@ -28,22 +36,49 @@ if (props.mode === 1){ externalCurr.userRegNo = props.extCurrList[0].user.regNo + }else if(props.mode === 2){ + extCurrList.value = externalCurrTab.value + } + + if(props.mode !== 2){ + extCurrList.value = props.extCurrList + console.log("oe") + } + + function deleteExtCursus(extcursus){ + externalCurrTab.value.splice(externalCurrTab.value.indexOf(extcursus),1) } async function postExternalCurr(){ - await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo); - //We refresh the list - extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); - list.value = !list.value; + if (props.mode === 1){ + await createExternalCurriculum(externalCurr.inscriptionRequestId, externalCurr.school, externalCurr.formation, externalCurr.completion, externalCurr.startYear, externalCurr.endYear, externalCurr.justifdocUrl, externalCurr.userRegNo); + //We refresh the list + extCurrList.value = await getExternalCurriculumByUser(externalCurr.userRegNo); + list.value = !list.value; + }else if (props.mode === 2){ + externalCurrTab.value.push({ + inscriptionRequestId : externalCurr.inscriptionRequestId, + school:externalCurr.school, + formation :externalCurr.formation, + completion : externalCurr.completion, + startYear : externalCurr.startYear, + endYear: externalCurr.endYear, + justifdocUrl : externalCurr.justifdocUrl, + userRegNo : externalCurr.userRegNo + }); + extCurrList.value = externalCurrTab.value + list.value = !list.value; + console.log(externalCurrTab.value) + } } diff --git a/frontend/src/Apps/Inscription/ManageRequests.vue b/frontend/src/Apps/Inscription/ManageRequests.vue index 8fd7ddf..1aa9bf0 100644 --- a/frontend/src/Apps/Inscription/ManageRequests.vue +++ b/frontend/src/Apps/Inscription/ManageRequests.vue @@ -1,6 +1,6 @@