@extends('admin.layouts.container')

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

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

        @foreach($languages as $language)
        <div class="form-group col-lg-6">
            <label>{{ meta('advantage_box_1_title', $language->local) ?? __('homeInfos.advantage_box_1_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('advantage_box_1_title_'.$language->local) ? 'is-invalid' : '' }}" name="advantage_box_1_title_{{ $language->local }}" placeholder="{{ meta('advantage_box_1_title', $language->local) ?? __('homeInfos.advantage_box_1_title') }}" value='{{ old("advantage_box_1_title_{$language->local}", $homeInfo[$language->local]->advantage_box_1_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('advantage_box_2_title', $language->local) ?? __('homeInfos.advantage_box_2_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('advantage_box_2_title_'.$language->local) ? 'is-invalid' : '' }}" name="advantage_box_2_title_{{ $language->local }}" placeholder="{{ meta('advantage_box_2_title', $language->local) ?? __('homeInfos.advantage_box_2_title') }}" value='{{ old("advantage_box_2_title_{$language->local}", $homeInfo[$language->local]->advantage_box_2_title ?? "") }}'/>
        </div>

        <div class="form-group col-lg-6">
            <label>{{ meta('advantage_box_3_title', $language->local) ?? __('homeInfos.advantage_box_3_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('advantage_box_3_title_'.$language->local) ? 'is-invalid' : '' }}" name="advantage_box_3_title_{{ $language->local }}" placeholder="{{ meta('advantage_box_3_title', $language->local) ?? __('homeInfos.advantage_box_3_title') }}" value='{{ old("advantage_box_3_title_{$language->local}", $homeInfo[$language->local]->advantage_box_3_title ?? "") }}'/>
        </div>

        <div class="form-group col-lg-6">
            <label>{{ meta('advantage_box_4_title', $language->local) ?? __('homeInfos.advantage_box_4_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('advantage_box_4_title_'.$language->local) ? 'is-invalid' : '' }}" name="advantage_box_4_title_{{ $language->local }}" placeholder="{{ meta('advantage_box_4_title', $language->local) ?? __('homeInfos.advantage_box_4_title') }}" value='{{ old("advantage_box_4_title_{$language->local}", $homeInfo[$language->local]->advantage_box_4_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('advantage_box_5_title', $language->local) ?? __('homeInfos.advantage_box_5_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('advantage_box_5_title_'.$language->local) ? 'is-invalid' : '' }}" name="advantage_box_5_title_{{ $language->local }}" placeholder="{{ meta('advantage_box_5_title', $language->local) ?? __('homeInfos.advantage_box_5_title') }}" value='{{ old("advantage_box_5_title_{$language->local}", $homeInfo[$language->local]->advantage_box_5_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('advantage_box_6_title', $language->local) ?? __('homeInfos.advantage_box_6_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('advantage_box_6_title_'.$language->local) ? 'is-invalid' : '' }}" name="advantage_box_6_title_{{ $language->local }}" placeholder="{{ meta('advantage_box_6_title', $language->local) ?? __('homeInfos.advantage_box_6_title') }}" value='{{ old("advantage_box_6_title_{$language->local}", $homeInfo[$language->local]->advantage_box_6_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('social_service_box_1_title', $language->local) ?? __('homeInfos.social_service_box_1_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('social_service_box_1_title_'.$language->local) ? 'is-invalid' : '' }}" name="social_service_box_1_title_{{ $language->local }}" placeholder="{{ meta('social_service_box_1_title', $language->local) ?? __('homeInfos.social_service_box_1_title') }}" value='{{ old("social_service_box_1_title_{$language->local}", $homeInfo[$language->local]->social_service_box_1_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('social_service_box_2_title', $language->local) ?? __('homeInfos.social_service_box_2_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('social_service_box_2_title_'.$language->local) ? 'is-invalid' : '' }}" name="social_service_box_2_title_{{ $language->local }}" placeholder="{{ meta('social_service_box_2_title', $language->local) ?? __('homeInfos.social_service_box_2_title') }}" value='{{ old("social_service_box_2_title_{$language->local}", $homeInfo[$language->local]->social_service_box_2_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('social_service_box_3_title', $language->local) ?? __('homeInfos.social_service_box_3_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('social_service_box_3_title_'.$language->local) ? 'is-invalid' : '' }}" name="social_service_box_3_title_{{ $language->local }}" placeholder="{{ meta('social_service_box_3_title', $language->local) ?? __('homeInfos.social_service_box_3_title') }}" value='{{ old("social_service_box_3_title_{$language->local}", $homeInfo[$language->local]->social_service_box_3_title ?? "") }}'/>
        </div>

        <div class="form-group col-lg-6">
            <label>{{ meta('social_service_box_4_title', $language->local) ?? __('homeInfos.social_service_box_4_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('social_service_box_4_title_'.$language->local) ? 'is-invalid' : '' }}" name="social_service_box_4_title_{{ $language->local }}" placeholder="{{ meta('social_service_box_4_title', $language->local) ?? __('homeInfos.social_service_box_4_title') }}" value='{{ old("social_service_box_4_title_{$language->local}", $homeInfo[$language->local]->social_service_box_4_title ?? "") }}'/>
        </div>

        <div class="form-group col-lg-12">
            <label>{{ meta('contact_box_title', $language->local) ?? __('homeInfos.contact_box_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('contact_box_title_'.$language->local) ? 'is-invalid' : '' }}" name="contact_box_title_{{ $language->local }}" placeholder="{{ meta('contact_box_title', $language->local) ?? __('homeInfos.contact_box_title') }}" value='{{ old("contact_box_title_{$language->local}", $homeInfo[$language->local]->contact_box_title ?? "") }}'/>
        </div>

        <div class="form-group col-lg-12">
            <label>{{ meta('advantage_box_1_description', $language->local) ?? __('homeInfos.advantage_box_1_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="advantage_box_1_description_{{ $language->local }}" class="form-control  {{ $errors->has('advantage_box_1_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('advantage_box_1_description', $language->local) ?? __('homeInfos.advantage_box_1_description') }}">{{ old("advantage_box_1_description_{$language->local}", $homeInfo[$language->local]->advantage_box_1_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('advantage_box_2_description', $language->local) ?? __('homeInfos.advantage_box_2_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="advantage_box_2_description_{{ $language->local }}" class="form-control  {{ $errors->has('advantage_box_2_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('advantage_box_2_description', $language->local) ?? __('homeInfos.advantage_box_2_description') }}">{{ old("advantage_box_2_description_{$language->local}", $homeInfo[$language->local]->advantage_box_2_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('advantage_box_3_description', $language->local) ?? __('homeInfos.advantage_box_3_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="advantage_box_3_description_{{ $language->local }}" class="form-control  {{ $errors->has('advantage_box_3_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('advantage_box_3_description', $language->local) ?? __('homeInfos.advantage_box_3_description') }}">{{ old("advantage_box_3_description_{$language->local}", $homeInfo[$language->local]->advantage_box_3_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('advantage_box_4_description', $language->local) ?? __('homeInfos.advantage_box_4_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="advantage_box_4_description_{{ $language->local }}" class="form-control  {{ $errors->has('advantage_box_4_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('advantage_box_4_description', $language->local) ?? __('homeInfos.advantage_box_4_description') }}">{{ old("advantage_box_4_description_{$language->local}", $homeInfo[$language->local]->advantage_box_4_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('advantage_box_5_description', $language->local) ?? __('homeInfos.advantage_box_5_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="advantage_box_5_description_{{ $language->local }}" class="form-control  {{ $errors->has('advantage_box_5_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('advantage_box_5_description', $language->local) ?? __('homeInfos.advantage_box_5_description') }}">{{ old("advantage_box_5_description_{$language->local}", $homeInfo[$language->local]->advantage_box_5_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('advantage_box_6_description', $language->local) ?? __('homeInfos.advantage_box_6_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="advantage_box_6_description_{{ $language->local }}" class="form-control  {{ $errors->has('advantage_box_6_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('advantage_box_6_description', $language->local) ?? __('homeInfos.advantage_box_6_description') }}">{{ old("advantage_box_6_description_{$language->local}", $homeInfo[$language->local]->advantage_box_6_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('social_service_box_1_description', $language->local) ?? __('homeInfos.social_service_box_1_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="social_service_box_1_description_{{ $language->local }}" class="form-control  {{ $errors->has('social_service_box_1_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('social_service_box_1_description', $language->local) ?? __('homeInfos.social_service_box_1_description') }}">{{ old("social_service_box_1_description_{$language->local}", $homeInfo[$language->local]->social_service_box_1_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('social_service_box_2_description', $language->local) ?? __('homeInfos.social_service_box_2_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="social_service_box_2_description_{{ $language->local }}" class="form-control  {{ $errors->has('social_service_box_2_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('social_service_box_2_description', $language->local) ?? __('homeInfos.social_service_box_2_description') }}">{{ old("social_service_box_2_description_{$language->local}", $homeInfo[$language->local]->social_service_box_2_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('social_service_box_3_description', $language->local) ?? __('homeInfos.social_service_box_3_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="social_service_box_3_description_{{ $language->local }}" class="form-control  {{ $errors->has('social_service_box_3_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('social_service_box_3_description', $language->local) ?? __('homeInfos.social_service_box_3_description') }}">{{ old("social_service_box_3_description_{$language->local}", $homeInfo[$language->local]->social_service_box_3_description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('social_service_box_4_description', $language->local) ?? __('homeInfos.social_service_box_4_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="social_service_box_4_description_{{ $language->local }}" class="form-control  {{ $errors->has('social_service_box_4_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('social_service_box_4_description', $language->local) ?? __('homeInfos.social_service_box_4_description') }}">{{ old("social_service_box_4_description_{$language->local}", $homeInfo[$language->local]->social_service_box_4_description ?? "") }}</textarea>
        </div>

        <div class="form-group col-lg-12">
            <label>{{ meta('contact_box_description', $language->local) ?? __('homeInfos.contact_box_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="contact_box_description_{{ $language->local }}" class="form-control  {{ $errors->has('contact_box_description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('contact_box_description', $language->local) ?? __('homeInfos.contact_box_description') }}">{{ old("contact_box_description_{$language->local}", $homeInfo[$language->local]->contact_box_description ?? "") }}</textarea>
        </div>

        @endforeach
            <div class="card col-md-12 mb-5">
                <div class="card-header">
                    <h5 class="card-title">{{__('homeInfos.first_box_points')}}</h5>
                </div>
                <div class="card-body first_box_points">
                    @if(count($firstBoxes))
                        @foreach($firstBoxes['ar'] as $key => $firstBox)
                            <div class="point_item row justify-content-between align-items-center">
                                <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.arabic') }} </label>
                                    <input type="text" class="form-control" name="first_box_points[ar][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.arabic') }}" value='{{$firstBox}}'/>
                                </div>
                                <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.english') }} </label>
                                    <input type="text" class="form-control" name="first_box_points[en][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.english')}}" value='{{$firstBoxes['en'][$key]}}'/>
                                </div>
                                <div class="form-group col-lg-1">
                                    <a class="btn btn-danger delete_point" href="#"><i class="fa fa-times"></i></a>
                                </div>
                            </div>
                        @endforeach
                    @endif
                </div>
                <div class="card-footer">
                    <a data-target=".first_box_points" data-field-name="first_box_points" class="btn btn-primary btn-block add_point" href="#"><i class="fa fa-plus"></i></a>
                </div>
            </div>
            <div class="card col-md-12 mb-5">
                <div class="card-header">
                    <h5 class="card-title">{{__('homeInfos.second_box_points')}}</h5>
                </div>
                <div class="card-body second_box_points">
                    @if(count($secondBoxes))
                        @foreach($secondBoxes['ar'] as $key => $secondBox)
                            <div class="point_item row justify-content-between align-items-center">
                            <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.arabic') }} </label>
                                    <input type="text" class="form-control" name="second_box_points[ar][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.arabic') }}" value='{{$secondBox}}'/>
                                </div>
                                <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.english') }} </label>
                                    <input type="text" class="form-control" name="second_box_points[en][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.english')}}" value='{{$secondBoxes['en'][$key]}}'/>
                                </div>
                                <div class="form-group col-lg-1">
                                    <a class="btn btn-danger delete_point" href="#"><i class="fa fa-times"></i></a>
                                </div>
                            </div>
                        @endforeach

                    @endif
                </div>
                <div class="card-footer">
                    <a data-target=".second_box_points" data-field-name="second_box_points" class="btn btn-primary btn-block add_point" href="#"><i class="fa fa-plus"></i></a>
                </div>
            </div>
            <div class="card col-md-12 mb-5">
                <div class="card-header">
                    <h5 class="card-title">{{__('homeInfos.third_box_points')}}</h5>
                </div>
                <div class="card-body third_box_points">
                    @if(count($thirdBoxes))
                        @foreach($thirdBoxes['ar'] as $key => $thirdBox)
                            <div class="point_item row justify-content-between align-items-center">
                            <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.arabic') }} </label>
                                    <input type="text" class="form-control" name="third_box_points[ar][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.arabic') }}" value='{{$thirdBox}}'/>
                                </div>
                                <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.english') }} </label>
                                    <input type="text" class="form-control" name="third_box_points[en][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.english')}}" value='{{$thirdBoxes['en'][$key]}}'/>
                                </div>
                                <div class="form-group col-lg-1">
                                    <a class="btn btn-danger delete_point" href="#"><i class="fa fa-times"></i></a>
                                </div>
                            </div>
                        @endforeach
                    @endif
                </div>
                <div class="card-footer">
                    <a data-target=".third_box_points" data-field-name="third_box_points" class="btn btn-primary btn-block add_point" href="#"><i class="fa fa-plus"></i></a>
                </div>
            </div>
            <div class="card col-md-12 mb-5">
                <div class="card-header">
                    <h5 class="card-title">{{__('homeInfos.fourth_box_points')}}</h5>
                </div>
                <div class="card-body fourth_box_points">
                    @if(count($fourthBoxes))
                        @foreach($fourthBoxes['ar'] as $key => $fourthBox)
                            <div class="point_item row justify-content-between align-items-center">
                            <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.arabic') }} </label>
                                    <input type="text" class="form-control" name="fourth_box_points[ar][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.arabic') }}" value='{{$fourthBox}}'/>
                                </div>
                                <div class="form-group col-lg-5">
                                    <label>{{ __('homeInfos.point') . __('homeInfos.english') }} </label>
                                    <input type="text" class="form-control" name="fourth_box_points[en][]" placeholder="{{ __('homeInfos.point') . __('homeInfos.english')}}" value='{{$fourthBoxes['en'][$key]}}'/>
                                </div>
                                <div class="form-group col-lg-1">
                                    <a class="btn btn-danger delete_point" href="#"><i class="fa fa-times"></i></a>
                                </div>
                            </div>
                        @endforeach
                    @endif
                </div>
                <div class="card-footer">
                    <a data-target=".fourth_box_points" data-field-name="fourth_box_points" class="btn btn-primary btn-block add_point" href="#"><i class="fa fa-plus"></i></a>
                </div>
            </div>

            <div class="point_container d-none">
                @include('admin.home_infos.point')
            </div>

            {{--Start advantage_image container--}}
            <div class="form-group col-lg-3">
                <label>{{ meta('advantage_image', getCurrentLocale()) ?? __('homeInfos.advantage_image') }} </label>
                <input id="advantage_image_thumbnail" class="advantage_image_thumbnail" type="hidden" name="advantage_image" value="{{old("advantage_image", $homeInfo->advantage_image ?? "")}}"/>

                <div class="photos advantage_image_main_photo {{ old('advantage_image', $homeInfo->advantage_image ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-12">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".advantage_image_thumbnail" data-preview=".advantage_image_holder" class="lfm" data-hide=".advantage_image_pick_button">
                                    <img src="{{asset(old('advantage_image', $homeInfo->advantage_image ?? ''))}} "  id="advantage_image_holder" class="advantage_image_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".advantage_image_thumbnail" data-hide=".advantage_image_main_photo" data-show=".advantage_image_pick_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn advantage_image_pick_button {{ old('advantage_image', $homeInfo->advantage_image ?? '') ? 'hide' : '' }} ">
                <a id="lfm" data-input=".advantage_image_thumbnail" data-preview=".advantage_image_holder" data-show=".advantage_image_main_photo" data-hide=".advantage_image_pick_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> Choose
                </a>
            </span>
            </div>
            {{--End advantage_image container--}}

        {{--Start social_service_image container--}}
        <div class="form-group col-lg-3">
            <label>{{ meta('social_service_image', getCurrentLocale()) ?? __('homeInfos.social_service_image') }} </label>
            <input id="social_service_image_thumbnail" class="social_service_image_thumbnail" type="hidden" name="social_service_image" value="{{old("social_service_image", $homeInfo->social_service_image ?? "")}}"/>

            <div class="photos social_service_image_main_photo {{ old('social_service_image', $homeInfo->social_service_image ?? '') ? ' wow fadeInUp' : 'hide' }}">
                <div class="col-lg-12">
                    <div class="items">
                        <div class="img">
                            <a href="#" id="lfm" data-input=".social_service_image_thumbnail" data-preview=".social_service_image_holder" class="lfm" data-hide=".social_service_image_pick_button">
                                <img src="{{asset(old('social_service_image', $homeInfo->social_service_image ?? ''))}} "  id="social_service_image_holder" class="social_service_image_holder"/>
                            </a>
                        </div>
                        <a href="#" class="showHide resetImage close" data-empty=".social_service_image_thumbnail" data-hide=".social_service_image_main_photo" data-show=".social_service_image_pick_button"><i class="fas fa-times"></i></a>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>
            <span class="input-group-btn social_service_image_pick_button {{ old('social_service_image', $homeInfo->social_service_image ?? '') ? 'hide' : '' }} ">
                <a id="lfm" data-input=".social_service_image_thumbnail" data-preview=".social_service_image_holder" data-show=".social_service_image_main_photo" data-hide=".social_service_image_pick_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> Choose
                </a>
            </span>
        </div>
        {{--End social_service_image container--}}


        <div class="text-center mt-5 col-12">
            <button class="butn add_home_info_button"><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>
        var route_prefix = "{{ url(config('lfm.prefix')) }}";
        var url = "{{url('/')}}/",
            currentLanguage = "{{getCurrentLocale()}}",
            inputName = null;
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>


    <script>

        $('.add_home_info_button').click(async function (e) {
            e.preventDefault();
            $(this).prop('disabled', true);

            let form = $('.add_home_info_form'),
                data = new FormData(form[0]),
                url = form.attr('action'),
                method = form.attr('method');

            const response=await ajax({
                url,
                data,
                dataType: 'json',
                method
            });

            if (response.url){
                window.location.href = response.url;
            }

            if (response.errors){
                $(this).prop('disabled', false);
                toasterError(response.errors);
            }

        });


        $('.add_point').click(function (e) {
            e.preventDefault();
            let pointContainer = $('.point_container').html(),
                fieldsName = $(this).data('field-name');
            $($(this).data('target')).append(pointContainer);

            $($(this).data('target') + ' input.appended').each(function () {
                $(this).attr('name', fieldsName+$(this).attr('name'));
                $(this).removeClass('appended');
            });
        });
        $(document).on('click', '.delete_point', function (e) {
            e.preventDefault();
            $(this).parents('.point_item').remove();
        })
    </script>

@endsection



