<?php
$headline = mb_get_block_field("pricelist-headline");
$subheadline = mb_get_block_field("pricelist-subheadline");
$text = mb_get_block_field("pricelist-text");
$pricelist = mb_get_block_field("pricelist");
$bottomtext = mb_get_block_field("pricelist-bottomtext");
if ($pricelist) { ?>
<section <?= inoby_block_attrs($attributes, ["class" => "pricelist"]) ?>>
  <div class="container">
    <div class="row">
      <div class="col-12">
        <div class="pricelist-header">
          <?php 
          if (!empty($headline)) : ?><h3><?= $headline ?></h3><?php endif;
          if (!empty($subheadline)) : ?><h5><?= $subheadline ?></h5><?php endif;
          if (!empty($text)) : ?><p><?= $text ?></p><?php endif; 
          ?>
        </div>
        <div class="pricelist">
          <div class="pricelist-legend">
            <span><?= __('Služba','inoby') ?></span>
            <span><?= __('Poplatok','inoby') ?></span>
            <span><?= __('Úhrada','inoby') ?></span>
          </div>
          <?php foreach($pricelist as $item){ ?>
          <div class="pricelist-item">
            <span><?= $item['service'] ?></span>
            <span><?= $item['fee'] ?></span>
            <span><?= $item['payment'] ?></span>
          </div>
          <?php } ?>
        </div>
        <?php if (!empty($bottomtext)) : ?><div class="pricelist-footer">
          <p><?= $bottomtext ?></p>
        </div><?php endif; ?>
      </div>
    </div>
  </div>
</section>
<?php }