<?php include_once('../../config.php') ?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title> </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="dist/css/custom.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="dist/css/dataTables.bootstrap4.min.css?versao=3.2511.13.1" type="text/css" />
  <link rel="stylesheet" href="dist/css/driver.min.css?versao=3.2511.13.1" type="text/css" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="dist/css/sisplan.newColorsButtons.css?versao=3.2511.13.1" type="text/css" />
  <link rel="stylesheet" href="dist/css/sisplan.adjustDataTableButtons.css?versao=3.2511.13.1" type="text/css" />
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.2511.13.1" type="text/css">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.2511.13.1">
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
  <link rel="shortcut icon" href="favicon.ico">
  <style>
    #tabelaEstorno td div button {
      padding: .0rem .5rem;
      margin: .0rem;
    }

    #tabelaEstorno td {
      padding: 5px 8px !important;
    }

    .table.dataTable tbody td {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }

    .table.dataTable thead th {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }

    input[type="button"] {
      border: 0;
      outline: none;
      padding: 10px 15px;
      cursor: pointer;
    }
  </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">Estorno de Pagamento de Terceiros</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>
        </div>
        <div class="card col-12 container-fluid">
          <div id="campostour">
            <div class="row card-body d-flex justify-content-start">
              <div class="form-group col-12 col-lg-4">
                <label for="txtRetornoDe">Retorno de/até:</label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="txtRetornoDe">
                    <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="txtRetornoAte">
                  </div>
                </div>
              </div>
              <div class="form-group col-12 col-lg-4">
                <label for="txtPagamentoDe">Pagamento de/até:</label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="txtPagamentoDe">
                    <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="txtPagamentoAte">
                  </div>
                </div>
              </div>
              <div class="form-group col-12 col-lg-4">
                <label for="txtEnvioDe">Envio de/até:</label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="txtEnvioDe">
                    <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="txtEnvioAte">
                  </div>
                </div>
              </div>
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="txtPeriodoDe">Período de:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control validate" id="txtPeriodoDe" name="txtPeriodoDe" placeholder="Período">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnPeriodoDe" name="btnPeriodoDe" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaPeriodoDe" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="txtPeriodoAte">Período até:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control validate" id="txtPeriodoAte" name="txtPeriodoAte" placeholder="Período">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnPeriodoAte" name="btnPeriodoAte" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaPeriodoAte" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="txtNumeroAP">Número AP: *</label>
                <div class="input-group">
                  <input type="number" class="input-default focus form-control validate" id="txtNumeroAP" name="txtNumeroAP" placeholder="Número AP">
                </div>
              </div>
              <div class="col-lg-6 col-sm-12 form-group">
                <label data-error="wrong" data-success="right" for="txtPedido">Pedido: </label>
                <div class="relative">
                  <div class="input-group">
                    <select class="js-example-programmatic js-states form-control" id="txtPedido" name="txtPedido" multiple="multiple"></select>
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnPedido" name="btnPedido" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaPedido" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-lg-6 col-sm-12 form-group">
                <label data-error="wrong" data-success="right" for="txtSetor">Setor: </label>
                <div class="relative">
                  <div class="input-group">
                    <select class="js-example-programmatic js-states form-control" id="txtSetor" name="txtSetor" multiple="multiple"></select>
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnSetor" name="btnSetor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaSetor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-lg-6 col-sm-12 form-group">
                <div class="icheck-primary d-inline" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas as Facções selecionadas na pesquisa, se desmarcado, desconsidera as Facções selecionadas na pesquisa e filtra por todas as outras Facções.">
                  <input type="checkbox" class="icheck-primary" value="S" id="cbConsideraFaccao" checked><label for="cbConsideraFaccao"></label>
                </div>
                <label data-error="wrong" data-success="right" for="txtFaccao">Facção: </label>
                <div class="relative">
                  <div class="input-group">
                    <select class="js-example-programmatic js-states form-control" id="txtFaccao" name="txtFaccao" multiple="multiple"></select>
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnFaccao" name="btnFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-lg-6 col-sm-12 form-group">
                <div class="icheck-primary d-inline" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas as OF's selecionadas na pesquisa, se desmarcado, desconsidera as OF's selecionadas na pesquisa e filtra por todas as outras OF's.">
                  <input type="checkbox" class="icheck-primary" value="S" id="cbConsideraOF" checked><label for="cbConsideraOF"></label>
                </div>
                <label data-error="wrong" data-success="right" for="txtOF">OF: </label>
                <div class="relative">
                  <div class="input-group">
                    <select class="js-example-programmatic js-states form-control" id="txtOF" name="txtOF" multiple="multiple"></select>
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnOF" name="btnOF" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaOF" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
              </div>
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="txtPeriodoDe">Tipo:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control validate" id="txtTipo" name="txtTipo" placeholder="Tipo">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnTipo" name="btnTipo" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaTipo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="form-group align-content-end ml-2">
                <button type="button" id="btnConsultar" name="btnConsultar" class="btn btn-primary btn-sisp" value="Consultar"><span class="fas fa-search"></span> Consultar</button>
              </div>
              <div class="row col-lg-12 col-12" style="margin: 0px!important; padding: 0px!important;">
                <div class="col-lg-12 table-responsive" style="max-height: 450px">
                  <table id="tabelaEstorno" class="table table-sm-sisp table-select table-hover" width="100%">
                    <thead>
                    </thead>
                    <tbody>
                    </tbody>
                  </table>
                </div>
                <div class="col-12 mt-4">
                  <button type="button" id="btnReabrirPgto" class="btn btnVerde btn-sisp d-none"><span class="fas fa-save"></span> Reabrir Pagamento</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  <?php
  include_once('../../modais.php');
  ?>

  <script src="plugins/jquery/jquery.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 type="text/javascript" src="dist/js/loadingoverlay.min.js?versao=3.2511.13.1"></script>

  <!-- jQuery UI 1.11.4 -->
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.2511.13.1"></script>
  <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  <script>
    $.widget.bridge('uibutton', $.ui.button)
  </script>
  <!-- Bootstrap 4 -->
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2511.13.1"></script>
  <!-- AdminLTE App -->
  <script src="dist/js/adminlte.min.js?versao=3.2511.13.1"></script>

  <script src="dist/js/sisplan.js?versao=3.2511.13.1"></script>
  <script type="text/javascript" src="utils/funcoes.js?versao=3.2511.13.1"></script>
  <!-- SweetAlert2 -->
  <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 src="dist/js/requisicoes.js?versao=3.2511.13.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.2511.13.1"></script>
  <script src="utils/cookies.js?versao=3.2511.13.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.2511.13.1"></script>
  <script src="pages/loja/js/rotinas.js?versao=3.2511.13.1"></script>
  <script src="dist/js/dataTables.keyTable.js?versao=3.2511.13.1"></script>
  <script src="dist/js/driver.min.js?versao=3.2511.13.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.2511.13.1"></script>
  <script src="plugins/jquery-validation/additional-methods.min.js?versao=3.2511.13.1"></script>
  <script type="text/javascript" src="config.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('FACESTORNOPAG');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/facestornopag/facestornopag.js?versao=3.2511.13.1`;
      insereJavaScriptPagina(sArquivo);
    });
  </script>
</body>

</html>