
<? global $lang;?>
<div id="user-panel">
  <?= \Tpl::view( 'globelus/firms/_partials/menu', [
    'active' => 'proponowani-kandydaci'
  ] );?>
  <div class="mini-box fluid mb15">
    <div class="title">Potencjalni kandydaci</div>
  </div>
  <div class="mini-box fluid" style="background: none; padding: 0;">
    <?
      if ( is_array( $this -> candidates ) and count( $this -> candidates ) ):
        foreach ( $this -> candidates as $candidate_id ):
          $candidate = \front\factory\GlobelusUser::user_details( $candidate_id );
        ?>
        <div class="cv-entry <? if ( $candidate['highlight'] ):?>highlight<? endif;?>">
          <? if ( $candidate['highlight'] ):?><div id="highlight-text">Kandydat wyróżniony</div><? endif;?>
          <div class="row">
            <div class="col-12 col-sm-2">
              <div class="img">
                <? if ( file_exists( \front\factory\GlobelusCandidates::avatar_url( $candidate['id'] ) ) ):?>
                  <img src="/avatar/<?= $candidate['id'];?>/<?= \S::get_token();?>">
                <? else:?>
                  <img src="/images/no-avatar.png">
                <? endif;?>
              </div>
            </div>
            <div class="col-12 col-sm-10">
              <div class="row">
                <div class="col-12 col-sm-8">
                  <h2>
                    <a href="/proponowany-kandydat/<?= $candidate['id'];?>/<?= \S::seo( $candidate['surname'] . ' ' . $candidate['name'], true );?>/" title="Kandydat: <?= addslashes( $candidate['surname'] . ' ' . $candidate['name'] );?>" target="_blank"><?= $candidate['surname'] . ' ' . $candidate['name'];?></a>
                  </h2>
                </div>
                <div class="col-12 col-sm-4 sex-and-birth">
                  <?= $lang['plec'];?>:
                  <?
                    if ( $candidate['sex'] == '1' )
                      echo $lang['mezczyzna'];
                    else if ( $candidate['sex'] == '0' )
                      echo $lang['kobieta'];
                    else
                      echo '-';
                  ?>
                  <? if ( $candidate['date_of_birth'] and $candidate['date_of_birth'] != '1970-01-01' ):?>
                    , <?= $lang['wiek'];?>: <?= $age = \S::date_diff( $candidate['date_of_birth'], date( 'Y-m-d H:i:s' ), 60 * 60 * 24 * 365.25 );?> <?= \front\factory\Globelus::age_word_translations( $age );?>
                  <? endif;?>
                </div>
              </div>
              <div class="info">
                <?= $lang['tel.'];?> <?= $candidate['phone'];?>, <?= $lang['email'];?>: <a href="mailto:<?= $candidate['email'];?>"><?= $candidate['email'];?></a>
              </div>
              <div class="info-2">
                <?
                  if ( is_array( $candidate['positions'] ) and count( $candidate['positions'] ) ):
                    echo '<p class="mb0">Chętnie podejmę pracę na stanowisku:<br />';
                    foreach ( $candidate['positions'] as $position ):
                      if ( !$position['id_position'] )
                        continue;
                      echo ' ● <strong>' . \front\factory\Globelus::position_name( $position['id_position'] ) . '</strong>'; if ( $position['experience'] ) echo ' - ' . $lang['moj-staz-na-tym-stanowisku'] . ' ' . $this -> positions_experience[ $position['experience'] ];
                      if ( $position != end( $candidate['positions'] ) )
                        echo '<br />';
                    endforeach;
                    echo '</p>';
                  endif;
                ?>
              </div>
              <div class="info-2">
                <?= $candidate['sex'] ? $lang['ostatnio-szukal-pracy'] : $lang['ostatnio-szukala-pracy'];?>: <strong><?= $candidate['last_refresh'] ? date( 'Y-m-d', strtotime( $candidate['last_refresh'] ) ) : date( 'Y-m-d', strtotime( $candidate['register_date'] ) );?></strong>
              </div>
              <div class="short-text">
                <?= \S::clear_advert_text( $advert['short_text'] );?>
              </div>
              <a href="/proponowany-kandydat/<?= $candidate['id'];?>/<?= \S::seo( $candidate['surname'] . ' ' . $candidate['name'], true );?>/" class="btn btn-success" target="_blank"><?= $lang['profil-kandydata'];?></a>
            </div>
          </div>
        </div>
        <? endforeach;
    else:
      ?>
        <div class="alert alert-danger">Brak proponowanych kandydatów</div>
      <?
    endif;?>
  </div>
</div>