@extends('backend.admin.layouts.app')
@section('content')
    <div class="pagetitle">
        <h1>Dashboard</h1>
        <nav>
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                <li class="breadcrumb-item">Dashboard</li>
                <li class="breadcrumb-item active">{{ $PageTitle }}</li>
            </ol>
        </nav>
    </div>

    <section class="section dashboard">
        <div class="row">
            <div class="col-lg-9">
                <div class="card">
                    <div class="card-body mt-3">
                        <form action="{{ route('admin.slider.store') }}" method="POST" enctype="multipart/form-data">
                            @csrf

                            <div class="row mt-4 mb-4">
                                <label for="image" class="col-sm-3 col-form-label">Fallback Banner Image</label>
                                <div class="col-sm-8 mb-25">
                                    <div class="upload-img-box">
                                        <img src="">
                                        <input type="file" name="image" id="image" accept="image/*" onchange="previewFile(this)">
                                        <div class="upload-img-box-icon">
                                            <i class="fa-solid fa-camera"></i>
                                        </div>
                                    </div>
                                    <p class="col-sm-10 mt-2 mb-0">Optional. YouTube video না থাকলে এই image show করবে.</p>
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="image_type" class="col-sm-3 col-form-label">Type</label>
                                <div class="col-sm-9">
                                    <select class="form-select" id="image_type" name="type" required>
                                        <option value="" selected disabled>Select type</option>
                                        <option value="large" {{ old('type') == 'large' ? 'selected' : '' }}>Large</option>
                                        <option value="small" {{ old('type') == 'small' ? 'selected' : '' }}>Small</option>
                                    </select>
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="title" class="col-sm-3 col-form-label">Right Side Title</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control @error('title') is-invalid @enderror"
                                           value="{{ old('title') }}" name="title" id="title"
                                           placeholder="Enter right side title">
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="description" class="col-sm-3 col-form-label">Right Side Description</label>
                                <div class="col-sm-9">
                                    <textarea class="form-control @error('description') is-invalid @enderror"
                                              name="description" id="description" rows="5"
                                              placeholder="Enter right side content">{{ old('description') }}</textarea>
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="youtube_url" class="col-sm-3 col-form-label">Left Side YouTube URL</label>
                                <div class="col-sm-9">
                                    <input type="url" class="form-control @error('youtube_url') is-invalid @enderror"
                                           value="{{ old('youtube_url') }}" name="youtube_url" id="youtube_url"
                                           placeholder="https://www.youtube.com/watch?v=...">
                                    <small class="text-muted">YouTube link দিলেই homepage header এর left side এ 1:1 video embed হবে.</small>
                                </div>
                            </div>

                            <div class="row mb-3">
                                <label for="img_ifo" class="col-sm-3 col-form-label">Image Alternative Info</label>
                                <div class="col-sm-9">
                                    <input type="text"
                                           class="form-control @error('img_info') is-invalid @enderror"
                                           value="{{ old('img_info') }}"
                                           name="img_info"
                                           id="img_ifo"
                                           placeholder="image alternative info">
                                </div>
                            </div>

                            <div class="row mb-3">
                                <div class="col-sm-10">
                                    <button type="submit" class="btn btn-primary">Save</button>
                                </div>
                            </div>

                        </form>
                    </div>
                </div>

            </div>
        </div>
    </section>
@endsection

@push('style')
    <style>
        .upload-img-box {
            width: 100%;
            height: 250px;
        }
    </style>
@endpush
