<? global $lang;?>
<? if ( !$this -> g_user['profile_completed'] and !$this -> g_user['type'] and 'a' == 'b' ):?>
<div id="incomplete_profile" class="mini-box fluid">
  <div class="row">
    <div class="col-12">
      <p><strong>Możesz juz aplikować na oferty pracy!</strong></p>
      <p><a href="/oferty-pracy" class="btn btn-success">oferty pracy</a></p>
      <p class="text-red">Ale uwaga!</p>
      <p>Doradzamy, abyś uzupełnił swój <strong>Profil Kandydata</strong>, bo to da Ci:<br />
        &bull; więcej bezpośrednich propozycji pracy<br />
        &bull; jeszcze szybsze aplikowanie (formularz aplikacyjny będzie <strong>automatycznie</strong> uzupełniony o <strong>Twoje dane</strong> oraz <strong>CV</strong>)</p>
    </div>
  </div>
</div>
<? endif;?>
<div id="user-panel">
  <div class="mini-buttons" id="buttons">
    <div class="btn active">
      <?= $lang['moj-profil'];?>
    </div>
    <a href="/panel-kandydata/wyslane-aplikacje" class="btn">
      <?= $lang['wyslane-aplikacje'];?>
    </a>
    <a href="/panel-kandydata/obserwowane-oferty" class="btn">
      <?= $lang['obserwowane-oferty-pracy'];?>
    </a>
    <a href="/panel-kandydata/ustawienia-konta" class="btn">
      <?= $lang['ustawienia-konta'];?>
    </a>
  </div>
  <div class="mini-box fluid">
    <div class="title">
      <? $refresh_diff  = \S::date_diff( date( 'Y-m-d H:i:s', strtotime( $this -> g_user['last_refresh'] ) ), date( 'Y-m-d H:i:s' ), 60 * 60 * 24 );?>
      <? $active_diff   = \S::date_diff( date( 'Y-m-d H:i:s' ), date( 'Y-m-d H:i:s', strtotime( $this -> g_user['active_to'] ) ), 60 * 60 * 24 );?>
      <?= ucfirst( $lang['moj-profil'] );?>
      <span class="info"><?= ucfirst( $lang['wyswietlenia-profilu'] );?>: <strong><?= $this -> g_user['visits'];?></strong></span>
      <span class="info"><?= ucfirst( $lang['konto-aktywne-do'] );?>: <strong><?= $this -> g_user['active_to'];?></strong><? if ( $active_diff <= 7 ):?><a class="btn btn-success btn-xs" href="/panel-kandydata/przedluz"><?= $lang['przedluz'];?></a><? endif;?></span>
    </div>
    <div class="subtitle">
      <?= $this -> g_user['visible'] ? '<a href="/panel-kandydata/wylacz-profil" class="btn btn-danger btn-profile">' . $lang['wylacz-profil'] . '</a>' : '<a href="/panel-kandydata/publikuj-profil" class="btn btn-success btn-profile"><b>Udostępnij</b> swój profil pracodawcom zarejestrowanym na globelus.pl</a>';?>
      <a href="/panel-kandydata/edycja-profilu" class="btn btn-dark ml5"><?= $lang['edytuj-profil'];?></a>
      <? if ( $refresh_diff >= 5 ):?><a class="btn btn-success" href="/panel-kandydata/odswiez"><?= $lang['odswiez'];?></a><? endif;?>
    </div>
    <div class="container-fluid">
      <div class="row">
        <div class="col-12">
          <div class="content profil">
            <div class="row">
              <div class="col-12">
                <div class="avatar-container">
                  <div class="name"><?= htmlspecialchars( $this -> g_user['surname'] );?> <?= htmlspecialchars( $this -> g_user['name'] );?></div>
                  <div class="avatar">
                    <? if ( file_exists( \front\factory\GlobelusCandidates::avatar_url( $this -> g_user['id'] ) ) ):?>
                      <img src="/avatar/<?= $this -> g_user['id'];?>/<?= \S::get_token();?>">
                    <? else:?>
                      <img src="/images/no-avatar.png">
                    <? endif;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-6">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['imie'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?= htmlspecialchars( $this -> g_user['name'] );?>
                  </div>
                </div>
              </div>
              <div class="col-12 col-md-6">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['nazwisko'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?= htmlspecialchars( $this -> g_user['surname'] );?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-6">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['data-urodzenia'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? if ( $this -> g_user['date_of_birth'] ) echo htmlspecialchars( date( 'd.m.Y', strtotime( $this -> g_user['date_of_birth'] ) ) );?>
                  </div>
                </div>
              </div>
              <div class="col-12 col-md-6">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['plec'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?
                      if ( $this -> g_user['sex'] == '1' )
                        echo $lang['mezczyzna'];
                      else if ( $this -> g_user['sex'] == '0' )
                        echo $lang['kobieta'];
                      else
                        echo '-';
                    ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-6">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['adres-email'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?= htmlspecialchars( $this -> g_user['email'] );?>
                  </div>
                </div>
              </div>
              <div class="col-12 col-md-6">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['telefon'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?= htmlspecialchars( $this -> g_user['phone'] );?>
                  </div>
                </div>
              </div>
            </div>
            <hr />
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['staz-pracy'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? if ( !$this -> g_user['inexperience'] ):?>
                      <? $positions_experience = \front\factory\Globelus::positions_experience();?>
                      <? foreach ( $this -> g_user['positions'] as $position ):?>
                        <p><?= $position['position'];?><? if ( $position['id_position'] ):?><?= \front\factory\Globelus::position_name( $position['id_position'] );?><? endif;?> - <?= $positions_experience[ $position['experience'] ];?></p>
                      <? endforeach;?>
                    <? else:?>
                      <?= $lang['brak-doswiadczenia'];?>
                    <? endif;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['w-jakiej-branzy-szukam-pracy'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? if ( $this -> g_user['categories'] ):  foreach ( $this -> g_user['categories'] as $category ):
                        echo $category['name'];
                        if ( $category != end( $this -> g_user['categories'] ) )
                          echo ', ';
                    endforeach; endif;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['jakie-znam-jezyki'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? $languages_experience = \front\factory\Globelus::languages_experience();?>
                    <? foreach ( $this -> g_user['languages'] as $language ):?>
                      <p><?= $language['language'];?> - <?= $languages_experience[ $language['experience'] ];?></p>
                    <? endforeach;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['gdzie-szukam-pracy'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? foreach ( $this -> g_user['countries'] as $country ):?>
                      <?= $country;?><? if ( $country != end ( $this -> g_user['countries'] ) ):?>,<? endif;?>
                    <? endforeach;?>
                    <? if ( count( $this -> g_user['voivodeships'] ) ):?>
                      <br/>
                      <? foreach ( $this -> g_user['voivodeships'] as $voivodeship ):?>
                        <?= $voivodeship;?><? if ( $voivodeship != end ( $this -> g_user['voivodeships'] ) ):?>,<? endif;?>
                      <? endforeach;?>
                    <? endif;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['dostepnosc'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? $availability_status = \front\factory\Globelus::availability_status();?>
                    <?= $availability_status[ $this -> g_user['status_of_availability'] ];?> <? if ( $this -> g_user['status_of_availability'] == 2 ): echo '-<b>' . $this -> g_user['date_of_availability'] . '</b>'; endif;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['doswiadczenie-w-pracy-za-granica'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?
                      if ( $this -> g_user['experience_abroad'] == '1' )
                        echo $lang['tak'];
                      else if ( $this -> g_user['experience_abroad'] == '0' )
                        echo $lang['nie'];
                      else
                        echo '-';
                    ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['czy-potrzebuje-zakwaterowania'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?
                      if ( $this -> g_user['accommodation'] == '1' )
                        echo $lang['tak'];
                      else if ( $this -> g_user['accommodation'] == '0' )
                        echo $lang['nie'];
                      else
                        echo '-';
                    ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['prawo-jazdy'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?
                      if ( $this -> g_user['driving_license'] == '1' )
                        echo $lang['tak'];
                      else if ( $this -> g_user['driving_license'] == '0' )
                        echo $lang['nie'];
                      else
                        echo '-';
                    ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['wlasny-samochod'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?
                      if ( $this -> g_user['own_car'] == '1' )
                        echo $lang['tak'];
                      else if ( $this -> g_user['own_car'] == '0' )
                        echo $lang['nie'];
                      else
                        echo '-';
                    ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['cv'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <? if ( file_exists( \front\factory\GlobelusCandidates::cv_url( $this -> g_user['id'] ) ) ):?><a href="/cv/<?= $this -> g_user['id'];?>/<?= \S::get_token();?>/"><?= $lang['zobacz-aktualne-cv'];?></a><? endif;?>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-12 col-md-10">
                <div class="form-group row">
                  <label class="col-12 col-sm-4"><?= ucfirst( $lang['dodatkowe-informacje'] );?>:</label>
                  <div class="col-12 col-sm-8">
                    <?= $this -> g_user['other_information'];?>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>