/home/bdqbpbxa/demo-subdomains/homesearch.goodface.com.ua/wp-content/themes/homesearch/pricing.php
<?php
  // Template name: Pricing

  get_header();
?>

<main>

  <?php
    $main = get_field('main');
    if ($main['title']) :
  ?>
    <section class="pricing-main <?php echo get_section_color($main['block_color']); ?>">
      <div class="container -smaller">
        <h1 class="title title-1 mob-title-1 -centered-title"><?php echo $main['title']; ?></h1>
        <?php
          if ($main['subtitle']) :
        ?>
          <p class="text text-2 mob-text-2 -centered-title"><?php echo $main['subtitle']; ?></p>
        <?php
          endif;
          $main_tabs = $main['tabs'];
          if ($main_tabs) :
        ?>
          <div class="--tabs-container pricing-tabs">
            <div class="--tabs-container__menu pricing-menu text-2 mob-text-2">
              <?php
                foreach($main_tabs as $tab) :
                  if ($tab['tab_name'] && $tab['title']) :
              ?>
                <div class="--tabs-container__menu-item pricing-menu__item">
                  <span class="bold --demi-bold"> <?php echo $tab['tab_name']; ?> </span>
                  <span class="regular"> <?php echo $tab['tab_name']; ?> </span>
                </div>
              <?php
                  endif;
                endforeach;
              ?>
            </div>
            <div class="--tabs-container__items pricing-tabs__items">
              <?php
                foreach($main_tabs as $tab) :
                  if ($tab['tab_name'] && $tab['title']) :
              ?>
                <div class="--tabs-container__item pricing-tabs__item">
                  <p class="title super-title"><?php echo $tab['title']; ?></p>
                  <?php
                    if ($tab['subtitle']) :
                  ?>
                    <p class="text text-2 mob-text-3"><?php echo $tab['subtitle']; ?></p>
                  <?php
                    endif;                    
                  ?>
                  <div class="pricing-tags text-2 mob-text-2 --demi-bold">
                    <?php
                      foreach($tab['tags'] as $tag) :
                        if ($tag['tag']) :
                    ?>
                      <div class="pricing-tag"><?php echo $tag['tag']; ?></div>
                    <?php
                        endif;
                      endforeach;
                    ?>
                  </div>
                  <?php
                    $button = get_link_group_field($tab['link']);
                    if ($button) :
                  ?>
                    <a href="<?php echo $button['url']; ?>" class="default-button"><?php echo $button['title']; ?></a>
                  <?php
                    endif;
                  ?>
                </div>
              <?php
                  endif;
                endforeach;
              ?>
            </div>
          </div>
        <?php
          endif;
        ?>
      </div>
    </section>
  <?php
    endif;
  ?>

  <?php
    $all_included_features = get_field('all_included_features');

    if ($all_included_features['title']) :
  ?>
    <section class="pricing-tables --white-section">
      <div class="container -smaller">
        <h2 class="title title-2 -centered-title"><?php echo $all_included_features['title']; ?></h2>
        <div class="pricing-tables-content">
          <?php
            foreach($all_included_features['tables'] as $table_info) :

              $classes = '';
              if ($table_info['stretch_cells_to_full_width_on_mobile']) {
                $classes = '-one-row-on-mob';
              } else {
                $classes = '';
              }

              $table = $table_info['table'];

              if ($table_info['table_name'] && $table) :
          ?>
            <div class="pricing-table --accordion -open <?php echo $classes; ?>">
              <div class="--accordion__open pricing-table__opener text-1 mob-text-2 --demi-bold"><?php echo $table_info['table_name']; ?></div>
              <div class="--accordion__content-container">
                <div class="--accordion__content pricing-table__content -with-check text-2 mob-text-4">
                  <?php
                    if ( ! empty ( $table ) ) {
                      echo '<table>';                  
                          if ( ! empty( $table['caption'] ) ) {                  
                              echo '<caption>' . $table['caption'] . '</caption>';
                          }                  
                          if ( ! empty( $table['header'] ) ) {                  
                              echo '<thead>';                  
                                  echo '<tr>';                  
                                      foreach ( $table['header'] as $th ) {                  
                                          echo '<th>';
                                              echo $th['c'];
                                          echo '</th>';
                                      }                  
                                  echo '</tr>';                  
                              echo '</thead>';
                          }                  
                          echo '<tbody>';                  
                              foreach ( $table['body'] as $tr ) {                  
                                  echo '<tr>';                  
                                      foreach ( $tr as $td ) {                  
                                          echo '<td>';
                                              echo $td['c'];
                                          echo '</td>';
                                      }                  
                                  echo '</tr>';
                              }                  
                          echo '</tbody>';                  
                      echo '</table>';
                    }
                  ?>
                </div>
              </div>
            </div>
          <?php
              endif;
            endforeach;
          ?>
            <!-- <div class="pricing-table --accordion -open">
              <div class="--accordion__open pricing-table__opener text-1 mob-text-2 --demi-bold">table 1 (marked, the structure does not change)</div>
              <div class="--accordion__content-container">
                <div class="--accordion__content pricing-table__content -with-check text-2 mob-text-4">
                  <table>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>

            <div class="pricing-table --accordion -open">
              <div class="--accordion__open pricing-table__opener text-1 mob-text-2 --demi-bold">table 2 (without marks)</div>
              <div class="--accordion__content-container">
                <div class="--accordion__content pricing-table__content text-2 mob-text-4">
                  <table>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>

            <div class="pricing-table --accordion -open">
              <div class="--accordion__open pricing-table__opener text-1 mob-text-2 --demi-bold">table 3 (without marks, scrollable)</div>
              <div class="--accordion__content-container">
                <div class="--accordion__content pricing-table__content -scrollable text-2 mob-text-4">
                  <table>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                    <tr>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Unlimited Homesearches</td>
                      <td>Digital connectivity rating</td>
                      <td>Digital connectivity rating</td>
                    </tr>
                  </table>
                </div>
              </div>
            </div> -->
          
            
        </div>
        <?php 
              if ($all_included_features['button']) :
            ?>
                <a href="<?php echo $all_included_features['button']['url']; ?>" <?php echo $all_included_features['button']['target']; ?> class="default-button"> <?php echo $all_included_features['button']['title']; ?> </a>
            <?php 
              endif;
            ?>
      </div>
    </section>
  <?php
    endif;
  ?>

</main>

<?php
  get_footer();
?>