%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/ava/grade/report/singleview/amd/build/
Upload File :
Create Path :
Current File : /home/vacivi36/ava/grade/report/singleview/amd/build/user.min.js.map

{"version":3,"file":"user.min.js","sources":["../src/user.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 * A small modal to search users within the gradebook.\n *\n * @module    gradereport_singleview/user\n * @copyright 2022 Mathew May <mathew.solutions>\n * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Pending from 'core/pending';\nimport * as Templates from 'core/templates';\nimport * as Repository from 'core_grades/searchwidget/repository';\nimport * as WidgetBase from 'core_grades/searchwidget/basewidget';\nimport Url from 'core/url';\nimport $ from 'jquery';\nimport * as Selectors from 'core_grades/searchwidget/selectors';\n\n/**\n * Our entry point into starting to build the search widget.\n * It'll eventually, based upon the listeners, open the search widget and allow filtering.\n *\n * @method init\n */\nexport const init = () => {\n    const pendingPromise = new Pending();\n    registerListenerEvents();\n    pendingPromise.resolve();\n};\n\n/**\n * Register user search widget related event listeners.\n *\n * @method registerListenerEvents\n */\nconst registerListenerEvents = () => {\n    let {bodyPromiseResolver, bodyPromise} = WidgetBase.promisesAndResolvers();\n    const dropdownMenuContainer = document.querySelector(Selectors.elements.getSearchWidgetDropdownSelector('user'));\n\n    // Handle the 'shown.bs.dropdown' event (Fired when the dropdown menu is fully displayed).\n    $(Selectors.elements.getSearchWidgetSelector('user')).on('show.bs.dropdown', async(e) => {\n        const courseID = e.relatedTarget.dataset.courseid;\n        const groupId = e.relatedTarget.dataset.groupid;\n        const actionBaseUrl = Url.relativeUrl('/grade/report/singleview/index.php', {item: 'user'}, false);\n        // Display a loading icon in the dropdown menu container until the body promise is resolved.\n        await WidgetBase.showLoader(dropdownMenuContainer);\n\n        // If an error occurs while fetching the data, display the error within the dropdown menu.\n        const data = await Repository.userFetch(courseID, actionBaseUrl, groupId).catch(async(e) => {\n            const errorTemplateData = {\n                'errormessage': e.message\n            };\n            bodyPromiseResolver(\n                await Templates.render('core_grades/searchwidget/error', errorTemplateData)\n            );\n        });\n\n        // Early return if there is no module data.\n        if (data === []) {\n            return;\n        }\n\n        await WidgetBase.init(\n            dropdownMenuContainer,\n            bodyPromise,\n            data.users,\n            searchUsers()\n        );\n\n        // Resolvers for passed functions in the dropdown menu creation.\n        bodyPromiseResolver(Templates.render('core_grades/searchwidget/user/usersearch_body', []));\n    });\n\n    // Handle the 'hide.bs.dropdown' event (Fired when the dropdown menu is being closed).\n    $(Selectors.elements.getSearchWidgetSelector('user')).on('hide.bs.dropdown', () => {\n        // Reset the state once the user menu dropdown is closed.\n        dropdownMenuContainer.innerHTML = '';\n    });\n};\n\n/**\n * Define how we want to search and filter users when the user decides to input a search value.\n *\n * @method registerListenerEvents\n * @returns {function(): function(*, *): (*)}\n */\nconst searchUsers = () => {\n    return () => {\n        return (users, searchTerm) => {\n            if (searchTerm === '') {\n                return users;\n            }\n            searchTerm = searchTerm.toLowerCase();\n            const searchResults = [];\n            users.forEach((user) => {\n                const userName = user.fullname.toLowerCase();\n                if (userName.includes(searchTerm)) {\n                    searchResults.push(user);\n                }\n            });\n            return searchResults;\n        };\n    };\n};\n"],"names":["pendingPromise","Pending","registerListenerEvents","resolve","bodyPromiseResolver","bodyPromise","WidgetBase","promisesAndResolvers","dropdownMenuContainer","document","querySelector","Selectors","elements","getSearchWidgetDropdownSelector","getSearchWidgetSelector","on","async","courseID","e","relatedTarget","dataset","courseid","groupId","groupid","actionBaseUrl","Url","relativeUrl","item","showLoader","data","Repository","userFetch","catch","errorTemplateData","message","Templates","render","init","users","searchUsers","innerHTML","searchTerm","toLowerCase","searchResults","forEach","user","fullname","includes","push"],"mappings":";;;;;;;4YAqCoB,WACVA,eAAiB,IAAIC,iBAC3BC,yBACAF,eAAeG,iBAQbD,uBAAyB,SACvBE,oBAACA,oBAADC,YAAsBA,aAAeC,WAAWC,6BAC9CC,sBAAwBC,SAASC,cAAcC,UAAUC,SAASC,gCAAgC,6BAGtGF,UAAUC,SAASE,wBAAwB,SAASC,GAAG,oBAAoBC,MAAAA,UACnEC,SAAWC,EAAEC,cAAcC,QAAQC,SACnCC,QAAUJ,EAAEC,cAAcC,QAAQG,QAClCC,cAAgBC,aAAIC,YAAY,qCAAsC,CAACC,KAAM,SAAS,SAEtFrB,WAAWsB,WAAWpB,6BAGtBqB,WAAaC,WAAWC,UAAUd,SAAUO,cAAeF,SAASU,OAAMhB,MAAAA,UACtEiB,kBAAoB,cACNf,EAAEgB,SAEtB9B,0BACU+B,UAAUC,OAAO,iCAAkCH,uBAK7DJ,OAAS,WAIPvB,WAAW+B,KACb7B,sBACAH,YACAwB,KAAKS,MACLC,eAIJnC,oBAAoB+B,UAAUC,OAAO,gDAAiD,6BAIxFzB,UAAUC,SAASE,wBAAwB,SAASC,GAAG,oBAAoB,KAEzEP,sBAAsBgC,UAAY,OAUpCD,YAAc,IACT,IACI,CAACD,MAAOG,iBACQ,KAAfA,kBACOH,MAEXG,WAAaA,WAAWC,oBAClBC,cAAgB,UACtBL,MAAMM,SAASC,OACMA,KAAKC,SAASJ,cAClBK,SAASN,aAClBE,cAAcK,KAAKH,SAGpBF"}

Zerion Mini Shell 1.0