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(a){const now=(new Date).getTime();let timing="future";return new Date(a.startdate).getTime()new Date(a.enddate).getTime()?"past":"present"),timing},install(Vue){let strings=(0,_stringHelper.load_strings)({studyplancard:{open:"open",noenddate:"noenddate",idnumber:"studyplan_idnumber",description:"studyplan_description",completed:"completed"}});const ItemEventBus=new Vue;Vue.component("s-studyplan-card",{props:{value:{type:Object},open:{type:Boolean}},data:()=>({text:strings.studyplancard}),computed:{timing(){const now=(new Date).getTime(),startdate=new Date(this.value.pages[0].startdate).getTime(),enddate=new Date(this.value.pages[0].enddate).getTime();let timing="future";return startdateenddate?"past":"present"),timing},startdate(){return(0,_dateHelper.format_date)(this.value.pages[0].startdate)},enddate(){return this.value.pages[0].enddate?(0,_dateHelper.format_date)(this.value.pages[0].enddate):this.text.noenddate},width_completed(){return this.value.progress?100*this.value.progress:0},width_incomplete(){return this.value.progress?100*(1-this.value.progress):100},percentage_complete(){return this.value.progress?Math.round(100*this.value.progress)+"%":"0%"}},methods:{onOpenClick(e){this.$emit("open",e)}},template:"\n \n \n \n
\n
\n
\n
\n \n {{value.name}}\n \n \n
\n
\n
\n {{ text.idnumber }}: {{ value.idnumber }}\n
\n
\n
0\"\n :style=\"{width: width_completed+'%'}\"\n class='s-studyplan-card-progress-segment s-studyplan-card-progress-completed'\n >
\n
\n {{ percentage_complete}} {{ text.completed.toLowerCase() }} \n
\n
\n
\n \n
\n \n \n \n "}),Vue.component("s-studyline-header-heading",{props:{identifier:{type:Number,default:()=>0}},data:()=>({layerHeights:{}}),created(){ItemEventBus.$on("headerHeightChange",this.onHeaderHeightChange)},computed:{},methods:{onHeaderHeightChange(newheight,identifier){this.identifier==identifier&&this.$refs.main&&(this.$refs.main.style.height=`${newheight}px`)}},template:'\n
\n '}),Vue.component("s-studyline-header-period",{props:{value:{type:Object},identifier:{type:Number,default:()=>0}},mounted(){const self=this;1==self.value.period&&(self.resizeListener=new ResizeObserver((()=>{if(self.$refs.main){const size=self.$refs.main.getBoundingClientRect();ItemEventBus.$emit("headerHeightChange",size.height,self.identifier)}})).observe(self.$refs.main))},unmounted(){this.resizeListener&&this.resizeListener.disconnect()},computed:{startdate(){return(0,_dateHelper.format_date)(this.value.startdate)},enddate(){return(0,_dateHelper.format_date)(this.value.enddate)},current(){if(this.value&&this.value.startdate&&this.value.enddate){const now=new Date,pstart=new Date(this.value.startdate),pend=new Date(this.value.enddate);return now>=pstart&&now({}),template:'\n

{{ value.shortname }}\n {{ value.fullname }}
\n \n {{ startdate }} - {{ enddate }}\n \n \n

\n {{ startdate }} - {{ enddate }}\n

\n
\n '})}};return _exports.default=_default,_exports.default})); //# sourceMappingURL=treestudyplan-components.min.js.map