moodle_local_treestudyplan/amd/build/page-view-plan.min.js.map

1 line
16 KiB
Plaintext
Raw Normal View History

2024-06-03 23:24:16 +02:00
{"version":3,"file":"page-view-plan.min.js","sources":["../src/page-view-plan.js"],"sourcesContent":["/* eslint no-unused-vars: \"off\" */\n/* eslint no-trailing-spaces: \"off\" */\n/* eslint max-depth: [\"error\", 5] */\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 {loadStrings} from './util/string-helper';\nimport {processStudyplan} from './studyplan-processor';\nimport {studyplanTiming} from './util/date-helper';\nimport {addBrowserButtonEvent} from './util/browserbuttonevents';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\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(\"treestudyplanviewer\");\n\nlet strings = loadStrings({\n studyplan: {\n studyplanSelectPlaceholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {number} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {number} categoryid The category we shoud attempt to work in (1:1 related to the context)\n */\nexport function init(contextid, categoryid) {\n // Make sure the id's are numeric and integer\n if (undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1) {\n contextid = 1;\n } else { // Ensure a numeric value instead of string\n contextid = Number(contextid);\n }\n if (undefined === categoryid || !Number.isInteger(Number(categoryid))) {\n categoryid = 0;\n } else { // Ensure a numeric value instead of string\n categoryid = Number(categoryid);\n }\n\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.studyplan,\n toolbox: {\n right: true,\n },\n usedcontexts: [],\n },\n async mounted() {\n call([{\n methodname: 'local_treestudyplan_list_studyplans',\n args: {'context_id': contextid}\n }])[0].then((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 } 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]);\n break;\n }\n }\n }\n return;\n }).catch(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_available_categories',\n args