brotherton-erpnext/erpnext/public/js/education/lms/pages/Home.vue

55 lines
1.5 KiB
Vue
Raw Normal View History

2018-10-30 12:55:49 +00:00
<template>
<div>
2018-11-13 11:54:07 +00:00
<TopSection :title="portal.title" :description="portal.description">
<TopSectionButton/>
</TopSection>
<CardList :title="'Featured Programs'" :description="'Master ERPNext'">
<ProgramCard v-for="item in featuredPrograms" :key="item.program.name" :program="item.program" :enrolled="item.is_enrolled"/>
</CardList>
2018-10-30 12:55:49 +00:00
</div>
</template>
<script>
2018-11-13 11:54:07 +00:00
import TopSection from "../components/TopSection.vue"
import CardList from "../components/CardList.vue"
import ProgramCard from "../components/ProgramCard.vue"
import TopSectionButton from "../components/TopSectionButton.vue"
2018-10-30 12:55:49 +00:00
export default {
2018-11-13 11:33:18 +00:00
name: "Home",
2018-11-01 11:47:30 +00:00
data() {
return{
2018-11-09 12:55:19 +00:00
portal: {},
featuredPrograms: [],
// enrolledPrograms: new Set()
2018-11-01 11:47:30 +00:00
}
},
2018-10-30 12:55:49 +00:00
components: {
2018-11-13 11:54:07 +00:00
TopSection,
CardList,
ProgramCard,
TopSectionButton
2018-11-09 12:55:19 +00:00
},
beforeMount() {
// this.updateEnrolledPrograms().then(data => {
// data.forEach(element => {
// this.enrolledPrograms.add(element)
// })
// });
},
2018-11-01 11:47:30 +00:00
mounted() {
2018-11-09 12:55:19 +00:00
this.getPortalDetails().then(data => this.portal = data);
this.getFeaturedPrograms().then(data => this.featuredPrograms = data);
2018-11-01 11:47:30 +00:00
},
2018-11-09 12:55:19 +00:00
methods: {
// updateEnrolledPrograms(){
2018-11-13 11:17:46 +00:00
// return lms.call("get_program_enrollments")
2018-11-09 12:55:19 +00:00
// },
getPortalDetails() {
2018-11-13 11:17:46 +00:00
return lms.call("get_portal_details")
2018-11-09 12:55:19 +00:00
},
getFeaturedPrograms() {
2018-11-13 11:17:46 +00:00
return lms.call("get_featured_programs")
2018-11-09 12:55:19 +00:00
}
}
2018-10-30 12:55:49 +00:00
};
</script>