<?php $__env->startSection('content'); ?>
    <div class="side-title">
        <h3><?php echo e($head ?? ''); ?></h3>
    </div>

    <div class="border-item">
        <form class="form-row" method="post" action="<?php echo e($action); ?>">
            <?php if($provider ?? ''  && $provider->id): ?>
                <?php echo method_field('PUT'); ?>
            <?php endif; ?>
            <?php echo csrf_field(); ?>

                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('city_id', getCurrentLocale()) ?? __('providers.city_id')); ?> </label>
                    <select  class="form-control <?php echo e($errors->has('city_id') ? 'is-invalid' : ''); ?>" name="city_id" >
                        <option value=""><?php echo e(__('dashboard.select')); ?></option>
                        <?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option <?php if((isset($provider) ? $provider->city_id : "") == $row->id ): ?> selected <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e($row->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('country_id', getCurrentLocale()) ?? __('providers.country_id')); ?> </label>
                    <select  class="form-control <?php echo e($errors->has('country_id') ? 'is-invalid' : ''); ?>" name="country_id" >
                        <option value=""><?php echo e(__('dashboard.select')); ?></option>
                        <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option <?php if((isset($provider) ? $provider->country_id : "") == $row->id ): ?> selected <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e($row->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('category_id', getCurrentLocale()) ?? __('providers.category_id')); ?> </label>
                    <select  class="form-control <?php echo e($errors->has('category_id') ? 'is-invalid' : ''); ?>" name="category_id" >
                        <option value=""><?php echo e(__('dashboard.select')); ?></option>
                        <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option <?php if((isset($provider) ? $provider->category_id : "") == $row->id ): ?> selected <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e($row->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

            <div class="form-group col-lg-6">
                <label><?php echo e(meta('name', getCurrentLocale()) ?? __('providers.name')); ?> </label>
                <input type="text" class="form-control <?php echo e($errors->has('name') ? 'is-invalid' : ''); ?>" name="name" placeholder="<?php echo e(meta('name', getCurrentLocale()) ??__('providers.name')); ?>" value='<?php echo e(old("name", $provider->name ?? "")); ?>'/>
            </div>

            <div class="form-group col-lg-6">
                <label><?php echo e(meta('email', getCurrentLocale()) ?? __('providers.email')); ?> </label>
                <input type="email" class="form-control <?php echo e($errors->has('email') ? 'is-invalid' : ''); ?>" name="email" placeholder="<?php echo e(meta('email', getCurrentLocale()) ?? __('providers.email')); ?>" value='<?php echo e(old("email", $provider->email ?? "")); ?>'/>
            </div>


            <div class="form-group col-lg-6">
                <label><?php echo e(meta('phone', getCurrentLocale()) ?? __('providers.phone')); ?> </label>
                <input type="number" class="form-control <?php echo e($errors->has('phone') ? 'is-invalid' : ''); ?>" name="phone" placeholder="<?php echo e(meta('phone', getCurrentLocale()) ?? __('providers.phone')); ?>" value='<?php echo e(old("phone", $provider->phone ?? "")); ?>'/>
            </div>

                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('commerical_log', getCurrentLocale()) ?? __('providers.commerical_log')); ?> </label>
                    <input type="text" class="form-control <?php echo e($errors->has('commerical_log') ? 'is-invalid' : ''); ?>" name="commerical_log" placeholder="<?php echo e(meta('commerical_log', getCurrentLocale()) ?? __('providers.commerical_log')); ?>" value='<?php echo e(old("commerical_log", $provider->commerical_log ?? "")); ?>'/>
                </div>

                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('provider_name', getCurrentLocale()) ?? __('providers.provider_name')); ?> </label>
                    <input type="text" class="form-control <?php echo e($errors->has('provider_name') ? 'is-invalid' : ''); ?>" name="provider_name" placeholder="<?php echo e(meta('provider_name', getCurrentLocale()) ?? __('providers.provider_name')); ?>" value='<?php echo e(old("provider_name", $provider->provider_name ?? "")); ?>'/>
                </div>

                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('start_time', getCurrentLocale()) ?? __('providers.start_time')); ?> </label>
                    <input type="time" class="form-control <?php echo e($errors->has('start_time') ? 'is-invalid' : ''); ?>" name="start_time" placeholder="<?php echo e(meta('start_time', getCurrentLocale()) ?? __('providers.start_time')); ?>" value='<?php echo e(old("start_time", $provider->start_time ?? "")); ?>'/>
                </div>
                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('end_time', getCurrentLocale()) ?? __('providers.end_time')); ?> </label>
                    <input type="time" class="form-control <?php echo e($errors->has('end_time') ? 'is-invalid' : ''); ?>" name="end_time" placeholder="<?php echo e(meta('end_time', getCurrentLocale()) ?? __('providers.end_time')); ?>" value='<?php echo e(old("end_time", $provider->end_time ?? "")); ?>'/>
                </div>


                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('facebook', getCurrentLocale()) ?? __('providers.facebook')); ?> </label>
                    <input type="url" class="form-control <?php echo e($errors->has('facebook') ? 'is-invalid' : ''); ?>" name="facebook" placeholder="<?php echo e(meta('facebook', getCurrentLocale()) ?? __('providers.facebook')); ?>" value='<?php echo e(old("facebook", $provider->facebook ?? "")); ?>'/>
                </div>

                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('twitter', getCurrentLocale()) ?? __('providers.twitter')); ?> </label>
                    <input type="url" class="form-control <?php echo e($errors->has('twitter') ? 'is-invalid' : ''); ?>" name="twitter" placeholder="<?php echo e(meta('twitter', getCurrentLocale()) ?? __('providers.twitter')); ?>" value='<?php echo e(old("twitter", $provider->twitter ?? "")); ?>'/>
                </div>

                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('instagram', getCurrentLocale()) ?? __('providers.instagram')); ?> </label>
                    <input type="url" class="form-control <?php echo e($errors->has('instagram') ? 'is-invalid' : ''); ?>" name="instagram" placeholder="<?php echo e(meta('instagram', getCurrentLocale()) ?? __('providers.instagram')); ?>" value='<?php echo e(old("instagram", $provider->instagram ?? "")); ?>'/>
                </div>

            <div class="form-group col-lg-6">
                <label><?php echo e(meta('password', getCurrentLocale()) ?? __('providers.password')); ?> </label>
                <input type="password" class="form-control <?php echo e($errors->has('password') ? 'is-invalid' : ''); ?>" name="password" placeholder="<?php echo e(meta('password', getCurrentLocale()) ?? __('providers.password')); ?>" value='<?php echo e(old("password", "")); ?>'/>
            </div>

            <div class="form-group col-lg-6">
                <label><?php echo e(meta('password_confirmation', getCurrentLocale()) ?? __('providers.password_confirmation')); ?> </label>
                <input type="password" class="form-control <?php echo e($errors->has('password_confirmation') ? 'is-invalid' : ''); ?>" name="password_confirmation" placeholder="<?php echo e(meta('password_confirmation', getCurrentLocale()) ?? __('providers.password_confirmation')); ?>" value='<?php echo e(old("password_confirmation", "")); ?>'/>
            </div>
            <div class="form-group col-lg-6"></div>

            <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="form-group col-lg-6">
                    <label><?php echo e(__('providers.name_provider')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
                    <input type="text" class="form-control <?php echo e($errors->has('name_'.$language->local) ? 'is-invalid' : ''); ?>" name="name_<?php echo e($language->local); ?>" placeholder="<?php echo e(__('providers.name_provider')); ?>" value='<?php echo e(old("name_{$language->local}", isset($provider) ? $provider->descriptions($language->id)->name : "")); ?>'/>
                </div>
                <div class="form-group col-lg-6">
                    <label><?php echo e(meta('description', $language->local) ?? __('providers.name')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
                    <textarea type="text" class="form-control <?php echo e($errors->has('description_'.$language->local) ? 'is-invalid' : ''); ?>" name="description_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('description', $language->local) ?? __('providers.description')); ?>"><?php echo e(old("description_{$language->local}", isset($provider) ? $provider->descriptions($language->id)->description : "")); ?></textarea>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            
            <div class="form-group col-lg-6">
                <label><?php echo e(meta('photo', getCurrentLocale()) ?? __('providers.photo')); ?> </label>
                <input id="image_thumbnail" class="image_thumbnail" type="hidden" name="photo" value="<?php echo e(old("photo", $provider->photo ?? "")); ?>"/>

                <div class="photos main_photo <?php echo e(old('photo', $provider->photo ?? '') ? ' 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="<?php echo e(asset(old('photo', $provider->photo ?? ''))); ?> "  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 <?php echo e(old('photo', $provider->photo ?? '') ? '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="form-group col-lg-6">
                <label><?php echo e(meta('commerical_photo', getCurrentLocale()) ?? __('providers.commerical_photo')); ?> </label>
                <input id="image_com_thumbnail" class="image_com_thumbnail" type="hidden" name="commerical_photo" value="<?php echo e(old("commerical_photo", $provider->commerical_photo ?? "")); ?>"/>

                <div class="photos main_com_photo <?php echo e(old('commerical_photo', $provider->commerical_photo ?? '') ? ' wow fadeInUp' : 'hide'); ?>">
                    <div class="col-lg-4">
                        <div class="items">
                            <div class="img">
                                <a href="#" id="lfm" data-input=".image_com_thumbnail" data-preview=".image_com_holder" class="lfm" data-hide=".pick_com_button">
                                    <img src="<?php echo e(asset(old('commerical_photo', $provider->commerical_photo ?? ''))); ?> "  id="image_com_holder" class="image_com_holder"/>
                                </a>
                            </div>
                            <a href="#" class="showHide resetImage close" data-empty=".image_com_thumbnail" data-hide=".main_com_photo" data-show=".pick_com_button"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>
                <span class="input-group-btn pick_com_button <?php echo e(old('commerical_photo', $provider->commerical_photo ?? '') ? 'hide' : ''); ?> ">
                    <a id="lfm" data-input=".image_com_thumbnail" data-preview=".image_com_holder" data-show=".main_com_photo" data-hide=".pick_com_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">
                    <?php if($provider ?? false): ?>
                        <?php $__currentLoopData = $provider['photos']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $photo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-md-4">
                                <div class="items">
                                    <div class="img">
                                        <a href="<?php echo e(asset($photo->image ?? '')); ?>" data-fancybox="gallery"><img src="<?php echo e(asset($photo->image ?? '')); ?>" alt=""></a>
                                    </div>
                                    <input type="hidden" name="images[]" value="<?php echo e($photo->image ?? ""); ?>">
                                    <a href="#" onclick="DeleteImg(this)" class="close"><i class="fas fa-times"></i></a>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php 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>

            <div class="col-md-12" style="margin-top: 10px">
                <input type="hidden" name="latlng" id="latlng" value="<?php if($provider ?? ''  && $provider->id): ?><?php echo e($provider->latlng); ?><?php endif; ?>">
                <div id="address-canvas">
                    <div id="map" style=" height: 400px;border: 1px solid #000;"></div>
                </div>
            </div>

            <div class="text-center mt-5 col-12">
                <button class="butn"><span><?php echo e(__('dashboard.save')); ?></span></button>
            </div>
        </form>
    </div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('inner_js'); ?>

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB9i5KheHihWwx0k0y0xyqWy-RVLB9AqjU&callback=initMap"></script>
    <script type="text/javascript">

        window.onload = function() {
            var latlng = new google.maps.LatLng(<?php echo $provider ?? ''  && $provider->id ? $provider->latlng : '21.4989, 39.2509'; ?>);
            var map = new google.maps.Map(document.getElementById('map'), {
                center: latlng,
                zoom: 11,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });
            var marker = new google.maps.Marker({
                position: latlng,
                map: map,
                title: 'Set lat/lon values for this property',
                draggable: true
            });
            google.maps.event.addListener(marker, 'dragend', function(a) {
                console.log(a);
                var div = document.createElement('div');
                div.innerHTML = a.latLng.lat().toFixed(4) + ', ' + a.latLng.lng().toFixed(4);
                document.getElementsByTagName('body')[0].appendChild(div);
                $("#latlng").val(function() {
                    return  div.innerHTML;


                });

            });

        };
    </script>
    <!-- Editor JS files -->
    <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
    <script>
        function DeleteImg(elem)
        {
            $(elem).closest('.col-md-4').remove();
        }
    </script>
    <script>
        let route_prefix = "<?php echo e(url(config('lfm.prefix'))); ?>",
            url = "<?php echo e(url('/')); ?>/",
            imagePath = "<?php echo e(asset('')); ?>";
    </script>
    <script src="<?php echo e(asset('assets/admin/js/editor.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/lfm.js')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/youdra/resources/views/admin/providers/form.blade.php ENDPATH**/ ?>