<?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 de Estoque Manual</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.255.15.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.15.1">
  <!-- overlayScrollbars -->
  <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css?versao=3.255.15.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.15.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.255.15.1">
  <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.255.15.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.255.15.1" />
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.255.15.1">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="dist/css/select.bootstrap.min.css?versao=3.255.15.1">
  <!-- Google Font: Source Sans Pro -->
  <!-- AutoComplete -->
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.255.15.1">

  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.255.15.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;
    }

    .info-box-text {
      font-size: 20px;
      font-weight: bold;
      color: grey;
    }


    #progressbar {
      margin-left: 0px;
    }

    #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
    }

    select.list-dt {
      border: none;
      outline: 0;
      border-bottom: 1px solid #ccc;
      padding: 2px 5px 3px 5px;
      margin: 2px
    }

    select.list-dt:focus {
      border-bottom: 2px solid var(--primary-color);
    }

    .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
    }

    #progressbar {
      margin-bottom: 30px;
      overflow: hidden;
      color: lightgrey
    }

    #progressbar .active {
      color: #000000
    }

    #progressbar li {
      list-style-type: none;
      font-size: 12px;
      width: 100%;
      float: left;
      position: relative
    }

    #progressbar #account:before {
      font-family: 'Font Awesome 5 Free';
      content: "\f15c"
    }

    #progressbar #personal:before {
      font-family: 'Font Awesome 5 Free';
      content: "\f155"
    }

    #progressbar #payment:before {
      font-family: 'Font Awesome 5 Free';
      content: "\f0cb"
    }

    #progressbar #confirm:before {
      font-family: 'Font Awesome 5 Free';
      content: "\f14a"
    }

    #progressbar li:before {
      width: 50px;
      height: 50px;
      line-height: 45px;
      display: block;
      font-size: 18px;
      color: #ffffff;
      background: lightgray;
      border-radius: 50%;
      margin: 0 auto 10px auto;
      padding: 2px
    }

    #progressbar li:after {
      content: '';
      width: 100%;
      height: 2px;
      background: lightgray;
      position: absolute;
      left: 0;
      top: 25px;
      z-index: -1
    }

    #progressbar li.active:before,
    #progressbar li.active:after {
      background: var(--primary-color);
    }

    .radio-group {
      position: relative;
      margin-bottom: 25px
    }

    .radio {
      display: inline-block;
      width: 204;
      height: 104;
      border-radius: 0;
      background: lightblue;
      box-shadow: 0 2px 2px 2px rgba(0, 0, 0, 0.2);
      box-sizing: border-box;
      cursor: pointer;
      margin: 8px 2px
    }

    .radio:hover {
      box-shadow: 2px 2px 2px 2px rgba(0, 0, 0, 0.3)
    }

    .radio.selected {
      box-shadow: 1px 1px 2px 2px rgba(0, 0, 0, 0.1)
    }

    .contador.item-0 {
      margin-top: 33px;
    }

    .contador {
      text-align: center;
      margin-left: 10px;
      margin-top: 4px;
      margin-bottom: auto;
      background-color: #dc3545;
      max-width: 35px;
      width: 50px;
      max-height: 30px;
      font-size: 12px;
      padding-top: 5px;
      height: 30px;
      font-weight: bold;
      color: white;
      border-radius: 5px;
    }

    .bordaTab {
      border: solid #e0e4e6;
      border-radius: 4px;
      border-width: 2px;
    }

    .grupo_botao.item-0 {
      margin-top: 29px;
    }
  </style>
  <!-- Toastr -->
  <link rel="stylesheet" href="./plugins/toastr/toastr.min.css">

