<div class="box">
    <div class="box-header">
        <h3 class="box-title">Recent jobs</h3>
    </div>
    <?php if(count($latest['jobs']) > 0): ?>
        <div class="box-body table-responsive no-padding">
            <table class="table table-hover">
                <tr>
                    <th>#</th>
                    <th>Title</th>
                    <th>Type</th>
                    <th>Location</th>
                    <th>User</th>
                    <th>Company</th>
                    <th>Views</th>
                    <th>Status</th>
                    <th>Active to</th>
                    <th>&nbsp;</th>
                </tr>
                <?php foreach($latest['jobs'] as $job): ?>
                    <tr>
                        <td><?php echo e($job->id); ?></td>
                        <td><a href="<?php echo e(route('admin.jobs.show', $job->id)); ?>"><?php echo e($job->title); ?></a></td>
                        <td><?php echo e($job->type->title); ?></td>
                        <td>
                            <?php if($job->remote): ?>
                                Remote
                            <?php else: ?>
                                <?php echo e($job->country); ?>, <?php echo e($job->city); ?>

                            <?php endif; ?>
                        </td>
                        <td><a href="<?php echo e(route('admin.users.show', $job->user->id)); ?>"><?php echo e($job->user->name); ?></a></td>
                        <td>
                            <?php if($job->company): ?>
                                <a href="<?php echo e(route('admin.companies.show', $job->company->id)); ?>"><?php echo e($job->company->name); ?></a>
                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td><?php echo e((int) app('counter')->get('model.job.'.$job->id.'.opened.total')->getValue()); ?></td>
                        <td>
                            <?php if($job->active): ?>
                                <span class="label label-success">active</span>
                            <?php else: ?>
                                <span class="label label-default">inactive</span>
                            <?php endif; ?>
                            <?php if($job->featured): ?>
                                <span class="label label-info">featured</span>
                            <?php endif; ?>
                            <?php if($job->new): ?>
                                <span class="label label-warning">new</span>
                            <?php endif; ?>
                            <?php if($job->filled): ?>
                                <span class="label label-danger">filled</span>
                            <?php endif; ?>
                        </td>
                        <td>
                            <?php if($job->active): ?>
                                <?php echo e($job->active_to); ?>

                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td class="text-right">
                            <?php if($job->active): ?>
                                <a href="<?php echo e(route('admin.jobs.deactivate', $job->id)); ?>" class="btn btn-info btn-xs confirm-action">Deactivate</a>
                            <?php else: ?>
                                <a href="<?php echo e(route('admin.jobs.activate', $job->id)); ?>" class="btn btn-success btn-xs confirm-action">Activate</a>
                            <?php endif; ?>
                            <?php if(!$job->filled): ?>
                                <a href="<?php echo e(route('admin.jobs.fill', $job->id)); ?>" class="btn btn-danger btn-xs confirm-action">fill</a>
                            <?php else: ?>
                                <a href="<?php echo e(route('admin.jobs.unfill', $job->id)); ?>" class="btn btn-danger btn-xs confirm-action">un-fill</a>
                            <?php endif; ?>
                            <a href="<?php echo e(route('admin.jobs.show', $job->id)); ?>" class="btn btn-success btn-xs">view</a>
                            <a href="<?php echo e(route('admin.jobs.edit', $job->id)); ?>" class="btn btn-warning btn-xs">edit</a>
                            <a href="<?php echo e(route('admin.jobs.delete', $job->id)); ?>" class="btn btn-danger btn-xs confirm-action">delete</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </table>
        </div>
    <?php else: ?>
        <div class="box-body">
            <div class="alert alert-info">Jobs list is empty.</div>
        </div>
    <?php endif; ?>
</div>