fix: link student emails to batch

This commit is contained in:
Jannat Patel
2023-10-23 19:11:36 +05:30
parent affd2b47bd
commit a707095fae
2 changed files with 25 additions and 14 deletions

View File

@@ -798,11 +798,33 @@ const email_to_students = () => {
const send_email = (values) => {
frappe.call({
method: "lms.lms.doctype.lms_batch.lms_batch.send_email_to_students",
method: "frappe.client.get_list",
args: {
batch: $(".class-details").data("batch"),
doctype: "Batch Student",
parent: "LMS Batch",
fields: ["student"],
filters: {
parent: $(".class-details").data("batch"),
},
},
callback: (data) => {
send_email_to_students(data.message, values);
},
});
};
const send_email_to_students = (students, values) => {
students = students.map((row) => row.student);
frappe.call({
method: "frappe.core.doctype.communication.email.make",
args: {
recipients: students.join(", "),
cc: values.reply_to,
subject: values.subject,
message: values.message,
content: values.message,
doctype: "LMS Batch",
name: $(".class-details").data("batch"),
send_email: 1,
},
callback: (r) => {
this.email_dialog.hide();