moodle_local_treestudyplan/amd/build/page-view-plan.min.js.map
2023-08-19 17:54:40 +02:00

1 line
12 KiB
Plaintext

{"version":3,"file":"page-view-plan.min.js","sources":["../src/page-view-plan.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\n// Import Vue from dev or prod depending on the developerdebug setting.\n// (Importing both dev and prod seems easier than using dynamic imports, but I could be mistaken)\nimport Config from \"core/config\";\nimport VueDev from './vue/dev/vue';\nimport VueProd from './vue/prod/vue';\nconst Vue = Config.developerdebug?VueDev:VueProd;\n\n\nimport Debugger from './util/debugger';\nimport {load_strings} from './util/string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\n\nimport TSComponents from './treestudyplan-components';\nVue.use(TSComponents);\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.esm';\nVue.use(BootstrapVue);\n\n\nlet debug = new Debugger(\"treestudyplanviewer\");\n\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {int} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {int} 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 ){ contextid = 1;} \n else { contextid = Number(contextid);} // ensure a numeric value instead of string\n if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}\n else { categoryid = Number(categoryid);} // ensure a numeric value instead of string\n\n const in_systemcontext = (contextid <= 1);\n\n let app = new Vue({\n el: '#root',\n data: {\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].done(function(response){\n const timingval = { present: 0, past: 1, future: 2};\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.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 = location.hash.replace('#','');\n const parts = hash.split(\"-\");\n\n if(!!parts && parts.length > 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 }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_used_categories',\n args: { operation: 'view'}\n }])[0].done(function(response){\n const contexts = [];\n for(const ix in response){\n if(response[ix].studyplancount >0){\n contexts.push(response[ix]);\n }\n }\n app.usedcontexts = contexts;\n }).fail(notification.exception);\n },\n computed: {\n dropdown_title(){\n if(this.activestudyplan && this.activestudyplan.name){\n return this.activestudyplan.name;\n }\n else{\n return this.text.studyplan_select_placeholder;\n }\n },\n contextid(){\n return contextid;\n }\n },\n methods: {\n switchContext(ctx){\n const params = new URLSearchParams(location.search);\n params.set('categoryid', ctx.id);\n window.location.search = params.toString();\n\n },\n closeStudyplan() {\n app.activestudyplan = null;\n app.associatedstudents = [];\n app.studentstudyplan = [];\n app.displayedstudyplan = null;\n },\n\n selectStudyplan(studyplan,studentid){\n // fetch studyplan\n app.loadingstudyplan = true;\n app.activestudyplan = null;\n app.associatedstudents = [];\n app.selectedstudent = null;\n app.studentstudyplan = null;\n call([{\n methodname: 'local_treestudyplan_get_studyplan_map',\n args: { id: studyplan.id}\n }])[0].done(function(response){\n app.activestudyplan = ProcessStudyplan(response,true);\n app.displayedstudyplan = app.activestudyplan;\n app.loadingstudyplan = false;\n location.hash = app.activestudyplan.id;\n call([{\n methodname: 'local_treestudyplan_all_associated',\n args: { studyplan_id: studyplan.id}\n }])[0].done(function(response){\n app.associatedstudents = response;\n if(studentid){\n for(const student of app.associatedstudents){\n if(student.id == studentid){\n app.showStudentView(student);\n break;\n }\n }\n }\n }).fail(notification.exception);\n\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n },\n showStudentView(student){\n app.selectedstudent = student;\n app.studentstudyplan = null;\n app.loadingstudyplan = true;\n call([{\n methodname: 'local_treestudyplan_get_user_studyplan',\n args: { userid: student.id, studyplanid: app.activestudyplan.id}\n }])[0].done(function(response){\n app.studentstudyplan = ProcessStudyplan(response,false);\n app.displayedstudyplan = app.studentstudyplan;\n app.loadingstudyplan = false;\n location.hash = app.activestudyplan.id + \"-\" + student.id;\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n\n\n },\n showOverview(){\n app.selectedstudent = null;\n app.studentstudyplan = null;\n app.displayedstudyplan = app.activestudyplan;\n }\n\n },\n });\n}\n"],"names":["contextid","categoryid","undefined","Number","isInteger","app","Vue","el","data","displayedstudyplan","activestudyplan","associatedstudents","selectedstudent","studentstudyplan","loadingstudyplan","studyplans","text","strings","studyplan","toolbox","right","usedcontexts","mounted","methodname","args","context_id","done","response","timingval","present","past","future","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","name","localeCompare","parts","location","hash","replace","split","length","idx","id","selectStudyplan","fail","notification","exception","operation","contexts","ix","studyplancount","push","computed","dropdown_title","this","studyplan_select_placeholder","methods","switchContext","ctx","params","URLSearchParams","search","set","window","toString","closeStudyplan","studentid","studyplan_id","student","showStudentView","error","userid","studyplanid","showOverview","Config","developerdebug","VueDev","VueProd","use","RVComponents","ModalComponents","PortalVue","BootstrapVue","Debugger"],"mappings":"wiCAkDqBA,WAAUC,YAE4DD,gBAApFE,IAAcF,aAAcG,OAAOC,UAAUD,OAAOH,cAAeA,WAAY,EAAiB,EAChFG,OAAOH,YAEnBC,gBADJC,IAAcD,YAAeE,OAAOC,UAAUD,OAAOF,aACpCE,OAAOF,YADyD,MAKhFI,IAAM,IAAIC,IAAI,CACdC,GAAI,QACJC,KAAM,CACFC,mBAAoB,KACpBC,gBAAiB,KACjBC,mBAAoB,GACpBC,gBAAiB,KACjBC,iBAAkB,KAClBC,kBAAkB,EAClBC,WAAY,GACZC,KAAMC,QAAQC,UACdC,QAAS,CACLC,OAAO,GAEXC,aAAc,IAEZC,6LACG,CAAC,CACFC,WAAY,sCACZC,KAAM,CAACC,WAAYzB,eACnB,GAAG0B,MAAK,SAASC,cACXC,UAAY,CAAEC,QAAS,EAAGC,KAAM,EAAGC,OAAQ,GACjDJ,SAASK,MAAK,SAACC,EAAEC,OACPC,QAAUC,iCAAaC,gBAAgBJ,GACvCK,QAAUF,iCAAaC,gBAAgBH,GAEvCK,EAAIX,UAAUO,SAAWP,UAAUU,gBACjC,GAALC,EAEQN,EAAEO,KAAKC,cAAcP,EAAEM,MAGvBD,KAGflC,IAAIU,WAAaY,aAGXe,MADOC,SAASC,KAAKC,QAAQ,IAAI,IACpBC,MAAM,QAEpBJ,OAASA,MAAMK,OAAS,MACrB,IAAIC,OAAO3C,IAAIU,cACZV,IAAIU,WAAWiC,KAAKC,IAAMP,MAAM,GAAG,CAClCrC,IAAI6C,gBAAgB7C,IAAIU,WAAWiC,KAAKN,MAAM,cAK3DS,KAAKC,sBAAaC,0BAChB,CAAC,CACF9B,WAAY,2CACZC,KAAM,CAAE8B,UAAW,WACnB,GAAG5B,MAAK,SAASC,cACX4B,SAAW,OACb,IAAMC,MAAM7B,SACTA,SAAS6B,IAAIC,eAAgB,GAC5BF,SAASG,KAAK/B,SAAS6B,KAG/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