<?php
get_header();
?>
<?php
if( get_field('content') ):
    while ( has_sub_field('content') ) :
        if( get_row_layout() == 'main_banner' ): ?>
            <?php $mainBannerBG = get_sub_field('bn_bg'); ?>
            <section class="banner_img" style="background:url(<?= $mainBannerBG['url']; ?>) center center / cover no-repeat fixed;">
                <div class="row m0">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-6 banner_text">
                                <h2 class="animated fadeInLeft"><?php the_sub_field('bn_title'); ?></h2>
                                <p class="wow fadeInLeft" data-wow-delay="0.5s"><?php the_sub_field('bn_text'); ?></p>
                                <?php
                                $bannerButton=get_sub_field('bn_button_name');
                                $bannerURL=get_sub_field('bn_button_url');
                                if (!empty($bannerButton)&&!empty($bannerURL)):
                                    echo "<a href=\"$bannerURL\" class=\"btn btn-default btn-outline\">$bannerButton</a>";
                                endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'inner_banner' ): ?>
            <?php $innerBannerBG = get_sub_field('inn_bn_bg'); ?>
            <section class=" banner_img inner_page" style="background:url( <?php
            if (!empty($innerBannerBG)) : echo $innerBannerBG['url']; else: echo get_template_directory_uri()."/images/why.png"; endif; ?>) center center / cover no-repeat fixed;">
                <div class="row m0">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-6 banner_text">
                                <?php if (get_sub_field('inn_bn_title')) : ?>
                                    <div class="tablee_cell">
                                        <h2 class="animated fadeInLeft"><?php the_sub_field('inn_bn_title'); ?></h2>
                                    </div>
                                <?php else: ?>
                                    <h2 class="animated fadeInLeft"><?php the_title(); ?></h2>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'simple_step' ): ?>
            <section class="container-fluid">
                <div class="row">
                    <div class="container m_t_20 m_b_40">
                        <div class="row">
                            <div class="col-md-12 title_text text-center">
                                <h2><?php the_sub_field('st_title'); ?></h2>
                                <div class="step_boxes">
                                    <?php
                                    if( have_rows('steps') ):
                                        while ( have_rows('steps') ) : the_row(); ?>
                                            <div class="step_box">
                                                <?php $stepImage = get_sub_field('stp_icon'); ?>
                                                <img src="<?= $stepImage['url']; ?>" alt="<?= $stepImage['alt']; ?>" class="wow swing"/>
                                                <h2><?php the_sub_field('stp_title'); ?></h2>
                                                <p><?php the_sub_field('stp_text'); ?></p>
                                            </div>
                                        <?php endwhile;
                                    endif;
                                    wp_reset_postdata();
                                    ?>
                                </div>
                                <?php
                                $stpButtonName=get_field('st_button_name');
                                $stpButtonURL=get_field('st_button_url');
                                if (!empty($stpButtonName)&&!empty($stpButtonURL)): ?>
                                    <div class="col-md-12 text-center text-uppercase">
                                        <a href="<?= $stpButtonURL; ?>" class="btn btn-primary"><?= $stpButtonName; ?></a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'two_column' ): ?>
            <section class=" background_gray">
                <div class="row m0">
                    <div class="container">
                        <div class="row">
                            <div class="tablee">
                                <div class="col-md-6 tablee_cell">
                                    <div class="title_text">
                                        <h2 class="m0"><?php the_sub_field('hiw_title'); ?></h2>
                                        <h4><?php the_sub_field('hiw_subtitle'); ?></h4>
                                    </div>
                                    <div class="content_text">
                                        <?php the_sub_field('hiw_text'); ?>
                                        <?php
                                        $hiwButtonName=get_sub_field('hiw_button_name');
                                        $hiwButtonURL=get_sub_field('hiw_button_url');
                                        if (!empty($hiwButtonName)&&!empty($hiwButtonURL)): ?>
                                            <a href="<?= $hiwButtonURL; ?>" class="btn btn-primary text-uppercase"><?= $hiwButtonName; ?></a>
                                        <?php endif; ?>
                                    </div>
                                </div>
                                <div class="col-md-6 tablee_cell">
                                    <?php
                                    $hiwImage = get_sub_field('hiw_image');
                                    if( !empty($hiwImage) ): ?>
                                        <img src="<?php echo $hiwImage['url']; ?>" alt="<?php echo $hiwImage['alt']; ?>" class="img-set img-responsive  wow fadeInRight" />
                                    <?php endif;
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'five_column' ): ?>
            <section class="container-fluid">
                <div class="row">
                    <div class="container p0">
                        <div class="row m_t_50 m_b_60">
                            <div class="title_text col-md-12 text-center">
                                <h2><?php the_sub_field('wwf_title'); ?></h2>
                                <h4 ><?php the_sub_field('wwf_text'); ?></h4>
                            </div>
                            <div class="what_we_do_boxes">
                                <?php
                                if( have_rows('what_we_fund') ):
                                    while ( have_rows('what_we_fund') ) : the_row(); ?>
                                        <div class="what_we_do">
                                            <div class="what_we_do_content">
                                                <?php $wdfImage = get_sub_field('wwfr_hvr_img'); ?>
                                                <img src="<?= $wdfImage['url']; ?>" alt="<?= $wdfImage['alt']; ?>" class="img-responsive normal_img"/>
                                                <?php $wdfhvrImage = get_sub_field('wwfr_image'); ?>
                                                <img src="<?= $wdfhvrImage['url']; ?>" alt="<?= $wdfhvrImage['alt']; ?>" class="img-responsive hover_img"/>
                                                <h2><?php the_sub_field('wwfr_title'); ?></h2>
                                                <?php
                                                $wwfrURL = get_sub_field('wwfr_url');
                                                if (!empty($wwfrURL)) : ?>
                                                    <a href="<?= $wwfrURL; ?>" class="animated fadeInDown">Read More  <img src="<?= site_url(); ?>/wp-content/uploads/2019/03/icon_4_hoaaur.png" class="arrow_right"/></a>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    <?php endwhile;
                                endif;
                                wp_reset_postdata();
                                ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'four_column' ): ?>
            <?php $faqBG = get_sub_field('faq_bg'); ?>
            <section class="faq_sections" style="background:url(<?= $faqBG['url']; ?>) center center / cover no-repeat;">
                <div class="row m0">
                    <div class="tablee">
                        <?php
                        if( have_rows('faq') ):
                            while ( have_rows('faq') ) : the_row(); ?>
                                <div class="tablee_cell faq_box col-md-3">
                                    <h4><?php the_sub_field('faq_subtitle'); ?></h4>
                                    <h2><?php the_sub_field('faq_title'); ?></h2>
                                    <p class="animated fadeInUp"><?php the_sub_field('faq_text'); ?></p>
                                </div>
                            <?php endwhile;
                        endif;
                        wp_reset_postdata();
                        ?>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'about' ): ?>
            <section class="about_section container-fluid">
                <div class="row">
                    <?php
                    $aboutImage = get_sub_field('ab_image');
                    ?>
                    <img src="<?= $aboutImage['url']; ?>" alt="<?= $aboutImage['alt']; ?>" class="about_left_img"  />
                    <div class="container">
                        <div class="row">
                            <div class="col-md-5  col-md-offset-7 col-sm-5 col-sm-offset-7 ">
                                <div class="content_text m_t_100 m_b_100 p_t_60 p_b_60">
                                    <h2><?php the_sub_field('ab_title'); ?></h2>
                                    <?php the_sub_field('ab_text') ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'testimonial' ): ?>
            <?php $testBG = get_field('test_bg'); ?>
            <section class="container-fluid" style="background:#00395d url(<?= $testBG['url']; ?>) left center / auto no-repeat;">
                <div class="row  m_t_50 m_b_60">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-12 title_text text_white text-center m_b_30">
                                <h2><?php the_sub_field('test_title'); ?></h2>
                            </div>
                            <div class="col-md-12 text-center">
                                <div class="owl-carousel" id="customer_reviews">
                                    <?php
                                    if( have_rows('testimonial') ):
                                        while ( have_rows('testimonial') ) : the_row(); ?>
                                            <div class="item">
                                                <div class="review_box">
                                                    <p><?php the_sub_field('author_text'); ?></p>
                                                    <div class="review_details">
                                                        <?php $authorImage = get_sub_field('author_image'); ?>
                                                        <img src="<?= $authorImage['url']; ?>" alt="<?= $authorImage['alt']; ?>" class="review_img"/> <h3><?php the_sub_field('author_name'); ?></h3>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php endwhile;
                                    endif;
                                    wp_reset_postdata();
                                    ?>
                                </div>
                            </div>
                            <div class="col-md-12 m_t_60 text-center text_underline font_test">
                                <?php
                                $testBtnName=get_sub_field('test_button_name');
                                $testBtnURL=get_sub_field('test_button_url');
                                if (!empty($testBtnName)&&!empty($testBtnURL)):
                                    echo "<a href=\"$testBtnURL\" class=\"text_white text-center text-uppercase\">$testBtnName</a>";
                                endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'contact_form' ): ?>
            <section class="container-fluid" style="background:url(<?= site_url(); ?>/wp-content/uploads/2019/03/apply_now_bg_white.png)   right center / auto no-repeat,url(<?= site_url(); ?>/wp-content/uploads/2019/03/apply_now_bg.png) center center / cover no-repeat;">
                <div class="row  m_t_60 m_b_80">
                    <div class="container">
                        <div class="row">
                            <div class="title_text col-md-12 ">
                                <h2><?php the_sub_field('an_title'); ?></h2>
                            </div>
                            <div class="col-md-8 col-md-offset-2 m_t_50 apply_form">
                                <?php $cntcForm = get_sub_field('con_form'); ?>
                                <?= do_shortcode($cntcForm); ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'contact_form_style_two' ): ?>
            <section class="container-fluid" style="background:#9fb4bf  url(<?= site_url(); ?>/wp-content/uploads/2019/03/apply_now_bg_white22.png) center right / auto no-repeat;">
                <div class="row  m_t_100 m_b_100">
                    <div class="container">
                        <div class="row">
                            <div class="title_text text-center text_white col-md-12 ">
                                <h2><?php the_sub_field('style_two_cn_title'); ?></h2>
                            </div>
                            <div class="col-md-12 m_t_50 apply_form form_2">
                                <?php $contactpageForm = get_sub_field('style_two_cn_form'); ?>
                                <?= do_shortcode($contactpageForm); ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'contact_form_style_three' ): ?>
            <section class="  container-fluid" style="background:url(<?= site_url(); ?>/wp-content/uploads/2019/03/apply_now_bg_white.png)   right center / auto no-repeat,url(<?= site_url(); ?>/wp-content/uploads/2019/03/apply_now_bg.png) center center / cover no-repeat;">
                <div class="row  m_t_100 m_b_100">
                    <div class="container">
                        <div class="row">
                            <div class="title_text col-md-12 ">
                                <h2><?php the_sub_field('style_three_cn_title'); ?></h2>
                            </div>
                            <div class="col-md-10 col-md-offset-1   apply_form">
                                <?php $payoffShortcode= get_sub_field('style_three_cn_form'); ?>
                                <?= do_shortcode($payoffShortcode); ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'faqs' ): ?>
            <section class="container-fluid" style="background:#fff url(<?= get_template_directory_uri(); ?>/images/happy_cus_bg2.png) left center / auto no-repeat fixed;">
                <div class="row">
                    <div class="container">
                        <div class="row  m_t_50 m_b_50">
                            <div class="col-md-12 title_text text-center">
                                <h2><?php the_sub_field('faq_title'); ?></h2>
                            </div>
                            <div class="col-md-10  col-md-offset-1">
                                <?php
                                $faqCount = 0;
                                if( have_rows('page_faqs') ):
                                    while ( have_rows('page_faqs') ) : the_row(); $faqCount++; ?>
                                        <div class="row locations_zig <?php if ($faqCount === 1) : echo 'open'; endif; ?>">
                                            <div class="col-md-12 header_port">
                                                <a href="javascript:void(0);" class="header_location"><?= $faqCount; ?>. <?php the_sub_field('faq_rep_title'); ?></a>
                                            </div>
                                            <div class="col-md-12 body_port" style="<?php if ($faqCount === 1) : echo 'display: block;'; endif; ?>">
                                                <?php the_sub_field('faq_rep_text'); ?>
                                            </div>
                                        </div>
                                    <?php endwhile;
                                endif;
                                wp_reset_postdata();
                                ?>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'map' ): ?>
            <section class="container-fluid" style="filter:grayscale(100%)">
                <div class="row">
                    <?php the_sub_field('iframe_map'); ?>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'two_column_about' ): ?>
            <section class="about_section container-fluid">
                <div class="row">
                    <div class="container m_t_20 m_b_20">
                        <div class="row m_t_100 m_b_100">
                            <div class="tablee">
                                <div class="tablee_cell col-md-6">
                                    <div class="row ">
                                        <div class="col-md-12 m_t_30 m_b_30">
                                            <div class="content_text content_2">
                                                <h2><?php the_sub_field('tab_title'); ?></h2>
                                                <?php the_sub_field('tab_text'); ?>
                                                <?php
                                                $abri_btn_nm=get_sub_field('tab_button_name');
                                                $abribtnURL=get_sub_field('tab_button_url');
                                                if (!empty($abri_btn_nm)&&!empty($abribtnURL)): ?>
                                                    <a class="btn btn-primary m_t_30" href="<?= $abribtnURL; ?>"><?= $abri_btn_nm; ?></a>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <?php $contentImage = get_sub_field('tab_image'); ?>
                                <div class="tablee_cell col-md-6 wow fadeInRight p_t_100 p_b_100" style="background:url(<?= $contentImage['url']; ?>) center center / cover no-repeat;"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'two_column_left_image' ): ?>
            <section class="about_section container-fluid">
                <div class="row">
                    <?php $abImage1 = get_sub_field('ab_page_image'); ?>
                    <img src="<?= $abImage1['url']; ?>" class="about_left_img"  />
                    <div class="container">
                        <div class="row">
                            <div class="col-md-5  col-md-offset-7 col-sm-5 col-sm-offset-7 ">
                                <div class="content_text m_t_100 m_b_100 p_t_60 p_b_60">
                                    <h2><?php the_sub_field('ab_li_title'); ?></h2>
                                    <?php the_sub_field('ab_li_text'); ?>
                                    <h4><?php the_sub_field('ab_lisubtitle'); ?></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'two_column_right_image' ): ?>
            <section class="about_section container-fluid" style="background:#f3f7fa">
                <div class="row">
                    <?php $abImage2 = get_sub_field('abri_image'); ?>
                    <img src="<?= $abImage2['url']; ?>" class="about_right_img" />
                    <div class="container">
                        <div class="row">
                            <div class="col-md-5 col-sm-5">
                                <div class="content_text m_t_100 m_b_100    ">
                                    <h2><?php the_sub_field('ab_ri_title'); ?></h2>
                                    <?php the_sub_field('ab_ri_text'); ?>
                                    <h4><?php the_sub_field('ab_ri_subtitle'); ?></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
        if( get_row_layout() == 'wt_call_us' ): ?>
            <section class="dark_section">
                <div class="row">
                    <div class="container">
                        <div class="row text-center">
                            <?php the_sub_field('wt_call_text'); ?>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif;
    endwhile;
endif;
?>
<?php
while (have_posts()) : the_post();
    the_content();
endwhile;
?>
<?php get_footer();
