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.
74 lines
2.8 KiB
74 lines
2.8 KiB
$(function() {
|
|
$('#revisionTareaModal').on('show.bs.modal', function (event) {
|
|
let button = $(event.relatedTarget); // Button that triggered the modal
|
|
let iframsrc = button.data('iframesrc');
|
|
let modal = $(this);
|
|
modal.find('iframe').attr('src', iframsrc);
|
|
$("#wnModal").find('button.close').trigger('click');
|
|
}).on('hidden.bs.modal', function (e) {
|
|
let modal = $(this);
|
|
modal.find('iframe').remove();
|
|
modal.find('.modal-body').html('<iframe src=""></iframe>');
|
|
$('body').css('padding-right', 0);
|
|
let userId = $(this).data('userId');
|
|
let classId = $(this).data('classId');
|
|
$.get( "/es/admin/api/countTareasByTrainer/"+classId+'/'+userId, function ( data ) {
|
|
if (data) {
|
|
let totalTareasElem = $('.progress-block').find('.info-box').last();
|
|
if(totalTareasElem){
|
|
totalTareasElem.find('.info-box-icon').text(data.total);
|
|
totalTareasElem.find('span.number').text(data.total);
|
|
}
|
|
if(parseInt(data.user) === 0){
|
|
$(".btn-wn").find('.unreaded').hide();
|
|
}else{
|
|
$(".btn-wn").find('.unreaded').text(data.user);
|
|
}
|
|
}//if
|
|
});
|
|
});
|
|
$("#wnModal").on('show.bs.modal', function (event) {
|
|
let url = $(this).data('urlajax');
|
|
let userId = $(this).data('userid');
|
|
let classId = $(this).data('classid');
|
|
$('#revisionTareaModal').data('classId', classId);
|
|
$('#revisionTareaModal').data('userId', userId);
|
|
$(this).find('.loader').show();
|
|
$.get(url, {userId:userId, classId:classId}, function(response){
|
|
console.log(response);
|
|
let htmlContent = response.error ? response.message : response;
|
|
$("#body-whats-new").html(htmlContent);
|
|
});
|
|
});
|
|
|
|
$(".workshop").each(function(){
|
|
countTareasByWorkshop($(this));
|
|
});
|
|
|
|
$(".entrepreneur").each(function(){
|
|
countTareasByWorkshopAndUser($(this));
|
|
});
|
|
|
|
function countTareasByWorkshop (object){
|
|
$.get( "/es/admin/api/countTareasByWorkshop/"+object.data("id"), function ( data ) {
|
|
if (!data)
|
|
object.hide();
|
|
else {
|
|
object.html( data );
|
|
object.css("display","flex");
|
|
}//else
|
|
});
|
|
}//function
|
|
|
|
function countTareasByWorkshopAndUser (object){
|
|
$.get( "/es/admin/api/countTareasByWorkshopAndUser/"+object.data("workshop")+"/"+object.data("id"), function ( data ) {
|
|
if (!data)
|
|
object.hide();
|
|
else {
|
|
object.html( data );
|
|
object.css("display","flex");
|
|
}//else
|
|
});
|
|
}//function
|
|
|
|
});
|