<?php
get_header(); ?>
    <?php
    if( have_rows('page_content') ):
        while ( have_rows('page_content') ) : the_row();
            if( get_row_layout() == 'home_hero_section' ): ?>
                <?php $heroBG = get_sub_field('hhs_bg_img'); ?>
                <section class="banner container-fluid" style="background:url(<?= $heroBG['url']; ?>) center center / cover no-repeat;">
                    <div class="container">
                        <div class="row banner_text">
                            <h2><?php the_sub_field('hhs_title'); ?></h2>
                            <?php 
                            $hhs_number=get_sub_field('hhs_number');
                            if (!empty($hhs_number)): ?>
                                <a href="tel:<?= $hhs_number; ?>" class="btn btn-banner"><i class="fa fa-phone"></i> <?= $hhs_number; ?></a>
                            <?php endif; ?>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'our_mission_with_map' ): ?>
                <section class="container-fluid about_us_bg">
                    <img src="<?= site_url(); ?>/wp-content/uploads/2019/05/map_bg.png" class="map_background"/>
                    <div class="row">
                        <div class="container">
                            <div class="row m_t_80  m_b_80 p_b_80 about_text">
                                <div class="col-md-5">
                                    <?php $omwm_title = get_sub_field('omwm_title');
                                    if (!empty($omwm_title)) : ?>
                                        <div class="title_text left_line text-center m_b_90">
                                            <h2><span><?= $omwm_title; ?></span></h2>
                                        </div>
                                    <?php endif; ?>
