Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/calendar/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/calendar/amd/build/crud.min.js

define ("core_calendar/crud",["jquery","core/str","core/notification","core/custom_interaction_events","core/modal","core/modal_registry","core/modal_factory","core/modal_events","core_calendar/modal_event_form","core_calendar/repository","core_calendar/events","core_calendar/modal_delete","core_calendar/selectors","core/pending"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){function o(d,e,f){var i=new n("core_calendar/crud:confirmDeletion"),m=[{key:"deleteevent",component:"calendar"}];f=parseInt(f,10);var o,p=1<f;if(p){m.push({key:"confirmeventseriesdelete",component:"calendar",param:{name:e,count:f}});o=g.create({type:l.TYPE})}else{m.push({key:"confirmeventdelete",component:"calendar",param:e});o=g.create({type:g.types.SAVE_CANCEL})}var q=b.get_strings(m),r=a.when(q,o).then(function(b,e){e.setRemoveOnClose(!0);e.setTitle(b[0]);e.setBody(b[1]);if(!p){e.setSaveButtonText(b[0])}e.show();e.getRoot().on(h.save,function(){var b=new n("calendar/crud:initModal:deletedevent");j.deleteEvent(d,!1).then(function(){a("body").trigger(k.deleted,[d,!1])}).then(b.resolve).catch(c.exception)});e.getRoot().on(k.deleteAll,function(){var b=new n("calendar/crud:initModal:deletedallevent");j.deleteEvent(d,!0).then(function(){a("body").trigger(k.deleted,[d,!0])}).then(b.resolve).catch(c.exception)});return e}).then(function(a){i.resolve();return a}).catch(c.exception);return r}return{registerRemove:function(b){b.on("click",m.actions.remove,function(b){var c=a(this).closest(m.eventItem),d=c.data("eventId"),e=c.data("eventTitle"),f=c.data("eventCount");o(d,e,f);b.preventDefault()})},registerEditListeners:function(b,d){var e=new n("core_calendar/crud:registerEditListeners");return d.then(function(c){a("body").on(k.editEvent,function(a,d){var e=b.find(m.wrapper);c.setEventId(d);c.setContextId(e.data("contextId"));c.show();a.stopImmediatePropagation()});return c}).then(function(a){e.resolve();return a}).catch(c.exception)},registerEventFormModal:function registerEventFormModal(b){var d=g.create({type:i.TYPE,large:!0});b.on("click",m.actions.create,function(a){d.then(function(a){var c=b.find(m.wrapper),d=c.data("categoryid");if("undefined"!=typeof d){a.setCategoryId(d)}var e=b.find(m.today),f=b.find(m.day);if(!e.length&&f.length){a.setStartTime(f.data("newEventTimestamp"))}a.setContextId(c.data("contextId"));a.setCourseId(c.data("courseid"));a.show()}).fail(c.exception);a.preventDefault()});b.on("click",m.actions.edit,function(b){b.preventDefault();var e=a(b.currentTarget),f=e.closest(m.wrapper),g=e.closest(m.eventItem);d.then(function(a){a.setEventId(g.data("eventId"));a.setContextId(f.data("contextId"));a.show();b.stopImmediatePropagation()}).fail(c.exception)});return d}}});
//# sourceMappingURL=crud.min.js.map