revisa.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. $('.richtext').richText();
  2. $('#modalArchivo').on('shown.bs.modal', function (event) { limpia(); });
  3. $('.nav-tabs a.eval').on('shown.bs.tab', function(){ $('#evalua').scrollTop(0); });
  4. $('#btnLimpiar').click(function (event) {
  5. limpia();
  6. $('#modalArchivo').modal('hide');
  7. });
  8. function abreModal(elem){
  9. var cid = $(elem).data('id');
  10. var etapa = $('#etapa').val();
  11. var tipo = 2;
  12. var evaluable = $(elem).data('tipo');
  13. $('#btnVotar').val(cid);
  14. var pag = 'califica';
  15. $.ajax({
  16. url: 'action/proyecto_action.php',
  17. type: 'POST',
  18. dataType: 'json',
  19. data: { id: cid, tipo: tipo, etapa: etapa, pag: pag },
  20. success: function(result) {
  21. if(result['error']!= '' && result['error'] !== undefined){
  22. $('#tabsContent').hide();
  23. $('#errorContent').show();
  24. $('#errorContent').children('div').children('div').children('div').children('div.msg').text(result['error']);
  25. }else{
  26. $('#modalArchivo a').removeClass('active');
  27. $('a[href="#iframeArchivo"]').addClass('active');
  28. $('.tab-pane').removeClass('active show');
  29. $('#iframeArchivo').addClass('active show');
  30. $('#iframeArchivo').attr('src', result['archivo']);
  31. $('#tabsContent').show();
  32. $('#errorContent').hide();
  33. if (evaluable == 1){
  34. $('.formaVoto').show();
  35. $('#msgVoto').hide();
  36. $.ajax({
  37. url: 'action/cuestionario_action.php',
  38. type: 'POST',
  39. dataType: 'json',
  40. data: { id: cid, tipo: tipo, etapa: etapa },
  41. success: function(result) {
  42. if(result['error']!= '' && result['error'] !== undefined){
  43. $('#msgTxtVoto').html(result['error']);
  44. $('#msgVotoIcon').removeClass().addClass('mb-2 ing-no-cargado');
  45. $('.formaVoto').hide();
  46. $('#msgVoto').show();
  47. }else{
  48. if (result['mensaje'] == 'ok'){
  49. $('.formaVoto').show();
  50. $('#msgVoto').hide();
  51. } else {
  52. $('#msgTxtVoto').html(result['mensaje']);
  53. $('#msgVotoIcon').removeClass().addClass('mb-2 ' + result['icono']);
  54. $('.formaVoto').hide();
  55. $('#msgVoto').show();
  56. }
  57. }
  58. },
  59. error: function(jqXHR, textStatus, errorThrown ){
  60. $('#msgTxtVoto').html('En este momento no es posible guardar tu revisión, inténtalo más tarde');
  61. $('#msgVotoIcon').removeClass().addClass('mb-2 ing-no-cargado');
  62. $('.formaVoto').hide();
  63. $('#msgVoto').show();
  64. }
  65. });
  66. } else {
  67. $('#msgTxtVoto').html('No tienes acceso a la revisión de éste proyecto.');
  68. $('#msgVotoIcon').removeClass().addClass('mb-2 ing-negar');
  69. $('.formaVoto').hide();
  70. $('#msgVoto').show();
  71. }
  72. }
  73. $('#modalArchivo').modal('show');
  74. },
  75. error: function(jqXHR, textStatus, errorThrown ){
  76. ejecuta = false;
  77. $('#tabsContent').hide();
  78. $('#errorContent').show();
  79. $('#errorContent').children('div').children('div').children('div').children('div.msg').text('No se puede mostrar la información en este momento');
  80. $('#modalCartel').modal('show');
  81. }
  82. });
  83. }