fix: show view certificate link on course page, if already certified
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<Button v-if="certification.data && certification.data.certificate" @click="downloadCertificate" class="w-full">
|
||||
<Button
|
||||
v-if="certification.data && certification.data.certificate"
|
||||
@click="downloadCertificate"
|
||||
class="w-full"
|
||||
>
|
||||
<template #prefix>
|
||||
<GraduationCap class="size-4 stroke-1.5" />
|
||||
</template>
|
||||
@@ -75,7 +79,7 @@ const downloadCertificate = () => {
|
||||
window.open(
|
||||
`/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name=${
|
||||
certification.data.certificate.name
|
||||
}&format=${encodeURIComponent(certification.data.certificate.template)}`,
|
||||
}&format=${encodeURIComponent(certification.data.certificate.template)}`
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1300,9 +1300,18 @@ def get_certification_details(course):
|
||||
)
|
||||
|
||||
paid_certificate = frappe.db.get_value("LMS Course", course, "paid_certificate")
|
||||
certificate = frappe.db.get_value("LMS Certificate", {"member": frappe.session.user, "course": course}, ["name", "template"], as_dict=1)
|
||||
certificate = frappe.db.get_value(
|
||||
"LMS Certificate",
|
||||
{"member": frappe.session.user, "course": course},
|
||||
["name", "template"],
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
return {"membership": membership, "paid_certificate": paid_certificate, "certificate": certificate}
|
||||
return {
|
||||
"membership": membership,
|
||||
"paid_certificate": paid_certificate,
|
||||
"certificate": certificate,
|
||||
}
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
Reference in New Issue
Block a user