<?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 | Manutenção Cashback</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.264.8.1">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.264.8.1">

  <!-- Google Font: Source Sans Pro -->
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">

  <link rel="stylesheet" href="dist/css/custom.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/sisplan.adjustDatatableButtons.css?versao=3.264.8.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.264.8.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.264.8.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.264.8.1" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.264.8.1">

  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.264.8.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/cards-financeiro.css">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.264.8.1">

  <style>
    #tabelaCashback td {
      padding: 0 !important;
      padding-left: 10px !important;
    }

    .border-Field .textoBorda {
      font-size: 1.0em !important;
      text-align: left !important;
      width: auto;
      padding: 0 10px;
      border-bottom: none;
    }

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

    ;
  </style>
</head>

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

    <div class="content-wrapper">
      <section class="content">
        <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">Manutenção Cashback</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" id="divTabelaCashback">
            <div class="row card">
              <div class="col-sm-12 mt-3 ml-3">
                <button class="btn btn-success btn-sisp" id="btnFiltros"><span class="fas fa-search"></span> Filtros</button>
                <button class="btn btn-danger btn-sisp" id="btnIncluir"><span class="fas fa-plus"></span> Incluir</button>
                <button id="btnImprimir" class="btn-sisp btn btn-secondary"><i class="fas fa-print"></i> Imprimir</button>
              </div>
              <div class="col-sm-12 mt-3 row" id="boxDashboard">
                <div class="col-md-3 col-sm-12 col-12">
                  <div id="valortotal" class="info-box">
                    <span class="info-box-icon text-white" style="background-color:var(--info-box-primary)"><i class="fas fa-chart-bar"></i></span>

                    <div class="info-box-content">
                      <span class="info-box-text">Total Pontos</span>
                      <span class="info-box-number" id="txtTotalPontos">0</span>
                    </div><!-- /.info-box-content -->
                  </div><!-- /.info-box -->
                </div> <!-- /.col -->
                <div class="col-md-3 col-sm-12 col-12">
                  <div id="valorpago" class="info-box">
                    <span class="info-box-icon text-white" style="background-color:var(--info-box-primary)"><i class="fas fa-dollar-sign"></i></span>

                    <div class="info-box-content">
                      <span class="info-box-text">Total Entrada</span>
                      <span class="info-box-number" id="txtValoresGerados">R$ 0</span>
                    </div><!-- /.info-box-content -->
                  </div><!-- /.info-box -->
                </div> <!-- /.col -->
                <div class="col-md-3 col-sm-12 col-12">
                  <div id="valorsaldo" class="info-box">
                    <span class="info-box-icon text-white" style="background-color:var(--info-box-danger)"><i class="fas fa-dollar-sign"></i></span>

                    <div class="info-box-content">
                      <span class="info-box-text">Total Saída</span>
                      <span class="info-box-number" id="txtValoresUtilizados">R$ 0</span>
                    </div><!-- /.info-box-content -->
                  </div><!-- /.info-box -->
                </div> <!-- /.col -->
                <div class="col-md-3 col-sm-12 col-12">
                  <div id="valorsaldo" class="info-box">
                    <span class="info-box-icon text-white" style="background-color:var(--info-box-success)"><i class="fas fa-dollar-sign"></i></span>

                    <div class="info-box-content">
                      <span class="info-box-text">Saldo Disponível</span>
                      <span class="info-box-number" id="txtSaldoDisponivel">R$ 0</span>
                    </div><!-- /.info-box-content -->
                  </div><!-- /.info-box -->
                </div> <!-- /.col -->
              </div><!-- right col -->
              <div class="col-sm-12 table-responsive card-body" id="divCashback">
                <h5>Lista de Cashback</h5>
                <table id="tabelaCashback" class="table table-sm table-select table-hover" width="100%">
                  <thead>
                    <tr>
                      <th class="th-sm">Id</th>
                      <th class="th-sm">Codcli</th>
                      <th class="th-sm">Nome</th>
                      <th class="th-sm">Valor</th>
                      <th class="th-sm">Pontos</th>
                      <th class="th-sm">Data</th>
                      <th class="th-sm">Docto</th>
                      <th class="th-sm">Tipo</th>
                      <th class="th-sm">EmpID</th>
                      <th class="th-sm">Obs</th>
                      </th>
                    </tr>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </section>
      <div id="modal-filtros" 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">Filtros</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 p-2">
                <div class="col-6 form-group" id="ClienteInfoTour">
                  <label data-error="wrong" data-success="right" for="txtCliente">Cliente </label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtCliente" name="txtCliente" class="form-control" placeholder="Cliente">
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btn-cliente" name="btn-Cliente" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btn-limpa-Cliente" name="btn-limpa-Cliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
                <div class="col-6 form-group">
                  <label data-error="wrong" data-success="right" for="txtDataDe">Data de/até</label>
                  <div class="input-group">
                    <input type="date" class="input-default focus form-control" id="txtDataDe" name="txtDataDe" />
                    <input type="date" class="input-default focus form-control" id="txtDataAte" name="txtDataAte" />
                  </div>
                </div>
                <div class="col-9"></div>
                <div class="col-3 d-flex justify-content-start align-items-center" style="margin-top: 0.5rem;">
                  <button class="btn btn-danger btn-sisp btn-block" type='button' id="btnSelecionarEmpresas">Selecionar Empresas</button>
                </div>
              </div>
            </div>
            <div class="modal-footer justify-content-start pl-0">
              <div class="row col-12">
                <div class="col-xl-4 col-12">
                  <label for="txtOrdem">Opção de Relatório:</label>
                  <div class="relative d-flex align-items-center">
                    <select id="txtOrdem" class="input-default focus custom-select">
                    </select>
                    <button class="btn btn-sm btn-success ml-2 btnEdicaoRelatorio" title="Edição de ordenações">
                      <i class="fas fa-check"></i>
                    </button>
                  </div>
                </div>
                <div class="col-6 col-lg-8 d-flex justify-content-end align-items-end pr-0">
                  <div class="d-flex">
                    <button class="btn btn-primary btn-sisp mr-2" id="btnLimparFiltros" style="background-color: #B22222; border-color: #B22222">
                      <span class="fas fa-trash"></span> Limpar Filtros
                    </button>
                    <button id="btnConsultar" class="btn btn-primary btn-sisp" type="button">
                      <span class="fas fa-search"></span> Consultar
                    </button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id="modal-incluir" 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">Filtros</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 p-2 p-md-4">
                <div class="col-12 col-lg-3 mt-3 justify-content-sm-start justify-content-center">
                  <fieldset class="form border-Field p-0">
                    <legend class="textoBorda pb-0 mb-0">Tipo de Operação</legend>
                    <div class="form-row">
                      <label class="labelCheck"><input type="radio" checked id="rdEntrada" name="rdFiltroOperacao"><span class="checkmark"></span>  Entrada</label>
                      <label class="labelCheck ml-3"><input type="radio" id="rdSaida" name="rdFiltroOperacao"><span class="checkmark"></span>  Saída </label>
                    </div>
                  </fieldset>
                </div>
                <div class="col-12 col-lg-9 form-group" id="IncluirClienteInfoTour">
                  <label data-error="wrong" data-success="right" for="txtCliente">Cliente* </label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtIncluirCliente" name="txtIncluirCliente" class="form-control" placeholder="Cliente">
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnIncluirCliente" name="btnIncluirCliente" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaIncluirCliente" name="btnLimpaIncluirCliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
                <div class="col-12 col-lg-4 form-group">
                  <label data-error="wrong" data-success="right" for="txtObs">Obs*</label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtObs" name="txtObs" class="form-control" placeholder="Observação">
                  </div>
                </div>
                <div class="col-12 col-lg-4 form-group">
                  <label data-error=" wrong" data-success="right" for="txtValorIncluir">Valor* </label>
                  <div class="input-group">
                    <input type="number" autocomplete="off" class="input-default focus form-control" id="txtValorIncluir" name="txtValorIncluir" class="form-control" placeholder="Valor">
                  </div>
                </div>
                <div class="col-12 col-lg-4 form-group">
                  <label data-error="wrong" data-success="right" for="txtIncluirPontos">Pontos*</label>
                  <div class="input-group">
                    <input type="number" autocomplete="off" class="input-default focus form-control" id="txtIncluirPontos" name="txtIncluirPontos" class="form-control" placeholder="Pontos">
                  </div>
                </div>
              </div>

            </div>

            <!-- <div class="modal-body">

              <div class="col-auto d-flex justify-content-sm-start justify-content-center">
                <fieldset class="form border-Field p-0">
                  <legend class="textoBorda pb-0 mb-0">Tipo de Operação</legend>
                  <div class="form-row">
                    <label class="labelCheck"><input type="radio" checked id="rdEntrada" name="rdFiltroOperacao"><span class="checkmark"></span>  Entrada</label>
                    <label class="labelCheck ml-3"><input type="radio" id="rdSaida" name="rdFiltroOperacao"><span class="checkmark"></span>  Saída </label>
                  </div>
                </fieldset>
              </div>

             <div class="row p-2">
                <div class="col-12 col-md-6 form-group" id="IncluirClienteInfoTour">
                  <label data-error="wrong" data-success="right" for="txtCliente">Cliente* </label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtIncluirCliente" name="txtIncluirCliente" class="form-control" placeholder="Cliente">
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnIncluirCliente" name="btnIncluirCliente" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaIncluirCliente" name="btnLimpaIncluirCliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
                <div class="col-12 col-md-6">
                  <label data-error="wrong" data-success="right" for="txtObs">Obs*</label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtObs" name="txtObs" class="form-control" placeholder="Observação">
                  </div>
                </div>
              </div>
              <div class="row p-2">
                <div class="col-12 col-md-6 form-group">
                  <label data-error=" wrong" data-success="right" for="txtValorIncluir">Valor* </label>
                  <div class="input-group">
                    <input type="number" autocomplete="off" class="input-default focus form-control" id="txtValorIncluir" name="txtValorIncluir" class="form-control" placeholder="Valor">
                  </div>
                </div>
                <div class="col-12 col-md-6 form-group">
                  <label data-error="wrong" data-success="right" for="txtIncluirPontos">Pontos*</label>
                  <div class="input-group">
                    <input type="number" autocomplete="off" class="input-default focus form-control" id="txtIncluirPontos" name="txtIncluirPontos" class="form-control" placeholder="Pontos">
                  </div>
                </div>
              </div>
            </div>-->
            <div class="modal-footer">
              <div class="row">
                <button class="btn btn-success btn-sisp mr-2" id="btnLimparFiltrosIncluir"></span> Limpar Filtros</button>
                <button class="btn btn-danger btn-sisp" id="btnGravar"></span> Gravar</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php
  include_once('../../modais.php');
  ?>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  </div>
  <script src="plugins/jquery/jquery.min.js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.264.8.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.264.8.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.264.8.1"></script>
  <script src="utils/cookies.js?versao=3.264.8.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.264.8.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/driver.min.js?versao=3.264.8.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.264.8.1"></script>

  <script type="text/javascript" src="dist/js/sum().js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="config.js?versao=3.264.8.1"></script>

  <script type="text/javascript" src="plugins/select2/js/select2.full.min.js?versao=3.264.8.1"></script>
  <script src="utils/funcoes.js?versao=3.264.8.1"></script>
  <script src="dist/js/sisplan.js?versao=3.264.8.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.264.8.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('CASHBACK');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/cashback/cashback.js?versao=3.264.8.1`;
      insereJavaScriptPagina(sArquivo);

    });
  </script>
</body>

</html>