2026-08-30 15:07:57 +00:00

85 lines
3.8 KiB
PHP

<?php
/**
* Секция «Расписание и стоимость» страницы класса начальной школы.
* Вкладка «🗓 Расписание и стоимость».
* Цена: class_price_text ?: глобальная branch_price_school.
*
* @package Dekart
*/
if (! defined('ABSPATH')) {
exit;
}
$post_id = (int) get_the_ID();
$schedule_title = crb_get_post_meta($post_id, 'class_schedule_title', 'Расписание и стоимость');
$schedule_rows = crb_get_post_meta($post_id, 'class_schedule');
$price_text = crb_get_post_meta($post_id, 'class_price_text', '');
if ('' === $price_text) {
$price_text = get_option('branch_price_school') ?: '45 000 ₽ / месяц';
}
$price_note = crb_get_post_meta($post_id, 'class_price_note', 'включая питание и продлёнку до 19:00');
$hero_btn_text = crb_get_post_meta($post_id, 'class_hero_btn_text', 'Записаться на пробный урок');
$hero_btn_url = crb_get_post_meta($post_id, 'class_hero_btn_url', '#form');
?>
<section class="class-schedule section-bg" data-bg="class-schedule" id="class-schedule" aria-labelledby="class-schedule-title">
<div class="container">
<div class="section-header--left">
<h2 id="class-schedule-title" class="bento-h2"><?php echo esc_html($schedule_title); ?></h2>
</div>
<div class="class-schedule__layout">
<?php if (is_array($schedule_rows) && ! empty($schedule_rows)) : ?>
<div class="class-schedule__table-wrap">
<table class="class-schedule__table">
<thead>
<tr>
<th scope="col">День</th>
<th scope="col">Время</th>
<th scope="col">Предмет</th>
</tr>
</thead>
<tbody>
<?php foreach ($schedule_rows as $row) :
$day = isset($row['schedule_day']) ? trim($row['schedule_day']) : '';
$time = isset($row['schedule_time']) ? trim($row['schedule_time']) : '';
$subject = isset($row['schedule_subject']) ? trim($row['schedule_subject']) : '';
if ('' === $subject && '' === $time) {
continue;
}
?>
<tr>
<td data-label="День"><?php echo esc_html($day); ?></td>
<td data-label="Время"><?php echo esc_html($time); ?></td>
<td data-label="Предмет"><?php echo esc_html($subject); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<aside class="class-price">
<span class="class-price__label">Стоимость обучения</span>
<span class="class-price__amount"><?php echo esc_html($price_text); ?></span>
<?php if ($price_note) : ?>
<p class="class-price__note"><?php echo esc_html($price_note); ?></p>
<?php endif; ?>
<?php if ($hero_btn_url && '#' !== $hero_btn_url) : ?>
<a class="btn-write btn-primary class-price__cta" href="<?php echo esc_url($hero_btn_url); ?>"><?php echo esc_html($hero_btn_text); ?></a>
<?php else : ?>
<button class="btn-write btn-primary class-price__cta open-bitrix-form" type="button"><?php echo esc_html($hero_btn_text); ?></button>
<?php endif; ?>
</aside>
</div>
</div>
</section>