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



<div class="border-item">  
  <?php if($store): ?>
    <form class="form-row" enctype="multipart/form-data"  method="post" action="<?php echo e(url(getCurrentLocale().'/storeDashboard/updateStore/'.$store->id)); ?>">
       
            <?php echo method_field('PUT'); ?>
        
        <?php echo csrf_field(); ?>
        <div class="form-group col-lg-6">
             <label><?php echo e(meta('password', getCurrentLocale()) ?? __('stores.password')); ?></label>
            <input type="password"  class="form-control  <?php echo e($errors->has('password') ? 'is-invalid' : ''); ?>" id="password"  name="password" placeholder="<?php echo e(meta('password', getCurrentLocale()) ?? __('stores.password')); ?> " value='<?php echo e(old("password", $store->password ?? "")); ?>'/>
        </div>
          <div class="form-group col-lg-6">
             <label><?php echo e(meta('facebook', getCurrentLocale()) ?? __('stores.facebook')); ?></label>
            <input type="text"  class="form-control  <?php echo e($errors->has('facebook') ? 'is-invalid' : ''); ?>" id="facebook"  name="facebook" placeholder="<?php echo e(meta('facebook', getCurrentLocale()) ?? __('stores.facebook')); ?> " value='<?php echo e(old("facebook", $store->facebook ?? "")); ?>'/>
        </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('youtube', getCurrentLocale()) ?? __('stores.youtube')); ?></label>
            <input type="text"  class="form-control  <?php echo e($errors->has('youtube') ? 'is-invalid' : ''); ?>" id="youtube"  name="youtube" placeholder="<?php echo e(meta('youtube', getCurrentLocale()) ?? __('stores.youtube')); ?> " value='<?php echo e(old("youtube", $store->youtube ?? "")); ?>'/>
        </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('twitter', getCurrentLocale()) ?? __('stores.twitter')); ?></label>
            <input type="text"  class="form-control  <?php echo e($errors->has('twitter') ? 'is-invalid' : ''); ?>" id="twitter"  name="twitter" placeholder="<?php echo e(meta('twitter', getCurrentLocale()) ?? __('stores.twitter')); ?> " value='<?php echo e(old("twitter", $store->twitter ?? "")); ?>'/>
        </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('instagram', getCurrentLocale()) ?? __('stores.instagram')); ?></label>
            <input type="text"  class="form-control  <?php echo e($errors->has('instagram') ? 'is-invalid' : ''); ?>" id="instagram"  name="instagram" placeholder="<?php echo e(meta('instagram', getCurrentLocale()) ?? __('stores.instagram')); ?> " value='<?php echo e(old("instagram", $store->instagram ?? "")); ?>'/>
        </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('email', getCurrentLocale()) ?? __('stores.email')); ?></label>
            <input type="text"  class="form-control  <?php echo e($errors->has('email') ? 'is-invalid' : ''); ?>" id="email"  name="email" placeholder="<?php echo e(meta('email', getCurrentLocale()) ?? __('stores.email')); ?> " value='<?php echo e(old("email", $store->email ?? "")); ?>'/>
        </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('phone', getCurrentLocale()) ?? __('stores.phone')); ?></label>
            <input type="number"  class="form-control  <?php echo e($errors->has('phone') ? 'is-invalid' : ''); ?>" id="phone"  name="phone" placeholder="<?php echo e(meta('phone', getCurrentLocale()) ?? __('stores.phone')); ?> " value='<?php echo e(old("phone", $store->phone ?? "")); ?>'/>
        </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('category_id', getCurrentLocale()) ?? __('stores.category_id')); ?></label>
           
                        <select  class="form-control <?php echo e($errors->has('category_id') ? 'is-invalid' : ''); ?>" onchange="categoryselect(this)" name="category_id">
                         <option selected disabled ><?php echo e(__('stores.select')); ?></option>
                         
                         <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                           <option <?php if($store ?? ''  && $store->id): ?> <?php if($store->category_id == $row->id): ?> selected <?php endif; ?> <?php endif; ?>  value="<?php echo e($row->id); ?>"><?php echo e(categoryname($row->id)); ?></option>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        
                         
                         
                         </select>
            </div>
       <div class="form-group col-lg-6">
             <label><?php echo e(meta('model_id', getCurrentLocale()) ?? __('stores.model_id')); ?></label>
         
                        <select id="models" class="form-control <?php echo e($errors->has('model_id') ? 'is-invalid' : ''); ?>" name="model_id">
                         <option selected disabled ><?php echo e(__('stores.select')); ?></option>
                          <?php if($store ?? ''  && $store->id): ?>
                         <?php $__currentLoopData = $models; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                           <option  <?php if($store->model_id == $row->id): ?> selected <?php endif; ?>   value="<?php echo e($row->id); ?>"><?php echo e(categoryname($row->id)); ?></option>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php endif; ?>
                         
                         
                         </select>
          </div>
      <div class="form-group col-sm-6">
           <label><?php echo e(meta('type', getCurrentLocale()) ?? __('stores.type')); ?></label>
                    
                        <select  class="form-control <?php echo e($errors->has('type') ? 'is-invalid' : ''); ?>" name="type">
                         <option <?php if($store ?? ''  && $store->id): ?> <?php if($store->type == 'active'): ?> selected <?php endif; ?> <?php endif; ?>  value="active"><?php echo e(__('stores.active')); ?></option>
                         <option <?php if($store ?? ''  && $store->id): ?> <?php if($store->type == 'inactive'): ?> selected <?php endif; ?> <?php endif; ?>  value="inactive"><?php echo e(__('stores.inactive')); ?></option>
                         </select>
                        
                </div>
                <div class="form-group col-sm-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(meta('name', $language->local) ?? __('stores.name')); ?> <?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(meta('name', $language->local) ?? __('stores.name')); ?>" value='<?php echo e(old("name_{$language->local}", $store[$language->local]->name ?? "")); ?>'/>
        </div>
 <div class="form-group col-lg-6">
            <label><?php echo e(meta('title', $language->local) ?? __('stores.title')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('title_'.$language->local) ? 'is-invalid' : ''); ?>" name="title_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('title', $language->local) ?? __('stores.title')); ?>" value='<?php echo e(old("title_{$language->local}", $store[$language->local]->title ?? "")); ?>'/>
        </div>
         <div class="form-group col-lg-6">
            <label><?php echo e(meta('address', $language->local) ?? __('stores.address')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('address_'.$language->local) ? 'is-invalid' : ''); ?>" name="address_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('address', $language->local) ?? __('stores.address')); ?>" value='<?php echo e(old("address_{$language->local}", $store[$language->local]->address ?? "")); ?>'/>
        </div>
        <div class="form-group col-lg-12">
            <label><?php echo e(meta('description', $language->local) ?? __('stores.description')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
            <textarea name="description_<?php echo e($language->local); ?>" class="form-control <?php echo e($errors->has('description_'.$language->local) ? 'is-invalid' : ''); ?>" placeholder="<?php echo e(meta('description', $language->local) ?? __('stores.description')); ?>"><?php echo e(old("description_{$language->local}", $store[$language->local]->description ?? "")); ?></textarea>
        </div>

       
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        
        
        
 <div class="form-group col-lg-12 image_container">
            <label><?php echo e(meta('image', getCurrentLocale()) ?? __('stores.image')); ?> </label>
            <input id="image_thumbnail" class="image_thumbnail" type="hidden" name="image" value="<?php echo e(old("image", $store->image ?? "")); ?>"/>

            <div class="photos main_photo <?php echo e(old('image', $store->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="<?php echo e(asset(old('image', $store->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 <?php echo e(old('image', $store->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="form-group col-lg-12 image_container">
            <label><?php echo e(meta('banner', getCurrentLocale()) ?? __('stores.banner')); ?> </label>
            <input id="banner_thumbnail" class="banner_thumbnail" type="hidden" name="banner" value="<?php echo e(old("banner", $store->banner ?? "")); ?>"/>

            <div class="photos banner_photo <?php echo e(old('banner', $store->banner ?? '') ? ' wow fadeInUp' : 'hide'); ?>">
                <div class="col-md-4">
                    <div class="items">
                        <div class="img">
                            <a href="#" id="lfm" data-input=".banner_thumbnail" data-preview=".banner_holder" class="lfm" data-hide=".banner_button">
                                <img src="<?php echo e(asset(old('banner', $store->banner ?? ''))); ?> "  id="banner_holder" class="banner_holder"/>
                            </a>
                        </div>
                        <a href="#" class="showHide resetImage close" data-empty=".banner_thumbnail" data-hide=".banner_photo" data-show=".banner_button"><i class="fas fa-times"></i></a>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>
            <span class="input-group-btn banner_button <?php echo e(old('banner', $store->banner ?? '') ? 'hide' : ''); ?> ">
                <a id="lfm"  data-input=".banner_thumbnail" data-preview=".banner_holder" data-show=".banner_photo" data-hide=".banner_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> Choose
                </a>
             </span>
        </div>
          <div class="col-md-12"><input type="hidden" name="latlng" id="latlng" value="<?php if($store ?? ''  && $store->id): ?><?php echo e($store->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>
<?php else: ?>
<h1>لم يتم انشاء متجر بعد</h1>
<?php endif; ?>
</div>

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

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

<script src="<?php echo e(asset('assets/admin/js/lib/Chart.min.js')); ?>"></script>

<script type="text/javascript">

window.onload = function() {
    var latlng = new google.maps.LatLng(<?php echo $store ?? ''  && $store->id ? $store->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;

    
});

    });
    
};

function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else { 
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}

function showPosition(position) {
    
   
    var latlng = new google.maps.LatLng(position.coords.latitude , position.coords.longitude);
      $("#mylatlng").val(function() {
    return  latlng;

    
});
    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');alert(div);
        div.innerHTML = a.latLng.lat().toFixed(4) + ', ' + a.latLng.lng().toFixed(4);
       
        

    });
}

</script>
<script>
    function categoryselect(elem){
        var num = $(elem).val();
        
        
        $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/admin/categorymodel/')); ?>+'/'+num,
          type : 'GET',
          data : 'nothing',
          success:function(data)
          {
            $('#models').html(data);
          }
        }) 
    }
</script>
















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

<?php echo $__env->make('store.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/omaralyomhost/public_html/4u/resources/views/store/profile.blade.php ENDPATH**/ ?>