@extends('admin.layouts.app')
@section('title', 'Sliders')
@section('content')
<div class="action-bar">
    <span>{{ $sliders->total() }} sliders</span>
    <a href="{{ route('admin.sliders.create') }}" class="btn btn-primary">+ New Slider</a>
</div>
<div class="card">
    <table>
        <tr><th>Image</th><th>Title</th><th>Subtitle</th><th>Order</th><th>Active</th><th>Actions</th></tr>
        @foreach($sliders as $slider)
        <tr>
            <td><img src="{{ asset('storage/'.$slider->image) }}" class="product-img" alt=""></td>
            <td><strong>{{ $slider->title ?? '—' }}</strong></td>
            <td class="text-muted">{{ $slider->subtitle ?? '—' }}</td>
            <td>{{ $slider->order }}</td>
            <td>{!! $slider->is_active ? '<span style="color:#6fcf97">Yes</span>' : '<span style="color:#e74c3c">No</span>' !!}</td>
            <td class="inline-flex">
                <a href="{{ route('admin.sliders.edit', $slider) }}" class="btn btn-primary btn-sm">Edit</a>
                <form action="{{ route('admin.sliders.destroy', $slider) }}" method="POST" onsubmit="return confirm('Delete?')">
                    @csrf @method('DELETE')
                    <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                </form>
            </td>
        </tr>
        @endforeach
    </table>
    <div class="pagination">{{ $sliders->links() }}</div>
</div>
@endsection
