
<?php $__env->startSection('title','Receipt Side'); ?>
<?php $__env->startSection('main'); ?>

    
<div class="container">
<form method="get" class="pt-3">
    <div class="row">
        <div class="col-">
            <div class="seven">
                <h1>Receipt Side</h1>
                </div>
            
        </div>        
    </div>
    <div class="row">
        <div class="col-11">
            <input type="hidden" name="projectid" id="projectid" class="form-control "   value=<?php if(isset($_GET['projectid'])): ?><?php echo e($_GET['projectid']); ?><?php endif; ?>>
            <select class="form-control form-control-sm d-print-none" id="project_name" name="project_name" >
                             <option>Select Your Project</option>
                         <?php $__currentLoopData = $projectdata; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                         <option data-id="<?php echo e($data->id); ?>" <?php if(isset($_GET['projectid'])): ?><?php echo e($data->id ==  $_GET['projectid']  ? 'selected' : ''); ?><?php endif; ?>
                         value="<?php echo e($data->project_name); ?>"><?php echo e($data->project_name); ?></option>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>
        <div class="col-1">
            <button type="submit" class="btn btn-info btn-sm d-print-none">Try Now</button>
        </div>
    </div>
</form>
<div class="row">
    <div class="col-">
        <form id="UpdateForm">
    <?php echo csrf_field(); ?>
<table class="table table-sm mt-3 table-striped table-bordered">

<thead>
    <tr>
    <th scope="col" style="width:10%;">Date</th>
    <th scope="col" style="width:20%;">Account Name</th>
    <th scope="col" style="width:40%;">Description</th>
    <th scope="col">Folio</th>
    <th scope="col"  class="text-end" style="width:10%;">Amount</th>
    <th scope="col"  class="text-center" style="width:10%;">Action</th>
    
    </tr>
</thead>
<tbody>



<?php $__currentLoopData = $voucherdata; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        
        <tr class="<?php echo e($datas->id); ?>">

        <td><?php echo e(date('d-M-y', strtotime($datas->cvdate))); ?></td>                 
        <td><?php echo e($datas->account_name); ?></td>
        <td >
            <span class="d-print-none"><?php echo e($datas->description); ?></span>
            <span class="d-none d-print-block"><?php echo e(Str::of($datas->description)->limit(25)); ?></span>
        </td>
        <td><?php echo e($datas->id); ?></td> 
        <td class="text-end"><?php echo e(number_format($datas->total_amount,0)); ?></td> 

        <td  class="text-center"><input class="form-check-input" name="ids[]" type="checkbox" value="<?php echo e($datas->id); ?>"></td> 

                                
        </tr>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

    
</tbody>
</div>    
</table>
<input type="submit" value="Update">
</form>
    </div>
</div>

</div>





<?php $__env->startPush('scripts'); ?>
<script>
         $('#project_name').change(function(){
         
           var selected = $(this).find('option:selected');    
            var projectid = selected.data('id');
            $('#projectid').val( projectid );
            
         });
</script>  
<script>
	$(document).ready(function(){
	$("#UpdateForm").submit(function(e){
	e.preventDefault();
	var formData = $(this).serialize();

	$.ajax({
		url:"<?php echo e(route('UpdateUserReceipt')); ?>",
		type:"POST",
		data:formData,
		success:function(data){
			
			if(data.success == true){
            	var ids = data.ids;
            	for(let i = 0; i<ids.length; i++)
                {
                	$('.'+ids[i]).remove();
                }
            }   
			
		}
	});	
	});
	});
</script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/alameenb/public_html/resources/views/reports/ReceiptChecker.blade.php ENDPATH**/ ?>