@extends('layouts.app')
@section('title', 'Mes demandes')
@section('content')
<h3 class="mb-4">Mes demandes</h3>

<div class="card p-3">
    <div class="table-responsive">
        <table class="table align-middle">
            <thead>
                <tr>
                    <th>#</th><th>Partenaire</th><th>Type</th><th>Statut</th><th>Urgence</th><th></th>
                </tr>
            </thead>
            <tbody>
                @forelse($requests as $r)
                <tr class="{{ $r->status === 'ecart' ? 'table-danger' : '' }}">
                    <td>{{ $r->id }}</td>
                    <td>{{ $r->partner->name }}</td>
                    <td>{{ \App\Models\ServiceRequest::types()[$r->type] }}</td>
                    <td><span class="badge {{ $r->status === 'ecart' ? 'badge-ecart' : 'bg-secondary' }}">{{ \App\Models\ServiceRequest::statuses()[$r->status] }}</span></td>
                    <td>{{ $r->urgency === 'urgent' ? '🔴' : '-' }}</td>
                    <td><a href="{{ route('courier.requests.show', $r) }}" class="btn btn-sm btn-outline-primary">Ouvrir</a></td>
                </tr>
                @empty
                <tr><td colspan="6" class="text-center text-muted">Aucune demande.</td></tr>
                @endforelse
            </tbody>
        </table>
    </div>
    {{ $requests->links() }}
</div>
@endsection
