87 lines
2.6 KiB
Vue
Raw Normal View History

2018-11-01 17:19:53 +05:30
<template>
2019-04-25 19:33:22 +05:30
<div class="py-3 col-md-4 col-sm-12">
2019-03-31 19:46:39 +05:30
<div class="card h-100">
<div class="card-hero-img" v-if="course.hero_image" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div>
<div v-else class="card-image-wrapper">
<div class="image-body">{{ course.course_name }}</div>
</div>
<div class='card-body'>
2018-11-01 17:19:53 +05:30
<h5 class="card-title">{{ course.course_name }}</h5>
<span class="course-list text-muted" id="getting-started">
{{ course.course_intro.substring(0,120) }}
2018-11-01 17:19:53 +05:30
</span>
</div>
<div class='p-3' style="display: flex; justify-content: space-between;">
<div>
<span v-if="complete"><i class="mr-2 text-success fa fa-check-circle" aria-hidden="true"></i>Course Complete</span>
</div>
<div class='text-right'>
2019-03-31 19:46:39 +05:30
<a-button
:type="'primary'"
size="sm"
2019-03-31 19:46:39 +05:30
:route="courseRoute"
>
{{ buttonName }}
</a-button>
</div>
2018-11-01 17:19:53 +05:30
</div>
</div>
</div>
</template>
<script>
2018-11-12 12:50:54 +05:30
import AButton from './Button.vue';
2018-11-02 20:51:24 +05:30
2018-11-01 17:19:53 +05:30
export default {
2018-11-22 15:33:30 +05:30
props: ['course', 'program_name'],
2018-11-13 17:24:07 +05:30
name: "CourseCard",
2018-11-02 20:51:24 +05:30
components: {
2018-11-09 11:47:09 +05:30
AButton
},
2019-02-28 15:21:43 +05:30
data() {
return {
courseDetails: {},
2019-02-28 15:21:43 +05:30
}
},
mounted() {
if(lms.store.checkLogin()) this.getCourseDetails().then(data => this.courseDetails = data)
2019-02-28 15:21:43 +05:30
},
2018-11-09 11:47:09 +05:30
computed: {
2018-12-17 13:56:27 +05:30
courseRoute() {
return `${this.program_name}/${this.course.name}`
},
complete() {
2019-02-28 15:21:43 +05:30
if(lms.store.checkProgramEnrollment(this.program_name)){
if (this.courseDetails.flag === "Completed" ) {
return true
2019-02-28 15:21:43 +05:30
}
else {
return false
2019-02-28 15:21:43 +05:30
}
}
else {
return false
2019-02-28 15:21:43 +05:30
}
},
isLogin() {
return lms.store.checkLogin()
},
buttonName() {
if(lms.store.checkProgramEnrollment(this.program_name)){
return "Start Course"
2019-02-28 15:21:43 +05:30
}
else {
return "Explore"
2019-02-28 15:21:43 +05:30
}
}
},
methods: {
getCourseDetails() {
return lms.call('get_student_course_details', {
2019-02-28 15:21:43 +05:30
course_name: this.course.name,
program_name: this.program_name
})
},
2018-11-01 17:19:53 +05:30
}
};
</script>