{% extends 'base.html.twig' %}
{% block title %}{{user.username}}{% endblock %}
{% block body %}

  <head>
    <!-- Custom -->
  </head>

  <body>
    {% include 'header.html.twig' %}
    <main>
      <div style="width: 75%; margin: auto">
        <h2 class="fw-bold ">Profil</h2>
        <form action="/profile/{{user.id}}" method="post" enctype="multipart/form-data">
          {# Username #}
          <div class="">
            <label for="username">Nom d'utilisateur</label>
            <input name="username" type="text" placeholder="JohnDoe" value="{{user.username}}">
          </div>
          {# Email #}
          <div class=""> 
            <label for="username">Email</label>
            <input name="email" type="email" placeholder = "mail@example.com" value="{{user.email}}">
          </div>
          {# Password #}
          <div class="">
            <label for="password">Mot de passe</label>
            <input name="password" type="password" placeholder="mdp">
          </div>
          {# Error message #}
          {% if message_register is defined %}<div class="text-danger font-weight-bold ">{{ message_register }}</div>{% endif %}
          {# Password again #}
          <div class="">
              <label for="repassword">Confirmez le mot de passe</label>
              <input name="repassword" type="password" placeholder="mdp" >
          </div>
          {# Image #}
          <div class=" w-50" style="float:left">
            <input name="image" type="file">
            <label for="image">Image</label>
          </div>
          <div class ="w-50 ps-4" style="float:right">
            <img src="{{user.image}}" alt="Image de profil" height="128" class="">
          </div>
          {# Submit #} 
          <button class="  btn btn-lg rounded-4 btn-primary" type="submit">Modifier</button>
          {# Delete #}
          <a class=" btn btn-lg ms-3 rounded-4 btn-danger" href="/delete/{{user.id}}" comfirm="Êtes vous sure de vouloir supprimer votre compte ?">Supprimer le compte</a
        </form>
        {# Message profil maj #}
        {% if message_profile is defined %}<div class="text-success font-weight-bold">{{ message_profile }}</div>{% endif %}
      </div>
      {% if user.google == "" %}
      <p class="text-center ">AJOUTER GOOGLE AU COMPTE</p>
      <div id="g_id_onload"
        data-client_id="1041713159432-vad6qp7ce7p9iid9qjdiopi7n6ajvmtv.apps.googleusercontent.com"
        data-login_uri="/auth"
        data-auto_prompt="false"
      ></div>
      <button class="g_id_signin"></button>
      {% endif %}
    </main>
    {% include "footer.html.twig"%}
  </body>

{% endblock %}


