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

70 lines
1.9 KiB
Vue
Raw Normal View History

2018-11-09 06:17:09 +00:00
<template>
<div>
<AcademyTopSection v-bind:title="program.program_name" v-bind:description="program.description">
2018-11-12 07:20:54 +00:00
<!-- <a-button @click="startCourse">Start Course</a-button>
<a-button @click="continueCourse">Continue Course</a-button> -->
2018-11-09 06:17:09 +00:00
</AcademyTopSection>
<AcademyList :title="'Courses'" :description="''">
2018-11-12 07:20:54 +00:00
<AcademyCourseCard v-for="course in course_data" :course="course.course" :program_name="program_name" :courseMeta="course.meta" :key="course.meta.flag"/>
2018-11-09 06:17:09 +00:00
</AcademyList>
</div>
</template>
<script>
import Button from '../components/Button.vue';
import AcademyTopSection from "../components/AcademyTopSection.vue"
import AcademyList from "../components/AcademyList.vue"
import AcademyCourseCard from "../components/AcademyCourseCard.vue"
export default {
props: ['program_name'],
name: "AcademyProgramPage",
components: {
AButton: Button,
AcademyTopSection,
AcademyList,
2018-11-12 07:20:54 +00:00
AcademyCourseCard
2018-11-09 06:17:09 +00:00
},
data() {
return {
program: {},
2018-11-12 07:20:54 +00:00
course_data: []
2018-11-09 06:17:09 +00:00
}
},
beforeMount() {
2018-11-13 11:17:46 +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-12 07:20:54 +00:00
this.getCourses().then(data => this.course_data = data);
2018-11-09 06:17:09 +00:00
2018-11-13 11:17:46 +00:00
// lms.on(`course-completed`, (course_name) => {
2018-11-12 07:20:54 +00:00
// const course = this.course_data.findIndex(c => c.name === course_name);
// this.course_data[course].completed = true;
// });
2018-11-09 06:17:09 +00:00
},
methods: {
startCourse() {
this.getContentForNextCourse()
.then((data) =>
this.$router.push(`/Program/${this.program_name}/${data.course}/${data.content_type}/${data.content}`)
)
},
getContentForNextCourse() {
2018-11-13 11:17:46 +00:00
return lms.call('get_continue_data', {
2018-11-09 06:17:09 +00:00
program_name: this.program_name
});
},
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>