<?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"><a href="<?php echo e(route('client.reports')); ?>">التقارير </a>

                    <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">
               				
            </div>
          </div>
        </div>
            <div class="col-xl-12 col-md-12 col-12">
                <div class="card">
                    <form id="search" name="date" >
                    <div class="card-body row" align="center">
                        <div class="col-lg-2 col-sm-6-md-6"></div>

                        <div class="col-lg-6 col-sm-6-md-6 ">


                            <div class= "row">
                        <div class="col-lg-4 col-sm-6-md-6 mb-1">
                            <center> <label class="form-label" style="font-weight:bold " > حدد الخزنة </label></center>
                        <select  name="safe_id" id="safe_id" class="form-control" required>
                       <option value="">إختر خزنة</option>
                       <option value="all">كل الخزن</option>
                       <?php $__currentLoopData = $safes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $safe): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                           <option value="<?php echo e($safe->id); ?>"><?php echo e($safe->safe_name); ?></option>
                       <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                   </select>   
                        </div>
                        <div class="col-lg-4 col-sm-6-md-6 mb-1">
                            <center> <label class="form-label" style="font-weight:bold " > من تاريخ</label></center>
                   <input type="date" name="from_date" id="from_date" class="form-control" >
                       
                </div>
                <div class="col-lg-4 col-sm-6-md-6 mb-1">
                    <center> <label class="form-label" style="font-weight:bold " > إلي تاريخ</label></center>
                    <input type="date" name="to_date" id="to_date" class="form-control" >
                   </div>
                            </div>
                </div>
                        <div class="col-lg-4 col-sm-6-md-6">
                            <center> <label class="form-label" style="font-weight:bold " ></label></center>
            
                            <button type="submit" class="btn btn-success me-1">بحث</button>
            
                         </div>
                      </div>
                    </form>
                </div>
              </div>

      <div class="col-xl-12 col-md-12 col-12" id="data-card" style="display: none">
          <div class="card card-statistics">

        <div class="card-body statistics-body">
          <div class="row">

            <div class="card-body" align="center" id="loader">
                <div class="spinner-border text-primary" style="width: 5rem; height: 5rem" role="status">
                </div>
              </div> 

                <div id="header" style="display: none">
              <center>
                  <h3 id="header-title"></h3>
                  <br>
              </center>
                </div>
                        <div class="card-datatable">
                            <div class="table-responsive">
                                <table class="table table-condensed table-striped table-bordered text-center table-hover " id="capitals">
                                    <thead>
                                    <tr>
                                        <th>م</th>
                                        <th>المبلغ</th>
                                        <th>الخزنة</th>
                                        <th>رصيد ما قبل</th>
                                        <th>رصيد ما بعد</th>
                                        <th>تاريخ - وقت</th>
                                        <th>المسؤل</th>

                                    </tr>
                                    </thead>
                                    <tbody class="tbody">
                                    </tbody>
                                </table>
                            </div>
                            
                        </div>

                        <div class="divider"></div>
          </div>
        </div>
      </div>
    </div>
	</section>

	</div>
      </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>

$("#search").on('submit',(function(e) {
e.preventDefault();
  filter();
}));
  var table = $('.table') ;
  function filter() {

var safe_id = $('#safe_id').val();
var from_date = $('#from_date').val();
var to_date = $('#to_date').val();

if(from_date == '' || to_date == ''){$('#header-title').text(' جميع عمليات إضافة رأس المال ')}else{$('#header-title').text('  عمليات إضافة رأس المال'+from_date+' إلي تاريخ '+to_date )}
$.ajax({
    url: "<?php echo e(route('client.report7.post')); ?>",
    type: "POST",
    data: {
        "_token": "<?php echo e(csrf_token()); ?>",
        "safe_id": safe_id,
        "from_date": $("#from_date").val(),
        "to_date" : $("#to_date").val()
    },
    beforeSend : function (){table.hide(); $('#header').hide(); $('#data-card').show();$('#loader').show(); var ifConnected = window.navigator.onLine;if (!ifConnected) {toastr.info("يتم الآن إعادة الإتصال","لا يوجد إتصال بالإنترنت",{positionClass: "toast-top-right",tapToDismiss: !1,timeOut: 2e3,rtl: $("html").attr("data-textdirection")});}},
    success: function (data) {
        $('#loader').hide();
        table.show();
        $('.tbody').empty();
        $('#header').show();
 
        $.each( data.capitals, function( key, value ) {
            $('#capitals').append(
                '<tr>'+
                '<td>'+(key+1)+'</td>'+
                '<td>'+formatMoney(parseFloat(value.amount))+'</td>'+
                '<td>'+(value.safe.safe_name)+'</td>'+
                '<td>'+value.balance_before+'</td>'+
                '<td>'+(value.balance_after)+'</td>'+
                '<td>'+(value.created_at.split('T')[0])+'</td>'+
                '<td>'+value.client.name+'</td>'+
                '</tr>'
            );
        });
        if(data.capitals == ''){ $('#capitals').append('<tr style="font-weight:bold;">'+'<td colspan="7">لا يوجد أي عمليات  </td>'+'</tr>')}

        


          },
   error: function (data) {

    }
});
};


var selectForm = $('#search');

if (selectForm) {
    selectForm.validate({

        rules: {
      'safe_id': {
        required: true,
      }
    }
  });
}
   </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/reports/report7.blade.php ENDPATH**/ ?>