2018-12-17 08:26:27 +00:00
|
|
|
|
|
|
|
<template>
|
2019-03-31 14:16:39 +00:00
|
|
|
<div class="mt-3 col-md-4 col-sm-12">
|
|
|
|
<div class="card h-100">
|
|
|
|
<div class="card-hero-img" v-if="topic.hero_image" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div>
|
|
|
|
<div v-else class="card-image-wrapper">
|
|
|
|
<div class="image-body">{{ topic.topic_name }}</div>
|
|
|
|
</div>
|
|
|
|
<div class='card-body'>
|
2019-02-26 11:19:15 +00:00
|
|
|
<h5 class="card-title">{{ topic.topic_name }}</h5>
|
2018-12-17 08:26:27 +00:00
|
|
|
<span class="course-list text-muted" id="getting-started">
|
2019-02-26 11:19:15 +00:00
|
|
|
Content
|
2019-04-22 12:21:30 +00:00
|
|
|
<ul class="mb-0 mt-1" style="padding-left: 1.5em;">
|
2019-02-26 11:19:15 +00:00
|
|
|
<li v-for="content in topic.topic_content" :key="content.name">
|
2019-02-26 11:41:01 +00:00
|
|
|
<router-link v-if="isLogin" tag="a" :class="'text-muted'" :to="{name: 'content', params:{program_name: program_name, topic:topic.name, course_name: course_name, type:content.content_type, content: content.content} }">
|
2019-04-22 12:21:30 +00:00
|
|
|
{{ content.content }}
|
2018-12-17 08:26:27 +00:00
|
|
|
</router-link>
|
2019-02-26 11:19:15 +00:00
|
|
|
<div v-else><span style="padding-right: 0.4em"></span>{{ content.content }}</div>
|
2018-12-17 08:26:27 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</span>
|
|
|
|
</div>
|
2019-04-22 12:21:30 +00:00
|
|
|
<div v-if="isLogin" 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 14:16:39 +00:00
|
|
|
<a-button
|
2019-04-22 12:21:30 +00:00
|
|
|
:type="'primary'"
|
|
|
|
size="sm"
|
|
|
|
:route="firstContentRoute"
|
|
|
|
>
|
|
|
|
{{ buttonName }}
|
|
|
|
</a-button>
|
2019-03-31 14:16:39 +00:00
|
|
|
</div>
|
2018-12-17 08:26:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import AButton from './Button.vue';
|
|
|
|
|
|
|
|
export default {
|
2019-02-26 11:41:01 +00:00
|
|
|
props: ['topic', 'course_name', 'program_name'],
|
2019-02-26 11:19:15 +00:00
|
|
|
name: "TopicCard",
|
2018-12-17 08:26:27 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2019-04-22 12:21:30 +00:00
|
|
|
topicDetails: {}
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2019-04-22 12:21:30 +00:00
|
|
|
if(lms.store.checkLogin()) this.gettopicDetails().then(data => this.topicDetails = data)
|
2018-12-17 08:26:27 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
AButton
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
firstContentRoute() {
|
|
|
|
if(lms.store.checkLogin()){
|
2019-04-22 12:21:30 +00:00
|
|
|
return `/Program/${this.program_name}/${this.course_name}/${this.topic.name}/${this.topicDetails.content_type}/${this.topicDetails.content}`
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
},
|
2019-04-22 12:21:30 +00:00
|
|
|
complete() {
|
2018-12-17 08:26:27 +00:00
|
|
|
if(lms.store.checkProgramEnrollment(this.program_name)){
|
2019-04-22 12:21:30 +00:00
|
|
|
if (this.topicDetails.flag === "Completed" ) {
|
|
|
|
return true
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
2019-04-22 12:21:30 +00:00
|
|
|
else {
|
|
|
|
return false
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-04-22 12:21:30 +00:00
|
|
|
return false
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
isLogin() {
|
|
|
|
// return lms.store.checkProgramEnrollment(this.program_name)
|
2019-02-28 10:10:49 +00:00
|
|
|
return lms.store.checkLogin()
|
2018-12-17 08:26:27 +00:00
|
|
|
},
|
|
|
|
buttonName() {
|
2019-03-19 07:00:43 +00:00
|
|
|
if(lms.store.checkProgramEnrollment(this.program_name)){
|
2019-04-22 12:21:30 +00:00
|
|
|
if (this.topicDetails.flag == 'Continue'){
|
|
|
|
return 'Continue'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return 'Start Topic'
|
|
|
|
}
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-19 07:00:43 +00:00
|
|
|
return "Explore"
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
iconClass(content_type) {
|
|
|
|
if(content_type == 'Video') return 'fa fa-play'
|
|
|
|
if(content_type == 'Article') return 'fa fa-file-text-o'
|
|
|
|
if(content_type == 'Quiz') return 'fa fa-question-circle-o'
|
|
|
|
},
|
2019-04-22 12:21:30 +00:00
|
|
|
gettopicDetails() {
|
2019-04-22 06:36:28 +00:00
|
|
|
return lms.call('get_student_topic_details', {
|
2019-02-28 10:10:49 +00:00
|
|
|
topic_name: this.topic.name,
|
2019-02-26 11:41:01 +00:00
|
|
|
course_name: this.course_name,
|
2018-12-17 08:26:27 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2019-04-22 12:21:30 +00:00
|
|
|
</script>
|