<?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 Ordem 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.239.11.1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.239.11.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.239.11.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.239.11.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.239.11.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.239.11.1">
  <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">
  <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;
    }
  </style>
</head>

<body class="hold-transition sidebar-mini layout-fixed">
  <div class="wrapper">
    <?php
    include_once('../../menu.php');
    ?>

    <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">
                <ol class="breadcrumb float-sm-right">
                  <li class="breadcrumb-item"><a href="../index">Início</a></li>
                  <li class="breadcrumb-item active">Liberação O.C</li>
                </ol>
              </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 Ordem 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 class="col-lg-4 form-group">
                            <label data-error="wrong" data-success="right" for="txtDtEntregaDe">Período Entrega (de/até)</label>
                            <div class="input-group">
                              <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtEntregaDe" name="txtDtEntregaDe">
                              <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtEntregaAte" name="txtDtEntregaAte">
                            </div>
                          </div>

                          <div class="col-lg-4 form-group">
                            <label data-error="wrong" data-success="right" for="txtDtEmissaoDe">Período Emissão (de/até)</label>
                            <div class="input-group">
                              <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtEmissaoDe" name="txtDtEmissaoDe">
                              <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtEmissaoAte" name="txtDtEmissaoAte">
                            </div>
                          </div>

                          <div class="col-lg-4 form-group">
                            <label data-error="wrong" data-success="right" for="txtDtLiberadosDe">Liberados (de/até)</label>
                            <div class="input-group">
                              <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtLiberadosDe" name="txtDtLiberadosDe">
                              <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtLiberadosAte" name="txtDtLiberadosAte">
                            </div>
                          </div>

                          <div class="col-lg-12 form-group">
                            <label data-error="wrong" data-success="right" for="txtOc">Ordens de Compra </label>
                            <div class="input-group">
                              <input type="text" class="input-default col-lg-3 col-12 focus form-control" id="txtOc" name="txtOc" class="form-control" placeholder="Ordem de Compra">
                              <button class="btn bg-danger" id="btn-OcConsulta" name="btn-OcConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                              <input type="text" id="txtListaOcs" class="form-group col-lg-9 col-12 input-default focus form-control" placeholder="Lista de Ordens de Compra" disabled>
                              <button class="btn bg-danger" id="btn-limpa-Oc" name="btn-limpa-Oc" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                            </div>
                          </div>


                          <div class="col-lg-4 form-group">
                            <label data-error="wrong" data-success="right" for="txtFornecedor">Fornecedor </label>
                            <div class="input-group">
                              <input type="text" class="input-default focus form-control" id="txtFornecedor" name="txtFornecedor" 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" name="btn-limpa-Fornecedor" 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="txtStatus">Status </label>
                            <div class="input-group">
                              <input type="text" class="input-default focus form-control" id="txtStatus" name="txtStatus" placeholder="Status">
                              <div class="input-group-append">
                                <button class="btn bg-danger" id="btn-Status" name="btn-Status" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                <button class="btn bg-danger" id="btn-limpa-Status" name="btn-limpa-Status" 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="txtUserLib">Usuário Liberação</label>
                            <div class="input-group">
                              <input type="text" class="input-default focus form-control" id="txtUserLib" name="txtUserLib" placeholder="Usuário Liberação">
                              <div class="input-group-append">
                                <button class="btn bg-danger" id="btn-UserLib" name="btn-UserLib" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                <button class="btn bg-danger" id="btn-limpa-UserLib" name="btn-limpa-UserLib" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                              </div>
                            </div>
                          </div>

                          <div class="col-lg-6 form-group">
                            <label data-error="wrong" data-success="right" for="txtUserCadOC">Usuário Cad. OC</label>
                            <div class="input-group">
                              <input type="text" class="input-default focus form-control" id="txtUserCadOC" name="txtUserCadOC" placeholder="Usuário Cad. OC">
                              <div class="input-group-append">
                                <button class="btn bg-danger" id="btn-UserCadOC" name="btn-UserCadOC" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                <button class="btn bg-danger" id="btn-limpa-UserCadOC" name="btn-limpa-UserCadOC" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                              </div>
                            </div>
                          </div>

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

                          <div class="col-sm-3 text-left">
                            <label data-error="wrong" data-success="right">Filtro </label>
                            <div class="radioStyle">
                              <label class="container p-0 m-0">
                                <input type="radio" checked="checked" id="radioTodos" name="filtro">
                                <span class="checkmark"></span> Todos
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioAnalise" name="filtro">
                                <span class="checkmark"></span> Em Análise
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioLiberados" name="filtro">
                                <span class="checkmark"></span> Liberados
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioRejeitados" name="filtro">
                                <span class="checkmark"></span> Rejeitados
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioBloqueados" name="filtro">
                                <span class="checkmark"></span> Bloqueados
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioBloqDir" name="filtro">
                                <span class="checkmark"></span> Bloq./Diretoria
                              </label>
                            </div>
                          </div>

                          <div class="col-sm-3 text-left">
                            <label data-error="wrong" data-success="right">Hierarquia </label>
                            <div class="radioStyle">
                              <label class="container p-0 m-0">
                                <input type="radio" checked="checked" id="radioTodosHierarquia" name="hierarquia">
                                <span class="checkmark"></span> Todos
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioAguardandoLib" name="hierarquia">
                                <span class="checkmark"></span> Aguardando Lib.
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioDispLib" name="hierarquia">
                                <span class="checkmark"></span> Disp. Liberação
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioJaLiberado" name="hierarquia">
                                <span class="checkmark"></span> Já Liberado
                              </label>
                            </div>
                          </div>

                          <div class="col-sm-3 text-left">
                            <label data-error="wrong" data-success="right">Tipo </label>
                            <div class="radioStyle">
                              <label class="container p-0 m-0">
                                <input type="radio" checked="checked" id="radioTodosTipo" name="tipo">
                                <span class="checkmark"></span> Todos
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioMaterial" name="tipo">
                                <span class="checkmark"></span> Material
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioProduto" name="tipo">
                                <span class="checkmark"></span> Produto
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioServico" name="tipo">
                                <span class="checkmark"></span> Serviço
                              </label>
                            </div>
                          </div>

                          <div class="col-sm-3 text-left">
                            <label data-error="wrong" data-success="right">Situação </label>
                            <div class="radioStyle">
                              <label class="container p-0 m-0">
                                <input type="radio" checked="checked" id="radioTodosSituacao" name="situacao">
                                <span class="checkmark"></span> Todos
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioAberta" name="situacao">
                                <span class="checkmark"></span> Aberta
                              </label><br>
                              <label class="container p-0 m-0">
                                <input type="radio" id="radioBaixada" name="situacao">
                                <span class="checkmark"></span> Baixada
                              </label><br>
                            </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="col-sm-12 table-responsive card-body">
                            <h5>Ordens de Compra</h5>
                            <table id="tabelaOc" class="table table-sm table-select table-hover" width="100%">
                              <thead>
                                <tr>
                                  <th class="th-sm">SEL
                                  </th>
                                  <th class="th-sm">Número
                                  </th>
                                  <th class="th-sm">Cód. For
                                  </th>
                                  <th class="th-sm">Fornecedor
                                  </th>
                                  <th class="th-sm">Valor
                                  </th>
                                </tr>
                              </thead>
                              <tbody>
                              </tbody>
                            </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">Informações</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>

                          <nav>
                            <div class="nav nav-tabs justify-content-center" id="nav-tab" role="tablist" style="text-decoration: none">
                              <a class="nav-link abaLink active" id="tabItens" data-toggle="tab" href="#divItens" role="tab" aria-controls="divItens" aria-selected="true">Itens</a>
                              <a class="nav-link abaLink" id="tabUltCompras" data-toggle="tab" href="#divUltCompras" role="tab" aria-controls="divUltCompras" aria-selected="false">Últimas Compras</a>
                            </div>
                          </nav>

                          <div class="tab-content" id="nav-tabContent">
                            <div class="tab-pane fade show active" id="divItens" role="tabpanel" aria-labelledby="tabFiscal">
                              <div class="col-12">
                                <div class="row card-body">
                                  <div class="col-4">
                                    <label data-error="wrong" data-success="right" for="txtNumeroOc">Ordem de Compra</label>
                                    <div class="input-group">
                                      <input type="text" class="input-default focus form-control" id="txtNumeroOc" name="txtNumeroOc" disabled>
                                    </div>
                                  </div>
                                  <div class="col-8">
                                    <label data-error="wrong" data-success="right" for="txtClienteOc">Fornecedor </label>
                                    <div class="input-group">
                                      <input type="text" class="input-default focus form-control" id="txtClienteOc" name="txtClienteOc" disabled>
                                    </div>
                                  </div>
                                  <div class="col-sm-12 table-responsive" style="margin-top: 20px;">
                                    <h5>Itens</h5>
                                    <table id="tabelaItens" class="table table-sm table-select table-hover" width="100%">
                                      <thead>
                                        <tr>
                                          <th class="th-sm">Código
                                          </th>
                                          <th class="th-sm">Descrição
                                          </th>
                                          <th class="th-sm">Cor
                                          </th>
                                          <th class="th-sm">Tam
                                          </th>
                                          <th class="th-sm">Qtde
                                          </th>
                                          <th class="th-sm">Preço
                                          </th>
                                        </tr>
                                      </thead>
                                      <tbody>
                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                              </div>
                            </div>

                            <div class="tab-pane fade" id="divUltCompras" role="tabpanel" aria-labelledby="tabICMS">
                              <div class="tab-content" id="nav-tabContent">
                                <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="tabFiscal">
                                  <div class="col-12">
                                    <div class="row card-body">
                                      <div class="col-sm-12 table-responsive" style="margin-top: 20px;">
                                        <h5>Últimas Compras</h5>
                                        <table id="tabelaUltCompras" class="table table-sm table-select table-hover" width="100%">
                                          <thead>
                                          </thead>
                                          <tbody>
                                          </tbody>
                                        </table>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>
  <?php
  include_once('../../footer.php');
  ?>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  <script src="plugins/jquery/jquery.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/jquery-ui/jquery-ui.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/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/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/driver.min.js?versao=3.239.11.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.239.11.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.239.11.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.239.11.1"></script>
  <script type="text/javascript" src="config.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;

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

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

    });
  </script>
</body>

</html>