{"version":3,"file":"calendar_view.min.js","sources":["https:\/\/amos.ukf.sk\/calendar\/amd\/src\/calendar_view.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle is distributed in the hope that it will be useful,\n\/\/ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\/\/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\/\/ GNU General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle. If not, see .\n\n\/**\n * This module is responsible for handle calendar day and upcoming view.\n *\n * @module core_calendar\/calendar_view\n * @copyright 2017 Simey Lameze \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\ndefine([\n 'jquery',\n 'core\/notification',\n 'core_calendar\/selectors',\n 'core_calendar\/events',\n 'core_calendar\/view_manager',\n 'core_calendar\/crud'\n],\nfunction(\n $,\n Notification,\n CalendarSelectors,\n CalendarEvents,\n CalendarViewManager,\n CalendarCrud\n) {\n\n var registerEventListeners = function(root, type) {\n var body = $('body');\n\n CalendarCrud.registerRemove(root);\n\n var reloadFunction = 'reloadCurrent' + type.charAt(0).toUpperCase() + type.slice(1);\n\n body.on(CalendarEvents.created, function() {\n CalendarViewManager[reloadFunction](root);\n });\n body.on(CalendarEvents.deleted, function() {\n CalendarViewManager[reloadFunction](root);\n });\n body.on(CalendarEvents.updated, function() {\n CalendarViewManager[reloadFunction](root);\n });\n\n root.on('change', CalendarSelectors.courseSelector, function() {\n var selectElement = $(this);\n var courseId = selectElement.val();\n CalendarViewManager[reloadFunction](root, courseId, null)\n .then(function() {\n \/\/ We need to get the selector again because the content has changed.\n return root.find(CalendarSelectors.courseSelector).val(courseId);\n })\n .then(function() {\n CalendarViewManager.updateUrl('?view=upcoming&course=' + courseId);\n })\n .fail(Notification.exception);\n });\n\n body.on(CalendarEvents.filterChanged, function(e, data) {\n var daysWithEvent = root.find(CalendarSelectors.eventType[data.type]);\n if (data.hidden == true) {\n daysWithEvent.addClass('hidden');\n } else {\n daysWithEvent.removeClass('hidden');\n }\n CalendarViewManager.foldDayEvents(root);\n });\n\n var eventFormPromise = CalendarCrud.registerEventFormModal(root);\n CalendarCrud.registerEditListeners(root, eventFormPromise);\n };\n\n return {\n init: function(root, type, isCalendarBlock = false) {\n root = $(root);\n\n CalendarViewManager.init(root, type, isCalendarBlock);\n registerEventListeners(root, type, isCalendarBlock);\n }\n };\n });\n"],"names":["define","$","Notification","CalendarSelectors","CalendarEvents","CalendarViewManager","CalendarCrud","registerEventListeners","root","type","body","registerRemove","reloadFunction","charAt","toUpperCase","slice","on","created","deleted","updated","courseSelector","courseId","this","val","then","find","updateUrl","fail","exception","filterChanged","e","data","daysWithEvent","eventType","hidden","addClass","removeClass","foldDayEvents","eventFormPromise","registerEventFormModal","registerEditListeners","init","isCalendarBlock"],"mappings":";;;;;;;AAsBAA,qCAAO,CACH,SACA,oBACA,0BACA,uBACA,6BACA,uBAEJ,SACIC,EACAC,aACAC,kBACAC,eACAC,oBACAC,kBAGQC,uBAAyB,SAASC,KAAMC,UACpCC,KAAOT,EAAE,QAEbK,aAAaK,eAAeH,UAExBI,eAAiB,gBAAkBH,KAAKI,OAAO,GAAGC,cAAgBL,KAAKM,MAAM,GAEjFL,KAAKM,GAAGZ,eAAea,SAAS,WAC5BZ,oBAAoBO,gBAAgBJ,SAExCE,KAAKM,GAAGZ,eAAec,SAAS,WAC5Bb,oBAAoBO,gBAAgBJ,SAExCE,KAAKM,GAAGZ,eAAee,SAAS,WAC5Bd,oBAAoBO,gBAAgBJ,SAGxCA,KAAKQ,GAAG,SAAUb,kBAAkBiB,gBAAgB,eAE5CC,SADgBpB,EAAEqB,MACOC,MAC7BlB,oBAAoBO,gBAAgBJ,KAAMa,SAAU,MAC\/CG,MAAK,kBAEKhB,KAAKiB,KAAKtB,kBAAkBiB,gBAAgBG,IAAIF,aAE1DG,MAAK,WACFnB,oBAAoBqB,UAAU,yBAA2BL,aAE5DM,KAAKzB,aAAa0B,cAG3BlB,KAAKM,GAAGZ,eAAeyB,eAAe,SAASC,EAAGC,UAC1CC,cAAgBxB,KAAKiB,KAAKtB,kBAAkB8B,UAAUF,KAAKtB,OAC5C,GAAfsB,KAAKG,OACLF,cAAcG,SAAS,UAEvBH,cAAcI,YAAY,UAE9B\/B,oBAAoBgC,cAAc7B,aAGlC8B,iBAAmBhC,aAAaiC,uBAAuB\/B,MAC3DF,aAAakC,sBAAsBhC,KAAM8B,yBAGtC,CACHG,KAAM,SAASjC,KAAMC,UAAMiC,wEACvBlC,KAAOP,EAAEO,MAETH,oBAAoBoC,KAAKjC,KAAMC,KAAMiC,iBACrCnC,uBAAuBC,KAAMC"}