moodle_local_treestudyplan/amd/build/page-coach.min.js.map

1 line
14 KiB
Plaintext
Raw Normal View History

2024-06-02 17:21:30 +02:00
{"version":3,"file":"page-coach.min.js","sources":["../src/page-coach.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\nimport Debugger from './util/debugger';\nimport {load_strings} from './util/string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\nimport {studyplanTiming} from './util/date-helper';\nimport {addBrowserButtonEvent} from './util/browserbuttonevents';\n\nimport EditorComponents from './studyplan-editor-components';\nVue.use(EditorComponents);\n\nimport TSComponents from './treestudyplan-components';\nVue.use(TSComponents);\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\n\nimport ModalComponents from './modedit-modal';\nVue.use(ModalComponents);\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\n\nlet debug = new Debugger(\"treestudyplancoach\");\n\nlet strings = load_strings({\n coach: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n switch_coach_editmode: 'switch_coach_editmode',\n },\n});\n\n/**\n * Initialize the Page\n */\nexport function init() {\n let app = new Vue({\n el: '#root',\n data: {\n selected: {\n planid: 0,\n studentid: 0,\n },\n displayedstudyplan: null,\n activestudyplan: null,\n associatedstudents: [],\n selectedstudent: null,\n studentstudyplan: null,\n loadingstudyplan: false,\n studyplans: [],\n text: strings.coach,\n toolbox: {\n right: true,\n },\n usedcontexts: [],\n editmode: false,\n },\n async mounted() {\n call([{\n methodname: 'local_treestudyplan_list_coaching_studyplans',\n args: {}\n }])[0].then(function(response){\n const timingval = { present: 0, past: 1, future: 2};\n response.sort((a,b) => {\n const timinga = studyplanTiming(a);\n const timingb = studyplanTiming(b);\n\n const t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by name if timing is equal\n return a.name.localeCompare(b.name);\n }\n else {\n return t;\n }\n });\n app.studyplans = response;\n // load studyplan from hash if applicable\n const hash = window.location.hash.replace('#','');\n const parts = hash.split(\"-\");\n\n if(!!parts && parts.length > 0 && parts[0] != ''){\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == parts[0]){\n app.selectStudyplan(app.studyplans[idx],parts[1],false);\n break;\n }\n }\n }\n }).catch(notification.exception);\n addBrowserButtonEvent(this.navChanged, this.navChanged);\n },\n computed: {\n },\n methods: {\n navChanged() {\n const hash = window.location.hash.replace('#','');\n const parts = hash.split(\"-\");\n debug.log(\"Navigation changed\",hash,parts);\n\n if(!!parts && parts.length > 0){\n const planid = Number(parts[0]);\n const studentid = (parts.length > 1)?Number(parts[1]):0;\n\n