<?php
    /*
    * Template Name: Template Homepage
    */
get_header(); 


$welcomeHead = get_field('welcome_heading', get_the_ID());
$ownInfoHead = get_field('own_info_center_head', get_the_ID());
$ownInfoCont = get_field('own_info_center_content', get_the_ID());


$sliderArg = array(
    'post_type' => 'header_slider',
    'post_statue' => 'publish',
    'post_per_page' => -1
);
$getSlider = new Wp_query($sliderArg);
?>
<section class="main-banner dis-block clearfix">
    <div class="owl-slider banner-slider owl-theme">
        <?php if($getSlider->have_posts()) : while($getSlider->have_posts()): $getSlider->the_post(); 
            $discoverText = get_field('slider_discover_text', get_the_ID());
            $discoverLink = get_field('slider_discover_redirect_to', get_the_ID());
            $learnText    = get_field('slider_learn_text', get_the_ID());
            $learnLink    = get_field('slider_learn_redirect_to', get_the_ID());
            $retainText   = get_field('slider_retain_text', get_the_ID());
            $retainLink   = get_field('slider_retain_redirect_to', get_the_ID()); 
            $btnsHideShow = get_field('slider_button_show_hide', get_the_ID()); ?>
            <div class="item">
                <div class="banner-group">
                    <div class="banner-img banne-img-1" style="background: url(<?php echo get_the_post_thumbnail_url(get_the_ID(),'full'); ?>)no-repeat top center; background-size: cover;"></div>
                    <div class=" banner-content">
                        <div class="container">
                            <div class="dis-block clearfix">
                                <div class="banner-heading"><?php echo get_the_title(); ?></div>
                                <div class="banner-btn">
                                    <?php if($btnsHideShow == true): 
                                        if($discoverText): ?>
                                            <div class="d-inline-block">
                                                <a href="javascript:void(0);<?php //if($discoverLink): echo $discoverLink; else: echo 'javascript:void(0)'; endif; ?>" class="btn white-outline-btn text-uppercase"><?php echo $discoverText; ?></a>
                                            </div>
                                        <?php endif;
                                        if($learnText): ?>
                                            <div class="d-inline-block">
                                                <a href="javascript:void(0);<?php //if($learnLink): echo $learnLink; else: echo 'javascript:void(0)'; endif; ?>" class="btn white-outline-btn text-uppercase"><?php echo $learnText; ?>
                                                </a>
                                            </div>
                                        <?php endif; 
                                        if($retainText): ?>
                                            <div class="d-inline-block">
                                                <a href="javascript:void(0)<?php //if($retainLink): echo $retainLink; else: echo 'javascript:void(0)'; endif; ?>" class="btn white-outline-btn text-uppercase"><?php echo $retainText; ?></a>
                                            </div>
                                        <?php endif; 
                                    endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php endwhile; endif; wp_reset_postdata(); ?>
    </div>
</section>
<section class="mid-section dis-block clearfix">
    <div class="container">
        <div class="dis-block clearfix">
            <div class="heading text-uppercase bottomline text-center ">
                <h1><?php if($welcomeHead): echo $welcomeHead; endif; ?><span><?php if($ownInfoHead): echo $ownInfoHead; endif;?></span>
                </h1>
            </div>
            <?php if($ownInfoCont): ?>
                <div class="dis-block clearfix text-center pad-b50">
                    <?php echo $ownInfoCont; ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
    <div class="dis-block clearfix services-sec bg-grey pad-t80 pad-b80">
        <div class="container">
            <?php $coutner = 1; ?>
            <?php if(have_rows('services_section')) : while(have_rows('services_section')) : the_row(); ?>
            <div class="row services-row align-items-center <?php if($coutner % 2 != 0): echo 'flex-row-reverse'; endif; ?>">
                <div class="col-lg-6 services-col travel-img">
                    <img src="<?php echo get_sub_field('service_image', get_the_ID()); ?>" alt="">
                </div>
                <div class="col-lg-6 services-col">
                    <div class="services-block bg-white">
                        <h2><?php echo get_sub_field('service_title', get_the_ID()); ?></h2>
                        <?php if(have_rows('service_highlight_point')) : ?>
                            <ul>
                                <?php while(have_rows('service_highlight_point')) : the_row(); ?>
                                    <li><?php echo get_sub_field('highlight_name'); ?></li>
                                <?php endwhile; ?>
                            </ul>
                        <?php endif;
                        $readMoreText = get_sub_field('services_read_more_text', get_the_ID());
                        $redirectTo = get_sub_field('services_read_more_redirect_to', get_the_ID());
                        if($readMoreText) : ?>
                            <div class="readmore-btn">
                                <a href="<?php if($redirectTo): echo $redirectTo; else: echo 'javascript:void(0)'; endif; ?>" class="btn blue-btn btn-arrow text-uppercase">
                                    <span><?php echo $readMoreText; ?></span>
                                </a>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        <?php $coutner++; endwhile; endif; ?>
        </div>
    </div>
</section>
<!-- OneTrust Cookies Settings button start -->
<button id="ot-sdk-btn" class="ot-sdk-show-settings">Cookie Settings</button>
<!-- OneTrust Cookies Settings button end -->
<?php get_footer(); ?>