<div class="panel panel-default pagination-container">
  <div class="panel-heading">
      <?php echo 'recent' == $this->type ? $this->translate('Current Jobs'): $this->translate('Famous jobs')?>
  </div>
    <table class="table table-striped table-bordered table-hover">
     <thead>
       <tr>
         <th><?php echo $this->translate('Job');?></th>
         <th><?php echo $this->translate('Date');?></th>
         <?php if ($this->acl()->isRole( Auth\Entity\User::ROLE_RECRUITER )):?>
           <th><?php echo $this->translate('Applications');?></th>
         <?php endif;?>
       </tr>
     </thead>
     <tbody>
     <?php foreach ($this->jobs as $job): /* @var Jobs\Entity\Job $job */?>
     <tr>
       <td>
           <?php $href = $job->getLink() ? $job->getLink() : $this->jobUrl($job, ['linkOnly' => true ]); ?>
           <?php if ($this->acl()->isRole( Auth\Entity\User::ROLE_ADMIN )):?>
               <a href="<?= $job->getLink() ? $job->getLink() : $href ; ?>"><?=$job->getTitle() ?></a>
           <?php else: ?>
                <a target="_new" href="<?=$job->getLink() ? $job->getLink() : $href; ?>"><?=$job->getTitle() ?></a>
            <?php endif ?>
         </td>
       <td>
       <?php if ($job->getDatePublishStart()): echo $this->dateFormat($job->getDatePublishStart(), 'short', 'none');
              elseif ($job->getDateCreated()): echo $this->dateFormat($job->getDateCreated(), 'short', 'none'); endif?>
       </td>
       <?php if ($this->acl()->isRole( Auth\Entity\User::ROLE_RECRUITER )):?>
       <td>     
         <?php if ($job->getApplications()->count()>0):?>
            <a title="<?php echo $this->translate("total")?>" href="<?php echo $this->url( 'lang/applications', array(), array('query' => 'job=' . $job->getId()), true) ?>">
            <span class="badge"><?php echo $job->getApplications()->count() ;?></span>
            </a>
         <?php endif;?>
         <?php if ($job->getUnreadApplications()->count()):?>
            / 
            <a title="<?php echo $this->translate("unread")?>" 
               href="<?php echo $this->url( 'lang/applications', array(), array('query' => 'job=' . $job->getId() . '&unread=1'), true) ?>">
            <span class="badge"> <?php echo $job->getUnreadApplications()->count()?></span>
            </a>
         <?php endif;?>
       </td>
       <?php endif;?>
     </tr>
     <?php endforeach ?>
     </tbody>
   </table>
  <div class="yk-panel-foot">
  <?php echo $this->paginationControl($this->jobs, 'Sliding', 'pagination-control', array('lang' => $this->params('lang'), 'route' => 'lang/jobs/dashboardjobs'));?>
  </div> 
</div>
