<?php $__env->startSection('title', trans('user.views.job.title', ['id' => $job->id, 'title' => $job->title])); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-md-12">
            <div class="page-header">
                <h1>#<?php echo e($job->id); ?> <small><?php echo e($job->title); ?></small></h1>
            </div>

            <?php echo $__env->make('user._partials.navigation', ['_active_navigation' => 'jobs'], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <hr>

            <div class="row">
                <div class="col-lg-10 col-lg-offset-1">
                    <p class="text-center">
                        <a href="<?php echo e(route('user.job.edit', $job->id)); ?>" class="btn btn-default"><?php echo e(trans('user.views.job.edit')); ?></a>
                        <?php if($job->active): ?>
                            <a href="<?php echo e(route('job.show', [$job->id, $job->slug])); ?>" class="btn btn-info"><i class="glyphicon glyphicon-link"></i></a>
                        <?php endif; ?>
                        <?php if(config('payment.enabled')): ?>
                            <a href="<?php echo e(route('user.job.services', $job->id)); ?>" class="btn btn-warning"><?php echo e(trans('user.views.job.order_services')); ?></a>
                        <?php endif; ?>
                        <?php if(!$job->filled): ?>
                            <a href="<?php echo e(route('user.job.fill', $job->id)); ?>" class="btn btn-danger confirm-action"><?php echo e(trans('user.views.job.fill')); ?></a>
                            <?php else: ?>
                            <a href="<?php echo e(route('user.job.unfill', $job->id)); ?>" class="btn btn-success confirm-action"><?php echo e(trans('user.views.job.unfill')); ?></a>
                        <?php endif; ?>
                    </p>
                    <hr>
                    <?php echo Notification::showAll(); ?>

                    <?php if(count($statistics['daily']) > 0): ?>
                        <div class="row">
                            <div class="col-md-10 col-md-offset-1">
                                <canvas id="viewsChart" width="450" height="200"></canvas>
                            </div>
                        </div>
                        <hr>
                    <?php else: ?>
                        <div class="alert alert-info"><?php echo e(trans('user.views.job.no_views')); ?></div>
                        <hr>
                    <?php endif; ?>
                    <?php if(count($services) > 0): ?>
                        <h4><?php echo e(trans('user.views.job.services.header')); ?></h4>
                        <table class="table table-hover no-margin">
                            <thead>
                            <tr>
                                <th><?php echo e(trans('user.views.job.services.active')); ?></th>
                                <th><?php echo e(trans('user.views.job.services.title')); ?></th>
                                <th><?php echo e(trans('user.views.job.services.type')); ?></th>
                                <th><?php echo e(trans('user.views.job.services.price')); ?></th>
                                <th><?php echo e(trans('user.views.job.services.active_from')); ?></th>
                                <th><?php echo e(trans('user.views.job.services.active_to')); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach($services as $service): ?>
                                <tr>
                                    <td>
                                        <?php if($service->active): ?>
                                            <span class="label label-success"><?php echo e(trans('user.views.job.services.active_yes')); ?></span>
                                        <?php else: ?>
                                            <span class="label label-danger"><?php echo e(trans('user.views.job.services.active_no')); ?></span>
                                        <?php endif; ?>
                                    </td>
                                    <td><?php echo e($service->title); ?></td>
                                    <td><?php echo e(trans('user.views.job.services.type_' . $service->type)); ?></td>
                                    <td>
                                        <?php if(!is_null($service->price)): ?>
                                            <?php echo e(format_balance($service->price)); ?>

                                        <?php else: ?>
                                            <span class="label label-default"><?php echo e(trans('user.views.job.services.price_free')); ?></span>
                                        <?php endif; ?>
                                    </td>
                                    <td><?php echo e($service->active_from); ?></td>
                                    <td><?php echo e($service->active_to); ?></td>
                                </tr>
                            <?php endforeach; ?>
                            </tbody>
                        </table>
                        <hr>
                    <?php endif; ?>
                    <div class="well well-sm">
                        <div class="row">
                            <div class="col-md-6">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.status')); ?></dt>
                                    <dd>
                                        <?php if($job->active): ?>
                                            <span class="label label-success"><?php echo e(trans('user.views.job.details.status_active')); ?></span>
                                        <?php else: ?>
                                            <span class="label label-default"><?php echo e(trans('user.views.job.details.status_inactive')); ?></span>
                                        <?php endif; ?>
                                        <?php if($job->new): ?>
                                            <span class="label label-warning"><?php echo e(trans('user.views.job.details.status_new')); ?></span>
                                        <?php endif; ?>
                                        <?php if($job->featured): ?>
                                            <span class="label label-warning"><?php echo e(trans('user.views.job.details.status_featured')); ?></span>
                                        <?php endif; ?>
                                        <?php if($job->filled): ?>
                                            <span class="label label-danger"><?php echo e(trans('user.views.job.details.status_filled')); ?></span>
                                        <?php endif; ?>
                                    </dd>
                                </dl>
                            </div>
                            <div class="col-md-6">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.total_views')); ?></dt>
                                    <dd>
                                        <?php echo e((int) app('counter')->get('model.job.'.$job->id.'.opened.total')->getValue()); ?>

                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-md-12">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.company')); ?></dt>
                                    <dd>
                                        <?php if($job->company): ?>
                                            <a href="<?php echo e(route('user.company.edit', $job->company->id)); ?>"><?php echo e($job->company->name); ?></a>
                                        <?php else: ?>
                                            -
                                        <?php endif; ?>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-md-12">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.description')); ?></dt>
                                    <dd><?php echo nl2br($job->description); ?></dd>
                                </dl>
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-md-12">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.instructions')); ?></dt>
                                    <dd><?php echo nl2br($job->instructions); ?></dd>
                                </dl>
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-md-6">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.categories')); ?></dt>
                                    <dd>
                                        <?php if(count($job->categories) > 0): ?>
                                            <ul class="list-unstyled">
                                                <?php foreach($job->categories as $jobCategory): ?>
                                                    <li><?php echo e($jobCategory->title); ?></li>
                                                <?php endforeach; ?>
                                            </ul>
                                        <?php else: ?>
                                            -
                                        <?php endif; ?>
                                    </dd>
                                </dl>
                            </div>
                            <div class="col-md-6">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.type')); ?></dt>
                                    <dd></dd>
                                </dl>
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-md-12">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.location')); ?></dt>
                                    <dd>
                                        <?php if($job->remote): ?>
                                            <?php echo e(trans('user.views.job.details.location_remote')); ?>

                                        <?php else: ?>
                                            <?php echo e($job->country); ?>, <?php echo e($job->city); ?>

                                        <?php endif; ?>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-md-6">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.active_from')); ?></dt>
                                    <dd><?php echo e($job->active_from); ?></dd>
                                </dl>
                            </div>
                            <div class="col-md-6">
                                <dl class="dl-horizontal">
                                    <dt><?php echo e(trans('user.views.job.details.active_to')); ?></dt>
                                    <dd><?php echo e($job->active_to); ?></dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom_scripts'); ?>
    <?php if(count($statistics['daily']) > 0): ?>
        <script>
            $(function () {
                var jobStatsData = {
                    labels: ["<?php echo implode('","', array_keys($statistics['daily'])); ?>"],
                    datasets: [
                        {
                            label: "Views for last 15 days",
                            fillColor: "rgba(151,187,205,0.2)",
                            strokeColor: "rgba(151,187,205,1)",
                            pointColor: "rgba(151,187,205,1)",
                            pointStrokeColor: "#fff",
                            pointHighlightFill: "#fff",
                            pointHighlightStroke: "rgba(151,187,205,1)",
                            data: [<?php echo e(implode(',', array_values($statistics['daily']))); ?>]
                        }
                    ]
                };

                var viewsChartOptions = {
                    showScale: true,
                    scaleShowGridLines: false,
                    scaleGridLineColor: "rgba(0,0,0,.05)",
                    scaleGridLineWidth: 1,
                    scaleShowHorizontalLines: true,
                    scaleShowVerticalLines: true,
                    bezierCurve: true,
                    bezierCurveTension: 0.3,
                    pointDot: true,
                    pointDotRadius: 4,
                    pointDotStrokeWidth: 1,
                    pointHitDetectionRadius: 20,
                    datasetStroke: true,
                    datasetStrokeWidth: 2,
                    datasetFill: false,
                    legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
                    maintainAspectRatio: false,
                    responsive: true
                };

                var viewsChartCanvas = $("#viewsChart").get(0).getContext("2d");
                var viewsChart = new Chart(viewsChartCanvas);
                viewsChart.Line(jobStatsData, viewsChartOptions);
            });
        </script>
    <?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>