<?php $__env->startSection('pagetitle'); ?>
	Users <small>overview</small>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('crumbs'); ?>
	<li class="active">
		<i class="fa fa-text-o"></i> Users
	</li>
<?php $__env->stopSection(); ?>

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

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title pull-left"><i class="fa fa-th fa-fw"></i> Users Panel</h3>
                    <p class="pull-right">
                    	<a href="<?php echo e(url('admin/users/create')); ?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> Add User</a>
                    </p>
                    <div class="clearfix"></div>
                </div>
                <div class="panel-body pages">
                    <?php if(sizeof($userlist) == 0): ?>
                        <div class="alert alert-info">User list is currently empty. </div>
                    <?php else: ?>
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover table-striped">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Name</th>
                                        <th>Phone</th>
                                        <th>Email</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	<?php foreach($userlist as $key => $page): ?>
    	                                <tr id="<?php echo e($page->id); ?>">
                                            <td><?php echo e($key); ?></td>
    	                                    <td><?php echo e($page->firstname); ?> <?php echo e($page->lastname); ?></td>
                                            <td><?php echo e($page->phone); ?></td>
                                            <td><?php echo e($page->email); ?></td>
    	                                    <td class="text-center">
    	                                    	<div class="btn-group">
    	                                    		 <button class="btn btn-warning btn-sm deltriggerbtn" data-toggle="modal" data-target="#myModal" data-id="<?php echo e($page->id); ?>"><i class="fa fa-trash"></i></button>
                                                    <a href="<?php echo e(url('/admin/users/')); ?>/<?php echo e($page->id); ?>/edit" class="btn btn-primary btn-sm"><i class="fa fa-pencil"></i></a>
    	                                    	</div>
    	                                    </td>
    	                                </tr>
                                    <?php endforeach; ?>
                                </tbody>
                            </table>
                            <?php echo $userlist->render (); ?>

                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Confirm Deletion</h4>
                </div>
                <div class="modal-body">
                    <div class="alert alert-info">
                        <p>Are you sure you wan to delete this User?</p>
                    </div>
                </div>
                <div class="modal-footer">
                    
                    <?php echo Form::open(['method' => 'DELETE', 'id' => 'pageDelete', 'route' => ['admin.users.destroy', 'test']]); ?>

                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <?php echo Form::submit('Delete', ['class' => 'btn btn-primary']); ?>

                    <?php echo Form::close(); ?>

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

<?php $__env->startSection('scripts'); ?>
    <script>
        $(function() {
            $('button.deltriggerbtn').click(function(e){
                var id = $(this).data('id');

                $('#pageDelete').attr('action', '<?php echo e(url("/admin/users/")); ?>'+'/'+id );
            });

            //delete a category

        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.masters.base', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>