<script setup>
import i18n from "@/i18n.js"
import {getUser} from '../rest/Users.js'
import {getcurriculum, getSomeonesCurriculumList} from "@/rest/curriculum.js";
import {getRegisters} from "@/rest/ServiceInscription.js";

const props = defineProps(['target']);
let request = await getRegisters(props.target);
const cursus = await getcurriculum(request.curriculum);

function getPP(){
  if(request.profilePicture === null){
    return "/Clyde.png"
  }
  return request.profilePicture;
}
</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 : {{request.firstName}} {{request.lastName}}
          </div>
          <div>
            E-mail: {{request.email}}
          </div>
          <div>
            Adresse : {{request.address}}
          </div>
          <div>
            Pays : {{request.country}}
          </div>
          <div>
            Date de naissance : {{request.birthDate}}
          </div>
          <div>
            Cursus voulu : BAB {{cursus.year}} {{cursus.option}}
          </div>
        </div>
      </div>
    </div>
  </div>

</template>


<style scoped>
.container{
  display:grid;
  grid-template-columns:200px 900px;
  grid-template-rows:200px auto;
  column-gap:30px;
  row-gap:45px;
  grid-template-areas:
  "profilPic globalInfos"
  "minfos minfos";
}

.profilPic{
  grid-area:profilPic;
}

.globalInfos {
  grid-area:globalInfos;
  align-self :center;

}

.body {
  width:100%;
  margin-bottom:10px;
}

.subContainter{
  width:100%;
  background-color:rgb(50,50,50);
  border-radius:20px;
  border:4px solid black;
}

.infosContainer {
  padding-bottom:50px;
  border:2px solid black;
  font-size:25px;
  color:white;
  padding:20px;
  background-color:rgb(50,50,50);
  border-radius:20px;
}

.moreInfos {
  display:grid;
  grid-template-rows:200px auto;
  column-gap:50px;
  row-gap:45px;
  grid-template-areas:
  "minfos minfos";
  grid-template-columns:600px 600px;
}

.listTitle{
  display: flex;
  justify-content: center;
  align-items: center;
  width:250px;
  margin-left:auto;
  margin-right:auto;
  border:2px solid black;
  font-size:25px;
  color:white;
  padding:20px;
  background-color:rgb(50,50,50);
  border-radius:20px;margin-bottom:10px;
}

.listElement{
  border:2px solid black;
  font-size:25px;
  color:white;
  padding:20px;
  background-color:rgb(50,50,50);
  border-radius:20px;
  margin-bottom:10px;
}

.containerElement{
  justify-content:center;
  display:grid;
  grid-template-columns:100px 100px 300px;
  grid-template-areas:
    "year option dateyear";
  column-gap:40px;
  padding-left: 25px;
}
</style>