Merge branch 'main' of https://github.com/frappe/lms into lms-frappe-ui
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
"portal_course_creation",
|
"portal_course_creation",
|
||||||
"section_break_szgq",
|
"section_break_szgq",
|
||||||
"send_calendar_invite_for_evaluations",
|
"send_calendar_invite_for_evaluations",
|
||||||
|
"show_day_view",
|
||||||
"allow_student_progress",
|
"allow_student_progress",
|
||||||
"column_break_2",
|
"column_break_2",
|
||||||
"show_dashboard",
|
"show_dashboard",
|
||||||
@@ -341,12 +342,18 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break_uwsp",
|
"fieldname": "column_break_uwsp",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "show_day_view",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Show Day View in Timetable"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-11-07 11:23:14.257687",
|
"modified": "2023-12-12 10:32:13.638368",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
@@ -2387,6 +2387,7 @@ select {
|
|||||||
border: 1px solid var(--gray-200) !important;
|
border: 1px solid var(--gray-200) !important;
|
||||||
border-radius: var(--border-radius-md) !important;
|
border-radius: var(--border-radius-md) !important;
|
||||||
background-color: var(--gray-100) !important;
|
background-color: var(--gray-100) !important;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toastui-calendar-panel .toastui-calendar-day-names.toastui-calendar-week {
|
.toastui-calendar-panel .toastui-calendar-day-names.toastui-calendar-week {
|
||||||
@@ -2442,13 +2443,23 @@ select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.calendar-legends {
|
.calendar-legends {
|
||||||
display: flex;
|
display: grid;
|
||||||
align-items: center;
|
grid-template-columns: repeat(4, 1fr);
|
||||||
justify-content: space-between;
|
width: 75%;
|
||||||
width: 50%;
|
|
||||||
margin: 0 auto 1rem;
|
margin: 0 auto 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.calendar-legends {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-item {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.batch-details {
|
.batch-details {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin: 2rem 0;
|
margin: 2rem 0;
|
||||||
|
|||||||
@@ -638,8 +638,10 @@
|
|||||||
frappe.boot.single_types = []
|
frappe.boot.single_types = []
|
||||||
let courses = {{ course_list | json }};
|
let courses = {{ course_list | json }};
|
||||||
const legends = {{ legends | json }};
|
const legends = {{ legends | json }};
|
||||||
const allow_future = {{ batch_info.allow_future }}
|
const allow_future = {{ batch_info.allow_future }};
|
||||||
|
const is_student = "{{ is_student or '' }}";
|
||||||
const evaluation_end_date = "{{ batch_info.evaluation_end_date if batch_info.evaluation_end_date else '' }}"
|
const evaluation_end_date = "{{ batch_info.evaluation_end_date if batch_info.evaluation_end_date else '' }}"
|
||||||
|
const show_day_view = {{ settings.show_day_view }};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
|
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ const get_calendar_options = (element, calendar_id) => {
|
|||||||
const end_time = element.data("end");
|
const end_time = element.data("end");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
defaultView: "week",
|
defaultView: $(window).width() < 768 || show_day_view ? "day" : "week",
|
||||||
usageStatistics: false,
|
usageStatistics: false,
|
||||||
week: {
|
week: {
|
||||||
narrowWeekend: true,
|
narrowWeekend: true,
|
||||||
@@ -692,6 +692,17 @@ const get_calendar_options = (element, calendar_id) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
template: {
|
template: {
|
||||||
|
allday: function (event) {
|
||||||
|
let hide = event.raw.completed ? "" : "hide";
|
||||||
|
return `<div class="calendar-event-time" title="${
|
||||||
|
event.title
|
||||||
|
} - ${frappe.datetime.get_time(
|
||||||
|
event.start.d.d
|
||||||
|
)} - ${frappe.datetime.get_time(event.end.d.d)}">
|
||||||
|
<img class='icon icon-sm pull-right ${hide}' src="/assets/lms/icons/check.svg">
|
||||||
|
<div class="calendar-event-title"> ${event.title} </div>
|
||||||
|
</div>`;
|
||||||
|
},
|
||||||
time: function (event) {
|
time: function (event) {
|
||||||
let hide = event.raw.completed ? "" : "hide";
|
let hide = event.raw.completed ? "" : "hide";
|
||||||
return `<div class="calendar-event-time" title="${
|
return `<div class="calendar-event-time" title="${
|
||||||
@@ -720,6 +731,7 @@ const create_events = (calendar, events, calendar_id) => {
|
|||||||
start: `${event.date}T${format_time(event.start_time)}`,
|
start: `${event.date}T${format_time(event.start_time)}`,
|
||||||
end: `${event.date}T${format_time(event.end_time)}`,
|
end: `${event.date}T${format_time(event.end_time)}`,
|
||||||
isAllday: event.start_time ? false : true,
|
isAllday: event.start_time ? false : true,
|
||||||
|
category: event.start_time ? "time" : "allday",
|
||||||
borderColor: clr,
|
borderColor: clr,
|
||||||
backgroundColor: "var(--fg-color)",
|
backgroundColor: "var(--fg-color)",
|
||||||
customStyle: {
|
customStyle: {
|
||||||
@@ -753,13 +765,16 @@ const add_links_to_events = (calendar) => {
|
|||||||
calendar.on("clickEvent", ({ event }) => {
|
calendar.on("clickEvent", ({ event }) => {
|
||||||
let event_date = event.start.d.d;
|
let event_date = event.start.d.d;
|
||||||
event_date = moment(event_date).format("YYYY-MM-DD");
|
event_date = moment(event_date).format("YYYY-MM-DD");
|
||||||
|
|
||||||
let current_date = moment().format("YYYY-MM-DD");
|
let current_date = moment().format("YYYY-MM-DD");
|
||||||
|
|
||||||
if (!moment(event_date).isSameOrBefore(current_date) && !allow_future)
|
if (
|
||||||
|
is_student &&
|
||||||
|
!moment(event_date).isSameOrBefore(current_date) &&
|
||||||
|
!allow_future
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.raw.milestone) {
|
if (is_student && event.raw.milestone) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "lms.lms.doctype.lms_batch.lms_batch.is_milestone_complete",
|
method: "lms.lms.doctype.lms_batch.lms_batch.is_milestone_complete",
|
||||||
args: {
|
args: {
|
||||||
@@ -783,29 +798,49 @@ const add_links_to_events = (calendar) => {
|
|||||||
const scroll_to_date = (calendar, events) => {
|
const scroll_to_date = (calendar, events) => {
|
||||||
if (
|
if (
|
||||||
new Date() < new Date(events[0].date) ||
|
new Date() < new Date(events[0].date) ||
|
||||||
new Date() > new Date(events.slice(-1).date)
|
new Date() > new Date(events.slice(-1)[0].date)
|
||||||
) {
|
) {
|
||||||
calendar.setDate(new Date(events[0].date));
|
calendar.setDate(new Date(events[0].date));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const set_calendar_range = (calendar, events) => {
|
const set_calendar_range = (calendar, events) => {
|
||||||
let week_start = moment(calendar.getDateRangeStart().d.d);
|
let day_view = $(window).width() < 768 || show_day_view ? true : false;
|
||||||
let week_end = moment(calendar.getDateRangeEnd().d.d);
|
if (day_view) {
|
||||||
|
let calendar_date = moment(calendar.getDate().d.d).format(
|
||||||
|
"DD MMMM YYYY"
|
||||||
|
);
|
||||||
|
$(".calendar-range").text(`${calendar_date}`);
|
||||||
|
|
||||||
$(".calendar-range").text(
|
if (moment(events[0].date).isSameOrBefore(moment(calendar)))
|
||||||
`${moment(week_start).format("DD MMMM YYYY")} - ${moment(
|
$("#prev-week").hide();
|
||||||
week_end
|
else $("#prev-week").show();
|
||||||
).format("DD MMMM YYYY")}`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (week_start.diff(moment(events[0].date), "days") <= 0)
|
if (
|
||||||
$("#prev-week").hide();
|
moment(calendar_date).isSameOrAfter(
|
||||||
else $("#prev-week").show();
|
moment(events.slice(-1)[0].date)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
$("#next-week").hide();
|
||||||
|
else $("#next-week").show();
|
||||||
|
} else {
|
||||||
|
let week_start = moment(calendar.getDateRangeStart().d.d);
|
||||||
|
let week_end = moment(calendar.getDateRangeEnd().d.d);
|
||||||
|
|
||||||
if (week_end.diff(moment(events.slice(-1)[0].date), "days") > 0)
|
$(".calendar-range").text(
|
||||||
$("#next-week").hide();
|
`${moment(week_start).format("DD MMMM YYYY")} - ${moment(
|
||||||
else $("#next-week").show();
|
week_end
|
||||||
|
).format("DD MMMM YYYY")}`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (week_start.diff(moment(events[0].date), "days") <= 0)
|
||||||
|
$("#prev-week").hide();
|
||||||
|
else $("#prev-week").show();
|
||||||
|
|
||||||
|
if (week_end.diff(moment(events.slice(-1)[0].date), "days") > 0)
|
||||||
|
$("#next-week").hide();
|
||||||
|
else $("#next-week").show();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const get_background_color = (doctype) => {
|
const get_background_color = (doctype) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user