<?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 | Envio de Arquivo de Remessa</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.2511.13.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.2511.13.1" />
  <link href='../dist/css/bootstrap.min.css?versao=3.2511.13.1'>
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.2511.13.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" type="text/css" href="../dist/css/responsive.bootstrap.min.css?versao=3.2511.13.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" href="../dist/css/cadastro.css?versao=3.2511.13.1">

  <!-- Toastr -->
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.2511.13.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.2511.13.1">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <style>
    .border-Field .textoBorda {
      font-size: 1.1em !important;
      text-align: left !important;
      width: auto;
      padding: 0 10px;
      border-bottom: none;
    }

    .border-Field {
      border: 1px solid var(--font-color) !important;
      padding: 0 1.0em 0 1.0em !important;
      margin: 0 0 0 0 !important;
      -webkit-box-shadow: 0px 0px 0px 0px #000;
      box-shadow: 0px 0px 0px 0px #000;
    }

    /* #tabelaDuplicatas thead th {
      position: sticky;
      top: 0;
      z-index: 99999 !important;
    } */

    #tabelaDuplicatas tbody,
    #tabelaDuplicatas thead {
      white-space: nowrap !important;
      text-overflow: ellipsis !important;
      overflow: hidden !important;
    }
  </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">Cobrança - Envio</h1>
              <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>
            </div>
            <div class="col-sm-6">
            </div>
          </div>
        </div>
        <div class="container-fluid">
          <div class="card">
            <div class="row col-12">
              <div class="row col-10">
                <div class="row col-sm-12 col-12 col-md-12 mt-1">
                  <div class="col-2 col-sm-2 col-md-2 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtBordero">Borderô: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtBordero" name="txtBordero" class="form-control" placeholder="Bordero">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btnBordero" name="btnBordero" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btnLimpaBordero" name="btnLimpaBordero" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>
                  <div class="col-3 col-sm-3 col-md-3 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtConta">Conta: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtConta" name="txtConta" class="form-control" placeholder="Conta">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btnConta" name="btnConta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btnLimpaConta" name="btnLimpaConta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>
                  <div class="col-3 col-sm-3 col-md-3 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtBanco">Banco: </label>
                    <div class="input-group">
                      <input ty="text" autocomplete="off" class="input-default focus form-control" disabled id="txtBanco" name="txtBanco" class="form-control" placeholder="Banco">
                    </div>
                  </div>
                  <div class="col-1 col-sm-1 col-md-1 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtSequencial">Sequencial: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtSequencial" name="txtSequencial" class="form-control">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btnLimpaSequencial" name="btnLimpaSequencial" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>
                  <div class="col-2 col-sm-2 col-md-2 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtDataVendor">Data Vendor: </label>
                    <input type="date" autocomplete="off" disabled class="input-default focus form-control" id="txtDataVendor" name="txtDataVendor" class="form-control">
                  </div>
                  <div class="col-1 col-sm-1 col-md-1 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtJuros">Juros: </label>
                    <input type="text" autocomplete="off" class="input-default focus form-control text-right" value="%" id="txtJuros" name="txtJuros">
                  </div>
                </div>
                <div class="row col-sm-12 col-12 col-md-12">
                  <div class="col-4 col-sm-4 col-md-4 pr-0">
                    <label data-error="wrong" data-success="right" for="txtInstrucaoCob1">Instrução Cobrança 1: </label>
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtInstrucaoCob1" name="txtInstrucaoCob1" class="form-control" placeholder="Instrução Cobrança 1">
                  </div>
                  <div class="col-4 col-sm-4 col-md-4 pr-0">
                    <label data-error="wrong" data-success="right" for="txtCarteira">Carteira: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtCarteira" name="txtCarteira" class="form-control" placeholder="Carteira">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btnCarteira" name="btnCarteira" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btnLimpaCarteira" name="btnLimpaCarteira" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>
                  <div class="col-3 col-sm-3 col-md-3 pr-0">
                    <label data-error="wrong" data-success="right" for="txtSitReceber">Situação Receber: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" disabled class="input-default focus form-control" id="txtSitReceber" name="txtSitReceber" class="form-control" placeholder="Situação Receber">
                    </div>
                  </div>
                  <div class="col-1 col-sm-1 col-md-1 mt-1 pr-0">
                    <label data-error="wrong" data-success="right" for="txtMulta">Multa: </label>
                    <input type="text" autocomplete="off" class="input-default focus form-control text-right" id="txtMulta" name="txtMulta">
                  </div>
                </div>
                <div class="row col-sm-12 col-12 col-md-12">
                  <div class="col-4 col-sm-4 col-md-4 pr-0">
                    <label data-error="wrong" data-success="right" for="txtInstrucaoCob2">Instrução Cobrança 2: </label>
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtInstrucaoCob2" name="txtInstrucaoCob2" class="form-control" placeholder="Instrução Cobrança 2">
                  </div>
                  <div class="col-2 col-sm-2 col-md-2 pr-0">
                    <label data-error="wrong" data-success="right" for="txtDiasProtestar">Dias Protestar: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" value="0" id="txtDiasProtestar" name="txtDiasProtestar" class="form-control">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btnLimpaDiasProtestar" name="btnLimpaDiasProtestar" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>
                  <div class="col-3 col-md-3 col-sm-3 pr-0">
                    <label data-error="wrong" class="labelGeral" data-success="right" for="selectOcorrencia">Ocorrência:
                    </label>
                    <select class="input-default focus custom-select" id="selectOcorrencia">
                    </select>
                  </div>
                  <div class="col-3 col-sm-3 col-md-3 pr-0">
                    <label data-error="wrong" data-success="right" for="txtVariacao1">Variação: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control col-6 col-sm-6 col-md-6 mr-3" id="txtVariacao1" name="txtVariacao1" class="form-control">
                      <input type="text" autocomplete="off" class="input-default focus form-control col-6 col-sm-6 col-md-6" id="txtVariacao2" name="txtVariacao2" class="form-control">
                    </div>
                  </div>
                </div>
              </div>
              <div class="row col-2">
                <div class="col-12 mt-4 ml-3">
                  <div class="form-group form-check icheck-primary col-12">
                    <input type="checkbox" class="form-check-input" id="cbBuscaTaxaBordero">
                    <label class="form-check-label pr-2" for="cbBuscaTaxaBordero">Buscar Taxa e Multa do Bordero</label>
                  </div>
                </div>
                <div class="row col-12">
                  <div class="col-sm-12 col-md-12 col-12 pb-4">
                    <div class="col-12 form" id="tipos">
                      <fieldset class="form border-Field mb-0 pb-0">
                        <legend class="textoBorda mb-0 pb-0">Opções</legend>
                        <div class="form-row ml-2">
                          <div class="form-group form-check icheck-danger col-12" style="margin-bottom: 10% !important">
                            <input type="checkbox" checked class="form-check-input" id="cbInstrucao1">
                            <label class="form-check-label pr-2" for="cbInstrucao1">Instrução 1</label>
                          </div>
                          <div class="form-group form-check icheck-danger col-12" style="margin-bottom: 10% !important">
                            <input type="checkbox" checked class="form-check-input" id="cbInstrucao2">
                            <label class="form-check-label pr-2" for="cbInstrucao2">Instrução 2</label>
                          </div>
                          <div class="form-group form-check icheck-danger col-12" style="margin-bottom: 10% !important">
                            <input type="checkbox" checked class="form-check-input" id="cbBancoEmiteBol">
                            <label class="form-check-label pr-2" for="cbBancoEmiteBol">Banco Emite Boleto</label>
                          </div>
                        </div>
                      </fieldset>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-sm-12 table-responsive card-body">
              <h5>Duplicatas</h5>
              <table id="tabelaDuplicatas" class="table table-sm table-select table-hover" width="100%">
                <thead>
                </thead>
                <tbody>
                </tbody>
              </table>
            </div>
            <div class="row col-lg-4 col-md-4 col-sm-4 mb-2 ml-2" style="margin-left: 0px important!; padding-left: 0px !important">
              <div class="col-6 col-sm-6 col-md-6">
                <label data-error="wrong" data-success="right" for="txtNomeArquivo">Nome Arquivo: </label>
                <input type="text" autocomplete="off" disabled placeholder="Nome Arquivo" class="input-default focus form-control" id="txtNomeArquivo" name="txtNomeArquivo">
              </div>
              <div class="col-6 col-sm-6 col-md-6" style="padding-right: 0px !important">
                <label data-error="wrong" data-success="right" for="txtTipoArquivo">Arquivo: </label>
                <input type="text" autocomplete="off" disabled placeholder="Arquivo" class="input-default focus form-control" id="txtTipoArquivo" name="txtTipoArquivo">
              </div>
            </div>
            <div class="row col-lg-6 col-md-6 col-sm-6 mb-2 ml-2">
              <button class="btn btn-primary btn-sisp mr-2" id="btnGerarArquivo"><i class=""></i> Gerar Arquivo</button>
              <!-- <button class="btn btn-secondary btn-sisp mr-2" id="btnImprimir"><i class=""></i> Imprimir</button> -->
              <button class="btn btn-dark btn-sisp mr-2" id="btnExcluirDup"><i class=""></i> Excluir Duplicata</button>
              <button class="btn btn-danger btn-sisp mr-2" id="btnExcluirTodas"><i class=""></i> Excluir Todas</button>
              <button class="btn btn-secondary btn-sisp mr-2" id="btnVoltar"> Voltar</button>
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>


  <?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.2511.13.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.2511.13.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.2511.13.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.2511.13.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.2511.13.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.2511.13.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/cliente/entidade.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.2511.13.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.2511.13.1"></script>
  <script src="../utils/funcoes.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.2511.13.1"></script>
  <script src="../utils/cookies.js?versao=3.2511.13.1"></script>
  <script src="../dist/js/dataTables.keyTable2.js?versao=3.2511.13.1"></script>
  <script type="text/javascript" src="../config.js?versao=3.2511.13.1"></script>
  <script src="../plugins/moment/moment.min.js?versao=3.2511.13.1"></script>
  <script src="<?php echo BASE_URI; ?>/dist/js/FileSaver.min.js?versao=3.2511.13.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('ESCENVIO');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      const permissaoUsuarioLogado = await permissaoAcessos("ESCENVIO");

      if (permissaoUsuarioLogado.INCLUI == 'N') {
        await criaMensagemErro("Sem permissão!", () => {
          parent.document.querySelector('#listaAbas > .active > a').click();
        });
        return;
      }

      //   $(window).on("beforeunload", function(e) {
      //     // e.preventDefault();
      //     e.stopPropagation();
      //     return undefined;
      //   });

      sArquivo = `${BASE_URI}/pages/escenvio/cadastro_escenvio/escenvio.js?versao=3.2511.13.1`;
      insereJavaScriptPagina(sArquivo);

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

</html>