Current Path : C:/xampp/htdocs/moodle/report/progress/amd/build/ |
Current File : C:/xampp/htdocs/moodle/report/progress/amd/build/completion_override.min.js |
define ("report_progress/completion_override",["jquery","core/ajax","core/str","core/modal_factory","core/modal_events","core/notification","core/custom_interaction_events","core/templates"],function(a,b,c,d,e,f,g,h){var i,j,k=function(a,b){return 0<a?"i/completion-"+b+"-y-override":"i/completion-"+b+"-n-override"},l=function(a){h.render("core/loading",{}).then(function(c){j.append(c);return b.call([{methodname:"core_completion_override_activity_completion_status",args:a}])[0]}).then(function(b){var d=0<b.state?1:0,e=d?"completion-y-override":"completion-n-override";c.get_string(e,"completion",i).then(function(a){var b={state:a,date:"",user:j.attr("data-userfullname"),activity:j.attr("data-activityname")};return c.get_string("progress-title","completion",b)}).then(function(a){var b=j.attr("data-completiontracking");return h.renderPix(k(d,b),"core",a)}).then(function(b){var c=0<d?0:1;j.find(".loading-icon").remove();j.data("changecompl",a.userid+"-"+a.cmid+"-"+c);j.attr("data-changecompl",a.userid+"-"+a.cmid+"-"+c);j.children("img").replaceWith(b)}).catch(f.exception)}).catch(f.exception)},m=function(b,g){g.originalEvent.preventDefault();g.originalEvent.stopPropagation();b.preventDefault();b.stopPropagation();j=a(b.currentTarget);var h=j.data("changecompl").split("-"),i={userid:h[0],cmid:h[1],newstate:h[2]},k=1==i.newstate?"completion-y":"completion-n";c.get_strings([{key:k,component:"completion"}]).then(function(a){return c.get_strings([{key:"confirm",component:"moodle"},{key:"areyousureoverridecompletion",component:"completion",param:a[0]}])}).then(function(a){return d.create({type:d.types.SAVE_CANCEL,title:a[0],body:a[1]})}).then(function(a){a.getRoot().on(e.save,function(){l(i)});a.getRoot().on(e.hidden,function(){j.focus();a.destroy()});a.show()}).catch(f.exception)};return{init:function init(b){i=b;a("#completion-progress a.changecompl").each(function(a,b){g.define(b,[g.events.activate])});a("#completion-progress").on(g.events.activate,"a.changecompl",function(a,b){m(a,b)})}}}); //# sourceMappingURL=completion_override.min.js.map