Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/report/insights/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/report/insights/amd/build/actions.min.js.map

{"version":3,"sources":["../src/actions.js"],"names":["define","$","Str","Ajax","Notification","Url","ModalFactory","ModalEvents","initBulk","rootNode","executeAction","predictionIds","predictionContainers","actionName","call","methodname","args","predictionids","actionname","then","tableNode","forEach","el","closest","remove","find","length","params","contextid","data","modelid","window","location","assign","relativeUrl","catch","exception","on","e","preventDefault","action","currentTarget","actionVisibleName","text","trim","each","container","push","strings","get_strings","key","component","param","nitems","strs","create","type","types","SAVE_CANCEL","title","body","modal","setSaveButtonText","show","getRoot","save"],"mappings":"AA4BAA,OAAM,2BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,WAAvB,CAAoC,mBAApC,CAAyD,UAAzD,CAAqE,oBAArE,CAA2F,mBAA3F,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAAuBC,CAAvB,CAAqCC,CAArC,CAA0CC,CAA1C,CAAwDC,CAAxD,CAAqE,CAEzE,MAAO,CAQHC,QAAQ,CAAE,kBAASC,CAAT,CAAmB,CAUzB,GAAIC,CAAAA,CAAa,CAAG,SAASC,CAAT,CAAwBC,CAAxB,CAA8CC,CAA9C,CAA0D,CAE1E,MAAOV,CAAAA,CAAI,CAACW,IAAL,CAAU,CACb,CACIC,UAAU,CAAE,iCADhB,CAEIC,IAAI,CAAE,CACFC,aAAa,CAAEN,CADb,CAEFO,UAAU,CAAEL,CAFV,CAFV,CADa,CAAV,EAQJ,CARI,EAQDM,IARC,CAQI,UAAW,CAGlB,GAAIC,CAAAA,CAAS,GAAb,CACAR,CAAoB,CAACS,OAArB,CAA6B,SAASC,CAAT,CAAa,CACtC,GAAI,KAAAF,CAAJ,CAAyB,CACrBA,CAAS,CAAGE,CAAE,CAACC,OAAH,CAAW,OAAX,CACf,CACDD,CAAE,CAACE,MAAH,EACH,CALD,EAOA,GAA4C,CA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AIsB,CAAAA,CAAO,CAAG,EAAd,CACA9C,CAAG,CAAC+C,WAAJ,CAAgB,CAAC,CACbC,GAAG,CAAE,mBADQ,CAEbC,SAAS,CAAE,iBAFE,CAGbC,KAAK,CAAE,CACHZ,MAAM,CAAEE,CADL,CAEHW,MAAM,CAAE1C,CAAa,CAACe,MAFnB,CAHM,CAAD,CAOb,CACCwB,GAAG,CAAE,SADN,CAECC,SAAS,CAAE,QAFZ,CAPa,CAAhB,EAWEhC,IAXF,CAWO,SAASmC,CAAT,CAAe,CAClBN,CAAO,CAAGM,CAAV,CACA,MAAOhD,CAAAA,CAAY,CAACiD,MAAb,CAAoB,CACvBC,IAAI,CAAElD,CAAY,CAACmD,KAAb,CAAmBC,WADF,CAEvBC,KAAK,CAAEjB,CAFgB,CAGvBkB,IAAI,CAAEZ,CAAO,CAAC,CAAD,CAHU,CAApB,CAKV,CAlBD,EAkBG7B,IAlBH,CAkBQ,SAAS0C,CAAT,CAAgB,CACpBA,CAAK,CAACC,iBAAN,CAAwBd,CAAO,CAAC,CAAD,CAA/B,EACAa,CAAK,CAACE,IAAN,GACAF,CAAK,CAACG,OAAN,GAAgB3B,EAAhB,CAAmB9B,CAAW,CAAC0D,IAA/B,CAAqC,UAAW,CAE5C,MAAOvD,CAAAA,CAAa,CAACC,CAAD,CAAgBC,CAAhB,CAAsCC,CAAtC,CACvB,CAHD,EAKA,MAAOgD,CAAAA,CACV,CA3BD,EA2BG1B,KA3BH,CA2BS/B,CAAY,CAACgC,SA3BtB,EA6BA,MAAO,KACV,CAnDD,CAoDH,CAtGE,CAwGV,CA3GK,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 * Module to manage report insights actions that are executed using AJAX.\n *\n * @package    report_insights\n * @copyright  2017 David Monllao {@link http://www.davidmonllao.com}\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * This module manages prediction actions that require AJAX requests.\n *\n * @module report_insights/actions\n */\ndefine(['jquery', 'core/str', 'core/ajax', 'core/notification', 'core/url', 'core/modal_factory', 'core/modal_events'],\n        function($, Str, Ajax, Notification, Url, ModalFactory, ModalEvents) {\n\n    return {\n\n        /**\n         * Attach on click handlers for bulk actions.\n         *\n         * @param {String} rootNode\n         * @access public\n         */\n        initBulk: function(rootNode) {\n\n            /**\n             * Executes the provided action.\n             *\n             * @param  {Array}  predictionIds\n             * @param  {Array}  predictionContainers\n             * @param  {String} actionName\n             * @return {Promise}\n             */\n            var executeAction = function(predictionIds, predictionContainers, actionName) {\n\n                return Ajax.call([\n                    {\n                        methodname: 'report_insights_action_executed',\n                        args: {\n                            predictionids: predictionIds,\n                            actionname: actionName\n                        }\n                    }\n                ])[0].then(function() {\n                    // Remove the selected elements from the list.\n\n                    var tableNode = false;\n                    predictionContainers.forEach(function(el) {\n                        if (tableNode === false) {\n                            tableNode = el.closest('table');\n                        }\n                        el.remove();\n                    });\n\n                    if (tableNode.find('tbody > tr').length === 0) {\n                        let params = {\n                            contextid: tableNode.closest('div.insight-container').data('context-id'),\n                            modelid: tableNode.closest('div.insight-container').data('model-id')\n                        };\n                        window.location.assign(Url.relativeUrl(\"report/insights/insights.php\", params, false));\n                    }\n                    return;\n                }).catch(Notification.exception);\n            };\n\n            $(rootNode + ' [data-bulk-actionname]').on('click', function(e) {\n                e.preventDefault();\n                var action = $(e.currentTarget);\n                var actionName = action.data('bulk-actionname');\n                var actionVisibleName = action.text().trim();\n\n                var predictionIds = [];\n                var predictionContainers = [];\n\n                $('.insights-list input[data-togglegroup^=\"insight-bulk-action-\"][data-toggle=\"slave\"]:checked').each(function() {\n                    var container = $(this).closest('tr[data-prediction-id]');\n                    predictionContainers.push(container);\n                    predictionIds.push(container.data('prediction-id'));\n                });\n\n                if (predictionIds.length === 0) {\n                    // No items selected message.\n                    return this;\n                }\n\n                var strings = [];\n                Str.get_strings([{\n                    key: 'confirmbulkaction',\n                    component: 'report_insights',\n                    param: {\n                        action: actionVisibleName,\n                        nitems: predictionIds.length\n                    }\n                }, {\n                    key: 'confirm',\n                    component: 'moodle'\n                }]\n                ).then(function(strs) {\n                    strings = strs;\n                    return ModalFactory.create({\n                        type: ModalFactory.types.SAVE_CANCEL,\n                        title: actionVisibleName,\n                        body: strings[0],\n                    });\n                }).then(function(modal) {\n                    modal.setSaveButtonText(strings[1]);\n                    modal.show();\n                    modal.getRoot().on(ModalEvents.save, function() {\n                        // The action is now confirmed, sending an action for it.\n                        return executeAction(predictionIds, predictionContainers, actionName);\n                    });\n\n                    return modal;\n                }).catch(Notification.exception);\n\n                return this;\n            });\n        },\n    };\n});\n"],"file":"actions.min.js"}