<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\widgets\LinkPager;
?>
<div class="row">
<div class="col-md-4">

</div>
<div class="col-md-8">
<a href="/yii2_job_website/web/index.php?r=jobs/create" class="btn btn-primary pull-right">Ajouter</a>
</div>
</div>
<hr>
<div class="row">
    <div class="col-md-6 col-md-offset-3">
    <?php if(Yii::$app->session->getFlash('success') != null):?>
         <div class="alert alert-success"><?= Yii::$app->session->getFlash('success'); ?></div>
    <?php endif;?>
        <ul class="list-group">
            <?php if($jobs != null):?>
                <?php foreach($jobs as $job):?>
                    <li class="list-group-item"><a href="/yii2_job_website/web/index.php?r=jobs/view&id=<?php echo $job->id;?>" class="btn btn-link"><?php echo $job->title;?></a><span class="label label-success"><?php echo $job->city;?></span> 
                    <span class="label label-danger"><?php echo $job->type;?></span>
                    <span class="label label-info">
                    <?php
                        echo  Yii::$app->formatter->asDatetime($job->created_at);
                    ?>
                    </span></li>
                <?php endforeach;?>
            <?php else:?>
            <div class="alert alert-info">Aucune offre trouvée!</div>
            <?php endif;?>
        </ul>
    </div>
</div>
