Start the rework of externalCurriculum interface
This commit is contained in:
		@ -88,7 +88,7 @@
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-if="extercurrlist==true">
 | 
			
		||||
      <ExternalCurriculumList :ext-curr-list="externalcurrlist"></ExternalCurriculumList>
 | 
			
		||||
      <ExternalCurriculumList :ext-curr-list="externalcurrlist" :mode="1"></ExternalCurriculumList>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,25 +1,91 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
  import i18n from "@/i18n.js";
 | 
			
		||||
  import {ref} from "vue";
 | 
			
		||||
  import {reactive, ref} from "vue";
 | 
			
		||||
  import {getSelf} from "@/rest/Users.js";
 | 
			
		||||
  import {createExternalCurriculum, getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
 | 
			
		||||
 | 
			
		||||
  const props = defineProps(["extCurrList"])
 | 
			
		||||
  //mode 0 = externalcurr related to inscrreq, 1 = externalcurr related to user
 | 
			
		||||
  const props = defineProps(["extCurrList", "mode"])
 | 
			
		||||
 | 
			
		||||
  const extCurrList = ref(props.extCurrList)
 | 
			
		||||
  console.log(extCurrList)
 | 
			
		||||
 | 
			
		||||
  const User = await getSelf()
 | 
			
		||||
 | 
			
		||||
  const list = ref(true)
 | 
			
		||||
 | 
			
		||||
  const notcompletedCheck = ref(false);
 | 
			
		||||
 | 
			
		||||
  const externalCurr = reactive({
 | 
			
		||||
    inscriptionRequestId : null,
 | 
			
		||||
    school:null,
 | 
			
		||||
    formation :null,
 | 
			
		||||
    completion : "completed",
 | 
			
		||||
    startYear : 0,
 | 
			
		||||
    endYear: 0,
 | 
			
		||||
    justifdocUrl : null,
 | 
			
		||||
    userRegNo : null
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  if (props.mode === 1){
 | 
			
		||||
    externalCurr.userRegNo = props.extCurrList[0].user.regNo
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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;
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template style="margin-top:5%;">
 | 
			
		||||
  <div style="display:flex; justify-content:center; " v-for="item in extCurrList">
 | 
			
		||||
    <div class="bodu">
 | 
			
		||||
      <div class="container">
 | 
			
		||||
        <div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
 | 
			
		||||
        <div class="school"><a>{{item.school}}</a></div>
 | 
			
		||||
        <div class="formation"><a>{{item.formation}}</a></div>
 | 
			
		||||
        <div class="completion"><a>{{item.completion}}</a></div>
 | 
			
		||||
        <div class="download"><button>Download document</button></div>
 | 
			
		||||
  <div v-if="list">
 | 
			
		||||
    <div v-if="User.regNo === externalCurr.userRegNo" style="margin-left: 2%;margin-top: 2%">
 | 
			
		||||
      <button @click="list = !list">Add external curriculum</button>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div style="display:flex; justify-content:center; " v-for="item in extCurrList">
 | 
			
		||||
      <div class="bodu">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
          <div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
 | 
			
		||||
          <div class="school"><a>{{item.school}}</a></div>
 | 
			
		||||
          <div class="formation"><a>{{item.formation}}</a></div>
 | 
			
		||||
          <div class="completion"><a>{{item.completion}}</a></div>
 | 
			
		||||
          <div class="download"><button>Download document</button></div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div v-else class="loginbox" style="margin-left: 35%; margin-top: 3%">
 | 
			
		||||
    <form class="form">
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>Ecole</p>
 | 
			
		||||
        <input type="text" v-model="externalCurr.school">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>Formation</p>
 | 
			
		||||
        <input type="text" v-model="externalCurr.formation">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>Cochez la case si vous n'avez terminé cette formation</p>
 | 
			
		||||
        <input v-model="notcompletedCheck" type="checkbox" id="checkboxformation">
 | 
			
		||||
        <div v-if="notcompletedCheck">
 | 
			
		||||
          <p>En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ?</p>
 | 
			
		||||
          <input type="text" v-model="externalCurr.completion">
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>Année de début</p>
 | 
			
		||||
        <input type="number" v-model="externalCurr.startYear">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox">
 | 
			
		||||
        <p>Année de fin</p>
 | 
			
		||||
        <input type="number" v-model="externalCurr.endYear">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="inputBox" style="margin-top: 3%; margin-bottom: 3%">
 | 
			
		||||
        <input type="submit" value="Upload curriculum" @click="postExternalCurr()">
 | 
			
		||||
      </div>
 | 
			
		||||
    </form>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
@ -61,18 +127,12 @@
 | 
			
		||||
  font-size: 70%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.download{
 | 
			
		||||
  grid-area: download;
 | 
			
		||||
  align-self:center;
 | 
			
		||||
}
 | 
			
		||||
button{
 | 
			
		||||
  font-size:15px;
 | 
			
		||||
  height:50px;
 | 
			
		||||
  width:75%;
 | 
			
		||||
  border:none;
 | 
			
		||||
  border-radius:20px;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.bodu {
 | 
			
		||||
  margin-top:2%;
 | 
			
		||||
@ -82,6 +142,43 @@ button{
 | 
			
		||||
  background-color:rgb(50,50,50);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.loginbox {
 | 
			
		||||
  background-color: rgb(24,24,24);
 | 
			
		||||
  width: 400px;
 | 
			
		||||
  display:flex;
 | 
			
		||||
  justify-content: center;
 | 
			
		||||
  border-radius: 5%;
 | 
			
		||||
  box-shadow:0 5px 25px #000000;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form {
 | 
			
		||||
  position:relative;
 | 
			
		||||
  width:100%;
 | 
			
		||||
  display: flex;
 | 
			
		||||
  flex-direction: column;
 | 
			
		||||
  align-items:center;
 | 
			
		||||
  gap: 3%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.inputBox input,select {
 | 
			
		||||
  width:100%;
 | 
			
		||||
  border: none;
 | 
			
		||||
  margin-right: 12.5%;
 | 
			
		||||
  padding-left: 2.5%;
 | 
			
		||||
  padding-top:2.5%;
 | 
			
		||||
  padding-bottom:2.5%;
 | 
			
		||||
  outline:none;
 | 
			
		||||
  border-radius: 10px;
 | 
			
		||||
  font-size:1.35em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.inputBox p{
 | 
			
		||||
  position:relative;
 | 
			
		||||
  z-index: 100;
 | 
			
		||||
  font-family:sans-serif ;
 | 
			
		||||
  color:rgb(239,60,168);
 | 
			
		||||
  transition: 0.5;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -100,7 +100,7 @@
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="setup">
 | 
			
		||||
        <div v-if="loginPage">
 | 
			
		||||
      <div v-if="loginPage">
 | 
			
		||||
      <div class='loginBox' style="margin-top:30%;">
 | 
			
		||||
          <form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form">
 | 
			
		||||
            <h1 style="color:rgb(239,60,168); font-family: sans-serif;">
 | 
			
		||||
@ -288,7 +288,6 @@
 | 
			
		||||
  justify-content: center;
 | 
			
		||||
  border-radius: 5%;
 | 
			
		||||
  box-shadow:0 5px 25px #000000;
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
.form {
 | 
			
		||||
  position:relative;
 | 
			
		||||
 | 
			
		||||
@ -9,11 +9,15 @@
 | 
			
		||||
  import {editMinerval, getCurrentMinerval} from "@/rest/minerval.js";
 | 
			
		||||
  import {postPayment} from "@/rest/payment.js";
 | 
			
		||||
  import {addUninscReq, createScholarshipRequest, postChangeCurrReq} from "@/rest/requests.js";
 | 
			
		||||
  import ExternalCurriculumList from "@/Apps/Inscription/ExternalCurriculumList.vue";
 | 
			
		||||
  import {getExternalCurriculumByUser} from "@/rest/externalCurriculum.js";
 | 
			
		||||
 | 
			
		||||
  const user = ref(await getSelf());
 | 
			
		||||
  const UserCurriculum = ref(""); 
 | 
			
		||||
  const curricula = ref (await getAllCurriculums());
 | 
			
		||||
  const minerv = ref({});
 | 
			
		||||
  const extcurrlist = ref(await getExternalCurriculumByUser(user.value.regNo))
 | 
			
		||||
 | 
			
		||||
  if(user.value.role === "Student"){
 | 
			
		||||
    minerv.value = ref(await getCurrentMinerval(user.value.regNo));
 | 
			
		||||
    UserCurriculum.value = await getSomeonesCurriculumList(user.value.regNo);
 | 
			
		||||
@ -25,7 +29,7 @@
 | 
			
		||||
 | 
			
		||||
  const sure = ref(0);
 | 
			
		||||
 | 
			
		||||
  //0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister
 | 
			
		||||
  //0 base, 1 modif, 2 curriculum, 3 register, 4 courselist, 5 minerval, 6 payment, 7 scholarship, 8 scholarshipinfos, 9 unregister, 10 sure, 11 aboutunregister, 12 manage external curriculums
 | 
			
		||||
  const windowState = ref(0);
 | 
			
		||||
 | 
			
		||||
  const isChecked = ref(false);
 | 
			
		||||
@ -68,7 +72,7 @@
 | 
			
		||||
  const changecurrdata = reactive({
 | 
			
		||||
    userId : user.value.regNo,
 | 
			
		||||
    actualcursus:null,
 | 
			
		||||
    newcursus:null
 | 
			
		||||
    newcursus:1
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  //Used to post a uninscription request
 | 
			
		||||
@ -80,7 +84,9 @@
 | 
			
		||||
  const paymentAmount = ref(0);
 | 
			
		||||
  let toModify= Object.assign({}, pattern);
 | 
			
		||||
  let personnalInfos =  Object.assign({}, patternInfos);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  //Used to store the year of the new cursus selected in change cursus feature
 | 
			
		||||
  const selectedYear = ref(0);
 | 
			
		||||
  function resetInputs(inputs,list){
 | 
			
		||||
    inputs=Object.assign({},list); 
 | 
			
		||||
  }
 | 
			
		||||
@ -138,6 +144,9 @@
 | 
			
		||||
    return date.getFullYear()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async function refreshExtCurrList(){
 | 
			
		||||
    extcurrlist.value = await getExternalCurriculumByUser(user.value.regNo)
 | 
			
		||||
  }
 | 
			
		||||
  //This function travels through the student cursus array and extract the current cursus of the student
 | 
			
		||||
  function getActualCurriculumList(){
 | 
			
		||||
    let actualCurriculumList = [];
 | 
			
		||||
@ -188,7 +197,7 @@
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="body">
 | 
			
		||||
  <div class="body" v-if="windowState !== 12">
 | 
			
		||||
  <div class="container" v-if="windowState!==4">
 | 
			
		||||
    <div class="profilPic" v-if="windowState===0">
 | 
			
		||||
      <img class="subContainter" :src=getPP()>
 | 
			
		||||
@ -216,6 +225,7 @@
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="(user.role==='Student')">
 | 
			
		||||
            <button @click="windowState=2">{{i18n("profile.change.curriculum")}}</button>
 | 
			
		||||
            <button @click="windowState=12;refreshExtCurrList() ">Manage external curriculums</button>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="(user.role==='Student')">
 | 
			
		||||
            <button @click="windowState=4">Manage Courses</button>
 | 
			
		||||
@ -361,6 +371,9 @@
 | 
			
		||||
              <option v-for="item in getCurriculumsNextYear()" :value="item.curriculumId">Bac {{item.year}} {{item.option}}</option>
 | 
			
		||||
            </select>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div v-if="curricula[changecurrdata.newcursus-1].year > 1 && reRegState !== 1">
 | 
			
		||||
            The cursus you selected has some prerequisites
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <button @click=" windowState = 0;postChangeCurrReq(changecurrdata);changecurrdata.actualcursus=null;changecurrdata.newcursus=null">{{i18n("courses.confirm")}}</button>
 | 
			
		||||
            <button @click="windowState = 0; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
 | 
			
		||||
@ -422,6 +435,10 @@
 | 
			
		||||
      <button style="width: 10%; margin-top: 5%" @click="windowState = 0">Return to profile</button>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
  <div v-if="windowState === 12">
 | 
			
		||||
    <ExternalCurriculumList :ext-curr-list="extcurrlist" :mode="1"></ExternalCurriculumList>
 | 
			
		||||
    <button @click="windowState = 0;refreshExtCurrList()">Back to profile</button>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,16 @@
 | 
			
		||||
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
 | 
			
		||||
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
 | 
			
		||||
 | 
			
		||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){
 | 
			
		||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl, userRegNo){
 | 
			
		||||
    return restPost("/externalcurriculum", {
 | 
			
		||||
        inscriptionRequestId: inscriptionRequestId,
 | 
			
		||||
        school:school,
 | 
			
		||||
        formation :formation,
 | 
			
		||||
        completion : completion,
 | 
			
		||||
        startYear : parseInteger(startYear),
 | 
			
		||||
        endYear: parseInteger(endYear),
 | 
			
		||||
        justifdocUrl : justifdocUrl
 | 
			
		||||
        startYear : startYear,
 | 
			
		||||
        endYear: endYear,
 | 
			
		||||
        justifdocUrl : justifdocUrl,
 | 
			
		||||
        userRegNo : userRegNo
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user