feat: certificate generation dialog
This commit is contained in:
@@ -58,13 +58,13 @@
|
|||||||
"fieldname": "batch_name",
|
"fieldname": "batch_name",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Batch Name",
|
"label": "Batch",
|
||||||
"options": "LMS Batch"
|
"options": "LMS Batch"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-08-23 14:48:49.351395",
|
"modified": "2023-08-29 15:23:08.637215",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Certificate",
|
"name": "LMS Certificate",
|
||||||
@@ -81,6 +81,18 @@
|
|||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "Moderator",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -116,6 +116,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if is_moderator %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#students">
|
<a class="nav-link" data-toggle="tab" href="#students">
|
||||||
{{ _("Students") }}
|
{{ _("Students") }}
|
||||||
@@ -125,7 +126,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% if is_moderator %}
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#assessments">
|
<a class="nav-link" data-toggle="tab" href="#assessments">
|
||||||
{{ _("Assessments") }}
|
{{ _("Assessments") }}
|
||||||
@@ -175,11 +175,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if is_moderator %}
|
||||||
<div class="tab-pane" id="students" role="tabpanel" aria-labelledby="students">
|
<div class="tab-pane" id="students" role="tabpanel" aria-labelledby="students">
|
||||||
{{ StudentsSection(batch_info, batch_students) }}
|
{{ StudentsSection(batch_info, batch_students) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if is_moderator %}
|
|
||||||
<div class="tab-pane" id="assessments" role="tabpanel" aria-labelledby="assessments">
|
<div class="tab-pane" id="assessments" role="tabpanel" aria-labelledby="assessments">
|
||||||
{{ AssessmentsSection(batch_info) }}
|
{{ AssessmentsSection(batch_info) }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<a class="dark-links" href="/batches/{{ batch.name }}">
|
<a class="dark-links" href="/batches/{{ batch.name }}">
|
||||||
{{ batch.name }}
|
{{ batch.title }}
|
||||||
</a>
|
</a>
|
||||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<span class="breadcrumb-destination">
|
<span class="breadcrumb-destination">
|
||||||
@@ -46,6 +46,9 @@
|
|||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_moderator %}
|
{% 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}}">
|
<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") }}
|
{{ _("Evaluate") }}
|
||||||
</a>
|
</a>
|
||||||
@@ -86,5 +89,4 @@
|
|||||||
let courses = {{ courses | json }};
|
let courses = {{ courses | json }};
|
||||||
let batch_name = "{{ batch.name }}";
|
let batch_name = "{{ batch.name }}";
|
||||||
</script>
|
</script>
|
||||||
{{ include_script('controls.bundle.js') }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,5 +1,45 @@
|
|||||||
frappe.ready(() => {
|
frappe.ready(() => {
|
||||||
|
frappe.require("controls.bundle.js");
|
||||||
|
|
||||||
$(".clickable-row").click((e) => {
|
$(".clickable-row").click((e) => {
|
||||||
window.location.href = $(e.currentTarget).data("href");
|
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."))
|
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(
|
context.courses = frappe.get_all(
|
||||||
"Batch Course", {"parent": batch_name}, pluck="course"
|
"Batch Course", {"parent": batch_name}, pluck="course"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ def get_context(context):
|
|||||||
context.module = module
|
context.module = module
|
||||||
context.docname = docname
|
context.docname = docname
|
||||||
context.doctype = doctype
|
context.doctype = doctype
|
||||||
|
context.apply_gst = frappe.db.get_single_value("LMS Settings", "apply_gst")
|
||||||
|
|
||||||
if not frappe.db.exists(doctype, docname):
|
if not frappe.db.exists(doctype, docname):
|
||||||
raise ValueError(_("Module Name is incorrect or does not exist."))
|
raise ValueError(_("Module Name is incorrect or does not exist."))
|
||||||
@@ -65,3 +66,6 @@ def get_context(context):
|
|||||||
context.title = batch.title
|
context.title = batch.title
|
||||||
context.amount = batch.amount
|
context.amount = batch.amount
|
||||||
context.currency = batch.currency
|
context.currency = batch.currency
|
||||||
|
|
||||||
|
if context.apply_gst:
|
||||||
|
context.gst_amount = context.amount * 1.18
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
{{ _("Short Description") }}
|
{{ _("Short Description") }}
|
||||||
</div>
|
</div>
|
||||||
<div class="field-description">
|
<div class="field-description">
|
||||||
{{ _("A breif description about this chapter.") }}
|
{{ _("A brief description about this chapter.") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|||||||
Reference in New Issue
Block a user