<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
      <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 border-bottom">
        <h1 class="h2">Configuração API de Jogos</h1>
      </div> 
      <div class="container mt-3">
      <?php if ($this->session->flashdata('msg')): ?> 

      <div class="alert alert-<?= $this->session->flashdata('tipo'); ?> text-center"" role="alert">
        <?= $this->session->flashdata('msg'); ?>
      </div>

      <?php endif; ?>

      <div class="mt-3 mb-3">
            <a href="<?php echo site_url('Fiverscan/sync'); ?>" class="btn btn-danger"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-sync"><path d="M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1"/><path d="M12 10v4h4"/><path d="m12 14 1.5-1.5c.9-.9 2.2-1.5 3.5-1.5s2.6.6 3.5 1.5c.4.4.8 1 1 1.5"/><path d="M22 22v-4h-4"/><path d="m22 18-1.5 1.5c-.9.9-2.1 1.5-3.5 1.5s-2.6-.6-3.5-1.5c-.4-.4-.8-1-1-1.5"/></svg> Sincronizar</a>
      </div>

      <div class="mt-3 mb-3">
            <a href="<?php echo site_url('Fiverscan/syncUsers'); ?>" class="btn btn-danger"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-sync"><path d="M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1"/><path d="M12 10v4h4"/><path d="m12 14 1.5-1.5c.9-.9 2.2-1.5 3.5-1.5s2.6.6 3.5 1.5c.4.4.8 1 1 1.5"/><path d="M22 22v-4h-4"/><path d="m22 18-1.5 1.5c-.9.9-2.1 1.5-3.5 1.5s-2.6-.6-3.5-1.5c-.4-.4-.8-1-1-1.5"/></svg> Sincronizar Usuários</a>
      </div>
     
      <form method="post" action="<?php echo site_url('Fiverscan/save'); ?>">
            <div class="mb-3">
                <label for="url" class="form-label">URL</label>
                <input type="text" class="form-control" id="url" name="url" value="<?php echo $config[0]->url ?>">
            </div>
            <div class="mb-3">
                <label for="client_id" class="form-label">Agent Code</label>
                <textarea class="form-control" id="agent_code" name="agent_code" rows="3">xxx</textarea>
            </div>
            <div class="mb-3">
                <label for="client_secret" class="form-label">Token</label>
                <textarea class="form-control" id="agent_token" name="agent_token" rows="3">xxx</textarea>
            </div>
            <div class="mb-3">
                <label for="client_id" class="form-label">RTP% (Chances de Ganhar)</label>
                <input type="number" class="form-control" id="ativo" name="ativo" value="<?php echo $config[0]->ativo ?>">
            </div>
            <button type="submit" class="btn btn-primary">Enviar</button>
      </form>

      
    </div>

</main>

<script>
    function ocultarTextareas() {
        // Obter referências aos elementos de área de texto
        var textArea1 = document.getElementById("agent_code");
        var textArea2 = document.getElementById("agent_token");

        // Criar novos elementos de input do tipo senha
        var senhaInput1 = document.createElement("input");
        var senhaInput2 = document.createElement("input");

        // Configurar os novos inputs
        senhaInput1.type = "password";
        senhaInput1.placeholder = "Senha 1";

        senhaInput2.type = "password";
        senhaInput2.placeholder = "Senha 2";

        // Substituir os text areas pelos novos inputs
        textArea1.parentNode.replaceChild(senhaInput1, textArea1);
        textArea2.parentNode.replaceChild(senhaInput2, textArea2);
    }
</script>