<?php
/**
 * Settings UI for PromoTimeWidget module.
 *
 * Renders the settings form for this module using the WordPress Settings API.
 *
 * @package Ilabs\Firevert\Modules\PromoTimeWidget\resources\views
 *
 * @var string $section
 * @var array $data
 * @var string $base_url
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Ilabs\Firevert\Modules\PromoTimeWidget\Services\Type\SectionType;
?>

<div class="wrap firevert-settings-page">
	<h2 class='nav-tab-wrapper'>
		<?php foreach ( SectionType::get_all() as $slug => $label ) : ?>
			<?php $is_active = $slug === $section ? 'nav-tab-active' : ''; ?>
			<a href="<?php echo esc_url( $base_url . '&section=' . $slug ); ?>"
				class="nav-tab <?php echo esc_attr( $is_active ); ?>">
				<?php echo esc_html( $label ); ?>
			</a>
		<?php endforeach; ?>
	</h2>

	<div class='panel-wrap'>
		<?php
			$view_path = sprintf( 'tabs/meta-%s.view.php', $section );
			firevert_module_view( 'PromoTimeWidget', $view_path, $data );
		?>
	</div>
</div>
