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

<div class="loading_page">
    <div class='loader'>
        <div class='blob'></div>
        <div class='blob'></div>
        <div class='blob'></div>
        <div class='blob'></div>
        <div class='blob'></div>
        <div class='blob'></div>
        <div class='blob'></div>
    </div>
</div>
 <section class="inner_header">
        <div class="container">
            <div class="top">
                <a href="<?php echo e(url(getCurrentLocale().'/')); ?>"><?php echo e(__('web.home')); ?> </a>
                <span><?php echo e(__('web.product')); ?></span>
            </div>
            <h2><?php echo e(__('web.add_product')); ?></h2>
        </div>
    </section>
    <main class="mazad_add_pg">
         <div class="loading_page">
        <div class='loader'>
            <div class='blob'></div>
            <div class='blob'></div>
            <div class='blob'></div>
            <div class='blob'></div>
            <div class='blob'></div>
            <div class='blob'></div>
            <div class='blob'></div>
        </div>
    </div>
        <!-- -------------- mazad_add --------------- -->
        <section class="mazad_add">
            <div class="cont bg-gray section-padding">
                <div class="container">
                     <form method="POST" onsubmit="savead(this)" action="<?php echo e(url(getCurrentLocale().'/item')); ?>" class="form-row"  enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                    <?php if(lastsubscribe(\Auth::user()->id) == '3'): ?>
                   <div class="col-12 search_tabs mb-4">
                        <label><h5><?php echo e(__('web.type_product')); ?> </h5> </label>
                        <div class="checks justify-content-center">
                            <div class="custom-control custom-checkbox">
                                <input type="radio" onclick="auctionselection(this)" checked class="custom-control-input" id="check30" name="auction" value="0">
                                <label class="custom-control-label" for="check30"><?php echo e(__('web.ad')); ?>

                                    <span data-toggle="tooltip" data-placement="top" title="<?php echo e(__('web.ad_desc')); ?>"><i class="fas fa-info-circle"></i></span>
                                  </label>
                            </div>
                            <div class="custom-control custom-checkbox">
                                <input type="radio" onclick="auctionselection(this)" class="custom-control-input" id="check31" name="auction" value="1">
                                <label class="custom-control-label" for="check31"> <?php echo e(__('web.auction')); ?>

                                    <span data-toggle="tooltip" data-placement="top" title="<?php echo e(__('web.auction_desc')); ?>"><i class="fas fa-info-circle"></i></span>
                                    </label>
                            </div>
                        </div>
                    </div>
                    <?php else: ?>
                    <input type="hidden" name="auction" value="0">
                    <?php endif; ?>
                       <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="form-group col-md-12">
                            <label><?php echo e(__('web.name')); ?> <?php echo e($language->local); ?></label>
                            <input type="text" name="name_<?php echo e($language->local); ?>" class="form-control" placeholder="<?php echo e(__('web.name')); ?> <?php echo e($language->local); ?> ">
                        </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        
                        
                        
                        
                        <div class="form-group col-md-6">
                            <label id="costing"> <?php echo e(__('web.cost')); ?> </label>
                            <input type="number" name="start_cost" class="form-control" placeholder=" <?php echo e(__('web.cost')); ?> ">
                        </div>
                        
                        <div class="form-group col-md-6 auction"  style="display:none">
                            <label> <?php echo e(__('web.end_cost')); ?> </label>
                            <input type="number" name="end_cost" class="form-control" placeholder=" <?php echo e(__('web.end_cost')); ?>">
                        </div>
                        <div class="form-group col-md-6  auction"  style="display:none">
                            <label> <?php echo e(__('web.start_time')); ?> </label>
                            <input type="time" name="start_time" class="form-control" placeholder="<?php echo e(__('web.start_time')); ?>">
                        </div>
                        <div class="form-group col-md-6 auction"  style="display:none">
                            <label> <?php echo e(__('web.end_time')); ?> </label>
                            <input type="time" name="end_time" class="form-control" placeholder="<?php echo e(__('web.end_time')); ?>">
                        </div>
                       
                        
                        <div class="form-group col-md-6">
                            <label><?php echo e(__('web.category')); ?></label>
                            <select name="category_id" onchange="categoryselect(this)" id="categories" class="form-control">
                                <option><?php echo e(__('web.select')); ?></option>
                                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option 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-md-6">
                            <label><?php echo e(__('web.main_model')); ?></label>
                            <select id="main_model" onchange="modelselect(this)" name="main_model_id" class="form-control">
                                <option selected disabled><?php echo e(__('web.select')); ?>  </option>
                                
                            </select>
                        </div>
                         <div class="form-group col-md-6">
                            <label> <?php echo e(__('web.model')); ?></label>
                            <select id="model" name="model_id" onchange="submodelselect(this)" class="form-control">
                                <option selected disabled><?php echo e(__('web.select')); ?>  </option>
                                
                            </select>
                        </div>
                         <div class="form-group col-md-6">
                            <label> <?php echo e(__('web.sub_model')); ?></label>
                            <select id="sub_model" name="sub_id" class="form-control">
                                <option selected disabled><?php echo e(__('web.select')); ?>  </option>
                                
                            </select>
                        </div>
                        <div class="form-group col-md-12" >
                            <div class="row" id="attributes" style="display:none">
                                
                            </div>
                        </div>
                        
                        <div class="form-group col-md-6">
                            <label><?php echo e(__('web.country')); ?></label>
                            <select name="country_id" onchange="countries(this)" class="form-control">
                                <option><?php echo e(__('web.select')); ?></option>
                                <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($row->id); ?>"><?php echo e(countryname($row->id)); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo e(__('web.city')); ?></label>
                            <select id="cities"  name="city_id" class="form-control">
                               <option selected disabled><?php echo e(__('web.select')); ?>  </option>
                            </select>
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo e(__('web.way_connect')); ?>  </label>
                            <select onchange="phoneselect(this)" name="type" class="form-control">
                                <option selected value="1"><?php echo e(__('web.msg_hanqr')); ?>  </option>
                                <option value="0"><?php echo e(__('web.phone_user')); ?>  </option>
                                
                            </select>
                        </div>
                        
                        <div class="form-group col-md-6">
                            <label><?php echo e(__('web.address')); ?></label>
                            <div class="d-flex map_show">
                                <!-- Button trigger modal --><input type="hidden" name="latlng" id="latlng">
                                <button type="button" class="" data-toggle="modal" data-target="#exampleModalCenter">
                                  <img src="<?php echo e(url('')); ?>/assets/web/images/map_icon.png" alt="">  <?php echo e(__('web.google_maps')); ?>

                                </button>
                                <input name="address" type="text" class="form-control" placeholder=" <?php echo e(__('web.address')); ?> ">
                            </div>
                        </div>
                        
                        
                        <div class="form-group col-md-5" style="display:none"  id="show">
                            <label><?php echo e(__('web.showphone')); ?> </label>
                            <div class="checks">
                                <div class="custom-control custom-checkbox">
                                    <input type="radio" class="custom-control-input" checked id="check4" value="1" name="show">
                                    <label class="custom-control-label" for="check4"><?php echo e(__('web.yes')); ?>  </label>
                                </div>
                                <div class="custom-control custom-checkbox">
                                    <input type="radio" class="custom-control-input" id="check5" value="0" name="show">
                                    <label class="custom-control-label" for="check5"> <?php echo e(__('web.no')); ?> </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group add_hash border_items col-md-12">
                            <div class="hash_head">
                                <h6><?php echo e(__('web.add_tags')); ?></h6>
                                <span class="add_icon">
                                    <i class="fas fa-plus"></i>
                                </span>
                            </div>
                            <div class="content">
                                <div class="item">
                                    <label># </label>
                                    <input type="text" name="tags[]" class="form-control tags" placeholder=" <?php echo e(__('web.tag')); ?> ">
                                </div>
                            </div>
                        </div>
                        <!-- <div class="form-group col-md-4">
                            <label>قبول دفع العربون </label>
                            <div class="checks">
                                <div class="custom-control custom-checkbox">
                                    <input type="radio" class="custom-control-input" id="check6" name="example1">
                                    <label class="custom-control-label" for="check6">نعم  </label>
                                </div>
                                <div class="custom-control custom-checkbox">
                                    <input type="radio" class="custom-control-input" id="check7" name="example1">
                                    <label class="custom-control-label" for="check7"> لا </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-md-3">
                            <label>مده العربون </label>
                            <select id="" class="form-control">
                                <option value="1">5 أيام  </option>
                                <option value="2">10 أيام </option>
                            </select>
                        </div> -->
                        <div class="add_img apload_car_parts col-12 p-0">
                            <div class="items_part">
                                <h6><?php echo e(__('web.addimages')); ?></h6>
                                <div class="input-field">
                                    <div class="input-images">
                                    </div>
                                    <img src="<?php echo e(url('')); ?>/assets/web/images/upload.png" alt="" class="icon">
                                </div>
                            </div>
                        </div>
                        <?php if(userpackagevid()): ?>
                        <div class="add_video col-md-12">
                            <label><?php echo e(__('web.addvideo')); ?></label>
                            <div class="row">
                                
                                <div class="col-md-12 upload_video valign">
                                    <div class="row w-100 text-center">
                                        <div class="col-6 r_side valign">
                                            <div class="img w-100">
                                                <img src="<?php echo e(url('')); ?>/assets/web/images/up_vid.png" alt="">
                                                <p><?php echo e(__('web.addvideo')); ?></p>
                                                <input type="file" name="video" id="video" />
                                            </div>
                                        </div>
                                        <div class="col-6 l_side">
                                            <output id="list"></output>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                        <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="form-group col-md-12">
                            <label><?php echo e(__('web.desc')); ?> <?php echo e($language->local); ?></label>
                            <textarea name="description_<?php echo e($language->local); ?>" class="form-control" placeholder="  <?php echo e(__('web.desc')); ?> <?php echo e($language->local); ?> " rows="6"></textarea>
                        </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-12" id="pics" style="display:none">
                             <div class="form-group col-md-6">
                            <label><?php echo e(__('web.check')); ?></label>
                             <input type="date" name="check" class="form-control" placeholder=" <?php echo e(__('web.check')); ?>">
                        </div>
                            <div class="apload_car_parts">
                                <div class="head mb-5">
                                    <h6><?php echo e(__('web.car_images')); ?> </h6>
                                </div>
                                
                                    <div class="row justify-content-center">
                                        <div class="col-md-4">
                                            <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview" class="imagePreview1"  style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/front_side.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_1" id="imageUpload" onchange="picchange(this)"  data-id="1" />
                                                        <label for="imageUpload"><?php echo e(__('web.image_1')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                             <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview" class="imagePreview2" style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/back_side.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_2"  data-id="2"  id="imageUpload" onchange="picchange(this)"/>
                                                        <label for="imageUpload"><?php echo e(__('web.image_2')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                             <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview" class="imagePreview3"   style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/right_side_f.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_3" data-id="3" id="imageUpload" onchange="picchange(this)"/>
                                                        <label for="imageUpload"><?php echo e(__('web.image_3')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview"class="imagePreview4"  style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/left_side_f.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_4"  data-id="4" id="imageUpload" onchange="picchange(this)"/>
                                                        <label for="imageUpload"><?php echo e(__('web.image_4')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview"class="imagePreview5"  style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/right_side_b.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_5"  data-id="5" id="imageUpload" onchange="picchange(this)"/>
                                                        <label for="imageUpload"><?php echo e(__('web.image_5')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview"class="imagePreview6"  style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/left_side_b.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_6"  data-id="6" id="imageUpload" onchange="picchange(this)"/>
                                                        <label for="imageUpload"><?php echo e(__('web.image_6')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="cr_img_upload">
                                                <div class="avatar-upload">
                                                    <div class="avatar-preview">
                                                        <div id="imagePreview"class="imagePreview7"  style="background-image: url(<?php echo e(url('')); ?>/assets/web/images/car_parts/draw/top_side.png);">
                                                        </div>
                                                    </div>
                                                    <div class="img_edit">
                                                        <input type='file' name="image_7"  data-id="7" id="imageUpload" onchange="picchange(this)"/>
                                                        <label for="imageUpload"><?php echo e(__('web.image_7')); ?></label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        
                                    </div>
                                
                            </div>
                        </div>
                        
                        <div class="shad_btn text-center col-12">
                            <button type="submit" class="butn main_bg open_loader"><span> <img src="<?php echo e(url('')); ?>/assets/web/images/icons/add.svg" alt=""> <?php echo e(__('web.save')); ?></span></button>
                        </div>
                         
                    </form>
                </div>
            </div>
        </section>

        <!-- Modal -->
        <div class="modal fade modal_map" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body">
                        <div class="map">
                           
						 <div id="address-canvas"><div id="map" style=" height: 400px;border: 1px solid #000;"></div></div>
                             
					
						</div>
                    </div>
                </div>
            </div>
        </div>

        <!-- -------------- inner_subscribe --------------- -->
        <section class="inner_subscribe">
            <div class="container">
                <div class="row">
                    <div class="col-md-6">
                        <div class="r_side">
                            <div class="icons">
                                <i class="fas fa-location-arrow"></i>
                            </div>
                            <div class="info">
                                <h6><?php echo e(__('web.sub_mail')); ?></h6>
                                <p><?php echo e(__('web.sub_mail_desc')); ?></p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="l_side">
                            <form onsubmit="subscribedata(this)" method="post" action="<?php echo e(url(getCurrentLocale().'/subcribe')); ?>" class="form-row">
                                <?php echo csrf_field(); ?>
                                <div class="form-group col-12">
                                    <input type="email" name="email"  placeholder="<?php echo e(__('web.email')); ?>">
                                    <button><?php echo e(__('web.subscribe')); ?></button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            
               <div class="modal fade modal_login" id="mailsuccess" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/checked.svg" alt="">
                        </div>
                        <h4><?php echo e(__('web.success')); ?></h4>
                    </div>
                </div>
            </div>
        </div>
        
         <div class="modal fade modal_login" id="mailfailed" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/alert.svg" alt="">
                        </div>
                        <div id="mailerrors" class="alert alert-danger">
                             
                        </div>
                       
                        
                    </div>
                </div>
            </div>
        </div>
        
            <div class="modal fade modal_login" id="savesuccess" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/checked.svg" alt="">
                        </div>
                        <h4><?php echo e(__('web.success')); ?></h4>
                    </div>
                </div>
            </div>
        </div>
        
         <div class="modal fade modal_login" id="savefailed" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-body text-center">
                        <div class="icon">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/alert.svg" alt="">
                        </div>
                        <div id="saveerrors" class="alert alert-danger">
                             
                        </div>
                       
                        
                    </div>
                </div>
            </div>
        </div>
        </section>


    </main>
    <?php $__env->startPush('js'); ?>
    <script>
        function picchange(elem) {
            
            if (elem.files && elem.files[0]) {
                let data = $(elem).attr('data-id');
                
                var reader = new FileReader();
                reader.onload = function(e) {
                    $('.imagePreview'+data).css('background-image', 'url(' + e.target.result + ')');
                     $('.imagePreview'+data).hide();
                     $('.imagePreview'+data).fadeIn(650);
                }
                reader.readAsDataURL(elem.files[0]);
            }
        }
       
    </script>
<script>
function auctionselection(elem){
    let data = $(elem).val();
    
    if(data == '1'){
         $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/auctionselection')); ?>,
          type: 'GET',              
          data: 'dataform',
          success:function(data)
          {
              
            $('#categories').html(data);
           
               }
     
        })
        $('.auction').css('display','block');
        $('#costing').html(<?php echo json_encode(__('web.start_cost')); ?>);
    }
    else{
        $('.auction').css('display','none');
        $('#costing').html(<?php echo json_encode(__('web.cost')); ?>);
    }
}
function savead(elem){
   event.preventDefault();
   $(".loading_page").fadeIn();
         let action = $(elem).attr('action');
       
       let urls = action;
       let target = $(elem).attr('data-id');
       let dataform = new FormData( $(elem)[0]);
        
     
      $.ajax({
          url : urls,
          type: 'POST',              
          data: dataform,
          contentType: false, 
          processData: false, 
           success:function(data)
          {
            $(".loading_page").fadeOut();
            $("#savesuccess").modal('show');
            setTimeout(
  function() 
  {
    $("#savesuccess").modal('hide');
  }, 1000);
  
  if(<?php echo json_encode(lastsubscribe(\Auth::user()->id)); ?> != '3'){
  setTimeout(
             function() 
  {
    window.location.replace("<?php echo e(url(getCurrentLocale().'/item/')); ?>/"+data+"");
  }, 2000);
  }
  else{
      let goto = $('input[name="auction"]:checked').val();
      if(goto == '0'){
      setTimeout(
             function() 
  {
    window.location.replace("<?php echo e(url(getCurrentLocale().'/item/')); ?>/"+data+"");
  }, 2000);
      }
      else{
           setTimeout(
             function() 
  {
    window.location.replace("<?php echo e(url(getCurrentLocale().'/profile')); ?>");
  }, 2000);
      }
  }
           
               }
          ,error: function (data) {
              $(".loading_page").fadeOut();
              $('#saveerrors').html('');
   $.each(data.responseJSON.errors, function(key,value) {
      
     $('#saveerrors').append('<h4 >'+value+'</h4>');
     
 }); 
 
  $("#savefailed").modal('show');
 
}
        })

}
    function categoryselect(elem){
        let data = $(elem).val();
        
        if(data == '1'){
            $('#pics').css('display','block');
        }
        else{
            $('#pics').css('display','none');
        }
        
         
        $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/categorydata/')); ?>+'/'+data,
          type : 'GET',
          data : 'nothing',

          success:function(data)
          {
            $('#main_model').html(data);
          }
        })   
        $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/attributedata/')); ?>+'/'+data,
          type : 'GET',
          data : 'nothing',
          
          success:function(data)
          {
               $("#attributes").css("display", "block");
            $('#attributes').html(data);
          }
        })   
    }
    function modelselect(elem){
          var data = $(elem).val();
         
        
        
         $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/modeldata/')); ?>+'/'+data,
          type : 'GET',
          data : 'nothing',

          success:function(data)
          {
            $('#model').html(data);
          }
        })   
    }
    function submodelselect(elem){
         var data = $(elem).val();
         
        
        
         $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/modeldata/')); ?>+'/'+data,
          type : 'GET',
          data : 'nothing',

          success:function(data)
          {
            $('#sub_model').html(data);
          }
        })  
    }
    function countries(elem){
     var data = $(elem).val();
         
       
        
         $.ajax({
          url : <?php echo json_encode(url(getCurrentLocale().'/countrydata/')); ?>+'/'+data,
          type : 'GET',
          data : 'nothing',

          success:function(data)
          {
            $('#cities').html(data);
          }
        })   
}
window.onload = function() {
    var latlng = new google.maps.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);
       
        

    });
}
    function phoneselect(elem){
        let data  = $(elem).val();
        if(data == '0'){
            $('#show').css('display','block');
        }
        else{
            
            $('#show').css('display','none');
        }
    }
    function subscribedata(elem) {
    event.preventDefault();
   
         let action = $(elem).attr('action');
       
       let urls = action;
       
       let dataform = new FormData( $(elem)[0]);
        
     
      $.ajax({
          url : urls,
          type: 'POST',              
          data: dataform,
          contentType: false, 
          processData: false, 
          success:function(data)
          {
            
            $("#mailsuccess").modal('show');
               }
          ,error: function (data) {
              
              $('#mailerrors').html('');
   $.each(data.responseJSON.errors, function(key,value) {
      
     $('#mailerrors').append('<h4 >'+value+'</h4>');
     
 }); 
 
  $("#mailfailed").modal('show');
 
}
        })


}
$("input.tags").on({
  keydown: function(e) {
    if (e.which === 32)
      return false;
  },
  change: function() {
    this.value = this.value.replace(/\s/g, "");
  }
});
</script>

<!------------ new ------------>
<script>
    $(".open_loader").on("click", function() {
        $(".loading_page").fadeIn();
    })
</script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('web.layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/omaralyomhost/public_html/hanqr/resources/views/web/pages/ads/createAd.blade.php ENDPATH**/ ?>