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

use ShopyPress\Views\Admin\Settings\BaseView;
use ShopyPress\Views\Admin\Settings\IView;
use ShopyPress\Utils\OptionUtils;
use ShopyPress\Views\Admin\Settings\ProductSync;
use ShopyPress\Views\Admin\Settings\Settings;
use ShopyPress\Views\Admin\Settings\Collections;
use ShopyPress\Views\Admin\Settings\Shortcodes;

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="settings-tab" data-bs-toggle="tab" data-bs-target="#settings-pane" type="button" role="tab" aria-controls="settings-tab-pane" aria-selected="true"><?php esc_html_e('Settings', 'synckube-products-sync-for-shopify') ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="collections-tab" data-bs-toggle="tab" data-bs-target="#collections-pane" type="button" role="tab" aria-controls="collections-pane" aria-selected="false"><?php esc_html_e('Collections', 'synckube-products-sync-for-shopify') ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="sync-tab" data-bs-toggle="tab" data-bs-target="#sync-pane" type="button" role="tab" aria-controls="sync-pane" aria-selected="false"><?php esc_html_e('Product sync', 'synckube-products-sync-for-shopify') ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="shortcodes-tab" data-bs-toggle="tab" data-bs-target="#shortcodes-pane" type="button" role="tab" aria-controls="shortcodes-pane" aria-selected="false"><?php esc_html_e('Shortcodes', 'synckube-products-sync-for-shopify') ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="docs-tab" data-bs-toggle="tab" data-bs-target="#docs-pane" type="button" role="tab" aria-controls="docs-pane" aria-selected="false"><?php esc_html_e('Documentation', 'synckube-products-sync-for-shopify') ?></button>
                    </li>
                </ul>

                <div class="tab-content px-3 py-4" id="settingsTabContent">
                    <div class="tab-pane fade show active" id="settings-pane" role="tabpanel" aria-labelledby="settings-tab" tabindex="0">
                        <?php (new Settings())->render() ?>
                    </div>
                    <div class="tab-pane fade" id="collections-pane" role="tabpanel" aria-labelledby="collections-tab" tabindex="1">
                        <?php (new Collections())->render() ?>
                    </div>
                    <div class="tab-pane fade" id="sync-pane" role="tabpanel" aria-labelledby="sync-tab" tabindex="2">
                        <?php (new ProductSync())->render() ?>
                    </div>
                    <div class="tab-pane fade" id="shortcodes-pane" role="tabpanel" aria-labelledby="shortcodes-tab" tabindex="2">
                        <?php (new Shortcodes())->render() ?>
                    </div>
                    <div class="tab-pane fade" id="docs-pane" role="tabpanel" aria-labelledby="docs-tab" tabindex="2">
                        <div class="row">
                        <div class="col-md-12 mb-2">
                            <h5><?php esc_html_e('Documentation', 'synckube-products-sync-for-shopify'); ?></h5>
                            <div class="alert alert-info" role="alert">
                                <span><?php esc_html_e("Full documentation can be found at", 'synckube-products-sync-for-shopify') ?> <a href="https://sakuraleaf.com/showcase/shopypress/documentation/" target="_blank"><?php esc_html_e("SyncKube Docs", 'synckube-products-sync-for-shopify') ?></a></span>.
                                <span><?php esc_html_e("Pro version can be found at", 'synckube-products-sync-for-shopify') ?> <a href="https://sakuraleaf.com/products/synckube-products-sync-for-shopify/" target="_blank"><?php esc_html_e("SyncKube Pro", 'synckube-products-sync-for-shopify') ?></a></span>. 
                                <span><?php esc_html_e("Demo can be found at", 'synckube-products-sync-for-shopify') ?> <a href="https://sakuraleaf.com/showcase/shopypress/" target="_blank"><?php esc_html_e("SyncKube Showcase", 'synckube-products-sync-for-shopify') ?></a></span>.
                            </div>
                        </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        
        <?php
    }
}