<?php $__env->startSection('title','الاعدادات الإضافية'); ?>
<?php $__env->startSection('content'); ?>
<div class="app-content content ">
    <div class="content-overlay"></div>
    <div class="header-navbar-shadow"></div>
    <div class="content-wrapper container-xxl p-0">
        <div class="content-header row">
            <div class="content-header-left col-md-9 col-12 mb-2">
              <div class="row breadcrumbs-top">
                <div class="col-12">
    
                  <h2 class="content-header-title float-start mb-0">
                    الإعدادات الإضافية
                 </h2>
                  <div class="breadcrumb-wrapper">
                    <ol class="breadcrumb">
                      <li class="breadcrumb-item"><a href="<?php echo e(route('client.home')); ?>">لوحة التحكم </a>
                      </li>
                      <li class="breadcrumb-item active" >  
                        الإعدادت             
                      </li>
                      <li class="breadcrumb-item active" > 
                        الإعدادات الإضافية
                      </li>
                    </ol>
                  </div>
                </div>
              </div>
            </div>
            <div class="content-header-right text-md-end col-md-3 col-12 d-md-block d-none">

            </div>
        </div>
      <div class="content-body">
        <section class="app-user-view-account">
<div class="row">
  <!-- User Sidebar -->

  <!-- User Content -->
  <div class="col-xl-12 col-lg-12 col-md-12 order-0 order-md-12">
    <!-- User Pills -->
<?php echo $__env->make('client.settings.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <!--/ User Pills -->

    <!-- Project table -->
    <div class="card">
        <div class="card-header">
            <h4 class="card-title">بيانات الشركة</h4>
        </div>

    <div class="card-body">
        <form id="form" method="POST">
            <?php echo csrf_field(); ?>
            <input type="hidden" name="company_id" value="<?php echo e($company->id); ?>"/>
            <div class="row">
            <div class="col-md-6 col-12">
                <div class="form-group">
                    <label for="brand_name">الدولة</label>
                    <select required name="timezone" class="form-control search">
                        <option value="">اختر بلدك</option>
                        <?php $__currentLoopData = $timezones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $timezone): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option
                                <?php if($extra->timezone == $timezone->timezone): ?> selected <?php endif; ?>
                            value="<?php echo e($timezone->timezone); ?>"><?php echo e($timezone->country_name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
            <div class="col-md-6 col-12">
                <div class="form-group">
                    <label for="person_name">العملة المرادفة لبلدك</label>
                    <select required name="currency" class="form-control search">
                        <option value="">اختر العملة</option>
                        <?php $__currentLoopData = $currencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $currency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option
                                <?php if($extra->currency == $currency->currency): ?> selected <?php endif; ?>
                            value="<?php echo e($currency->currency); ?>"><?php echo e($currency->currency); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>


            <div class="col-12" align="center">
                <br>
                  <button type="submit" class="btn btn-success me-1">تعديل</button>
                  <button type="button" class="btn btn-outline-danger" onclick="window.history.back()">رجوع</button>
                </div>
            </div>
        </form>
        </div>
    </div>
  </div>
  <!--/ User Content -->
</div>
</section>
      </div>
  </div>
  <!-- END: Content-->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script src="<?php echo e(asset('app-assets/js/select2.min.js')); ?>"></script>
<script src="<?php echo e(asset('app-assets/js/pages/sales.js')); ?>"></script>
<script>
    
        $('.search').select2();
        var selectForm = $('#form');

if (selectForm) {
    selectForm.validate({

        rules: {
      'timezone': {
        required: true,
      },
      'currency': {
        required: true
      }

    
    
    }
  });
}

$("#form").on('submit',(function(e) {

e.preventDefault();

$.ajax({

  url: "<?php echo e(route('client.extra.settings.update')); ?>",

  type: "POST",

  data:  new FormData(this),

  dataType:  'json',

  contentType: false,

  cache: false,

  processData:false,
  
  beforeSend : function (){var ifConnected = window.navigator.onLine;if (!ifConnected) {toastr.info("يتم الآن إعادة الإتصال","لا يوجد إتصال بالإنترنت",{positionClass: "toast-top-right",tapToDismiss: !1,timeOut: 2e3,rtl: $("html").attr("data-textdirection")});}},

  success: function(response) {

    if(response.status){

            toastr.success("",response.message,{
			positionClass: "toast-top-right",
			tapToDismiss: !1,
			timeOut: 2e3,
			rtl: $("html").attr("data-textdirection")
		    });      
            document.getElementById("addForm").reset();

    }else{
        toastr.warning("",response.message,{
			positionClass: "toast-top-right",
			tapToDismiss: !1,
			timeOut: 2e3,
			rtl: $("html").attr("data-textdirection")
		    });   
    } 

  },
  error: function(response){
          $.each(response.responseJSON.errors, function (key, item) 
          {
            toastr.error("",item,{
			positionClass: "toast-top-right",
			tapToDismiss: !1,
			timeOut: 2e3,
			rtl: $("html").attr("data-textdirection")
		    });

          });
  },

 });

}));

    </script>

    <?php $__env->stopSection(); ?>
<?php echo $__env->make('client.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/barasys/public_html/resources/views/client/settings/extra.blade.php ENDPATH**/ ?>