Current Path : C:/xampp/htdocs/moodle/calendar/amd/build/ |
Current File : C:/xampp/htdocs/moodle/calendar/amd/build/event_form.min.js.map |
{"version":3,"sources":["../src/event_form.js"],"names":["define","$","CalendarRepository","SELECTORS","EVENT_GROUP_COURSE_ID","EVENT_GROUP_ID","SELECT_OPTION","addCourseGroupSelectListeners","formElement","courseGroupSelect","find","loadGroupSelectOptions","groups","groupSelect","groupSelectOptions","courseGroups","remove","prop","each","id","group","append","attr","text","name","on","courseId","val","getCourseGroupsData","then","catch","Notification","exception","init","formId"],"mappings":"AAuBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,0BAAX,CAAD,CAAyC,SAASC,CAAT,CAAYC,CAAZ,CAAgC,IAEvEC,CAAAA,CAAS,CAAG,CACZC,qBAAqB,CAAE,0BADX,CAEZC,cAAc,CAAE,oBAFJ,CAGZC,aAAa,CAAE,QAHH,CAF2D,CAgBvEC,CAA6B,CAAG,SAASC,CAAT,CAAsB,IAClDC,CAAAA,CAAiB,CAAGD,CAAW,CAACE,IAAZ,CAAiBP,CAAS,CAACC,qBAA3B,CAD8B,CAGlDO,CAAsB,CAAG,SAASC,CAAT,CAAiB,CAC1C,GAAIC,CAAAA,CAAW,CAAGL,CAAW,CAACE,IAAZ,CAAiBP,CAAS,CAACE,cAA3B,CAAlB,CACIS,CAAkB,CAAGD,CAAW,CAACH,IAAZ,CAAiBP,CAAS,CAACG,aAA3B,CADzB,CAEIS,CAAY,CAAGd,CAAC,CAACW,CAAD,CAFpB,CAKAE,CAAkB,CAACE,MAAnB,GACAH,CAAW,CAACI,IAAZ,CAAiB,UAAjB,KACAF,CAAY,CAACG,IAAb,CAAkB,SAASC,CAAT,CAAaC,CAAb,CAAoB,CAClCnB,CAAC,CAACY,CAAD,CAAD,CAAeQ,MAAf,CAAsBpB,CAAC,CAAC,mBAAD,CAAD,CAAuBqB,IAAvB,CAA4B,OAA5B,CAAqCF,CAAK,CAACD,EAA3C,EAA+CI,IAA/C,CAAoDH,CAAK,CAACI,IAA1D,CAAtB,CACH,CAFD,CAGH,CAdqD,CAiBtDf,CAAiB,CAACgB,EAAlB,CAAqB,QAArB,CAA+B,UAAW,CACtC,GAAIC,CAAAA,CAAQ,CAAGlB,CAAW,CAACE,IAAZ,CAAiBP,CAAS,CAACC,qBAA3B,EAAkDuB,GAAlD,EAAf,CACAzB,CAAkB,CAAC0B,mBAAnB,CAAuCF,CAAvC,EACKG,IADL,CACU,SAASjB,CAAT,CAAiB,CACnB,MAAOD,CAAAA,CAAsB,CAACC,CAAD,CAChC,CAHL,EAIKkB,KAJL,CAIWC,YAAY,CAACC,SAJxB,CAKH,CAPD,CAQH,CAzC0E,CAsD3E,MAAO,CACHC,IAAI,CANG,QAAPA,CAAAA,IAAO,CAASC,CAAT,CAAiB,CACxB,GAAI1B,CAAAA,CAAW,CAAGP,CAAC,CAAC,IAAMiC,CAAP,CAAnB,CACA3B,CAA6B,CAACC,CAAD,CAChC,CAEM,CAGV,CAzDK,CAAN","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 * A javascript module to enhance the event form.\n *\n * @module core_calendar/event_form\n * @package core_calendar\n * @copyright 2017 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core_calendar/repository'], function($, CalendarRepository) {\n\n var SELECTORS = {\n EVENT_GROUP_COURSE_ID: '[name=\"groupcourseid\"]',\n EVENT_GROUP_ID: '[name=\"groupid\"]',\n SELECT_OPTION: 'option'\n };\n\n /**\n * Listen for when the user changes the group course when configuring\n * a group event and filter the options in the group select to only\n * show the groups available within the course the user has selected.\n *\n * @method addCourseGroupSelectListeners\n * @param {object} formElement The root form element\n */\n var addCourseGroupSelectListeners = function(formElement) {\n var courseGroupSelect = formElement.find(SELECTORS.EVENT_GROUP_COURSE_ID);\n\n var loadGroupSelectOptions = function(groups) {\n var groupSelect = formElement.find(SELECTORS.EVENT_GROUP_ID),\n groupSelectOptions = groupSelect.find(SELECTORS.SELECT_OPTION),\n courseGroups = $(groups);\n\n // Let's clear all options first.\n groupSelectOptions.remove();\n groupSelect.prop(\"disabled\", false);\n courseGroups.each(function(id, group) {\n $(groupSelect).append($(\"<option></option>\").attr(\"value\", group.id).text(group.name));\n });\n };\n\n // If the user choose a course in the selector do a WS request to get groups.\n courseGroupSelect.on('change', function() {\n var courseId = formElement.find(SELECTORS.EVENT_GROUP_COURSE_ID).val();\n CalendarRepository.getCourseGroupsData(courseId)\n .then(function(groups) {\n return loadGroupSelectOptions(groups);\n })\n .catch(Notification.exception);\n });\n };\n\n /**\n * Initialise all of the form enhancements.\n *\n * @method init\n * @param {string} formId The value of the form's id attribute\n */\n var init = function(formId) {\n var formElement = $('#' + formId);\n addCourseGroupSelectListeners(formElement);\n };\n\n return {\n init: init,\n };\n});\n"],"file":"event_form.min.js"}