function dialogContrato(idContrato, retorno, bot) { log(retorno) const matric = retorno.matric; let contrato = ( matric.length > 0) ? "contrato do pacote " + matric[0].pacote : "contrato do curso " + matric.dadosMatric.curso; colocaClasse(bot, 'desabilitado'); const largura = 0.8 * tamanhoTela().largura; const divCarregando = "
" + "carregando contrato" + "...
"; const divContrato = this.divContrato = $("
" + divCarregando + "
").dialog({ autoOpen: true, title: contrato, show: { effect: "scale", duration: 200 }, top: 30, width: largura, position: { my: 'center top', at: 'center top+100' }, modal: true, close: function() { tiraClasse(bot, 'desabilitado'); divContrato.dialog("destroy"); } }); buscaContrato.call(this, idContrato); } function buscaContrato(idContrato, origem) { const url = "matriculaonline/escCurso.php"; let info = "acao=contrato&idContrato=" + idContrato; if (origem) info += "&origem=" + origem; const esteCadastro = this; new cnx.carrega(url, function() { montaContrato.call(esteCadastro, this.resposta) }, null, "POST", info); } function montaContrato(retorno) { retorno = jQuery.parseJSON(retorno); const esteCadastro = this; this.dados.idContrato = retorno.idContrato; this.divContrato.find("div.carregando").remove(); const contrato = retorno.contrato; if (!contrato.txt) { $("
Seu acesso a este contrato não está liberado.
").appendTo(this.divContrato.prev()); this.divContrato.remove(); return; } $(contrato.txt).appendTo(this.divContrato); const ulFakeParaEstilos = $("").prependTo(this.divContrato.prev()); this.onde = $("
  • ").appendTo(ulFakeParaEstilos)[0]; this.botoes = [ { tipo: 'exportar', opcaoPDF: true, tiraExcel: true, padroes: contrato.pdfPadroes }, { tipo: 'imprimir', conteudoImpressao: this.divContrato[0] } ]; if (contrato.aceiteEm.length == "") { this.botoes.push({ tipo: "padrao", label: "aceitar", classe: "aceitar", funcao: "aceitar", aceitar: function() { aceiteContrato.call(esteCadastro) } }); } this.objBotoes = new clBotoes(this); const botAceitar = this.objBotoes.listaBotoes.filter(bot => bot.objBotao.classe == "aceitar")[0]; if (botAceitar) botAceitar.objBotao.elementoDom.innerHTML = "aceitar"; colocaClasse(this.objBotoes.divBotoes, 'contrato'); if (contrato.aceiteEm.length > 0) { const divBotoes = this.objBotoes.divBotoes ; $("
    " + "
    " + "" + "" + contrato.aceiteEm + "
    " + "
    " + ""+ "" + contrato.aceitePor + "
    " + "
    ").appendTo(divBotoes); } //fundo imagem if (contrato.imgFundo != "") { const urlFundo = (contrato.imgFundo) ? "img/imgEscolas/" + _idEsc + "/" + encodeURI(contrato.imgFundo) : ""; const imgFundo = (urlFundo) ? "url(" + urlFundo + ") no-repeat center center" : "none"; const divImg = this.divContrato divImg.css("background", imgFundo) divImg.css("background-size", ((contrato.tipoFundo == "2") ? "contain" : "auto")) }; this.antesImpressao = function() { colocaClasse(document.body, "sohContrato") }; this.aposImpressao = function() { tiraClasse(document.body, "sohContrato") }; } function aceiteContrato() { const esteCadastro = this; const html = "
    " + "concordoainda não
    "; this.divAceite = $(html).appendTo(this.onde).animate({ 'width': '23em' }, 200) .on("click", "a.sim", function(e) { e.preventDefault(), aceiteConcorda.call(esteCadastro) }) .on("click", "a.nao", function(e) { e.preventDefault(), aceiteFecha.call(esteCadastro) }); colocaClasse(this.onde, "comConfirmaAceite"); } function aceiteFecha() { this.divAceite.animate({ "width": "10%" }, 200, function() { removeObj(this); }); delete(this.divAceite); tiraClasse(this.onde, "comConfirmaAceite"); } function aceiteConcorda(idContrato) { idContrato = this.dados.idContrato const esteCadastro = this; const url = "matriculaonline/escCurso.php" const info = "acao=aceite&idDocUso=" + idContrato; new cnx.carrega(url, function() { aceiteRetorna.call(esteCadastro, this.resposta) }, null, "POST", info); $("
    gravando seu aceite...
    ").appendTo(this.divAceite); } function aceiteRetorna (retorno) { this.divAceite.animate({ "width": "10%" }, 200, function() { removeObj(this); }); delete(this.divAceite); retorno = jQuery.parseJSON(retorno); if (retorno.aceiteEm.length > 0) { this.botoes[2].objBotao.elementoDom.remove() const divBotoes = this.objBotoes.divBotoes $("
    " + "
    " + "" + "" + retorno.aceiteEm + "
    " + "
    " + ""+ "" + retorno.aceitePor + "
    " + "
    ").appendTo(divBotoes); this.botContrato ? this.botContrato.find("div.aindaNaoAceite").remove() : ""; //this.botContrato.find("div.aindaNaoAceite").remove(); $("
    " + "
    " + "
    " + "
    ").appendTo(this.botContrato); //remover divAreaCadastro divConfirmacao divBotoes divAindaNaoAceite //troca por contrato aceito em } } function testaDadosCobranca(dadosAlterados) { //se for emitir cobrança pelo Efí testa se tem nome e sobrenome if (_contaEfi == 1) { const campoNome = this.camposID["nome"]; campoNome.label = "nome completo"; campoNome.validaEspecifico = function() { const nomeSobrenome = this.campo.value.split(" "); var txtAviso = "ao menos um nome e um sobrenome"; if (nomeSobrenome.length > 1) { this.tiraAvisoIndividual(txtAviso); return false; } else { this.colocaAvisoIndividual(txtAviso); return { label: this.label, aviso: txtAviso }; } } } }