<? global $lang, $g_user;?>
<div class="firm-details">
  <div class="top">
    <div class="row">
      <div class="col-12">
        <div class="logo-container">
          <div class="name"><?= htmlspecialchars( $this -> firm['firm_name_profile'] );?></div>
          <div class="logo">
            <? if ( file_exists( \front\factory\GlobelusFirms::logo_url( $this -> firm['id'] ) ) ):?>
              <img src="/logo/<?= $this -> firm['id'];?>/<?= \S::get_token();?>">
            <? else:?>
              <img src="/images/no-logo.jpg">
            <? endif;?>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="content">
    <div class="row">
      <div class="col-12">
        <div class="form-group row">
          <label class="col-12 col-sm-4"><?= ucfirst( $lang['firma'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['firm_name_profile'] );?>
          </div>
        </div>
        <div class="form-group row">
          <label class="col-12 col-sm-4"><?= ucfirst( $lang['numer-identyfikacji-podatkowej'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['nip_vat'] );?>
          </div>
        </div>
      </div>
    </div>
    <hr/>
    <div class="step-title">
      <?= $lang['pracodawca-profil-krok-2-opis'];?>
    </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['telefon'] );?>:</label>
          <div class="col-12 col-sm-8">
            <? if ( !$this -> g_user ):?>
              <a href="/logowanie">Zaloguj się aby zobaczyć numer telefonu</a>
            <? else:?>
              <?= htmlspecialchars( $this -> firm['phone'] );?>
            <? endif;?>
          </div>
        </div>
      </div>
      <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">
            <? if ( !$this -> g_user ):?>
              <a href="/logowanie">Zaloguj się aby zobaczyć adres email</a>
            <? else:?>
              <?= htmlspecialchars( $this -> firm['email'] );?>
            <? 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['strona-www'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['www'] );?>
          </div>
        </div>
      </div>
    </div>
    <hr />
    <div class="step-title">
      <?= $lang['pracodawca-profil-krok-3-opis'];?>
    </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['kraj'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['country'] );?>
          </div>
        </div>
      </div>
      <div class="col-12 col-md-6">
        <div class="form-group row">
          <label class="col-12 col-sm-4"><?= ucfirst( $lang['region'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['region'] );?>
          </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['miasto'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['city'] );?>
          </div>
        </div>
      </div>
      <div class="col-12 col-md-6">
        <div class="form-group row">
          <label class="col-12 col-sm-4"><?= ucfirst( $lang['kod-pocztowy'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['postal_code'] );?>
          </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['ulica'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['street'] );?>
          </div>
        </div>
      </div>
      <div class="col-12 col-md-6">
        <div class="form-group row">
          <label class="col-12 col-sm-4"><?= ucfirst( $lang['nr-budynku-lokalu'] );?>:</label>
          <div class="col-12 col-sm-8">
            <?= htmlspecialchars( $this -> firm['apartment_number'] );?>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="content">
    <div class="row">
      <div class="col-12">
        <div class="step-title">
          <?= ucfirst( $lang['krotki-opis-firmy'] );?>
        </div>
        <?
          $text = $this -> firm['other_information'];
          $text = preg_replace('/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i', ' <a href="/logowanie">Zaloguj się aby zobaczyć adres email</a> ', $text );
          $text = preg_replace('/(\+[0-9]{11}|\+[0-9]{2} [0-9]{9}|\+[0-9]{2} [0-9]{3} [0-9]{3} [0-9]{3}|\+[0-9]{2} [0-9]{3}-[0-9]{3}-[0-9]{3})/i', ' <a href="/logowanie">Zaloguj się aby zobaczyć numer telefonu</a> ', $text );
          echo $text;
        ?>
      </div>
    </div>
  </div>
  <div class="adverts-title">Wszystkie oferty tego pracodawcy</div>
  <? if ( is_array( $this -> adverts ) and count( $this -> adverts ) ):?>
    <? foreach ( $this -> adverts as $advert ):?>
      <div class="advert-entry <? if ( $advert['highlight'] ):?>highlight<? endif;?>">
        <? if ( $advert['highlight'] ):?><div id="highlight-text">Oferta wyróżniona</div><? endif;?>
        <div class="row">
          <div class="col-12 col-sm-3 col-md-2">
            <div class="logo">
              <? if ( file_exists( \front\factory\GlobelusFirms::logo_url( $advert['user_id'] ) ) ):?>
                <img src="/logo/<?= $advert['user_id'];?>/<?= \S::get_token();?>">
              <? else:?>
                <img src="/images/no-logo.jpg">
              <? endif;?>
            </div>
          </div>
          <div class="col-12 col-sm-9 col-md-10">
            <div class="row">
              <div class="col-12 col-md-9">
                <h2>
                  <a href="/oferta/<?= $advert['id'];?>/<?= \S::seo( $advert['title'], true );?>" title="Ogłoszenie: <?= addslashes( $advert['title'] );?>"><?= $advert['title'];?></a>
                </h2>
              </div>
              <div class="col-12 col-md-3 date-add">
                <?= date( 'Y-m-d', strtotime( $advert['date_add'] ) );?>
                <div class="flag">
                  <? if ( file_exists( 'upload/filemanager/flags/' . \S::seo( $advert['country'] ) . '.jpg' ) ):?>
                    <img src="/upload/filemanager/flags/<?= \S::seo( $advert['country'] );?>.jpg">
                  <? endif;?>
                </div>
              </div>
            </div>
            <div class="info">
              <a href="/oferty-pracy/<?= \S::seo( $advert['country'], true );?>" class="place" title="praca <?= $adver['country'];?>"><?= $advert['country'];?></a> - <?= $advert['city'];?></span> | <a href="/pracodawca/<?= $advert['user_id'];?>/<?= \S::seo( $advert['firm_name_profile'] );?>" class="firm"><?= $advert['firm_name_profile'];?></a> | <a href="/oferty-pracy/<?= \S::seo( $advert['category'], true );?>" class="category" title="praca <?= $advert['category'];?>"><?= $advert['category'];?></a>
            </div>
            <div class="short-text">
              <?= mb_substr( strip_tags( \S::clear_advert_text( $advert['text'] ) ), 0, 150, 'UTF-8' );?>...
            </div>
            <a href="/oferta/<?= $advert['id'];?>/<?= \S::seo( $advert['title'], true );?>" class="btn btn-success"><?= $lang['szczegoly-oferty'];?></a>
          </div>
        </div>
      </div>
    <? endforeach;?>
  <? endif;?>
  <a href="javascript:history.back()" class="btn btn-dark btn-back"><?= $lang['wstecz'];?></a>
</div>