From 9c2bebb3d921453e9aa9e57dd055c03b72c1b490 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 21 Jun 2024 13:08:58 +0530 Subject: [PATCH 1/2] feat: timezone in batches --- frontend/src/components/BatchCard.vue | 10 ++- frontend/src/components/BatchOverlay.vue | 10 ++- frontend/src/pages/Batch.vue | 9 ++- frontend/src/pages/BatchCreation.vue | 70 +++++++++++++++---- lms/lms/doctype/lms_batch/lms_batch.json | 13 +++- .../certificate_request_creation.html | 2 +- .../certificate_request_reminder.html | 2 +- .../certificate_request_reminder.json | 6 +- lms/lms/utils.py | 1 + lms/public/frontend/index.html | 2 +- lms/www/lms.py | 8 +++ 11 files changed, 104 insertions(+), 29 deletions(-) diff --git a/frontend/src/components/BatchCard.vue b/frontend/src/components/BatchCard.vue index f5525858..f187d0b2 100644 --- a/frontend/src/components/BatchCard.vue +++ b/frontend/src/components/BatchCard.vue @@ -36,19 +36,25 @@ :endDate="batch.end_date" class="mb-3" /> -
+
{{ formatTime(batch.start_time) }} - {{ formatTime(batch.end_time) }}
+
+ + + {{ batch.timezone }} + +
+ diff --git a/lms/www/lms.py b/lms/www/lms.py index 4f92c88f..6a75ce06 100644 --- a/lms/www/lms.py +++ b/lms/www/lms.py @@ -82,6 +82,14 @@ def get_meta(app_path): if re.match(r"^batches/.*$", app_path): batch_name = app_path.split("/")[1] + if "new/edit" in app_path: + return { + "title": _("New Batch"), + "image": frappe.db.get_single_value("Website Settings", "banner_image"), + "description": "Create a new batch", + "keywords": "New Batch, Create Batch", + "link": "/lms/batches/new/edit", + } batch = frappe.db.get_value( "LMS Batch", batch_name, From 4f2dd7654cdaddaf1a50c55307e1deb0485b154d Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 21 Jun 2024 13:17:54 +0530 Subject: [PATCH 2/2] fix: notification template for timezone --- .../certificate_request_creation.html | 4 +++- .../certificate_request_creation.json | 7 +++++-- .../certificate_request_reminder.html | 4 +++- .../certificate_request_reminder.json | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lms/lms/notification/certificate_request_creation/certificate_request_creation.html b/lms/lms/notification/certificate_request_creation/certificate_request_creation.html index 117742c7..23aad496 100644 --- a/lms/lms/notification/certificate_request_creation/certificate_request_creation.html +++ b/lms/lms/notification/certificate_request_creation/certificate_request_creation.html @@ -1,5 +1,7 @@ {% set title = frappe.db.get_value("LMS Course", doc.course, "title") %} +{% set timezone = frappe.db.get_value("LMS Batch", doc.batch, "timezone") %} +{% set timezone = timezone if timezone else '' %}

{{ _("Hey {0}").format(doc.member_name) }}

-

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, "medium"), frappe.utils.format_time(doc.start_time, "short")) }}, doc.timezone

+

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, "medium"), frappe.utils.format_time(doc.start_time, "short"), timezone) }}

{{ _("Please prepare well and be on time for the evaluations.") }}

diff --git a/lms/lms/notification/certificate_request_creation/certificate_request_creation.json b/lms/lms/notification/certificate_request_creation/certificate_request_creation.json index 8a4302d6..172fe82a 100644 --- a/lms/lms/notification/certificate_request_creation/certificate_request_creation.json +++ b/lms/lms/notification/certificate_request_creation/certificate_request_creation.json @@ -10,9 +10,9 @@ "event": "New", "idx": 0, "is_standard": 1, - "message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n

{{ _(\"Hey {0}\").format(doc.member_name) }}

\n

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}

\n

{{ _(\"Please prepare well and be on time for the evaluations.\") }}

\n", + "message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n{% set timezone = frappe.db.get_value(\"LMS Batch\", doc.batch, \"timezone\") %}\n{% set timezone = timezone if timezone else '' %}\n\n

{{ _(\"Hey {0}\").format(doc.member_name) }}

\n

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\"), timezone) }}

\n

{{ _(\"Please prepare well and be on time for the evaluations.\") }}

\n", "message_type": "HTML", - "modified": "2023-11-29 17:34:54.514031", + "modified": "2024-06-21 13:15:38.588768", "modified_by": "Administrator", "module": "LMS", "name": "Certificate Request Creation", @@ -23,6 +23,9 @@ }, { "receiver_by_document_field": "evaluator" + }, + { + "receiver_by_role": "Frappe School Admin" } ], "send_system_notification": 0, diff --git a/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.html b/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.html index d04a26c6..ba0e048f 100644 --- a/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.html +++ b/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.html @@ -1,5 +1,7 @@ {% set title = frappe.db.get_value("LMS Course", doc.course, "title") %} +{% set timezone = frappe.db.get_value("LMS Batch", doc.batch, "timezone") %} +{% set timezone = timezone if timezone else '' %} -

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, "medium"), frappe.utils.format_time(doc.start_time, "short")) }}, doc.timezone

+

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, "medium"), frappe.utils.format_time(doc.start_time, "short"), timezone) }}

{{ _("Please prepare well and be on time for the evaluations.") }}

diff --git a/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.json b/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.json index 6e886a10..aa807f0b 100644 --- a/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.json +++ b/lms/lms/notification/certificate_request_reminder/certificate_request_reminder.json @@ -11,9 +11,9 @@ "event": "Days Before", "idx": 0, "is_standard": 1, - "message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}, doc.timezone

\n\n

{{ _(\"Please prepare well and be on time for the evaluations.\") }}

\n", + "message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n{% set timezone = frappe.db.get_value(\"LMS Batch\", doc.batch, \"timezone\") %}\n{% set timezone = timezone if timezone else '' %}\n\n

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\"), timezone) }}

\n\n

{{ _(\"Please prepare well and be on time for the evaluations.\") }}

\n", "message_type": "HTML", - "modified": "2024-06-21 12:59:05.980527", + "modified": "2024-06-21 13:17:26.360030", "modified_by": "Administrator", "module": "LMS", "name": "Certificate Request Reminder",