@extends('admin.layouts.app')
@section('title', 'Edit Testimonial')
@section('content')
<div class="card" style="max-width:700px">
    <div class="card-header">Edit Testimonial</div>
    <form action="{{ route('admin.testimonials.update', $testimonial) }}" method="POST" enctype="multipart/form-data">
        @csrf @method('PUT')
        <div class="form-row">
            <div class="form-group">
                <label>Name</label>
                <input type="text" name="name" class="form-control" value="{{ old('name', $testimonial->name) }}" required>
            </div>
            <div class="form-group">
                <label>Position</label>
                <input type="text" name="position" class="form-control" value="{{ old('position', $testimonial->position) }}">
            </div>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Company</label>
                <input type="text" name="company" class="form-control" value="{{ old('company', $testimonial->company) }}">
            </div>
            <div class="form-group">
                <label>Rating</label>
                <input type="number" name="rating" class="form-control" value="{{ old('rating', $testimonial->rating) }}" min="1" max="5">
            </div>
        </div>
        <div class="form-group">
            <label>Content</label>
            <textarea name="content" class="form-control" required>{{ old('content', $testimonial->content) }}</textarea>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Image</label>
                <input type="file" name="image" class="form-control" accept="image/*">
                @if($testimonial->image) <small class="text-muted">Has image</small> @endif
            </div>
            <div class="form-group">
                <label>Order</label>
                <input type="number" name="order" class="form-control" value="{{ old('order', $testimonial->order) }}" min="0">
            </div>
        </div>
        <div class="form-group">
            <label class="checkbox-label"><input type="checkbox" name="is_active" value="1" {{ $testimonial->is_active ? 'checked' : '' }}> Active</label>
        </div>
        <button type="submit" class="btn btn-primary">Update Testimonial</button>
    </form>
</div>
@endsection
