2018-11-01 11:50:04 +00:00
|
|
|
<template>
|
|
|
|
<div class="nav-buttons">
|
2018-11-02 10:59:04 +00:00
|
|
|
<button class='btn btn-outline-secondary' @click="$router.go(-1)">Back</button>
|
2018-11-05 07:41:37 +00:00
|
|
|
<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 11:50:04 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: ['nextContent', 'nextContentType'],
|
2018-11-03 15:13:59 +00:00
|
|
|
name: 'ContentNavigation',
|
|
|
|
methods: {
|
|
|
|
goNext() {
|
2018-11-05 07:41:37 +00:00
|
|
|
if(this.$route.params.type != "Quiz"){
|
|
|
|
frappe.call({
|
|
|
|
method: "erpnext.www.academy.add_activity",
|
|
|
|
args: {
|
|
|
|
enrollment: this.$root.$data.enrolledCourses[this.$route.params.course],
|
|
|
|
content_type: this.$route.params.type,
|
|
|
|
content: this.$route.params.content
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2018-11-03 15:13:59 +00:00
|
|
|
this.$router.push({ name: 'content', params: { course: this.$route.params.course, type:this.nextContentType, content:this.nextContent }})
|
2018-11-05 05:31:05 +00:00
|
|
|
},
|
|
|
|
finish() {
|
|
|
|
if(this.$route.params.type != "Quiz"){
|
|
|
|
frappe.call({
|
|
|
|
method: "erpnext.www.academy.add_activity",
|
|
|
|
args: {
|
|
|
|
enrollment: this.$root.$data.enrolledCourses[this.$route.params.course],
|
|
|
|
content_type: this.$route.params.type,
|
|
|
|
content: this.$route.params.content
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2018-11-05 07:41:37 +00:00
|
|
|
frappe.call({
|
|
|
|
method: "erpnext.www.academy.mark_course_complete",
|
|
|
|
args: {
|
|
|
|
enrollment: this.$root.$data.enrolledCourses[this.$route.params.course]
|
|
|
|
}
|
|
|
|
})
|
2018-11-09 06:17:09 +00:00
|
|
|
// this.$root.$data.addCompletedCourses(this.$route.params.course)
|
2018-11-05 09:24:40 +00:00
|
|
|
this.$root.$data.updateCompletedCourses()
|
2018-11-05 05:31:05 +00:00
|
|
|
this.$router.push({ name: 'program', params: { code: this.$route.params.code}})
|
2018-11-09 06:17:09 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
academy.trigger('course-completed', course_name);
|
2018-11-03 15:13:59 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-01 11:50:04 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="css" scoped>
|
|
|
|
.nav-buttons {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
}
|
|
|
|
</style>
|