<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Expedição de Material
  </title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/sisplan.newColorsButtons.css?versao=3.263.17.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.263.17.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.263.17.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.263.17.1">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>

</head>
<style>
  /* #msform {
    text-align: start;
    position: relative;
  }

  .botoesMenu {
    height: 100%;
    padding-left: auto;
    padding-right: auto;
    color: white !important;
    min-width: 150px;
    font-weight: bold;
    margin-left: -4px !important;
    font-size: 1rem !important;
    background-color: #343a40;
    cursor: pointer !important;
  }

  .card {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
  }

  .card-header {
    box-shadow: 0px 1px rgb(0 0 0 / 20%) !important;
  }


  .fa-angle-right,
  .fa-angle-down {
    color: #343a40;
  }

  .card-body {
    margin-left: 0px !important;
    padding-left: 1.25rem !important;
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 1.25rem !important;
  }

  .header-content-page .title-page,
  .title-content-page .title,
  .title-page {
    font-size: 20px;
    line-height: normal;
    font-weight: 500;
    color: #343a40;
    margin: 0;
    font-family: Roboto, Arial, sans-serif;
  }

  #DadosGerais>.card,
  #obs>.card {
    background: #f7f7f7;
  }

  .bordaProduto {
    padding-top: .5%;
    border: solid #e0e4e6;
    border-radius: 4px;
    border-width: 2px;
  }

  #timerExp {
    position: absolute;
    right: 20px;
    font-size: 30px;
  }

  #btnNfe {
    background-color: #3ca2d3 !important;
  } */

  .ajustPadding {
    padding: 0px !important
  }

  .bordaProduto {
    padding-top: .5%;
    border: solid #e0e4e6;
    border-radius: 6px;
    border-width: 2px;
    margin-right: 0px !important;
  }

  thead.ajustaCor {
    background-color: var(--thead-bg);
  }

  .arredondarCantos {
    border-top-right-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
  }
  
  .pagination {
    justify-content: end;
  }
