if ($('.richtext').length > 0) $('.richtext').richText(); $('#modalCartel').on('shown.bs.modal', function (event) { limpia(); }); $('.nav-tabs a.eval').on('shown.bs.tab', function(){ $('#evalua').scrollTop(0); }); $('#btnLimpiar').click(function (event) { limpia(); $('#modalCartel').modal('hide'); }); function abreModal(elem){ var cid = $(elem).data('id'); var etapa = $('#etapa').val(); var tipo = 2; $('#iframeCartel').attr('src', ''); var evaluable = $(elem).data('tipo'); $('#btnVotar').val(cid); var pag = 'califica'; $.ajax({ url: 'action/proyecto_action.php', type: 'POST', dataType: 'json', data: { id: cid, tipo: tipo, etapa: etapa, pag: pag }, success: function(result) { if(result['error']!= '' && result['error'] !== undefined){ $('#tabsContent').hide(); $('#errorContent').show(); $('#errorContent').children('div').children('div').children('div').children('div.msg').text(result['error']); }else{ $('#modalCartel a').removeClass('active'); $('a[href="#iframeCartel"]').addClass('active'); $('.tab-pane').removeClass('active show'); $('#iframeCartel').addClass('active show'); $('#iframeCartel').attr('src', result['html']); if (result['video'] != ''){ $('#iframeVideo').attr('src',result['video']); $('.li-video').show(); $('.video').show(); } else { $('.li-video').hide(); $('.video').hide(); } $('#tabsContent').show(); $('#errorContent').hide(); if (evaluable == 1){ $('.formaVoto').show(); $('#msgVoto').hide(); $.ajax({ url: 'action/cuestionario_action.php', type: 'POST', dataType: 'json', data: { id: cid, tipo: tipo, etapa: etapa }, success: function(result) { if(result['error']!= '' && result['error'] !== undefined){ $('#msgTxtVoto').html(result['error']); $('#msgVotoIcon').removeClass().addClass('mb-2 ing-no-cargado'); $('.formaVoto').hide(); $('#msgVoto').show(); }else{ if (result['mensaje'] == 'ok'){ $('.formaVoto').show(); $('#msgVoto').hide(); } else { $('#msgTxtVoto').html(result['mensaje']); $('#msgVotoIcon').removeClass().addClass('mb-2 ' + result['icono']); $('.formaVoto').hide(); $('#msgVoto').show(); } } }, error: function(jqXHR, textStatus, errorThrown ){ $('#msgTxtVoto').html('En este momento no es posible guardar tu evaluación, inténtalo más tarde'); $('#msgVotoIcon').removeClass().addClass('mb-2 ing-no-cargado'); $('.formaVoto').hide(); $('#msgVoto').show(); } }); } else { $('#msgTxtVoto').html('No tienes acceso a la evaluación de éste proyecto.'); $('#msgVotoIcon').removeClass().addClass('mb-2 ing-negar'); $('.formaVoto').hide(); $('#msgVoto').show(); $('#modalCartel').modal('show'); } } $('#modalCartel').modal('show'); }, error: function(jqXHR, textStatus, errorThrown ){ $('#tabsContent').hide(); $('#errorContent').show(); $('#errorContent').children('div').children('div').children('div').children('div.msg').text('No se puede mostrar la información en este momento'); $('#modalCartel').modal('show'); } }); }