feat: live class list display
This commit is contained in:
@@ -120,6 +120,9 @@ def create_live_class(class_name, title, duration, date, time, description=None)
|
|||||||
"host": frappe.session.user,
|
"host": frappe.session.user,
|
||||||
"date": date,
|
"date": date,
|
||||||
"time": time,
|
"time": time,
|
||||||
|
"class": class_name,
|
||||||
|
"password": data.get("password"),
|
||||||
|
"description": description,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
class_details = frappe.get_doc(payload)
|
class_details = frappe.get_doc(payload)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
"date",
|
"date",
|
||||||
"timezone",
|
"timezone",
|
||||||
"column_break_spvt",
|
"column_break_spvt",
|
||||||
"start_time",
|
"time",
|
||||||
"duration",
|
"duration",
|
||||||
"section_break_yrpq",
|
"section_break_yrpq",
|
||||||
"start_url",
|
"start_url",
|
||||||
@@ -44,12 +44,6 @@
|
|||||||
"label": "Date",
|
"label": "Date",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "start_time",
|
|
||||||
"fieldtype": "Time",
|
|
||||||
"label": "Start Time",
|
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "duration",
|
"fieldname": "duration",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
@@ -114,11 +108,17 @@
|
|||||||
"fieldname": "password",
|
"fieldname": "password",
|
||||||
"fieldtype": "Password",
|
"fieldtype": "Password",
|
||||||
"label": "Password"
|
"label": "Password"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "time",
|
||||||
|
"fieldtype": "Time",
|
||||||
|
"label": "Time",
|
||||||
|
"reqd": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-03-02 17:47:07.807968",
|
"modified": "2023-03-02 23:00:33.006661",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Live Class",
|
"name": "LMS Live Class",
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane" id="live-class" role="tabpanel" aria-labelledby="live-class">
|
<div class="tab-pane" id="live-class" role="tabpanel" aria-labelledby="live-class">
|
||||||
{{ LiveClassSection(class_info) }}
|
{{ LiveClassSection(class_info, live_classes) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -188,40 +188,65 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
{% macro LiveClassSection(class_info) %}
|
{% macro LiveClassSection(class_info, live_classes) %}
|
||||||
<div>
|
<div>
|
||||||
{% if is_moderator %}
|
{% if is_moderator %}
|
||||||
<button class="btn btn-secondary btn-sm" id="open-class-modal">
|
{{ CreateLiveClass(class_info) }}
|
||||||
{{ _("Create a Live Class") }}
|
{% endif %}
|
||||||
</button>
|
{{ LiveClassList(class_info, live_classes) }}
|
||||||
|
</div>
|
||||||
<div class="modal fade live-class-modal" id="live-class-modal" tabindex="-1" role="dialog">
|
{% endmacro %}
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<div class="modal-title">{{ _("Live Class Details") }}</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="modal-body">
|
{% macro CreateLiveClass(class_info) %}
|
||||||
<form class="live-class-form" id="live-class-form"></form>
|
<button class="btn btn-secondary btn-sm" id="open-class-modal">
|
||||||
</div>
|
{{ _("Create a Live Class") }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="modal fade live-class-modal" id="live-class-modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="modal-title">{{ _("Live Class Details") }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-body">
|
||||||
<button class="btn btn-secondary btn-sm mr-2" data-dismiss="modal" aria-label="Close">
|
<form class="live-class-form" id="live-class-form"></form>
|
||||||
{{ _("Discard") }}
|
</div>
|
||||||
</button>
|
|
||||||
|
|
||||||
<button class="btn btn-primary btn-sm" id="create-live-class">
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-secondary btn-sm mr-2" data-dismiss="modal" aria-label="Close">
|
||||||
|
{{ _("Discard") }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="btn btn-primary btn-sm" id="create-live-class">
|
||||||
{{ _("Submit") }}
|
{{ _("Submit") }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
{% macro LiveClassList(class_info, live_classes) %}
|
||||||
|
<div class="cards-parent mt-5">
|
||||||
|
{% for class in live_classes %}
|
||||||
|
<div class="common-card-style column-card">
|
||||||
|
<div class="course-card-title">
|
||||||
|
{{ class.title }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ class.description }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ frappe.utils.format_date(class.date, "medium") }} {{ _("at") }}
|
||||||
|
{{ frappe.utils.format_time(class.time, "hh:mm a") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ const make_live_class_form = (e) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: "meeting_time",
|
fieldname: "meeting_time",
|
||||||
fieldtype: "Datetime",
|
fieldtype: "Time",
|
||||||
options: "",
|
options: "",
|
||||||
label: "Date and Time",
|
label: "Time",
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ def get_context(context):
|
|||||||
"Class Student", {"parent": class_name}, ["student", "student_name", "username"]
|
"Class Student", {"parent": class_name}, ["student", "student_name", "username"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
context.is_moderator = has_course_moderator_role()
|
||||||
|
|
||||||
|
context.live_classes = frappe.get_all(
|
||||||
|
"LMS Live Class",
|
||||||
|
{"class": class_name},
|
||||||
|
["title", "description", "time", "date", "start_url", "join_url"],
|
||||||
|
)
|
||||||
|
|
||||||
for student in class_students:
|
for student in class_students:
|
||||||
if student.student == frappe.session.user:
|
if student.student == frappe.session.user:
|
||||||
session_user.append(student)
|
session_user.append(student)
|
||||||
@@ -38,5 +46,3 @@ def get_context(context):
|
|||||||
context.class_students = session_user + remaining_students
|
context.class_students = session_user + remaining_students
|
||||||
else:
|
else:
|
||||||
context.class_students = class_students
|
context.class_students = class_students
|
||||||
|
|
||||||
context.is_moderator = has_course_moderator_role()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user