Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.8 KiB

5 years ago
  1. $(function() {
  2. $('#revisionTareaModal').on('show.bs.modal', function (event) {
  3. let button = $(event.relatedTarget); // Button that triggered the modal
  4. let iframsrc = button.data('iframesrc');
  5. let modal = $(this);
  6. modal.find('iframe').attr('src', iframsrc);
  7. $("#wnModal").find('button.close').trigger('click');
  8. }).on('hidden.bs.modal', function (e) {
  9. let modal = $(this);
  10. modal.find('iframe').remove();
  11. modal.find('.modal-body').html('<iframe src=""></iframe>');
  12. $('body').css('padding-right', 0);
  13. let userId = $(this).data('userId');
  14. let classId = $(this).data('classId');
  15. $.get( "/es/admin/api/countTareasByTrainer/"+classId+'/'+userId, function ( data ) {
  16. if (data) {
  17. let totalTareasElem = $('.progress-block').find('.info-box').last();
  18. if(totalTareasElem){
  19. totalTareasElem.find('.info-box-icon').text(data.total);
  20. totalTareasElem.find('span.number').text(data.total);
  21. }
  22. if(parseInt(data.user) === 0){
  23. $(".btn-wn").find('.unreaded').hide();
  24. }else{
  25. $(".btn-wn").find('.unreaded').text(data.user);
  26. }
  27. }//if
  28. });
  29. });
  30. $("#wnModal").on('show.bs.modal', function (event) {
  31. let url = $(this).data('urlajax');
  32. let userId = $(this).data('userid');
  33. let classId = $(this).data('classid');
  34. $('#revisionTareaModal').data('classId', classId);
  35. $('#revisionTareaModal').data('userId', userId);
  36. $(this).find('.loader').show();
  37. $.get(url, {userId:userId, classId:classId}, function(response){
  38. console.log(response);
  39. let htmlContent = response.error ? response.message : response;
  40. $("#body-whats-new").html(htmlContent);
  41. });
  42. });
  43. $(".workshop").each(function(){
  44. countTareasByWorkshop($(this));
  45. });
  46. $(".entrepreneur").each(function(){
  47. countTareasByWorkshopAndUser($(this));
  48. });
  49. function countTareasByWorkshop (object){
  50. $.get( "/es/admin/api/countTareasByWorkshop/"+object.data("id"), function ( data ) {
  51. if (!data)
  52. object.hide();
  53. else {
  54. object.html( data );
  55. object.css("display","flex");
  56. }//else
  57. });
  58. }//function
  59. function countTareasByWorkshopAndUser (object){
  60. $.get( "/es/admin/api/countTareasByWorkshopAndUser/"+object.data("workshop")+"/"+object.data("id"), function ( data ) {
  61. if (!data)
  62. object.hide();
  63. else {
  64. object.html( data );
  65. object.css("display","flex");
  66. }//else
  67. });
  68. }//function
  69. });