@php /** @var \App\Models\Testimonial $testimonial */ @endphp

<label for="tag">Tag (ex. CBT, Logistique)</label>
<input id="tag" type="text" name="tag" value="{{ old('tag', $testimonial->tag) }}" maxlength="120">

<label for="stars">Nombre d'etoiles (1 a 5)</label>
<select id="stars" name="stars" required>
    @foreach(range(1, 5) as $n)
    <option value="{{ $n }}" @selected((int) old('stars', $testimonial->stars ?? 5) === $n)>{{ $n }} etoile(s)</option>
    @endforeach
</select>

<label for="quote">Citation</label>
<textarea id="quote" name="quote" rows="4" required maxlength="5000">{{ old('quote', $testimonial->quote) }}</textarea>

<label for="author_name">Nom du client</label>
<input id="author_name" type="text" name="author_name" value="{{ old('author_name', $testimonial->author_name) }}" required maxlength="255">

<label for="author_role">Fonction / contexte</label>
<input id="author_role" type="text" name="author_role" value="{{ old('author_role', $testimonial->author_role) }}" maxlength="255" placeholder="Ex. Responsable Import">

{{-- <label for="avatar">Photo (optionnel)</label>
<input id="avatar" type="file" name="avatar" accept="image/jpeg,image/png,image/webp,image/gif">
<p style="font-size:13px;color:#5f6b76;margin:-8px 0 14px;">JPEG, PNG, WebP ou GIF — max 2 Mo.</p>
@error('avatar')
    <p style="color:#b91c1c;font-size:14px;margin:-6px 0 12px;">{{ $message }}</p>
@enderror --}}

@if($testimonial->exists && $testimonial->avatarDisplayUrl())
<div style="margin-bottom:14px;">
    <span style="font-size:13px;font-weight:600;display:block;margin-bottom:6px;">Photo actuelle</span>
    <img src="{{ $testimonial->avatarDisplayUrl() }}" alt="" style="max-width:120px;border-radius:50%;border:2px solid #e7eaee;">
</div>
<label class="row-check">
    <input type="hidden" name="remove_avatar" value="0">
    <input type="checkbox" name="remove_avatar" value="1" @checked(old('remove_avatar')==='1' )>
    Supprimer la photo
</label>
@endif

<label for="sort_order">Ordre d'affichage</label>
<input id="sort_order" type="number" name="sort_order" value="{{ old('sort_order', $testimonial->sort_order ?? 0) }}" min="0" max="9999">

<label class="row-check">
    <input type="hidden" name="is_published" value="0">
    <input type="checkbox" name="is_published" value="1" @checked(old('is_published', $testimonial->is_published ? '1' : '0') === '1')>
    Publie sur l'accueil
</label>
