
<script setup>
  import i18n from "@/i18n.js"
  import { getAllUsers } from '../rest/Users.js'
  import {ref} from "vue";
  import AboutUser from "@/Apps/AboutUser.vue";
  const list = ref(true)
  const targetRegNo =ref()


  const users = await getAllUsers();
  
</script> 
<template style="margin-top:5%;">
  <div v-if="list === false">
    <AboutUser :user=target />
    <button style="background-color:rgb(105,05,105);width:5%; margin-left: 10%;" @click="list = true;">Back</button>
  </div>
  <div style="display:flex; justify-content:center; min-width:1140px;" v-for="item in users" v-if="list">
    <div class="body">
      <div class="container">
        <div class="role"><a style="margin-left:30px">{{i18n(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; target = item;">{{i18n("request.moreInfos")}} </button>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
  .container{
    color:white;
    height:100px;
    font-size:30px;
    display:grid;
    grid-template-columns:27.7% 27.7% 27.7% 16.9%;
    grid-template-areas:
    "role surname firstname infos"; 

  }
  
  .infos {

    grid-area:infos;
    align-self:center;
  }

  .role {
    grid-area:role;
    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;

  }

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

