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

{% block title %}Mes Missions{% endblock %}

{% block body %}
    <div class="space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500">
        
        <div class="flex items-center justify-between">
            <h1 class="text-2xl font-black text-slate-900 tracking-tight">Mes Missions</h1>
            <span class="bg-blue-100 text-blue-600 text-xs font-bold px-3 py-1 rounded-full">{{ missions|length }}</span>
        </div>

        <div class="space-y-4">
            {% for mission in missions %}
                <a href="{{ path('etl_contrat_view', {id: mission.id}) }}" class="block bg-white rounded-[1.5rem] p-5 border border-slate-100 shadow-sm hover:border-blue-100 transition-all group">
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <p class="text-[10px] font-black uppercase tracking-widest text-slate-400 mb-1">
                                {{ mission.dateAt|date('d/m H:i') }} <span class="text-slate-300 mx-1">➜</span> {{ mission.endAt|date('d/m H:i') }}
                            </p>
                            <h3 class="font-bold text-slate-900 group-hover:text-blue-600 transition-colors">{{ mission.addressEvent }}</h3>
                            <p class="text-xs text-slate-500">{{ mission.zipCodeEvent }} {{ mission.townEvent }}</p>
                        </div>
                        <span class="inline-flex items-center justify-center w-8 h-8 rounded-full bg-blue-50 text-blue-600 group-hover:bg-blue-600 group-hover:text-white transition-colors">
                            <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="M9 5l7 7-7 7" /></svg>
                        </span>
                    </div>
                    
                    <div class="flex items-center gap-3 pt-4 border-t border-slate-50">
                        <div class="flex flex-col">
                            <span class="text-[9px] font-bold text-slate-400 uppercase">Client</span>
                            <span class="text-xs font-bold text-slate-700">{{ mission.customer.surname }} {{ mission.customer.name }}</span>
                        </div>
                        <div class="ml-auto">
                             <span class="px-2 py-1 rounded-lg text-[9px] font-black uppercase tracking-wide
                                {{ mission.reservationState == 'ready' ? 'bg-emerald-50 text-emerald-600' : 'bg-amber-50 text-amber-600' }}">
                                {{ mission.reservationState }}
                            </span>
                        </div>
                    </div>
                </a>
            {% else %}
                <div class="bg-white rounded-[2rem] border border-slate-100 p-8 text-center">
                    <div class="inline-flex p-4 bg-slate-50 rounded-full text-slate-300 mb-3">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" /></svg>
                    </div>
                    <p class="text-xs font-bold text-slate-900">Aucune mission</p>
                    <p class="text-[10px] text-slate-400 mt-1">Vous n'avez aucune mission assignée pour le moment.</p>
                </div>
            {% endfor %}
        </div>

    </div>
{% endblock %}
