@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">
        <input type="hidden" name="user_id" value="{{auth()->id()}}">
        @if($package ?? ''  && $package->id)
            @method('PUT')
        @endif
        @csrf

        <div class="form-group col-lg-12">
            <label>{{ meta('package_category_id', $lang) ?? __('packages.category') }}</label>

            <select name="package_category_id" id="package_category_id" class="form-control {{ $errors->has('package_category_id') ? 'is-invalid' : '' }}">
                <option value="">{{meta('category_id', $lang) ?? __('packages.category')}}</option>
                @foreach ($packageCategories as $packageCategory)

                    <option {{old("package_category_id", $package->package_category_id ?? "") == $packageCategory->id ? 'selected': ''}} value="{{$packageCategory->id}}">{{$packageCategory->name ?? ''}}</option>
                @endforeach
            </select>
        </div>

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

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

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

        </div>

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

        <div class="form-group col-lg-12">
            <label>{{ meta('description', $language->local) ?? __('packages.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) ?? __('packages.description')}}">{{ old("description_{$language->local}", $package[$language->local]->description ?? "") }}</textarea>
        </div>

        @endforeach

        {{--Start Package Info--}}
        <div class="package_info col-12 row">
            <div class="form-group col-lg-12">
                <label>{{ __('packages.attach') }} </label>
                <input id="attach_thumbnail" class="attach_thumbnail" type="hidden" name="attach" value="{{old("attach", $package->attach ?? "")}}"/>

                <div class="photos main_attach {{ old('attach', $package->attach ?? '') ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-4">
                        <div class="items">
                            <div>
                                <a href="{{asset(old('attach', $package->attach ?? ''))}}" class="btn btn-primary attach_href" target="_blank" > Browse </a>

                                <a id="lfm" data-input=".attach_thumbnail" data-href=".attach_href" data-preview=".attach_holder" data-show=".main_attach" data-hide=".pick_attach_button" class="lfm btn btn-primary ml-4 text-light">
                                    <i class="fas fa-attach"></i> Choose
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".attach_thumbnail" data-hide=".main_attach" data-show=".pick_attach_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn pick_attach_button {{ old('attach', $package->attach ?? '') ? 'hide' : '' }} ">
                    <a id="lfm" data-input=".attach_thumbnail" data-href=".attach_href" data-preview=".attach_holder" data-show=".main_attach" data-hide=".pick_attach_button" class="lfm btn btn-primary text-light">
                        <i class="fas fa-attach"></i> Choose
                    </a>
                </span>
            </div>

            <div class="form-group col-lg-6">
                <label>{{ __('packages.price') }} </label>
                <div class="input-group mb-3">
                    <input type="number" step="0.01" class="form-control {{ $errors->has('price') ? 'is-invalid' : '' }}" name="price" placeholder="{{ __('packages.price') }}" value='{{ old("price", $package->price ?? "") }}'/>
                    <div class="input-group-append">
                        <span class="input-group-text" id="basic-addon2">SAR</span>
                    </div>
                    <div class="input-group-append">
                        <div class="input-group-text" id="basic-addon2">
                            <div class="form-check">
                                <input class="form-check-input" name="offer" type="checkbox" value="1" {{ old("offer", $package->offer ?? "") ? 'checked' : '' }} id="offer">
                                <label class="form-check-label" for="offer">{{ __('packages.offer') }}</label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group col-lg-6 old_price hide">
                <label>{{ __('packages.old_price') }} </label>
                <div class="input-group mb-3">
                    <input type="number" step="0.01" class="form-control {{ $errors->has('old_price') ? 'is-invalid' : '' }}" name="old_price" placeholder="{{ __('packages.old_price') }}" value='{{ old("old_price", $package->old_price ?? "") }}'/>
                    <div class="input-group-append">
                        <span class="input-group-text" id="basic-addon2">SAR</span>
                    </div>
                </div>
            </div>

            <div class="col-12"></div>

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

            <div class="form-group col-lg-6">
                <label>{{ __('packages.flight_duration_label') }} </label>
                <div class="input-group mb-3">
                    <input type="text" class="form-control  html-duration-picker {{ $errors->has('flight_duration') ? 'is-invalid' : '' }}" name="flight_duration" placeholder="{{ __('packages.flight_duration_label') }}" value='{{ old("flight_duration", $package->flight_duration ?? "") }}' data-hide-seconds data-duration="00:15:00" data-duration-min="00:05:00" />
                    <div class="input-group-append">
                        <span class="input-group-text" id="basic-addon2">{{ __('packages.hour') }}</span>
                    </div>
                </div>
            </div>

            <div class="card p-3 mb-3 col-md-12">
                <label>{{ __('packages.journey_duration_label') }} </label>
                <div class=" row">
                    <div class="form-group col-6">
                        <label>{{ __('packages.start_date') }} </label>
                        <input readonly type="text" class="form-control date_from {{ $errors->has('start_date') ? 'is-invalid' : '' }}" name="start_date" placeholder="{{ __('packages.start_date') }}" value='{{ old("start_date", $package->start_date ?? "") }}'/>
                    </div>

                    <div class="form-group col-6">
                        <label>{{ __('packages.end_date') }} </label>
                        <input readonly type="text" class="form-control date_to {{ $errors->has('end_date') ? 'is-invalid' : '' }}" name="end_date" placeholder="{{ __('packages.end_date') }}" value='{{ old("end_date", $package->end_date ?? "") }}'/>
                    </div>
                </div>
            </div>

            <div class="form-group col-6">
                <label for="latitude">Latitude</label>
                <input type="text" class="form-control" id="latitude" name="latitude" aria-describedby="latitudeHelp" placeholder="Latitude" value='{{ old("latitude", $package->latitude ?? "") }}'>
                <small id="latitudeHelp" class="form-text text-muted">{!! __('packages.coords_help') !!}</small>
            </div>

            <div class="form-group col-6">
                <label for="longitude">Longitude</label>
                <input type="text" class="form-control" id="longitude" name="longitude" aria-describedby="longitudeHelp" placeholder="Longitude" value='{{ old("longitude", $package->longitude ?? "") }}'>
                <small id="longitudeHelp" class="form-text text-muted">{!! __('packages.coords_help') !!}</small>
            </div>

            <div class="form-group col-lg-12">
                <label>{{ __('packages.enable_wifi')}} </label>
                <div class="card p-1">
                    <div class="d-flex p-2">
                        <div class="col-md-6 custom-control custom-radio">
                            <input {{old('wifi', $package->wifi ?? '') == 0 ? 'checked' : 'checked'}} type="radio" class="custom-control-input" name="wifi" id="wifi_0" value='0'/>
                            <label for="wifi_0" class="custom-control-label">{{ __('dashboard.no') }} </label>
                        </div>
                        <div class="col-md-6 custom-control custom-radio ">
                            <input {{old('wifi', $package->wifi ?? '') == 1 ? 'checked' : ''}} type="radio" class="custom-control-input" name="wifi" id="wifi_1" value='1'/>
                            <label for="wifi_1" class="custom-control-label">{{ __('dashboard.yes') }} </label>
                        </div>
                    </div>
                </div>
            </div>

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

            {{--Start Price Include List--}}
            <div class="card mb-5 col-md-12">
                <div class="card-header"><h4>{{ __('packages.price_include') }}</h4></div>
                @for($i = 0; $i< count($priceIncludes['en'] ?? []); $i++)
                <div class=" row">
                    @foreach($languages as $language)
                    <div class="form-group col-5">
                        <label>{{ __('packages.price_include') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                        <input type="text" class="form-control" name="price_include_{{ $language->local }}[]" placeholder="{{ __('packages.price_include') }}" value='{{ $priceIncludes[$language->local][$i] ?? "" }}'/>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" data-node= ".price_include" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                @endfor
                <div class="price_include row d-none">
                    @foreach($languages as $language)
                    <div class="form-group col-5">
                        <label>{{ __('packages.price_include') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                        <input type="text" class="form-control" name="price_include_{{ $language->local }}[]" placeholder="{{ __('packages.price_include') }}"/>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                <div class="text-left mb-4 col-12">
                    <button class="butn add_row" data-node= ".price_include" type="button"><span class="fa fa-plus"></span></button>
                </div>
            </div>
            {{--End Price Include List--}}

            {{--Start Price Exclude List--}}
            <div class="card mb-5 col-md-12">
                <div class="card-header"><h4>{{ __('packages.price_exclude') }}</h4></div>
                @for($i = 0; $i< count($priceExcludes['en'] ?? []); $i++)
                <div class=" row">
                    @foreach($languages as $language)
                    <div class="form-group col-5">
                        <label>{{ __('packages.price_exclude') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                        <input type="text" class="form-control" name="price_exclude_{{ $language->local }}[]" placeholder="{{ __('packages.price_exclude') }}" value='{{ $priceExcludes[$language->local][$i] ?? "" }}'/>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" data-node= ".price_exclude" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                @endfor
                <div class="price_exclude row d-none">
                    @foreach($languages as $language)
                    <div class="form-group col-5">
                        <label>{{ __('packages.price_exclude') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                        <input type="text" class="form-control" name="price_exclude_{{ $language->local }}[]" placeholder="{{ __('packages.price_exclude') }}"/>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                <div class="text-left mb-4 col-12">
                    <button class="butn add_row" data-node= ".price_exclude" type="button"><span class="fa fa-plus"></span></button>
                </div>
            </div>
            {{--End Price Exclude List--}}

            {{--Start Itinerary List--}}
            <div class="card mb-5 col-md-12">
                <div class="card-header"><h4>{{ __('packages.itinerary') }}</h4></div>
                @for($i = 0; $i< count($itinerary['en']['title'] ?? []); $i++)
                <div class="mb-5 row">
                    @foreach($languages as $language)
                    <div class="col-5">
                        <div class="form-group">
                            <label>{{ __('packages.itinerary_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <input type="text" class="form-control" name="itinerary_{{ $language->local }}[title][]" placeholder="{{ __('packages.itinerary_title') }}" value='{{ $itinerary[$language->local]['title'][$i] ?? "" }}'/>
                        </div>
                        <div class="form-group">
                            <label>{{ __('packages.itinerary_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <textarea rows="3" class="form-control" name="itinerary_{{ $language->local }}[description][]" placeholder="{{ __('packages.itinerary_description') }}">{{ $itinerary[$language->local]['description'][$i] ?? "" }}</textarea>
                        </div>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" data-node= ".itinerary" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                @endfor
                <div class="itinerary row d-none">
                    @foreach($languages as $language)
                    <div class="col-5">
                        <div class="form-group">
                            <label>{{ __('packages.itinerary_title') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <input type="text" class="form-control" name="itinerary_{{ $language->local }}[title][]" placeholder="{{ __('packages.itinerary_title') }}"/>
                        </div>
                        <div class="form-group">
                            <label>{{ __('packages.itinerary_description') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <textarea rows="3" class="form-control" name="itinerary_{{ $language->local }}[description][]" placeholder="{{ __('packages.itinerary_description') }}"></textarea>
                        </div>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                <div class="text-left mb-4 col-12">
                    <button class="butn add_row" data-node= ".itinerary" type="button"><span class="fa fa-plus"></span></button>
                </div>
            </div>
            {{--End Itinerary List--}}

            {{--Start FAQ List--}}
            <div class="card mb-5 col-md-12">
                <div class="card-header"><h4>{{ __('packages.faq') }}</h4></div>
                @for($i = 0; $i< count($faq['en']['question'] ?? []); $i++)
                <div class="mb-5 row">
                    @foreach($languages as $language)
                    <div class="col-5">
                        <div class="form-group">
                            <label>{{ __('packages.question') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <input type="text" class="form-control" name="faq_{{ $language->local }}[question][]" placeholder="{{ __('packages.question') }}" value='{{ $faq[$language->local]['question'][$i] ?? "" }}'/>
                        </div>
                        <div class="form-group">
                            <label>{{ __('packages.answer') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <textarea rows="3" class="form-control" name="faq_{{ $language->local }}[answer][]" placeholder="{{ __('packages.answer') }}">{{ $faq[$language->local]['answer'][$i] ?? "" }}</textarea>
                        </div>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" data-node= ".faq" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                @endfor
                <div class="faq row d-none">
                    @foreach($languages as $language)
                    <div class="col-5">
                        <div class="form-group">
                            <label>{{ __('packages.question') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <input type="text" class="form-control" name="faq_{{ $language->local }}[question][]" placeholder="{{ __('packages.question') }}"/>
                        </div>
                        <div class="form-group">
                            <label>{{ __('packages.answer') }} {{ count($languages) > 1 ? "({$language->name})" : '' }} </label>
                            <textarea rows="3" class="form-control" name="faq_{{ $language->local }}[answer][]" placeholder="{{ __('packages.answer') }}"></textarea>
                        </div>
                    </div>
                    @endforeach
                    <div class="text-left mt-4 col-2">
                        <button class="btn btn-danger delete_row" type="button"><span class="fa fa-times"></span></button>
                    </div>
                </div>
                <div class="text-left mb-4 col-12">
                    <button class="butn add_row" data-node= ".faq" type="button"><span class="fa fa-plus"></span></button>
                </div>
            </div>
            {{--End FAQ List--}}
        </div>
        {{--End Package Info--}}

        {{--Start video type--}}
        {{-- {{$package->video_type ?? ''}} --}}
        <div class="form-group col-lg-12 ">
            <label>{{ meta('video_type', $lang) ?? __('packages.type')}} </label>
            <div class="card p-1">
                <div class="d-flex p-2">
                    <div class="col-md-6 custom-control custom-radio">
                        <input {{old('video_type', $package->video_type ?? '') == 1 ? 'checked' : ''}} id="external" type="radio" class="custom-control-input external" name="video_type" value='1'/>
                        <label for="external" class="custom-control-label">{{ meta('external_link', $lang) ?? __('packages.external_link') }} </label>
                    </div>
                    <div class="col-md-6 custom-control custom-radio ">
                        <input {{old('video_type', $package->video_type ?? '') == 2 ? 'checked' : ''}} id="local" type="radio" class="custom-control-input local" name="video_type" value='2'/>
                        <label for="local" class="custom-control-label">{{ meta('local_link', $lang) ?? __('packages.local_link') }} </label>
                    </div>
                </div>
            </div>
        </div>
        {{--End video type--}}

        {{--Start video url--}}
        <div class="form-group col-lg-12 url_container  d-none">
            <label>{{ meta('video_url', $lang) ?? __('packages.url')}}</label>
            <input type="text" class="form-control url {{ $errors->has('video_url') ? 'is-invalid' : '' }}" name="video_url" placeholder="{{ meta('video_url', $lang) ?? __('packages.url') }}" value='{{ old("video_url", $package->video ?? "") }}'/>
        </div>
        {{--End video url--}}

        {{--Start video container--}}
        <div class="form-group col-lg-12 video_container d-none">
            <label>{{ __('packages.video') }} </label>
            <input id="video_thumbnail" class="video_thumbnail" type="hidden" name="video" value="{{old("video", $package->video ?? "")}}"/>

            <div class="photos main_video {{ old('video', $package->video ?? '') ? '' : 'hide' }}">
                <div class="col-lg-4">
                    <div class="items">
                        <div>
                            <a href="{{asset(old('video', $package->video ?? ''))}}" class="btn btn-primary video_href" target="_blank" > Browse </a>

                            <a id="lfm" data-input=".video_thumbnail" data-href=".video_href" data-preview=".video_holder" data-show=".main_video" data-hide=".pick_video_button" class="lfm btn btn-primary ml-4 text-light">
                                <i class="fas fa-video"></i> Choose
                            </a>
                        </div>
                        <a href="#" class="showHide resetImage close" data-empty=".video_thumbnail" data-hide=".main_video" data-show=".pick_video_button"><i class="fas fa-times"></i></a>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>
            <span class="input-group-btn pick_video_button {{ old('video', $package->video ?? '') ? 'hide' : '' }} ">
                <a id="lfm" data-input=".video_thumbnail" data-href=".video_href" data-preview=".video_holder" data-show=".main_video" data-hide=".pick_video_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-video"></i> Choose
                </a>
            </span>
        </div>
        {{-- <div class="form-group col-lg-12 video_container d-none">
            <label>{{ meta('video', $lang) ?? __('packages.video')}} </label>
            <input id="video_thumbnail" class="video_thumbnail" type="hidden" name="video" value="{{old("video", $package->video ?? "")}}"/>

            <div class="photos main_video {{ old('video', $package->video ?? '') ? ' wow fadeInUp' : 'hide' }}">

                <div class="col-lg-4">
                    <div class="items">
                        <div>
                            <label href="#" id="lfm" data-input=".video_thumbnail" data-preview=".video_holder" class="lfm" data-hide=".pick_video_button">
                                <input type="text" value="{{asset(old('video', $package->video ?? ''))}}" id="video_holder" class="video_thumbnail form-control">
                            </label>
                        </div>
                        <a href="#" class="showHide resetImage close" data-empty=".video_thumbnail" data-hide=".main_video" data-show=".pick_video_button"><i class="fas fa-times"></i></a>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>
            <span class="input-group-btn pick_video_button {{ old('video', $package->video ?? '') ? 'hide' : '' }} ">
                <a id="lfm" data-input=".video_thumbnail" data-preview=".video_holder" data-show=".main_video" data-hide=".pick_video_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-video"></i> Choose
                </a>
            </span>
        </div> --}}
        {{--End video container--}}

        {{--Start image container--}}
        @if (preg_match('/https:\/\/img\.youtube\.com/', $package->image ?? '', $match) )
            <div class="form-group col-lg-12 youtube_thumbnails">
                <label>{{ meta('image', $lang) ?? __('packages.image') }} </label>
                <div class="photos {{ $package->image ?? '' ? ' wow fadeInUp' : 'hide' }}">
                    <div class="col-lg-4">
                        <div class="items">
                            <div class="img">
                                <a target="_blank" href="{{$package->image ?? ''}}" >
                                    <img src="{{$package->image ?? ''}}">
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        @endif

        <div class="form-group image_container col-lg-12  d-none">
            <label>{{ meta('image', $lang) ?? __('packages.image') }} </label>
            <input id="image_thumbnail" class="image_thumbnail" type="hidden" name="image" value="{{old("image", $package->image ?? "")}}"/>

            <div class="photos main_photo {{ old('image', $package->image ?? '') ? ' wow fadeInUp' : 'hide' }}">
                <div class="col-md-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', $package->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', $package->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>

        <div class="border-item photos col-md-12 other_image_container">
            <div class="row">
                @if ($package ?? false)
                    @foreach ($package['photos'] as $photo)
                        <div class="col-md-4">
                            <div class="items">
                                <div class="img">
                                    <a href="{{ asset($photo->image ?? '')}}" data-fancybox="gallery"><img src="{{ asset($photo->image ?? '')}}" alt=""></a>
                                </div>
                                <input type="hidden" name="images[]" value="{{ $photo->image ?? "" }}">
                                <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="package_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 = "{{$lang}}",
            imagePath = "{{asset('')}}",
            imageTitle = null,
            inputName = null;
    </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/packages.js') }}"></script>
@endsection