</head>

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


    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
      <!-- Content Header (Page header) -->
      <!-- /.content-header -->
      <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">Movimentação de Entrada</li>
                </ol> -->
              </div><!-- /.col -->
            </div><!-- /.row -->
          </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>Movimentação de Entrada (Material)
                    <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="form-card">
                        <div class="card-10" id="campostour">
                          <div class="card-body">
                            <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="form-group col-xl-2 col-lg-3 col-sm-5 col-6 pt-3 my-auto">
                                <div class="icheck-primary" title='Configuração feita pela tela "Permissões Tela"'>
                                  <input class="form-check-input" disabled type="checkbox" id="chkGravaImprime" value="">
                                  <label class="form-check-label" id="check_todosTour">Gravar e imprimir ao buscar peso</label>
                                </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-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="txtFuncionarioEntradaMat">Funcionário
                                  *</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control validate" required id="txtFuncionarioEntradaMat" name="txtFuncionarioEntradaMat" placeholder="Funcionário">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnFuncionarioEntradaMat" name="btnFuncionarioEntradaMat" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaFuncionarioEntradaMat" 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="txtTipoEntradaMat">Tipo Entrada
                                  *</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control validate" required id="txtTipoEntradaMat" name="txtTipoEntradaMat" placeholder="Tipo Entrada">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnTipoEntradaMat" name="btnTipoEntradaMat" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaTipoEntradaMat" 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" 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="txtMaterialEntrada">Material
                                  *</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control controleBlur" required id="txtMaterialEntrada" name="txtMaterialEntrada" placeholder="Material">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnMaterialEntrada" name="btnMaterialEntrada" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaMaterialEntrada" 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="txtCor">Cor *</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control controleBlur" required 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 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 controleBlur" 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-4 col-12">
                                <label data-error="wrong" data-success="right" for="txtLote">Lote
                                </label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control controleBlur" id="txtLote" name="txtLote" placeholder="Lote">
                                  <!-- <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnLote" name="btnLote" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaLote" 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-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtTonalidade">Tonalidade</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" disabled="true" id="txtTonalidade" name="txtTonalidade" placeholder="Tonalidade">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnTonalidade" name="btnTonalidade" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaTonalidade" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>

                              <div class="form-group col-lg-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtLoteInterno">Lote Interno
                                </label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" disabled="true" id="txtLoteInterno" name="txtLoteInterno" placeholder="Lote Interno">
                                </div>
                              </div>

                              <div class="form-group col-lg-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtBarra">Barra
                                </label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" disabled="true" id="txtBarra" name="txtBarra" placeholder="Barra">
                                </div>
                              </div>

                              <div class="form-group col-lg-3 col-12">
                                <label>Data de Fabricação *</label>
                                <input type="date" max="2500-12-31" class="input-default focus form-control" disabled="true" required id="dtFabricacao">
                              </div>
                            </div>

                            <div class="row">

                              <div class="form-group col-sm-3  col-12">
                                <label data-error="wrong" data-success="right" for="txtQuantidade">Peso Bruto</label>
                                <div class="input-group">
                                  <input type="number" class="input-default focus form-control" disabled="true" id="txtPesoBruto" name="txtPesoBruto" placeholder="0" title="Peso bruto do material.">
                                </div>
                              </div>
                              <div class="form-group col-sm-3  col-12">
                                <label data-error="wrong" data-success="right" for="txtQuantidade">Quantidade Aux</label>
                                <div class="input-group">
                                  <input type="number" class="input-default focus form-control" id="txtQuantidadeAux" name="txtQuantidadeAux" placeholder="0" title="A quantidade inserida neste campo será convertida, com base no rendimento, para a quantidade correspondente na unidade principal.">
                                  <input type="text" disabled id="txtUnidadeAux" title="Unidade Auxiliar" class="form-group col-lg-5 col-12 input-default focus form-control" placeholder="Unid. Aux.">
                                  <input type="number" class="form-group col-lg-5 col-12 input-default focus form-control" title="Rendimento" disabled id="txtRendimento" name="txtRendimento" placeholder="Rend.">
                                </div>
                              </div>
                              <div class="form-group col-sm-3  col-12">
                                <label data-error="wrong" data-success="right" for="txtQuantidade">Quantidade *</label>
                                <div class="input-group">
                                  <input type="number" min="0" class="input-default focus form-control" required id="txtQuantidade" name="txtQuantidade" placeholder="0">
                                  <input type="text" id="UnidadeMedidaMat" title="Unidade" disabled class="form-group col-lg-4 col-12 input-default focus form-control" placeholder="Unid.">
                                </div>
                              </div>
                              <div class="form-group col-sm-3  col-12">
                                <label data-error="wrong" data-success="right" for="txtPreco">Preço *</label>
                                <div class="input-group">
                                  <input type="number" min="0" class="input-default focus form-control" required id="txtPreco" name="txtPreco" placeholder="0">
                                </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" maxlength="70"></textarea>
                                </div>
                              </div>
                            </div>
                            <div class="row">
                              <div class="col-sm-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>Qtde</th>
                                      <th>UN</th>
                                      <th>Lote</th>
                                      <th>Tonalidade</th>
                                      <th>Lote Interno</th>
                                      <th>Barra</th>
                                      <th>Data de Fabricação</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="limpar_mov" name="limpar_mov" class="action-button-previous" value="Limpar" />
                            <input type="button" id="Imprimir" name="Imprimir" class="action-button-previous" value="Imprimir" style="background:#2C3E50!important;" />
                          </div>
                        </div>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </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.15.1"></script>

  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="dist/js/loadingoverlay.min.js?versao=3.255.15.1"></script>

  <!-- jQuery UI 1.11.4 -->
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.255.15.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.15.1"></script>
  <!-- AdminLTE App -->
  <script src="dist/js/adminlte.min.js?versao=3.255.15.1"></script>

  <script src="dist/js/sisplan.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="utils/funcoes.js?versao=3.255.15.1"></script>
  <!-- SweetAlert2 -->
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.255.15.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.255.15.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.255.15.1"></script>
  <script src="utils/cookies.js?versao=3.255.15.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.255.15.1"></script>
  <script src="pages/loja/js/rotinas.js?versao=3.255.15.1"></script>
  <script src="dist/js/dataTables.keyTable.js?versao=3.255.15.1"></script>
  <script src="dist/js/driver.min.js?versao=3.255.15.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.255.15.1"></script>
  <script src="plugins/jquery-validation/additional-methods.min.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="config.js?versao=3.255.15.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('MAT_ENTRADA_MANUAL');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/material/mat_entrada_manual/mat_entrada_manual.js?versao=3.255.15.1`;
      insereJavaScriptPagina(sArquivo);
    });
  </script>
</body>

</html>