{% extends "base.html.twig" %}

{% block pp %}{{pp}}{% endblock %}

{% block css %}{{css}}{% endblock %}

{% block title %}Amis - HearthTrack{% endblock %}

{% block user %}{{user}} - {{role}}{% endblock %}

{% block body %}
<div class="container-fluid px-4">
    <h1 class="mt-4">Liste d'ami</h1>
        <ol class="breadcrumb mb-4">
            <li class="breadcrumb-item"><a href="/">Accueil</a></li>
            <li class="breadcrumb-item active">Ami</li>
        </ol>
        <style>.btn-mrg{margin:15px; margin-left:87%}</style>
        <form method="get" action="/friend">
            <button class="btn btn-primary btn-mrg" id="btnNavbarSearch" type="submit">Ajouter un ami</button>
        </form>
        
        
                             <div class="card-body">
                            <div class="datatable-container">                                
                            	<table id="datatablesSimple" class="datatable-table">
                                {% if friendship is empty %}
                                        <p>Vous n'avez aucun ami.</p>
                                    {% else %}
                                    <thead>
                                        <tr>
                                            <th></th>
                                            <th>Nom</th>
                                            <th>Prénom</th>
                                            <th>Identifiant</th>
                                            <th></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for ami in friendship %}
                                            <tr>
                                                <td><style> .image-ronde{ clip-path:ellipse(50% 50%); } </style>
                                                <img src="/assets/img/person/{{ami.img}}.png" width="35px" height="35px" class="image-ronde"></td>
                                                <td>{{ami.nom}}</td>
                                                <td>{{ami.prenom}}</td>
                                                <td>{{ami.status}}</td>
                                                <td>
                                                    <div >
                                                    <form method="get" action="/mail">
                                                        <input type="hidden" name="username" value="{{ ami.username }}"><button class="btn" type="submit"><img src="/assets/img/msg.png"></button></input>
                                                    </form>
                                                    <form method="post" action="/friendlist">
                                                        <input type="hidden" name="username" value="{{ ami.username }}"><button class="btn" type="submit"><img src="/assets/img/block.png"></button></input>
                                                    </form>
                                                    <form method="post" action="/friendlist">
                                                        <input type="hidden" name="username" value="{{ ami.username }}"><button class="btn" type="submit"><img src="/assets/img/delete.png"></button></input>
                                                    </form>
                                                    </div>
                                                </td>
                                            </tr>
                                        {% endfor %}
                                    {% endif %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                </div>
          </div>
    </div>
{% endblock %}