<?php 
/**
 * Template part for displaying Choose Us Section
 *
 *@package Business Carter
 */

?>

<?php
    $business_carter_choose_us_section_subtitle    = business_carter_get_option( 'business_carter_choose_us_section_subtitle' );
    $business_carter_choose_us_section_title       = business_carter_get_option( 'business_carter_choose_us_section_title' ); 
    $business_carter_number_of_choose_us_items     = business_carter_get_option( 'business_carter_number_of_choose_us_items' );
    $business_carter_choose_us_btn_label           = business_carter_get_option( 'business_carter_choose_us_btn_label' );
    $business_carter_choose_us_btn_url             = business_carter_get_option( 'business_carter_choose_us_btn_url' );   
?>

<?php if( !empty( $business_carter_choose_us_section_subtitle ) || !empty( $business_carter_choose_us_section_title ) ) : ?>
    <div class="section-header">
        <?php if( !empty( $business_carter_choose_us_section_subtitle ) ) : ?>
            <h3 class="section-subtitle"><?php echo esc_html( $business_carter_choose_us_section_subtitle ); ?></h3>
        <?php endif; ?>

        <?php if( !empty( $business_carter_choose_us_section_title ) ) : ?>
            <h2 class="section-title"><?php echo esc_html( $business_carter_choose_us_section_title ); ?></h2>
        <?php endif; ?>
    </div><!-- .section-header -->
<?php endif; ?>

<div class="col-3 clear">
    <?php for( $i=1; $i<=$business_carter_number_of_choose_us_items; $i++ ) : 
        $business_carter_choose_us_icon[$i]     = business_carter_get_option( 'business_carter_choose_us_icon_'. $i ); 
        $business_carter_choose_us_title[$i]    = business_carter_get_option( 'business_carter_choose_us_title_'. $i ); 
        $business_carter_choose_us_content[$i]  = business_carter_get_option( 'business_carter_choose_us_content_'. $i ); ?>
        
        <article>
            <div class="choose-us-item">
                <?php if( !empty( $business_carter_choose_us_icon[$i] ) ) : ?>
                    <div class="icon-container">
                        <i class="<?php echo esc_attr( $business_carter_choose_us_icon[$i] )?>"></i>
                    </div><!-- .icon-container -->
                <?php endif; ?>

                <?php if( !empty( $business_carter_choose_us_title[$i] ) ) : ?>
                    <header class="entry-header">
                        <h2 class="entry-title"><?php echo esc_html($business_carter_choose_us_title[$i]); ?></h2>
                    </header>
                <?php endif; ?>
            </div><!-- .choose-us-item -->
        </article>
    <?php endfor; ?>
</div><!-- .col-3 -->

<?php if( !empty( $business_carter_choose_us_btn_label ) ): ?>
    <div class="read-more">
        <a href="<?php echo esc_attr( $business_carter_choose_us_btn_url ); ?>" class="btn"><?php echo esc_html( $business_carter_choose_us_btn_label ); ?><i class="fas fa-long-arrow-alt-right"></i></a>
    </div><!-- .read-more -->
<?php endif; ?>