<?php 
/**
 * This file is used to markup the plugin settings.
 *
 * @since      1.0
 *
 * @package    SiteEase_Smart_Product_Filtering_Engine
 * @subpackage SiteEase_Smart_Product_Filtering_Engine/admin/partials
 */

// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
global $ifqpf_settings;
$ifqpf_settings = get_option(IFQPF_PREFIX.'_settings');
$default_tab = '';
?>
<div class="wrap">

	<h1><?php echo esc_html__('SiteEase Smart AJAX Product Filter Settings', 'siteease-smart-product-filtering-engine'); ?></h1>

	<?php ifqpf_settings_notice(); ?>

	<form method="post" id="ifqpf-settings">

		<div class="ifqpf-tab-wrap">
			<ul class="ifqpf-tabs-nav">
				<?php foreach ($ifqpf_tabs as $tab_key => $tab) { ?>
					<?php
					if( isset( $tab['default'] ) && $tab['default'] === true ){
						$default_tab = $tab_key;
					}

					$tab_li_class = ( isset( $tab['default'] ) && $tab['default'] === true ) ? sprintf("ifqpf-tab-active-li ifqpf-tab-%s", $tab['id']) : sprintf("ifqpf-tab-%s", $tab['id']);
					?>
			        <li class="ifqpf-tab <?php echo esc_attr($tab_li_class); ?>">
			        	<a href="javascript:void(0);" data-tag="<?php echo esc_attr($tab['id']); ?>" class="ifqpf-tab-btn"><?php echo esc_html($tab['label']); ?></a>
			        </li>
			    <?php } ?>
		    </ul>    
		    <div style="clear: both;"></div>    
		    <div class="ifqpf-tab-container">
		    	<?php foreach ($ifqpf_tabs as $tab_key => $tab) { ?>
					<?php
					$tab_content_class = ( isset( $tab['default'] ) && $tab['default'] === true ) ? sprintf("ifqpf-tab-active-ifqpf-tab-content ifqpf-tab-%s", $tab['id']) : sprintf("ifqpf-tab-content-hide ifqpf-tab-%s", $tab['id']);
					?>
					<div class="ifqpf-tab-content <?php echo esc_attr($tab_content_class); ?>" id="<?php echo esc_attr($tab['id']); ?>">					
						<?php if( isset( $tab['heading'] ) && !empty( $tab['heading'] ) ) { ?>
							<h2><?php echo esc_html($tab['heading']); ?></h2>
						<?php } ?>
						<?php call_user_func($tab['callback']); ?>				
					</div>
			    <?php } ?>
		    </div> 
		</div> 
		<?php $quick_save_changes_val = 'Save Changes'; ?>
		<input type="hidden" name="ifqpf_currnet_tab" id="ifqpf_currnet_tab" value="<?php echo esc_attr($default_tab);?>">
		<?php wp_nonce_field('ifqpf_action_nonce', 'ifqpf_nonce');?>
		<div class="submit">
			<button name="ifqpf_save_settings" class="button-primary ifqpf-save-button" type="submit" value="<?php echo esc_attr($quick_save_changes_val); ?>"><?php echo esc_html__('Apply Changes', 'siteease-smart-product-filtering-engine'); ?></button>
		</div>
	</form>
</div>