</style>

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

  <script type="text/javascript" src="../config.js"></script>
  <main class="wrapper">

    <div>
      <div class="content-header">
        <div class="col-12 text-left p-0 mt-3 mb-2">
          <div class="card px-0 pt-4 pb-0 mt-3 mb-3">
            <div class="flex ajustPadding">
              <h2 class="col-3">
                <strong class="ml-3">Expedição Material</strong>
                <button type="button" class="btnTutorial" style="margin-top: -10px!important;" id="tutorial">
                  <i class="fas fa-question-circle"></i>
                </button>
              </h2>
              <div class="flex col-7" style="margin-top: -10px !important">
                <p id="txtVencimentoCertificadoDigital" style="color: red; margin-top: 20px; margin-left: 15px;"></p>
              </div>
              <div class="col-2 d-flex justify-content-end align-items-center">
                <h2 class="text-dark timer-div mr-3 d-none" id="timerExp"><i class="fas fa-stopwatch"></i>00:00</h2>
              </div>
            </div>
            <div class="row">
              <div class="col-md-12 mx-0" style="padding:0px 30px 0px 30px !important">
                <form id="msform">
                  <fieldset>
                    <div class="form-card" id="formcard1">
                      <div class="row mt-3">

                        <div class="col-4" id="tutoPedido">
                          <label for="txtPedido">Pedido *</label>
                          <div class="input-group">
                            <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtPedido" name="txtPedido" class="form-control" placeholder="Pedido">
                            <div class="input-group-append">
                              <button class="btn bg-danger" id="btnPedido" name="btnPedido" data-button="absolute" type="button">
                                <i class="m-0 p-0 fas fa-search"></i>
                              </button>
                            </div>
                          </div>
                        </div>

                        <div class="col-2 d-none" id="divReserva">
                          <div class="group-default form-group">
                            <label for="txtReserva">Reserva</label>
                            <div class="relative">
                              <select id="txtReserva" class="input-default focus form-control validate" data-dropdown-css-class="select2-danger">
                              </select>
                            </div>
                          </div>
                        </div>

                        <div class="col-4" id="divDeposito">
                          <label data-error="wrong" data-success="right" for="txtDeposito">Depósito</label>
                          <div class="input-group">
                            <input type="text" autocomplete="off" class="input-default focus form-control validate" aria-describedby="ufError" id="txtDeposito" name="txtDeposito" class="form-control" placeholder="Depósito" disabled>
                          </div>
                        </div>

                        <div class="col-3" id="divCliente">
                          <label data-error="wrong" class="labelGeral" data-success="right" for="txtCliente">Cliente</label>
                          <div class="input-group">
                            <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtCliente" name="txtCliente" class="form-control" placeholder="Cliente" disabled>
                          </div>
                        </div>

                        <div class="col-1 d-none" id="divVolumes">
                          <label data-error="wrong" class="labelGeral" data-success="right" for="txtVolumes">Volumes</label>
                          <div class="input-group">
                            <input type="text" autocomplete="off" class="input-default focus form-control" id="txtVolumes" name="txtVolumes" class="form-control" placeholder="Volumes">
                          </div>
                        </div>

                        <div class="col-1">
                          <button class="btn btn-danger" id="btnMaisInfo" name="btnMaisInfo" data-button="absolute" type="button" style="margin-top: 27px; width:100%">
                            <label class="m-0 p-0"><i class="m-0 p-0 fas fa-folder-plus"></i></label>
                          </button>
                        </div>

                        <div class="col-12 block mt-4">
                          <h2 class="fs-title">Itens Pedido</h2>
                          <div class="form-row bordaProduto" id="divProduto" style="margin-left: 1px;">

                            <div class="col-1 col-lg-1" style="margin-top: 10px;" id="divQtde">
                              <label for="txtQtde">Qtde</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" id="txtQtde" value="1" name="txtQtde" placeholder="Qtde">
                              </div>
                            </div>

                            <div class="col-4 col-lg-4" id="barraBipar" style="margin-top: 10px;">
                              <label for="txtBarra">Barra</label>
                              <div class="input-group">
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnMais" type="button">
                                    <i class="m-0 p-0 fas fa-plus"></i>
                                  </button>
                                </div>
                                <input type="text" class="input-default focus form-control arredondarCantos" id="txtBarra" name="txtBarra" placeholder="Barra">
                                <input type="text" class="input-default focus form-control" id="txtCodigoEPC" name="txtCodigoEPC" hidden>
                              </div>
                            </div>

                            <div class="col-4 col-lg-4 d-none" id="barraEstorno" style="margin-top: 10px;">
                              <label for="txtBarraEstorno">Barra Estorno</label>
                              <div class="input-group">
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnMenos" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-minus"></i>
                                  </button>
                                </div>

                                <input type="text" class="input-default focus form-control arredondarCantos" aria-describedby="ufError" id="txtBarraEstorno" name="txtBarraEstorno" class="form-control" placeholder="Barra Estorno">
                              </div>
                            </div>

                            <div class="col-4 col-lg-4 escondeEdicao" style="margin-top: 39px;">
                              <div class="row">
                                <label style="margin-top: 0.5rem!important; margin-bottom: 0!important; display: flex; text-align: center; justify-content: space-between; margin-left: 5px" for="txtCodigo">
                                  <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>
                                </label>
                                <label for="btn-iniciar-epc" style="margin-left: 10px"></label>
                                <div class="divRFID d-none">
                                  <button type="button" class="btn btn-icon-normal btn-danger d-flex align-items-center justify-content-center" style="border-radius: 4px!important; text-align: center;" id="btn-iniciar-epc" name="btn-iniciar-epc" data-button="absolute" title="Iniciar RFID, Atalho (Alt + 1)">
                                    <i class="fas fa-play"></i>
                                  </button>
                                </div>
                                <label for="btn-parar-epc" style="margin-left: 5px"></label>
                                <div class="divRFID d-none">
                                  <button type="button" class="btn btn-icon-normal btn-danger d-flex align-items-center justify-content-center" style="border-radius: 4px!important;" id="btn-parar-epc" name="btn-parar-epc" data-button="absolute" title="Parar RFID, Atalho (Alt + 2)">
                                    <i class="fas fa-pause"></i>
                                  </button>
                                </div>
                              </div>
                            </div>

                            <div class="col-1 col-lg-1 escondeEdicao" style="margin-top: 10px;">
                              <label for="txtTotal">Total</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" disabled id="txtTotal" value="0" name="txtTotal">
                              </div>
                            </div>

                            <div class="col-1 col-lg-1 escondeEdicao" style="margin-top: 10px;">
                              <label for="txtConferidas">Conferidas</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" disabled id="txtConferidas" value="0" name="txtConferidas">
                              </div>
                            </div>

                            <div class="col-1 col-lg-1 escondeEdicao" style="margin-top: 10px;">
                              <label for="txtSaldo">Saldo</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" disabled id="txtSaldo" value="0" name="txtSaldo">
                              </div>
                            </div>

                            <div class="col-sm-12" style="margin-top: 15px">
                              <table id="tabelaItens" class="table table-sm-sisp table-select table-hover" width="100%">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                              </table>
                            </div>

                          </div>
                        </div>

                      </div>
                    </div>

                    <div class="d-flex justify-content-end flex-wrap gap-2 mt-2 mb-2">
                      <button type="button" name="gravar" id="btnGravar" class="btn btn-sisp btnVerde marginBtnH"><i class="fas fa-save"></i> Gravar</button>
                      <button type="button" id="btnDesistir" class="btn btn-sisp btn-danger marginBtnH d-none"><i class="fas fa-times"></i> Desistir</button>
                      <button type="button" id="btnNfe" class="btn btn-sisp btn-primary marginBtnH d-none"><i class="fas fa-file-invoice"></i> NFE</button>
                      <button type="button" id="btnRFID" class="btn btn-sisp btn-danger marginBtnH d-none"><i class="fas fa-satellite-dish"></i> RFID</button>
                      <button type="button" id="btnVoltar" class="btn btn-sisp btn-secondary marginBtnH"><i class="fas fa-arrow-left"></i> Voltar</button>
                    </div>
                  </fieldset>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div id="modal-infos" class="modal" 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">Informações Adicionais</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-12 col-lg-12 form-group">
                  <label for="txtFuncionario">Funcionário</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" aria-describedby="ufError" id="txtFuncionario" name="txtFuncionario" class="form-control" 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="btnAFuncionario" type="button">
                        <i class="m-0 p-0 fas fa-trash"></i>
                      </button>
                    </div>
                  </div>
                </div>

                <div class="col-12 col-lg-12 form-group">
                  <label for="txtEspecie">Espécie</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" value="VOLUME" id="txtEspecie" name="txtEspecie" class="form-control" placeholder="Espécie">
                  </div>
                </div>

                <div class="col-12 col-lg-12 form-group">
                  <label for="txtObservacao">Observação</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" aria-describedby="ufError" id="txtObservacao" name="txtObservacao" class="form-control" placeholder="Observação">
                  </div>
                </div>

              </div>
            </div>
          </div>
        </div>
      </div>

      <div id="modal-nfe" 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">Nota Fiscal</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-6 col-lg-6 form-group">
                  <label data-error="wrong" class="labelGeral" data-success="right" for="txtPedidoBusca">Pedido</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" id="txtPedidoBusca" name="txtPedidoBusca" placeholder="Pedido">
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnPedidoBusca" name="btnPedidoBusca" data-button="absolute" type="button">
                        <i class="m-0 p-0 fas fa-search"></i>
                      </button>
                      <button class="btn bg-danger" id="btnAPedidoBusca" type="button">
                        <i class="m-0 p-0 fas fa-trash"></i>
                      </button>
                    </div>
                  </div>
                </div>

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

                <div class="col-sm-6 col-lg-6 form-group">
                  <label data-error="wrong" class="labelGeral" data-success="right" for="txtFatura">Fatura</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" disabled id="txtFatura" name="txtFatura" placeholder="Fatura">
                  </div>
                </div>

                <div class="col-sm-6 col-lg-6 form-group">
                  <label data-error="wrong" class="labelGeral" data-success="right" for="txtSerie">Série</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" disabled id="txtSerie" name="txtSerie" placeholder="Serie">
                  </div>
                </div>

                <div class="col-sm-4 col-lg-4 form-group">
                  <label data-error="wrong" class="labelGeral" data-success="right" for="txtChave">Chave</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" disabled id="txtChave" name="txtChave" placeholder="Chave">
                  </div>
                </div>

                <div class="col-sm-4 col-lg-4 form-group">
                  <label data-error="wrong" class="labelGeral" data-success="right" for="txtProtocolo">Protocolo</label>
                  <div class="input-group">
                    <input type="text" class="input-default focus form-control" disabled id="txtProtocolo" name="txtProtocolo" placeholder="Protocolo">
                  </div>
                </div>

                <div class="col-sm-4 col-lg-4 form-group">
                  <label data-error="wrong" class="labelGeral" data-success="right" for="txtDtEmissao">Data de Emissão</label>
                  <div class="input-group">
                    <input type="date" max="2500-12-31" class="input-default focus form-control" disabled id="txtDtEmissao" name="txtDtEmissao" placeholder="Data de Emissão">
                  </div>
                </div>

              </div>
            </div>
            <div class="modal-footer">
              <div class="btn-group">
                <button id="btnImprimir" class="btn btn-secondary text-white btn-sisp botoesMenu">
                  <span class="fas fa-print pr-1" style="color: white!important"></span> Imprimir
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
    </div>
    <?php include_once('../../../modais.php'); ?>
  </main>

  <script src="../plugins/jquery/jquery.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.263.17.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.263.17.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.263.17.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.263.17.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.263.17.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.263.17.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.263.17.1"></script>
  <script src="../utils/funcoes.js?versao=3.263.17.1"></script>
  <script src="../utils/cookies.js?versao=3.263.17.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.263.17.1"></script>
  <script type="text/javascript" src="../dist/js/sum().js?versao=3.263.17.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;
      sArquivo = `${BASE_URI}/pages/expedicao_mat/expedicao_mat/expedicao_mat.js?versao=3.263.17.1`;
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

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

      await insereJavaScriptPagina(sArquivo);

      habilitaCamposObrigatoriosTela(nomeTela);
    });
  </script>
</body>

</html>