<?php
/**
 * Contact section
 *
 * This is the template for the content of contact section
 *
 * @package Theme Palace
 * @subpackage Raise Charity Pro
 * @since Raise Charity Pro 1.0.0
 */
if ( ! function_exists( 'raise_charity_pro_add_contact_section' ) ) :
    /**
    * Add contact section
    *
    *@since Raise Charity Pro 1.0.0
    */
    function raise_charity_pro_add_contact_section() {
        $options = raise_charity_pro_get_theme_options();

        // Check if contact is enabled on frontpage
        $contact_enable = apply_filters( 'raise_charity_pro_section_status', true, 'contact_section_enable' );


        if ( true !== $contact_enable ) {
           return false;
        }

        // Render contact section now.
        raise_charity_pro_render_contact_section();
    }
endif;

if ( ! function_exists( 'raise_charity_pro_render_contact_section' ) ) :
  /**
   * Start contact section
   *
   * @return string contact content
   * @since Raise Charity Pro 1.0.0
   *
   */
   function raise_charity_pro_render_contact_section() {
        
        $options = raise_charity_pro_get_theme_options();

        $contact_title = !empty( $options['contact_title'] ) ? $options['contact_title'] : '';
        $contact_sub_title = !empty( $options['contact_sub_title'] ) ? $options['contact_sub_title'] : '';
        $contact_image = !empty( $options['contact_image'] ) ? $options['contact_image'] : '';

        ?>
        <div id="raise_charity_pro_contact_section">
           <div id="contact-section" class="relative page-section" style="background-image: url('<?php echo esc_url( $contact_image ); ?>');">
                <div class="overlay"></div>
                <div class="wrapper">
                <?php if ( is_customize_preview()):
                    raise_charity_pro_section_tooltip( 'contact-section' );
                endif; ?>
                    <div class="section-header">
                    <?php if( !empty( $contact_title ) ): ?>
                        <h2 class="section-title"><?php echo esc_html( $contact_title ); ?></h2>
                    <?php endif;
                        if( !empty( $contact_sub_title ) ):
                     ?>
                        <p class="section-subtitle"><?php echo esc_html( $contact_sub_title ); ?></p>
                    <?php endif; ?>
                    </div><!-- .section-header -->


                    <div class="section-content <?php echo ($options['home_layout'] == 'seventh-design') ? 'col-2' : 'col-1'; ?>">
                        <?php if($options['home_layout'] == 'seventh-design'): ?>
                            <article>
                                <div class="contact-information">
                                    <ul>
                                        <li>
                                            <i class="fa fa-phone"></i>
                                            <span><?php _e( 'Phone Number:', 'raise-charity-pro' ); ?></span>
                                            <p id="number"><?php echo esc_html($options['contact_section_phoneNumber']); ?></p>
                                        </li>
                                        <li>
                                            <i class="fa fa-envelope"></i>
                                            <span><?php _e( 'Email:', 'raise-charity-pro' ); ?></span>
                                            <p id="email"><?php echo esc_html($options['contact_section_email']); ?></p>
                                        </li>
                                        <li>
                                            <i class="fa fa-map-marker"></i>
                                            <span><?php _e( 'Location:', 'raise-charity-pro' ); ?></span>
                                            <p id="address"><?php echo esc_html($options['contact_section_address']); ?></p>
                                        </li>
                                    </ul>
                                    <?php if(!empty( $options[ 'contact_map_shortcode'] ) ) : ?>
                                        <div id="map">
                                            <?php echo do_shortcode(  $options[ 'contact_map_shortcode'] ); ?>
                                        </div>
                                    <?php endif; ?>
                                </div><!-- .contact-information -->
                            </article>
                        <?php endif; ?>
                        <article>
                            <?php if( class_exists('WPCF7') && !empty( $options['contact_form_shortcode'] )) echo do_shortcode( $options['contact_form_shortcode'] ); ?>
                        </article>
                    </div><!-- .section-content -->

                </div><!-- .wrapper -->
            </div><!-- #contact-section -->
        </div>
      

    <?php }
endif;
