brotherton-erpnext/erpnext/public/js/education/web-academy/components/AcademyProgramCard.vue

57 lines
1.8 KiB
Vue
Raw Normal View History

2018-10-30 12:55:49 +00:00
<template>
<div class='card-deck mt-5'>
<div class="card">
2018-11-01 11:49:21 +00:00
<img :src="program.hero_image" style='height: 150px; width: auto'>
2018-10-30 12:55:49 +00:00
<div class='card-body'>
<router-link :to="'/Program/' + program.name">
2018-11-01 11:49:21 +00:00
<h5 class='card-title'>{{ program.program_name }}</h5>
2018-10-30 12:55:49 +00:00
</router-link>
<div v-html="program.description"></div>
</div>
<div class='card-footer text-right'>
<!-- <a class='video-btn btn btn-secondary btn-sm' data-toggle="modal" data-src=" insert jinja stuff here " data-target="#myModal">Watch Intro</a>&nbsp;&nbsp; -->
2018-11-05 05:31:37 +00:00
<a v-if="this.$root.$data.checkProgramEnrollment(program.name)" class='btn btn-secondary btn-sm' @click="$router.push('/Program/' + program.name)">Start Course</a>
<a v-else-if="this.$root.$data.isLogin" class='btn btn-secondary btn-sm' @click="enroll()">Enroll Now</a>
<a v-else class='btn btn-secondary btn-sm' href="/login#signup">Sign Up</a>
2018-10-30 12:55:49 +00:00
</div>
</div>
</div>
</template>
<script>
export default {
2018-11-01 11:49:21 +00:00
props: ['program_code'],
2018-10-30 12:55:49 +00:00
name: "AcademyProgramCard",
data() {
return {
program: ''
};
},
mounted() {
frappe.call({
method: "erpnext.www.academy.get_program_details",
args: {
2018-11-01 11:49:21 +00:00
program_name: this.program_code
2018-10-30 12:55:49 +00:00
}
}).then(r => {
this.program = r.message
})
},
2018-11-03 12:33:24 +00:00
methods: {
enroll() {
frappe.call({
method: "erpnext.www.academy.enroll_in_program",
2018-11-03 12:33:24 +00:00
args:{
program_name: this.program_code,
2018-11-03 12:33:24 +00:00
student_email_id: frappe.session.user
}
})
}
}
2018-10-30 12:55:49 +00:00
};
2018-11-01 11:49:21 +00:00
</script>
<style lang="css" scoped>
a {
text-decoration: none;
}
</style>