<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Desdobra Lote</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.243.6.1">
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.243.6.1">
    <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.243.6.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.243.6.1">
    <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.243.6.1" />
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.243.6.1">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.243.6.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.243.6.1">
    <link rel="stylesheet" href="plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css?versao=3.243.6.1">
    <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.243.6.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.243.6.1">
    <style>
        #msform {
            text-align: start;
            position: relative;
        }

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

        #lotesDesdobrados {
            margin-bottom: 100px;
        }

        .radiosStyle {
            padding-top: 0.5rem;
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
            margin-left: 0%;
        }

        .radiosStyle2 {
            padding-top: 0.5rem;
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
        }

        .borda {
            padding: 10px;
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
        }

        .select2-container--default .select2-selection--multiple .select2-selection__rendered {
            float: left;
        }

        .border-Field .textoBorda {
            font-size: 1.1em !important;
            text-align: left !important;
            width: auto;
            padding: 0 10px;
            border-bottom: none;
        }

        .border-Field {
            border: 1px solid var(--white-dark) !important;
            /* padding: 0 1.0em 1.0em 1.0em !important; */
            margin: 0 0 1.0em 0 !important;
            -webkit-box-shadow: 0px 0px 0px 0px #000;
            box-shadow: 0px 0px 0px 0px #000;
        }

        .modalFooterFixo {
            position: absolute;
            bottom: 0;
            left: 10px;
            right: 10px;
            background-color: #171f21;
            z-index: 1;
            padding: 4px;
        }


        .sidebar-collapse .sidebar-margin {
            margin-left: 5%
        }

        /* .sidebar-margin {
            margin-left: 250px
        } */

        /* #rodape {
            margin-bottom: 80px;
        } */

        .table {
            table-layout: fixed;
            /* width: 100%; */
            /* width: 100vw;
            max-width: 100%; */
        }

        #tabelaLotes_wrapper .table.dataTable tbody td {
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            /* max-width: 200px; */
            /* white-space: normal; */
            /* word-break: break-all; */
        }

        #tabelaLotes_wrapper .table.dataTable thead th {
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            max-width: 390px;
            /* white-space: normal;  */
            /* /* word-break: break-all; */
        }

        #tabelaLotesDesdobrados_wrapper .table.dataTable tbody td {
            /* white-space: nowrap; */
            text-overflow: ellipsis;
            overflow: hidden;
            /* max-width: 200px; */
            white-space: normal;
            /* word-break: break-all; */
        }

        #tabelaLotesDesdobrados_wrapper .table.dataTable thead th {
            white-space: nowrap;
            /* text-overflow: ellipsis; */
            overflow: hidden;
            max-width: 390px;
            /* white-space: normal; */
            /* word-break: break-all; */
        }

        table.dataTable thead .sorting:before,
        table.dataTable thead .sorting:after,
        table.dataTable thead .sorting_asc:before,
        table.dataTable thead .sorting_asc:after,
        table.dataTable thead .sorting_desc:before,
        table.dataTable thead .sorting_desc:after {
            display: none;
        }

        @media (max-width:1410px) {

            #botaoConsultaLimpa{ 
                text-align: center !important;
            }
        }
    </style>
