<?php
/**
 * Template part for displaying About section
 *
 * @package Buildora Architect
 * @subpackage buildora_architect
 */
?>

<?php $buildora_architect_static_image1 = get_stylesheet_directory_uri() . '/assets/images/about-middle.png'; ?>
<?php if( get_theme_mod( 'buildora_architect_about_show_hide', true) != '') { ?>
<?php
$buildora_architect_about_bg = get_theme_mod(
    'buildora_architect_about_bg_image',
    get_template_directory_uri() . '/assets/images/about-bg.png'
);
?>
<section id="about" style="background-image: url('<?php echo esc_url( $buildora_architect_about_bg ); ?>');">
  <div class="container-fluid">
    <div class="row">
      <div class="col-lg-5 col-md-4 align-self-center">
        <div class="first-about">
          <?php $buildora_architect_about_page = array();
            $buildora_architect_mod = absint( get_theme_mod( 'buildora_architect_about_page' ));
            if ( 'page-none-selected' != $buildora_architect_mod ) {
              $buildora_architect_about_page[] = $buildora_architect_mod;
            }
            if( !empty($buildora_architect_about_page) ) :
            $buildora_architect_args = array(
              'post_type' => 'page',
              'post__in' => $buildora_architect_about_page,
              'orderby' => 'post__in'
            );
            $buildora_architect_query = new WP_Query( $buildora_architect_args );
            if ( $buildora_architect_query->have_posts() ) :
              while ( $buildora_architect_query->have_posts() ) : $buildora_architect_query->the_post(); ?>
                  <?php if( get_theme_mod('buildora_architect_about_tittle') != ''){ ?>
                    <div class="small-top-abt mb-2"><i class="fa-solid fa-house me-2"></i><h2 class="text-uppercase"><?php echo esc_html(get_theme_mod('buildora_architect_about_tittle','')); ?></h2></div>
                  <?php }?>
                  <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                  <p class="mb-3 abt-first-content"><?php echo esc_html(wp_trim_words(get_the_content(), 40)); ?></p>
                  <span class="abt-btn mb-3"><a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','buildora-architect'); ?><i class="fas fa-chevron-right ms-2"></i></a>
                  </span>
              <?php endwhile; ?>
            <?php else : ?>
              <div class="no-postfound"></div>
            <?php endif;
          endif;
          wp_reset_postdata()?>
        </div>
      </div>
      <div class="col-lg-4 col-md-4 pe-md-0 align-self-center">
        <?php 
        $buildora_architect_about_middle_page = array();
        $buildora_architect_mod = absint( get_theme_mod( 'buildora_architect_about_middle_page' ) );
        if ( 'page-none-selected' != $buildora_architect_mod ) {
          $buildora_architect_about_middle_page[] = $buildora_architect_mod;
        }
        if( !empty($buildora_architect_about_middle_page) ) :
          $buildora_architect_args = array(
            'post_type' => 'page',
            'post__in' => $buildora_architect_about_middle_page,
            'orderby' => 'post__in'
          );
          $buildora_architect_query = new WP_Query( $buildora_architect_args );
          if ( $buildora_architect_query->have_posts() ) : ?>
            <div class="second-about">
              <?php while ( $buildora_architect_query->have_posts() ) : $buildora_architect_query->the_post(); ?>
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <div class="img-middle">
                  <?php if(has_post_thumbnail()){ ?>
                    <img src="<?php the_post_thumbnail_url('full'); ?>"/>
                  <?php }else { echo '<img src="'.$buildora_architect_static_image1.'">'; } ?>
                  <div class="middle-page-icon">
                    <i class="<?php echo esc_attr(get_theme_mod('buildora_architect_about_middle_icon','fa-solid fa-house')); ?>"></i>
                  </div>
                </div>
                <p class="my-3 abt-sec-content"><?php echo esc_html(wp_trim_words(get_the_content(), 30)); ?></p>
              <?php endwhile; ?>
            </div>
          <?php endif;
          wp_reset_postdata();
        endif; ?>
      </div>
      <div class="col-lg-3 col-md-4 px-md-0">
        <div class="third-about">
          <?php if (
          get_theme_mod('buildora_architect_tab_heading1') != '' ||
          get_theme_mod('buildora_architect_tab_heading2') != '' ||
          get_theme_mod('buildora_architect_tab_heading3') != ''
          ) : ?>
          <div class="main-bottom-box d-flex">
              <?php for ( $buildora_architect_i = 1; $buildora_architect_i <= 3; $buildora_architect_i++ ) : ?>
                  <?php if ( get_theme_mod('buildora_architect_tab_heading' . $buildora_architect_i) != '' ) : ?>
                    <div class="service-box text-center">
                        <?php
                        $buildora_architect_icon = get_theme_mod('buildora_architect_tab_icon' . $buildora_architect_i, 'fa-solid fa-house');
                        $buildora_architect_image = get_theme_mod(
                            'buildora_architect_tab_image' . $buildora_architect_i,
                            get_template_directory_uri() . '/assets/images/abt-small1.png'
                        );
                        ?>
                        <div class="top-icon-img">
                        <span class="service-icon">
                            <i class="<?php echo esc_attr( $buildora_architect_icon ); ?>"></i>
                        </span>
                        <span class="service-image">
                            <img src="<?php echo esc_url( $buildora_architect_image ); ?>" alt="">
                        </span>
                      </div>
                        <?php
                        $buildora_architect_link = get_theme_mod('buildora_architect_tab_link' . $buildora_architect_i);
                        $buildora_architect_heading = get_theme_mod('buildora_architect_tab_heading' . $buildora_architect_i);
                        if ( $buildora_architect_heading != '' ) :
                        ?>
                        <h3 class="service-title">
                            <?php if ( $buildora_architect_link != '' ) : ?>
                                <a href="<?php echo esc_url( $buildora_architect_link ); ?>" title="<?php echo esc_attr( $buildora_architect_heading ); ?>">
                                    <?php echo esc_html( $buildora_architect_heading ); ?>
                                </a>
                            <?php else : ?>
                                <?php echo esc_html( $buildora_architect_heading ); ?>
                            <?php endif; ?>
                        </h3>
                        <?php endif; ?>
                    </div>
                  <?php endif; ?>
              <?php endfor; ?>
          </div>
          <?php endif; ?>
        </div>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
</section>
<?php }?>