<script setup>
  import i18n from "@/i18n.js"
  import {provide, reactive, ref} from 'vue'
  import { getStudents } from '../rest/Users.js'
  import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
  const users = await getStudents();

  let targetRegNo = "";
  let list = ref(true);
</script>

<template style="margin-top:5%;">
  <div v-if="list === false">
    <AboutStudent :target=targetRegNo />
    <button style="background-color:rgb(105,05,105);width:5%; margin-left: 10%;" @click="list = true;">{{ i18n("courses.back") }}</button>
  </div>
  <div style="display:flex; justify-content:center; " v-for="item in users" v-if="list === true">
    <div class="bodu">
      <div class="container">
        <div class="status"><a style="margin-left:30px">{{item.status}}</a></div>
        <div class="option"><a>{{item.role}}</a></div>
        <div class="surname"><a>{{item.lastName}}</a></div>
        <div class="firstname"><a>{{item.firstName}}</a></div>
        <div class="infos">
          <button style="background-color:rgb(105,05,105);" @click="list = false; targetRegNo = item.regNo;">{{i18n("request.moreInfos")}} </button>
        </div>
    </div>
    </div>
  </div>
</template>

<style scoped>
  .container{
    color:white;
    height:100px;
    font-size:30px;
    display:grid;
    grid-template-columns:21.7% 21.7% 21.7% 20% 13.1%;
    grid-template-areas:
    "status option surname firstname infos"; 
    column-gap:10px;
  }
  
  .infos {
    grid-area:infos;
    align-self:center;
  }

  .option{
    grid-area:option;
    align-self:center;
  }

  .status{
    grid-area:status;
    align-self:center;
  }

  .surname{
    grid-area:surname;
    align-self:center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow:ellipsis;
  }

  .firstname{
    grid-area:firstname;
    align-self:center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow:ellipsis;
  }

  button{
    font-size:15px;
    height:50px;
    width:75%;
    border:none;
    border-radius:20px;

  }

  .bodu {
    margin-top:2%;
    width:66%;
    border:2px solid black;
    border-radius:9px;
    background-color:rgb(50,50,50);
  }


</style>

