{"version":3,"file":"modal_event_form.min.js","sources":["../src/modal_event_form.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the quick add or update event modal.\n *\n * @module core_calendar/modal_event_form\n * @copyright 2017 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport * as CustomEvents from 'core/custom_interaction_events';\nimport Modal from 'core/modal';\nimport * as FormEvents from 'core_form/events';\nimport CalendarEvents from './events';\nimport * as Str from 'core/str';\nimport * as Notification from 'core/notification';\nimport * as Fragment from 'core/fragment';\nimport * as Repository from 'core_calendar/repository';\n\nconst SELECTORS = {\n SAVE_BUTTON: '[data-action=\"save\"]',\n LOADING_ICON_CONTAINER: '[data-region=\"loading-icon-container\"]',\n};\n\nexport default class ModalEventForm extends Modal {\n static TYPE = 'core_calendar-modal_event_form';\n static TEMPLATE = 'calendar/modal_event_form';\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n constructor(root) {\n super(root);\n\n this.eventId = null;\n this.startTime = null;\n this.courseId = null;\n this.categoryId = null;\n this.contextId = null;\n this.reloadingBody = false;\n this.reloadingTitle = false;\n this.saveButton = this.getFooter().find(SELECTORS.SAVE_BUTTON);\n }\n\n configure(modalConfig) {\n modalConfig.large = true;\n super.configure(modalConfig);\n }\n\n /**\n * Set the context id to the given value.\n *\n * @method setContextId\n * @param {Number} id The event id\n */\n setContextId(id) {\n this.contextId = id;\n }\n\n /**\n * Retrieve the current context id, if any.\n *\n * @method getContextId\n * @return {Number|null} The event id\n */\n getContextId() {\n return this.contextId;\n }\n\n /**\n * Set the course id to the given value.\n *\n * @method setCourseId\n * @param {Number} id The event id\n */\n setCourseId(id) {\n this.courseId = id;\n }\n\n /**\n * Retrieve the current course id, if any.\n *\n * @method getCourseId\n * @return {Number|null} The event id\n */\n getCourseId() {\n return this.courseId;\n }\n\n /**\n * Set the category id to the given value.\n *\n * @method setCategoryId\n * @param {Number} id The event id\n */\n setCategoryId(id) {\n this.categoryId = id;\n }\n\n /**\n * Retrieve the current category id, if any.\n *\n * @method getCategoryId\n * @return {Number|null} The event id\n */\n getCategoryId() {\n return this.categoryId;\n }\n\n /**\n * Check if the modal has an course id.\n *\n * @method hasCourseId\n * @return {bool}\n */\n hasCourseId() {\n return this.courseId !== null;\n }\n\n /**\n * Check if the modal has an category id.\n *\n * @method hasCategoryId\n * @return {bool}\n */\n hasCategoryId() {\n return this.categoryId !== null;\n }\n\n /**\n * Set the event id to the given value.\n *\n * @method setEventId\n