feat:evaluation end date from lms portal

This commit is contained in:
Jannat Patel
2023-11-29 18:01:44 +05:30
parent eef5bd6062
commit 6f1e7624ec
2 changed files with 32 additions and 16 deletions

View File

@@ -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()

View File

@@ -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",
},