@extends('layouts.app_admin')
@section('title', 'Slider Image')
@push('css')
    <style>
        .form-row {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            gap: 20px;
        }

        .form-column {
            width: 48%;
            /* Adjust the width for proper spacing */
        }
    </style>
@endpush

@section('content')

    <!-- Main Content -->
    <div class="main-content">
        <section class="section">
            <div class="col-12 section-header">
                <div class="col-6">
                    <h1>Edit Slider Image</h1>
                </div>
            </div>

            @if ($errors->any())
                <div class="col-sm-12">
                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                        @foreach ($errors->all() as $error)
                            <span>
                                <p>{{ $error }}</p>
                            </span>
                        @endforeach
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                </div>
            @endif

            @include('flash-message')

            <div class="section-body">
                <div class="col-12">
                    <div class="card">
                        <div class="col-12 card-body">
                            <form method="POST" action="{{ route('slider-image.update', $id) }}" id="editForm"
                                enctype="multipart/form-data">
                                {{ method_field('PATCH') }}
                                {{ csrf_field() }}

                                <!-- Image Upload -->
                                <div class="form-group">
                                    <label>Image</label><br>
                                    @if ($sliderImage->image != null)
                                        <img src="{{ asset('images/sliderImage/' . $sliderImage->image) }}" width="400px"
                                            height="200px" alt="user photo" /><br>
                                    @endif
                                    <input type="file" name="image" class="form-control form-control-lg" />
                                </div>

                                <!-- Two-Column Layout -->
                                <div class="form-row">
                                    <!-- English Column -->
                                    <div class="form-column col-lg-6">
                                        <h5>English Details</h5>
                                        <div class="form-group">
                                            <label>Text One (English)<code></code></label>
                                            <input type="text" name="text_one_en" class="form-control form-control-lg"
                                                value="{{ $sliderImage->text_one_en }}">
                                        </div>
                                        <div class="form-group">
                                            <label>Text Two (English)<code></code></label>
                                            <input type="text" name="text_two_en" class="form-control form-control-lg"
                                                value="{{ $sliderImage->text_two_en }}">
                                        </div>
                                    </div>

                                    <!-- Bengali Column -->
                                    <div class="form-column col-lg-6">
                                        <h5>Bengali Details</h5>
                                        <div class="form-group">
                                            <label>Text One (Bengali)<code></code></label>
                                            <input type="text" name="text_one_bn" class="form-control form-control-lg"
                                                value="{{ $sliderImage->text_one_bn }}">
                                        </div>
                                        <div class="form-group">
                                            <label>Text Two (Bengali)<code></code></label>
                                            <input type="text" name="text_two_bn" class="form-control form-control-lg"
                                                value="{{ $sliderImage->text_two_bn }}">
                                        </div>
                                    </div>
                                </div>

                                <!-- Submit Button -->
                                <div class="card-footer text-right">
                                    <button class="btn btn-primary mr-1" type="submit">Update</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- End -->
    </div>

@endsection

@section('extra-js')
@endsection
