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

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

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

<?php $__env->startSection('content'); ?>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <span class="fa fa-users"></span> Agents
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-users"></i> Admin Panel</a></li>
                <li class="active">Agents</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content" style=" padding-bottom: 10%;">
            <div class="page-header">
                <a href="<?php echo e(route('agents.new')); ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i> New Agent</a>
            </div>

            <table class="table table-hover" id="user_table" width="100%">
                <thead>
                <tr style="background: grey ;color:#fff; font-weight: bold">
                    <td>ID</td>
                    <td>Code</td>
                    <td>Agent Name</td>
                    <td>Team</td>
                    <td>Position</td>
                    <td>Email</td>
                    <td>Active</td>
                    <td style="text-align: center">Deleted At</td>
                    <td>Actions</td>
                </tr>
                </thead>
                <?php $__currentLoopData = $agents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    
                    <tr>
                        <td><?php echo e($agent->id); ?></td>
                        <td><?php echo e(strtoupper($agent->code)); ?></td>
                        <td width="20%"><a href="<?php echo e(route('agents.info',[$agent->id])); ?>"><?php echo e($agent->fullname ?? ''); ?></a></td>
                        <td><?php echo e($agent->team->name ?? '-'); ?></td>
                        <td width="15%"><?php echo e($agent->position); ?></td>
                        <td><?php echo e($agent->email_ad); ?></td>
                        <td style="text-align: center">
                            <?php if($agent->active == "Yes"): ?>
                                <span class="label label-success"><?php echo e($agent->active); ?></span>
                            <?php else: ?>
                                <span class="label label-warning"><?php echo e($agent->active); ?></span>
                            <?php endif; ?>
                        </td>
                        <td width="12%" style="text-align: center">
                            <?php echo e($agent->deleted_at ?? '-'); ?>

                        </td>
                        <td class="btn btn-default ">
                            <a href="<?php echo e(route('agents.edit',[$agent->id])); ?>" class="btn btn-primary btn-xs"><i class="fa fa-edit"></i></a>
                            <a href="#" data-toggle="modal" data-target="#d<?php echo e($agent->id); ?>" class="text-danger btn btn-danger btn-xs"><i class="fa fa-trash"></i></a>
                            <!-- Delete Modal -->
                            <div class="modal fade" id="d<?php echo e($agent->id); ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                <div class="modal-dialog" role="document">
                                    <form method="post" action="<?php echo e(route('agents.delete')); ?>">
                                    <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"><i class="fa fa-warning"></i> confirm delete agent account</h4>
                                        </div>
                                        <div class="modal-body text-danger">
                                            <input type="hidden" name="id" value="<?php echo e($agent->id); ?>">
                                            Are you sure want to delete agent "<?php echo e($agent->fullname); ?>"
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                            <button type="submit" class="btn btn-primary">Confirm</button>
                                        </div>

                                    </div>
                                        <?php echo e(csrf_field()); ?>

                                    </form>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </table>
            <?php if(Session('info')): ?>
                <div class="row">
                    <div class="col-md-6 col-md-offset-3 text-center">
                        <div class="tem alert alert-success navbar-fixed-bottom"><span class="glyphicon glyphicon-ok-circle"></span> <?php echo e(Session('info')); ?></div>
                    </div>
                </div>
            <?php endif; ?>
        </section>

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

<?php $__env->startSection('script'); ?>
    <script>
        $(document).ready(function() {
            $('#user_table').DataTable( {
                "bDestroy": true,
                "order": [[ 0, "desc" ]]
            });
        });
        /*$("#btnAdd").on("click", function(){
            $('#addModal').modal('toggle');
        });*/
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>