<?php include_once('../../../config.php') ?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Ordem de Serviço</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Theme style -->
    <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.2510.7.1">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.2510.7.1">
    <!-- Google Font: Source Sans Pro -->
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" type="text/css" href="../dist/css/dataTables.bootstrap4.min.css?versao=3.2510.7.1" />

    <link href='../dist/css/bootstrap.min.css?versao=3.2510.7.1'>
    <link rel="stylesheet" href="../dist/css/custom.css?versao=3.2510.7.1">
    <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.2510.7.1">
    <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.2510.7.1">
    <link rel="stylesheet" type="text/css" href="../dist/css/responsive.bootstrap.min.css?versao=3.2510.7.1">
    <link rel="shortcut icon" href="../favicon.ico">
    <!-- Toastr -->
    <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.2510.7.1">
    <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.2510.7.1" />
    <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.2510.7.1">
    <link rel="stylesheet" href="../dist/css/cadastro.css?versao=3.2510.7.1">
    <link rel="stylesheet" href="../dist/css/PesquisaVariosSelect2.css?versao=3.2510.7.1">
    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">

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

        #tabelaComissoesCadastro td div button {
            padding: .0rem .5rem;
            margin-top: .1rem;
            margin-bottom: .2rem;
        }

        #tabelaComissoesCadastro td {
            padding: 0 !important;
            padding-left: 10px !important;
        }

        .card-totais {
            margin-top: 2%;
        }

        #txtDados {
            padding-top: .7%;
            padding-left: .85%;
        }

        .input-group-append>a>i {
            margin-left: 0 !important;
            padding-left: 5px;
            padding-right: 5px;
        }

        .focus:read-only:focus {
            border-color: #aa1212 !important;
        }
    </style>
</head>

