<?php

use Sipago\WooCommerce\SipagoCheckout\Helpers\HealthCheckSipagoFactory;

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

function tbk_is_nav_active($tab, $val)
{
    if ($tab === $val) {
        echo 'active';
    }
}
?>
<div class="wrap tbk-wrap">
    <h3><?php _e('Sipago', 'woocommerce'); ?></h3>
    <p><?php _e('Sipago es la empresa líder en negocios de medio de pago en Argentina.'); ?></p>

    <div class="tbk-container">
        <div class="tbk-nav-container">
            <div class="tbk-nav">
                <div class="nav-title">Configuración</div>
                <ul>
                    <li class="<?php tbk_is_nav_active($tab, 'options'); ?>"><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=checkout&section=sipago_pay&tbk_tab=options') ?>">
                            Sipago <i class="icon fa fa-arrow-right"></i>
                        </a></li>
               
                    <li class="<?php tbk_is_nav_active($tab, 'transactions'); ?>"><a href="<?php echo admin_url('admin.php?page=sipago_pay&tbk_tab=transactions') ?>">
                            Transacciones <i class="icon fa fa-arrow-right"></i>
                        </a></li>
                    <li class="<?php tbk_is_nav_active($tab, 'healthcheck'); ?>"><a href="<?php echo admin_url('admin.php?page=sipago_pay&tbk_tab=healthcheck') ?>">
                            Diagnóstico <i class="icon fa fa-arrow-right"></i>
                        </a></li>
                    <li class="<?php tbk_is_nav_active($tab, 'logs'); ?>"><a href="<?php echo admin_url('admin.php?page=sipago_pay&tbk_tab=logs') ?>">
                            Registros (logs) <i class="icon fa fa-arrow-right"></i>
                        </a></li>
                    <li class="<?php tbk_is_nav_active($tab, 'phpinfo'); ?>"><a href="<?php echo admin_url('admin.php?page=sipago_pay&tbk_tab=phpinfo') ?>">
                            PHP Info <i class="icon fa fa-arrow-right"></i>
                        </a></li>
                </ul>
            </div>
        </div>
        <div class="tbk-content">
            <?php
            if ($tab === 'options') {
                include __DIR__.'/admin-options.php';
            }  elseif ($tab === 'logs') {
                include __DIR__.'/logs.php';
            } elseif ($tab === 'phpinfo') {
                $healthcheck = HealthCheckSipagoFactory::create();
                $datos_hc = json_decode($healthcheck->printFullResume());
                include __DIR__.'/phpinfo.php';
            } elseif ($tab === 'transactions') {
                include __DIR__.'/transactions.php';
            } else {
                $healthcheck = HealthCheckSipagoFactory::create();
                $datos_hc = json_decode($healthcheck->printFullResume());
                include __DIR__.'/healthcheck.php';
            }
            ?>
        </div>
    </div>




</div>
