@extends('layouts.app')

@section('page_title', 'Photo Slider')

@section('content')
    <div id="photo-slider-table">
        @if (session('success'))
            <div class="alert alert-success alert-dismissible fade show" role="alert">
                {{ session('success') }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        @endif
        @if (session('error'))
            <div class="alert alert-danger alert-dismissible fade show" role="alert">
                {{ session('error') }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        @endif
        @include('components.photo-slider-component', [
            'pageTitle' => 'Photo Slider',
            'data' => $sliders,
            'columns' => [
                ['name' => 'Title', 'key' => 'title', 'sortable' => true],
                ['name' => 'Type', 'key' => 'type', 'sortable' => true],
                ['name' => 'Start Date', 'key' => 'startDate', 'sortable' => true],
                ['name' => 'End Date', 'key' => 'endDate', 'sortable' => true]
            ],
            'actions' => ['view', 'delete'],
            'showAddButton' => true,
            'addButtonUrl' => route('photo-slider.create'),
            'showCheckboxes' => true,
            'showBatchDelete' => true,
            'showEditModal' => true,
            'showViewModal' => true,
            'currentPage' => $currentPage ?? 1,
            'lastPage' => $lastPage ?? 1,
            'total' => $total ?? 0,
        ])
        <div id="no-data-message" style="display: {{ empty($sliders) ? 'block' : 'none' }}; text-align: center; margin-top: 20px;">
            <p>No photo sliders found.</p>
        </div>
    </div>
@endsection