<?php $__env->startSection('title'); ?> <?php if( ! empty($title)): ?> <?php echo e($title); ?> | <?php endif; ?> ##parent-placeholder-3c6de1b7dd91465d437ef415f94f36afc1fbc8a8## <?php $__env->stopSection(); ?>

<?php $__env->startSection('main'); ?>
<div class="">
    <div id="wrapper">
        <?php echo $__env->make('admin.sidebar_menu', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

        <div id="page-wrapper">
            <?php if( ! empty($title)): ?>
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"> <?php echo e($title); ?> </h1>
                </div> <!-- /.col-lg-12 -->
            </div> <!-- /.row -->
            <?php endif; ?>

            <?php echo $__env->make('admin.flash_msg', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <form action="<?php echo e(route('selectagency')); ?>" method="get">
                <div class='form-group'>
                    <input type='text' name='search' class='form-control form-control-lg'/>
                    
                </div>
                <div class='form-group'>
                    <button type="submit" class="btn btn-primary">Submit</button>
                    
                </div>
                
                
            </form>

            <div class="row">
                <div class="col-xs-12">
                    <?php if(count($users) > 0): ?>
                    <table class="table table-bordered table-striped" id="jDataTable">
                        <thead>
                            <tr>
                                <th><?php echo app('translator')->getFromJson('app.name'); ?></th>
                                <th><?php echo app('translator')->getFromJson('app.email'); ?></th>
                                <th><?php echo app('translator')->getFromJson('app.actions'); ?></th>
                            </tr>
                        </thead>

                        <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        <tr>
                            <th><?php echo '<a href="'.route('agent_info', $user->id).'">'.$user->name.'</a>'; ?></th>
                            <th><?php echo $user->email; ?></th>
                            <th>
                                <?php
                                $html = '<a href="'.route('agent_info', $user->id).'" class="btn btn-info btn-xs"><i
                                        class="fa fa-eye"></i> '.trans('app.view').'</a>';

                                if($user->feature == 0){
                                $html .= '<a href="javascript:;" class="btn btn-default btn-xs agent-feature-btn"
                                    data-user-id="'.$user->id.'"><i class="fa fa-star-o"></i></a>';
                                }else{
                                $html .= '<a href="javascript:;" class="btn btn-default btn-xs agent-feature-btn"
                                    data-user-id="'.$user->id.'"><i class="fa fa-star"></i></a>';
                                }

                                echo $html;
                                ?>
                            </th>
                        </tr>

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

                    </table>

                    <?php echo $users->links(); ?>

                    <?php else: ?>
                    <h4>Search for an agency or refine you parameters</h4>
                    <?php endif; ?>

                </div>
            </div>

        </div> <!-- /#page-wrapper -->

    </div> <!-- /#wrapper -->


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

<?php $__env->startSection('page-js'); ?>
<script>
    $(document).ready(function() {

            $(document).on('click','.agent-feature-btn', function(){
                var user_id = $(this).data('user-id');
                $that = $(this);
                $.ajax({
                    type : 'POST',
                    url : '<?php echo e(route('change_user_feature')); ?>',
                    data: { user_id : user_id, _token : '<?php echo e(csrf_token()); ?>' },
                    success : function(data){
                        $that.html(data);
                    }
                });
            });

        });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>