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

3 lines
7.0 KiB
JavaScript
Raw Normal View History

define("local_treestudyplan/treestudyplan-components",["exports","./util/string-helper","./util/date-helper"],(function(_exports,_stringHelper,_dateHelper){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var _default={studyplanTiming:function(a){var now=(new Date).getTime(),timing="future";return new Date(a.startdate).getTime()<now&&(timing=a.enddate&&now>new Date(a.enddate).getTime()?"past":"present"),timing},install:function(Vue){var strings=(0,_stringHelper.load_strings)({studyplancard:{open:"open",noenddate:"noenddate",idnumber:"studyplan_idnumber",description:"studyplan_description",completed:"completed"}}),ItemEventBus=new Vue;Vue.component("s-studyplan-card",{props:{value:{type:Object},open:{type:Boolean}},data:function(){return{text:strings.studyplancard}},computed:{timing:function(){var now=(new Date).getTime(),startdate=new Date(this.value.pages[0].startdate).getTime(),enddate=new Date(this.value.pages[0].enddate).getTime(),timing="future";return startdate<now&&(timing=this.value.pages[0].enddate&&now>enddate?"past":"present"),timing},startdate:function(){return(0,_dateHelper.format_date)(this.value.pages[0].startdate)},enddate:function(){return this.value.pages[0].enddate?(0,_dateHelper.format_date)(this.value.pages[0].enddate):this.text.noenddate},width_completed:function(){return this.value.progress?100*this.value.progress:0},width_incomplete:function(){return this.value.progress?100*(1-this.value.progress):100},percentage_complete:function(){return this.value.progress?Math.round(100*this.value.progress)+"%":"0%"}},methods:{onOpenClick:function(e){this.$emit("open",e)}},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-studyplan-card-info'>\n <div class='s-studyplan-card-titlebar'>\n <b-card-title>\n <a v-if='open' href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>\n <template v-else>{{value.name}}</template>\n </b-card-title>\n <div class='s-studyplan-card-titleslot'><slot name='title'></slot></div>\n </div> \n <div class='s-studyplan-card-idnumber' v-if='value.idnumber'>\n {{ text.idnumber }}: {{ value.idnumber }}\n </div>\n <div class='s-studyplan-card-progress' v-if='value.progress !== undefined && value.progress !== null'>\n <div class=\"s-studyplan-card-progressbar\"\n ><span v-if=\"width_completed > 0\"\n :style=\"{width: width_completed+'%'}\"\n class='s-studyplan-card-progress-segment s-studyplan-card-progress-completed'\n ></span\n ><span :style=\"{width: width_incomplete+'%'}\"\n class='s-studyplan-card-progress-segment s-studyplan-card-progress-incomplete'\n ></span\n ></div>\n <div class=\"s-studyplan-card-progresstext\">\n {{ percentage_complete}} {{ text.completed.toLowerCase() }} \n </div>\n </div>\n </div>\n \n </div>\n <slot></slot>\n <template #footer>\n <span :class=\"'t-timing-'+timing\" v-html=\"startdate + ' - '+ enddate\"></span>\n <span class=\"s-studyplan-card-buttons\">\n <slot name='footer'></slot>\n <template v-if='value.description'
//# sourceMappingURL=treestudyplan-components.min.js.map