<?php
/**
 * Admin settings page
 * @var $currentTab;
 */

namespace HulkPlugins\Woo\ProductDescriptionInLoop;

defined( 'ABSPATH' ) || exit;

$generalTab = admin_url( 'admin.php?page=hulk_woo_pdil_settings&tab=general' );
$styleTab = admin_url( 'admin.php?page=hulk_woo_pdil_settings&tab=style' );

$queryString = isset( $_SERVER['QUERY_STRING'] ) ? sanitize_text_field( wp_unslash( $_SERVER['QUERY_STRING'] ) ) : '';
if ( str_contains( $queryString, 'tab=style' ) ) {
	$currentTab = 'style';
} else {
	$currentTab = 'general';
}
?>
<div class="wrap">
	<h1 class="hulk-main-heading"><?php echo esc_attr__( 'Product Description on Shop & Archive Pages Settings', 'product-description-in-loop-for-woocommerce' ); ?></h1>
	<div class="nav-tab-wrapper">
		<a
			href="<?php echo esc_url( $generalTab ); ?>"
			class="nav-tab <?php echo $currentTab === 'general' ? 'nav-tab-active' : ''; ?>"
		><?php echo esc_attr__( 'General Settings', 'product-description-in-loop-for-woocommerce' ); ?></a>
		<a
			href="<?php echo esc_url( $styleTab ); ?>"
			class="nav-tab <?php echo $currentTab === 'style' ? 'nav-tab-active' : ''; ?>"
		><?php echo esc_attr__( 'Style Settings', 'product-description-in-loop-for-woocommerce' ); ?></a>
		<a
			href="<?php echo esc_url( DOCUMENTATION ); ?>"
			class="nav-tab" target="_blank"
		><?php echo esc_attr__( 'Documentation', 'product-description-in-loop-for-woocommerce' ); ?></a>
	</div>
	<div id="hulk_woo_pdil_admin_settings"></div>
</div>
