<?php
namespace OxygenApp\Views\Admin\Settings;
if ( ! defined( 'ABSPATH' ) ) exit;

use OxygenApp\Views\BaseView;
use OxygenApp\Views\IView;
use OxygenApp\Utils\OptionUtils;
use OxygenApp\Views\Admin\Settings\General\GeneralSettings;
use OxygenApp\Views\Admin\Settings\Languages\FeLanguages;

class MainSettings extends BaseView implements IView {

    public function render(): void {
        $options_group_slug = OptionUtils::OPTION_GROUP_SLUG;
        ?>
        <form method="post" action="options.php">
            <?php settings_fields($options_group_slug); ?>
            <div class="container-fluid mt-4">
                <ul class="nav main-nav-tabs nav-tabs" id="settingsTab" role="tablist">
                    <li class="nav-item" role="presentation">
                        <button class="nav-link active" id="general" data-bs-toggle="tab" data-bs-target="#general-pane" type="button" role="tab" aria-controls="general-pane" aria-selected="true"><?php esc_html_e('General', 'oxyleaf-app-working-and-relaxing-app') ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="languages-tab" data-bs-toggle="tab" data-bs-target="#languages-pane" type="button" role="tab" aria-controls="languages-tab-pane" aria-selected="false"><?php esc_html_e('Languages', 'oxyleaf-app-working-and-relaxing-app') ?></button>
                    </li>
                </ul>

                <div class="tab-content px-3 py-4" id="settingsTabContent">
                    <div class="tab-pane fade show active" id="general-pane" role="tabpanel" aria-labelledby="general" tabindex="0">
                        <?php (new GeneralSettings())->render() ?>
                    </div>
                    <div class="tab-pane fade show" id="languages-pane" role="tabpanel" aria-labelledby="languages" tabindex="1">
                        <?php (new FeLanguages())->render() ?>
                    </div>
                </div>
            </div>
        </form>
        <?php
    }
}