@extends('backoffice.layouts.app')
@section('contents')
    <div class="py-4">
        <nav aria-label="breadcrumb" class="d-none d-md-inline-block">
            <ol class="breadcrumb breadcrumb-dark breadcrumb-transparent">
                <li class="breadcrumb-item">
                    <a href="{{ route('admin.dashboard') }}">
                        <svg class="icon icon-xxs" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                            xmlns="http://www.w3.org/2000/svg">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6">
                            </path>
                        </svg>
                    </a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Home</li>
            </ol>
        </nav>
        <div class="d-flex justify-content-between w-100 flex-wrap">
            <div class="mb-3 mb-lg-0">
                <h1 class="h4">Home</h1>
                {{-- <p class="mb-0">Dozens of reusable components built to provide buttons, alerts, popovers, and more.</p> --}}
            </div>
            <div>
                {{-- <a href="https://themesberg.com/docs/volt-bootstrap-5-dashboard/components/tables/"
                    class="btn btn-outline-gray-600 d-inline-flex align-items-center">
                    <svg class="icon icon-xs me-1" fill="currentColor" viewBox="0 0 20 20"
                        xmlns="http://www.w3.org/2000/svg">
                        <path fill-rule="evenodd"
                            d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z"
                            clip-rule="evenodd"></path>
                    </svg>
                    Bootstrap Tables Docs
                </a> --}}
            </div>
        </div>
    </div>

    <div class="card border-0 shadow components-section">
        <div class="card-body">
            <div class="row">
                <div class="col-lg-12 col-sm-12">
                    <form action="{{ route('home.store') }}" method="POST" enctype="multipart/form-data">
                        @csrf

                        <div class="mb-4">
                            <label for="page_title">Page Title</label>
                            <input type="text" class="form-control @error('page_title') is-invalid @enderror"
                                name="page_title" id="page_title"
                                value="{{ old('page_title', $homeSection->page_title ?? '') }}" placeholder="Enter here"
                                data-bs-toggle="tooltip" title="@error('page_title') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="section_one_heading">Section One Heading</label>
                            <input type="text" class="form-control @error('section_one_heading') is-invalid @enderror"
                                name="section_one_heading" id="section_one_heading"
                                value="{{ old('section_one_heading', $homeSection->section_one_heading ?? '') }}"
                                placeholder="Enter here" data-bs-toggle="tooltip"
                                title="@error('section_one_heading') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="editordata">Section One Description</label>
                            <textarea class="summernote @error('editordata') is-invalid @enderror" name="editordata" data-bs-toggle="tooltip"
                                title="@error('editordata') {{ $message }} @enderror">  {{ old('editordata', $homeSection->section_one_description ?? '') }}</textarea>
                        </div>

                        <div class="mb-4">
                            <label for="section_one_button_text">Section One Button Text</label>
                            <input type="text"
                                class="form-control @error('section_one_button_text') is-invalid @enderror"
                                name="section_one_button_text" id="section_one_button_text"
                                value="{{ old('section_one_button_text', $homeSection->section_one_button_text ?? '') }}"
                                placeholder="Enter here" data-bs-toggle="tooltip"
                                title="@error('section_one_button_text') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="thumbnail">Section One Image</label>

                            @if (isset($homeSection->section_one_image))
                                <div class="mb-2">
                                    <img src="{{ asset($homeSection->section_one_image) }}" class="img-fluid"
                                        alt="Section One Image" style="max-width: 300px; height: 170px;">
                                </div>
                            @endif

                            <input type="file" name="thumbnail" id="thumbnail"
                                class="form-control @error('thumbnail') is-invalid @enderror" data-bs-toggle="tooltip"
                                title="@error('thumbnail') {{ $message }} @enderror" accept="image/*">
                        </div>



                        <div class="mb-4">
                            <label for="search_filter_heading">Search Filter Heading</label>
                            <input type="text" name="search_filter_heading" id="search_filter_heading"
                                class="form-control @error('search_filter_heading') is-invalid @enderror"
                                value="{{ old('search_filter_heading', $homeSection->search_filter_heading ?? '') }}"
                                placeholder="Enter here" data-bs-toggle="tooltip"
                                title="@error('search_filter_heading') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="second_section_heading">Second Section Heading</label>
                            <input type="text" name="second_section_heading" id="second_section_heading"
                                class="form-control @error('second_section_heading') is-invalid @enderror"
                                value="{{ old('second_section_heading', $homeSection->second_section_heading ?? '') }}"
                                placeholder="Enter here" data-bs-toggle="tooltip"
                                title="@error('second_section_heading') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="second_section_button_text">Second Section Button Text</label>
                            <input type="text" name="second_section_button_text" id="second_section_button_text"
                                class="form-control @error('second_section_button_text') is-invalid @enderror"
                                value="{{ old('second_section_button_text', $homeSection->second_section_button_text ?? '') }}"
                                placeholder="Enter here" data-bs-toggle="tooltip"
                                title="@error('second_section_button_text') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="third_section_heading">Third Section Heading</label>
                            <input type="text" name="third_section_heading" id="third_section_heading"
                                class="form-control @error('third_section_heading') is-invalid @enderror"
                                value="{{ old('third_section_heading', $homeSection->third_section_heading ?? '') }}"
                                placeholder="Enter here" data-bs-toggle="tooltip"
                                title="@error('third_section_heading') {{ $message }} @enderror">
                        </div>

                        <div class="mb-4">
                            <label for="third_section_description">Third Section Description</label>
                            <textarea name="third_section_description" id="third_section_description"
                                class="form-control @error('third_section_description') is-invalid @enderror" rows="4"
                                placeholder="Enter description">{{ old('third_section_description', $homeSection->third_section_description ?? '') }}</textarea>
                        </div>

                        <div class="mb-4">
                            <label for="third_section_image">Third Section Image</label>

                            @if (isset($homeSection->third_section_image))
                                <div class="mb-2">
                                    <img src="{{ asset($homeSection->third_section_image) }}" class="img-fluid"
                                        alt="Third Section Image" style="max-width: 300px; height: 170px;">
                                </div>
                            @endif

                            <input type="file" name="third_section_image" id="third_section_image"
                                class="form-control" accept="image/*">
                        </div>



                        <div class="mb-4">
                            <button class="btn btn-gray-800 w-100" type="submit">Save</button>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
@endsection
<style>
    .dropify-wrapper .dropify-preview img {
        max-width: 100% !important;
        max-height: 170px !important;
        /* Adjust the height as needed */
        object-fit: cover !important;
    }
</style>


<script>
    var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
    tooltipTriggerList.map(function(tooltipTriggerEl) {
        return new bootstrap.Tooltip(tooltipTriggerEl)
    })
</script>
