<?php include_once('../../../config.php') ?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Cadastro das Informações do TEF</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.263.26.1">
    <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.263.26.1">
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="../dist/css/dataTables.bootstrap4.min.css?versao=3.263.26.1" />
    <link href='../dist/css/bootstrap.min.css?versao=3.263.26.1'>
    <link rel="stylesheet" href="../dist/css/custom.css?versao=3.263.26.1">
    <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.263.26.1">
    <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.263.26.1">
    <link rel="stylesheet" type="text/css" href="../dist/css/responsive.bootstrap.min.css?versao=3.263.26.1">
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../dist/css/cadastro.css?versao=3.263.26.1">
    <!-- Toastr -->
    <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.263.26.1">
    <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.263.26.1" />
    <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.263.26.1">
    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
    <style>
        #progressbar li {
            list-style-type: none;
            font-size: 12px;
            width: 50%;
            float: left;
            position: relative
        }

        .labelGeral {
            margin-top: 7px;
            margin-bottom: 3px;
        }

        .btnInfoCampoNSU {
            padding: 0.1rem 0.25rem !important;
            font-size: .700rem !important;
            line-height: 1.5 !important;
            border-radius: 0.2rem !important;
            margin-bottom: 0.25rem;
        }

        .btnInfoCampoBandeira {
            padding: 0.1rem 0.25rem !important;
            font-size: .700rem !important;
            line-height: 1.5 !important;
            border-radius: 0.2rem !important;
            margin-bottom: 0.25rem;
        }
    </style>
