<?php
$head = mb_get_block_field("vik_packages_head");
$text = mb_get_block_field("vik_packages_text");
$count .= mb_get_block_field("vik_packages_list_count") ?? false ? mb_get_block_field("vik_packages_list_count") : 2;
$btn = mb_get_block_field("vik_packages_btntext");
$url = mb_get_block_field("vik_packages_btnurl");

?>
<section <?= inoby_block_attrs($attributes, ["class" => "component-packages-list"]) ?>>
  <div class="container">
    <div class="row row-head">
      <div class="col-12">
        <?php if($head): echo '<h2 class="underlined">'.$head.'</h2>'; endif;?>
        <?php if($text): echo '<p>'.$text.'</p>'; endif;?>
      </div>
    </div>
    <div class="row">
      <div class="col-12">
        <?php
          echo do_shortcode('[vikbooking view="packageslist" sortby="dfrom" sorttype="asc" reslim="'.$count.'" lang="*"]');
        ?>
      </div>
    </div>
    <?php if($url): ?>
    <div class="row row-btn">
      <div class="col-12">
        <a class="button" href="<?=$url?>"><?=$btn?></a>
      </div>
    </div>
    <?php endif; ?>
  </div>
</section>