@extends('app.admin.layout.layout')
@section('title',__('Create Menu'))
@push('css')
    <link rel="stylesheet" href="{{asset('/assets/admin/plugins/src/image-uploader/uploader.css')}}">
@endpush
@section('content')
    <style>
        .form-control{
            border-radius: 10px;
            border: 1px solid #7b7bff;
            box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;        }
        .form-label{
            font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
        }
        .btn-success:hover{
            background-color: #7b7bff !important;
        }
        .layout-top-spacing{
            margin: 20px;
            border-radius: 15px;
            box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
        }
        .form-select{
            background-image: none !important;
        }
    </style>
    <br><br><br>
    <div class="card layout-top-spacing">
        <div class="card-body">
            <div class="page-title-container">
                <div class="row">
                    <!-- Title Start -->
                    <div class="col-12 col-md-7">
                        <h1 class="mb-0 pb-0 display-4" id="title">@lang('Create Menu')</h1>
                        <nav class="breadcrumb-container d-inline-block" aria-label="breadcrumb">
                                <ul class="breadcrumb pt-0">
                                        <li class="breadcrumb-item"><a href="{{ route('admin:home') }}">@lang('Home')</a></li>
                                        <li class="breadcrumb-item"><a href="{{ route('admin:menyus.index') }}">@lang('Menus')</a></li>
                                        <li class="breadcrumb-item"><a href="{{ route('admin:menyus.create') }}">@lang('Create Menu')</a></li>
                                </ul>
                        </nav>
                    </div>

                    <div class="col-12 col-md-5 d-flex align-items-start justify-content-end">
                        <a href="{{ route('admin:menyus.index') }}">
                            <button type="button" class="btn btn-outline-primary btn-icon btn-icon-start w-100 w-md-auto">
                                <i data-acorn-icon="arrow-left" class="me-2" data-acorn-size="17"></i>
                                <span>@lang('Back')</span>
                            </button>
                        </a>
                    </div>
                </div>
            </div>
            <form @class(["row needs-validation","was-validated" => $errors->any()]) action="{{route('admin:menyus.store')}}" method="post" novalidate enctype="multipart/form-data">
                @csrf

                     <x-admin.form.input
                        :label="__('Image')"
                        custom-div-class="col-12 col-lg-12"
                        name="image"
                        type="file"
                        :value="old('image')"
                        nullable/>

                   {{-- <x-admin.form.input
                        :label="__('Video')"
                        custom-div-class="col-12 col-lg-6"
                        name="video"
                        type="file"
                        :value="old('video')"
                        nullable/> --}}

                    <x-admin.form.input
                        :label="__('Title Az')"
                        name="title_az"
                        custom-div-class="col-12 col-lg-4"
                        :value="old('title_az')"
                        required/>

                    <x-admin.form.input
                        :label="__('Title Ru')"
                        name="title_ru"
                        custom-div-class="col-12 col-lg-4"
                        :value="old('title_ru')"
                        required/>

                    <x-admin.form.input
                        :label="__('Title En')"
                        name="title_en"
                        custom-div-class="col-12 col-lg-4"
                        :value="old('title_en')"
                        required/>

                    <x-admin.form.select
                        :label="__('Menu Category')"
                        id="menu_category"
                        name="category_id"
                        custom-div-class="col-12 col-lg-4"
                        :selected="old('category_id')"
                        :options="$menuCategories"
                        required/>


                        
                    @php
                        $viewOptions = [
                            '1' => 'Active',
                            '2' => 'Deactive',
                        ];
                    @endphp

                    <x-admin.form.select
                        :label="__('Active or Deactive')"
                        name="position"
                        custom-div-class="col-12 col-lg-4"
                        :selected="old('position')"
                        nullable
                        :options="$viewOptions"
                    />
                

                    <x-admin.form.input
                            :label="__('Number')"
                            name="number"
                            custom-div-class="col-12 col-lg-2"
                            :value="old('number')"
                            nullable/>

                    <x-admin.form.input
                        :label="__('Price')"
                        name="price"
                        custom-div-class="col-12 col-lg-2"
                        :value="old('price')"
                        required/>

                    <x-admin.form.text-area
                        :label="__('Description Az')"
                        name="description_az"
                        id="description_az"
                        class="editor-container"
                        type="text"
                        custom-div-class="col-12 col-lg-12"
                        :value="old('description_az')"/>

                    <x-admin.form.text-area
                        :label="__('Description Ru')"
                        name="description_ru"
                        id="description_ru"
                        class="editor-container"
                        type="text"
                        custom-div-class="col-12 col-lg-12"
                        :value="old('description_ru')"/>

                    <x-admin.form.text-area
                        :label="__('Description En')"
                        name="description_en"
                        id="description_en"
                        class="editor-container"
                        type="text"
                        custom-div-class="col-12 col-lg-12"
                        :value="old('description_en')"/>


                    {{-- <div class="col-span-12 mb-3">
                        <div class="form-check form-switch">
                            <input class="form-check-input" type="checkbox" id="use-background" name="show_in_main" @checked(old('show_in_main'))>
                            <label class="form-check-label" for="use-background">@lang('Show in main')</label>
                        </div>
                    </div> --}}

                    {{-- <div class="col-12 mb-3">
                        <label class="col-form-label">@lang('Gallery')</label>
                         <div id="partners" class="form-control"></div>
                     </div> --}}




                <x-admin.form.submit-button/>
            </form>
        </div>
    </div>
@endsection
@push('js')
    <script src="{{asset('/assets/admin/plugins/src/image-uploader/uploader.js')}}"></script>
    <script>
        $("#partners").imageUploader({
            label:"{{__('Drag & Drop files here or click to browse')}}",
            imagesInputName: 'partners',
            maxFiles: 50,
            maxSize: '2 * 1024 * 1024',
            allowedExt: 'jpg|jpeg|gif|png|webp|svg',
        });
    </script>

<script src="{{asset('/assets/admin/ckeditor/ckeditor.js')}}"></script>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        CKEDITOR.replace('description_az');
        CKEDITOR.replace('description_ru');
        CKEDITOR.replace('description_en');
        CKEDITOR.replace('description_meta');
        CKEDITOR.replace('condition_az');
        CKEDITOR.replace('condition_ru');
        CKEDITOR.replace('condition_en');
        CKEDITOR.replace('description');
        CKEDITOR.replace('keyword');
    });
</script>


    <script src="{{asset('/assets/admin/plugins/src/tinymce/tinymce.min.js')}}"></script>
    <script>
        let tinyDarkActive = JSON.parse(localStorage.getItem("theme")).settings.layout.darkMode;
        tinymce.init({
            selector: 'textarea',
            plugins: [
                'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
                'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
                'media', 'table', 'emoticons', 'help'
            ],
            skin: tinyDarkActive ? "oxide-dark" : null,
            content_css: tinyDarkActive ? "dark" : null,
            @if(in_array(app()->getLocale(),['az','ru']))
            language: '{{app()->getLocale()}}'
            @endif
        });
    </script>
@endpush
