<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Twenty_One
 * @since Twenty Twenty-One 1.0
 */

get_header(); ?>
<?php if (have_posts()):
    while (have_posts()):
        the_post(); ?>
        <?php $Bannersection = get_field('banner_group');
        $BannerHeading = $Bannersection['banner_heading'];
        $Bannerimage = $Bannersection['banner_image']; ?>
        <?php if ($Bannerimage): ?>
            <section class="hero-block hero-block-in clear" style="background-image: url('<?php echo $Bannerimage; ?>');">
                <?php if ($BannerHeading): ?>
                    <div class="container">
                        <h1><?php echo $BannerHeading; ?></h1>
                    </div>
                <?php endif; ?>
            </section>
        <?php endif; ?>
        <?php $Callsection = get_field('call_us_section');
        $callHeading = $Callsection['call_us_heading'];
        $callimage = $Callsection['call_us_image'];?>
        <section class="blue-strip  blue-strip-in clear">
            <div class="container">
            <?php $companymobile = get_field('company_mobile_number', 'options');
        $phone = $companymobile['mobile_number'];
        $phonelink = $companymobile['mobile_link']; ?>
                <a href="<?php echo $phonelink; ?>"><img src="<?php echo $callimage['url']; ?>"
                        alt="<?php echo $callimage['alt'] ?>"> <?php echo $callHeading; ?>: <span><?php echo $phone; ?></span>
                </a>
            </div>
        </section>
        <?php $rightimagesection = get_field('right_image_block');
        $sectionContent = $rightimagesection['scontent'];
        $sectionimage = $rightimagesection['section_image']; ?>
        <section class="mob-service clear">
            <div class="container">
                <div class="flex">
                    <div class="left-side">
                        <?php echo $sectionContent; ?>
                    </div>

                    <div class="right-side">
                        <img src="<?php echo $sectionimage['url']; ?>" alt="<?php echo $sectionimage['alt'] ?>">
                    </div>
                </div>
            </div>
        </section>
        <?php wp_reset_postdata(); ?>
        <?php $whychooseus = get_field('why_choose');
        $sectionHeading = $whychooseus['why_choose_heading'];
        $sectionimage = $whychooseus['why_choose_background']; ?>
<?php if($sectionHeading || $sectionimage) {?>
        <section class="mob-choose clear" style="background-image:url('<?php echo $sectionimage; ?>');">
            <div class="container">
                <h2><?php echo $sectionHeading; ?></h2>
                <div class="flex">
                    <?php if (have_rows('why_choose')): ?>
                        <?php while (have_rows('why_choose')):
                            the_row(); ?>
                            <?php if (have_rows('why_choose_box')): ?>
                                <?php while (have_rows('why_choose_box')):
                                    the_row(); ?>
                                    <?php
                                    $boximage = get_sub_field('icon_image');
                                    $boxheading = get_sub_field('box_heading');
                                    $boxcontent = get_sub_field('box_content');
                                    ?>
                                    <div class="mob-choose-box">
                                        <span><img src="<?php echo $boximage['url']; ?>" alt="<?php echo $boximage['alt']; ?>"></span>
                                        <h4><?php echo $boxheading; ?></h4>
                                        <p><?php echo $boxcontent; ?></p>
                                    </div>
                                <?php endwhile; ?>
                            <?php endif; ?>
                        <?php endwhile; ?>
                    <?php endif; ?>
                </div>
            </div>
        </section>
       <?php }?>
        <section class="mob-service clear">
        <?php $leftimage = get_field('left_image_block');
        $sectionimages = $leftimage['section_image1'];
        $sectionsHeadings = $leftimage['content1']; ?>
			<?php if($sectionimages || $sectionsHeadings){?>
            <div class="container">
                <div class="flex">
                    <div class="right-side">
                        <img src="<?php echo $sectionimages['url']; ?>" alt="<?php echo $sectionimages['alt']; ?>">
                    </div>
                    <div class="left-side">
                       <?php echo $sectionsHeadings;?>
                    </div>
                </div>
            </div>
        </section>
<?php }?>
       <?php 
$priceslider = get_field('therapy_price');
$sectionimage = $priceslider['background_image']; 
?>
<?php if($sectionimage){ ?>
<section class="therapy-price clear therapy-price-box-outer" style="background-image:url('<?php echo $sectionimage ?>');">
    <div class="container">
        <div class="owl-carousel owl-theme arrow-owl" id="therapy-price-slider">
            <?php if (have_rows('therapy_price')): ?>
                <?php while (have_rows('therapy_price')):
                    the_row(); ?>
                    <?php if (have_rows('box')): ?>
                        <?php while (have_rows('box')):
                            the_row(); ?>
                            <?php
                            $typeheading = get_sub_field('type_heading');
                            $typecontent = get_sub_field('type_content');
                            $priceheading = get_sub_field('price_heading');
                            $prices = get_sub_field('price');
                            $sessionheading = get_sub_field('session_heading');
                            $sessiontime = get_sub_field('session_time');
                            $buttontext = get_sub_field('button_text');
                            $buttonlink = get_sub_field('button_link');?>
                            <div class="therapy-price-box">
                                <p class="type"><span class="key"><?php echo $typeheading;?>:</span> <span class="value"><?php echo $typecontent;?></span></p>
                                <p class="price"><span class="key"><?php echo $priceheading;?>:</span> <span class="value"><?php echo $prices;?></span></p>
                                <p class="session"><span class="key"><?php echo $sessionheading;?>:</span> <span class="value"><?php echo $sessiontime;?></span></p>
                                <a href="<?php echo $buttonlink['url']?>"><?php echo $buttontext?></a>
                            </div>
                        <?php endwhile; ?>
                    <?php endif; ?>
                <?php endwhile; ?>
            <?php endif; ?>
        </div>
    </div>
</section>
<?php } ?>
    <?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>