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

    <div class="col-md-12">
        <div class="card">
            <div class="header">
                <h4 class="title" style="display: inline;">Users list</h4>
                <button data-toggle="modal" data-target="#modal" onclick="loadModal('user/create')" class="btn btn-info btn-fill pull-right">NEW USER <i class="fa fa-plus" aria-hidden="true"></i> </button>
            </div>
            <div class="content">
                <div class="fresh-datatables">
                    <table id="datatable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%" style="width:100%">
                        <thead>
                        <tr>
                            <th>Image</th>
                            <th>Name</th>
                            <th>Designation</th>
                            <th>Email</th>
                            <th>Mobile No</th>
                            <th>Timezone</th>
                            <th>Last Login</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><?php if(empty($user->image)): ?>
                                        <img src="<?php echo e(asset("public/img/users/default-avatar.png")); ?>" height="40">
                                    <?php else: ?>
                                        <img src="<?php echo e(asset("public/img/users/$user->image")); ?>" height="40">
                                    <?php endif; ?>
                                </td>
                                <td><?php echo e($user->first_name. " ".$user->last_name); ?></td>
                                <td><?php echo e(@$user->designation->title); ?></td>
                                <td><?php echo e($user->email); ?></td>
                                <td><?php echo e($user->mobile_no); ?></td>
                                <td><?php echo e($user->timezone); ?></td>
                                <td><?php echo e($user->last_login_time); ?></td>
                                <td>
                                    <?php if($user->status==1): ?>
                                        <label class="label label-success">Active</label>
                                    <?php else: ?>
                                        <label class="label label-warning">Inactive</label>
                                    <?php endif; ?>
                                </td>
                                <td class="text-right">
                                    <a title="User Report" href="<?php echo e(URL::to('user-details-report')); ?>/<?php echo e($user->id); ?>" class="btn btn-simple btn-info btn-icon"><i class="fa fa-file-o"></i></a>
                                    <a class="btn btn-simple btn-warning btn-icon" data-toggle="modal" data-target="#modal" onclick="loadModalEdit('user',<?php echo e($user->id); ?>,'edit')" title="User Details"><i class="fa fa-edit"></i></a>
                                        <a class="btn btn-simple btn-danger btn-icon remove" <?php if(Auth::id()!=$user->id): ?> onclick="deleteConfirm('userDelete',<?php echo e($user->id); ?>)" title ="User Delete" <?php else: ?> disabled="" rel="tooltip" title="You can't delete yourself." <?php endif; ?>><i class="fa fa-times"></i></a>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">

        function deleteConfirm(url,id) {

            swal({
                title: "Are you sure?",
                text: "You will not be able to recover this!",
                type: "warning",
                showCancelButton: true,
                closeOnConfirm: true,
                closeOnCancel: true
            }, function (isConfirm) {
                if (isConfirm) {
                    window.location='<?php echo e(URL::to('/')); ?>/'+url+"/"+id;
                    //swal("Deleted!", "Your imaginary file has been deleted.", "success");
                }
            });
        }

    </script>
    <?php echo $__env->make('backend._partials.ajax', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('backend._partials.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>