From f1f9d9790be3f4cbfd85ccec691964fb11beebfa Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 30 Nov 2023 11:51:36 +0530 Subject: [PATCH 1/2] feat: all day events --- lms/lms/doctype/lms_batch/lms_batch.js | 38 ++++++++++++++++++++++++++ lms/public/css/style.css | 4 +++ lms/www/batches/batch.js | 7 ++++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/lms/lms/doctype/lms_batch/lms_batch.js b/lms/lms/doctype/lms_batch/lms_batch.js index 9f6b23ab0..aae5bf791 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.js +++ b/lms/lms/doctype/lms_batch/lms_batch.js @@ -28,6 +28,10 @@ frappe.ui.form.on("LMS Batch", { }, }; }); + + if (frm.doc.timetable.length && !frm.doc.timetable_legends.length) { + set_default_legends(frm); + } }, timetable_template: function (frm) { @@ -127,3 +131,37 @@ const add_legend_rows = (frm, legends) => { frm.refresh_field("timetable_legends"); frm.save(); }; + +const set_default_legends = (frm) => { + const data = [ + { + reference_doctype: "Course Lesson", + label: "Lesson", + color: "#449CF0", + }, + { + reference_doctype: "LMS Quiz", + label: "LMS Quiz", + color: "#39E4A5", + }, + { + reference_doctype: "LMS Assignment", + label: "LMS Assignment", + color: "#ECAD4B", + }, + { + reference_doctype: "LMS Live Class", + label: "LMS Live Class", + color: "#bb8be8", + }, + ]; + + data.forEach((detail) => { + let child = frm.add_child("timetable_legends"); + child.reference_doctype = detail.reference_doctype; + child.label = detail.label; + child.color = detail.color; + }); + frm.refresh_field("timetable_legends"); + frm.save(); +}; diff --git a/lms/public/css/style.css b/lms/public/css/style.css index c6c9e99de..eb82e49dc 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -2482,4 +2482,8 @@ select { .text-color { color: var(--text-color); +} + +.toastui-calendar-weekday-event-block { + box-shadow: none !important; } \ No newline at end of file diff --git a/lms/www/batches/batch.js b/lms/www/batches/batch.js index 406dfaa59..9a71e5e63 100644 --- a/lms/www/batches/batch.js +++ b/lms/www/batches/batch.js @@ -694,7 +694,11 @@ const get_calendar_options = (element, calendar_id) => { template: { time: function (event) { let hide = event.raw.completed ? "" : "hide"; - return `
+ return `
${frappe.datetime.get_time(event.start.d.d)} - ${frappe.datetime.get_time(event.end.d.d)}
@@ -739,6 +743,7 @@ const create_events = (calendar, events, calendar_id) => { }; const format_time = (time) => { + if (!time) return "00:00:00"; let time_arr = time.split(":"); if (time_arr[0] < 10) time_arr[0] = "0" + time_arr[0]; return time_arr.join(":"); From 9b532a5470429582dbb65878ec65cc8ff9607214 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 30 Nov 2023 12:02:43 +0530 Subject: [PATCH 2/2] fix: editing evaluation end date from lms portal --- lms/www/batches/batch_details.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/www/batches/batch_details.py b/lms/www/batches/batch_details.py index a4f4db4f3..875dd8877 100644 --- a/lms/www/batches/batch_details.py +++ b/lms/www/batches/batch_details.py @@ -33,6 +33,7 @@ def get_context(context): "published", "meta_image", "batch_details_raw", + "evaluation_end_date", ], as_dict=1, )