feat: all day events

This commit is contained in:
Jannat Patel
2023-11-30 11:51:36 +05:30
parent 96190910a7
commit f1f9d9790b
3 changed files with 48 additions and 1 deletions

View File

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