</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">
        <div class="content-wrapper">
            <div class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                        <div class="col-sm-6 flex">
                            <h1 class="m-0 text-dark"></h1>
                        </div>
                        <div class="col-sm-6">
                            <!-- <ol class="breadcrumb float-sm-right">
                                
                                <li class="breadcrumb-item active"><a href="../operadoratef">Acesso Informações do TEF.</a></li>
                                <li class="breadcrumb-item active">Cadastro das Informações do TEF</li>
                            </ol> -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div>
                <div class="row justify-content-center mt-0">
                    <div class="col-10 text-center p-0 mt-3 mb-2">
                        <div class="card px-0 pt-4 pb-0 mt-3 mb-3">
                            <div class="card-header text-center flex" style="border: none!important;box-shadow:none!important;">
                                <h2>Cadastro das Informações do TEF
                                    <button type="button" class="btn btn-info btn-sm ml-2" title="Tutorial" style="color: white;" id="tutorial">
                                        <i class="fas fa-question-circle"></i>
                                    </button>
                                </h2>
                            </div>
                            <div class="row">
                                <div class="col-md-12 mx-0">
                                    <form id="msform">
                                        <!-- progressbar -->
                                        <ul id="progressbar">
                                            <li class="active" id="account" style="font-size: 100%;"><strong>Geral</strong></li>
                                            <li id="payment" style="font-size: 100%;"><strong>Bandeiras</strong></li>
                                        </ul>
                                        <p>Preencha os dados e clique em avançar para ir para a próxima aba de cadastro.</p>
                                        <fieldset>
                                            <div class="form-card" id="formcard1">
                                                <h2 class="fs-title">Dados Gerais</h2>
                                                <div class="row">
                                                    <div class="col-lg-2  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtOperadora">Operadora</label>
                                                        <input type="text" class="input-default focus form-control" id="txtOperadora" aria-describedby="codError" name="txtOperadora" class="form-control" placeholder="Operadora">
                                                    </div>
                                                    <div class="col-lg-4  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtEmpAdmin">Emp. Administradora</label>
                                                        <div class="input-group">
                                                            <input type="text" class="input-default focus form-control" id="txtEmpAdmin" name="txtEmpAdmin" placeholder="Emp. Administradora">
                                                            <div class="input-group-append">
                                                                <button class="btn bg-danger" id="btnEmpAdmin" name="btnEmpAdmin" data-button="absolute" type="button">
                                                                    <i class="m-0 p-0 fas fa-search"></i>
                                                                </button>
                                                                <button class="btn bg-danger" id="btnAEmpAdmin" type="button">
                                                                    <i class="m-0 p-0 fas fa-trash"></i>
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-4  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtClasseGer">Classe Gerencial</label>
                                                        <div class="input-group">
                                                            <input type="text" class="input-default focus form-control" id="txtClasseGer" name="txtClasseGer" placeholder="Classe Gerencial">
                                                            <div class="input-group-append">
                                                                <button class="btn bg-danger" id="btnClasseGer" name="btnClasseGer" data-button="absolute" type="button">
                                                                    <i class="m-0 p-0 fas fa-search"></i>
                                                                </button>
                                                                <button class="btn bg-danger" id="btnAClasseGer" type="button">
                                                                    <i class="m-0 p-0 fas fa-trash"></i>
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </div>                                                                                                      
                                                    <div class="col-lg-2  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtMaquineta">Maquineta</label>
                                                        <input type="text" class="input-default focus form-control" id="txtMaquineta" aria-describedby="codError" name="txtMaquineta" class="form-control" placeholder="Maquineta">
                                                    </div>
                                                    <div class="col-lg-3  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtTaxaOp">Taxa Operadora</label>
                                                        <input type="text" class="input-default focus form-control" id="txtTaxaOp" name="txtTaxaOp" placeholder="Taxa Operadora">
                                                    </div>  
                                                    <div class="col-lg-3  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtCampoNsu">Campo NSU</label>
                                                        <button type="button" class="btn btn-info mr-l btnInfoCampoNSU" style="color: white;" data-toggle="tooltip" data-placement="top" checked title="Define qual campo será utilizado para preencher os campos 'RECEBER.CARTAO_NSU' e 'CONDIVENDA.NSU'. Por padrão, utiliza-se o próprio NSU. Por exemplo, na integração com a Stone, o campo 'Stone ID:' deve ser utilizado para esse preenchimento, pois é ele que permitirá a conciliação e baixa futura. É necessário informar exatamente o nome do campo conforme aparece no comprovante de retorno do TEF.">
                                                            <i class="fas fa-info-circle "></i>
                                                        </button>
                                                        <input type="text" class="input-default focus form-control" id="txtCampoNsu" aria-describedby="codError" name="txtCampoNsu" class="form-control" placeholder="Campo NSU">
                                                    </div>
                                                    <div class="col-lg-3  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtCampoBandeira">Campo Bandeira</label>
                                                        <button type="button" class="btn btn-info mr-l btnInfoCampoBandeira" style="color: white;" data-toggle="tooltip" data-placement="top" checked title="Define qual posição será utilizada para buscar a bandeira no arquivo da TEF. Por padrão, utiliza-se a posição 040-000 do arquivo, entretanto, nem todas as gerenciadoras utilizam essa posição, sendo assim, é necessário informar qual posição que está destacada a bandeira utilizada na transação da TEF. É necessário informar exatamente a posição conforme aparece no comprovante completo da TEF, que pode ser encontrado na tabela CONDIVENDA no campo DADOS_TEF. Exemplo de como informar: 010-000 ou 010-001.">
                                                            <i class="fas fa-info-circle "></i>
                                                        </button>
                                                        <input type="text" class="input-default focus form-control" id="txtCampoBandeira" aria-describedby="codError" name="txtCampoBandeira" class="form-control" placeholder="Campo Bandeira">
                                                    </div>
                                                    <div class="col-lg-3  col-12 form-group">
                                                        <label data-error="wrong" class="labelGeral" data-success="right" for="selectParcelaArredondamento">Parcela Arredondamento</label>
                                                        <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectParcelaArredondamento" aria-describedby="tipoError" class="custom-select focus">
                                                            <option value="P">Primeira Parcela</option>
                                                            <option selected value="U">Última Parcela</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="button" name="avancar1" class="btn-sisp next action-button" value="Avançar" id="avancar1" />
                                            <button type="button" id="btnVoltar" style="font-size:15px;" class="btn-sisp action-button-previous" data-dismiss="modal">Voltar</button>
                                        </fieldset>
                                        <fieldset>
                                            <div class="form-card" id="bandeiras">
                                                <h2 class="fs-title">Bandeiras</h2>
                                                <div class="row">
                                                    <div class="col-md-12 col-12">
                                                        <div class="table-responsive">
                                                            <table id="tabela-bandeiras" class="table table-sm table-select table-hover">
                                                                <thead>
                                                                    <tr>
                                                                        <th>Id</th>
                                                                        <th>Bandeira</th>
                                                                        <th>Taxa</th>
                                                                        <th>Ações</th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>
                                                    <input type="button" name="btnIncluir" style="margin-left: 80%;" class="action-button" value="Incluir" id="btnIncluir" />
                                                </div>
                                            </div>
                                            <input type="button" name="btnGravar" class="action-button" value="Gravar" id="btnGravar" />
                                            <input type="button" name="voltar" class="previous action-button-previous" value="Voltar" id="voltar" />
                                        </fieldset>
                                </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="modal-bandeira" class="modal" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-xl" role="document">
                <div class="modal-content" id="modalBody">
                    <div class="modal-header">
                        <h4 class="modal-title">Bandeiras</h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div style="margin-top:6px" class="col-lg-7 bandeira">
                                <label style="margin-bottom:0px;">Bandeira</label>
                                <div class="input-group">
                                    <select class="form-control select2 select2-danger focus" id="select_bandeira" name="select_bandeira" data-dropdown-css-class="select2-danger" style="width: 100%;">
                                        <option value="" selected="selected">Selecione uma bandeira</option>
                                    </select>
                                </div>
                            </div>
                            <div style="margin-top: -2px;" class="col-lg-4  col-12 form-group">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtTaxaBand">Taxa Bandeira</label>
                                <input type="text" class="input-default focus form-control" id="txtTaxaBand" name="txtTaxaBand" placeholder="Taxa Bandeira">
                            </div>
                            <div class="col-lg-1" style="margin-top: 33px; margin-left: 0px !important;">
                                <button type="button" class="btn btn-info btn-sm" title="Tutorial cadastro das taxas" style="color: white;" id="btnTutorialTaxas">
                                    <i class="fas fa-question-circle"></i>
                                </button>
                            </div>
                            <div class="col-md-12 col-12">
                                <div class="table-responsive">
                                    <label data-error="wrong" data-success="right" for="tabela-parcelas">Parcelas</label>
                                    <table id="tabela-parcelas" class="table table-sm table-select table-hover">
                                        <thead>
                                            <tr>
                                                <th>Parcelas</th>
                                                <th>Prazo</th>
                                                <th>Taxa</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div class="row">
                            <button class="btn btn-primary btn-sisp" id="btnConfirmar">Confirmar</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    </div>
    </div>

    <input type="text" class="d-none" id="ultimoId">
    <input type="text" class="d-none" id="ultimaBandeira">
    <input type="text" class="d-none" id="ultimaTaxa">
    <?php
    include_once('../../../modais.php');
    ?>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Control sidebar content goes here -->
    </aside>
    <!-- /.control-sidebar -->
    </div>

    <!-- jQuery -->
    <script src="../plugins/jquery/jquery.min.js?versao=3.263.26.1"></script>
    <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.263.26.1"></script>
    <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.263.26.1"></script>
    <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.263.26.1"></script>
    <!-- SweetAlert2 -->
    <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.263.26.1"></script>
    <script src="../plugins/toastr/toastr.min.js?versao=3.263.26.1"></script>

    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>

    <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/adminlte.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/requisicoes.js?versao=3.263.26.1"></script>
    <script src="../dist/js/cliente/entidade.js?versao=3.263.26.1"></script>
    <script src="../dist/js/loadingoverlay.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/valida_cpf_cnpj.js?versao=3.263.26.1"></script>
    <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/sisplan.js?versao=3.263.26.1"></script>
    <script src="../utils/funcoes.js?versao=3.263.26.1"></script>
    <script src="../utils/cookies.js?versao=3.263.26.1"></script>
    <script src="../dist/js/driver.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/jquery.maskMoney.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/jquery.mask.min.js?versao=3.263.26.1"></script>
    <script src="../dist/js/dataTables.keyTable2.js?versao=3.263.26.1"></script>
    <script type="text/javascript" src="../config.js?versao=3.263.26.1"></script>
    <script>
        $(document).ready(async function() {
            if (getCookie('usuario') == "") {
                window.location.href = `${BASE_URI}/login`;
                return;
            }

            let usuario = getCookie('usuario');
            let empresa = getCookie('empresa');

            ipInterno = IP_INTERNO;
            ipExterno = IP_EXTERNO;
            basicAuth = BASIC_AUTH;

            const temAcesso = await temAcessoTela('OPERADORATEF');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            const permissaoUsuarioLogado = await permissaoAcessos("OPERADORATEF");

            if (permissaoUsuarioLogado.INCLUI == 'N') {
                await criaMensagemErro("Sem permissão para incluir!", () => {
                    window.location.href = `${BASE_URI}/operadoratef`
                });
                return;
            }

            sArquivo = `${BASE_URI}/pages/operadoratef/cadastro_operadoratef/operadoratef.js?versao=3.263.26.1`;
            insereJavaScriptPagina(sArquivo);

            const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');
            habilitaCamposObrigatoriosTela(nomeTela);
        });
    </script>
</body>

</html>