62 lines
1.7 KiB
Vue
Raw Normal View History

2018-11-01 17:20:04 +05:30
<template>
<div class="nav-buttons">
2018-11-02 16:29:04 +05:30
<button class='btn btn-outline-secondary' @click="$router.go(-1)">Back</button>
2018-11-05 13:11:37 +05:30
<button v-if="nextContent" class='btn btn-primary' @click="goNext()">Next</button>
<button v-else class='btn btn-primary' @click="finish()">Finish Course</button>
2018-11-01 17:20:04 +05:30
</div>
</template>
<script>
export default {
props: ['nextContent', 'nextContentType'],
2018-11-13 17:24:07 +05:30
name: 'Navigation',
2018-11-03 20:43:59 +05:30
methods: {
goNext() {
2018-11-05 13:11:37 +05:30
if(this.$route.params.type != "Quiz"){
frappe.call({
method: "erpnext.www.lms.add_activity",
2018-11-05 13:11:37 +05:30
args: {
2018-11-13 16:47:46 +05:30
enrollment: lms.store.enrolledCourses[this.$route.params.course],
2018-11-05 13:11:37 +05:30
content_type: this.$route.params.type,
content: this.$route.params.content
}
})
}
2018-11-03 20:43:59 +05:30
this.$router.push({ name: 'content', params: { course: this.$route.params.course, type:this.nextContentType, content:this.nextContent }})
},
finish() {
if(this.$route.params.type != "Quiz"){
frappe.call({
method: "erpnext.www.lms.add_activity",
args: {
2018-11-13 16:47:46 +05:30
enrollment: lms.store.enrolledCourses[this.$route.params.course],
content_type: this.$route.params.type,
content: this.$route.params.content
}
})
}
2018-11-05 13:11:37 +05:30
frappe.call({
method: "erpnext.www.lms.mark_course_complete",
2018-11-05 13:11:37 +05:30
args: {
2018-11-13 16:47:46 +05:30
enrollment: lms.store.enrolledCourses[this.$route.params.course]
2018-11-05 13:11:37 +05:30
}
})
2018-11-13 16:47:46 +05:30
// lms.store.addCompletedCourses(this.$route.params.course)
lms.store.updateCompletedCourses()
2018-11-12 12:50:54 +05:30
this.$router.push({ name: 'program', params: { program_name: this.$route.params.program_name}})
2018-11-09 11:47:09 +05:30
//
2018-11-13 16:47:46 +05:30
lms.trigger('course-completed', course_name);
2018-11-03 20:43:59 +05:30
}
}
2018-11-01 17:20:04 +05:30
};
</script>
<style lang="css" scoped>
.nav-buttons {
position: absolute;
bottom: 0;
right: 0;
}
</style>