<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Pagar</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.239.11.1">

  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.239.11.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.239.11.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.239.11.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css">
  <!-- Toastr -->
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.239.11.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.239.11.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.239.11.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.239.11.1">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">


</head>
<style>
  #msform {
    text-align: start;
    position: relative;
  }

  .card {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
  }

  .card-header {
    box-shadow: 0px 1px rgb(0 0 0 / 20%) !important;
  }

  .card-body {
    padding-left: 1.25rem !important;
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 1.25rem !important;
  }

  .fa-angle-right,
  .fa-angle-down {
    color: #343a40;
  }

  .header-content-page .title-page,
  .title-content-page .title,
  .title-page {
    font-size: 20px;
    line-height: normal;
    font-weight: 500;
    color: #343a40;
    margin: 0;
    font-family: Roboto, Arial, sans-serif;
  }

  #DadosGerais>.card,
  #obs>.card {
    background: #f7f7f7;
  }
</style>


<body class="hold-transition sidebar-mini layout-fixed">

  <script type="text/javascript" src="../config.js"></script>
  <div class="wrapper">

    <?php
    include_once('../../../menu.php');
    ?>

    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h3 class="col-mb=2"></h3>
            </div>
            <div class="col-sm-6">
              <ol class="breadcrumb float-sm-right">
                <li class="breadcrumb-item"><a href="./index">Início</a></li>
                <li class="breadcrumb-item"><a href="../pagar">Pagar</a></li>
                <li class="breadcrumb-item active">Cadastro</li>
              </ol>
            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <div class="card" style="height:auto;">
                <div class="card-header bg-dark">
                  <div class="row flex">
                    <h4 class="text-white">Cadastro Contas a Pagar </h4>
                    <button title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial">
                      <i class="fas fa-question-circle"></i>
                    </button>
                  </div>
                </div>
                <fieldset>
                  <div class="card-body" style="padding-left: 0rem!important; padding-right: 0rem!important;">
                    <form id="msform" name="msform">
                      <div class="card card-header" role="tab" id="geral">
                        <a style="width:100%;" data-toggle="collapse" data-parent="#DadosGerais" href="#DadosGerais" aria-expanded="true" aria-controls="collapseOne1">
                          <div class="row">
                            <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                              <i class="fas fa-angle-down"></i>
                            </div>
                            <div class="col-11">
                              <h4 class="title-page">
                                Dados Gerais
                              </h4>
                            </div>
                          </div>
                        </a>
                      </div>
                      <div class="collapse show" id="DadosGerais">
                        <div class="card card-body">
                          <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="dados-tab">
                            <input type="text" required class="input-default focus form-control validate d-none" id="txtEmpId" name="txtEmpId">
                            <input type="text" class="d-none" id="txtNum_ap">
                            <div class="form-row">
                              <div class="form-group col-md-2 col-12" id="NotaFiscalInfoTour">
                                <label>Nota Fiscal *</label>
                                <div class="relative">
                                  <input type="text" maxlength="10" autocomplete="off" value="" class="input-default focus form-control validate" required="required" pattern="[0-9]+$" id="txtNotaFiscal" name="txtNotaFiscal">
                                </div>
                              </div>

                              <div class="form-group col-md-2 col-12 d-none" id="DupliInfoTour">
                                <label>Dupli</label>
                                <div class="relative">
                                  <input type="text" maxlength="10" autocomplete="off" value="" class="input-default focus form-control validate" pattern="[0-9]+$" id="txtDupli" name="txtDupli" readonly>
                                </div>
                              </div>

                              <div class="form-group group-default col-md-2 col-12">
                                <label>Data de Emissão</label>
                                <div class="relative" id="DataEmissao">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control validate" id="txtDTemissao" name="txtDTemissao">
                                </div>
                              </div>

                              <div class="form-group col-6" id="FornecedorInfoTour">
                                <label data-error="wrong" data-success="right" for="txtFornecedor">Fornecedor *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtFornecedor" name="txtFornecedor" class="form-control" placeholder="Fornecedor">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Fornecedor" name="btn-Fornecedor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Fornecedor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>


                              <div class="d-none">
                                <input type="text" autocomplete="off" maxlength="13" value="" class="input-default focus form-control validate" id="txtValorPago" name="txtValorPago">
                              </div>

                              <div class="form-group group-default col-md-2 col-12" id="divStatus">
                                <label for="Sstatus">Status *</label>
                                <div class="relative">
                                  <select id="txtStatus" name="txtStatus" class="input-default focus form-control validate" required>
                                    <option value="" selected>Selecione uma opção</option>
                                    <option value="DUPL" id="1">Duplicata</option>
                                    <option value="ANTE" id="2">Antecipação</option>
                                    <option value="ORCA" id="3">Orçamento</option>
                                  </select>
                                </div>
                              </div>
                              <div class="col-md-3 col-12" id="ClasseInfoTour">
                                <label data-error="wrong" data-success="right" for="txtClasse">Classe *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" required class="input-default focus form-control" id="txtClasse" name="txtClasse" class="form-control" placeholder="Classe">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Classe" name="btn-Classe" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Classe" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-md-3 col-12 form-group" id="BancoInfoTour">
                                <label data-error="wrong" data-success="right" for="txtBanco">Banco *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtBanco" name="txtBanco" class="form-control" placeholder="Banco">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Banco" name="btn-Banco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Banco" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>

                              <div class="col-md-3 col-12 form-group" id="ContaInfoTour">
                                <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="btn-Conta" name="btn-Conta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Conta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-md-3 col-12 form-group" id="SituacaoInfoTour">
                                <label data-error="wrong" data-success="right" for="txtSituacao">Situação *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtSituacao" name="txtSituacao" class="form-control" placeholder="Situação">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Situacao" name="btn-Situacao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Situacao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12" id="ValorInfoTour">
                                <label>Valor Total *</label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" maxlength="10" value="" class="input-default focus form-control validate" id="txtValor" name="txtValor">
                                </div>
                              </div>

                              <div class="form-group group-default col-md-2 col-12 divParcela" id="ValorParcelaInfoTour">
                                <label>Valor Parcela</label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" maxlength="10" value="" class="input-default focus form-control validate" id="txtValorParcela" name="txtValorParcela">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12 divParcela" id="ParcelaInfoTour">
                                <label>Parcelas *</label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" value="1" class="input-default focus form-control validate" id="txtParcela" name="txtParcela">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12 divParcela" id="IntervaloDiasInfoTour">
                                <label>Intervalo dias </label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtIntervaloDias" name="txtIntervaloDias" value="0">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12">
                                <label>1º Vencimento</label>
                                <div class="relative">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control validate" id="txtDTvencimento" name="txtDTvencimento">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12 d-none" id="labelParcela">
                                <label style="color: red; font-size: 19px; margin-top: 33px;"></label>
                              </div>
                              <div class="form-group group-default col-md-1 col-12 divParcela">
                                <div class="form-check" style="margin-top: 27px;">
                                  <input class="form-check-input" type="checkbox" id="cbVenctoMesmoDia"> <label for="cbVenctoMesmoDia">Vencimento no mesmo dia</label>
                                </div>
                              </div>
                              <div class="form-group group-default col-md-1 col-12 divParcela">
                                <input id="btnGerarAp" style="font-size:15px; float: left; margin-top: 23px;" class="btn btn-danger btn-sisp action-button" value="Gerar AP's">
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="card card-header" role="tab" id="observacao">
                        <a style="width:100%;" data-toggle="collapse" data-parent="#obs" href="#obs" aria-expanded="true" aria-controls="collapseOne1">
                          <div class="row">
                            <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                              <i class="fas fa-angle-right"></i>
                            </div>
                            <div class="col-11">
                              <h4 class="title-page">
                                Observação
                              </h4>
                            </div>
                          </div>
                        </a>
                      </div>
                      <div class="collapse" id="obs">
                        <div class="card card-body">
                          <div class="form-row pt-2">
                            <div class="form-group group-default col-12">
                              <label>Observação</label>
                              <textarea style="resize: none" id="txtObs" placeholder="Observação" class="input-default focus form-control validate" rows="4"></textarea>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="col-12" style="margin-top: 10px">
                        <table id="tabelaParcelas" class="table table-responsive-sm table-select table-hover" width="100%">
                          <thead>
                            <tr>
                            </tr>
                          </thead>
                          <tbody>
                          </tbody>
                        </table>
                      </div>
                      <div class="group-button mr-2">
                        <input id="btnGravar" type="submit" style="font-size:15px;" class="btn btn-danger btn-sisp action-button" value="Gravar">
                        <button type="button" id="btnVoltar" style="font-size:15px;" class="btn btn-success btn-sisp action-button-previous" data-dismiss="modal">Voltar</button>
                      </div>
                    </form>
                  </div>
                </fieldset>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>


    <aside class="control-sidebar control-sidebar-dark">

    </aside>
    <?php
    include_once('../../../footer.php');
    ?>
    <?php include_once('../../../menu_fiscal.php'); ?>
  </div>

  <script src="../plugins/jquery/jquery.min.js?versao=3.239.11.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.239.11.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.239.11.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.239.11.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.239.11.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.239.11.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.239.11.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.239.11.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.239.11.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.239.11.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.239.11.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.239.11.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.239.11.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.239.11.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.239.11.1"></script>
  <script src="../utils/funcoes.js?versao=3.239.11.1"></script>
  <script src="../utils/cookies.js?versao=3.239.11.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.239.11.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;
      sArquivo = `${BASE_URI}/pages/pagar/cadastro_pagar/pagar.js?versao=3.239.11.1`;
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

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

      const permissaoUsuarioLogado = await permissaoAcessos("PAGAR");

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

      await insereJavaScriptPagina(sArquivo);

      habilitaCamposObrigatoriosTela(nomeTela);
    });
  </script>
</body>

</html>