<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/datatables") ?>
<?= $this->extend('themes/backend/vuexy/main/general_settings_layout') ?>

<?= $this->section('content'); ?>
<!--Content Body-->
<div class="row mt-4">

    <!-- Navigation -->
    <div class="col-lg-3 col-md-4 col-12 mb-md-0 mb-3">
        <div class="d-flex justify-content-between flex-column mb-2 mb-md-0">
            <ul class="nav nav-align-left nav-pills flex-column">
                <li class="nav-item">
                    <button class="nav-link active" data-bs-toggle="tab" data-bs-target="#general">
                        <i class="ti ti-sitemap me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_general")?></span>
                    </button>
                </li>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#email">
                        <i class="ti ti-mail me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_email")?></span>
                    </button>
                </li>
                <?php /* ?>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#robots">
                        <i class="ti ti-robot me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_captcha")?></span>
                    </button>
                </li>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#auth">
                        <i class="ti ti-lock me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_auth")?></span>
                    </button>
                </li>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#storage">
                        <i class="ti ti-device-floppy me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_storage")?></span>
                    </button>
                </li>
                <?php */ ?>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#backup">
                        <i class="ti ti-server me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_backup")?></span>
                    </button>
                </li>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#register">
                        <i class="ti ti-user me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_register")?></span>
                    </button>
                </li>
                <?php /* ?>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#notification">
                        <i class="ti ti-bell me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_notification")?></span>
                    </button>
                </li>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#api">
                        <i class="ti ti-link me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_api")?></span>
                    </button>
                </li>
                <?php */ ?>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#logs">
                        <i class="ti ti-archive me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_logs")?></span>
                    </button>
                </li>
                <li class="nav-item">
                    <button class="nav-link" data-bs-toggle="tab" data-bs-target="#cron">
                        <i class="ti ti-rotate-clockwise me-1 ti-sm"></i>
                        <span class="align-middle fw-semibold"><?=lang("App.settings_label_cron")?></span>
                    </button>
                </li>
            </ul>
        </div>
    </div>
    <!-- /Navigation -->

    <!-- System Settings -->
    <div class="col-lg-9 col-md-8 col-12">
        <form class="form" action="<?=site_url("settings/store")?>" method="post">
            <?= csrf_field() ?>
            <div class="tab-content py-0">
                <!-- General Settings -->
                <div class="tab-pane fade show active" id="general" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-sitemap ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_general_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="col-lg-12 mb-3">
                                <label class="form-label text-primary"><?=lang("App.settings_label_general_subtitle_1")?></label>
                            </div>
                            <div class="col-lg-12 mb-3">
                                <label for="title" class="form-label"><?=lang("App.settings_field_title")?></label>
                                <input
                                        type="text"
                                        id="title"
                                        name="title"
                                        class="form-control"
                                        placeholder=<?=lang("App.settings_field_title_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['title'] : set_value('title');?>"
                                />
                            </div>
                            <?php /*
                            <div class="col-lg-3 mb-3">
                                <label for="activate_frontend" class="form-label"><?=lang("App.settings_field_frontend")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['activate_frontend'] : set_value('activate_frontend');?>
                                <select name="activate_frontend" id="activate_frontend" class="select2 form-control">
                                    <option value="0" <?= $id_select == "0" ? 'selected' : '' ?>><?=lang("App.notification_grid_no")?></option>
                                    <option value="1" <?= $id_select == "1" ? 'selected' : '' ?>><?=lang("App.notification_grid_yes")?></option>
                                </select>
                            </div>
                            */ ?>
                            <div class="col-lg-6 mb-3">
                                <label class="form-label"><?=lang("App.settings_field_seo_description")?></label>
                                <textarea
                                        class="form-control"
                                        id="seo_description"
                                        name="seo_description"
                                        rows="3"><?= (isset($obj)) ? $obj['seo_description'] : set_value('seo_description');?>
                                </textarea>
                            </div>
                            <div class="col-lg-6 mb-3">
                                <div class="form-group">
                                    <label for="seo_keywords" class="form-label"><?=lang("App.settings_field_seo_keywords")?></label>
                                    <textarea
                                            class="form-control"
                                            id="seo_keywords"
                                            name="seo_keywords"
                                            rows="3"><?= (isset($obj)) ? $obj['seo_keywords'] : set_value('seo_keywords');?>
                                    </textarea>
                                </div>
                            </div>

                            <div class="col-lg-12 mb-3">
                                <label class="form-label text-primary"><?=lang("App.settings_label_general_subtitle_2")?></label>
                            </div>

                            <div class="col-lg-3 mb-3">
                                <label for="default_language" class="form-label"><?=lang("App.settings_field_default_language")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_language'] : set_value('default_language');?>
                                <select name="default_language" id="default_language" class="select2 form-control">
                                    <option value="en" <?= $id_select == "en" ? 'selected' : '' ?>><?=lang("App.lang_en")?></option>
                                    <option value="es" <?= $id_select == "es" ? 'selected' : '' ?>><?=lang("App.lang_es")?></option>
                                    <option value="pt" <?= $id_select == "pt" ? 'selected' : '' ?>><?=lang("App.lang_pt")?></option>
                                </select>
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="default_role" class="form-label"><?=lang("App.settings_field_default_role")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_role'] : set_value('default_role');?>
                                <select name="default_role" id="default_role" class="select2 form-control">
                                    <?php foreach($group??[] as $item): ?>
                                        <option value="<?=$item->token?>" <?= $id_select == $item->token ? 'selected' : '' ?>><?=$item->title?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="default_date_format" class="form-label"><?=lang("App.settings_field_default_date_format")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_date_format'] : set_value('default_date_format');?>
                                <select name="default_date_format" id="default_date_format" class="select2 form-control">
                                    <option value="Y-m-d" <?= $id_select == "Y-m-d" ? 'selected' : '' ?>>Y-m-d</option>
                                    <option value="d-m-Y" <?= $id_select == "d-m-Y" ? 'selected' : '' ?>>d-m-Y</option>
                                    <option value="d/m/Y" <?= $id_select == "d/m/Y" ? 'selected' : '' ?>>d/m/Y</option>
                                    <option value="m-d-Y" <?= $id_select == "m-d-Y" ? 'selected' : '' ?>>m-d-Y</option>
                                    <option value="m/d/Y" <?= $id_select == "m/d/Y" ? 'selected' : '' ?>>m/d/Y</option>
                                </select>
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="default_hour_format" class="form-label"><?=lang("App.settings_field_default_hour_format")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_hour_format'] : set_value('default_hour_format');?>
                                <select name="default_hour_format" id="default_hour_format" class="select2 form-control">
                                    <option value="24" <?= $id_select == "24" ? 'selected' : '' ?>>24h</option>
                                    <option value="12" <?= $id_select == "12" ? 'selected' : '' ?>>12h</option>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="default_timezone" class="form-label"><?=lang("App.settings_field_default_timezone")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_timezone'] : set_value('default_timezone');?>
                                <select name="default_timezone" id="default_timezone" class="select2 form-control">
                                    <?php foreach($timezone??[] as $item): ?>
                                        <option value="<?=$item['timezone']?>" <?= $id_select == $item['timezone'] ? 'selected' : '' ?>><?=$item['description']?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="default_currency" class="form-label"><?=lang("App.settings_field_default_currency")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_currency'] : set_value('default_currency');?>
                                <select name="default_currency" id="default_currency" class="select2 form-control">
                                    <?php foreach($currency??[] as $item): ?>
                                        <option value="<?=$item['code']?>" <?= $id_select == $item['code'] ? 'selected' : '' ?>><?=$item['code']?> - <?=$item['name']?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="default_currency_separation" class="form-label"><?=lang("App.settings_field_default_currency_separation")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_currency_separation'] : set_value('default_currency_separation');?>
                                <select name="default_currency_separation" id="default_currency_separation" class="select2 form-control">
                                    <option value="dot" <?= $id_select == "dot" ? 'selected' : '' ?>><?=lang("App.settings_field_default_currency_separation_dot")?></option>
                                    <option value="comma" <?= $id_select == "comma" ? 'selected' : '' ?>><?=lang("App.settings_field_default_currency_separation_coma")?></option>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="default_currency_position" class="form-label"><?=lang("App.settings_field_default_currency_position")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_currency_position'] : set_value('default_currency_position');?>
                                <select name="default_currency_position" id="default_currency_position" class="select2 form-control">
                                    <option value="left" <?= $id_select == "left" ? 'selected' : '' ?>><?=lang("App.settings_field_default_currency_position_left")?></option>
                                    <option value="right" <?= $id_select == "right" ? 'selected' : '' ?>><?=lang("App.settings_field_default_currency_position_right")?></option>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="default_country" class="form-label"><?=lang("App.settings_field_default_country")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_country'] : set_value('default_country');?>
                                <select name="default_country" id="default_country" class="select2 form-control">
                                    <?php foreach($countries??[] as $item): ?>
                                        <option value="<?=$item['code']?>" <?= $id_select == $item['code'] ? 'selected' : '' ?>><?=$item['name']?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="default_theme" class="form-label"><?=lang("App.settings_field_default_theme")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['default_theme'] : set_value('default_theme');?>
                                <select name="default_theme" id="default_theme" class="select2 form-control">
                                    <?php foreach($theme??[] as $item): ?>
                                        <?php if ($item['type'] == "backend") : ?>
                                            <option value="<?=$item['id_theme']?>" <?= $id_select == $item['id_theme'] ? 'selected' : '' ?>><?=$item['name']?></option>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <?php /*
                            <div class="col-lg-3 mb-3">
                                <label for="default_theme_front" class="form-label"><?=lang("App.settings_field_default_theme_front")?></label>
                                <select name="default_theme_front" id="default_theme_front" class="select2 form-control">
                                    <?php foreach($theme??[] as $item): ?>
                                        <?php if ($item['type'] == "frontend") : ?>
                                            <option value="<?=$item['id_theme']?>" <?= $id_select == $item['id_theme'] ? 'selected' : '' ?>><?=$item['name']?></option>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            */ ?>
                        </div>
                    </div>
                </div>
                <!-- /General Settings -->
                <!-- Email Settings -->
                <div class="tab-pane fade show" id="email" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-mail ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_email_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="col-lg-12 mb-3">
                                <label class="text-primary"><?=lang("App.settings_label_email_subtitle_1")?></label>
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="email_gateway" class="form-label"><?=lang("App.settings_field_email_gateway")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['email_gateway'] : set_value('email_gateway');?>
                                <select name="email_gateway" id="email_gateway" class="select2 form-control">
                                    <option value="smtp" <?= $id_select == "smtp" ? 'selected' : '' ?>><?=lang("App.settings_field_email_gateway_smtp")?></option>
                                </select>
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="email_smtp" class="form-label"><?=lang("App.settings_field_email_smtp")?></label>
                                <input
                                        type="text"
                                        id="email_smtp"
                                        name="email_smtp"
                                        class="form-control"
                                        placeholder="<?=lang("App.settings_field_email_smtp_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['email_smtp'] : set_value('email_smtp');?>"
                                >
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="email_port" class="form-label"><?=lang("App.settings_field_email_port")?></label>
                                <input
                                        type="number"
                                        id="email_port"
                                        name="email_port"
                                        class="form-control"
                                        placeholder="<?=lang("App.settings_field_email_port_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['email_port'] : set_value('email_port');?>"
                                >
                            </div>
                            <div class="col-lg-3 mb-3">
                                <label for="email_cert" class="form-label"><?=lang("App.settings_field_email_cert")?></label>
                                <?php $id_select = (isset($obj)) ? $obj['email_cert'] : set_value('email_cert');?>
                                <select name="email_cert" id="email_cert" class="select2 form-control">
                                    <option value="none" <?= $id_select == "none" ? 'selected' : '' ?>><?=lang("App.settings_field_email_cert_none")?></option>
                                    <option value="ssl" <?= $id_select == "ssl" ? 'selected' : '' ?>><?=lang("App.settings_field_email_cert_ssl")?></option>
                                    <option value="tls" <?= $id_select == "tls" ? 'selected' : '' ?>><?=lang("App.settings_field_email_cert_tls")?></option>
                                </select>
                            </div>
                            <div class="col-lg-6 mb-3">
                                <label for="email_address" class="form-label"><?=lang("App.settings_field_email_address")?></label>
                                <input
                                        type="text"
                                        id="email_address"
                                        name="email_address"
                                        class="form-control"
                                        placeholder="<?=lang("App.settings_field_email_address_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['email_address'] : set_value('email_address');?>"
                                >
                            </div>
                            <div class="col-lg-6 mb-3">
                                <label for="email_pass" class="form-label"><?=lang("App.settings_field_email_pass")?></label>
                                <input
                                        type="password"
                                        id="email_pass"
                                        name="email_pass"
                                        class="form-control"
                                        placeholder="<?=lang("App.settings_field_email_pass_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['email_pass'] : set_value('email_pass');?>"
                                >
                            </div>

                            <div class="col-lg-6 mb-3">
                                <label for="email_name" class="form-label"><?=lang("App.settings_field_email_name")?></label>
                                <input
                                        type="text"
                                        id="email_name"
                                        name="email_name" class="form-control"
                                        placeholder="<?=lang("App.settings_field_email_name_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['email_name'] : set_value('email_name');?>"
                                >
                            </div>
                            <div class="col-lg-12 mt-4 mb-3">
                                <label class="text-primary"><?=lang("App.settings_field_test_send")?></label>
                            </div>
                            <div class="col-lg-6 mb-3">
                                <label class="form-label"><?=lang("App.settings_field_email_address")?></label>
                                <div class="input-group">
                                    <input
                                            type="email"
                                            id="send_email_test"
                                            name="send_email_test"
                                            class="form-control"
                                            placeholder="<?=lang("App.settings_field_email_address_ph")?>"
                                    >
                                    <div class="input-group-append">
                                        <button type="button" class="btn btn-outline-primary" onclick="send_test()"><?=lang("App.settings_field_test_send_btn")?></button>
                                    </div>
                                </div>
                                <p class="text-primary" id="msg_email_test" style="display: none;"><i class="fas fa-spinner fa-pulse"></i> <?= lang("App.login_wait") ?></p>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Email Settings -->
                <!-- Robot Settings -->
                <div class="tab-pane fade show" id="robots" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-robot ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_captcha_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="col-lg-12 mb-3">
                                <label class="text-primary"><?=lang("App.settings_label_email_subtitle_1")?></label>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label class="form-label">Método</label>
                                <?php $id_select = (isset($obj)) ? $obj['captcha_gateway'] : set_value('captcha_gateway');?>
                                <select name="captcha_gateway" id="captcha_gateway" class="select2 form-control">
                                    <option value="recaptcha" <?= $id_select == "recaptcha" ? 'selected' : '' ?>><?=lang("App.settings_field_captcha_gateway_recaptcha")?></option>
                                    <option value="hcaptcha" <?= $id_select == "hcaptcha" ? 'selected' : '' ?>><?=lang("App.settings_field_captcha_gateway_hcaptcha")?></option>
                                </select>
                            </div>
                            <div class="col-lg-4 mb-3">
                                    <label for="captcha_site_key" class="form-label"><?=lang("App.settings_field_captcha_site_key")?></label>
                                    <input
                                            type="text"
                                            id="captcha_site_key"
                                            name="captcha_site_key"
                                            class="form-control"
                                            placeholder="<?=lang("App.settings_field_captcha_site_key_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['captcha_site_key'] : set_value('captcha_site_key');?>"
                                    >
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label class="form-label"><?=lang("App.settings_field_captcha_secret_key")?></label>
                                <input
                                        type="text"
                                        id="captcha_secret_key"
                                        name="captcha_secret_key"
                                        class="form-control"
                                        placeholder="<?=lang("App.settings_field_captcha_secret_key_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['captcha_secret_key'] : set_value('captcha_secret_key');?>"
                                >
                            </div>
                            <div class="col-lg-12 mt-3 mb-3">
                                <label class="text-primary"><?=lang("App.settings_label_captcha_subtitle_2")?></label>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <div class="small mb-3"><?=lang("App.settings_field_captcha_register")?></div>
                                <label class="switch">
                                    <input
                                            type="checkbox"
                                            id="captcha_register"
                                            name="captcha_register"
                                            class="switch-input"
                                            <?= $obj['captcha_register']??false ? 'checked' : ''?>
                                    />
                                    <span class="switch-toggle-slider">
                                        <span class="switch-on"></span>
                                        <span class="switch-off"></span>
                                    </span>
                                    <span class="switch-label"><?=lang("App.global_activate")?></span>
                                </label>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <div class="small mb-3"><?=lang("App.settings_field_captcha_login")?></div>
                                <label class="switch">
                                    <input
                                            type="checkbox"
                                            id="captcha_login"
                                            name="captcha_login"
                                            class="switch-input"
                                        <?= $obj['captcha_login']??false ? 'checked' : ''?>
                                    />
                                    <span class="switch-toggle-slider">
                                        <span class="switch-on"></span>
                                        <span class="switch-off"></span>
                                    </span>
                                    <span class="switch-label"><?=lang("App.global_activate")?></span>
                               </label>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <div class="small mb-3"><?=lang("App.settings_field_captcha_recovery")?></div>
                                <label class="switch">
                                    <input
                                            type="checkbox"
                                            id="captcha_recovery"
                                            name="captcha_recovery"
                                            class="switch-input"
                                        <?= $obj['captcha_recovery']??false ? 'checked' : ''?>
                                    />
                                    <span class="switch-toggle-slider">
                                        <span class="switch-on"></span>
                                        <span class="switch-off"></span>
                                    </span>
                                    <span class="switch-label"><?=lang("App.global_activate")?></span>
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Robot Settings -->
                <!-- Auth Settings -->
                <div class="tab-pane fade show" id="auth" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-lock ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_auth_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="col-lg-12 mb-3">
                                <label class="text-primary"><?=lang("App.settings_label_auth_subtitle_1")?></label>
                            </div>
                            <div class="col-lg-12 mb-3">
                                <div class="small mb-3"><?=lang("App.settings_field_two_factor_auth")?></div>
                                <label class="switch">
                                    <input
                                            type="checkbox"
                                            id="two_factor_auth"
                                            name="two_factor_auth"
                                            class="switch-input"
                                        <?= $obj['two_factor_auth']??false ? 'checked' : ''?>
                                    />
                                    <span class="switch-toggle-slider">
                                        <span class="switch-on"></span>
                                        <span class="switch-off"></span>
                                    </span>
                                    <span class="switch-label"><?=lang("App.global_activate")?></span>
                                </label>
                            </div>
                            <div class="col-lg-12 mt-3 mb-3">
                                <label class="text-primary"><?=lang("App.settings_label_auth_subtitle_2")?></label>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <div class="small mb-3"><?=lang("App.settings_field_throttle_auth")?></div>
                                <label class="switch">
                                    <input
                                            type="checkbox"
                                            id="throttle_auth"
                                            name="throttle_auth"
                                            class="switch-input"
                                        <?= $obj['throttle_auth']??false ? 'checked' : ''?>
                                    />
                                    <span class="switch-toggle-slider">
                                        <span class="switch-on"></span>
                                        <span class="switch-off"></span>
                                    </span>
                                    <span class="switch-label"><?=lang("App.global_activate")?></span>
                                </label>
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="throttle_auth_max_attempts" class="form-label"><?=lang("App.settings_field_throttle_auth_max_attempts")?></label>
                                <input
                                        type="number"
                                        id="throttle_auth_max_attempts"
                                        min="1"
                                        name="throttle_auth_max_attempts"
                                        class="form-control"
                                        placeholder="<?=lang("App.settings_field_throttle_auth_max_attempts_ph")?>"
                                        value="<?= (isset($obj)) ? $obj['throttle_auth_max_attempts'] : set_value('throttle_auth_max_attempts');?>"
                                />
                            </div>
                            <div class="col-lg-4 mb-3">
                                <label for="throttle_auth_lockour_time" class="form-label"><?=lang("App.settings_field_throttle_auth_lockour_time")?></label>
                                <div class="input-group">
                                    <input
                                            type="number"
                                            id="throttle_auth_lockour_time"
                                            name="throttle_auth_lockour_time"
                                            class="form-control"
                                            placeholder="<?=lang("App.settings_field_throttle_auth_lockour_time_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['throttle_auth_lockour_time'] : set_value('throttle_auth_lockour_time');?>"
                                    />
                                    <span class="input-group-text"><?=lang("App.global_hours")?></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Auth Settings -->
                <!-- Storage Settings -->
                <div class="tab-pane fade show" id="storage" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-device-floppy ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_storage_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_storage_subtitle_1")?></label>
                                </div>
                                <div class="col-lg-4 mb-3">
                                        <label for="storage_gateway" class="form-label"><?=lang("App.settings_field_storage_gateway")?></label>
                                        <?php $id_select = (isset($obj)) ? $obj['storage_gateway'] : set_value('storage_gateway');?>
                                        <select name="storage_gateway" id="storage_gateway" class="select2 form-control">
                                            <option value="local" <?= $id_select == "local" ? 'selected' : '' ?>><?=lang("App.settings_field_storage_gateway_local")?></option>
                                            <option value="aws" <?= $id_select == "aws" ? 'selected' : '' ?>><?=lang("App.settings_field_storage_gateway_aws")?></option>
                                            <option value="minio" <?= $id_select == "minio" ? 'selected' : '' ?>><?=lang("App.settings_field_storage_gateway_minio")?></option>
                                        </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_storage_subtitle_2")?></label>
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <label for="aws_key" class="form-label"><?=lang("App.settings_field_aws_key")?></label>
                                    <input
                                            type="text"
                                            id="aws_key"
                                            min="1"
                                            name="aws_key"
                                            class="form-control"
                                            placeholder="<?=lang("app.settings_field_aws_key_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['aws_key'] : set_value('aws_key');?>"
                                    />
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <label for="aws_secret" class="form-label"><?=lang("App.settings_field_aws_secret")?></label>
                                    <input
                                            type="text"
                                            id="aws_secret"
                                            min="1"
                                            name="aws_secret"
                                            class="form-control"
                                            placeholder="<?=lang("app.settings_field_aws_secret_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['aws_secret'] : set_value('aws_secret');?>"
                                    />
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <label for="aws_region" class="form-label"><?=lang("App.settings_field_aws_region")?></label>
                                    <input
                                            type="text"
                                            id="aws_region"
                                            min="1"
                                            name="aws_region"
                                            class="form-control"
                                            placeholder="<?=lang("app.settings_field_aws_region_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['aws_region'] : set_value('aws_region');?>"
                                    />
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <label for="aws_bucket" class="form-label"><?=lang("App.settings_field_aws_bucket")?></label>
                                    <input
                                            type="text"
                                            id="aws_bucket"
                                            min="1"
                                            name="aws_bucket"
                                            class="form-control"
                                            placeholder="<?=lang("app.settings_field_aws_bucket_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['aws_bucket'] : set_value('aws_bucket');?>"
                                    />
                                </div>
                                <div class="col-lg-12 mb-3">
                                    <label for="aws_endpoint" class="form-label"><?=lang("App.settings_field_aws_endpoint")?></label>
                                    <input
                                            type="text"
                                            id="aws_endpoint"
                                            min="1"
                                            name="aws_endpoint"
                                            class="form-control"
                                            placeholder="<?=lang("app.settings_field_aws_endpoint_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['aws_endpoint'] : set_value('aws_endpoint');?>"
                                    />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Storage Settings -->
                <!-- Backup Settings -->
                <div class="tab-pane fade show" id="backup" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-server ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_backup_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_backup_subtitle_1")?></label>
                                </div>
                                <div class="col-lg-4 mb-3">
                                    <label for="backup_storage" class="form-label"><?=lang("App.settings_field_backup_storage")?></label>
                                    <?php $id_select = (isset($obj)) ? $obj['backup_storage'] : set_value('backup_storage');?>
                                    <select name="backup_storage" id="backup_storage" class="select2 form-control">
                                        <option value="local" <?= $id_select == "local" ? 'selected' : '' ?>><?=lang("App.settings_field_storage_gateway_local")?></option>
                                        <option value="aws" <?= $id_select == "aws" ? 'selected' : '' ?>><?=lang("App.settings_field_storage_gateway_aws")?></option>
                                        <option value="minio" <?= $id_select == "minio" ? 'selected' : '' ?>><?=lang("App.settings_field_storage_gateway_minio")?></option>
                                    </select>
                                </div>
                                <div class="col-lg-4 mb-3">
                                    <label for="backup_table" class="form-label"><?=lang("App.settings_field_backup_table")?></label>
                                    <?php $select = (isset($obj)) ? $obj['backup_table'] : set_value('backup_table');?>
                                    <select name="backup_table[]" id="backup_table" class="select2 form-control" multiple="multiple">
                                        <?php
                                        $select = explode(',',$select);
                                        foreach($select??[] as $id_select){
                                            if ($id_select == "all"){
                                                $all = 'selected';
                                            }
                                        }
                                        ?>
                                        <option value="all" <?=$all??''?>><?=lang("App.settings_field_backup_table_all")?></option>
                                        <?php foreach ($tables??[] as $item) : ?>
                                            <?php foreach ($select??[] as $id_select) : ?>
                                                <?php
                                                if ($id_select == $item){
                                                    $selItem = 'selected';
                                                }
                                                ?>
                                            <?php endforeach; ?>
                                            <option value="<?=$item?>" <?=$selItem??''?>><?=lang("App.settings_field_backup_table")?> (<?=$item?>)</option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                                <div class="col-lg-4 mb-3">
                                    <label for="backup_time" class="form-label"><?=lang("App.settings_field_backup_time")?></label>
                                    <?php $id_select = (isset($obj)) ? $obj['backup_time'] : set_value('backup_time');?>
                                    <select name="backup_time" id="backup_time" class="select2 form-control">
                                        <?php for ($i = 0; $i <= 23; $i++) : ?>
                                            <option value="<?= $i < 10 ? '0'.$i.':00:00':$i.':00:00' ?>" <?= $id_select == "<?= $i < 10 ? '0'.$i.':00:00':$i.':00:00' ?>" ? 'selected' : '' ?>><?= $i < 10 ? '0'.$i.':00':$i.':00' ?></option>
                                            <option value="<?= $i < 10 ? '0'.$i.':30:00':$i.':30:00' ?>" <?= $id_select == "<?= $i < 10 ? '0'.$i.':30:00':$i.':30:00' ?>" ? 'selected' : '' ?>><?= $i < 10 ? '0'.$i.':30':$i.':30' ?></option>
                                        <?php endfor; ?>
                                    </select>
                                </div>
                                <div class="col-lg-12 mb-3">
                                    <label for="backup_email" class="form-label"><?=lang("App.settings_field_backup_email")?></label>
                                    <input
                                            type="text"
                                            id="backup_email"
                                            min="1"
                                            name="backup_email"
                                            class="form-control"
                                            placeholder="<?=lang("App.settings_field_backup_email_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['backup_email'] : set_value('backup_email');?>"
                                    />
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_backup_notification_email")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="backup_notification_email"
                                                name="backup_notification_email"
                                                class="switch-input"
                                            <?= $obj['backup_notification_email']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_backup_automatic")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="backup_automatic"
                                                name="backup_automatic"
                                                class="switch-input"
                                            <?= $obj['backup_automatic']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-12 text-right mb-3">
                                    <a href="<?=site_url("integration/create_backup/1")?>" class="btn btn-primary mt-2">
                                        <i class="fas fa-download"></i> <?=lang("App.settings_label_backup_btn_1")?>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Backup Settings -->
                <!-- Register Settings -->
                <div class="tab-pane fade show" id="register" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-user ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_register_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_register_subtitle_1")?></label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_registration")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="registration"
                                                name="registration"
                                                class="switch-input"
                                            <?= $obj['registration']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_remember_me")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="remember_me"
                                                name="remember_me"
                                                class="switch-input"
                                            <?= $obj['remember_me']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_forgot_password")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="forgot_password"
                                                name="forgot_password"
                                                class="switch-input"
                                            <?= $obj['forgot_password']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_terms_conditions")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="terms_conditions"
                                                name="terms_conditions"
                                                class="switch-input"
                                            <?= $obj['terms_conditions']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_email_confirmation")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="email_confirmation"
                                                name="email_confirmation"
                                                class="switch-input"
                                            <?= $obj['email_confirmation']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_send_welcome_message")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="send_email_welcome"
                                                name="send_email_welcome"
                                                class="switch-input"
                                            <?= $obj['send_email_welcome']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-12 mb-3">
                                    <label for="terms_conditions_text" class="form-label"><?=lang("App.settings_field_terms_conditions_text")?></label>
                                    <textarea
                                            class="form-control"
                                            id="terms_conditions_text"
                                            name="terms_conditions_text"
                                            rows="3">
                                        <?= (isset($obj)) ? $obj['terms_conditions_text'] : set_value('terms_conditions_text');?>
                                    </textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Register Settings -->
                <!-- Notifications Settings -->
                <div class="tab-pane fade show" id="notification" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-bell ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_notification_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_notification_subtitle_1")?></label>
                                </div>
                                <div class="col-lg-4 mb-3">
                                    <label for="send_user_register" class="form-label"><?=lang("App.settings_field_send_user_register")?></label>
                                    <?php $id_select = (isset($obj)) ? $obj['send_user_register'] : set_value('send_user_register');?>
                                    <select name="send_user_register" id="send_user_register" class="select2 form-control">
                                        <?php foreach($user??[] as $item): ?>
                                            <option value="<?=$item->token?>" <?= $id_select == $item->token ? 'selected' : '' ?>><?=$item->first_name?> - <?=$item->email?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                                <div class="col-lg-4 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_send_email_register")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="send_email_register"
                                                name="send_email_register"
                                                class="switch-input"
                                            <?= $obj['send_email_register']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-4 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_send_notification_register")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="send_notification_register"
                                                name="send_notification_register"
                                                class="switch-input"
                                            <?= $obj['send_notification_register']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Notifications Settings -->
                <!-- API Settings -->
                <div class="tab-pane fade show" id="api" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-link ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_api_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_notification_subtitle_1")?></label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_enable_api")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="enable_api"
                                                name="enable_api"
                                                class="switch-input"
                                            <?= $obj['enable_api']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_block_api")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="block_external_api"
                                                name="block_external_api"
                                                class="switch-input"
                                            <?= $obj['block_external_api']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-6 mb-3">
                                        <label for="ip_allowed_api" class="form-label"><?=lang("App.settings_field_ip_api")?></label>
                                        <input
                                                type="text"
                                                id="ip_allowed_api"
                                                name="ip_allowed_api"
                                                class="form-control"
                                                placeholder="<?=lang("App.settings_field_ip_api_ph")?>"
                                                value="<?= (isset($obj)) ? $obj['ip_allowed_api'] : set_value('ip_allowed_api');?>"
                                        />
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <label class="form-label"><?=lang("App.settings_field_jwt_token_lifetime")?></label>
                                    <div class="input-group">
                                        <input
                                                type="number"
                                                id="jwt_token_lifetime"
                                                min="1"
                                                name="jwt_token_lifetime"
                                                class="form-control"
                                                placeholder="<?=lang("App.settings_field_jwt_token_lifetime_ph")?>"
                                                value="<?= (isset($obj)) ? $obj['jwt_token_lifetime'] : set_value('jwt_token_lifetime');?>"
                                        />
                                        <span class="input-group-text"><?=lang("App.global_minutes")?></span>
                                    </div>
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <label for="jwt_private_key" class="form-label"><?=lang("App.settings_field_jwt_private_key")?></label>
                                    <input
                                            type="text"
                                            id="jwt_private_key"
                                            name="jwt_private_key"
                                            class="form-control"
                                            placeholder="<?=lang("App.settings_field_jwt_private_key_ph")?>"
                                            value="<?= (isset($obj)) ? $obj['jwt_private_key'] : set_value('jwt_private_key');?>"
                                    />
                                </div>
                                <div class="col-lg-3 mb-3">
                                        <label for="group_api" class="form-label"><?=lang("App.settings_field_group_api")?></label>
                                        <?php $id_select = (isset($obj)) ? $obj['group_api'] : set_value('group_api');?>
                                        <select name="group_api" id="group_api" class="select2 form-control">
                                            <?php foreach($group??[] as $item): ?>
                                                <option value="<?=$item->token?>" <?= $id_select == $item->token ? 'selected' : '' ?>><?=$item->title?></option>
                                            <?php endforeach; ?>
                                        </select>
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_api_subtitle_2")?></label>
                                </div>
                                <div class="col-lg-6 mb-3">
                                    <a href="<?=site_url("integration/download_postman")?>" class="btn btn-warning pull-right">
                                        <i class="fas fa-download mr-1"></i> <?=lang("App.settings_label_api_download")?>
                                    </a>
                                </div>
                                <div class="col-lg-12 mb-3">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <p class="form-label"><b><i class="fas fa-user-friends"></i> <?=lang("App.settings_label_api_users")?></b></p>
                                            <div id="accordion-one" class="accordion-no-gutter accordion-bordered">
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseOne">
                                                        <span class="accordion__header--text"><span class="badge badge-success"><i class="fas fa-lock"></i> GET</span> <?=getenv('app.baseURL').'/api/user'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseOne" class="collapse accordion__body" data-parent="#accordion-one">
                                                        <div class="accordion__body--text" id="api_user_all"></div>
                                                    </div>
                                                </div>
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseTwo">
                                                        <span class="accordion__header--text"><span class="badge badge-success"><i class="fas fa-lock"></i> GET</span> <?=getenv('app.baseURL').'/api/user/<b>{USER_TOKEN_ID}</b>'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseTwo" class="collapse accordion__body" data-parent="#accordion-one">
                                                        <div class="accordion__body--text" id="api_user_token"></div>
                                                    </div>
                                                </div>
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseThree">
                                                        <span class="accordion__header--text"><span class="badge badge-warning"><i class="fas fa-lock"></i> POST</span> <?=getenv('app.baseURL').'/api/user'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseThree" class="collapse accordion__body" data-parent="#accordion-one">
                                                        <div class="accordion__body--text" id="api_user_add"></div>
                                                    </div>
                                                </div>
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseFour">
                                                        <span class="accordion__header--text"><span class="badge badge-danger"><i class="fas fa-lock"></i> DEL</span> <?=getenv('app.baseURL').'/api/user/<b>{USER_TOKEN_ID}</b>'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseFour" class="collapse accordion__body" data-parent="#accordion-one">
                                                        <div class="accordion__body--text" id="api_user_delete"></div>
                                                    </div>
                                                </div>
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseFive">
                                                        <span class="accordion__header--text"><span class="badge badge-info"><i class="fas fa-lock"></i> PUT</span> <?=getenv('app.baseURL').'/api/user/<b>{USER_TOKEN_ID}</b>'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseFive" class="collapse accordion__body" data-parent="#accordion-one">
                                                        <div class="accordion__body--text" id="api_user_edit"></div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <p class="form-label"><b><i class="fas fa-key"></i> <?=lang("App.settings_label_api_auth")?></b></p>
                                            <div id="accordion-two" class="accordion-no-gutter accordion-bordered">
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseOne_two">
                                                        <span class="accordion__header--text"><span class="badge badge-success"><i class="fas fa-lock-open"></i> GET</span> <?=getenv('app.baseURL').'/api/status'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseOne_two" class="collapse accordion__body" data-parent="#accordion-two">
                                                        <div class="accordion__body--text" id="api_status"></div>
                                                    </div>
                                                </div>
                                                <div class="accordion__item">
                                                    <div class="accordion__header collapsed" data-toggle="collapse" data-target="#default_collapseTwo_two">
                                                        <span class="accordion__header--text"><span class="badge badge-warning"><i class="fas fa-lock-open"></i> POST</span> <?=getenv('app.baseURL').'/api/signin'?></span>
                                                        <span class="accordion__header--indicator"></span>
                                                    </div>
                                                    <div id="default_collapseTwo_two" class="collapse accordion__body" data-parent="#accordion-two">
                                                        <div class="accordion__body--text" id="api_signin"></div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /API Settings -->
                <!-- Logs Settings -->
                <div class="tab-pane fade show" id="logs" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-archive ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_logs_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_logs_subtitle_1")?></label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <div class="small mb-3"><?=lang("App.settings_field_remove_log")?></div>
                                    <label class="switch">
                                        <input
                                                type="checkbox"
                                                id="remove_log"
                                                name="remove_log"
                                                class="switch-input"
                                            <?= $obj['remove_log']??false ? 'checked' : ''?>
                                        />
                                        <span class="switch-toggle-slider">
                                            <span class="switch-on"></span>
                                            <span class="switch-off"></span>
                                        </span>
                                        <span class="switch-label"><?=lang("App.global_activate")?></span>
                                    </label>
                                </div>
                                <div class="col-lg-3 mb-3">
                                    <label for="remove_log_time" class="form-label"><?=lang("App.settings_field_remove_log_time")?></label>
                                    <div class="input-group">
                                        <input
                                                type="number"
                                                id="remove_log_time"
                                                min="1"
                                                name="remove_log_time"
                                                class="form-control"
                                                placeholder="<?=lang("App.settings_field_remove_log_time_ph")?>"
                                                value="<?= (isset($obj)) ? $obj['remove_log_time'] : set_value('remove_log_time');?>"
                                        />
                                        <span class="input-group-text"><?=lang("App.global_days")?></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Logs Settings -->
                <!-- Cron Settings -->
                <div class="tab-pane fade show" id="cron" role="tabpanel">
                    <div class="d-flex mb-3 gap-3">
                        <div>
                              <span class="badge bg-label-primary rounded-2 p-2">
                                <i class="ti ti-rotate-clockwise ti-lg"></i>
                              </span>
                        </div>
                        <div>
                            <h4 class="mb-0">
                                <span class="align-middle"><?=lang("App.settings_label_cron_title")?></span>
                            </h4>
                        </div>
                    </div>
                    <div class="card">
                        <div class="row card-body">
                            <div class="row">
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_cron_subtitle_1")?></label>
                                </div>

                                <div class="col-lg-12 mb-3">
                                    <p class="form-label">
                                        <b><?=lang("App.settings_label_cron_timer")?></b>
                                        <br><?=lang("App.settings_label_cron_timer_time")?>
                                        <br><?=getenv('app.baseURL').'/cron'?>
                                    </p>
                                </div>
                                <div class="col-lg-12 mb-3">
                                    <label class="text-primary"><?=lang("App.settings_label_cron_subtitle_2")?></label>
                                    <!-- CSRF token -->
                                    <input type="hidden" class="txt_csrfname" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" />
                                    <!-- Table -->
                                    <table id='table-grid' class="table table-striped nowrap" style="width:100%">
                                        <thead>
                                        <tr>
                                            <th><?=lang("App.settings_grid_routine")?></th>
                                            <th><?=lang("App.settings_group_grid_error")?></th>
                                            <th><?=lang("App.settings_group_grid_created_at")?></th>
                                        </tr>
                                        </thead>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Cron Settings -->
            </div>
            <div class="tab-content pt-4">
                    <button type="submit" class="btn btn-primary float-start me-sm-3 me-1">
                        <?= lang("App.global_save") ?>
                    </button>
                    <a href="<?= site_url('/home') ?>" class="btn btn-secondary">
                        <?= lang("App.global_come_back") ?>
                    </a>
            </div>
        </form>
    </div>
    <!-- /System Settings -->


