

<?php $__env->startSection('title'); ?>
All Customers 
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
<ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i> Home</a></li>

        <li class="active">All Customers</li>
      </ol>
<?php $__env->stopSection(); ?>

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

<link href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css"  rel="stylesheet">

<style>

table.dataTable thead .sorting_asc {
    background-image: none !important;
}

.table.dataTable, table.dataTable {
    width: 99.8%!important;
}
</style>

<?php $__env->stopSection(); ?>

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


            <div class="container-fluid">

                <!--.row-->
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-info">
                            <div class="panel-heading">Search Customer</div>
                            <div class="panel-wrapper collapse in" aria-expanded="true">
                                <div class="panel-body">
                                    <form >
                                        <div class="form-body">
                                            <div class="row">
                                                 <div class="col-md-6">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By Reference No.</label>
                                                        <select id="ref_id" class="form-control chosen-select">
                                                        <option  value="0">None</option>
                                                        <?php $__currentLoopData = $referenceNumbers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($r->id); ?>"><?php echo e($r->membership_no); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select>

                                                         </div>
                                                </div> 
                                                <!--/span-->
                                                <div class="col-md-6">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By Customer Name</label>
                                                        
                                                        <select id="cus_id" class="form-control chosen-select">
                                                        <option  value="0">None</option>
                                                        <?php $__currentLoopData = $customerNames; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($c->id); ?>"><?php echo e($c->name); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select> </div>
                                                </div>
                                                <!--/span-->
                                            </div>
                                            
                                        </div>
                                        <div class="form-actions">
                                            <button type="button" class="btn btn-success search-customer"> <i class="fa fa-check" ></i> Search</button>
                                            
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--./row-->


                <!-- /row -->
                <div class="row" id="update-table">
                    <div class="col-sm-12">
                        <div class="white-box">
                        	<div class="pull-right">
								<!-- <a href="<?php echo e(route('customer.addView')); ?>" class="btn  btn-primary">
									<i class="fa fa-plus-square"></i>&nbsp; Add new Customer
								</a> -->
							</div>
                            <h3 class="box-title">All Customers (<b><?php echo e($customerCount); ?></b>)</h3>

                            <div class="table-responsive" >
                                <table id="myTable" class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                           <th>Type</th>
                                            <th>Member Name</th>
                                            <th>Code</th>
                                            <th>Mobile Number</th>
                                            <th>Status</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $count =1;?>
                                        <?php $__currentLoopData = $allCustomers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e($count++); ?></td>

                                             <td>
                                                <?php if($customer->type == '1'): ?>
                                                <?php echo e('Company'); ?>

                                                <?php elseif($customer->type == '0'): ?>
                                                <?php echo e('Individual'); ?>

                                                <?php endif; ?>
                                               </td>
                                            
                                            <td>
                                                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-customer')): ?>
                                                <a href="<?php echo e(route('customer.detail',['id'=>$customer->id])); ?>"><?php echo e($customer->name); ?></a>
                                                <?php else: ?>
                                                <?php echo e($customer->name); ?>

                                                <?php endif; ?>
                                            </td>
                                            <td>
                                                <?php $words = explode(" ",$customer->name);
                                                $acronym = "";
                                                foreach ($words as $w) {
                                                    $acronym .= $w;
                                                   
                                                }
                                                ?>

                                                <?php echo e($acronym); ?>00<?php echo e($customer->id); ?>

                                            </td>
<!--                                            <td><?php echo e($customer->father_name); ?></td>-->
                                            <td><?php echo e($customer->mobile_number); ?></td>


                                           
                                           <?php if($customer->status == true): ?>
                                            <td><span class="label label-success">Active</span></td>
                                            <?php else: ?>
                                            <td><span class="label label-danger">InActive</span></td>
                                            <?php endif; ?>
                                            <td class="text-nowrap">
                                                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-customer')): ?>
                                                <a href="<?php echo e(route('customer.detail',['id'=>$customer->id])); ?>" data-toggle="tooltip" data-original-title="View"> <i class="fa fa-eye text-inverse m-r-10"></i> </a>
                                                <?php endif; ?>
                                                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'edit-customer')): ?>
                                                <a href="<?php echo e(route('customer.editView',['id'=>$customer->id])); ?>" data-toggle="tooltip" data-original-title="Edit"> <i class="fa fa-pencil text-inverse m-r-10"></i> </a>
                                                <?php endif; ?>
                                                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'delete-customer')): ?>
                                                <a href="<?php echo e(route('customer.delete',['id'=>$customer->id])); ?>" data-toggle="confirmation" data-title="Are you sure to delete?" > <i class="fa fa-close text-danger"></i> </a>
                                                <?php endif; ?>
                                            </td>
                                        </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                    </tbody>
                                </table>
                                <div style="float: right;"><?php echo e($allCustomers->links()); ?></div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.row -->
              </div>
            <!-- /.container-fluid -->

<?php $__env->stopSection(); ?>

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

<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
 <script src="https://cdn.datatables.net/buttons/1.7.0/js/dataTables.buttons.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
 <script src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.html5.min.js"></script>
  <script src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.print.min.js"></script>


<script>
    $(function() {
        $('#myTable').DataTable({
            'pageLength':25,
            'paging':false,
            'searching':false,
            'info':true,
            'dom': 'Bfrtip',
        'buttons': [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
        });
    });

        $('.search-customer').on('click',function(){
            
            refId = $('#ref_id').val();
            cusId = $('#cus_id').val();

            if(refId == 0 && cusId == 0) {
                toastr.warning("please select ref no or customer name.");
                return false;
            }

            var data = {'ref':refId,'cus':cusId};
            $.get('/customer/updateTable',data,function(data){
                document.getElementById('update-table').innerHTML = data;

                $('#myTable').DataTable({
                    'paging':false,
                    'searching':false,
                    'info':true,
                    'dom': 'Bfrtip',
        'buttons': [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
                });
                toastr.success("Search updated.");
            });
        });

       
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\akram-city.projecterp.net\resources\views/customer/index.blade.php ENDPATH**/ ?>