@extends('Admin.layouts.master')

@section('content')
@php
  $currentPage = 'manage_cms';
@endphp
<style>
    .error-message {
        color: #FF0000;
    }

    form .error-message {
        color: red;
        /* Set your desired color here */
    }

    form .input_class.error-message {
        color: #0e1726;
    }
</style>


<div class="layout-px-spacing">
    <div class="middle-content container-xxl p-0">
        <div class="row layout-top-spacing ">
            <div class="top-tabel">
                <div class="row">
                    <div class="col-md-4">
                        <a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.aboutUs') }}">
                            <img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}">
                            <h6 class="card-title p-0">Edit Details</h6>
                        </a>
                    </div>
                    <div class="col-md-8">

                    </div>
                </div>
            </div>
            <div class="col-xl-12 col-lg-12 col-sm-12  layout-spacing">
                <div class="widget-content widget-content-area br-8 position-btn h-10">
                    <div class="view-details Article">
                    <form id="update_about" enctype="multipart/form-data">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group ">
                                    <label for="company-name" class="label">Title</label>
                                    <input type="hidden" name="about_id" value="{{ $edit_service['id'] }}" class="form-control">
                                    <input type="text" class="form-control" value="{{ $edit_service['title'] }}" name="about_title">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group ">
                                    <label for="company-name" class="label">Image Upload</label>
                                    <input type="file" name="about_image" id="imageInputNormal" class="form-control">
                                    <div id="imageInputPreviewNormal" style="width: 30%;">
                                        <img src="{{ $edit_service['thumbnail_image'] }}" alt="Image Preview" style="width: 40%;">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group ">
                                    <label for="company-name" class="label">Description</label>
                                    <div id="about-quill-edit" class="editor-quill" style="height: 100px;">{!! $edit_service['description'] !!}</div>
                                    <input type="hidden" id="about_des" name="about_des" value="{{ $edit_service['description'] }}">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="company-name" class="label">Select Category</label>
                                    <select class="form-control input_class" id="company-name" name="category">
                                        <option value="">Select Category</option>
                                        @foreach ($about_us_cat as $about_us_catg)
                                            <option value="{{$about_us_catg['id']}}" @if($edit_service['category_xid'] == $about_us_catg['id']) selected @endif>{{$about_us_catg['name']}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <button class="download-btn-custom mt-3 custom-width-10" id="update_about_us">
                                    <span>Save</span>
                                </button>
                            </div>
                        </div>
                    </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



@endsection
@section('section_script')
<script>
    var quill = new Quill('#about-quill-edit', {
        theme: 'snow'
    });
    // Listen for changes and update the hidden input with the HTML content
    quill.on('text-change', function() {
            var htmlContent = quill.root.innerHTML;
            document.getElementById('about_des').value = htmlContent;
        });
</script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_aboutus/edit_about_us.js')}}"></script>

@endsection
