@extends('admin.layout')

@section('title', 'Temoignages')

@section('content')
    <div style="display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:20px;">
        <div>
            <h1>Temoignages</h1>
            <p class="muted">Affiches sur la page d'accueil, section « Ce que disent nos clients ».</p>
        </div>
        <a class="btn" href="{{ route('admin.testimonials.create') }}">Nouveau temoignage</a>
    </div>

    <div class="card" style="padding:0;overflow:hidden;">
        <table>
            <thead>
                <tr>
                    <th>Ordre</th>
                    <th>Tag</th>
                    <th>Citation</th>
                    <th>Auteur</th>
                    <th>Publie</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @forelse($testimonials as $t)
                    <tr>
                        <td>{{ $t->sort_order }}</td>
                        <td>{{ $t->tag ?? '—' }}</td>
                        <td>{{ \Illuminate\Support\Str::limit($t->quote, 80) }}</td>
                        <td>{{ $t->author_name }}</td>
                        <td>{{ $t->is_published ? 'Oui' : 'Non' }}</td>
                        <td><a href="{{ route('admin.testimonials.edit', $t) }}">Modifier</a></td>
                    </tr>
                @empty
                    <tr>
                        <td colspan="6" style="color:#5f6b76;">Aucun temoignage.</td>
                    </tr>
                @endforelse
            </tbody>
        </table>
    </div>

    <div style="margin-top:20px;">{{ $testimonials->links() }}</div>
@endsection
