{"version":3,"file":"calendar_view.min.js","sources":["https:\/\/training-formation.phac-aspc.gc.ca\/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\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\/str',\n 'core\/notification',\n 'core_calendar\/selectors',\n 'core_calendar\/events',\n 'core_calendar\/view_manager',\n 'core_calendar\/repository',\n 'core\/modal_factory',\n 'core_calendar\/modal_event_form',\n 'core\/modal_events',\n 'core_calendar\/crud'\n ],\n function(\n $,\n Str,\n Notification,\n CalendarSelectors,\n CalendarEvents,\n CalendarViewManager,\n CalendarRepository,\n ModalFactory,\n ModalEventForm,\n ModalEvents,\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) {\n root = $(root);\n\n CalendarViewManager.init(root, type);\n registerEventListeners(root, type);\n }\n };\n });\n"],"names":["define","$","Str","Notification","CalendarSelectors","CalendarEvents","CalendarViewManager","CalendarRepository","ModalFactory","ModalEventForm","ModalEvents","CalendarCrud","init","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","registerEventListeners"],"mappings":";;;;;;;AAsBAA,qCAAO,CACC,SACA,WACA,oBACA,0BACA,uBACA,6BACA,2BACA,qBACA,iCACA,oBACA,uBAEJ,SACIC,EACAC,IACAC,aACAC,kBACAC,eACAC,oBACAC,mBACAC,aACAC,eACAC,YACAC,oBAgDO,CACHC,KAAM,SAASC,KAAMC,MACjBD,KAAOZ,EAAEY,MAETP,oBAAoBM,KAAKC,KAAMC,MAjDV,SAASD,KAAMC,UACpCC,KAAOd,EAAE,QAEbU,aAAaK,eAAeH,UAExBI,eAAiB,gBAAkBH,KAAKI,OAAO,GAAGC,cAAgBL,KAAKM,MAAM,GAEjFL,KAAKM,GAAGhB,eAAeiB,SAAS,WAC5BhB,oBAAoBW,gBAAgBJ,SAExCE,KAAKM,GAAGhB,eAAekB,SAAS,WAC5BjB,oBAAoBW,gBAAgBJ,SAExCE,KAAKM,GAAGhB,eAAemB,SAAS,WAC5BlB,oBAAoBW,gBAAgBJ,SAGxCA,KAAKQ,GAAG,SAAUjB,kBAAkBqB,gBAAgB,eAE5CC,SADgBzB,EAAE0B,MACOC,MAC7BtB,oBAAoBW,gBAAgBJ,KAAMa,SAAU,MAC\/CG,MAAK,kBAEKhB,KAAKiB,KAAK1B,kBAAkBqB,gBAAgBG,IAAIF,aAE1DG,MAAK,WACFvB,oBAAoByB,UAAU,yBAA2BL,aAE5DM,KAAK7B,aAAa8B,cAG3BlB,KAAKM,GAAGhB,eAAe6B,eAAe,SAASC,EAAGC,UAC1CC,cAAgBxB,KAAKiB,KAAK1B,kBAAkBkC,UAAUF,KAAKtB,OAC5C,GAAfsB,KAAKG,OACLF,cAAcG,SAAS,UAEvBH,cAAcI,YAAY,UAE9BnC,oBAAoBoC,cAAc7B,aAGlC8B,iBAAmBhC,aAAaiC,uBAAuB\/B,MAC3DF,aAAakC,sBAAsBhC,KAAM8B,kBAQrCG,CAAuBjC,KAAMC"}