moodle_local_treestudyplan/amd/build/modedit-modal.min.js.map
2023-09-08 12:47:29 +02:00

1 line
No EOL
5.5 KiB
Text

{"version":3,"file":"modedit-modal.min.js","sources":["../src/modedit-modal.js"],"sourcesContent":["/*eslint no-var: \"error\"*/\n/*eslint no-console: \"off\"*/\n/*eslint-disable no-trailing-spaces */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n\nimport {loadFragment} from 'core/fragment';\nimport {load_strings} from './util/string-helper';\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\nimport {replaceNodeContents} from 'core/templates';\n//import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only\n//import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only\n\nexport default {\n install(Vue/*,options*/){\n\n let strings = load_strings({\n editmod: {\n save$core: \"save$core\",\n cancel$core: \"cancel$core\",\n }\n });\n\n Vue.component('s-edit-mod', {\n props: {\n cmid: {\n type: Number,\n },\n coursectxid:{\n type: Number,\n },\n title: {\n type: String,\n default: \"\",\n },\n genericonly: {\n type: Boolean,\n default: false,\n }\n },\n data() {\n return {\n content: \"\",\n text: strings.editmod,\n };\n },\n computed: {\n },\n methods: {\n openForm(){\n const self = this;\n self.$refs[\"editormodal\"].show();\n },\n onShown(){\n const self = this;\n let params = {cmid: this.cmid};\n console.info(\"Loading form\");\n loadFragment('local_treestudyplan', 'mod_edit_form', this.coursectxid, params).then((html,js) =>{\n replaceNodeContents(self.$refs[\"content\"], html, js);\n }).catch(notification.exception);\n\n },\n onSave(){\n const self = this;\n let form = this.$refs[\"content\"].getElementsByTagName(\"form\")[0];\n\n // markFormSubmitted(form); // Moodle 4.00+ only\n // We call this, so other modules can update the form with the latest state.\n form.dispatchEvent(new Event(\"save-form-state\"));\n // Tell all form fields we are about to submit the form.\n // notifyFormSubmittedByJavascript(form); // Moodle 4.00+ only\n\n const formdata = new FormData(form);\n const data =new URLSearchParams(formdata).toString();\n //const formdata = new FormData(form);\n //const data = {};\n //formdata.forEach((value, key) => (data[key] = value));\n\n call([{\n methodname: 'local_treestudyplan_submit_cm_editform',\n args: {cmid: this.cmid, formdata: data}\n }])[0].done(()=>{\n self.$emit(\"saved\",formdata);\n }).fail(notification.exception);\n\n }\n },\n template: `\n <span class='s-edit-mod'><a href='#' @click.prevent=\"openForm\"><slot><i class=\"fa fa-cog\"></i></slot></a>\n <b-modal\n ref=\"editormodal\"\n scrollable\n centered\n size=\"xl\"\n id=\"'modal-cm-'+cmid\"\n @shown=\"onShown\"\n @ok=\"onSave\"\n :title=\"title\"\n :ok-title=\"text.save$core\"\n ><div :class=\"'s-edit-mod-form '+ (genericonly?'genericonly':'')\" ref=\"content\"\n ><div class=\"d-flex justify-content-center mb-3\"><b-spinner variant=\"primary\"></b-spinner></div\n ></div\n ></b-modal>\n </span>\n `,\n });\n }\n};\n\n"],"names":["install","Vue","strings","editmod","save$core","cancel$core","component","props","cmid","type","Number","coursectxid","title","String","default","genericonly","Boolean","data","content","text","computed","methods","openForm","this","$refs","show","onShown","self","params","console","info","then","html","js","catch","notification","exception","onSave","form","getElementsByTagName","dispatchEvent","Event","formdata","FormData","URLSearchParams","toString","methodname","args","done","$emit","fail","template"],"mappings":"mYAce,CACXA,iBAAQC,SAEAC,SAAU,8BAAa,CACvBC,QAAS,CACLC,UAAW,YACXC,YAAa,iBAIrBJ,IAAIK,UAAU,aAAc,CACxBC,MAAO,CACHC,KAAM,CACFC,KAAMC,QAEVC,YAAY,CACRF,KAAMC,QAEVE,MAAO,CACHH,KAAMI,OACNC,QAAS,IAEbC,YAAa,CACTN,KAAMO,QACNF,SAAS,IAGjBG,sBACW,CACHC,QAAS,GACTC,KAAMjB,QAAQC,UAGtBiB,SAAU,GAEVC,QAAS,CACLC,oBACiBC,KACRC,MAAL,YAA0BC,QAE9BC,uBACUC,KAAOJ,KACTK,OAAS,CAACpB,KAAMe,KAAKf,MACzBqB,QAAQC,KAAK,2CACA,sBAAuB,gBAAiBP,KAAKZ,YAAaiB,QAAQG,MAAK,SAACC,KAAKC,uCAClEN,KAAKH,MAAL,QAAuBQ,KAAMC,OAClDC,MAAMC,sBAAaC,YAG1BC,sBACUV,KAAOJ,KACTe,KAAOf,KAAKC,MAAL,QAAsBe,qBAAqB,QAAQ,GAI9DD,KAAKE,cAAc,IAAIC,MAAM,wBAIvBC,SAAW,IAAIC,SAASL,MACxBrB,KAAM,IAAI2B,gBAAgBF,UAAUG,0BAKrC,CAAC,CACFC,WAAY,yCACZC,KAAM,CAACvC,KAAMe,KAAKf,KAAMkC,SAAUzB,SAClC,GAAG+B,MAAK,WACRrB,KAAKsB,MAAM,QAAQP,aACpBQ,KAAKf,sBAAaC,aAI7Be"}