{"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} from './util/date-helper';\n\nexport default {\n studyplanTiming(a) {\n const now = new Date().getTime();\n let timing = 'future';\n if(new Date(a.startdate).getTime() < now){\n if(a.enddate && now > new Date(a.enddate).getTime()) {\n timing = 'past';\n } else {\n timing = 'present';\n }\n }\n return timing;\n },\n\n install(Vue/*,options*/){\n let strings = load_strings({\n studyplancard: {\n open: \"open\",\n noenddate: \"noenddate\",\n idnumber: \"studyplan_idnumber\"\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 startdate(){\n return format_date(this.value.pages[0].startdate);\n },\n enddate(){\n if(this.value.pages[0].enddate){\n return format_date(this.value.pages[0].enddate);\n } \n else {\n return this.text.noenddate;\n }\n }\n },\n methods: {\n onOpenClick(e) {\n this.$emit('open',e);\n }\n },\n template: `\n
{{ value.shortname }}\n
\n \n {{ startdate }} - {{ enddate }}\n \n
\n {{ startdate }} - {{ enddate }}\n
\n