brotherton-erpnext/erpnext/public/js/education/lms/components/ProgressCard.vue

90 lines
2.6 KiB
Vue
Raw Normal View History

2018-11-26 11:23:51 +00:00
<template>
2019-04-25 14:03:22 +00:00
<div class='py-3 col-md-4 col-sm-12'>
<div class="card h-100">
<div class='card-body'>
2018-11-26 11:23:51 +00:00
<router-link :to="'/Program/' + programData.name">
<h5 class='card-title'>{{ programData.program }}</h5>
</router-link>
<span class="course-list text-muted" id="getting-started">
Courses
<ul class="mb-0 mt-1 list-unstyled" style="padding-left: 1.5em;">
2018-11-26 11:23:51 +00:00
<li v-for="item in programData.progress" :key="item.name">
2019-02-28 12:41:46 +00:00
<span v-if="item.is_complete"><i class="text-success fa fa-check-circle" aria-hidden="true"></i></span>
<span v-else><i class="text-secondary fa fa-circle-o" aria-hidden="true"></i></span>
2018-11-26 11:23:51 +00:00
{{ item.course_name }}
</li>
</ul>
</span>
</div>
<div class='p-3' style="display: flex; justify-content: space-between;">
<div></div>
<div class='text-right'>
<a-button
:type="buttonType"
size="sm btn-block"
:route="programRoute"
>
{{ buttonName }}
</a-button>
</div>
2018-11-26 11:23:51 +00:00
</div>
</div>
</div>
</template>
<script>
import AButton from './Button.vue';
export default {
props: ['program'],
name: "ProgressCard",
data() {
return {
programData: {}
};
},
mounted() {
this.getProgramProgress().then(data => this.programData = data)
},
methods: {
getProgramProgress() {
return lms.call('get_program_progress', {
program_name: this.program
})
},
},
2018-11-26 13:46:54 +00:00
computed: {
programRoute() {
return {name: 'program', params: {program_name: this.program}}
},
buttonType() {
if (this.programData.percentage == 100 ){
return "success"
}
else if (this.programData.percentage == "0" ) {
return "secondary"
}
else {
return "info"
}
},
buttonName() {
if (this.programData.percentage == 100 ){
return "Program Complete"
}
else {
return `${this.programData.percentage}% Completed`
}
}
},
2018-11-26 11:23:51 +00:00
components: {
AButton
},
};
</script>
<style scoped>
2019-02-28 12:41:46 +00:00
a {
text-decoration: none;
color: black;
}
2018-11-26 11:23:51 +00:00
</style>