<body class="sidebar-mini layout-fixed">
    <div class="wrapper">
        <div id="myModal" class="modal" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 id="myModalLabel" class="modal-title"></h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <p id="myModalText"></p>
                    </div>
                    <div class="modal-footer">
                        <button id="btnYes" type="button" class="btn btn-primary">Sim</button>
                        <button id="btnNo" type="button" class="btn btn-secondary" data-dismiss="modal">Não</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="content-wrapper">
            <section class="content">
                <div class="container-fluid" id="grad1">
                    <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: none!important;box-shadow:none!important;">
                                    <h2>Cadastro de Comissão
                                        <button title="Tutorial" type="button" class="btn btn-info btn-sm ml-2" 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">
                                            <fieldset>
                                                <div class="form-card" id="tourGeral">
                                                    <div class="row justify-content-start">
                                                        <h2 class="fs-title col-4"> Dados Gerais </h2>
                                                        <div class="col-lg-12 col-sm-12 col-12 row">
                                                            <div class="col-lg-1 col-1 form-group">
                                                                <label data-error="wrong" data-success="right" for="txtOrdem">Ordem: *</label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtOrdem" name="txtOrdem" class="form-control" placeholder="Ordem">
                                                                </div>
                                                            </div>
                                                            <div class="col-4"></div>
                                                            <div class="form" id="area">
                                                                <fieldset class="form border-Field">
                                                                    <legend class="textoBorda mb-0 pb-0">Tipo</legend>
                                                                    <div class="form-row ml-auto justify-content-left">
                                                                        <div class="icheck-primary form-group form-check pl-2">
                                                                            <input type="radio" id="rdProduto" checked name="rdTipo" class='rdTipo' value="P">
                                                                            <label class="labelCheck" for="rdProduto">Produto</label>
                                                                        </div>
                                                                        <div class="icheck-primary form-group form-check pl-2">
                                                                            <input type="radio" id="rdMaterial" name="rdTipo" class='rdTipo' value="M">
                                                                            <label class="labelCheck" for="rdMaterial">Material</label>
                                                                        </div>
                                                                    </div>
                                                                </fieldset>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="row col-12">
                                                            <div class="col-lg-4 col-4 form-group">
                                                                <label data-error="wrong" data-success="right" for="txtTabPreco">Tabela de Preço: *</label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtTabPreco" name="txtTabPreco" class="form-control" placeholder="Tabela de Preço">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnTabPreco" name="btnTabPreco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                                        <button class="btn bg-danger" id="btnLimpaTabPreco" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="col-lg-4 col-4 form-group" id="ProdutoInfoTour">
                                                                <label data-error="wrong" data-success="right" for="txtProduto">Produto: *</label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtProduto" name="txtProduto" class="form-control" placeholder="Produto">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnProduto" name="btnProduto" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                                        <button class="btn bg-danger" id="btnLimpaProduto" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="col-lg-4 col-4 form-group d-none" id="MaterialInfoTour">
                                                                <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" name="txtMaterial" class="form-control" placeholder="Material">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnMaterial" name="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-lg-4 col-4 form-group" id="RepresentanteInfoTour">
                                                                <label data-error="wrong" data-success="right" for="txtRepresentante">Representante: </label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtRepresentante" name="txtRepresentante" class="form-control" placeholder="Representante">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnRepresentante" name="btnRepresentante" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                                        <button class="btn bg-danger" id="btnLimpaRepresentante" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="row col-12 justify-content-start">
                                                            <div class="col-2 row">
                                                                <div class="col-lg-6 col-6 form-group">
                                                                    <label data-error="wrong" data-success="right" for="txtValor01">Valor 01:</label>
                                                                    <div class="input-group">
                                                                        <input type="text" class="input-default focus form-control" id="txtValor01" name="txtValor01" class="form-control" placeholder="Valor 01">
                                                                    </div>
                                                                </div>
                                                                <div class="col-lg-6 col-6 form-group">
                                                                    <label data-error="wrong" data-success="right" for="txtCom01">% Com. 01:</label>
                                                                    <div class="input-group">
                                                                        <input type="text" class="input-default focus form-control" id="txtCom01" name="txtCom01" class="form-control" placeholder="Com. 01">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-2 row">
                                                                <div class="col-lg-6 col-6 form-group">
                                                                    <label data-error="wrong" data-success="right" for="txtValor02">Valor 02:</label>
                                                                    <div class="input-group">
                                                                        <input type="text" class="input-default focus form-control" id="txtValor02" name="txtValor02" class="form-control" placeholder="Valor 02">
                                                                    </div>
                                                                </div>
                                                                <div class="col-lg-6 col-6 form-group">
                                                                    <label data-error="wrong" data-success="right" for="txtCom02">% Com. 02:</label>
                                                                    <div class="input-group">
                                                                        <input type="text" class="input-default focus form-control" id="txtCom02" name="txtCom02" class="form-control" placeholder="Com. 02">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-2 row">
                                                                <div class="col-lg-6 col-6 form-group">
                                                                    <label data-error="wrong" data-success="right" for="txtValor03">Valor 03:</label>
                                                                    <div class="input-group">
                                                                        <input type="text" class="input-default focus form-control" id="txtValor03" name="txtValor03" class="form-control" placeholder="Valor 03">
                                                                    </div>
                                                                </div>
                                                                <div class="col-lg-6 col-6 form-group">
                                                                    <label data-error="wrong" data-success="right" for="txtCom03">% Com. 03:</label>
                                                                    <div class="input-group">
                                                                        <input type="text" class="input-default focus form-control" id="txtCom03" name="txtCom03" class="form-control" placeholder="Com. 03">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-2 row">
                                                                <div class="input-group ml-2 mt-2">
                                                                    <button type="button" id="btnAdicionar" class="btn btn-dark btn-sisp mt-1" style="min-width: 120px">Adicionar</button>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-12 table-responsive card-body pl-0 pr-0">
                                                        <h5>Comissões</h5>
                                                        <table id="tabelaComissoesCadastro" class="table table-sm table-select table-hover" width="100%">
                                                            <thead>
                                                                <tr>
                                                                    <th class="th-sm">Sequência</th>
                                                                    <th class="th-sm">Código</th>
                                                                    <th class="th-sm">Descrição Item</th>
                                                                    <th class="th-sm">Desc. De</th>
                                                                    <th class="th-sm">Desc. Até</th>
                                                                    <th class="th-sm">Comissão</th>
                                                                    <th class="th-sm">Tipo</th>
                                                                    <th class="th-sm">Representante</th>
                                                                    <th class="th-sm">Nome Representante</th>
                                                                    <th class="th-sm">Tab. Preço</th>
                                                                    <th class="th-sm">Descrição Tab. Preço</th>
                                                                    <th class="th-sm">% Desconto</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </fieldset>
                                            <div class="ml-auto d-flex justify-content-end">
                                                <!-- <button type="button" id="btnVoltar" class="btn btn-secondary btn-sisp mb-2 mt-2 ml-2">Voltar</button>
                                                <button type="button" id="btnGravar" class="btn btn-primary btn-sisp mb-2 mt-2 mr-2 ml-2 text-white">Gravar</button> -->
                                                <!-- <button type="button" id="btnExcluir" class="btn btn-danger btn-sisp mb-2 mt-2 mr-2">Excluir</button> -->
                                                <input type="button" name="btnVoltar" id="btnVoltar" class="previous action-button-previous" value="Voltar" />
                                                <input type="button" id="btnExcluir" style="background-color: rgb(13, 110, 253)" name="make_payment" class="next action-button" value="Excluir" />
                                                <input type="button" id="btnGravar" name="make_payment" class="next action-button" value="Gravar" />
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>

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

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Control sidebar content goes here -->
    </aside>
    <!-- /.control-sidebar -->
    </div>

    <!-- jQuery -->
    <script src="../plugins/jquery/jquery.min.js?versao=3.2510.7.1"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.2510.7.1"></script>
    <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.2510.7.1"></script>
    <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.2510.7.1"></script>
    <!-- SweetAlert2 -->
    <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.2510.7.1"></script>
    <script src="../plugins/toastr/toastr.min.js?versao=3.2510.7.1"></script>

    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>

    <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2510.7.1"></script>

    <script src="../dist/js/adminlte.min.js?versao=3.2510.7.1"></script>

    <script src="../dist/js/requisicoes.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/cliente/entidade.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/loadingoverlay.min.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/valida_cpf_cnpj.js?versao=3.2510.7.1"></script>
    <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/sisplan.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/popper.min.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/tippy-bundle.umd.js?versao=3.2510.7.1"></script>
    <script src="../utils/funcoes.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/jquery.maskMoney.min.js?versao=3.2510.7.1"></script>
    <script src="../utils/cookies.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/driver.min.js?versao=3.2510.7.1"></script>
    <script src="../dist/js/dataTables.keyTable2.js?versao=3.2510.7.1"></script>
    <script type="text/javascript" src="../config.js?versao=3.2510.7.1"></script>
    <!-- Production -->
    <script type="text/javascript">
        $(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('CADCOMISSAO');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/cadcomissao/cadastro_cadcomissao/cadcomissao.js?versao=3.2510.7.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>