@extends('admin.layouts.container')

@section('content')
    <div class="side-title">
        <h3>{{$head ?? '' }}</h3>
    </div>

    <div class="border-item">
        <form class="form-row" method="post" action="{{ $action }}" enctype="multipart/form-data">
            @if($about ?? ''  && $about->id)
                @method('PUT')
            @endif
            @csrf

            @foreach($languages as $language)
                <div class="form-group col-lg-6">
                    <label>{{ meta('home_title_1', $language->local) ?? __('abouts.home_title_1') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <input type="text" class="form-control {{ $errors->has('home_title_1_'.$language->local) ? 'is-invalid' : '' }}" name="home_title_1_{{ $language->local }}" placeholder="{{ meta('home_title_1', $language->local) ?? __('abouts.home_title_1') }}" value='{{ old("home_title_1_{$language->local}", $about[$language->local]->home_title_1 ?? "") }}'/>
                </div>
                <div class="form-group col-lg-6">
                    <label>{{ meta('home_title_2', $language->local) ?? __('abouts.home_title_2') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <input type="text" class="form-control {{ $errors->has('home_title_2_'.$language->local) ? 'is-invalid' : '' }}" name="home_title_2_{{ $language->local }}" placeholder="{{ meta('home_title_2', $language->local) ?? __('abouts.home_title_2') }}" value='{{ old("home_title_2_{$language->local}", $about[$language->local]->home_title_2 ?? "") }}'/>
                </div>
                <div class="form-group col-lg-6">
                    <label>{{ meta('icon_1_title', $language->local) ?? __('abouts.icon_1_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <input type="text" class="form-control {{ $errors->has('icon_1_title_'.$language->local) ? 'is-invalid' : '' }}" name="icon_1_title_{{ $language->local }}" placeholder="{{ meta('icon_1_title', $language->local) ?? __('abouts.icon_1_title') }}" value='{{ old("icon_1_title_{$language->local}", $about[$language->local]->icon_1_title ?? "") }}'/>
                </div>
                <div class="form-group col-lg-6">
                    <label>{{ meta('icon_2_title', $language->local) ?? __('abouts.icon_2_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <input type="text" class="form-control {{ $errors->has('icon_2_title_'.$language->local) ? 'is-invalid' : '' }}" name="icon_2_title_{{ $language->local }}" placeholder="{{ meta('icon_2_title', $language->local) ?? __('abouts.icon_2_title') }}" value='{{ old("icon_2_title_{$language->local}", $about[$language->local]->icon_2_title ?? "") }}'/>
                </div>
                <div class="form-group col-lg-12">
                    <label>{{ meta('home_description_1', $language->local) ?? __('abouts.home_description_1') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <textarea name="home_description_1_{{ $language->local }}" class="form-control my-editor {{ $errors->has('home_description_1_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('home_description_1', $language->local) ?? __('abouts.home_description_1') }}">{{ old("home_description_1_{$language->local}", $about[$language->local]->home_description_1 ?? "") }}</textarea>
                </div>
                <div class="form-group col-lg-12">
                    <label>{{ meta('home_description_2', $language->local) ?? __('abouts.home_description_2') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <textarea name="home_description_2_{{ $language->local }}" class="form-control my-editor {{ $errors->has('home_description_2_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('home_description_2', $language->local) ?? __('abouts.home_description_2') }}">{{ old("home_description_2_{$language->local}", $about[$language->local]->home_description_2 ?? "") }}</textarea>
                </div>

                <div class="form-group col-lg-12">
                    <label>{{ meta('about_description_1', $language->local) ?? __('abouts.about_description_1') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <textarea name="about_description_1_{{ $language->local }}" class="form-control my-editor {{ $errors->has('about_description_1_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('about_description_1', $language->local) ?? __('abouts.about_description_1') }}">{{ old("about_description_1_{$language->local}", $about[$language->local]->about_description_1 ?? "") }}</textarea>
                </div>
                <div class="form-group col-lg-12">
                    <label>{{ meta('about_description_2', $language->local) ?? __('abouts.about_description_2') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                    <textarea name="about_description_2_{{ $language->local }}" class="form-control my-editor {{ $errors->has('about_description_2_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('about_description_2', $language->local) ?? __('abouts.about_description_2') }}">{{ old("about_description_2_{$language->local}", $about[$language->local]->about_description_2 ?? "") }}</textarea>
                </div>
            @endforeach


            {{--Start consultation image container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('home_image_1', getCurrentLocale()) ?? __('abouts.home_image_1') }} </label>
                <input id="home_image_1_thumbnail" class="home_image_1_thumbnail" type="hidden" name="home_image_1" value="{{old("home_image_1", $about->home_image_1 ?? "")}}"/>

                <div class="photos main_photo {{ old('home_image_1', $about->home_image_1 ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".home_image_1_thumbnail" data-preview=".home_image_1_holder" class="lfm" data-hide=".pick_button">
                                    <img src="{{asset(old('home_image_1', $about->home_image_1 ?? ''))}} "  id="home_image_1_holder" class="home_image_1_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".home_image_1_thumbnail" data-hide=".main_photo" data-show=".pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn pick_button {{ old('home_image_1', $about->home_image_1 ?? '') ? 'hide' : '' }} ">
                <a id="lfm" data-input=".home_image_1_thumbnail" data-preview=".home_image_1_holder" data-show=".main_photo" data-hide=".pick_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> Choose
                </a>
            </span>
            </div>
            {{--End why us home_image_1 container--}}

            {{--Start consultation home_image_2 container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('home_image_2', getCurrentLocale()) ?? __('abouts.home_image_2') }} </label>
                <input id="home_image_2_thumbnail" class="home_image_2_thumbnail" type="hidden" name="home_image_2" value="{{old("home_image_2", $about->home_image_2 ?? "")}}"/>

                <div class="photos home_image_2_main_photo {{ old('home_image_2', $about->home_image_2 ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".home_image_2_thumbnail" data-preview=".home_image_2_holder" class="lfm" data-hide=".home_image_2_pick_button">
                                    <img src="{{asset(old('home_image_2', $about->home_image_2 ?? ''))}} "  id="home_image_2_holder" class="home_image_2_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".home_image_2_thumbnail" data-hide=".home_image_2_main_photo" data-show=".home_image_2_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn home_image_2_pick_button {{ old('home_image_2', $about->home_image_2 ?? '') ? 'hide' : '' }} ">
            <a id="lfm" data-input=".home_image_2_thumbnail" data-preview=".home_image_2_holder" data-show=".home_image_2_main_photo" data-hide=".home_image_2_pick_button" class="lfm btn btn-primary text-light">
                <i class="fas fa-camera-retro"></i> Choose
            </a>
        </span>
            </div>
            {{--End why us home_image_2 container--}}

            {{--Start consultation about_image_1 container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('about_image_1', getCurrentLocale()) ?? __('abouts.about_image_1') }} </label>
                <input id="about_image_1_thumbnail" class="about_image_1_thumbnail" type="hidden" name="about_image_1" value="{{old("about_image_1", $about->about_image_1 ?? "")}}"/>

                <div class="photos about_image_1_main_photo {{ old('about_image_1', $about->about_image_1 ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".about_image_1_thumbnail" data-preview=".about_image_1_holder" class="lfm" data-hide=".about_image_1_pick_button">
                                    <img src="{{asset(old('about_image_1', $about->about_image_1 ?? ''))}} "  id="about_image_1_holder" class="about_image_1_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".about_image_1_thumbnail" data-hide=".about_image_1_main_photo" data-show=".about_image_1_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn about_image_1_pick_button {{ old('about_image_1', $about->about_image_1 ?? '') ? 'hide' : '' }} ">
            <a id="lfm" data-input=".about_image_1_thumbnail" data-preview=".about_image_1_holder" data-show=".about_image_1_main_photo" data-hide=".about_image_1_pick_button" class="lfm btn btn-primary text-light">
                <i class="fas fa-camera-retro"></i> Choose
            </a>
        </span>
            </div>
            {{--End why us about_image_1 container--}}

            {{--Start consultation about_image_2 container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('about_image_2', getCurrentLocale()) ?? __('abouts.about_image_2') }} </label>
                <input id="about_image_2_thumbnail" class="about_image_2_thumbnail" type="hidden" name="about_image_2" value="{{old("about_image_2", $about->about_image_2 ?? "")}}"/>

                <div class="photos about_image_2_main_photo {{ old('about_image_2', $about->about_image_2 ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".about_image_2_thumbnail" data-preview=".about_image_2_holder" class="lfm" data-hide=".about_image_2_pick_button">
                                    <img src="{{asset(old('about_image_2', $about->about_image_2 ?? ''))}} "  id="about_image_2_holder" class="about_image_2_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".about_image_2_thumbnail" data-hide=".about_image_2_main_photo" data-show=".about_image_2_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn about_image_2_pick_button {{ old('about_image_2', $about->about_image_2 ?? '') ? 'hide' : '' }} ">
            <a id="lfm" data-input=".about_image_2_thumbnail" data-preview=".about_image_2_holder" data-show=".about_image_2_main_photo" data-hide=".about_image_2_pick_button" class="lfm btn btn-primary text-light">
                <i class="fas fa-camera-retro"></i> Choose
            </a>
        </span>
            </div>
            {{--End why us about_image_2 container--}}

            {{--Start consultation about_logo container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('about_logo', getCurrentLocale()) ?? __('abouts.about_logo') }} </label>
                <input id="about_logo_thumbnail" class="about_logo_thumbnail" type="hidden" name="about_logo" value="{{old("about_logo", $about->about_logo ?? "")}}"/>

                <div class="photos about_logo_main_photo {{ old('about_logo', $about->about_logo ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".about_logo_thumbnail" data-preview=".about_logo_holder" class="lfm" data-hide=".about_logo_pick_button">
                                    <img src="{{asset(old('about_logo', $about->about_logo ?? ''))}} "  id="about_logo_holder" class="about_logo_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".about_logo_thumbnail" data-hide=".about_logo_main_photo" data-show=".about_logo_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn about_logo_pick_button {{ old('about_logo', $about->about_logo ?? '') ? 'hide' : '' }} ">
            <a id="lfm" data-input=".about_logo_thumbnail" data-preview=".about_logo_holder" data-show=".about_logo_main_photo" data-hide=".about_logo_pick_button" class="lfm btn btn-primary text-light">
                <i class="fas fa-camera-retro"></i> Choose
            </a>
        </span>
            </div>
            {{--End why us about_logo container--}}

            {{--Start consultation about_icon_1 container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('about_icon_1', getCurrentLocale()) ?? __('abouts.about_icon_1') }} </label>
                <input id="about_icon_1_thumbnail" class="about_icon_1_thumbnail" type="hidden" name="about_icon_1" value="{{old("about_icon_1", $about->about_icon_1 ?? "")}}"/>

                <div class="photos about_icon_1_main_photo {{ old('about_icon_1', $about->about_icon_1 ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".about_icon_1_thumbnail" data-preview=".about_icon_1_holder" class="lfm" data-hide=".about_icon_1_pick_button">
                                    <img src="{{asset(old('about_icon_1', $about->about_icon_1 ?? ''))}} "  id="about_icon_1_holder" class="about_icon_1_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".about_icon_1_thumbnail" data-hide=".about_icon_1_main_photo" data-show=".about_icon_1_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn about_icon_1_pick_button {{ old('about_icon_1', $about->about_icon_1 ?? '') ? 'hide' : '' }} ">
            <a id="lfm" data-input=".about_icon_1_thumbnail" data-preview=".about_icon_1_holder" data-show=".about_icon_1_main_photo" data-hide=".about_icon_1_pick_button" class="lfm btn btn-primary text-light">
                <i class="fas fa-camera-retro"></i> Choose
            </a>
        </span>
            </div>
            {{--End why us about_icon_1 container--}}

            {{--Start consultation about_icon_2 container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('about_icon_2', getCurrentLocale()) ?? __('abouts.about_icon_2') }} </label>
                <input id="about_icon_2_thumbnail" class="about_icon_2_thumbnail" type="hidden" name="about_icon_2" value="{{old("about_icon_2", $about->about_icon_2 ?? "")}}"/>

                <div class="photos about_icon_2_main_photo {{ old('about_icon_2', $about->about_icon_2 ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".about_icon_2_thumbnail" data-preview=".about_icon_2_holder" class="lfm" data-hide=".about_icon_2_pick_button">
                                    <img src="{{asset(old('about_icon_2', $about->about_icon_2 ?? ''))}} "  id="about_icon_2_holder" class="about_icon_2_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".about_icon_2_thumbnail" data-hide=".about_icon_2_main_photo" data-show=".about_icon_2_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn about_icon_2_pick_button {{ old('about_icon_2', $about->about_icon_2 ?? '') ? 'hide' : '' }} ">
            <a id="lfm" data-input=".about_icon_2_thumbnail" data-preview=".about_icon_2_holder" data-show=".about_icon_2_main_photo" data-hide=".about_icon_2_pick_button" class="lfm btn btn-primary text-light">
                <i class="fas fa-camera-retro"></i> Choose
            </a>
        </span>
            </div>
            {{--End why us about_icon_2 container--}}

            <div class="text-center mt-5 col-12">
                <button class="butn"><span>{{ __('dashboard.save') }}</span></button>
            </div>
        </form>
    </div>

@endsection

@section('inner_js')
    <!-- Editor JS files -->
    <script src="{{ asset('/assets/admin/js/lib/tinymce.min.js') }}"></script>
    {{--        <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>--}}
    <script>
        let route_prefix = "{{ url(config('lfm.prefix')) }}",
            url = "{{url('/')}}/",
            currentLanguage = "{{getCurrentLocale()}}",
            imagePath = "{{asset('')}}",
            inputName = "";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>
    <script src="{{ asset('assets/admin/js/articles.js') }}"></script>
@endsection