<!--                                    <img src="--><?//= get_template_directory_uri(); ?><!--/images/Map.png" class="img-responsive m_t_80"/>-->
                                    <div id="map" style="width: 500px; height: 500px; border-radius: 50%;"></div>

                                </div>
                                <div class="col-md-7 p30">
                                    <div class="row">
                                        <div class="col-md-11 padding_right">
                                            <?php the_sub_field('omwm_text'); ?>
                                        </div>
                                    </div>
                                    <div class="about_imgs">
                                        <?php $omwm_frst_img = get_sub_field('omwm_frst_img'); ?>
                                        <img src="<?= $omwm_frst_img['url']; ?>" alt="<?= $omwm_frst_img['alt']; ?>" class="image_1"/>
                                        <?php $omwm_scnd_img = get_sub_field('omwm_scnd_img'); ?>
                                        <img src="<?= $omwm_scnd_img['url']; ?>" alt="<?= $omwm_scnd_img['alt']; ?>" class="image_2"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'team_member' ): ?>
                <section class="container-fluid gray_bg">
                    <div class="row">
                        <div class="container">
                            <div class="row margin_minus m_b_80 p_b_80 about_text">
                                <?php $tm_title = get_sub_field('tm_title');
                                if (!empty($tm_title)) : ?>
                                    <div class="title_text col-md-12 text-center m_b_80">
                                        <h2><?= $tm_title; ?></h2>
                                    </div>
                                <?php endif; ?>
                                <div class="col-md-12">
                                    <div class="row same_height_container">
                                        <?php
                                        $team_member = get_sub_field('team_member');
                                        if( $team_member ): ?>
                                            <?php foreach( $team_member as $team_members): ?>
                                                <?php setup_postdata($team_members); ?>
                                                <div class="col-md-3">
                                                    <div class="about_box same_height">
                                                        <?= get_the_post_thumbnail($team_members->ID); ?>
                                                        <h3><?= get_the_title($team_members->ID); ?></h3>
                                                        <h4><?php the_field('position',$team_members->ID); ?></h4>
                                                        <h5><?php the_field('email_address',$team_members->ID); ?></h5>
                                                        <p><?php the_field('home_page_content',$team_members->ID); ?></p>
                                                        <a href="<?= site_url(); ?>/bendercompanies/our-team/#<?php echo( basename(get_permalink($team_members->ID)) ); ?>">READ MORE</a>
                                                        <a href="mailto:<?php the_field('email_address',$team_members->ID); ?>" class="message_icon"><i class="fa fa-envelope"></i></a>
                                                    </div>
                                                </div>
                                            <?php endforeach; ?>
                                            <?php wp_reset_postdata(); ?>
                                        <?php endif; ?>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 m_t_xs_80 m_t_80 text-center">
                                            <?php
                                            $tm_btn_nm=get_sub_field('tm_btn_nm');
                                            $tm_btn_url=get_sub_field('tm_btn_url');
                                            if (!empty($tm_btn_nm)&&!empty($tm_btn_url)):
                                                echo "<a href=\"$tm_btn_url\" class=\"btn btn-rounded\">$tm_btn_nm</a>";
                                            endif;
                                            ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'hero_section_with_right_bg' ): ?>
                <section class="sub_banner container-fluid">
                    <div class="row">
                        <?php $hsw_bg_img = get_sub_field('hsw_bg_img'); ?>
                        <img src="<?= $hsw_bg_img['url']; ?>" class="img-responsive banner_img"/>
                        <div class="container">
                            <div class="row m_t_100 m_b_100">
                                <?php $hsw_ph_num = get_sub_field('hsw_ph_num');
                                if (!empty($hsw_ph_num)) : ?>
                                    <a href="tel:<?= $hsw_ph_num; ?>" class="btn btn-banner"><i class="fa fa-phone"></i> <?= $hsw_ph_num; ?></a>
                                <?php endif; ?>
                                <div class="col-md-5 title_text text-left  sub_text">
                                    <?php
                                    $hsw_title = get_sub_field('hsw_title');
                                    if (!empty($hsw_title)) : ?>
                                        <h2><?= $hsw_title; ?></h2>
                                    <?php endif; ?>
                                    <?php the_sub_field('hsw_text'); ?>
                                    <?php 
                                    $hsw_btn_name=get_field('hsw_btn_name');
                                    $hsw_btn_url=get_field('hsw_btn_url');
                                    if (!empty($hsw_btn_name)&&!empty($hsw_btn_url)):
                                        echo "<a href=\"$hsw_btn_url\" class=\"banner_a\">$hsw_btn_name <i class=\"fa fa-arrow-right\"></i></a>";
                                    endif;
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'content_with_four_boxs' ): ?>
                <section class="container-fluid gray_fancy_bg custom-top-bg">
                    <div class="row">
                        <div class="container">
                            <div class="row m_t_80 m_t_xs_80 m_b_80 p_b_80 about_text">
                                <div class="tablee working_bender">
                                    <div class="col-md-5 tablee_cell">
                                        <div class="title_text light_font text-left">
                                            <?php $cwfb_title = get_sub_field('cwfb_title');
                                            if (!empty($cwfb_title)) : ?>
                                                <h2><?= $cwfb_title; ?></h2>
                                            <?php endif; ?>
                                            <?php the_sub_field('cwfb_text'); ?>
                                        </div>
                                    </div>
                                    <div class="col-md-7 tablee_cell">
                                        <div class="row">
                                            <div class="col-md-11 col-md-offset-1">
                                                <div class="row">
                                                    <div class="col-md-6">
                                                        <?php
                                                        $content_with_four_boxs = 0;
                                                        if( have_rows('cwfb_four_boxes') ):
                                                            while ( have_rows('cwfb_four_boxes') ) : the_row(); $content_with_four_boxs++; ?>
                                                                <div class="approch_box">
                                                                    <div class="tablee m_b_20">
                                                                        <div class="tablee_cell">
                                                                            <h3><?php the_sub_field('cwfb_title'); ?></h3>
                                                                        </div>
                                                                        <div class="tablee_cell">
                                                                            <span class="round_img">
                                                                                <?php $cwfb_image = get_sub_field('cwfb_image'); ?>
                                                                                <img src="<?= $cwfb_image['url']; ?>" />
                                                                            </span>
                                                                        </div>
                                                                    </div>
                                                                    <?php the_sub_field('cwfb_text'); ?>
                                                                </div>                                                                                                              <?php if ($content_with_four_boxs === 2 ) : ?>
                                                            </div><div class="col-md-6 m_t_50">
                                                        <?php endif;
                                                        endwhile;
                                                        endif;
                                                        wp_reset_postdata();
                                                         ?>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'hero_section_with_team_images' ): ?>
                <section class="sub_banner m_t_50 container-fluid our_professional_sec" style="background:url(<?= get_template_directory_uri(); ?>/images/banner_gray.png) top left / 100% 100% no-repeat;">
                    <div class="row">
                        <div class="container">
                            <div class="row m_t_100">
                                <div class="tablee vtop">
                                    <div class="col-md-5 tablee_cell title_text text-left p40">
                                        <?php $hst_title = get_sub_field('hst_title');
                                        if (!empty($hst_title)) : ?>
                                            <h2><?= $hst_title; ?></h2>
                                        <?php endif; ?>
                                        <?php the_sub_field('hst_text'); ?>
                                        <?php 
                                        $hstl_btn_name=get_sub_field('hstl_btn_name');
                                        $hstl_btn_url=get_sub_field('hstl_btn_url');
                                        if (!empty($hstl_btn_name)&&!empty($hstl_btn_url)): ?>
                                            <a href="<?= $hstl_btn_url; ?>" class="banner_a"><?= $hstl_btn_name; ?></a>
                                        <?php endif; ?>
                                    </div>
                                    <div class="col-md-7 tablee_cell">
                                        <div class="row">
                                            <div class="col-md-10">
                                                <div class="team_box_banner">
                                                    <?php
                                                    $teamBox=0;
                                                    if( have_rows('hst_tm_img') ):
                                                        while ( have_rows('hst_tm_img') ) : the_row(); $teamBox++;
                                                            $hst_image = get_sub_field('hst_image'); ?>
                                                            <img src="<?= $hst_image['url']; ?>" class="team_<?= $teamBox ?>"/>
                                                        <?php endwhile;
                                                    endif;
                                                    wp_reset_postdata();
                                                    ?>
                                                    <div class="right_team">
                                                        <?php
                                                        $bannerButton = 0;
                                                        if( have_rows('hst_buttons') ):
                                                            while ( have_rows('hst_buttons') ) : the_row(); $bannerButton++;
                                                                $hst_btn_name = get_sub_field('hst_btn_name');
                                                                $hst_btn_url = get_sub_field('hst_btn_url'); ?>
                                                                <a href="#" class="<?php if ($bannerButton == 1) : echo "button_first"; elseif ($bannerButton == 2 ) : echo "button_sectnd"; else: echo "button_third"; endif; ?>"><?= $hst_btn_name; ?></a>
                                                            <?php endwhile;
                                                        endif;
                                                        wp_reset_postdata();
                                                        ?>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'team_listing' ): ?>
                <section class="container-fluid" id="our-team" >
                    <div class="row">
                        <div class="container p_b_80">
                            <?php
                            $select_team_member = get_sub_field('select_team_member');
                            if( $select_team_member ): ?>
                                <?php foreach( $select_team_member as $select_team_members): ?>
                                    <div id="<?php echo( basename(get_permalink($select_team_members->ID)) ); ?>" class="row p_t_40 p_b_50 professional about_text">
                                        <div class="tablee">
                                            <div class="tablee_cell col-md-4 col-sm-4 col-xs-12">
                                                <div class="team_box">
                                                    <?php $listing_image = get_field('listing_image',$select_team_members->ID); ?>
                                                    <img src="<?= $listing_image['url']; ?>"/>
                                                    <div class="team_details">
                                                        <a href="mailto:<?php the_field('email_address',$select_team_members->ID); ?>" class="round_icon"><i class="fa fa-envelope"></i></a>
                                                        <h3><?= get_the_title($select_team_members->ID); ?></h3>
                                                        <h4><?php the_field('position',$select_team_members->ID); ?></h4>

                                                        <h5><?php the_field('email_address',$select_team_members->ID); ?></h5>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="tablee_cell col-md-8 ">
                                                <div class="row">
                                                    <div class="col-md-10 col-md-offset-2">
                                                        <?php echo get_post_field('post_content', $select_team_members->ID);
