From fa14ffdcbaedc8e3de6a53d7a02396dc5a93b06b Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 17 Feb 2025 18:17:50 +0530 Subject: [PATCH] feat: batch specific email templates --- frontend/src/pages/BatchForm.vue | 95 +++++++++++-------- lms/lms/doctype/lms_batch/lms_batch.json | 21 ++-- .../lms_batch_enrollment.py | 11 ++- 3 files changed, 76 insertions(+), 51 deletions(-) diff --git a/frontend/src/pages/BatchForm.vue b/frontend/src/pages/BatchForm.vue index a1632386..e06579cc 100644 --- a/frontend/src/pages/BatchForm.vue +++ b/frontend/src/pages/BatchForm.vue @@ -13,15 +13,14 @@
{{ __('Details') }}
-
-
- -
-
+
+ +
-
- -
- - -
-
-
+ +
{{ __('Date and Time') }}
@@ -133,6 +110,14 @@ class="mb-4" :required="true" /> +
-
-
+ +
{{ __('Settings') }}
@@ -179,6 +157,11 @@ type="date" class="mb-4" /> +
+ +
+
+ {{ __('Description') }} +
+ +
+ + +
+
@@ -278,6 +288,7 @@ const batch = reactive({ end_time: '', timezone: '', evaluation_end_date: '', + confirmation_email_template: '', seat_count: '', medium: '', category: '', diff --git a/lms/lms/doctype/lms_batch/lms_batch.json b/lms/lms/doctype/lms_batch/lms_batch.json index eb450285..c4de7840 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.json +++ b/lms/lms/doctype/lms_batch/lms_batch.json @@ -17,16 +17,17 @@ "start_time", "end_time", "timezone", - "section_break_rgfj", - "medium", - "category", - "column_break_flwy", - "seat_count", - "evaluation_end_date", "section_break_6", "description", "column_break_hlqw", "instructors", + "section_break_rgfj", + "medium", + "category", + "confirmation_email_template", + "column_break_flwy", + "seat_count", + "evaluation_end_date", "meta_image", "section_break_khcn", "batch_details", @@ -318,6 +319,12 @@ { "fieldname": "section_break_khcn", "fieldtype": "Section Break" + }, + { + "fieldname": "confirmation_email_template", + "fieldtype": "Link", + "label": "Confirmation Email Template", + "options": "Email Template" } ], "index_web_pages_for_search": 1, @@ -335,7 +342,7 @@ "link_fieldname": "batch_name" } ], - "modified": "2025-02-12 11:59:35.312487", + "modified": "2025-02-17 17:48:12.949392", "modified_by": "Administrator", "module": "LMS", "name": "LMS Batch", diff --git a/lms/lms/doctype/lms_batch_enrollment/lms_batch_enrollment.py b/lms/lms/doctype/lms_batch_enrollment/lms_batch_enrollment.py index 8fd3124c..8de7715e 100644 --- a/lms/lms/doctype/lms_batch_enrollment/lms_batch_enrollment.py +++ b/lms/lms/doctype/lms_batch_enrollment/lms_batch_enrollment.py @@ -79,13 +79,20 @@ def send_mail(doc): batch = frappe.db.get_value( "LMS Batch", doc.batch, - ["name", "title", "start_date", "start_time", "medium"], + [ + "name", + "title", + "start_date", + "start_time", + "medium", + "confirmation_email_template", + ], as_dict=1, ) subject = _("Enrollment Confirmation for {0}").format(batch.title) template = "batch_confirmation" - custom_template = frappe.db.get_single_value( + custom_template = batch.confirmation_email_template or frappe.db.get_single_value( "LMS Settings", "batch_confirmation_template" )