<?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 | Liberação Solicitação de Compra</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="dist/css/adminlte.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" href="plugins/select2/css/select2.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="dist/css/select.bootstrap.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="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.255.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.255.7.1" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.255.7.1">
  <style>
    .radioStyle {
      border: solid #e0e4e6;
      border-radius: 4px;
      border-width: 2px;
      padding: 7.25px;
      height: 136px;
    }

    .campoSel {
      display: inline-block;
      position: absolute;
      width: 22px;
      height: 22px;
      border: 1px solid #D3CFC8;
      border-radius: 0;
    }

    .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;
      border-radius: 3px !important;
    }

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

    #tabelaSc tbody td,
    #tabelaMaterial tbody td,
    #tabelaProduto tbody td,
    #tabelaServico tbody td {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      padding: 0 !important;
      padding-left: 10px !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">
              </div>
              <div class="col-sm-6">
              </div><!-- /.col -->
              <div class="container-fluid" id="grad1">
                <div class="row justify-content-center mt-0">
                  <div class="col-12">
                    <div class="card mb-0">
                      <div class="card-header" style="border: none!important;box-shadow:none!important;">
                        <h2 class="m-0">Liberação de Solicitação de Compra
                          <button title="Tutorial" type="button" class="btn btn-info btn-sm ml-2" style="color: white;" id="tutorial">
                            <i class="fas fa-question-circle"></i>
                          </button>
                        </h2>
                      </div>
                      <div class="container-fluid">
                        <div class="row card-body" id="abaGeral">
                          <div id="tutorialFiltros" class="row card-body">
                            <div class="col-lg-4 col-sm-12 form-group">
                              <label data-error="wrong" data-success="right" for="txtEmissao">Emissão De/Até:</label>
                              <div class="input-group">
                                <input type="date" value="1200-01-01" max="2500-12-31" class="input-default focus form-control mr-1" id="txtEmissaoDe" name="txtEmissaoDe">
                                <input type="date" value="2500-12-21" max="2500-12-31" class="input-default focus form-control" id="txtEmissaoAte" name="txtEmissaoAte">
                              </div>
                            </div>

                            <div class="col-lg-8 form-group"></div>

                           
                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtNumero">Solicitações de Compras: </label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtNumero" name="txtNumero" multiple="multiple"></select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnNumero" name="btnNumero" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                  <button class="btn bg-danger" id="btnLimpaNumero" name="btnLimpaNumero" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtSetor">Setor: </label>
                              <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" name="btnLimpaSetor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtSolicitante">Solicitante: </label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtSolicitante" name="txtSolicitante" multiple="multiple"></select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnSolicitante" name="btnSolicitante" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                  <button class="btn bg-danger" id="btnLimpaSolicitante" name="btnLimpaSolicitante" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtPedido">Pedido:</label>
                              <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" name="btnLimpaPedido" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtNumOF">Num. OF:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtNumOF" name="txtNumOF" multiple="multiple"></select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnNumOF" name="btnNumOF" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                  <button class="btn bg-danger" id="btnLimpaNumOF" name="btnLimpaNumOF" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtTipo">Tipo:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtTipo" name="txtTipo" multiple="multiple"></select>
                                <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" name="btnLimpaTipo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtCentroCusto">Centro Custo:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtCentroCusto" name="txtCentroCusto" multiple="multiple"></select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnCentroCusto" name="btn-CentroCusto" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                  <button class="btn bg-danger" id="btnLimpaCentroCusto" name="btnLimpaCentroCusto" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>

                            <div class="col-lg-4 form-group">
                              <label data-error="wrong" data-success="right" for="txtObs">Observação</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" id="txtObs" name="txtObs" placeholder="Observação">
                              </div>
                            </div>

                            <div class="col-lg-4 form-group"></div>



                            <div class="col-sm-4 form-group d-flex">
                              <fieldset class="w-100 form border-Field mb-0 pb-0">
                                <legend class="textoBorda mb-0 pb-0">Status Liberação</legend>
                                <div class="">
                                  <div class="icheck-primary"><input type="radio" checked id="rdTodos" name="statusLiberacao"><label class="container p-0 m-0" for="rdTodos">Todos </label></div>
                                  <div class="icheck-primary"><input type="radio" id="rdLiberada" name="statusLiberacao"><label class="container p-0 m-0" for="rdLiberada">Liberada</label></div>
                                  <div class="icheck-primary"><input type="radio" id="rdBloqueada" name="statusLiberacao"> <label class="container p-0 m-0" for="rdBloqueada">Bloqueada</label></div>
                                  <div class="icheck-primary"><input type="radio" id="rdBloqDiretoria" name="statusLiberacao"><label class="container p-0 m-0" for="rdBloqDiretoria">Bloqueada / Diretoria</label></div>
                                </div>
                              </fieldset>
                            </div>


                            <div class="col-sm-4 form-group d-flex">
                              <fieldset class="w-100 form border-Field mb-0 pb-0">
                                <legend class="textoBorda mb-0 pb-0">Situação</legend>
                                <div class="">
                                  <div class="icheck-primary"><input type="radio" checked id="rdTodosSit" name="situacao"><label for="rdTodosSit" class="container p-0 m-0">Todos</label></div>
                                  <div class="icheck-primary"><input type="radio" id="rdSemOrdem" name="situacao"><label for="rdSemOrdem" class="container p-0 m-0">Sem Ordem de Compra</label></div>
                                  <div class="icheck-primary"><input type="radio" id="rdComOrdem" name="situacao"><label for="rdComOrdem" class="container p-0 m-0">Com Ordem de Compra</label></div>
                                </div>
                              </fieldset>
                            </div>
                          </div>

                          <div class="col-sm-12 align-end d-flex justify-content-end mt-4">
                            <div class="button-group">
                              <button class="btn btn-primary btn-sisp" id="btnConsultar"><span class="fas fa-search"></span> Consultar</button>
                            </div>
                          </div>

                          <div class="card col-sm-12 table-responsive card-body" id="tutorialTabelaSolicitacoes">
                            <h5>Solicitações de Compras</h5>
                            <table id="tabelaSc" class="table table-sm table-select table-hover" width="100%">
                            </table>
                          </div>

                          <div class="col-sm-12 d-flex justify-content-end">
                            <button id="btnLiberar" class="btn btn-danger btn-sisp">Confirmar</button>
                          </div>

                        </div>

                      </div>
                    </div>

                    <div id="modal-itens" 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">Itens da Solicitação</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>

                          <div class="">
                            <ul class="nav nav-tabs justify-content-center" id="custom-content-below-tab" role="tablist">
                              <li class="nav-item">
                                <a class="nav-link active" id="abaMaterial" data-toggle="pill" href="#conteudoAbaMaterial" role="tab" aria-controls="conteudoAbaMaterial" aria-selected="false" style="color: var(--font-color) !important">Material</a>
                              </li>
                              <li class="nav-item">
                                <a class="nav-link" id="AbaProduto" data-toggle="pill" href="#conteudoAbaProduto" role="tab" aria-controls="conteudoAbaProduto" aria-selected="false" style="color: var(--font-color) !important">Produto</a>
                              </li>
                              <li class="nav-item">
                                <a class="nav-link" id="abaServico" data-toggle="pill" href="#conteudoAbaServico" role="tab" aria-controls="conteudoAbaServico" aria-selected="true" style="color: var(--font-color) !important">Serviço</a>
                              </li>
                            </ul>

                            <div class="tab-content" id="custom-content-below-tabContent">
                              <div class="tab-pane fade active show" id="conteudoAbaMaterial" role="tabpanel" aria-labelledby="abaMaterial">
                                <div class="col-sm-12 table-responsive card-body">
                                  <table id="tabelaMaterial" class="table table-sm table-select table-hover" width="100%">
                                  </table>
                                </div>
                              </div>
                              <div class="tab-pane fade" id="conteudoAbaProduto" role="tabpanel" aria-labelledby="AbaProduto">
                                <div class="col-sm-12 table-responsive card-body">
                                  <table id="tabelaProduto" class="table table-sm table-select table-hover" width="100%">
                                  </table>
                                </div>
                              </div>
                              <div class="tab-pane fade" id="conteudoAbaServico" role="tabpanel" aria-labelledby="abaServico">
                                <div class="col-sm-12 table-responsive card-body">
                                  <table id="tabelaServico" class="table table-sm table-select table-hover" width="100%">
                                  </table>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>

                  </div>
                </div>
              </div>
            </div>
      </section>
    </div>
  </div>
  <?php
  include_once('../../modais.php');
  ?>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  <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 src="plugins/jquery-ui/jquery-ui.min.js?versao=3.255.7.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.7.1"></script>
  <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 src="utils/funcoes.js?versao=3.255.7.1"></script>
  <script src="utils/cookies.js?versao=3.255.7.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.255.7.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/driver.min.js?versao=3.255.7.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="dist/js/sum().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('LIBERACAO_SOLICITACAO_COMPRA');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

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

    });
  </script>
</body>

</html>