@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-12">
            <label>{{ meta('description', $language->local) ?? __('description.description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="description_{{$language->local}}" class="form-control my-editor {{ $errors->has('description_'.$language->local) ? 'is-invalid' : '' }}">{{ old("description_{$language->local}", $about->description['description_'.$language->local] ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('ceo_message', $language->local) ?? __('details.ceo_message') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="ceo_message_{{$language->local}}" class="form-control my-editor {{ $errors->has('ceo_message_'.$language->local) ? 'is-invalid' : '' }}" >{{ old("ceo_message_{$language->local}", $about->ceo_message['ceo_message_'.$language->local] ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('our_message', $language->local) ?? __('details.our_message') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="our_message_{{$language->local}}" class="form-control my-editor {{ $errors->has('our_message_'.$language->local) ? 'is-invalid' : '' }}">{{ old("our_message_{$language->local}", $about->our_message['our_message_'.$language->local] ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('vision', $language->local) ?? __('details.vision') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="vision_{{$language->local}}" class="form-control my-editor {{ $errors->has('vision_'.$language->local) ? 'is-invalid' : '' }}">{{ old("vision_{$language->local}", $about->vision['vision_'.$language->local] ?? "") }}</textarea>
        </div>
        @endforeach

        <div class="form-group col-lg-6">
            <label>{{ meta('statistics', $language->local) ?? __('details.statistics') }}</label>
            <input type="text" name="statistics" class="form-control {{ $errors->has('statistics') ? 'is-invalid' : '' }}" value="{{ old("statistics", $about->statistics ?? "") }}">
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('experience_year', $language->local) ?? __('details.experience_year') }}</label>
            <input type="number" name="experience_year" class="form-control {{ $errors->has('experience_year') ? 'is-invalid' : '' }}" value="{{ old("experience_year", $about->experience_year ?? "") }}">
        </div>


        {{--Start image container--}}
        <div class="border-item photos col-md-12 other_image_container">
            <div class="row">
                @if ($about ?? false)
                    @foreach ($about['photos'] as $photo)
                        <div class="col-md-4">
                            <div class="items">
                                <div class="img">
                                    <a href="{{ asset($photo ?? '')}}" data-fancybox="gallery"><img src="{{ asset($photo ?? '')}}" alt=""></a>
                                </div>
                                <input type="hidden" name="images[]" value="{{ $photo ?? "" }}">
                                <a href="#" class="close"><i class="fas fa-times"></i></a>
                            </div>
                        </div>
                    @endforeach
                @endif
            </div>
            <div class="text-center">
                <input id="other_image_thumbnail" class="other_image_thumbnail" type="hidden"/>
                <div class="clearfix"></div>
                <span id="add">
                    <a id="lfm" data-width="" data-cache="article_gallery" data-input=".other_image_thumbnail" data-preview="" data-show="" data-hide="" class="lfm add">
                        Add New Item
                    </a>
                </span>
            </div>
        </div>
        {{--End image 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('')}}";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>
@endsection



