<?php

// Disable direct call
if ( ! defined( 'ABSPATH' ) ) { exit; }


/* Theme setup section
-------------------------------------------------------------------- */

if ( !function_exists( 'seohub_template_form_2_theme_setup' ) ) {
	add_action( 'seohub_action_before_init_theme', 'seohub_template_form_2_theme_setup', 1 );
	function seohub_template_form_2_theme_setup() {
		seohub_add_template(array(
			'layout' => 'form_2',
			'mode'   => 'forms',
			'title'  => esc_html__('Contact Form 2', 'seohub')
			));
	}
}

// Template output
if ( !function_exists( 'seohub_template_form_2_output' ) ) {
	function seohub_template_form_2_output($post_options, $post_data) {
		global $SEOHUB_GLOBALS;
		$address_1 = seohub_get_theme_option('contact_address_1');
		$address_2 = seohub_get_theme_option('contact_address_2');
		$phone = seohub_get_theme_option('contact_phone');
		$fax = seohub_get_theme_option('contact_fax');
		$email = seohub_get_theme_option('contact_email');
		$open_hours = seohub_get_theme_option('contact_open_hours');
		?>
		<div class="sc_columns columns_wrap">
			<div class="sc_form_fields column-2_3">
				<form <?php echo ($post_options['id'] ? ' id="'.esc_attr($post_options['id']).'"' : ''); ?> data-formtype="<?php echo esc_attr($post_options['layout']); ?>" method="post" action="<?php echo esc_url($post_options['action'] ? $post_options['action'] : $SEOHUB_GLOBALS['ajax_url']); ?>">
					<div class="sc_form_info">
						<div class="sc_form_item sc_form_field label_over"><label class="required" for="sc_form_username"><?php esc_html_e('Name', 'seohub'); ?></label><input id="sc_form_username" type="text" name="username" placeholder="<?php esc_attr_e('Name *', 'seohub'); ?>"></div>
						<div class="sc_form_item sc_form_field label_over"><label class="required" for="sc_form_email"><?php esc_html_e('E-mail', 'seohub'); ?></label><input id="sc_form_email" type="text" name="email" placeholder="<?php esc_attr_e('E-mail *', 'seohub'); ?>"></div>
						<div class="sc_form_item sc_form_field label_over"><label class="required" for="sc_form_subj"><?php esc_html_e('Subject', 'seohub'); ?></label><input id="sc_form_subj" type="text" name="subject" placeholder="<?php esc_attr_e('Subject', 'seohub'); ?>"></div>
					</div>
					<div class="sc_form_item sc_form_message label_over"><label class="required" for="sc_form_message"><?php esc_html_e('Message', 'seohub'); ?></label><textarea id="sc_form_message" name="message" placeholder="<?php esc_attr_e('Message', 'seohub'); ?>"></textarea></div>
					<div class="sc_form_item sc_form_button"><button><?php esc_html_e('Send', 'seohub'); ?></button></div>
					<div class="result sc_infobox"></div>
				</form>
			</div><div class="sc_form_address column-1_3">
                <h1 class="sc_form_address_title"><?php esc_html_e('Address', 'seohub'); ?></h1>
                <div class="sc_form_address_field">
                    <span class="sc_form_address_label"><?php esc_html_e('Address', 'seohub'); ?></span>
                    <span class="sc_form_address_data"><?php echo trim($address_1) . (!empty($address_1) && !empty($address_2) ? ', ' : '') . $address_2; ?></span>
                </div>
                <div class="sc_form_address_field">
                    <span class="sc_form_address_label"><?php esc_html_e('Phone number', 'seohub'); ?></span>
                    <span class="sc_form_address_data"><?php echo trim($phone) . (!empty($phone) && !empty($fax) ? ', ' : '') . $fax; ?></span>
                </div>
                <div class="sc_form_address_field">
                    <span class="sc_form_address_label"><?php esc_html_e('We are open', 'seohub'); ?></span>
                    <span class="sc_form_address_data"><?php echo trim($open_hours); ?></span>
                </div>
            </div>
		</div>
		<?php
	}
}
?>