fix: certification flow
This commit is contained in:
@@ -176,6 +176,18 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% set certificate = is_certified(course.name) %}
|
||||
{% set progress = frappe.utils.cint(membership.progress) %}
|
||||
{% if certificate %}
|
||||
<a class="button wide-button is-secondary mt-2" href="/courses/{{ course.name }}/{{ certificate }}">
|
||||
{{ _("Get Certificate") }}
|
||||
</a>
|
||||
{% elif course.enable_certification and progress == 100 %}
|
||||
<div class="button wide-button is-secondary mt-4" id="certification" data-course="{{ course.name }}">
|
||||
{{ _("Get Certificate") }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="overlay-heading"> {{ _("Course Include:") }} </div>
|
||||
{% if get_lessons(course.name) | length %}
|
||||
<div class="mt-3">
|
||||
|
||||
@@ -41,6 +41,10 @@ frappe.ready(() => {
|
||||
notify_user(e);
|
||||
})
|
||||
|
||||
$("#certification").click((e) => {
|
||||
create_certificate(e);
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
var check_mentor_request = () => {
|
||||
@@ -196,7 +200,7 @@ var submit_review = (e) => {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
var notify_user = (e) => {
|
||||
e.preventDefault();
|
||||
@@ -216,4 +220,20 @@ var notify_user = (e) => {
|
||||
$("#notify-me").addClass("hide");
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
const create_certificate = (e) => {
|
||||
e.preventDefault();
|
||||
course = $(e.currentTarget).attr("data-course");
|
||||
console.log(course)
|
||||
console.log($(e.currentTarget))
|
||||
frappe.call({
|
||||
method: "school.lms.doctype.lms_certification.lms_certification.create_certificate",
|
||||
args: {
|
||||
"course": course
|
||||
},
|
||||
callback: (data) => {
|
||||
window.location.href = `/courses/${course}/${data.message}`;
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ def get_context(context):
|
||||
|
||||
course = frappe.db.get_value("LMS Course", course_name,
|
||||
["name", "title", "image", "short_introduction", "description", "is_published", "upcoming",
|
||||
"disable_self_learning", "video_link"],
|
||||
"disable_self_learning", "video_link", "enable_certification"],
|
||||
as_dict=True)
|
||||
|
||||
related_courses = frappe.get_all("Related Courses", {"parent": course.name}, ["course"])
|
||||
|
||||
Reference in New Issue
Block a user