{"version":3,"file":"courselistingdetailsmodal.min.js","sources":["https:\/\/devlearn.bowenehs.com\/theme\/boost_union\/amd\/src\/courselistingdetailsmodal.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 .\n\n\/**\n * Theme Boost Union - JS code for course listing details modal.\n *\n * @module theme_boost_union\/courselistingdetailsmodal\n * @copyright 2025 Alexander Bias, ssystems GmbH \n * based on core_admin\/themeselector\/preview_modal by David Woloszyn \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport ModalCancel from 'core\/modal_cancel';\nimport Notification from 'core\/notification';\nimport Templates from 'core\/templates';\nimport {getString} from 'core\/str';\n\nconst SELECTORS = {\n DETAILS: '[data-action=\"courselisting-details\"]',\n};\n\n\/**\n * Entrypoint of the js.\n *\n * @method init\n *\/\nexport const init = () => {\n registerListenerEvents();\n};\n\n\/**\n * Register snippet related event listeners.\n *\n * @method registerListenerEvents\n *\/\nconst registerListenerEvents = () => {\n document.addEventListener('click', (e) => {\n const details = e.target.closest(SELECTORS.DETAILS);\n if (details) {\n buildModal(details).catch(Notification.exception);\n }\n });\n};\n\n\/**\n * Build the modal with the provided data.\n *\n * @method buildModal\n * @param {object} element\n *\/\nconst buildModal = async(element) => {\n\n \/\/ Prepare data for modal.\n const data = {\n title: element.getAttribute('data-title'),\n summary: element.getAttribute('data-summary'),\n coursecontacts: element.getAttribute('data-coursecontacts'),\n customfields: element.getAttribute('data-customfields'),\n };\n\n await ModalCancel.create({\n title: data.title,\n body: Templates.render('theme_boost_union\/courselistingdetailsmodal', data),\n large: true,\n buttons: {\n 'cancel': getString('closebuttontitle', 'moodle'),\n },\n show: true,\n });\n};\n"],"names":["SELECTORS","registerListenerEvents","document","addEventListener","e","details","target","closest","buildModal","catch","Notification","exception","async","data","title","element","getAttribute","summary","coursecontacts","customfields","ModalCancel","create","body","Templates","render","large","buttons","show"],"mappings":";;;;;;;;8OA6BMA,kBACO,sDAQO,KAChBC,gCAQEA,uBAAyB,KAC3BC,SAASC,iBAAiB,SAAUC,UAC1BC,QAAUD,EAAEE,OAAOC,QAAQP,mBAC7BK,SACAG,WAAWH,SAASI,MAAMC,sBAAaC,eAW7CH,WAAaI,MAAAA,gBAGTC,KAAO,CACTC,MAAOC,QAAQC,aAAa,cAC5BC,QAASF,QAAQC,aAAa,gBAC9BE,eAAgBH,QAAQC,aAAa,uBACrCG,aAAcJ,QAAQC,aAAa,4BAGjCI,sBAAYC,OAAO,CACrBP,MAAOD,KAAKC,MACZQ,KAAMC,mBAAUC,OAAO,8CAA+CX,MACtEY,OAAO,EACPC,QAAS,SACK,kBAAU,mBAAoB,WAE5CC,MAAM"}