<?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="plugins/fontawesome-free/css/all.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css?versao=3.255.7.1">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>

  <link rel="stylesheet" href="dist/css/custom.css?versao=3.255.7.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.255.7.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.255.7.1">

  <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.255.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.255.7.1" />
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.255.7.1">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="dist/css/select.bootstrap.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.255.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.255.7.1" />

  <style>
    /* #tabelaEstorno td div button {
      padding: .0rem .5rem;
      margin-top: .1rem;
      margin-bottom: .2rem;
    }

    #tabelaEstorno td {
      padding: 0 !important;
      padding-left: 10px !important;
    } */

    .content-wrapper {
      margin-left: 0px !important;
    }

    .main-header,
    .main-sidebar {
      display: none;
    }

    #tabelaEstorno tbody td {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      padding: 4px !important;
    }

    #separador {
      padding: 1.5rem;
      border-top: 2px outset #ddd;
      box-shadow: none !important;
      margin-top: 35px;
      padding-top: 20px;
    }

    .form-group {
      margin-bottom: 0px !important;
    }

    input[type="button"] {
      border: 0;
      outline: none;
      padding: 10px 15px;
      cursor: pointer;
    }
  </style>

  <link rel="stylesheet" href="./plugins/toastr/toastr.min.css">
</head>

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


  <div class="wrapper">
    <?php
    include_once('../../menu.php');
    ?>
    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row">
            <div class="col-12">
              <fieldset>
                <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-bottom: 2px solid var(--primary-color);">
                        <h2>Estorno de Pagamento de Terceiros
                          <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">
                            <div class="row d-flex justify-content-center">
                              <div class="col-12">
                                <div class="card-body">
                                  <div class="form-card" id="campostour">

                                    <div class="row">
                                      <div class="form-group col-12 col-lg-4">
                                        <label for="txtRetornoDe">Retorno De/Até:</label>
                                        <div class="d-block d-sm-flex mt-2 mt-sm-0">
                                          <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control mr-2 mt-2 mt-sm-0" style="border-radius: 4px 0 0 4px;" id="txtRetornoDe">
                                          <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control mt-2 mt-sm-0" style="border-radius: 0 4px 4px 0;" id="txtRetornoAte">
                                        </div>
                                      </div>

                                      <div class="form-group col-12 col-lg-4">
                                        <label for="txtPagamentoDe">Pagamento De/Até:</label>
                                        <div class="d-block d-sm-flex mt-2 mt-sm-0">
                                          <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control mr-2 mt-2 mt-sm-0" style="border-radius: 4px 0 0 4px;" id="txtPagamentoDe">
                                          <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control mt-2 mt-sm-0" style="border-radius: 0 4px 4px 0;" id="txtPagamentoAte">
                                        </div>
                                      </div>

                                      <div class="form-group col-12 col-lg-4">
                                        <label for="txtEnvioDe">Envio De/Até:</label>
                                        <div class="d-block d-sm-flex mt-2 mt-sm-0">
                                          <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control mr-2 mt-2 mt-sm-0" style="border-radius: 4px 0 0 4px;" id="txtEnvioDe">
                                          <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control mt-2 mt-sm-0" style="border-radius: 0 4px 4px 0;" id="txtEnvioAte">
                                        </div>
                                      </div>
                                    </div>

                                    <div class="row mt-2">
                                      <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="2402">
                                          <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="2405">
                                          <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="123456">
                                        </div>
                                      </div>
                                    </div>

                                    <div class="row mt-2">
                                      <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>

                                    <div class="row mt-2">
                                      <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>

                                    <div class="row justify-content-lg-between justify-content-center align-center mt-2">
                                      <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="2">
                                          <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="mt-4">
                                        <input type="button" id="btnConsultar" name="btnConsultar" class="btn btn-danger mr-2 px-5" value="Consultar">
                                      </div>

                                    </div>



                                    <div class="card-body d-none" id="separador">

                                      <div class="col-sm-12 table-responsive card-body">
                                        <table id="tabelaEstorno" class="table table-sm table-select table-hover" width="100%">
                                          <thead>
                                          </thead>
                                          <tbody>
                                          </tbody>
                                        </table>
                                      </div>

                                      <div class="row mt-4 justify-content-center justify-content-lg-end">
                                        <input type="button" id="btnReabrirPgto" value="Reabrir Pagamento" class="btn bg-gradient-success btn-sisp" style="margin-right: 7px;">
                                      </div>
                                    </div>

                                  </div>
                                </div>
                              </div>
                          </form>
                        </div>
                      </div>
                    </div>
                  </div>

              </fieldset>
            </div>
          </div>
        </div>
      </div>
    </div>


    <aside class="control-sidebar control-sidebar-dark">
    </aside>
    <?php include_once('../../modais.php'); ?>
  </div>



  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.content-wrapper -->
  <?php
  include_once('../../modais.php');
  ?>
  </div>
  <!-- ./wrapper -->

  <script src="plugins/jquery/jquery.min.js?versao=3.255.7.1"></script>

  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="dist/js/loadingoverlay.min.js?versao=3.255.7.1"></script>

  <!-- jQuery UI 1.11.4 -->
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.255.7.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.255.7.1"></script>
  <!-- AdminLTE App -->
  <script src="dist/js/adminlte.min.js?versao=3.255.7.1"></script>

  <script src="dist/js/sisplan.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="utils/funcoes.js?versao=3.255.7.1"></script>
  <!-- SweetAlert2 -->
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.255.7.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.255.7.1"></script>
  <script src="utils/cookies.js?versao=3.255.7.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.255.7.1"></script>
  <script src="pages/loja/js/rotinas.js?versao=3.255.7.1"></script>
  <script src="dist/js/dataTables.keyTable.js?versao=3.255.7.1"></script>
  <script src="dist/js/driver.min.js?versao=3.255.7.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.255.7.1"></script>
  <script src="plugins/jquery-validation/additional-methods.min.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="config.js?versao=3.255.7.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.255.7.1`;
      insereJavaScriptPagina(sArquivo);
    });
  </script>
</body>

</html>