?>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php endforeach; ?>
                                <?php wp_reset_postdata(); ?>
                            <?php endif; ?>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'strait_up_white_module' ): ?>
                <section class="sub_banner m_t_50 container-fluid">
                    <div class="row">
                        <div class="container">
                            <div class="row m_t_80">
                                <div class="col-md-6 col-md-offset-3 text-center title_text">
                                    <?php $suwm_icon = get_sub_field('suwm_icon'); ?>
                                    <img src="<?= $suwm_icon['url']; ?>" class="center-block" />
                                    <h2><?php the_sub_field('suwm_title'); ?></h2>
                                    <?php the_sub_field('suwm_text'); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'investment_module_with_map' ): ?>
                <section class="container-fluid gray_bg_3">
                    <div class="row">
                        <div class="container m_t_80 m_b_80">
                            <div class="row">
                                <div class="tablee">
                                    <div class="tablee_cell col-md-6">
                                        <div class="row">
                                            <?php $imwm_title = get_sub_field('imwm_title');
                                            if (!empty($imwm_title)) : ?>
                                                <div class="title_text col-md-12 left_line text-center">
                                                    <h2><span><?= $imwm_title; ?></span></h2>
                                                </div>
                                            <?php endif; ?>
                                            <div class="col-md-12">
                                                <div class="investment_map">
                                                <div id="map" style="width: 510px;
    height: 357px;
    border-radius: 25px;
    position: relative;
    overflow: hidden;
    max-width: 100%; margin: 0 auto;"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tablee_cell col-md-6">
                                        <div class="row">
                                            <div class="col-md-10 col-md-offset-1">
                                                <?php 
                                                if( have_rows('imwm_moduls') ):
                                                    while ( have_rows('imwm_moduls') ) : the_row(); ?>
                                                        <div class="row">
                                                            <div class="approch_box smaller">
                                                                <div class="tablee m_b_10">
                                                                    <div class="tablee_cell" style="width:60px;">
                                                                <span class="round_img">
                                                                    <?php $imwm_icon = get_sub_field('imwm_icon'); ?>
                                                                    <img src="<?= $imwm_icon['url']; ?>">
                                                                </span>
                                                                    </div>
                                                                    <div class="tablee_cell">
                                                                        <h3><?php the_sub_field('imwm_title'); ?></h3>
                                                                    </div>
                                                                </div>
                                                                <?php the_sub_field('imwm_text'); ?>
                                                            </div>
                                                        </div>
                                                    <?php endwhile;
                                                endif;
                                                wp_reset_postdata();
                                                ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'content_with_background' ): ?>
                <?php $cwb_bg_img = get_sub_field('cwb_bg_img'); ?>
                <section class="container-fluid bg_sides" style="background:#00567D">
					<img src="<?= $cwb_bg_img['url']; ?>" class="background_ss wow bounceInRight" data-wow-duration="2s"/>
                    <div class="row p_b_80">
                        <div class="container m_t_80 m_b_80">
                            <div class="row text_white">
                                <div class="col-md-8 col-md-offset-2 title_text text-center">
                                    <?php $cwb_title = get_sub_field('cwb_title');
                                    if (!empty($cwb_title)) : ?>
                                        <h2><?= $cwb_title; ?></h2>
                                    <?php endif; ?>
                                    <?php the_sub_field('cwb_text'); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'investment_strategy_module' ): ?>
                <section class="container-fluid"  style="background:url(<?= get_template_directory_uri(); ?>/images/home.png) 100% 80% / auto no-repeat;">
                    <div class="row m_t_80 m_b_80">
                        <div class="container">
                            <div class="row">
                                <?php $ism_title = get_sub_field('ism_title');
                                if (!empty($ism_title)) : ?>
                                    <div class="col-md-8 col-md-offset-2 title_text text-center">
                                        <h2><?= $ism_title; ?></h2>
                                    </div>
                                <?php endif; ?>
                                <div class="col-md-8 col-md-offset-2 m_t_20">
                                    <?php
                                    if( have_rows('ism_module') ):
                                        while ( have_rows('ism_module') ) : the_row(); ?>
                                            <div class="investment_box">
                                                <h3><?php the_sub_field('ismr_title'); ?></h3>
                                                <?php the_sub_field('ismr_text'); ?>
                                            </div>
                                        <?php endwhile;
                                    endif;
                                    wp_reset_postdata();
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'bender_investments' ): ?>
                <section class="container-fluid" >
                    <div class="row p_b_80 m_t_80 m_b_80">
                        <div class="container">
                            <div class="row">
                                <?php $bi_title = get_sub_field('bi_title');
                                if (!empty($bi_title)) : ?>
                                    <div class="col-md-8 m_b_30 col-md-offset-2 title_text text-center">
                                        <h2><?= $bi_title; ?></h2>
                                    </div>
                                <?php endif; ?>
                                <div class="col-md-12">
                                    <div class="row">
                                        <?php
                                        $bi = get_sub_field('bi_select');
                                        if( $bi ): ?>
                                            <?php foreach( $bi as $bis): ?>
                                                <?php setup_postdata($bis); ?>
                                                <div class="col-md-3 col-sm-4 col-xs-12">
                                                    <div class="invest_box2">
                                                        <?= get_the_post_thumbnail($bis->ID); ?>
                                                        <span><?php the_field('property_type',$bis->ID); ?></span>
                                                        <div class="invest_content">
                                                            <h3><?= get_the_title($bis->ID); ?></h3>
                                                            <?php $biURL = get_field('property_url',$bis->ID);
                                                            if (!empty($biURL)) : ?>
                                                                <a href="<?= $biURL; ?>" target="_blank">View Property <i class="fa fa-arrow-right"></i></a>
                                                            <?php endif; ?>
                                                        </div>
                                                    </div>
                                                </div>
                                            <?php endforeach; ?>
                                            <?php wp_reset_postdata(); ?>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            <?php endif;
            if( get_row_layout() == 'home_hero_section' ): ?>

            <?php endif;
        endwhile;
    endif;
    ?>

<?php get_footer();