<?php $__env->startSection('title', 'List User'); ?>
<?php $__env->startSection('content'); ?>
<!-- Start content -->
<div class="content">
    <div class="container-fluid">
      <div class="row">
            <div class="col-12">
                <div class="card-box table-responsive">
                    <h4 class="m-t-0 m-b-20 header-title"><b>List User <span class="label label-primary">AKTIF</span></b></h4>
                    <table id="datatable-buttons" class="table table-striped table-bordered" cellspacing="0" width="100%">
                        <colgroup>
                          <col style="width:10%"/>
                          <col style="width:10%"/>
                          <col style="width:13%"/>
                          <col style="width:14%"/>
                          <col style="width:6%"/>
                          <col style="width:17%"/>
                          <col style="width:15%"/>
                          <?php if(auth()->user()->level == 'admin'): ?>
                          <col style="width:15%"/>
                          <?php endif; ?>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>Username</th>
                            <th>Level</th>
                            <th>Registered By</th>
                            <th>Expired</th>
                            <th>Status</th>
                            <th>Saldo</th>
                            <th>Registered At</th>
                            <?php if(auth()->user()->level == 'admin'): ?>
                            <th>Action</th>
                            <?php endif; ?>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!-- container -->

</div>
<!-- content -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
<script type="text/javascript">
var resizefunc = [];
var table;
$(document).ready(function() {
    table = $('#datatable-buttons').DataTable({
    serverSide: true,
    processing: true,
    order: [[ 3, "desc" ]],
    ajax: '<?php echo e(route('users.active.list')); ?>',
    columns: [
        {data: 'username'},
        {data: 'level'},
        {data: 'register_by'},
        {data: 'expired_date'},
        {data: 'status'},
        {data: 'saldo'},
        {data: 'created_at'},
        <?php if(auth()->user()->level == 'admin'): ?>
        {data: 'action'}
        <?php endif; ?>
    ]
    });
});



    function suspend(id){
        var popup = confirm("Are you sure?");
        if(popup){
            $.ajax({
                url: "<?php echo e(url('/user/suspend')); ?>"+ '/' +id,
                type: "GET",
                success: function(data){
                    table.ajax.reload();
                },
                error: function(){
                    alert('Something wrong');
                }
            });
        }
    }


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

<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>