moodle_local_treestudyplan/amd/build/treestudyplan-components.min.js.map

1 line
15 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"treestudyplan-components.min.js","sources":["../src/treestudyplan-components.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 {load_strings} from './util/string-helper';\nimport {format_date, studyplanDates} from './util/date-helper';\n\nexport default {\n studyplanTiming(plan) {\n const now = new Date().getTime();\n \n const dates = studyplanDates(plan);\n\n if(dates.start < now){\n if( dates.end && now > dates.end) {\n return 'past';\n } else {\n return 'present';\n }\n } else {\n return 'future';\n }\n },\n\n install(Vue/*,options*/){\n let strings = load_strings({\n studyplancard: {\n open: \"open\",\n noenddate: \"noenddate\",\n idnumber: \"studyplan_idnumber\",\n description: \"studyplan_description\",\n completed: \"completed\",\n details: \"studyplan_details\",\n },\n details: {\n details: \"studyplan_details\",\n }\n });\n // Create new eventbus for interaction between item components\n const ItemEventBus = new Vue();\n\n Vue.component('s-studyplan-card', {\n props: {\n value: {\n type: Object,\n },\n open: {\n type: Boolean\n },\n },\n data() {\n return {\n text: strings.studyplancard\n };\n },\n computed: {\n timing(){\n const now = new Date().getTime();\n const startdate = new Date(this.value.pages[0].startdate).getTime();\n const enddate = new Date(this.value.pages[0].enddate).getTime();\n let timing = 'future';\n if(startdate < now){\n if(this.value.pages[0].enddate && now > enddate) {\n timing = 'past';\n } else {\n timing = 'present';\n }\n }\n return timing;\n },\n dates(){\n const dates = studyplanDates(this.value);\n return {\n start: format_date(dates.start),\n end: (dates.end)?format_date(dates.end):this.text.noenddate,\n };\n },\n width_completed() {\n if(this.value.progress) {\n return this.value.progress * 100;\n } else {\n return 0;\n }\n },\n width_incomplete() {\n if(this.value.progress) {\n return (1-this.value.progress) * 100;\n } else {\n return 100;\n }\n },\n percentage_complete() {\n if(this.value.progress) {\n return Math.round(this.value.progress * 100) + \"%\";\n } else {\n return \"0%\";\n }\n }\n },\n methods: {\n onOpenClick(e) {\n this.$emit('open',e);\n }\n },\n template: `\n <b-card\n :class=\"'s-studyplan-card timing-' + timing\"\n >\n <template #header></template>\n \n <div class='s-studyplan-card-content'>\n <div class='s-studyplan-card-icon'><img :src='value.icon'></div>\n <div class='s-studypla