@extends('admin.layout')

@section('title', 'Modifier le temoignage')

@section('content')
    <h1>Modifier le temoignage</h1>
    <p class="muted">{{ $testimonial->author_name }}</p>

    @if($errors->any())
        <div style="background:#fee2e2;color:#991b1b;padding:12px 16px;border-radius:10px;margin-bottom:16px;font-size:14px;">
            {{ $errors->first() }}
        </div>
    @endif

    <div class="card">
        <form method="post" action="{{ route('admin.testimonials.update', $testimonial) }}" enctype="multipart/form-data">
            @csrf
            @method('PUT')
            @include('admin.testimonials._form', ['testimonial' => $testimonial])
            <button type="submit" class="btn">Mettre a jour</button>
            <a href="{{ route('admin.testimonials.index') }}" style="margin-left:12px;">Retour</a>
        </form>

        <form method="post" action="{{ route('admin.testimonials.destroy', $testimonial) }}" style="margin-top:22px;padding-top:18px;border-top:1px solid #e7eaee;" onsubmit="return confirm('Supprimer ce temoignage ?');">
            @csrf
            @method('DELETE')
            <button type="submit" class="btn secondary" style="background:#fef2f2;color:#b91c1c;border-color:#fecaca;">Supprimer</button>
        </form>
    </div>
@endsection
