<?php 
if (!defined('ABSPATH')) {

    exit(); // Exit if accessed directly.
}

global $ffl_dealers_obj, $ffl_dealers_notices;


$active_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'general';

$tabs = apply_filters('ffl_menu_settings_tabs', array());


?>

<header>
    <div class="header-container bg-white">
        <h2><?php _e('Settings', 'ffl-dealers'); ?></h2>
    </div>
	<?php
	if( $ffl_dealers_notices ) {
		$tmr_error_text = esc_html__( 'settings has been updated. !', 'ffl-dealers' );
		$ffl_dealers_obj->plugin_admin_notice( $tmr_error_text, 'success' );
	}
	?>
</header>

<div class="wrap">
    <?php do_action('ffl_dealers_settings_page_notice'); ?>
    <nav class="nav-tab-wrapper">
        <?php
        if (is_array($tabs) && !empty($tabs)) {
            foreach ($tabs as $tab_key => $tab) {
                $tab_classes = 'wps-link ';
                if (!empty($active_tab) && $active_tab === $tab_key) {
                    $tab_classes .= 'nav-tab-active';
                }
                ?>
                <a id="<?php echo esc_attr($tab_key); ?>" href="<?php echo esc_url(admin_url('admin.php?page=ffl-settings') . '&tab=' . esc_attr($tab_key)); ?>" class="nav-tab <?php echo $tab_classes; ?>"><?php echo esc_html($tab); ?></a>
                <?php
            }
        }
		
        ?>
    </nav>

    <div class="tab-content">
        <?php 
		do_action('save_notice_message');
		
		
        do_action('ffl_dealer_before_settings_form');
        // if submenu is directly clicked.
        if ($active_tab == '' || $active_tab == 'general') {
            $active_tab = 'general';
        }
        
		if (!enduwetcszshyxkmeeokgfngvvjpe() && $_GET['page'] == 'ffl-dealers') {
			$file_path = FFL_DEALERS_PATH . 'admin/partials/ffl-dealers-activate-form.php';
		}else{
			$file_path = FFL_DEALERS_PATH . 'admin/partials/ffl-dealers-settings-form.php';
		}
		$ffl_dealers_obj->load_plugin_template($file_path);
        do_action('ffl_dealer_after_settings_form');
        ?>
    </div>

</div>