diff --git a/lms/lms/doctype/lms_batch/lms_batch.py b/lms/lms/doctype/lms_batch/lms_batch.py index 9f96d4cd..857df297 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.py +++ b/lms/lms/doctype/lms_batch/lms_batch.py @@ -29,6 +29,7 @@ class LMSBatch(Document): self.validate_membership() self.validate_timetable() self.send_confirmation_mail() + self.validate_evaluation_end_date() def validate_duplicate_students(self): students = [row.student for row in self.students] @@ -68,6 +69,10 @@ class LMSBatch(Document): self.send_mail(student) student.confirmation_email_sent = 1 + def validate_evaluation_end_date(self): + if self.evaluation_end_date and self.evaluation_end_date < self.end_date: + frappe.throw(_("Evaluation end date cannot be less than the batch end date.")) + def send_mail(self, student): subject = _("Enrollment Confirmation for the Next Training Batch") template = "batch_confirmation" @@ -253,6 +258,7 @@ def create_batch( currency=None, name=None, published=0, + evaluation_end_date=None, ): frappe.only_for("Moderator") if name: @@ -278,6 +284,7 @@ def create_batch( "amount": amount, "currency": currency, "published": published, + "evaluation_end_date": evaluation_end_date, } ) doc.save() diff --git a/lms/public/js/common_functions.js b/lms/public/js/common_functions.js index 88a86e28..48559002 100644 --- a/lms/public/js/common_functions.js +++ b/lms/public/js/common_functions.js @@ -267,15 +267,6 @@ const open_batch_dialog = () => { fieldname: "published", default: batch_info && batch_info.published, }, - { - fieldtype: "Column Break", - }, - { - fieldtype: "Int", - label: __("Seat Count"), - fieldname: "seat_count", - default: batch_info && batch_info.seat_count, - }, { fieldtype: "Section Break", }, @@ -293,13 +284,6 @@ const open_batch_dialog = () => { reqd: 1, default: batch_info && batch_info.end_date, }, - { - fieldtype: "Select", - label: __("Medium"), - fieldname: "medium", - options: ["Online", "Offline"], - default: (batch_info && batch_info.medium) || "Online", - }, { fieldtype: "Column Break", }, @@ -317,6 +301,16 @@ const open_batch_dialog = () => { default: batch_info && batch_info.end_time, reqd: 1, }, + { + fieldtype: "Section Break", + }, + { + fieldtype: "Select", + label: __("Medium"), + fieldname: "medium", + options: ["Online", "Offline"], + default: (batch_info && batch_info.medium) || "Online", + }, { fieldtype: "Link", label: __("Category"), @@ -325,6 +319,21 @@ const open_batch_dialog = () => { only_select: 1, default: batch_info && batch_info.category, }, + { + fieldtype: "Column Break", + }, + { + fieldtype: "Int", + label: __("Seat Count"), + fieldname: "seat_count", + default: batch_info && batch_info.seat_count, + }, + { + fieldtype: "Date", + label: __("Evaluation End Date"), + fieldname: "evaluation_end_date", + default: batch_info && batch_info.evaluation_end_date, + }, { fieldtype: "Section Break", },