<x-app-layout>
    <x-ui.page-header title="Soumissions" :description="'Formulaire : ' . $form->title">
        <x-slot name="actions">
            <a href="{{ route('admin.forms.index') }}" class="btn-secondary btn-sm">← Formulaires</a>
        </x-slot>
    </x-ui.page-header>

    <div class="card overflow-hidden">
        <div class="overflow-x-auto">
            <table class="min-w-full table-modern">
                <thead>
                    <tr>
                        <th>Filiale</th>
                        <th>Utilisateur</th>
                        <th>Date de soumission</th>
                        <th class="text-right">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse($submissions as $submission)
                        <tr>
                            <td class="font-medium">{{ $submission->filiale->name }}</td>
                            <td>{{ $submission->user->name }}</td>
                            <td>{{ $submission->submitted_at?->format('d/m/Y à H:i') }}</td>
                            <td>
                                <x-ui.crud-actions :view="route('admin.submissions.show', $submission)" />
                            </td>
                        </tr>
                    @empty
                        <tr><td colspan="4" class="text-center py-12 text-slate-400">Aucune soumission reçue.</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
        @if($submissions->hasPages())
            <div class="px-6 py-4 border-t border-slate-100">{{ $submissions->links() }}</div>
        @endif
    </div>
</x-app-layout>