</head>

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

        <div class="content-wrapper">
            <div class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                        <div class="col-sm-6">
                            <h3 class="col-mb=2"></h3>
                        </div>
                        <div class="col-sm-6">
                            <!-- <ol class="breadcrumb float-sm-right">
                                
                                <li class="breadcrumb-item active">Desdobra Lote</li>
                            </ol> -->
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12">
                            <div class="card" style="height:auto;">
                                <div class="card-header bg-dark">
                                    <div class="row flex">
                                        <h4 class="text-white">Desdobra Lote</h4>
                                        <button title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial">
                                            <i class="fas fa-question-circle"></i>
                                        </button>
                                    </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">
                                                        <!-- <label for="divGeral">Desdobra Lote</label> -->
                                                        <div class="form-row borda" id="lotes">
                                                            <div class="col-12">
                                                                <div class="form-row">
                                                                    <div class="col-xl-3 col-12">
                                                                        <label data-error="wrong" data-success="right" for="txtLote">Lote</label>
                                                                        <div class="relative">
                                                                            <div class="input-group">
                                                                                <input type="text" class="input-default focus form-control" id="txtLote" class="form-control" placeholder="Lote">
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-3 col-12">
                                                                        <label data-error="wrong" data-success="right" for="txtMaterial">Material</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtMaterial" class="form-control" placeholder="Material">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="btnMaterial" data-button="absolute" type="button">
                                                                                    <i class="m-0 p-0 fas fa-search"></i>
                                                                                </button>
                                                                                <button class="btn bg-danger" id="btnLimpaMaterial" type="button">
                                                                                    <i class="m-0 p-0 fas fa-trash"></i>
                                                                                </button>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-3 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" class="form-control" placeholder="Cor">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="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="col-xl-3 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" id="txtDeposito" class="form-control" placeholder="Depósito">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="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>
                                                                <div class="form-row">
                                                                    <div class="col-xl-3 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" id="txtFuncionario" class="form-control" placeholder="Funcionário">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="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 class="col-xl-auto col-12" style="margin-top: 10px;">
                                                                        <fieldset class="form border-Field p-0">
                                                                            <legend class="textoBorda pb-0 mb-0">Opções</legend>
                                                                            <div class="form-row ml-1 mt-1">
                                                                                <label for="cbLoteExato">   <input type="checkbox" id="cbLoteExato">  Consulta Lote Exato</label>
                                                                                <label for="cbPositivos">   <input type="checkbox" id="cbPositivos">  Somente Positivos</label>
                                                                                <label for="cbEtiquetaTAG">   <input type="checkbox" id="cbEtiquetaTAG">  Gerar Etiqueta TAG</label>
                                                                                <label for="cbImprimirAoGravar" class="mr-3">   <input type="checkbox" id="cbImprimirAoGravar">  Imprimir ao Gravar</label>
                                                                            </div>
                                                                        </fieldset>
                                                                    </div>
                                                                    <div class="col-12 col-xl text-center text-xl-left" id="botaoConsultaLimpa" style="margin: 13px 0 15px 0;">
                                                                        <button type="button" class="btn btn-primary btn-sisp mr-2" id="btnConsultar" style="margin-top: 10px;">Consultar</button>
                                                                        <button type="button" class="btn bg-gradient-danger btn-sisp" id="btnLimparTela" style="margin-top: 10px;">Limpar Tela</button>
                                                                    </div>
                                                                </div>

                                                                <div class="col-sm-12 table-responsive">
                                                                    <table id="tabelaLotes" class="table table-sm table-select table-hover" width="100%">
                                                                        <thead>
                                                                        </thead>
                                                                        <tbody>
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <!-- <div class="form-row borda" style="margin-top: 25px;"> -->
                                                        <!-- <div class="col-sm-12 table-responsive">
                                                                <table id="tabelaLotes" class="table table-sm table-select table-hover" width="100%">
                                                                    <thead>
                                                                    </thead>
                                                                    <tbody>
                                                                    </tbody>
                                                                </table>
                                                            </div> -->
                                                        <!-- </div> -->
                                                        <!-- <div class="input-group-append">
                                                            <label for="divPagamentos" style="margin-top: 25px;">Pagamentos</label>
                                                        </div> -->
                                                        <div class="form-row borda" style="margin-top: 25px;" id="lotesDesdobrados">
                                                            <div class="col-12">
                                                                <div class="form-row">
                                                                    <div class="col-xl-4 col-12">
                                                                        <label data-error="wrong" data-success="right" for="txtTpBaixa">Tipo Baixa</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtTpBaixa" class="form-control" placeholder="Tipo Baixa">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="btnTpBaixa" data-button="absolute" type="button">
                                                                                    <i class="m-0 p-0 fas fa-search"></i>
                                                                                </button>
                                                                                <button class="btn bg-danger" id="btnLimpaTpBaixa" type="button">
                                                                                    <i class="m-0 p-0 fas fa-trash"></i>
                                                                                </button>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-4 col-12">
                                                                        <label data-error="wrong" data-success="right" for="txtDepositoEntrada">Depósito Entrada</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtDepositoEntrada" class="form-control" placeholder="Depósito Entrada">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="btnDepositoEntrada" data-button="absolute" type="button">
                                                                                    <i class="m-0 p-0 fas fa-search"></i>
                                                                                </button>
                                                                                <button class="btn bg-danger" id="btnLimpaDepositoEntrada" type="button">
                                                                                    <i class="m-0 p-0 fas fa-trash"></i>
                                                                                </button>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-4 col-12">
                                                                        <label data-error="wrong" data-success="right" for="txtLocalEntrada">Local</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtLocalEntrada" class="form-control" placeholder="Local">
                                                                            <div class="input-group-append">
                                                                                <button class="btn bg-danger" id="btnLocalEntrada" data-button="absolute" type="button">
                                                                                    <i class="m-0 p-0 fas fa-search"></i>
                                                                                </button>
                                                                                <button class="btn bg-danger" id="btnLimpaLocalEntrada" type="button">
                                                                                    <i class="m-0 p-0 fas fa-trash"></i>
                                                                                </button>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="form-row">
                                                                    <div class="col-xl-6 col-12">
                                                                        <label data-error="wrong" data-success="right" for="txtObservacao">Observação</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtObservacao" class="form-control" placeholder="Observação">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-1 col-3">
                                                                        <label data-error="wrong" data-success="right" for="txtLargura">Largura</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtLargura" class="form-control" placeholder="Largura" value="0.00">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-1 col-3">
                                                                        <label data-error="wrong" data-success="right" for="txtGramatura">Gramatura</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtGramatura" class="form-control" placeholder="Gramatura" value="0.00">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-1 col-3">
                                                                        <label data-error="wrong" data-success="right" for="txtTara">Tara</label>
                                                                        <div class="input-group">
                                                                            <input type="text" class="input-default focus form-control" id="txtTara" class="form-control" placeholder="Tara" value="0.00">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-1 col-3">
                                                                        <label data-error="wrong" data-success="right" for="txtQtdeRolo">Qtde Rolo</label>
                                                                        <div class="input-group">
                                                                            <input type="number" class="input-default focus form-control" id="txtQtdeRolo" class="form-control" placeholder="Qtde Rolo" value="0">
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-xl-1 col-12 text-center text-xl-left">
                                                                        <button type="button" class="btn btn-primary btn-sisp" id="btnDistribuir" style="margin-top: 28px;">Distribuir</button>
                                                                    </div>
                                                                </div>
                                                                <div class="col-sm-12 table-responsive  mb-5 pb-5 mb-xl-0 pb-xl-0" style="margin-top: 10px;" width="100%">
                                                                    <div class="input-group-append">
                                                                    </div>
                                                                    <table id="tabelaLotesDesdobrados" class="table table-sm table-select table-hover" width="100%">
                                                                        <thead>
                                                                        </thead>
                                                                        <tbody>
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                                <!-- <button type="button" class="btn btn-primary btn-sisp" id="btnDistribuir" style="margin-top: 20px;">Distribuir</button> -->
                                                            </div>
                                                            <div class="modal-footer modalFooterFixo row" id="rodapeTela">
                                                                <div class="sidebar-margin mr-auto text-center text-xl-left col-xl-auto col-12 mb-3 mb-xl-0">
                                                                    <button type="button" class="btn bg-gradient-success btn-sisp" id="btnGravar" style="margin-top: 25px; ">Gravar</button>
                                                                    <button type="button" class="btn bg-gradient-danger btn-sisp d-none" id="btnExcluir" style="margin-top: 25px; margin-left: 0px;">Excluir</button>
                                                                    <button type="button" class="btn btn-primary btn-sisp" id="btnImprimir" style="margin-top: 25px; margin-left: 0px;">Imprimir</button>
                                                                </div>

                                                                <div class="col-xl-6 col-12 d-flex justify-content-xl-end justify-content-center">
                                                                    <div class="col-4 col-xl-3">
                                                                        <label data-error="wrong" data-success="right" for="txtTotalLote">Total Lote</label>
                                                                        <input type="text" id="txtTotalLote" class="form-control" data-bs-toggle="tooltip" title="Quantidade total do lote" value="0.00" readonly>
                                                                    </div>
                                                                    <div class="col-4 col-xl-3">
                                                                        <label data-error="wrong" data-success="right" for="txtTotalBaixa">Total Baixa</label>
                                                                        <input type="text" id="txtTotalBaixa" class="form-control" data-bs-toggle="tooltip" title="Quantidade total da baixa" value="0.00" readonly>
                                                                    </div>
                                                                    <div class="col-4 col-xl-3">
                                                                        <label data-error="wrong" data-success="right" for="txtSaldo">Saldo</label>
                                                                        <input type="text" id="txtSaldo" class="form-control" data-bs-toggle="tooltip" title="Quantidade de saldo" value="0.00" readonly>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <!-- <div class="form-row borda" style="margin-bottom: 15px; margin-top: 25px;">
                                                            <div class="col-sm-12 table-responsive">
                                                                <div class="input-group-append">
                                                                </div>
                                                                <table id="tabelaLotesDesdobrados" class="table table-sm table-select table-hover" width="100%">
                                                                    <thead>
                                                                    </thead>
                                                                    <tbody>
                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                        </div> -->
                                                    </div>
                                                </div>

                                            </div>
                                        </form>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <?php
    include_once('../../footer.php');
    ?>
    <aside class="control-sidebar control-sidebar-dark">
    </aside>
    </div>
    <script src="plugins/jquery/jquery.min.js?versao=3.243.6.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.243.6.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.243.6.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.243.6.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.243.6.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.243.6.1"></script>
    <script src="dist/js/sisplan.js?versao=3.243.6.1"></script>
    <script src="utils/funcoes.js?versao=3.243.6.1"></script>
    <script src="utils/cookies.js?versao=3.243.6.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.243.6.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.243.6.1"></script>
    <script src="dist/js/driver.min.js?versao=3.243.6.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.243.6.1"></script>
    <script src="plugins/select2/js/select2.full.min.js?versao=3.243.6.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.243.6.1"></script>
    <script type="text/javascript" src="config.js?versao=3.243.6.1"></script>
    <script src="plugins/moment/moment.min.js?versao=3.243.6.1"></script>
    <script src="plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js?versao=3.243.6.1"></script>
    <script src="dist/js/jquery.mask.min.js?versao=3.243.6.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.243.6.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('DESDOBRALOTE');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/desdobralote/desdobralote.js?versao=3.243.6.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>