<?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>
    <div class="content-body">
	<!-- Dashboard Ecommerce Starts -->
		<section id="dashboard-ecommerce">
		<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>
                  </ol>
                </div>
              </div>
            </div>
          </div>
          <div class="content-header-right text-md-end col-md-3 col-12 d-md-block d-none">
            <div class="mb-1 breadcrumb-right">
			
              <div class="dropdown">
               				
        <a  href="<?php echo e(route('client.banks.create')); ?>">
            <button class="btn-icon btn btn-primary" type="button"><i data-feather='plus'> </i></button>
            </a>
            </div>
          </div>
        </div>
        <div class="col-xl-12 col-md-12 col-12">
          <div class="card card-statistics">
        <div class="card-body statistics-body">
          <div class="row">

                    <div class="table-responsive">
                        <div class="card-datatable">
                            <table id="example2" class="datatables-basic table dataTable no-footer dtr-column collapsed" aria-describedby="example2_info">
                                <thead>
                                    <tr>
                                    <th >تحكم</th>
                                    <th> اسم الينك</th>
                                     <th > رصيد البنك </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                     $i=0;
                                    ?>
                                    <?php $__currentLoopData = $banks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bank): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                     <tr id="id-<?php echo e($bank->id); ?>">
                                        <td>
                                            <a class="pe-1 dropdown-toggle -arrow text-primary" data-bs-toggle="dropdown">
                                              <i data-feather='more-vertical'style="width: 20;height: 20;"></i>
                                            </a>
                                               <div class="dropdown-menu dropdown-menu-end">
                                                
                                                <a href="<?php echo e(route('client.banks.process',[$bank->id,'deposit'])); ?>"class="dropdown-item"><b> إيداع <i data-feather='arrow-right'></i></b> </a>
                                                <a href="<?php echo e(route('client.banks.process',[$bank->id,'withdrawal'])); ?>"class="dropdown-item"><b> سحب <i data-feather='arrow-left'></i></b> </a>
                                                <a href="<?php echo e(route('client.banks.transfer',$bank->id)); ?>"class="dropdown-item"><b> تحويل <i data-feather='shuffle'></i></b> </a>
                                                <a href="<?php echo e(route('client.bank.safe.transfer',$bank->id)); ?>"class="dropdown-item"><b> تحويل لخزنة <i data-feather='chevrons-left'></i></b> </a>
                                                <a href="<?php echo e(route('client.banks.edit',$bank->id)); ?>"class="dropdown-item"><b> تعديل <i data-feather='edit'></i></b> </a>
                                                
                                                
                                               <a onclick="deleteRow(<?php echo e($bank->id); ?>)" class="dropdown-item"><b> حذف <i data-feather='trash-2'></b></i></a>
                                               </div>                       
                                          </td>
                                         <td><?php echo e($bank->bank_name); ?></td>
                                         <td><?php echo e(number_format( $bank->bank_balance)); ?></td>
                                     </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                            </table>
                            
                        </div>
            </div>
          </div>
        </div>
      </div>
    </div>
	</section>

	</div>
      </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script src="<?php echo e(asset('app-assets/js/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('app-assets/js/dataTables.bootstrap5.min.js')); ?>"></script>
<script src="<?php echo e(asset('app-assets/js/sweetalert.min.js')); ?>"></script>
<script>
       

    $(function () {
      $("#example2").DataTable();
     
    });
   $('#example2').DataTable({"language": { "url": "<?php echo e(asset('app-assets/data/locales/Arabic.json')); ?>"}}); 

  function deleteRow(id){

   swal({

title: "هل أنت متأكد من حذف هذا البنك", 


  type: "warning",

  showCancelButton: true,

  confirmButtonColor: "#DD6B55",

  confirmButtonText: "تأكيد",

cancelButtonText: "إلغاء",

  closeOnConfirm: false

}, function (isConfirm) {

  if (!isConfirm) return;

  $.ajax({

    url: "<?php echo e(route('client.banks.delete')); ?>",

      type: "post",

      data: {

          id: id,
          '_token':'<?php echo e(csrf_token()); ?>'
      },

      dataType: "json",
      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){
            swal(response.message,response.sol,"success");
        $("#id-" +id).remove()
        }else{
            swal(response.message,response.sol,"error");
        }
         

      },

      error: function (xhr, ajaxOptions, thrownError) {

          swal("خطأ في الحذف ", "الرجاء المحاولة مرة آخري", "error");

      }

  });

});
  }
   </script>
<?php $__env->stopSection(); ?>


<?php echo $__env->make('client.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\xampp\htdocs\sales\resources\views/client/banks/index.blade.php ENDPATH**/ ?>