@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($staff ?? ''  && $staff->id)
            @method('PUT')
        @endif
        @csrf

        <div class="form-group col-lg-6">
            <label>{{ meta('email', $local) ?? __('staffs.email') }} </label>
            <input type="email" class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}" name="email" placeholder="{{ meta('email', $local) ?? __('staffs.email') }}" value='{{ old("email", $staff->email ?? "") }}'/>
        </div>

        <div class="form-group col-lg-6">
            <label>{{ meta('phone', $local) ?? __('staffs.phone') }} </label>
            <input type="tel" class="form-control {{ $errors->has('phone') ? 'is-invalid' : '' }}" name="phone" placeholder="{{ meta('phone', $local) ?? __('staffs.phone') }}" value='{{ old("phone", $staff->phone ?? "") }}'/>
        </div>

        <div class="form-group col-lg-6">
            <label>{{ meta('linkedin', $local) ?? __('staffs.linkedin') }} </label>
            <input type="url" class="form-control {{ $errors->has('linkedin') ? 'is-invalid' : '' }}" name="linkedin" placeholder="{{ meta('linkedin', $local) ?? __('staffs.linkedin') }}" value='{{ old("linkedin", $staff->linkedin ?? "") }}'/>
        </div>

        <div class="form-group col-lg-6">
            <label>{{ meta('twitter', $local) ?? __('staffs.twitter') }} </label>
            <input type="url" class="form-control {{ $errors->has('twitter') ? 'is-invalid' : '' }}" name="twitter" placeholder="{{ meta('twitter', $local) ?? __('staffs.twitter') }}" value='{{ old("twitter", $staff->twitter ?? "") }}'/>
        </div>

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

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

        <div class="form-group col-lg-12">
            <label>{{ meta('description', $language->local) ?? __('staffs.description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="description_{{ $language->local }}" class="form-control my-editor {{ $errors->has('description_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('description', $language->local) ?? __('staffs.description') }}">{{ old("description_{$language->local}", $staff[$language->local]->description ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('brief', $language->local) ?? __('staffs.brief') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="brief_{{ $language->local }}" class="form-control my-editor {{ $errors->has('brief_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('brief', $language->local) ?? __('staffs.brief') }}">{{ old("brief_{$language->local}", $staff[$language->local]->brief ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('practical_experience_title', $language->local) ?? __('staffs.practical_experience_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('practical_experience_title_'.$language->local) ? 'is-invalid' : '' }}" name="practical_experience_title_{{ $language->local }}" placeholder="{{ meta('practical_experience_title', $language->local) ?? __('staffs.practical_experience_title') }}" value='{{ old("practical_experience_title_{$language->local}", $staff[$language->local]->practical_experience_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('practical_experience', $language->local) ?? __('staffs.practical_experience') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="practical_experience_{{ $language->local }}" class="form-control my-editor {{ $errors->has('practical_experience_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('practical_experience', $language->local) ?? __('staffs.practical_experience') }}">{{ old("practical_experience_{$language->local}", $staff[$language->local]->practical_experience ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('training_courses_title', $language->local) ?? __('staffs.training_courses_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('training_courses_title_'.$language->local) ? 'is-invalid' : '' }}" name="training_courses_title_{{ $language->local }}" placeholder="{{ meta('training_courses_title', $language->local) ?? __('staffs.training_courses_title') }}" value='{{ old("training_courses_title_{$language->local}", $staff[$language->local]->training_courses_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('training_courses', $language->local) ?? __('staffs.training_courses') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="training_courses_{{ $language->local }}" class="form-control my-editor {{ $errors->has('training_courses_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('training_courses', $language->local) ?? __('staffs.training_courses') }}">{{ old("training_courses_{$language->local}", $staff[$language->local]->training_courses ?? "") }}</textarea>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('skills_title', $language->local) ?? __('staffs.skills_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <input type="text" class="form-control {{ $errors->has('skills_title_'.$language->local) ? 'is-invalid' : '' }}" name="skills_title_{{ $language->local }}" placeholder="{{ meta('skills_title', $language->local) ?? __('staffs.skills_title') }}" value='{{ old("skills_title_{$language->local}", $staff[$language->local]->skills_title ?? "") }}'/>
        </div>
        <div class="form-group col-lg-12">
            <label>{{ meta('skills', $language->local) ?? __('staffs.skills') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
            <textarea name="skills_{{ $language->local }}" class="form-control my-editor {{ $errors->has('skills_'.$language->local) ? 'is-invalid' : '' }}" placeholder="{{ meta('skills', $language->local) ?? __('staffs.skills') }}">{{ old("skills_{$language->local}", $staff[$language->local]->skills ?? "") }}</textarea>
        </div>

        @endforeach

        {{--Start image container--}}
        <div class="form-group col-lg-12">
            <label>{{ meta('image', getCurrentLocale()) ?? __('staffs.image') }} </label>
            <input id="image_thumbnail" class="image_thumbnail" type="hidden" name="image" value="{{old("image", $staff->image ?? "")}}"/>

            <div class="photos main_photo {{ old('image', $staff->image ?? '') ? ' wow fadeInUp' : 'hide' }}">
                <div class="col-lg-4">
                    <div class="items">
                        <div class="img">
                            <a href="#" id="lfm" data-input=".image_thumbnail" data-preview=".image_holder" class="lfm" data-hide=".pick_button">
                                <img src="{{asset(old('image', $staff->image ?? ''))}} "  id="image_holder" class="image_holder"/>
                            </a>
                        </div>
                        <a href="#" class="showHide resetImage close" data-empty=".image_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('image', $staff->image ?? '') ? 'hide' : '' }} ">
                <a id="lfm" data-input=".image_thumbnail" data-preview=".image_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 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>
        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>

@endsection



