<?php $__env->startSection('main-container'); ?>
<main id="main" class="main">
<?php echo $__env->make('cdn', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<div class="row page-titles mx-0">

    <div class="col-sm-6 p-md-0">

        <div class="breadcrumb-range-picker">

             <h3>Customers</h3>

        </div>

    </div>

    <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">

         <a href="<?php echo e(url('/addcustomer')); ?>" class="btns primary-btn ml-4">

            <span class="btn-icon-left" style="color: white">+ Add customer</span>

        </a>

    </div>

</div>

<div class="container-fluid" style="margin-top: 15px">

    <?php echo $__env->make('flash_msg', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <div class="row">

        <div class="col-12">

            <div class="card">

                <div class="card-body">

                    <form method="GET" action="">

                        <div class="row text-right">

                            <div class="col-md-6"></div>

                            <div class="col-md-4">

                                 <input type="text" class="form-control right-search" name="search" value="<?php echo e($request->search); ?>" placeholder="Search by Name">

                            </div>

                             <div class="col-md-2">

                                <label class="">&nbsp;</label>

                                <button type="submit" class="btns primary-btn">Search</button>

                            </div>

                        </div>

                    </form>

                    <hr>

                    <div class="table-responsive">

                        <table class="table table-border table-hover table-sm" >
                            <thead>

                                <tr>

                                    <th>#</th>

                                    <th>NAME</th>

                                    <th>EMAIL</th>

                                    <th>GROUP</th>

                                    <th>MOBILE</th>

                                    <th>STATUS</th>

                                    <th>ACTION</th>



                                </tr>

                            </thead>

                            <tbody>
                                <?php if(!empty($users)): ?>
                                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                 <tr>
                                   <td><?php echo e(++$key); ?></td>
                                   <td><?php echo e($value->name); ?></td>
                                   <td><?php echo e($value->email); ?></td>
                                   <td><?php echo e($value->Group->name ?? 'No Group'); ?></td>
                                   <td><?php echo e($value->mobile); ?></td>

                                    <td>
                                    <?php if($value->status=='1'): ?>

                                        <a href="<?php echo e(url('customeractive/'.$value->id)); ?>">

                                            <button class="btns success-btn">Active</button>
                                        </a>
                                        <?php else: ?>
                                        <a href="<?php echo e(url('customeractive/'.$value->id)); ?>">

                                            <button class="btn btn-danger">InActive</button>
                                        </a>
                                        <?php endif; ?>
                                    </td>

                                    <td class="text-right">

                                        <a href="<?php echo e(route('customer.view',encrypt($value->id))); ?>">
                                            <button type="button" class="btns success-btn btn-sm" title="View More" alt="View More">
                                                <i class="fas fa-eye"></i> 
                                            </button>
                                        </a>


                                         <a href="<?php echo e(route('customer.edit',encrypt($value->id))); ?>">
                                        <button type="button" class="btns success-btn btn-sm" title="Edit" alt="Edit"><i class="fas fa-edit"></i> 
                                        </button>
                                         </a>

                                        <a href="<?php echo e(route('customer.delete',encrypt($value->id))); ?>" onclick="return confirm('Are you sure?')">
                                        <button type="button" class="btns success-btn btn-sm" title="Delete" alt="Delete"><i class="fas fa-trash-alt"></i>
                                        </button>
                                        </a>

                                    </td>

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

                               <?php if($users->count() == 0): ?>

                                        <tr class="text-center">

                                            <td colspan="6">No Customer to display.</td>

                                        </tr>

                                <?php endif; ?>
                                <?php endif; ?>

                               </tbody>

                            <tfoot>

                                <tr>
                                    <th>#</th>

                                    <th>Name</th>

                                    <th>Email</th>

                                    <th>Group</th>

                                    <th>Mobile</th>

                                    <th>Status</th>

                                    <th>Action</th>



                                </tr>


                            </tfoot>

                        </table>

                    </div>

                      <div class="text-left float-left mt-1">

                       <p>Displaying <?php echo e($users->count()); ?> of <?php echo e($users->total()); ?> Add Users.</p>

                    </div>

                    <div class="pagination">
                        <ul class="pagination-list">
                            <?php if($users->currentPage() > 1): ?>
                                <li class="pagination-item">
                                    <a href="<?php echo e($users->appends(request()->all())->previousPageUrl()); ?>" class="pagination-link">&lt;</a>
                                </li>
                            <?php endif; ?>

                            <?php if($users->currentPage() > 3): ?>
                                <li class="pagination-item">
                                    <a href="<?php echo e($users->appends(request()->all())->url(1)); ?>" class="pagination-link">1</a>
                                </li>
                                <li class="pagination-item disabled">
                                    <span class="pagination-link">...</span>
                                </li>
                            <?php endif; ?>

                            <?php $__currentLoopData = range(max(1, $users->currentPage() - 2), min($users->lastPage(), $users->currentPage() + 2)); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $page): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="pagination-item <?php echo e($page == $users->currentPage() ? 'active' : ''); ?>">
                                    <a href="<?php echo e($users->appends(request()->all())->url($page)); ?>" class="pagination-link"><?php echo e($page); ?></a>
                                </li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            <?php if($users->currentPage() < $users->lastPage() - 2): ?>
                                <li class="pagination-item disabled">
                                    <span class="pagination-link">...</span>
                                </li>
                                <li class="pagination-item">
                                    <a href="<?php echo e($users->appends(request()->all())->url($users->lastPage())); ?>" class="pagination-link"><?php echo e($users->lastPage()); ?></a>
                                </li>
                            <?php endif; ?>

                            <?php if($users->hasMorePages()): ?>
                                <li class="pagination-item">
                                    <a href="<?php echo e($users->appends(request()->all())->nextPageUrl()); ?>" class="pagination-link">&gt;</a>
                                </li>
                            <?php endif; ?>
                        </ul>
                    </div>

                </div>

            </div>

        </div>

    </div>

</div>
</main><!-- End #main -->
<script type="text/javascript">
   $(document).ready(function () {
    var table = $('#tabl').DataTable({
      order: [],
      columnDefs: [ { orderable: false, targets: [0,1,2,3,4,5,6] } ],
      responsive: true
    });

    new $.fn.dataTable.FixedHeader( table );
});
</script>
<script type="text/javascript">
       $("document").ready(function(){
        setTimeout(function()
        {
            $("div.alert").remove();

        }, 3000);

       });

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

<?php echo $__env->make('frontend.layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/vinecork/public_html/webdev/Company/resources/views/customer/index.blade.php ENDPATH**/ ?>