<?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 | Entrada NF</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.258.7.1">
  <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.258.7.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.258.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.258.7.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.258.7.1" />
  <link rel="stylesheet" href="dist/css/select.bootstrap.min.css?versao=3.258.7.1" />
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.258.7.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.258.7.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.258.7.1">
  <style>
    #msform {
      text-align: start;
      position: relative;
    }

    #myModalText {
      color: black;
      font-size: 17px;
    }

    .linhaBotao {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .btn-Mov {
      border-radius: 0px;
    }

    #tabelaEntradaNF td div button {
      padding: .0rem .5rem;
      margin-top: .1rem;
      margin-bottom: .2rem;
    }

    #tabelaEntradaNF td {
      padding: 0 !important;
      padding-left: 10px !important;
    }

    .table.dataTable tbody td {
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  </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">Entrada NF</h1>
              <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>
            </div>
            <div class="col-sm-6">

            </div>
          </div>
          <div class="row">
            <div class="container-fluid">
              <div class="row card">
                <div class="col-sm-12 mt-3 ml-2 ">
                  <button class="btn btn-success btn-sisp" id="btnFiltros" type="button"><span class="fas fa-filter"></span> Filtros</button>
                  <button class="btn btn-danger btn-sisp" id="btn-novoPagar"><span class="fas fa-plus"></span> Incluir
                    Entrada NF</button>
                  <button class="btn btn-secondary btn-sisp" id="btnImprimeAcessoNfe"><span class="fas fa-print pr-1" style="color: white!important"></span>Imprimir</button>
                </div>
                <div class="card-body">
                  <h5 class="mb-4">Lista de entrada de NF</h5>

                  <div class="col-sm-12 table-responsive">
                    <table id="tabelaEntradaNF" class="table table-sm table-select table-hover" width="100%">
                      <tbody>
                        <thead>
                          <th class="d-none">DT_ORDENACAO</th>
                          <th>Nota Fiscal</th>
                          <th>Credor</th>
                          <th>Nome</th>
                          <th>Data Emissão</th>
                          <th>Data Entrada</th>
                          <th>Serie</th>
                          <th>Tipo</th>
                          <th>Lançamento</th>
                        </thead>
                      </tbody>
                    </table>
                  </div>
                </div>

                <hr class="m-0">

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

                <hr class="m-0">

                <div class="col-sm-12 table-responsive card-body">
                  <h5 class="mb-12">Notas referenciadas</h5>
                  <table id="tabelaNfRef" class="table table-sm table-select table-hover" width="100%">
                    <tbody>
                      <thead>
                      </thead>
                    </tbody>
                  </table>
                </div>

              </div>
            </div>
          </div>
          <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">
                    <div class="col-sm-12 col-lg-6">
                      <div class="form-group group-defaut">
                        <label for="txtNotaFiscalPesquisa">Nota Fiscal</label>
                        <div class="input-group">
                          <!-- <input type="text" class="input-default focus form-control" required aria-describedby="ufError" id="txtNotaFiscalPesquisa" name="txtNotaFiscalPesquisa" class="form-control" placeholder="Nota Fiscal"> -->
                          <select class="js-example-programmatic js-states form-control" id="txtNotaFiscalPesquisa" name="txtNotaFiscalPesquisa" multiple="multiple"></select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnNotaFiscalPesquisa" name="btnNotaFiscalPesquisa" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaNotaFiscalPesquisa" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="col-sm-12 col-lg-6">
                      <div class="form-group group-defaut">
                        <label for="txtFornecedorPesquisa">Fornecedor</label>
                        <div class="input-group">
                          <!-- <input type="text" class="input-default focus form-control" required aria-describedby="ufError" id="txtFornecedorPesquisa" name="txtFornecedorPesquisa" class="form-control" placeholder="Fornecedor"> -->
                          <select class="js-example-programmatic js-states form-control" id="txtFornecedorPesquisa" name="txtFornecedorPesquisa" multiple="multiple"></select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnFornecedorPesquisa" name="btnFornecedorPesquisa" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaFornecedorPesquisa" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="col-sm-12 col-lg-6">
                      <div class="form-group group-defaut">
                        <label for="txtProdutoPesquisa">Produto</label>
                        <div class="input-group">
                          <!-- <input type="text" class="input-default focus form-control" required aria-describedby="ufError" id="txtProdutoPesquisa" name="txtProdutoPesquisa" class="form-control" placeholder="Produto"> -->
                          <select class="js-example-programmatic js-states form-control" id="txtProdutoPesquisa" name="txtProdutoPesquisa" multiple="multiple"></select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnProdutoPesquisa" name="btnProdutoPesquisa" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaProdutoPesquisa" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="col-sm-12 col-lg-6">
                      <div class="form-group group-defaut">
                        <label for="txtMaterialPesquisa">Material</label>
                        <div class="input-group">
                          <select class="js-example-programmatic js-states form-control" id="txtMaterialPesquisa" name="txtMaterialPesquisa" multiple="multiple"></select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnMaterialPesquisa" name="btnMaterialPesquisa" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaMaterialPesquisa" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>

                  <div class="row">
                    <div class="col-sm-12 col-lg-3">
                      <div class="group-default form-group">
                        <label for="">Data Emissão De:</label>
                        <div class="relative">
                          <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control " id="txtDataEmissaoDe" name="txtDataEmissaoDe">
                        </div>
                      </div>
                    </div>
                    <div class="col-sm-12 col-lg-3">
                      <div class="group-default form-group">
                        <label for="">Até:</label>
                        <div class="relative">
                          <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control " id="txtDataEmissaoAte" name="txtDataEmissaoAte">
                        </div>
                      </div>
                    </div>

                    <div class="col-sm-12 col-lg-3">
                      <div class="group-default form-group">
                        <label for="">Data Entrada De:</label>
                        <div class="relative">
                          <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control " id="txtDataEntradaDe" name="txtDataEntradaDe">
                        </div>
                      </div>
                    </div>
                    <div class="col-sm-12 col-lg-3">
                      <div class="group-default form-group">
                        <label for="">Até:</label>
                        <div class="relative">
                          <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control " id="txtDataEntradaAte" name="txtDataEntradaAte">
                        </div>
                      </div>
                    </div>
                  </div>

                </div>
                <div class="modal-footer">
                  <div class="row">
                    <button class="btn btn-primary btn-sisp" 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 id="modal-incluirNF" 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">Movimentação</h4>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </div>
                <div class="modal-body">
                  Ola modal Incluir NF-e
                </div>
                <div class="modal-footer">

                  <div class="container-fluid">
                    <div class="row justify-content-center mt-0">
                      <div class="col-2 btn btn-danger btn-Mov">Incluir</div>
                      <div class="col-2 btn btn-danger ml-1 btn-Mov">Incluir NF-e</div>
                      <div class="col-2 btn btn-danger ml-1 btn-Mov">Incluir CT-e</div>
                      <div class="col-2 btn btn-danger ml-1 btn-Mov">Alterar</div>
                      <div class="col-2 btn btn-danger ml-1 btn-Mov">Excluir</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div> 
      </div>
    </div>

    <?php
    include_once('../../modais.php');
    ?>
  </div>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?versao=3.258.7.1"></script>
  <script src="plugins/jquery/jquery.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.258.7.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.258.7.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/sisplan.js?versao=3.258.7.1"></script>
  <script src="utils/funcoes.js?versao=3.258.7.1"></script>
  <script src="utils/cookies.js?versao=3.258.7.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.258.7.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/driver.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/datetime.js?versao=3.258.7.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.258.7.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.258.7.1"></script>
  <script src="plugins/moment/moment.min.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.258.7.1"></script>
  <script src="dist/js/xml2json.js?versao=3.258.7.1"></script>
  <script src="pages/compras/js/acesso.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="config.js?versao=3.258.7.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.258.7.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.258.7.1versao=3.258.7.13.253.19.1"></script>
  <script type="text/javascript">
    $(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('ENTRADA_NF');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      await insereJavaScriptTraducoes()

    });
  </script>
</body>

</html>