@extends('admin.layouts.app')
@section('title', 'Edit Top Seller')
@section('content')
<div class="card" style="max-width:700px">
    <div class="card-header">Edit Top Seller: {{ $topSeller->title }}</div>
    <form action="{{ route('admin.top-sellers.update', $topSeller) }}" method="POST" enctype="multipart/form-data">
        @csrf @method('PUT')
        <div class="form-group">
            <label>Title *</label>
            <input type="text" name="title" class="form-control" value="{{ old('title', $topSeller->title) }}" required>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Slug</label>
                <input type="text" name="slug" class="form-control" value="{{ old('slug', $topSeller->slug) }}">
            </div>
            <div class="form-group">
                <label>Price</label>
                <input type="number" step="0.01" name="price" class="form-control" value="{{ old('price', $topSeller->price) }}" min="0">
            </div>
        </div>
        <div class="form-group">
            <label>Description</label>
            <textarea name="description" class="form-control">{{ old('description', $topSeller->description) }}</textarea>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Link</label>
                <input type="text" name="link" class="form-control" value="{{ old('link', $topSeller->link) }}">
            </div>
            <div class="form-group">
                <label>Order</label>
                <input type="number" name="order" class="form-control" value="{{ old('order', $topSeller->order) }}" min="0">
            </div>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Image</label>
                <input type="file" name="image" class="form-control" accept="image/*">
                @if($topSeller->image) <small class="text-muted">Current: {{ $topSeller->image }}</small> @endif
            </div>
            <div class="form-group">
                <label class="checkbox-label" style="margin-top:25px"><input type="checkbox" name="is_active" value="1" {{ $topSeller->is_active ? 'checked' : '' }}> Active</label>
            </div>
        </div>
        <button type="submit" class="btn btn-primary">Update Top Seller</button>
    </form>
</div>
@endsection
