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

    <section class="inner_header">
            <img src="<?php echo e(url('')); ?>/assets/web/images/icons/inner.svg" alt="" class="inner_shap">
            <div class="container">
                <ul class="links">
                    <li>
                        <a href="<?php echo e(url(getCurrentLocale().'/')); ?>"><i class="bi bi-house"></i></a>
                    </li>
                    <li>
                        <a href="<?php echo e(url(getCurrentLocale().'/request')); ?>"> <?php echo e(__('web.new_store')); ?> </a>
                    </li>
                </ul>
                <h4><?php echo e(__('web.new_store')); ?></h4>
            </div>
        </section>
    <!--End-inner_header-->
    <!--Contents-->
    <main>
        <!-- -------------- about --------------- -->
        <section class="login section_padding">
            <div class="container">
                <div class="row">
                    <div class="col-lg-5">
                        <div class="login_form">
                            <div class="form_head text-center mb-4">
                                <img src="<?php echo e(url('')); ?>/assets/web/images/logo.png" alt="">
                                <h5 class="mt-3 mb-2"><?php echo e(__('web.form_new_store')); ?></h5>
                                <p><?php echo e(__('web.fillform')); ?></p>
                            </div>
                            <div class="form_box">
                                <form onsubmit="saveform(this)" id="saveform" method="post" action="<?php echo e(url(getCurrentLocale().'/request')); ?>"> 
                                <?php echo csrf_field(); ?>
                               
                                <div class="form-group">
                                    <label for=""><?php echo e(__('web.store_name')); ?></label>
                                    <input type="text" name="name" class="form-control" placeholder="<?php echo e(__('web.store_name')); ?>">
                                    <span class="icon"><i class="bi bi-bank"></i></span>
                                </div>
                                <div class="form-group">
                                    <label for=""><?php echo e(__('web.phone')); ?></label>
                                    <input type="number" name="phone" class="form-control" placeholder="<?php echo e(__('web.phone')); ?>">
                                    <span class="icon"><i class="bi bi-phone"></i></span>
                                </div>
                                <div class="form-group">
                                    <label for=""> <?php echo e(__('web.num_id')); ?></label>
                                    <input type="text" name="num_id" class="form-control" placeholder="<?php echo e(__('web.num_id')); ?>">
                                    <span class="icon"><i class="bi bi-file-earmark-text"></i></span>
                                </div>
                                <div class="form-group">
                                    <label for=""> <?php echo e(__('web.percentage_provide')); ?></label>
                                    <input type="number" name="percentage" max="100" min="0" class="form-control" placeholder="<?php echo e(__('web.percentage_provide')); ?>">
                                    <span class="icon"><i class="bi bi-percent"></i></span>
                                </div>
                                <div class="form-group">
                                    <label for=""><?php echo e(__('web.maincategory')); ?></label>
                                    <span class="icon"><i class="bi bi-boxes"></i></span>
                                    <select name="category_id" onchange="modelSelect(this)" id="" class="form-control custom-select">
                                        <option selected disabled><?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(categorydescription($row->id,'name')); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for=""><?php echo e(__('web.subcategory')); ?></label>
                                    <span class="icon"><i class="bi bi-boxes"></i></span>
                                    <select name="model_id" id="models" class="form-control custom-select">
                                        <option selected disabled><?php echo e(__('web.select_category')); ?></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for=""><?php echo e(__('web.store_description')); ?></label>
                                    <textarea name="description" id="" rows="6" class="form-control px-3 py-3" placeholder="<?php echo e(__('web.store_description')); ?>"></textarea>
                                </div>
                                <div class="text-center">
                                    <button class="butn sub_color mt-4 d-block w-100"> <span><?php echo e(__('web.regist')); ?> </span> </button>
                                </div>
                                 </form>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6 offset-1">
                        <div class="img section_padding mt-5">
                            <img src="<?php echo e(url('')); ?>/assets/web/images/trader.svg" alt="">
                        </div>
                    </div>
                </div>
            </div>
            <!-- <img src="<?php echo e(url('')); ?>/assets/web/images/login_shape.svg" alt="" class="login_shape"> -->
        </section>
    </main>
    
 <div class="modal fade order_modal" id="success_modal" 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 p-5">
                    <div class="text-center">
                        <span class="check_icon"><i class="bi bi-check2-circle text-success"></i></span>
                        <h3 class="check_inf"><?php echo e(__('web.success')); ?> </h3>
                    </div>
                </div>
            </div>
            </div>
        </div>

        <div class="modal fade order_modal" id="error_modal" 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 p-5">
                    <div class="text-center">
                        <span class="check_icon"><i class="bi bi-x-octagon text-danger"></i></span>
                        <div id="error">
                            
                        </div>
                    </div>
                </div>
            </div>
            </div>
        </div>
    <script>
            
    function modelSelect(elem)
    {
        let data = $(elem).val();
        if(data != ''){
      $.ajax
        ({
          url : <?php echo json_encode(url(getCurrentLocale().'/modelSelect')); ?>+'/'+data,
          type: 'GET',              
          data: 'dataform',
          success:function(data)
          {
            $('#models').html(data);
            filter();
          }
          
        })
        }
        else{
            $('#models').html("<option selected disabled>"+<?php echo json_encode(__('web.select_category')); ?>+"</option>");
            filter();
        }
    }
        function saveform(elem){
        event.preventDefault(); 
       var action = $('#saveform').attr('action');
       var urls = action;
       var dataform = $('#saveform').serialize();
     
      $.ajax({
          url : urls,
          type: 'POST',              
          data: dataform,
          success:function(data)
          {
           $('#success_modal').modal('show');
              
                 setTimeout(
  function()
  {
      location.reload();
  }, 1000);
             
          }
          ,error:function(data) {
             $('#error_modal').modal('show');
              $('#error').html('');
    $('#error').css("display", "block");
   
   $.each(data.responseJSON.errors, function(key,value) {
       console.log(key);
     $('#error').append('<h4 class="title text-center mt-3">'+value+'</h4>');
     
     
 }); 
 
}
        })
        }
    </script>
    <?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/4u/resources/views/web/pages/store/request.blade.php ENDPATH**/ ?>