<x-admin-layout :title="$item->exists ? 'Edit Testimonial' : 'Create Testimonial'">
    <x-admin.form-panel :back-route="route('admin.testimonials.index')">
        <form method="POST" action="{{ $item->exists ? route('admin.testimonials.update', $item) : route('admin.testimonials.store') }}" class="space-y-4">
            @csrf
            @if ($item->exists) @method('PUT') @endif

            <div>
                <label class="block text-sm font-medium">Quote</label>
                <textarea name="quote" rows="4" class="admin-input" required>{{ old('quote', $item->quote) }}</textarea>
            </div>
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label class="block text-sm font-medium">Author Name</label>
                    <input name="author_name" value="{{ old('author_name', $item->author_name) }}" class="admin-input" required>
                </div>
                <div>
                    <label class="block text-sm font-medium">Author Role</label>
                    <input name="author_role" value="{{ old('author_role', $item->author_role) }}" class="admin-input">
                </div>
            </div>
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label class="block text-sm font-medium">Avatar Path</label>
                    <input name="avatar_path" value="{{ old('avatar_path', $item->avatar_path) }}" class="admin-input">
                </div>
                <div>
                    <label class="block text-sm font-medium">Sort Order</label>
                    <input type="number" name="sort_order" value="{{ old('sort_order', $item->sort_order ?? 0) }}" class="admin-input" required>
                </div>
            </div>
            <div class="flex items-center gap-2">
                <input type="checkbox" name="is_featured" value="1" @checked(old('is_featured', $item->is_featured ?? true))>
                <label class="text-sm font-medium">Featured</label>
            </div>
            <button type="submit" class="admin-btn-primary">Save</button>
        </form>
    </x-admin.form-panel>
</x-admin-layout>
