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

{% block title %}Tag index{% endblock %}

{% block body %}
{{ include("dashboard/menu.html.twig") }}
<h1 class="text-center my-4">Tags </h1>

<table class="table">
    <thead>
        <tr>
            <th>Nom</th>
            <th>actions</th>
        </tr>
    </thead>
    <tbody>
        {% for tag in tags %}
        <tr>
            <td>
                <a href="{{ path('app_tag_show', {'id': tag.id}) }}">
                    {{ tag.nom }}
                </a>
            </td>
            <td>
                <div class="d-flex">
                    <a href="{{ path('app_tag_edit', {'id': tag.id}) }}" class="btn btn-success me-3">modifier</a>
                    <form method="post" action="{{ path('app_tag_delete', {'id': tag.id}) }}"
                        onsubmit="return confirm('Vous etes sur de supprimer?');">
                        <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ tag.id) }}">
                        <button class="btn btn-danger">Supprimer</button>
                    </form>
                </div>
            </td>
        </tr>
        {% else %}
        <tr>
            <td colspan="3">no records found</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

{% endblock %}