<?php include_once('../../../config.php') ?>
<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Entrada Manual</title>
  <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.255.7.1">
  <!-- Ionicons -->
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.255.7.1">
  <!-- overlayScrollbars -->
  <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css?versao=3.255.7.1">
  <!-- Daterange picker -->
  <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" 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" />
  <!-- iCheck for checkboxes and radio inputs -->
  <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">
  <!-- Google Font: Source Sans Pro -->
  <!-- AutoComplete -->
  <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>
    .ui-autocomplete-loading {
      background: white url("dist/img/ui-anim_basic_16x16.gif") center center no-repeat;
    }

    .input-group button,
    .input-group input {
      height: 40px;
    }

    .input-group button {
      min-width: 45px;
    }

    .btn.bg-danger {
      border: 1px solid white;
    }

    #msform {
      text-align: center;
      position: relative;
      margin-top: 20px
    }

    #msform fieldset .form-card {
      background: white;
      border: 0 none;
      padding: 20px 40px 30px 40px;
      width: 94%;
      margin: 0 3% 20px 3%;
      position: relative
    }

    #msform fieldset {
      background: white;
      border: 0 none;
      border-radius: 0.5rem;
      box-sizing: border-box;
      width: 100%;
      margin: 0;
      padding-bottom: 20px;
      position: relative
    }

    #msform fieldset:not(:first-of-type) {
      display: none
    }

    #msform fieldset .form-card {
      text-align: left;
      color: #9E9E9E
    }

    #msform .action-button {
      width: 100px;
      background: var(--primary-color);
      ;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px
    }

    #msform .action-button:hover,
    #msform .action-button:focus {
      box-shadow: 0 0 0 2px white, 0 0 0 3px var(--primary-color);
    }

    #msform .action-button-previous {
      width: 100px;
      background: #616161;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px
    }

    #msform .action-button-previous:hover,
    #msform .action-button-previous:focus {
      box-shadow: 0 0 0 2px white, 0 0 0 3px #616161
    }

    .card {
      z-index: 0;
      border: none;
      border-radius: 0.5rem;
      position: relative
    }

    .fs-title {
      font-size: 25px;
      color: #2C3E50;
      margin-bottom: 10px;
      font-weight: bold;
      text-align: left
    }
  </style>
  <link rel="stylesheet" href="./plugins/toastr/toastr.min.css">

