diff --git a/lms/lms/doctype/lms_live_class/lms_live_class.py b/lms/lms/doctype/lms_live_class/lms_live_class.py index d3128104..37ca1994 100644 --- a/lms/lms/doctype/lms_live_class/lms_live_class.py +++ b/lms/lms/doctype/lms_live_class/lms_live_class.py @@ -3,6 +3,8 @@ import frappe from frappe.model.document import Document +from datetime import timedelta +from frappe.utils import cint, get_datetime class LMSLiveClass(Document): @@ -16,11 +18,14 @@ class LMSLiveClass(Document): self.add_event_participants(event, calendar) def create_event(self): + start = f"{self.date} {self.time}" + event = frappe.get_doc( { "doctype": "Event", - "subject": f"Live Class {self.title}", - "starts_on": f"{self.date} {self.time}", + "subject": f"Live Class on {self.title}", + "starts_on": start, + "ends_on": get_datetime(start) + timedelta(minutes=cint(self.duration)), } ) event.save() diff --git a/lms/public/css/style.css b/lms/public/css/style.css index d0658feb..0297ffcc 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -1993,10 +1993,19 @@ select { .lms-card { display: flex; flex-direction: column; - border-width: 1px; border-radius: 0.75rem; - border: 1px solid var(--gray-200); + /* border: 1px solid var(--gray-200); */ + box-shadow: var(--shadow-sm); padding: 1rem; height: 100%; position: relative; } + +.live-class-panel { + margin-top: auto; + display: none; +} + +.lms-card:hover + .live-class-panel { + display: block; +} diff --git a/lms/www/classes/class.html b/lms/www/classes/class.html index 9d9199ab..f7e4bf2c 100644 --- a/lms/www/classes/class.html +++ b/lms/www/classes/class.html @@ -253,11 +253,23 @@ {{ class.description }} - {% if class.owner == frappe.session.user and class.date == frappe.utils.getdate() %} - - {{ _("Start Class") }} - - {% endif %} +
+ {% if class.owner == frappe.session.user and class.date == frappe.utils.getdate() %} + + {{ _("Start") }} + + {% endif %} + + {% if class.owner == frappe.session.user %} + + {{ _("Edit") }} + + + + {{ _("Delete") }} + + {% endif %} +
{% if is_student and class.date == frappe.utils.getdate() %} diff --git a/lms/www/classes/class.js b/lms/www/classes/class.js index 192c3e2d..7b038376 100644 --- a/lms/www/classes/class.js +++ b/lms/www/classes/class.js @@ -107,7 +107,7 @@ const create_live_class = (e) => { ); setTimeout(function () { window.location.href = `/classes/${class_name}#live-class`; - }, 1000); + }, 2000); }, }); };