feat: self enrollment in batches
This commit is contained in:
@@ -146,6 +146,10 @@
|
||||
href="/billing/batch/{{ batch_info.name }}">
|
||||
{{ _("Register Now") }}
|
||||
</a>
|
||||
{% elif batch_info.allow_self_enrollment %}
|
||||
<button class="btn btn-primary wide-button enroll-batch">
|
||||
{{ _("Enroll Now") }}
|
||||
</button>
|
||||
{% else %}
|
||||
<div class="alert alert-info">
|
||||
{{ _("To join this batch, please contact the Administrator.") }}
|
||||
|
||||
@@ -12,6 +12,10 @@ frappe.ready(() => {
|
||||
$(".btn-remove-course").click((e) => {
|
||||
remove_course(e);
|
||||
});
|
||||
|
||||
$(".enroll-batch").click((e) => {
|
||||
enroll_batch(e);
|
||||
});
|
||||
});
|
||||
|
||||
const show_course_modal = (e) => {
|
||||
@@ -54,6 +58,26 @@ const show_course_modal = (e) => {
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const enroll_batch = (e) => {
|
||||
let batch_name = $(".class-details").data("batch");
|
||||
frappe.call({
|
||||
method: "lms.lms.doctype.batch_student.batch_student.enroll_batch",
|
||||
args: {
|
||||
batch_name: batch_name,
|
||||
},
|
||||
callback(r) {
|
||||
frappe.show_alert(
|
||||
{
|
||||
message: __("Successfully Enrolled"),
|
||||
indicator: "green",
|
||||
},
|
||||
2000
|
||||
);
|
||||
window.location.href = `/batches/${batch_name}`;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const add_course = (values, course_name) => {
|
||||
frappe.call({
|
||||
method: "lms.lms.doctype.lms_batch.lms_batch.add_course",
|
||||
|
||||
@@ -35,6 +35,7 @@ def get_context(context):
|
||||
"batch_details_raw",
|
||||
"evaluation_end_date",
|
||||
"amount_usd",
|
||||
"allow_self_enrollment",
|
||||
],
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user