1//:::::::::::::::::::::: 2// LINEAS DE TIEMPO 3//:::::::::::::::::::::: 4 5/* 6 * peticion ajax para cambiar de linea de tiempo 7 */ 8 9function cambiarTimeline(lineaTiempo, href) { 10 11 $.ajax({ 12 type: 'GET', 13 async: true, 14 url: requestUrl + '/intranet/sitio/cambiar-linea-tiempo', 15 data: {lineaTiempo: lineaTiempo}, 16 dataType: 'json', 17 beforeSend: function () { 18 $('html').showLoading(); 19 }, 20 complete: function (data) { 21 $('html').hideLoading(); 22 }, 23 success: function (data) { 24 if (data.result == "ok") { 25 $(".lineastiempo").html(""); 26 $(href).html(data.response); 27 } 28 }, 29 error: function (jqXHR, textStatus, errorThrown) { 30 $('html').hideLoading(); 31 } 32 }); 33} 34 35$(document).on('click', "a[data-role='cambiar-timeline']", function () { 36 var lineaTiempo = $(this).attr('data-timeline'); 37 var href = $(this).attr('href'); 38 cambiarTimeline(lineaTiempo, href); 39}); 40 41$(document).on('click', "a[data-role='agregar-destino-contenido']", function () { 42 43 $.ajax({ 44 type: 'GET', 45 async: true, 46 url: requestUrl + '/intranet/contenido/agregar-destino', 47 dataType: 'json', 48 beforeSend: function () { 49 $('html').showLoading() 50 }, 51 complete: function (data) { 52 $('html').hideLoading(); 53 }, 54 success: function (data) { 55 if (data.result == "ok") { 56 $("#contenido-destino").append(data.response); 57 } 58 }, 59 error: function (jqXHR, textStatus, errorThrown) { 60 $('html').hideLoading(); 61 62 } 63 }); 64 return false; 65}); 66 67 68$(document).on('click', "a[data-role='agregar-producto']", function () { 69 70 $.ajax({ 71 type: 'GET', 72 async: true, 73 url: requestUrl + '/intranet/contenido/agregar-producto', 74 dataType: 'json', 75 beforeSend: function () { 76 $('html').showLoading() 77 }, 78 complete: function (data) { 79 $('html').hideLoading(); 80 }, 81 success: function (data) { 82 if (data.result == "ok") { 83 $("#contenido-producto").append(data.response); 84 } 85 }, 86 error: function (jqXHR, textStatus, errorThrown) { 87 $('html').hideLoading(); 88 89 } 90 }); 91 return false; 92}); 93 94$(document).on('click', "a[data-role='agregar-producto2']", function () { 95 96 $.ajax({ 97 type: 'GET', 98 async: true, 99 url: requestUrl + '/intranet/contenido/agregar-producto2', 100 dataType: 'json', 101 beforeSend: function () { 102 $('html').showLoading() 103 }, 104 complete: function (data) { 105 $('html').hideLoading(); 106 }, 107 success: function (data) { 108 if (data.result == "ok") { 109 $("#contenido-producto").append(data.response); 110 } 111 }, 112 error: function (jqXHR, textStatus, errorThrown) { 113 $('html').hideLoading(); 114 115 } 116 }); 117 return false; 118}); 119 120 121$(document).on('click', "a[data-role='ver-contenido-administrable']", function () { 122 123 $.ajax({ 124 type: 'POST', 125 async: true, 126 url: requestUrl + '/intranet/modulos-administrables/ver-contenido', 127 dataType: 'json', 128 data: {contenido: $(this).attr('data-contenido')}, 129 beforeSend: function () { 130 $('html').showLoading(); 131 $("#modal-contenido-administrable").remove(); 132 }, 133 complete: function (data) { 134 $('html').hideLoading(); 135 136 }, 137 success: function (data) { 138 $('body').append(data); 139 $("#modal-contenido-administrable").modal("show"); 140 }, 141 error: function (jqXHR, textStatus, errorThrown) { 142 $('html').hideLoading(); 143 } 144 }); 145 return false; 146}); 147 148$(document).on('change', "#premio-tiporedimir", function () { 149 150 if($(this).val() == 2){ 151 $("#cuestionario_redimir").css('display','block');
152 $("#puntos_redimir").css('display','none'); 153 }else{ 154 $("#cuestionario_redimir").css('display','none'); 155 $("#puntos_redimir").css('display','block'); 156 } 157 158}); 159 160$(document).on('click', "a[data-role='quitar-destino-contenido']", function () { 161 $($(this).attr('data-row')).remove(); 162 return false; 163}); 164 165 166/* 167 * peticion ajax para guardar un contenido de una publicacion 168 */ 169$(document).on('click', "a[data-role='guardar-contenido']", function () { 170 171 var formElement = document.getElementById("form-contenido-publicar"); 172 var formData = new FormData(formElement); 173 var href = $(this).attr('data-href'); 174 var files = $('#contenido-imagenes').fileinput('getFileStack'); 175 176 if (files.length > 0) { 177 $.each(files, function (key, data) { 178 formData.append('imagenes[]', data, files[key].name); 179 }); 180 } 181 182 $.ajax({ 183 type: 'POST', 184 processData: false, 185 contentType: false, 186 url: requestUrl + '/intranet/sitio/guardar-contenido', 187 data: formData, 188 dataType: 'json', 189 beforeSend: function () { 190 $('html').showLoading(); 191 }, 192 complete: function (data) { 193 $('html').hideLoading(); 194 }, 195 success: function (data) { 196 if (data.result == "ok") { 197 $(".lineastiempo").html(""); 198 $(href).html(data.response); 199 $('#publicarContenido').toggle('slow'); 200 $("#mostrarFormularioContenido").text('ocultar formulario') 201 } 202 203 if (data.result == 'error') { 204 alert('Error:'+ data.error); 205 $('html').hideLoading(); 206 } 207 }, 208 error: function (jqXHR, textStatus, errorThrown) { 209 $('html').hideLoading(); 210 alert(jqXHR.responseText); 211 } 212 }); 213 214 return false; 215}); 216 217/* 218 * peticion ajax para guardar un contenido de una publicacion en el template 219 * publicar portales. 220 */ 221$(document).on('click', "a[data-role='guardar-contenido-publicar-portales']", function () { 222 223 var formElement = document.getElementById("form-contenido-publicar-portales"); 224 var formData = new FormData(formElement); 225 var href = $(this).attr('data-href'); 226 var files = $('#contenido-imagenes').fileinput('getFileStack'); 227 228 if (files.length > 0) { 229 $.each(files, function (key, data) { 230 formData.append('imagenes[]', data, files[key].name); 231 }); 232 } 233 234 $.ajax({ 235 type: 'POST', 236 processData: false, 237 contentType: false, 238 url: requestUrl + '/intranet/sitio/publicar-portales-crear', 239 data: formData, 240 dataType: 'json', 241 beforeSend: function () { 242 $('html').showLoading(); 243 }, 244 complete: function (data) { 245 $('html').hideLoading(); 246 }, 247 success: function (data) { 248 if (data.result == "ok") { 249 $('.publicar-portales').remove(); 250 $('.formulario').append(data.response); 251 } 252 }, 253 error: function (jqXHR, textStatus, errorThrown) { 254 $('html').hideLoading(); 255 $("#btnAgregarContenido").attr('disabled', false); 256 } 257 }); 258 259 return false; 260}); 261 262$(document).on('click', "a[data-role='actualizar-contenido-publicar-portales']", function () { 263 264 var idNoticia = $(this).attr('data-noticia'); 265 var formElement = document.getElementById("form-contenido-publicar-portales"); 266 var formData = new FormData(formElement); 267 var href = $(this).attr('data-href'); 268 var files = $('#contenido-imagenes').fileinput('getFileStack'); 269 270 if (files.length > 0) { 271 $.each(files, function (key, data) { 272 formData.append('imagenes[]', data, files[key].name); 273 }); 274 } 275 276 $.ajax({ 277 type: 'POST', 278 processData: false, 279 contentType: false, 280 url: requestUrl + '/intranet/sitio/publicar-portales-actualizar?id='+idNoticia, 281 data: formData, 282 dataType: 'json', 283 beforeSend: function () { 284 $('html').showLoading(); 285 }, 286 complete: function (data) { 287 $('html').hideLoading(); 288 location.reload(); 289 }, 290 success: function (data) { 291 }, 292 error: function (jqXHR, textStatus, errorThrown) { 293 $('html').hideLoading(); 294 $("#btnAgregarContenido").attr('disabled', false); 295 } 296 }); 297 return false;
298}); 299 300//:::::::::::::::::::::: 301// MENU 302//:::::::::::::::::::::: 303/* 304 * peticion ajax para cambiar agregar una opcion del menu 305 */ 306$(document).on('click', "input[data-role='agregar-opcion']", function () { 307 308 var idMenu = $(this).attr('data-id'); 309 var isChecked = ($(this).is(':checked')) ? 1 : 0; 310 311 $.ajax({ 312 type: 'POST', 313 async: true, 314 url: requestUrl + '/intranet/sitio/agregar-opcion-menu', 315 data: {idMenu: idMenu, value: isChecked}, 316 dataType: 'json', 317 beforeSend: function () { 318 $('html').showLoading(); 319 }, 320 complete: function (data) { 321 $('html').hideLoading(); 322 }, 323 success: function (data) { 324 if (data.result == "ok") { 325 $('.list-menu-corporativo').remove(); 326 $(data.response).insertAfter('#list-menu-corporativo'); 327 $.Webarch.init(); 328 //document.insertBefore(data.response, document.getElementById('list-menu-corporativo')); 329 }else{ 330 alert(data.response); 331 } 332 }, 333 error: function (jqXHR, textStatus, errorThrown) { 334 $('html').hideLoading(); 335 } 336 }); 337}); 338 339$(document).on('click', "a[data-role='me-gusta-contenido']", function () { 340 341 var idContenido = $(this).attr('data-contenido'); 342 var val = $(this).attr('data-value'); 343 344 $.ajax({ 345 type: 'POST', 346 async: true, 347 url: requestUrl + '/intranet/sitio/me-gusta-contenido', 348 data: {idContenido: idContenido, value: val}, 349 dataType: 'json', 350 beforeSend: function () { 351 $('html').showLoading() 352 }, 353 complete: function (data) { 354 $('html').hideLoading(); 355 356 }, 357 success: function (data) { 358 if (data.result == "ok") { 359 $('#numero-megusta-ajax_' + idContenido).addClass('badge badge-info pull-right'); 360 $('#numero-megusta-ajax_' + idContenido).html(data.response); 361 console.log(data.response); 362 if (val == 1) { 363 $("#megusta_" + idContenido).css('display', 'none'); 364 $("#no_megusta_" + idContenido).css('display', ''); 365 } else { 366 $("#no_megusta_" + idContenido).css('display', 'none'); 367 $("#megusta_" + idContenido).css('display', ''); 368 } 369 } 370 }, 371 error: function (jqXHR, textStatus, errorThrown) { 372 $('html').hideLoading(); 373 374 } 375 }); 376}); 377 378$(document).on('click', "button[data-role='guardar-comentario-contenido']", function () { 379 380 var idContenido = $(this).attr('data-contenido'); 381 var comentario = $('#comentario_' + idContenido).val(); 382 383 $.ajax({ 384 type: 'POST', 385 async: true, 386 url: requestUrl + '/intranet/sitio/guardar-comentario', 387 data: {idContenido: idContenido, comentario: comentario}, 388 dataType: 'json', 389 beforeSend: function () { 390 $('html').showLoading() 391 $('#comentario_' + idContenido).prop('disabled', true); 392 $(".comentar").attr('disabled', true); 393 }, 394 complete: function (data) { 395 $('html').hideLoading(); 396 $(".comentar").attr('disabled', false); 397 $('#comentario_' + idContenido).prop('disabled', false); 398 }, 399 success: function (data) { 400 if (data.result == "ok") { 401 $("#contenido_" + idContenido).html(data.response); 402 } 403 404 }, 405 error: function (jqXHR, textStatus, errorThrown) { 406 $('html').hideLoading(); 407 $('#comentario_' + idContenido).prop('disabled', false); 408 $(".comentar").attr('disabled', false); 409 } 410 }); 411}); 412 413$(document).on('click', 'a[data-role="listado-me-gusta-contenido"]', function () { 414 $.ajax({ 415 type: 'POST', 416 dataType: 'json', 417 async: true, 418 url: requestUrl + '/intranet/contenido/listado-me-gusta-contenido', 419 data: {render: true, idContenido: $(this).attr('data-contenido')}, 420 beforeSend: function () {
421 $("#modal-me-gusta-contenido").remove(); 422 $('html').showLoading() 423 }, 424 complete: function () { 425 $('html').hideLoading(); 426 }, 427 success: function (data) { 428 if (data.result == 'ok') { 429 $('body').append(data.response); 430 $("#modal-me-gusta-contenido").modal("show"); 431 } else { 432 alert(data.response); 433 } 434 }, 435 error: function (jqXHR, textStatus, errorThrown) { 436 $('html').hideLoading(); 437 alert('Error: ' + errorThrown); 438 } 439 }); 440 return false; 441}); 442 443$(document).on('click', 'a[data-role="listado-comentarios-contenido"]', function () { 444 $.ajax({ 445 type: 'POST', 446 dataType: 'json', 447 async: true, 448 url: requestUrl + '/intranet/contenido/listado-comentarios-contenido', 449 data: {render: true, idContenido: $(this).attr('data-contenido')}, 450 beforeSend: function () { 451 $("#modal-comentarios-contenido").remove(); 452 $('html').showLoading() 453 }, 454 complete: function () { 455 $('html').hideLoading(); 456 }, 457 success: function (data) { 458 if (data.result == 'ok') { 459 $('body').append(data.response); 460 $("#modal-comentarios-contenido").modal("show"); 461 } else { 462 alert(data.response); 463 } 464 }, 465 error: function (jqXHR, textStatus, errorThrown) { 466 $('html').hideLoading(); 467 468 alert('Error: ' + errorThrown); 469 } 470 }); 471 return false; 472}); 473 474// renderiza el modal del denuncio contenido 475$(document).on('click', 'a[data-role="denunciar-contenido"]', function () { 476 $.ajax({ 477 type: 'POST', 478 dataType: 'json', 479 async: true, 480 url: requestUrl + '/intranet/contenido/denunciar-contenido', 481 data: {render: true, idContenido: $(this).attr('data-contenido'), idLineaTiempo: $(this).attr('data-linea-tiempo')}, 482 beforeSend: function () { 483 $("#modal-comentarios-contenido").remove(); 484 $('html').showLoading() 485 }, 486 complete: function () { 487 $('html').hideLoading(); 488 }, 489 success: function (data) { 490 if (data.result == 'ok') { 491 $('.div-modal-denuncio-contenido').append(data.response); 492 $("#modal-contenido-denuncio").modal("show"); 493 } else { 494 alert(data.response); 495 } 496 }, 497 error: function (jqXHR, textStatus, errorThrown) { 498 $('html').hideLoading(); 499 alert('Error: ' + errorThrown); 500 } 501 }); 502 return false; 503}); 504 505//guarda el denuncio de un contenido 506$(document).on('click', 'button[data-role="guardar-denuncio-contenido"]', function () { 507 508 var form = $("#form-contenido-denuncio") 509 var elemento = $(this).attr('data-linea-tiempo'); 510 511 $.ajax({ 512 type: 'POST', 513 dataType: 'json', 514 async: true, 515 url: requestUrl + '/intranet/contenido/guardar-denuncio-contenido', 516 data: form.serialize(), 517 beforeSend: function () { 518 $('html').showLoading(); 519 }, 520 complete: function () { 521 $('html').hideLoading(); 522 }, 523 success: function (data) { 524 if (data.result == 'ok') { 525 $("#lt" + elemento).html(data.response); 526 $("#modal-contenido-denuncio").modal("hide"); 527 } else { 528 $("#modal-contenido-denuncio").modal("hide"); 529 $('#modal-contenido-denuncio').on('hidden.bs.modal', function (e) { 530 $(".div-modal-denuncio-contenido").html(data.response); 531 $("#modal-contenido-denuncio").modal("show"); 532 }) 533 } 534 }, 535 error: function (jqXHR, textStatus, errorThrown) { 536 $('html').hideLoading(); 537 } 538 }); 539 return false; 540}); 541 542$(document).on('click', 'a[data-role="eliminar-comentario"]', function () { 543 544 var idComentario = $(this).attr("data-comentario"); 545 $.ajax({ 546 type: 'POST', 547 dataType: 'json', 548 async: true, 549 url: requestUrl + '/intranet/contenido/eliminar-comentario', 550 data: {idComentario: idComentario}, 551 beforeSend: function () { 552 $('html').showLoading() 553 }, 554 complete: function () { 555 $('html').hideLoading(); 556 }, 557 success: function (data) { 558 if (data.result == 'ok') {
559 $("#numero-comentarios_"+data.idContenido).empty(); 560 $("#numero-comentarios_"+data.idContenido).append(data.numeroComentarios); 561 $("#comentarios_contenido").html(data.response); 562 } else { 563 alert(data.response); 564 } 565 }, 566 error: function (jqXHR, textStatus, errorThrown) { 567 $('html').hideLoading(); 568 alert('Error: ' + errorThrown); 569 } 570 }); 571 return false; 572}); 573 574// renderiza el modal para eliminar un comentario 575$(document).on('click', 'a[data-role="denunciar-comentario"]', function () { 576 577 var idComentario = $(this).attr("data-comentario"); 578 $.ajax({ 579 type: 'POST', 580 dataType: 'json', 581 async: true, 582 url: requestUrl + '/intranet/contenido/denunciar-comentario', 583 data: {idComentario: idComentario}, 584 beforeSend: function () { 585 $("#modal-comentario-denuncio").remove(); 586 $('html').showLoading() 587 }, 588 complete: function () { 589 $('html').hideLoading(); 590 }, 591 success: function (data) { 592 if (data.result == 'ok') { 593 $("#modal-comentarios-contenido").modal('hide'); 594 $('body').append(data.response); 595 $("#modal-comentario-denuncio").modal('show'); 596 } else { 597 alert(data.response); 598 } 599 }, 600 error: function (jqXHR, textStatus, errorThrown) { 601 $('html').hideLoading(); 602 alert('Error: ' + errorThrown); 603 } 604 }); 605 return false; 606}); 607 608// guarda el denuncio de un comentario 609$(document).on('click', 'button[data-role="guardar-denuncio-comentario"]', function () { 610 611 var form = $("#form-comentario-denuncio") 612 $.ajax({ 613 type: 'POST', 614 dataType: 'json', 615 async: true, 616 url: requestUrl + '/intranet/contenido/guardar-denuncio-comentario', 617 data: form.serialize(), 618 beforeSend: function () { 619 $('html').showLoading() 620 }, 621 complete: function () { 622 $('html').hideLoading(); 623 }, 624 success: function (data) { 625 if (data.result == 'ok') { 626 $("#modal-comentario-denuncio").modal('hide'); 627 } else { 628 $("#modal-comentario-denuncio").modal("hide"); 629 $('#modal-comentario-denuncio').on('hidden.bs.modal', function (e) { 630 $('#modal-comentario-denuncio').remove(); 631 $("body").append(data.response); 632 $("#modal-comentario-denuncio").modal("show"); 633 }) 634 } 635 }, 636 error: function (jqXHR, textStatus, errorThrown) { 637 $('html').hideLoading(); 638 alert('Error: ' + errorThrown); 639 } 640 }); 641 return false; 642}); 643 644$(document).on('click', 'a[data-role="quitar-elemento"]', function () { 645 646 var elemento = $(this).attr('data-elemento'); 647 $.ajax({ 648 type: 'POST', 649 dataType: 'json', 650 async: true, 651 url: requestUrl + '/intranet/sitio/quitar-elemento', 652 data: {elemento: elemento, opcion: 2}, 653 beforeSend: function () { 654 $('html').showLoading(); 655 }, 656 complete: function () { 657 $('html').hideLoading(); 658 }, 659 success: function (data) { 660 }, 661 error: function (jqXHR, textStatus, errorThrown) { 662 $('html').hideLoading(); 663 alert('Error: ' + errorThrown); 664 } 665 }); 666 return false; 667}); 668 669$(document).on('click', 'input[data-role="toggle-elemento"]', function () { 670 671 var elemento = $(this).attr('data-elemento'); 672 var opcion = $(this).prop('checked') ? 1 : 2; 673 674 $.ajax({ 675 type: 'POST', 676 dataType: 'json', 677 async: true, 678 url: requestUrl + '/intranet/sitio/quitar-elemento', 679 data: {elemento: elemento, opcion: opcion}, 680 beforeSend: function () { 681 $('html').showLoading() 682 }, 683 complete: function () { 684 $('html').hideLoading(); 685 }, 686 success: function (data) { 687 }, 688 error: function (jqXHR, textStatus, errorThrown) { 689 $('html').hideLoading(); 690 691 alert('Error: ' + errorThrown); 692 } 693 }); 694 695}); 696 697$(document).on('click', 'a[data-role="agregar-modulo"]', function () { 698 699 var idModulo = $(this).attr('data-modulo'); 700 var idGrupo = $("#idGrupo").val(); 701 702 $.ajax({ 703 type: 'POST', 704 dataType: 'json', 705 async: true, 706 url: requestUrl + '/intranet/modulos-administrables/agregar-modulo', 707 data: {idModulo: idModulo, idGrupo: idGrupo}, 708 beforeSend: function () { 709 $('html').showLoading() 710 }, 711 complete: function () { 712 $('html').hideLoading(); 713 }, 714 success: function (data) { 715 if (data.result == 'ok') { 716 $("#tabla_agregados").yiiGridView("applyFilter"); 717 } 718 }, 719 error: function (jqXHR, textStatus, errorThrown) { 720 $('html').hideLoading(); 721 alert('Error: ' + errorThrown); 722 } 723 }); 724 return false;
725}); 726 727$(document).on('click', 'a[data-role="eliminar-modulo"]', function () { 728 729 var idModulo = $(this).attr('data-modulo'); 730 var idGrupo = $("#idGrupo").val(); 731 732 $.ajax({ 733 type: 'POST', 734 dataType: 'json', 735 async: true, 736 url: requestUrl + '/intranet/modulos-administrables/eliminar-modulo', 737 data: {idModulo: idModulo, idGrupo: idGrupo}, 738 beforeSend: function () { 739 $('html').showLoading() 740 }, 741 complete: function () { 742 $('html').hideLoading(); 743 }, 744 success: function (data) { 745 if (data.result == 'ok') { 746 $("#tabla_agregados").yiiGridView("applyFilter"); 747 } 748 }, 749 error: function (jqXHR, textStatus, errorThrown) { 750 $('html').hideLoading(); 751 alert('Error: ' + errorThrown); 752 } 753 }); 754 return false; 755}); 756 757$(document).on('click', 'a[data-role="editar-modulo"]', function () { 758 759 var idModulo = $(this).attr('data-modulo'); 760 var idGrupo = $("#idGrupo").val(); 761 var orden = $("#orden_" + idModulo).val(); 762 763 $.ajax({ 764 type: 'POST', 765 dataType: 'json', 766 async: true, 767 url: requestUrl + '/intranet/modulos-administrables/editar-modulo', 768 data: {idModulo: idModulo, idGrupo: idGrupo, orden: orden}, 769 beforeSend: function () { 770 $('html').showLoading() 771 }, 772 complete: function () { 773 $('html').hideLoading(); 774 }, 775 success: function (data) { 776 if (data.result == 'ok') { 777 $("#tabla_agregados").yiiGridView("applyFilter"); 778 } 779 }, 780 error: function (jqXHR, textStatus, errorThrown) { 781 $('html').hideLoading(); 782 alert('Error: ' + errorThrown); 783 } 784 }); 785 return false; 786}); 787 788 789 790$('#selectCiudadVisualizacion').change(function() { 791 $.ajax({ 792 type: 'POST', 793 async: true, 794 url: requestUrl + '/intranet/sitio/cambiar-ciudad-visualizacion', 795 data: {codigoCiudad: $(this).val()}, 796 dataType: 'json', 797 beforeSend: function () { 798 $('html').showLoading(); 799 800 }, 801 complete: function (data) { 802 $('html').hideLoading(); 803 }, 804 success: function (data) { 805 console.log(data); 806 location.reload(); 807 }, 808 error: function (jqXHR, textStatus, errorThrown) { 809 $('html').hideLoading(); 810 alert('Error: ' + errorThrown); 811 } 812 }); 813console.log($(this).val()); 814}); 815 816 817$(document).on('click', 'a[data-role="redimir-premio"]', function () { 818 819 var idPremio = $(this).attr('data-premio'); 820 var cantidad = $("#cantidad_"+idPremio).val(); 821 822 $.ajax({ 823 type: 'POST', 824 dataType: 'json', 825 async: true, 826 url: requestUrl + '/intranet/formacioncomunicaciones/premios/verificar-redimir', 827 data: {idPremio: idPremio, cantidad: cantidad}, 828 beforeSend: function () { 829 $('html').showLoading() 830 }, 831 complete: function () { 832 $('html').hideLoading(); 833 }, 834 success: function (data) { 835 if (data.result == 'ok') { 836 alert(data.response); 837 $("#puntos-totales").html(data.puntos); 838 $("#cantidaddisponible_"+idPremio).html(data.cantidades); 839 }else{ 840 alert(data.response); 841 } 842 }, 843 error: function (jqXHR, textStatus, errorThrown) { 844 $('html').hideLoading(); 845 alert('Error: ' + errorThrown); 846 } 847 }); 848 return false; 849}); 850 851 852$(document).on('click','button[data-role="tramitar-redenciones"]',function() { 853 var keys = $('#gridRedenciones').yiiGridView('getSelectedRows'); 854 var estado = $(this).attr('data-estado'); 855 var observaciones = $("#observacion").val(); 856 var fechaEntrega = $("#fecha_entrega").val(); 857 $.post({ 858 url: requestUrl + '/intranet/formacioncomunicaciones/premios/cambiar-estado-redencion', 859 dataType: 'json', 860 data: {premios: keys, estado:estado,fechaEntrega:fechaEntrega,observaciones:observaciones}, 861 success: function(data) { 862 if (data.result === 'ok') { 863 864 $("#gridRedenciones").yiiGridView("applyFilter"); 865 }else{ 866 alert(data.response); 867 } 868 }, 869 }); 870}); 871 872 873 874$(document).on('click', 'button[data-role="guardarRespuesta"]', function () { 875 876 var form = $("#formOpciones"); 877 878 $.ajax({ 879 type: 'POST', 880 dataType: 'json', 881 async: true, 882 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/guardar-opcion-respuesta', 883 data: form.serialize(), 884 beforeSend: function () { 885 $('html').showLoading() 886 }, 887 complete: function () { 888 $('html').hideLoading(); 889 }, 890 success: function (data) { 891 if (data.result == 'ok') { 892 $("#opciones-agregadas").yiiGridView("applyFilter"); 893 }else{ 894 alert(data.response); 895 } 896 }, 897 error: function (jqXHR, textStatus, errorThrown) { 898 $('html').hideLoading(); 899 alert('Error: ' + errorThrown); 900 } 901 }); 902 return false;
903}); 904 905$(document).on('click', 'button[data-role="guardarRespuestaFalsoVerdadero"]', function () { 906 907 var form = $("#formOpciones"); 908 909 $.ajax({ 910 type: 'POST', 911 dataType: 'json', 912 async: true, 913 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/guardar-opcion-respuesta', 914 data: form.serialize(), 915 beforeSend: function () { 916 $('html').showLoading() 917 }, 918 complete: function () { 919 $('html').hideLoading(); 920 }, 921 success: function (data) { 922 if (data.result == 'ok') { 923 $("#opciones-agregadas").yiiGridView("applyFilter"); 924 }else{ 925 alert(data.response); 926 } 927 }, 928 error: function (jqXHR, textStatus, errorThrown) { 929 $('html').hideLoading(); 930 alert('Error: ' + errorThrown); 931 } 932 }); 933 return false; 934}); 935 936$(document).on('click', 'button[data-role="guardarPreguntaCompletar"]', function () { 937 938 var form = $("#formOpciones"); 939 940 $.ajax({ 941 type: 'POST', 942 dataType: 'json', 943 async: true, 944 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/guardar-pregunta-completar', 945 data: form.serialize(), 946 beforeSend: function () { 947 $('html').showLoading() 948 }, 949 complete: function () { 950 $('html').hideLoading(); 951 }, 952 success: function (data) { 953 if (data.result == 'ok') { 954 $("#preguntas-agregadas").yiiGridView("applyFilter"); 955 }else{ 956 alert(data.response); 957 } 958 }, 959 error: function (jqXHR, textStatus, errorThrown) { 960 $('html').hideLoading(); 961 alert('Error: ' + errorThrown); 962 } 963 }); 964 return false; 965}); 966 967$(document).on('click', 'a[data-role="eliminar-opcion"]', function () { 968 969 $.ajax({ 970 type: 'POST', 971 dataType: 'json', 972 async: true, 973 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/eliminar-opcion', 974 data: {idOpcionRespuesta:$(this).attr('data-opcion-respuesta')}, 975 beforeSend: function () { 976 $('html').showLoading() 977 }, 978 complete: function () { 979 $('html').hideLoading(); 980 }, 981 success: function (data) { 982 if (data.result == 'ok') { 983 $("#opciones-agregadas").yiiGridView("applyFilter"); 984 } 985 }, 986 error: function (jqXHR, textStatus, errorThrown) { 987 $('html').hideLoading(); 988 alert('Error: ' + errorThrown); 989 } 990 }); 991 return false; 992}); 993 994$(document).on('click', 'a[data-role="agregar-opciones-completar"]', function () { 995 996 $.ajax({ 997 type: 'POST', 998 dataType: 'json', 999 async: true, 1000 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/agregar-opciones-completar', 1001 data: {idPregunta:$(this).attr('data-pregunta')}, 1002 beforeSend: function () { 1003 $('html').showLoading(); 1004 $("#modal-opciones-completar").remove(); 1005 }, 1006 complete: function () { 1007 $('html').hideLoading(); 1008 }, 1009 success: function (data) { 1010 $('body').append(data.response); 1011 $("#modal-opciones-completar").modal("show"); 1012 }, 1013 error: function (jqXHR, textStatus, errorThrown) { 1014 $('html').hideLoading(); 1015 alert('Error: ' + errorThrown); 1016 } 1017 }); 1018 return false; 1019}); 1020 1021$(document).on('click', 'button[data-role="guardar-respuesta-completar"]', function () { 1022 1023 var form = $("#form-opciones-completar"); 1024 1025 $.ajax({ 1026 type: 'POST', 1027 dataType: 'json', 1028 async: true, 1029 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/guardar-opcion-completar', 1030 data: form.serialize(), 1031 beforeSend: function () { 1032 $('html').showLoading(); 1033 }, 1034 complete: function () { 1035 $('html').hideLoading(); 1036 }, 1037 success: function (data) { 1038 if(data.result == 'ok'){ 1039 $("#tabla-opciones").html(data.response); 1040 }else{ 1041 alert(data.response); 1042 } 1043 }, 1044 error: function (jqXHR, textStatus, errorThrown) { 1045 $('html').hideLoading(); 1046 alert('Error: ' + errorThrown); 1047 } 1048 }); 1049 return false;
1050}); 1051 1052$(document).on('click', 'a[data-role="editar-opcion"]', function () { 1053 1054 $.ajax({ 1055 type: 'POST', 1056 dataType: 'json', 1057 async: true, 1058 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/editar-opcion-modal', 1059 data: {idOpcionRespuesta: $(this).attr('data-opcion-respuesta')}, 1060 beforeSend: function () { 1061 $('html').showLoading(); 1062 $("#modal-editar-opciones").remove(); 1063 }, 1064 complete: function () { 1065 $('html').hideLoading(); 1066 }, 1067 success: function (data) { 1068 if(data.result == 'ok'){ 1069 $('body').append(data.response); 1070 $("#modal-editar-opciones").modal("show"); 1071 }else{ 1072 alert(data.response); 1073 } 1074 }, 1075 error: function (jqXHR, textStatus, errorThrown) { 1076 $('html').hideLoading(); 1077 alert('Error: ' + errorThrown); 1078 } 1079 }); 1080 return false; 1081}); 1082 1083$(document).on('click', 'button[data-role="actualizar-opcion-respuesta"]', function () { 1084 1085 $.ajax({ 1086 type: 'POST', 1087 dataType: 'json', 1088 async: true, 1089 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/guardar-opcion-editar', 1090 data: $("#form-opciones-editar").serialize(), 1091 beforeSend: function () { 1092 $('html').showLoading(); 1093 }, 1094 complete: function () { 1095 $('html').hideLoading(); 1096 }, 1097 success: function (data) { 1098 if(data.result == 'ok'){ 1099 $("#modal-editar-opciones").remove(); 1100 $("#opciones-agregadas").yiiGridView("applyFilter"); 1101 }else{ 1102 alert(data.response); 1103 } 1104 }, 1105 error: function (jqXHR, textStatus, errorThrown) { 1106 $('html').hideLoading(); 1107 alert('Error: ' + errorThrown); 1108 } 1109 }); 1110 return false; 1111 }); 1112 1113$(document).on('change', '#cuestionario-idcurso', function () { 1114 $.ajax({ 1115 type: 'POST', 1116 dataType: 'json', 1117 async: true, 1118 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/buscar-contenidos', 1119 data: {idCurso: $(this).val()}, 1120 beforeSend: function () { 1121 $('html').showLoading(); 1122 }, 1123 complete: function () { 1124 $('html').hideLoading(); 1125 }, 1126 success: function (data) { 1127 if(data.result == 'ok'){ 1128 $("#cuestionario-idcontenido").html(data.response); 1129 }else{ 1130 alert(data.response); 1131 } 1132 }, 1133 error: function (jqXHR, textStatus, errorThrown) { 1134 $('html').hideLoading(); 1135 alert('Error: ' + errorThrown); 1136 } 1137 }); 1138 1139}); 1140 1141$(document).on('click', 'a[data-role="visualizar-pregunta"]', function () { 1142 1143 $.ajax({ 1144 type: 'POST', 1145 dataType: 'json', 1146 async: true, 1147 url: requestUrl + '/intranet/formacioncomunicaciones/cuestionario/visualizar-pregunta-demo', 1148 data: {idPregunta: $(this).attr('data-pregunta')}, 1149 beforeSend: function () { 1150 $('html').showLoading(); 1151 $("#modal-visualizacion-pregunta").remove(); 1152 }, 1153 complete: function () { 1154 $('html').hideLoading(); 1155 }, 1156 success: function (data) { 1157 if(data.result == 'ok'){ 1158 $('body').append(data.response); 1159 $("#modal-visualizacion-pregunta").modal('show'); 1160 }else{ 1161 alert(data.response); 1162 } 1163 }, 1164 error: function (jqXHR, textStatus, errorThrown) { 1165 $('html').hideLoading(); 1166 alert('Error: ' + errorThrown); 1167 } 1168 }); 1169 return false; 1170 }); 1171 1172$(document).on('click', "a[data-role='modal-premio-categoria']", function () { 1173 $.ajax({ 1174 type: 'GET', 1175 async: true, 1176 url: requestUrl + '/intranet/formacioncomunicaciones/categorias-premios/render-modal-asignar-premio', 1177 dataType: 'json', 1178 beforeSend: function() { 1179 $('body').showLoading(); 1180 }, 1181 complete: function(data) { 1182 $('body').hideLoading(); 1183 }, 1184 success: function(data) { 1185 if (data.result == "ok") { 1186 $('#modal-asignar-categoria-premio').remove(); 1187 $('body').append(data.response); 1188 $('#modal-asignar-categoria-premio').modal('show'); 1189 } 1190 }, 1191 error: function(jqXHR, textStatus, errorThrown) { 1192 $('body').hideLoading(); 1193 } 1194 }); 1195 }); 1196 1197$(document).on('click', "a[data-role='categoria-premio-asignar']", function () { 1198 var idCategoria = $(this).attr('data-id-categoria'); 1199 var nombreCategoria = $(this).attr('data-nombre-categoria'); 1200 $('#categoriaspremios-idcategoriapadre').val(idCategoria); 1201 $('#premio-idcategoria').val(idCategoria); 1202 $("a[data-role='modal-premio-categoria']").text(nombreCategoria);
1203 $('#modal-asignar-categoria-premio').modal('hide'); 1204}); 1205 1206function validarBono(){ 1207 if($('#premio-tipopremio').val() == 1){ 1208 $('#divbono').css('display','none'); 1209 }else{ 1210 $('#divbono').css('display','block'); 1211 } 1212}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.