@extends('admin.layouts.app')
@section('custom-styles')
<link rel="stylesheet" href="{{ asset('admin-assets/css/summernote.css') }}" />
   
@endsection
@section('content')

    <div class="row clearfix">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <div class="card">
                <div class="header">
                    <h2><strong>Theme </strong>Settings</h2>

                </div>
                <div class="mt-2">
                    @include('admin.layouts.partials.messages')
                </div>
                <div class="body">
                    @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <strong>Whoops!</strong> There were some problems with your input.<br><br>
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
                    <form method="POST"
                        action="@if ($content) {{ route('update.content') }}@else {{ route('store.content') }} @endif"
                        enctype="multipart/form-data">
                        @csrf
                        <input type="hidden" value="@if ($content) {{ $content->id }} @endif"
                            name="id">
                        <div class="row">
                            <div class="col-12">
                                <label class="form-label">Details</label>
                                <textarea class="summernote" name="details" placeholder="Details">
@if ($content)
{!! $content->details !!}
@endif
</textarea>
                            </div>

                        </div>
                        <br>
                        <div class="col-12">
                            <div class="d-grid">
                                <button type="submit" class="btn btn-primary">Save</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
@endsection
@section('custom-scripts')
    <script src="{{ asset('admin-assets/js/summernote.js') }}"></script>

    <script>
        jQuery(document).ready(function() {

            $('.summernote').summernote({
                height: 350, // set editor height
                minHeight: null, // set minimum height of editor
                maxHeight: null, // set maximum height of editor
                focus: false, // set focus to editable area after initializing summernote
                popover: {
                    image: [],
                    link: [],
                    air: []
                }
            });

            $('.inline-editor').summernote({
                airMode: true
            });

        });

        window.edit = function() {
                $(".click2edit").summernote()
            },
            window.save = function() {
                $(".click2edit").summernote('destroy');
            }
    </script>
@endsection