</div>
<?= $this->endSection() ?>



<?= $this->section('additionalInlineJs') ?>
    "use strict";
    $(document).ready(function () {
        $('#first_name').focus();
        let configSummerNote = {
            height: 150, // set editor height
            minHeight: null, // set minimum height of editor
            maxHeight: null, // set maximum height of editor
            focus: true, // set focus to editable area after initializing summernote
            toolbar: [
                ['style', ['style']],
                ['font', ['bold', 'italic', 'underline', 'clear']],
                ['fontname', ['fontname']],
                ['color', ['color']],
                ['para', ['ul', 'ol', 'paragraph']],
                ['height', ['height']],
                ['table', ['table']],
                ['insert', ['link', 'picture', 'hr']],
                ['view', ['codeview']]
            ]
        }
        $("#terms_conditions_text").summernote(configSummerNote);
        let dataFormat = [
            {
                targets: 2,
                render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss','<?=momentDateTimeJS()?>')
            }
        ];
        let order = [[2, "desc"]];
        let translate = '/themes/vuexy/vendor/datatables/locales/<?=langJS()?>.json';
        let button = ["<?=lang("App.global_copy")?>","<?=lang("App.global_print")?>","<?=lang("App.global_excel")?>","<?=lang("App.global_pdf")?>"];
        let columns = [{ data: 'routine' },{ data: 'error' },{ data: 'created_at' }];
        loadDataTableAjax('table-grid', '<?=site_url('ajax/getCronHistory')?>', translate, true, true, order, columns,dataFormat, button);
        load_data_api();
    });
    $("#terms_conditions_text").on("summernote.enter", function(we, e) {
        $(this).summernote("pasteHTML", "<br><br>");
        e.preventDefault();
    });
    function load_data_api(){
        let api_user_all = document.getElementById("api_user_all");
        let api_user_token = document.getElementById("api_user_token");
        let api_user_add = document.getElementById("api_user_add");
        let api_user_delete = document.getElementById("api_user_delete");
        let api_user_edit = document.getElementById("api_user_edit");
        let api_status = document.getElementById("api_status");
        let api_signin = document.getElementById("api_signin");
        api_user_all.innerText = '[\n' +
            '    {\n' +
            '        "token": "fdfa9b8b69e2a71f8a35fdaa226745cf",\n' +
            '        "first_name": "Web",\n' +
            '        "last_name": "Guard",\n' +
            '        "date_birth": null,\n' +
            '        "email": "test@eduardofiorini.com",\n' +
            '        "mobile": "551190000000",\n' +
            '        "picture": "/assets/img/default-user.png",\n' +
            '        "language": "en",\n' +
            '        "address": "",\n' +
            '        "state": "",\n' +
            '        "country": "BR",\n' +
            '        "zip_code": null,\n' +
            '        "status": "1",\n' +
            '        "created_at": "2021-11-12 14:58:46",\n' +
            '        "updated_at": "2021-11-30 16:44:05"\n' +
            '    }\n' +
            ']';
        api_user_token.innerText = '{\n' +
            '        "token": "fdfa9b8b69e2a71f8a35fdaa226745cf",\n' +
            '        "first_name": "Web",\n' +
            '        "last_name": "Guard",\n' +
            '        "date_birth": null,\n' +
            '        "email": "test@eduardofiorini.com",\n' +
            '        "mobile": "551190000000",\n' +
            '        "picture": "/assets/img/default-user.png",\n' +
            '        "language": "en",\n' +
            '        "address": "",\n' +
            '        "state": "",\n' +
            '        "country": "BR",\n' +
            '        "zip_code": null,\n' +
            '        "status": "1",\n' +
            '        "created_at": "2021-11-12 14:58:46",\n' +
            '        "updated_at": "2021-11-30 16:44:05"\n' +
            '    }\n';
        api_user_add.innerText = '{\n' +
            '    "error": false,\n' +
            '    "message": "Added successfully!",\n' +
            '    "data": {\n' +
            '        "token": "0c4e735f95425818d76d89d0837bbe9c",\n' +
            '        "first_name": "Web",\n' +
            '        "last_name": "Guard",\n' +
            '        "date_birth": null,\n' +
            '        "email": "test@eduardofiorini.com",\n' +
            '        "mobile": "",\n' +
            '        "picture": "/assets/img/default-user.png",\n' +
            '        "language": "pt",\n' +
            '        "address": null,\n' +
            '        "state": "",\n' +
            '        "country": "",\n' +
            '        "zip_code": null,\n' +
            '        "status": "1",\n' +
            '        "created_at": "2021-12-10 14:30:35",\n' +
            '        "updated_at": "2021-12-10 14:30:35"\n' +
            '    }\n' +
            '}';
        api_user_delete.innerText = '{\n' +
            '    "error": false,\n' +
            '    "message": "Successfully deleted!"\n' +
            '}';
        api_user_edit.innerText = '{\n' +
            '    "error": false,\n' +
            '    "message": "Successfully Edited!",\n' +
            '    "data": {\n' +
            '        "token": "92f223f92f8d1f95298eba5dd09f53af",\n' +
            '        "first_name": "Eduardo",\n' +
            '        "last_name": "Fiorini",\n' +
            '        "date_birth": "1989-06-19",\n' +
            '        "email": "edupva@gmail.com",\n' +
            '        "mobile": "556696000000",\n' +
            '        "picture": "https://s.gravatar.com/avatar/60bc9eb71c6bc1e82f165ad587bd0947?s=150",\n' +
            '        "language": "pt",\n' +
            '        "address": "",\n' +
            '        "state": "",\n' +
            '        "country": "BR",\n' +
            '        "zip_code": null,\n' +
            '        "status": "1",\n' +
            '        "created_at": "2021-11-07 17:04:49",\n' +
            '        "updated_at": "2021-12-10 14:31:19"\n' +
            '    }\n' +
            '}';
        api_status.innerText = '{\n'+
            '"status": true,\n' +
            '"message": "The system is running!"\n'+
            '}';
        api_signin.innerText = '{\n'+
            '"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImFkbWluQGFkbWluLmNvbSIsImlhdCI6MTYzOTE1NTgyNiwiZXhwIjoxNjM5MTU2MTI2fQ.-gfpuC2jqWBqCiTUFMECbBR0nUqyfW1n8OyWqqNKqvE"\n'+
            '}';
        hljs.highlightBlock(api_user_all)
        hljs.highlightBlock(api_user_token)
        hljs.highlightBlock(api_user_add)
        hljs.highlightBlock(api_user_delete)
        hljs.highlightBlock(api_user_edit)
        hljs.highlightBlock(api_status)
        hljs.highlightBlock(api_signin)
    }
    function send_test(){
        let email = $("#send_email_test");
        let ajax = new XMLHttpRequest();
        document.getElementById('msg_email_test').style.display = 'block';
        ajax.open("GET", "<?=site_url("integration/send_email_test/")?>"+email.val(), true);
        ajax.send();
        ajax.onreadystatechange = function() {
            if (ajax.readyState == 4 && ajax.status == 200) {
                let data = JSON.parse(this.responseText);
                document.getElementById('msg_email_test').style.display = 'none';
                if(data.return){
                    swal({
                        position: 'center',
                        type: 'success',
                        title: '<?=lang("App.settings_alert_email_test_send")?>',
                        showConfirmButton: false,
                        timer: 2000,
                        confirmButtonClass: 'btn btn-primary',
                        buttonsStyling: false
                    });
                }else{
                    swal({
                        position: 'center',
                        type: 'error',
                        title: '<?=lang("App.settings_alert_email_test_error")?>',
                        showConfirmButton: false,
                        timer: 2000,
                        confirmButtonClass: 'btn btn-primary',
                        buttonsStyling: false
                    });
                }
                email.val("");
            }
        }
    }
<?= $this->endSection() ?>
