Current Path : C:/Users/Mahmood/Desktop/moodle8/user/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle8/user/amd/build/status_field.min.js.map |
{"version":3,"sources":["../src/status_field.js"],"names":["define","Template","$","Str","Config","Notification","ModalFactory","ModalEvents","Fragment","Ajax","SELECTORS","EDIT_ENROLMENT","SHOW_DETAILS","UNENROL","StatusFieldActions","options","contextid","courseid","bindEditEnrol","bindUnenrol","bindStatusDetails","prototype","statusFieldInstsance","click","e","preventDefault","clickedEditTrigger","parentContainer","parent","fullname","data","ueid","attr","when","get_string","then","modalTitle","create","large","title","type","types","SAVE_CANCEL","done","modal","getRoot","on","save","submitEditFormAjax","hidden","destroy","setBody","getBody","show","fail","exception","unenrolLink","strings","key","component","param","user","course","enrolinstancename","deleteModalPromise","get_strings","results","confirmMessage","setTitle","setSaveButtonText","unenrolParams","submitUnenrolFormAjax","detailsButton","context","find","editEnrolLink","next","length","editenrollink","append","clone","html","modalStringsPromise","modalPromise","CANCEL","modalBodyPromise","render","hide","trigger","form","val","request","methodname","args","formdata","serialize","call","result","window","M","core_formchangechecker","reset_form_dirty_state","location","reload","formData","JSON","stringify","alert","errors","message","params","loadFragment","init","config"],"mappings":"AAsBAA,OAAM,0BAAC,CAAC,gBAAD,CACC,QADD,CAEC,UAFD,CAGC,aAHD,CAIC,mBAJD,CAKC,oBALD,CAMC,mBAND,CAOC,eAPD,CAQC,WARD,CAAD,CAUF,SAASC,CAAT,CAAmBC,CAAnB,CAAsBC,CAAtB,CAA2BC,CAA3B,CAAmCC,CAAnC,CAAiDC,CAAjD,CAA+DC,CAA/D,CAA4EC,CAA5E,CAAsFC,CAAtF,CAA4F,IAQpFC,CAAAA,CAAS,CAAG,CACZC,cAAc,CAAE,iCADJ,CAEZC,YAAY,CAAE,+BAFF,CAGZC,OAAO,CAAE,2BAHG,CARwE,CAoBpFC,CAAkB,CAAG,SAASC,CAAT,CAAkB,CACvC,KAAKC,SAAL,CAAiBD,CAAO,CAACC,SAAzB,CAC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/B,CAAsD,KAAK/F,SAA3D,CAAsE8F,CAAtE,EAA8ExD,IAA9E,CAAmFjD,CAAY,CAACkD,SAAhG,CACV,CARD,CAUA,MAAoD,CAShDyD,IAAI,CAAE,cAASC,CAAT,CAAiB,CAClB,GAAInG,CAAAA,CAAJ,CAAuBmG,CAAvB,CACJ,CAX+C,CAavD,CA1UC,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 * AMD module for the user enrolment status field in the course participants page.\n *\n * @module core_user/status_field\n * @copyright 2017 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/templates',\n 'jquery',\n 'core/str',\n 'core/config',\n 'core/notification',\n 'core/modal_factory',\n 'core/modal_events',\n 'core/fragment',\n 'core/ajax'\n ],\n function(Template, $, Str, Config, Notification, ModalFactory, ModalEvents, Fragment, Ajax) {\n\n /**\n * Action selectors.\n *\n * @access private\n * @type {{EDIT_ENROLMENT: string, SHOW_DETAILS: string, UNENROL: string}}\n */\n var SELECTORS = {\n EDIT_ENROLMENT: '[data-action=\"editenrolment\"]',\n SHOW_DETAILS: '[data-action=\"showdetails\"]',\n UNENROL: '[data-action=\"unenrol\"]'\n };\n\n /**\n * Constructor\n *\n * @param {Object} options Object containing options. The only valid option at this time is contextid.\n * Each call to templates.render gets it's own instance of this class.\n */\n var StatusFieldActions = function(options) {\n this.contextid = options.contextid;\n this.courseid = options.courseid;\n\n // Bind click event to editenrol buttons.\n this.bindEditEnrol();\n\n // Bind click event to unenrol buttons.\n this.bindUnenrol();\n\n // Bind click event to status details buttons.\n this.bindStatusDetails();\n };\n // Class variables and functions.\n\n /** @var {number} courseid The course ID. */\n StatusFieldActions.prototype.courseid = 0;\n\n /**\n * Private method\n *\n * @method initModal\n * @private\n */\n StatusFieldActions.prototype.bindEditEnrol = function() {\n var statusFieldInstsance = this;\n\n $(SELECTORS.EDIT_ENROLMENT).click(function(e) {\n e.preventDefault();\n\n // The particular edit button that was clicked.\n var clickedEditTrigger = $(this);\n // Get the parent container (it contains the data attributes associated with the status field).\n var parentContainer = clickedEditTrigger.parent();\n // Get the name of the user whose enrolment status is being edited.\n var fullname = parentContainer.data('fullname');\n // Get the user enrolment ID.\n var ueid = clickedEditTrigger.attr('rel');\n\n $.when(Str.get_string('edituserenrolment', 'enrol', fullname)).then(function(modalTitle) {\n return ModalFactory.create({\n large: true,\n title: modalTitle,\n type: ModalFactory.types.SAVE_CANCEL\n });\n }).done(function(modal) {\n // Handle save event.\n modal.getRoot().on(ModalEvents.save, function(e) {\n // Don't close the modal yet.\n e.preventDefault();\n // Submit form data.\n statusFieldInstsance.submitEditFormAjax(modal);\n });\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Set the modal body.\n modal.setBody(statusFieldInstsance.getBody(ueid));\n\n // Show the modal!\n modal.show();\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Private method\n *\n * @method bindUnenrol\n * @private\n */\n StatusFieldActions.prototype.bindUnenrol = function() {\n var statusFieldInstsance = this;\n\n $(SELECTORS.UNENROL).click(function(e) {\n e.preventDefault();\n var unenrolLink = $(this);\n var parentContainer = unenrolLink.parent();\n var strings = [\n {\n key: 'unenrol',\n component: 'enrol'\n },\n {\n key: 'unenrolconfirm',\n component: 'enrol',\n param: {\n user: parentContainer.data('fullname'),\n course: parentContainer.data('coursename'),\n enrolinstancename: parentContainer.data('enrolinstancename')\n }\n }\n ];\n\n var deleteModalPromise = ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL\n });\n\n $.when(Str.get_strings(strings), deleteModalPromise).done(function(results, modal) {\n var title = results[0];\n var confirmMessage = results[1];\n modal.setTitle(title);\n modal.setBody(confirmMessage);\n modal.setSaveButtonText(title);\n\n // Handle confirm event.\n modal.getRoot().on(ModalEvents.save, function() {\n // Build params.\n var unenrolParams = {\n 'ueid': $(unenrolLink).attr('rel')\n };\n // Don't close the modal yet.\n e.preventDefault();\n // Submit data.\n statusFieldInstsance.submitUnenrolFormAjax(modal, unenrolParams);\n });\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Display the delete confirmation modal.\n modal.show();\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Private method\n *\n * @method bindStatusDetails\n * @private\n */\n StatusFieldActions.prototype.bindStatusDetails = function() {\n $(SELECTORS.SHOW_DETAILS).click(function(e) {\n e.preventDefault();\n\n var detailsButton = $(this);\n var parentContainer = detailsButton.parent();\n var context = {\n \"fullname\": parentContainer.data('fullname'),\n \"coursename\": parentContainer.data('coursename'),\n \"enrolinstancename\": parentContainer.data('enrolinstancename'),\n \"status\": parentContainer.data('status'),\n \"statusclass\": parentContainer.find('span').attr('class'),\n \"timestart\": parentContainer.data('timestart'),\n \"timeend\": parentContainer.data('timeend'),\n \"timeenrolled\": parentContainer.data('timeenrolled')\n };\n\n // Get default string for the modal and modal type.\n var strings = [\n {\n key: 'enroldetails',\n component: 'enrol'\n }\n ];\n\n // Find the edit enrolment link.\n var editEnrolLink = detailsButton.next(SELECTORS.EDIT_ENROLMENT);\n if (editEnrolLink.length) {\n // If there's an edit enrolment link for this user, clone it into the context for the modal.\n context.editenrollink = $('<div>').append(editEnrolLink.clone()).html();\n }\n\n var modalStringsPromise = Str.get_strings(strings);\n var modalPromise = ModalFactory.create({large: true, type: ModalFactory.types.CANCEL});\n $.when(modalStringsPromise, modalPromise).done(function(strings, modal) {\n var modalBodyPromise = Template.render('core_user/status_details', context);\n modal.setTitle(strings[0]);\n modal.setBody(modalBodyPromise);\n\n if (editEnrolLink.length) {\n modal.getRoot().on('click', SELECTORS.EDIT_ENROLMENT, function(e) {\n e.preventDefault();\n modal.hide();\n // Trigger click event for the edit enrolment link to show the edit enrolment modal.\n $(editEnrolLink).trigger('click');\n });\n }\n\n modal.show();\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Private method\n *\n * @method submitEditFormAjax\n * @param {Object} modal The the AMD modal object containing the form.\n * @private\n */\n StatusFieldActions.prototype.submitEditFormAjax = function(modal) {\n var statusFieldInstsance = this;\n var form = modal.getRoot().find('form');\n\n // User enrolment ID.\n var ueid = $(form).find('[name=\"ue\"]').val();\n\n var request = {\n methodname: 'core_enrol_submit_user_enrolment_form',\n args: {\n formdata: form.serialize()\n }\n };\n\n Ajax.call([request])[0].done(function(data) {\n if (data.result) {\n // Dismiss the modal.\n modal.hide();\n\n // Reload the page, don't show changed data warnings.\n if (typeof window.M.core_formchangechecker !== \"undefined\") {\n window.M.core_formchangechecker.reset_form_dirty_state();\n }\n window.location.reload();\n } else {\n // Serialise the form data and reload the form fragment to show validation errors.\n var formData = JSON.stringify(form.serialize());\n modal.setBody(statusFieldInstsance.getBody(ueid, formData));\n }\n }).fail(Notification.exception);\n };\n\n /**\n * Private method\n *\n * @method submitUnenrolFormAjax\n * @param {Object} modal The the AMD modal object containing the form.\n * @param {Object} unenrolParams The unenrol parameters.\n * @private\n */\n StatusFieldActions.prototype.submitUnenrolFormAjax = function(modal, unenrolParams) {\n var request = {\n methodname: 'core_enrol_unenrol_user_enrolment',\n args: unenrolParams\n };\n\n Ajax.call([request])[0].done(function(data) {\n if (data.result) {\n // Dismiss the modal.\n modal.hide();\n\n // Reload the page, don't show changed data warnings.\n if (typeof window.M.core_formchangechecker !== \"undefined\") {\n window.M.core_formchangechecker.reset_form_dirty_state();\n }\n window.location.reload();\n } else {\n // Display an alert containing the error message\n Notification.alert(data.errors[0].key, data.errors[0].message);\n }\n }).fail(Notification.exception);\n };\n\n /**\n * Private method\n *\n * @method getBody\n * @private\n * @param {Number} ueid The user enrolment ID associated with the user.\n * @param {string} formData Serialized string of the edit enrolment form data.\n * @return {Promise}\n */\n StatusFieldActions.prototype.getBody = function(ueid, formData) {\n var params = {\n 'ueid': ueid\n };\n if (typeof formData !== 'undefined') {\n params.formdata = formData;\n }\n return Fragment.loadFragment('enrol', 'user_enrolment_form', this.contextid, params).fail(Notification.exception);\n };\n\n return /** @alias module:core_user/editenrolment */ {\n // Public variables and functions.\n /**\n * Every call to init creates a new instance of the class with it's own event listeners etc.\n *\n * @method init\n * @public\n * @param {object} config - config variables for the module.\n */\n init: function(config) {\n (new StatusFieldActions(config));\n }\n };\n });\n"],"file":"status_field.min.js"}