</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">
                <!-- <ol class="breadcrumb float-sm-right">
                  
                  <li class="breadcrumb-item active">Entrada Manual</li>
                </ol> -->
              </div>
            </div>
          </div>
          <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>Entrada Manual (Produto)
                    <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">
                        <div class="col-12" id="campostour">
                          <div class="card-body">
                            <div class="form-card">

                              <div class="row">
                                <div class="form-group col-xl-2 col-lg-3 col-sm-5 col-6">
                                  <label data-error="wrong" data-success="right" for="txtDocumento">Documento *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" required id="txtDocumento" name="txtDocumento" placeholder="Documento">
                                  </div>
                                </div>
                                <div class="d-none">
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" required id="txtLancamento" name="txtLancamento" placeholder="Lançamento">
                                  </div>
                                </div>
                              </div>

                              <div class="row">
                                <div class="form-group col-lg-3  col-sm-3 col-12 ">
                                  <label>Data Movimento *</label>
                                  <input type="date" max="2500-12-31" class="input-default focus form-control" required id="txtDataMovimentoEntrada">
                                </div>
                                <div class="form-group col-md col-sm col-12">
                                  <label data-error="wrong" data-success="right" for="txtFuncionario">Funcionário
                                    *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" required id="txtFuncionario" name="txtFuncionario" placeholder="Funcionário">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnFuncionario" name="btnFuncionario" data-button="absolute" type="button">
                                        <i class="m-0 p-0 fas fa-search"></i>
                                      </button>
                                      <button class="btn bg-danger" id="btnLimpaFuncionario" type="button">
                                        <i class="m-0 p-0 fas fa-trash"></i>
                                      </button>
                                    </div>
                                  </div>
                                </div>
                              </div>
                              <div class="row">
                                <div class="form-group col-lg-4 col-12">
                                  <label data-error="wrong" data-success="right" for="txtTipoEntrada">Tipo Entrada *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" required id="txtTipoEntrada" name="txtTipoEntrada" placeholder="Tipo Entrada">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnTipoEntrada" name="btnTipoEntrada" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                      <button class="btn bg-danger" id="btnLimpaTipoEntrada" 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="txtDeposito">Depósito *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" required id="txtDeposito" name="txtDeposito" placeholder="Depósito">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnDeposito" name="btnDeposito" data-button="absolute" type="button">
                                        <i class="m-0 p-0 fas fa-search"></i>
                                      </button>
                                      <button class="btn bg-danger" id="btnLimpaDeposito" 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="txtQualidade">Qualidade *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" required id="txtQualidade" name="txtQualidade" placeholder="Qualidade">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnQualidade" name="btnQualidade" data-button="absolute" type="button">
                                        <i class="m-0 p-0 fas fa-search"></i>
                                      </button>
                                      <button class="btn bg-danger" id="btnLimpaQualidade" type="button">
                                        <i class="m-0 p-0 fas fa-trash"></i>
                                      </button>
                                    </div>
                                  </div>
                                </div>

                                <div class="form-group col-lg-2 col-12">
                                  <label data-error="wrong" data-success="right" for="txtPrecoSped">Preço SPED</label>
                                  <div class="input-group">
                                    <input type="text" min="0" value="0" class="input-default focus form-control" id="txtPrecoSped" name="txtPrecoSped" placeholder="Preço SPED">
                                  </div>
                                </div>
                                <div class="form-group col-sm-2 col-12">
                                  <label data-error="wrong" data-success="right" for="txtEstoque">Estoque</label>
                                  <div class="input-group">
                                    <input type="text" min="0" value="0" disabled class="input-default focus form-control" id="txtEstoque" name="txtEstoque" placeholder="Estoque">
                                  </div>
                                </div>
                                <div class="form-group col-lg-4 col-12">
                                  <label data-error="wrong" data-success="right" for="txtProduto">Produto *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control" id="txtProduto" name="txtProduto" placeholder="Produto">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnProduto" name="btnProduto" data-button="absolute" type="button">
                                        <i class="m-0 p-0 fas fa-search"></i>
                                      </button>
                                      <button class="btn bg-danger" id="btnLimpaProduto" 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="txtCor">Cor *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control" id="txtCor" name="txtCor" placeholder="Cor">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnCor" name="btnCor" data-button="absolute" type="button">
                                        <i class="m-0 p-0 fas fa-search"></i>
                                      </button>
                                      <button class="btn bg-danger" id="btnLimpaCor" type="button">
                                        <i class="m-0 p-0 fas fa-trash"></i>
                                      </button>
                                    </div>
                                  </div>
                                </div>
                              </div>

                              <div class="row">
                                <div class="form-group col-xl-1 col-lg-2 col-sm-4 col-12 mr-3">
                                  <label data-error="wrong" data-success="right" for="txtQuantidade">Quantidade</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" id="txtQuantidade" value="1" name="txtQuantidade" placeholder="Quantidade">
                                  </div>
                                </div>

                                <div class="form-group col-lg-6 col-12" id="barraBipar">
                                  <div class="row" style="margin-left: 0px;">
                                    <label style="display: flex; text-align: center; justify-content: space-between" data-error="wrong" id="labelBarras" data-success="right" for="txtBarra">
                                      Código de barras
                                    </label>
                                    <div class="col-md-1">
                                      <i title='Clique para desativar o som de bipagem' style="font-size: 20px" class="fas fa-volume-up somAtivo d-none"></i>
                                      <i title='Clique para ativar o som de bipagem' style="font-size: 20px" class="fas fa-volume-mute somInativo"></i>
                                    </div>
                                  </div>
                                  <div class="input-group">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnMenosOuMais" data-button="absolute" type="button" data-estorno="false">
                                        <i class="m-0 p-0 fas fa-plus"></i>
                                      </button>
                                    </div>
                                    <input type="text" class="input-default focus form-control validate" id="txtBarra" name="txtBarra" placeholder="Barra">
                                  </div>
                                </div>
                              </div>

                              <div class="row">
                                <div class="col-sm-12 col-12">
                                  <div class="form-group">
                                    <label>Observação</label>
                                    <textarea style="resize: none" id="txtObs" placeholder="Observação" class="input-default focus form-control" rows="3"></textarea>
                                  </div>
                                </div>
                              </div>


                              <div class="row">
                                <div class="form-group col-lg-4 col-12 d-none">
                                  <label data-error="wrong" data-success="right" for="txtLote">Lote *</label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control validate" id="txtLote" name="txtLote" value="000000" placeholder="Lote">
                                  </div>
                                </div>
                              </div>

                              <div class="form-group col-sm-12 col-12 table-responsive">
                                <table width="100%" style="width: 100%" id="tabela-movimentados" class="table table-sm table-hover table-select table-condensed">
                                  <thead>
                                    <tr>
                                      <th>Codigo</th>
                                      <th>Descrição</th>
                                      <th>Cor</th>
                                      <th>Desc. Cor</th>
                                      <th>Tam</th>
                                      <th>Qtde</th>
                                      <th>Preço SPED</th>
                                      <th>Lote</th>
                                      <th>ID</th>
                                      <th>Excluir</th>
                                    </tr>
                                  </thead>
                                  <tbody>
                                  </tbody>
                                </table>
                              </div>
                            </div>
                            <input type="button" id="confirmar_mov" name="confirmar_mov" class="action-button" value="Gravar" />
                            <input type="button" id="btnImprimir" name="btnImprimir" class="action-button" value="Imprimir" />
                            <input type="button" id="btnCancelarEntradaManual" name="btnCancelarEntradaManual" class="action-button-previous" value="Cancelar" />
                            <div class="col-md-2" style="margin-top: 15px;">
                              <div class="flex">
                                <span class="info-box-icon"><i class="fas fa-box-open" style="font-size: 25px; margin-right: 5px; margin-top: 5px; color:var(--font-color) "></i></span>
                                <div class="info-box-content ">
                                  <input type="number" name="txtQuantidadeBipada" id="txtQuantidadeBipada" class="form-control" data-bs-toggle="tooltip" title="Quantidade total de peças Bipadas" readonly>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                  </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
    </div>
    </section>
    <!-- Main content -->
  </div>


  <div id="modal-grade" class="modal" data-backdrop="static" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg" role="document">
      <div class="modal-content" id="modalBody">
        <div class="modal-header">
          <h4 class="modal-title">Grade Produto</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="col-12 table-responsive">
            <table id="tabela-grade" class="table table-sm table-hover table-select table-condensed">
              <thead>
                <tr>
                  <th>Tamanho</th>
                  <th>Estoque Atual</th>
                  <th>Filtrado</th>
                  <th>Expedição</th>
                  <th>Reserva</th>
                  <th>Saldo</th>
                  <th width="100px">Entrada</th>
                </tr>
              </thead>
              <tbody>
              </tbody>
            </table>
          </div>
        </div>
        <div class="modal-footer">
          <div class="row">

            <button id="btnConfirmar" class="btn btn-danger btn-sisp" type="button">
              Confirmar
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- Control Sidebar -->
  <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('PROD_ENTRADA_MANUAL');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/produto/prod_entrada_manual/prod_entrada_manual.js?versao=3.255.7.1`;
      insereJavaScriptPagina(sArquivo);
    });
  </script>
</body>

</html>