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

65 lines
1.7 KiB
Vue
Raw Normal View History

2018-11-09 06:17:09 +00:00
<template>
<div>
2018-11-13 11:54:07 +00:00
<TopSection v-bind:title="program.program_name" v-bind:description="program.description">
</TopSection>
<CardList :title="'Courses'" :description="''">
2018-11-22 10:03:30 +00:00
<CourseCard slot="card-list-slot" v-for="course in courseData" :course="course" :program_name="program_name" :key="course.name"/>
2018-11-13 11:54:07 +00:00
</CardList>
2018-11-09 06:17:09 +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 CourseCard from "../components/CourseCard.vue"
2018-11-09 06:17:09 +00:00
export default {
props: ['program_name'],
2018-11-13 11:33:18 +00:00
name: "ProgramPage",
2018-11-09 06:17:09 +00:00
components: {
2018-11-13 11:54:07 +00:00
TopSection,
CardList,
CourseCard
2018-11-09 06:17:09 +00:00
},
data() {
return {
program: {},
2018-11-22 10:03:30 +00:00
courseData: [],
2018-11-09 06:17:09 +00:00
}
},
beforeMount() {
2018-11-15 05:43:56 +00:00
// if(lms.store.isLogin) lms.store.updateCompletedCourses()
2018-11-09 06:17:09 +00:00
},
mounted() {
this.getProgramDetails().then(data => this.program = data);
2018-11-22 10:03:30 +00:00
this.getCourses().then(data => this.courseData = data);
2018-11-13 11:17:46 +00:00
// lms.on(`course-completed`, (course_name) => {
2018-11-22 10:03:30 +00:00
// const course = this.courseData.findIndex(c => c.name === course_name);
// this.courseData[course].completed = true;
2018-11-12 07:20:54 +00:00
// });
2018-11-09 06:17:09 +00:00
},
methods: {
2018-11-19 11:38:40 +00:00
// startCourse() {
// this.getContentForNextCourse()
// .then((data) =>
// this.$router.push(`/Program/${this.program_name}/${data.course}/${data.content_type}/${data.content}`)
// )
// },
// getContentForNextCourse() {
// return lms.call('get_continue_data', {
// program_name: this.program_name
// });
// },
2018-11-09 06:17:09 +00:00
getProgramDetails() {
2018-11-13 11:17:46 +00:00
return lms.call('get_program_details', {
2018-11-09 06:17:09 +00:00
program_name: this.program_name
});
},
getCourses() {
2018-11-13 11:17:46 +00:00
return lms.call('get_courses', {
2018-11-09 06:17:09 +00:00
program_name: this.program_name
})
}
}
};
</script>