@extends('adminlte::page')

@section('title', 'Add Slider')

@section('content_header')
    <h1>Add Slider</h1>
    <a href="{{ route('admin.sliders.index') }}" class="btn btn-secondary float-right">Back to Sliders</a>
@stop

@section('content')
    <div class="card">
        <div class="card-body">
            @if($errors->any())
                <div class="alert alert-danger">
                    <ul class="mb-0">
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif

            <form action="{{ route('admin.sliders.store') }}" method="POST" enctype="multipart/form-data">
                @csrf

                <div class="mb-3">
                    <label for="title" class="form-label">Title *</label>
                    <input type="text" name="title" id="title" class="form-control" value="{{ old('title') }}" required>
                </div>

                <div class="mb-3">
                    <label for="subtitle" class="form-label">Subtitle</label>
                    <input type="text" name="subtitle" id="subtitle" class="form-control" value="{{ old('subtitle') }}">
                </div>

                <div class="mb-3">
                    <label for="button_text" class="form-label">Button Text</label>
                    <input type="text" name="button_text" id="button_text" class="form-control" value="{{ old('button_text') }}">
                </div>

                <div class="mb-3">
                    <label for="button_link" class="form-label">Button Link</label>
                    <input type="url" name="button_link" id="button_link" class="form-control" value="{{ old('button_link') }}">
                </div>

                <div class="mb-3">
                    <label for="image" class="form-label">Image *</label>
                    <input type="file" name="image" id="image" class="form-control" required>
                </div>

                <div class="mb-3">
                    <label for="position" class="form-label">Position</label>
                    <input type="number" name="position" id="position" class="form-control" value="{{ old('position') }}">
                </div>

                <div class="form-check mb-3">
                    <input type="checkbox" name="is_active" id="is_active" class="form-check-input" value="1" {{ old('is_active') ? 'checked' : '' }}>
                    <label for="is_active" class="form-check-label">Active</label>
                </div>

                <button type="submit" class="btn btn-primary">Save Slider</button>
            </form>
        </div>
    </div>
@stop
