This commit is contained in:
GP_DEV
2025-07-08 14:21:19 +03:00
parent a6bb81cbe1
commit 21562852ca
65 changed files with 7464 additions and 1073 deletions

View File

@@ -3,7 +3,7 @@
* Блок с клубными картами
*/
// Получение полей ACF
$block_id = 'club-cards-' . $block['id'];
$class_name = 'club-cards-block';
if (!empty($block['className'])) {
@@ -14,14 +14,17 @@ if (!empty($block['align'])) {
}
if (!function_exists('get_club_cards_for_current_language')) {
function get_club_cards_for_current_language() {
function get_club_cards_for_current_language()
{
$current_lang = pll_current_language();
$args = array(
'post_type' => 'club-card',
'posts_per_page' => -1,
'lang' => $current_lang,
'post_status' => 'publish'
'post_status' => 'publish',
'sort' => 'menu_order',
'order' => 'ASC',
);
return get_posts($args);
@@ -30,57 +33,118 @@ if (!function_exists('get_club_cards_for_current_language')) {
$cards = get_club_cards_for_current_language();
$heading = get_field('heading', $block['id']);
$room = get_current_room();
if ($room === 'fitness') {
} else {
$section_classes = 'bg-cover bg-center bg-no-repeat';
$bg_image = get_template_directory_uri() . '/assets/images/hero-bg.png';
$style_attr = 'style="background-image: url(' . esc_url($bg_image) . ')"';
}
?>
<section id="<?php echo esc_attr($block_id); ?>" class="<?php echo esc_attr($class_name); ?>">
<div class="container mx-auto mt-[24px]">
<?php if ($heading) : ?>
<h2 class="text-[32px] font-bold mt-[24px]"><?php echo esc_html($heading); ?></h2>
<?php endif; ?>
<section id="<?php echo esc_attr($block_id); ?>" class="py-[96px] <?php echo esc_attr($section_classes); ?>" <?php echo $style_attr; ?>>
<div class="container mx-auto">
<?php if ($cards): ?>
<div class="mt-[24px] grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[30px] max-[768px]:gap-[20px]">
<?php foreach ($cards as $card): ?>
<div class="bg-[#ffffff] border-[1px] border-[#e5e7eb] rounded-[16px] overflow-hidden shadow-lg hover:shadow-xl transition-shadow ">
<?php
$card_image = get_field('image', $card->ID);
if ($card_image): ?>
<div class="overflow-hidden max-w-[60px] max-h-[60px] mx-auto mt-[22px] rounded-full">
<img src="<?php echo esc_url($card_image['url']); ?>"
alt="<?php echo esc_attr($card_image['alt']); ?>"
class="w-full h-full object-cover" />
</div>
<?php endif; ?>
<div class="mt-[24px] grid grid-cols-3 gap-[24px]">
<?php if (is_front_page()): ?>
<?php if ($heading) : ?>
<div class="flex flex-col gap-[16px] [&>img]:w-[294px] mt-[28px]">
<div class="p-[30px] max-[768px]:p-[20px]">
<?php $card_heading = get_field('heading', $card->ID); ?>
<?php if ($card_heading): ?>
<h3 class="text-[24px] max-[768px]:text-[20px] font-semibold text-[#1f2937] mb-[16px] text-center">
<?php echo esc_html($card_heading); ?>
</h3>
<?php endif; ?>
<h2 class="dark:text-[#fff] text-[40px] leading-[120%] font-[500]"><?php echo esc_html($heading); ?></h2>
<?php display_icon(get_current_room() === 'gym' ? 'dark_logo_name' : 'light_logo_name'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php foreach ($cards as $card): ?>
<div class="bg-[#ffffff] rounded-[12px] p-[28px] pb-[16px] h-[258px] shadow-[0_2px_32px_0_rgba(16,_15,_15,_0.03)]">
<div class="flex flex-col h-full">
<div class="flex gap-[16px] items-center"> <?php
$card_image = get_field('image', $card->ID);
if ($card_image): ?>
<div class="overflow-hidden w-[32px] h-[32px]">
<img src="<?php echo esc_url($card_image['url']); ?>"
alt="<?php echo esc_attr($card_image['alt']); ?>"
class="w-full h-full object-cover"/>
</div>
<?php endif; ?>
<?php $card_heading = get_field('heading', $card->ID); ?>
<?php if ($card_heading): ?>
<h3 class="text-[24px] font-[600] leading-[125%]">
<?php echo esc_html($card_heading); ?>
</h3>
<?php endif; ?></div>
<?php $card_description = get_field('description', $card->ID); ?>
<?php if ($card_description): ?>
<div class="text-[16px] max-[768px]:text-[14px] text-[#6b7280] leading-[150%] text-center mb-[16px]">
<div class="text-[16px] leading-[145%] font-[500] mt-[16px]">
<?php echo wp_kses_post($card_description); ?>
</div>
<?php endif; ?>
<?php $card_price = get_field('price', $card->ID); ?>
<?php if ($card_price): ?>
<div class="text-[20px] max-[768px]:text-[18px] font-bold text-[#1f2937] text-center mb-[24px]">
<span>От</span> <?php echo esc_html($card_price); ?> Р.
</div>
<?php endif; ?>
<div class="text-center mt-auto">
<div class="flex mt-auto pt-[16px] border-t border-t-[#f1f1f1] justify-between items-center gap-[12px] flex-wrap">
<?php $popup_button = get_field('popup_button', $card->ID); ?>
<button data-modal="club-card"
data-card-id="<?php echo $card->ID; ?>"
class="inline-block cursor-pointer px-[24px] py-[12px] bg-[#3b82f6] text-white rounded-[8px] hover:bg-[#2563eb] transition-colors ">
<?php echo $popup_button ? esc_html($popup_button) : 'Подробнее'; ?>
</button>
<?php $card_price = get_field('price', $card->ID) ?: ($card_prices['1_month']['day'] ?? ''); ?>
<?php
$card_prices = [];
if (have_rows('card_prices', $card->ID)) {
while (have_rows('card_prices', $card->ID)) {
the_row();
$periods = ['1_month', '3_month', '6_month', '12_month'];
foreach ($periods as $period) {
if (have_rows($period)) {
while (have_rows($period)) {
the_row();
$card_prices[$period] = [
'full' => get_sub_field('full'),
'day' => get_sub_field('day')
];
}
}
}
}
}
?>
<?php
$card_time = [];
if (have_rows('time', $card->ID)) {
while (have_rows('time', $card->ID)) {
the_row();
$card_time[] = [
'normal_days' => get_sub_field('normal_days'),
'vacation_days' => get_sub_field('vacation_days')
];
}
}
?>
<div>
<button
data-modal="club-card"
data-card-id="<?php echo $card->ID; ?>"
data-card-title="<?php echo esc_attr($card_heading); ?>"
data-card-prices='<?php echo esc_attr(json_encode($card_prices)); ?>'
data-card-time='<?php echo esc_attr(json_encode($card_time));
?>'
class="red-gradient-hover cursor-pointer flex text-[#f8f8f8] text-[18px] text-[#fff] font-[600] justify-center h-[59px] w-[160px] rounded-[90px] flex items-center">
<?php echo 'Оформить' ?>
</button>
</div>
<?php if ($card_price): ?>
<div class="flex items-center text-[20px] font-[600] leading-[125%]">
от 
<div class="rounded-[32px] px-[12px] h-[36px] flex items-center bg-[linear-gradient(90deg,_rgba(43,_44,_53,_0.06)_39.42%,_rgba(110,_121,_150,_0.06)_92.9%)]">
<span class="bg-[linear-gradient(90deg,_#2b2c35_67.31%,_#4f5870_92.9%)] text-[24px] flex items-center justify-center font-[600] bg-clip-text text-transparent"> <?php echo esc_html($card_price); ?> ₽ </span>
</div>
 в день
</div>
<?php endif; ?>
</div>
</div>
</div>