2020-11-28 14:21:17 +03:00

146 lines
4.9 KiB
PHP

<div class="prices">
<h1>Цены</h1>
<div class="prices_sections__titles container">
<div class="row justify-content-center">
<div class="col-4">
<div class="prices_sections__title" data-price-section="ticket">
<i class="fa fa-ticket"></i>Квесты
</div>
</div>
<div class="col-4">
<div class="prices_sections__title" data-price-section="rooms">
<i class="fa fa-birthday-cake"></i>Залы
</div>
</div>
<div class="col-4">
<div class="prices_sections__title" data-price-section="tables">
<i class="fa fa-cutlery"></i>Услуги
</div>
</div>
</div>
</div>
<div class="prices_sections__content container" data-price-section="ticket">
<?php the_field('price_ticket_description') ?>
<div class="row justify-content-between">
<?php if( have_rows('price_ticket_item') ): ?>
<?php while( have_rows('price_ticket_item') ): the_row(); ?>
<div class="price_section col-12 col-sm-6">
<?php $title = get_sub_field('price_paragraph_title')?>
<h3><?php echo $title ?></h3>
<?php if( have_rows('price_items') ): ?>
<?php while( have_rows('price_items') ): the_row();
$text = get_sub_field('price_item_title');
$cost = get_sub_field('price_item_cost');
?>
<div class="price">
<span><?php echo $text?></span>
<span><?php echo $cost?> ₽</span>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="prices__adding container">
<?php the_field('price_ticket_additionally') ?>
</div>
</div>
<div class="prices_sections__content container" data-price-section="rooms">
<?php the_field('price_rooms_description') ?>
<div class="row justify-content-between">
<?php if( have_rows('price_room_item') ): ?>
<?php while( have_rows('price_room_item') ): the_row(); ?>
<div class="price_section col-12 col-sm-6">
<?php $title = get_sub_field('price_paragraph_title')?>
<h3><?php echo $title ?></h3>
<?php if( have_rows('price_items') ): ?>
<?php while( have_rows('price_items') ): the_row();
$text = get_sub_field('price_item_title');
$cost = get_sub_field('price_item_cost');
?>
<div class="price">
<span><?php echo $text?></span>
<span><?php echo $cost?> ₽</span>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="prices__adding container">
<?php the_field('price_rooms_additionally') ?>
</div>
</div>
<div class="prices_sections__content container" data-price-section="tables">
<?php the_field('price_tables_description') ?>
<div class="row justify-content-between">
<?php if( have_rows('price_table_item') ): ?>
<?php while( have_rows('price_table_item') ): the_row(); ?>
<div class="price_section col-12 col-sm-6">
<?php $title = get_sub_field('price_paragraph_title')?>
<h3><?php echo $title ?></h3>
<?php if( have_rows('price_items') ): ?>
<?php while( have_rows('price_items') ): the_row();
$text = get_sub_field('price_item_title');
$cost = get_sub_field('price_item_cost');
?>
<div class="price">
<span><?php echo $text?></span>
<span><?php echo $cost?> ₽</span>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="prices__adding container row">
<?php the_field('price_tables_additionally') ?>
</div>
</div>
</div>
<script>
const titles = document.querySelector('.prices_sections__titles')
const content = document.querySelectorAll('.prices_sections__content')
content[0].style.display = 'block';
titles.querySelector('.prices_sections__title').classList.add('active');
const clickHandler = (e) => {
const focusSection = e.target.closest('.prices_sections__title')
document.querySelectorAll('.prices_sections__title').forEach(title => title.classList.remove('active'));
content.forEach(section => {
section.dataset.priceSection == focusSection.dataset.priceSection
? section.style.display = 'block'
: section.style.display = 'none'
})
focusSection.classList.add('active')
}
titles.addEventListener('click', clickHandler)
</script>