feat: assignment submission and ui

This commit is contained in:
Jannat Patel
2022-11-18 17:05:38 +05:30
parent a4ec058a81
commit 74210245cf
25 changed files with 284 additions and 134 deletions

View File

@@ -1,5 +1,4 @@
frappe.ready(() => {
$("#submit-student").click((e) => {
submit_student(e);
});
@@ -11,57 +10,61 @@ frappe.ready(() => {
$(".class-course").click((e) => {
update_course(e);
});
});
const submit_student = (e) => {
e.preventDefault();
frappe.call({
method: "lms.lms.doctype.lms_class.lms_class.add_student",
args: {
"email": $("#student-email").val(),
"class_name": $(".class-details").data("class")
email: $("#student-email").val(),
class_name: $(".class-details").data("class"),
},
callback: (data) => {
frappe.show_alert({
frappe.show_alert(
{
message: __("Student added successfully"),
indicator: "green",
} ,3);
},
3
);
window.location.reload();
}
})
},
});
};
const remove_student = (e) => {
frappe.confirm("Are you sure you want to remove this student from the class?",
() => {
frappe.call({
method: "lms.lms.doctype.lms_class.lms_class.remove_student",
args: {
"student": $(e.currentTarget).data("student"),
"class_name": $(".class-details").data("class")
},
callback: (data) => {
frappe.show_alert({
message: __("Student removed successfully"),
indicator: "green",
}, 3);
window.location.reload();
}
});
})
}
frappe.confirm(
"Are you sure you want to remove this student from the class?",
() => {
frappe.call({
method: "lms.lms.doctype.lms_class.lms_class.remove_student",
args: {
student: $(e.currentTarget).data("student"),
class_name: $(".class-details").data("class"),
},
callback: (data) => {
frappe.show_alert(
{
message: __("Student removed successfully"),
indicator: "green",
},
3
);
window.location.reload();
},
});
}
);
};
const update_course = (e) => {
frappe.call({
method: "lms.lms.doctype.lms_class.lms_class.update_course",
args: {
"course": $(e.currentTarget).data("course"),
"value": $(e.currentTarget).children("input").prop("checked") ? 1 : 0,
"class_name": $(".class-details").data("class")
}
})
course: $(e.currentTarget).data("course"),
value: $(e.currentTarget).children("input").prop("checked") ? 1 : 0,
class_name: $(".class-details").data("class"),
},
});
};