feat: certificate generation dialog
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if is_moderator %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#students">
|
||||
{{ _("Students") }}
|
||||
@@ -125,7 +126,6 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if is_moderator %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#assessments">
|
||||
{{ _("Assessments") }}
|
||||
@@ -175,11 +175,11 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if is_moderator %}
|
||||
<div class="tab-pane" id="students" role="tabpanel" aria-labelledby="students">
|
||||
{{ StudentsSection(batch_info, batch_students) }}
|
||||
</div>
|
||||
|
||||
{% if is_moderator %}
|
||||
<div class="tab-pane" id="assessments" role="tabpanel" aria-labelledby="assessments">
|
||||
{{ AssessmentsSection(batch_info) }}
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</a>
|
||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||
<a class="dark-links" href="/batches/{{ batch.name }}">
|
||||
{{ batch.name }}
|
||||
{{ batch.title }}
|
||||
</a>
|
||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||
<span class="breadcrumb-destination">
|
||||
@@ -46,6 +46,9 @@
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if is_moderator %}
|
||||
<button class="btn btn-default btn-sm btn-certification ml-2">
|
||||
{{ _("Grant Certificate") }}
|
||||
</button>
|
||||
<a class="btn btn-primary btn-sm btn-evaluate ml-2" href="/evaluation/new?member={{student.name}}&date={{frappe.utils.getdate()}}&class_name={{batch.name}}">
|
||||
{{ _("Evaluate") }}
|
||||
</a>
|
||||
@@ -86,5 +89,4 @@
|
||||
let courses = {{ courses | json }};
|
||||
let batch_name = "{{ batch.name }}";
|
||||
</script>
|
||||
{{ include_script('controls.bundle.js') }}
|
||||
{% endblock %}
|
||||
@@ -1,5 +1,45 @@
|
||||
frappe.ready(() => {
|
||||
frappe.require("controls.bundle.js");
|
||||
|
||||
$(".clickable-row").click((e) => {
|
||||
window.location.href = $(e.currentTarget).data("href");
|
||||
});
|
||||
|
||||
$(".btn-certification").click((e) => {
|
||||
show_certificate_dialog(e);
|
||||
});
|
||||
});
|
||||
|
||||
const show_certificate_dialog = (e) => {
|
||||
this.certificate_dialog = new frappe.ui.Dialog({
|
||||
title: __("Grant Certificate"),
|
||||
fields: [
|
||||
{
|
||||
fieldtype: "Link",
|
||||
fieldname: "course",
|
||||
label: __("Course"),
|
||||
options: "LMS Course",
|
||||
reqd: 1,
|
||||
filters: {
|
||||
name: ["in", courses],
|
||||
},
|
||||
filter_description: " ",
|
||||
only_select: 1,
|
||||
},
|
||||
{
|
||||
fieldtype: "Date",
|
||||
fieldname: "issue_date",
|
||||
label: __("Issue Date"),
|
||||
reqd: 1,
|
||||
default: frappe.datetime.get_today(),
|
||||
},
|
||||
{
|
||||
fieldtype: "Date",
|
||||
fieldname: "expiry_date",
|
||||
label: __("Expiry Date"),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
this.certificate_dialog.show();
|
||||
};
|
||||
|
||||
@@ -29,7 +29,9 @@ def get_context(context):
|
||||
):
|
||||
raise frappe.PermissionError(_("You don't have permission to access this page."))
|
||||
|
||||
context.batch = frappe.db.get_value("LMS Batch", batch_name, ["name"], as_dict=True)
|
||||
context.batch = frappe.db.get_value(
|
||||
"LMS Batch", batch_name, ["name", "title"], as_dict=True
|
||||
)
|
||||
|
||||
context.courses = frappe.get_all(
|
||||
"Batch Course", {"parent": batch_name}, pluck="course"
|
||||
|
||||
Reference in New Issue
Block a user