<!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.255.7.1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.255.7.1">
  <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" href="../plugins/toastr/toastr.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.255.7.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.255.7.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.255.7.1">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">


</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;
  }
</style>

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

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



    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h3 class="col-mb=2"></h3>
            </div>
            <div class="col-sm-6">

            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <div class="card" style="height:auto;">
                <div class="card-header bg-dark">
                  <div class="row d-flex">
                    <h4 class="text-white mt-3">Expedição de Material</h4>
                    <button title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial">
                      <i class="fas fa-question-circle"></i>
                    </button>
                   
                    <p id="txtVencimentoCertificadoDigital" style="color: red; margin-top: 20px; margin-left: 15px;"></p>
                    <h5 class="text-white d-none" id="timerExp">00:00</h4>
                  </div>
                </div>
                <fieldset>
                  <div class="card-body" style="padding-left: 0rem!important; padding-right: 0rem!important;">
                    <form id="msform" name="msform">
                      <div class="collapse show" id="DadosGerais">
                        <div class="card card-body" style="padding-top: 10px;">
                          <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="dados-tab">

                            <div class="form-row d-none" id="divCaixa">

                              <div class="col-2 col-lg-2 form-group" id="tutoCaixa">
                                <label for="txtCaixa">Caixa</label>
                                <div class="input-group">
                                  <input type="text" readonly disabled class="input-default focus form-control" id="txtCaixa" name="txtCaixa" placeholder="Gerado automaticamente">
                                </div>
                              </div>

                            </div>

                            <div class="form-row">

                              <div class="col-4 col-lg-4 form-group" id="tutoPedido">
                                <label for="txtPedido">Pedido *</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" id="txtPedido" name="txtPedido" 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 form-group d-none" id="divReserva">
                                <label data-error="wrong" data-success="right" for="txtReserva">Reserva</label>
                                <select style="width:100%;" class="form-control select2 select2-danger focus" data-dropdown-css-class="select2-danger" id="txtReserva" class="custom-select focus">
                                </select>
                              </div>

                              <div class="col-4 form-group" id="divDeposito">
                                <label for="txtDeposito">Depósito</label>
                                <div class="input-group">
                                  <input type="text" readonly disabled class="input-default focus form-control" aria-describedby="ufError" id="txtDeposito" name="txtDeposito" class="form-control" placeholder="Depósito">
                                </div>
                              </div>

                              <div class="col-3 form-group" id="divCliente">
                                <label for="txtCliente">Cliente</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" readonly disabled aria-describedby="ufError" id="txtCliente" name="txtCliente" class="form-control" placeholder="Cliente">
                                </div>
                              </div>

                              <div class="col-1 form-group d-none" id="divVolumes">
                                <label for="txtVolumes">Volumes</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" value="1" id="txtVolumes" name="txtVolumes" class="form-control">
                                </div>
                              </div>

                              <div class="col-1 form-group">
                                <button class="btn bg-danger btn-block" id="btnMaisInfo" name="btnMaisInfo" data-button="absolute" type="button" style="margin-top: 30px;">
                                  <label class="m-0 p-0"><i class="m-0 p-0 fas fa-folder-plus"></i></label>
                                </button>
                              </div>

                            </div>

                            <label for="divProduto">Itens Pedido</label>
                            <div class="form-row bordaProduto" id="divProduto" style="margin-left: 4px;">

                              <div class="col-1 col-lg-1" style="margin-top: 10px;" id="divQtde">
                                <label for="txtBarra">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" 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" 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 table-select table-hover" width="100%">
                                  <thead>
                                  </thead>
                                  <tbody>
                                  </tbody>
                                </table>
                              </div>

                            </div>

                          </div>
                        </div>
                      </div>
                      <input type="button" name="gravar" id="btnGravar" class="btn-sisp action-button mr-2" value="Gravar" />
                      <button type="button" id="btnDesistir" style="font-size:14px;" class="btn-sisp action-button-previous d-none">Desistir</button>
                      <button type="button" id="btnNfe" style="font-size:14px;" class="btn-sisp action-button-previous d-none">NFE</button>
                      <button type="button" id="btnRFID" style="font-size:14px;" class="btn-sisp action-button-previous d-none">RFID</button>
                      <button type="button" id="btnVoltar" style="font-size:14px;" class="btn-sisp action-button-previous">Voltar</button>
                    </form>
                  </div>
                </fieldset>
              </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.255.7.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.255.7.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.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 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>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.255.7.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.255.7.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.255.7.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.255.7.1"></script>
  <script src="../utils/funcoes.js?versao=3.255.7.1"></script>
  <script src="../utils/cookies.js?versao=3.255.7.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="../dist/js/sum().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;
      sArquivo = `${BASE_URI}/pages/expedicao_mat/expedicao_mat/expedicao_mat.js?versao=3.255.7.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>