{% extends 'dashboard/base.twig' %}

{% block title %}Catégorie{% endblock %}
{% block title_header %}Catégorie{% endblock %}

{% block actions %}
    <div class="flex items-center space-x-3">
        <a data-turbo="false"  href="{{ path('app_crm_category_add') }}" class="flex items-center space-x-2 px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white text-[10px] font-black uppercase tracking-[0.2em] rounded-xl transition-all shadow-lg shadow-blue-600/20 group">
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M12 4v16m8-8H4" />
            </svg>
            <span>Nouvelle catégorie</span>
        </a>
    </div>
{% endblock %}
{% block body %}
    <div class="backdrop-blur-xl bg-[#1e293b]/40 border border-white/5 rounded-[2.5rem] overflow-hidden shadow-2xl animate-in fade-in duration-700">
        <div class="overflow-x-auto">
            <table class="w-full text-left border-collapse">
                <thead>
                <tr class="border-b border-white/5 bg-black/20">
                    <th class="px-6 py-5 text-[10px] font-black text-slate-300 uppercase tracking-[0.2em]">Nom</th>
                    <th class="px-6 py-5 text-[10px] font-black text-slate-300 uppercase tracking-[0.2em] text-right">Actions</th>
                </tr>
                </thead>
                <tbody class="divide-y divide-white/5">
                {% for category in categorys %}
                    <tr class="group hover:bg-white/[0.02] transition-colors">

                        {# CLIENT #}
                        <td class="px-6 py-4">
                            <div class="flex flex-col">
                                    <span class="text-[11px] font-mono font-bold text-blue-500 tracking-wider">
                                        {{ category.name }}
                                    </span>
                            </div>
                        </td>



                        {# ACTIONS #}
                        <td class="px-6 py-4 text-right">
                            <div class="flex items-center justify-end space-x-2">
                                <a data-turbo="false" href="{{ path('app_crm_category_delete', {id: category.id}) }}?_token={{ csrf_token('delete' ~ category.id) }}"
                                   data-turbo-method="post"
                                   data-turbo-confirm="Confirmer la suppression de la catégorie {{ category.name }} ?"
                                   class="p-2 bg-rose-500/10 hover:bg-rose-600 text-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/20">
                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
                                </a>
                            </div>
                        </td>
                    </tr>
                {% else %}
                    <tr>
                        <td colspan="6" class="py-24 text-center">
                            <p class="text-slate-500 italic uppercase tracking-[0.2em] text-[10px] font-black">Aucun devis trouvé</p>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}
