Current Path : C:/xampp/htdocs/moodle/calendar/amd/build/ |
Current File : C:/xampp/htdocs/moodle/calendar/amd/build/calendar.min.js |
define ("core_calendar/calendar",["jquery","core/ajax","core/str","core/templates","core/notification","core/custom_interaction_events","core/modal_events","core/modal_factory","core_calendar/modal_event_form","core_calendar/summary_modal","core_calendar/repository","core_calendar/events","core_calendar/view_manager","core_calendar/crud","core_calendar/selectors"],function(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p){var q={ROOT:"[data-region='calendar']",DAY:"[data-region='day']",NEW_EVENT_BUTTON:"[data-action='new-event-button']",DAY_CONTENT:"[data-region='day-content']",LOADING_ICON:".loading-icon",VIEW_DAY_LINK:"[data-action='view-day-link']",CALENDAR_MONTH_WRAPPER:".calendarwrapper",TODAY:".today"},r=function(b,c,e,g){var h=null,i=g.attr("data-day-timestamp");if(e){h=e.attr("data-day-timestamp")}if(!e||h!=i){d.render("core/loading",{}).then(function(a,b){g.find(q.DAY_CONTENT).addClass("hidden");d.appendNodeContents(g,a,b);if(e){e.find(q.DAY_CONTENT).addClass("hidden");d.appendNodeContents(e,a,b)}}).then(function(){return l.updateEventStartDay(c,i)}).then(function(){a("body").trigger(m.eventMoved,[c,e,g])}).always(function(){var a=g.find(q.LOADING_ICON);g.find(q.DAY_CONTENT).removeClass("hidden");d.replaceNode(a,"","");if(e){var b=e.find(q.LOADING_ICON);e.find(q.DAY_CONTENT).removeClass("hidden");d.replaceNode(b,"","")}}).fail(f.exception)}},s=function(b,c){var d=a("body");d.on(m.created,function(){n.reloadCurrentMonth(b)});d.on(m.deleted,function(){n.reloadCurrentMonth(b)});d.on(m.updated,function(){n.reloadCurrentMonth(b)});d.on(m.editActionEvent,function(a,b){window.location.assign(b)});d.on(m.moveEvent,r);d.on(m.eventMoved,function(){n.reloadCurrentMonth(b)});o.registerEditListeners(b,c)},t=function(b){b.on("click",q.VIEW_DAY_LINK,function(c){var d=a(c.target),e=d.data("year"),g=d.data("month"),h=d.data("day"),i=d.data("courseid"),j=d.data("categoryid");n.refreshDayContent(b,e,g,h,i,j,b,"core_calendar/calendar_day").then(function(){c.preventDefault();var a="?view=day&time="+d.data("timestamp");return window.history.pushState({},"",a)}).fail(f.exception)});b.on("change",p.elements.courseSelector,function(){var c=a(this),d=c.val();n.reloadCurrentMonth(b,d,null).then(function(){return b.find(p.elements.courseSelector).val(d)}).fail(f.exception)});var c=o.registerEventFormModal(b),d=a(q.CALENDAR_MONTH_WRAPPER).data("context-id");s(b,c);if(d){b.on("click",q.DAY,function(b){var d=a(b.target);if(!d.is(q.VIEW_DAY_LINK)){var e=a(this).attr("data-new-event-timestamp");c.then(function(a){var b=d.closest(p.wrapper);a.setCourseId(b.data("courseid"));var c=b.data("categoryid");if("undefined"!=typeof c){a.setCategoryId(c)}a.setContextId(b.data("contextId"));a.setStartTime(e);a.show()}).fail(f.exception);b.preventDefault()}})}};return{init:function init(b){b=a(b);n.init(b);t(b)}}}); //# sourceMappingURL=calendar.min.js.map