fix: batch ui and ux
This commit is contained in:
@@ -48,7 +48,7 @@ You can create courses and lessons through simple forms. Lessons can be in the f
|
|||||||
- Add detailed descriptions and preview videos to the course. 🎬
|
- Add detailed descriptions and preview videos to the course. 🎬
|
||||||
- Add videos, quizzes, and assignments to your lessons and make them interesting and interactive 📝
|
- Add videos, quizzes, and assignments to your lessons and make them interesting and interactive 📝
|
||||||
- Discussions section below each lesson where instructors and students can interact with each other. 💬
|
- Discussions section below each lesson where instructors and students can interact with each other. 💬
|
||||||
- Create classes to group your students based on courses and track their progress 🏛
|
- Create batches to group your students based on courses and track their progress 🏛
|
||||||
- Statistics dashboard that provides all important numbers at a glimpse. 📈
|
- Statistics dashboard that provides all important numbers at a glimpse. 📈
|
||||||
- Job Board where users can post and look for jobs. 💼
|
- Job Board where users can post and look for jobs. 💼
|
||||||
- People directory with each person's profile page 👨👩👧👦
|
- People directory with each person's profile page 👨👩👧👦
|
||||||
|
|||||||
@@ -196,6 +196,10 @@ website_route_rules = [
|
|||||||
"from_route": "/batches/details/<batchname>",
|
"from_route": "/batches/details/<batchname>",
|
||||||
"to_route": "batches/batch_details",
|
"to_route": "batches/batch_details",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"from_route": "/certified-participants",
|
||||||
|
"to_route": "certified_participants/certified_participants",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
website_redirects = [
|
website_redirects = [
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def add_pages_to_nav():
|
|||||||
pages = [
|
pages = [
|
||||||
{"label": "Explore", "idx": 1},
|
{"label": "Explore", "idx": 1},
|
||||||
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
|
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
|
||||||
{"label": "Classes", "url": "/classes", "parent": "Explore", "idx": 3},
|
{"label": "Batches", "url": "/batches", "parent": "Explore", "idx": 3},
|
||||||
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
|
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
|
||||||
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5},
|
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5},
|
||||||
{"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
|
{"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class CourseEvaluator(Document):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_schedule(course, date, class_name=None):
|
def get_schedule(course, date, batch=None):
|
||||||
evaluator = get_evaluator(course, class_name)
|
evaluator = get_evaluator(course, batch)
|
||||||
|
|
||||||
all_slots = frappe.get_all(
|
all_slots = frappe.get_all(
|
||||||
"Evaluator Schedule",
|
"Evaluator Schedule",
|
||||||
|
|||||||
@@ -238,3 +238,25 @@ def fetch_lessons(courses):
|
|||||||
lessons.extend(get_lessons(course.get("course")))
|
lessons.extend(get_lessons(course.get("course")))
|
||||||
|
|
||||||
return lessons
|
return lessons
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def add_course(course, parent, name=None, evaluator=None):
|
||||||
|
frappe.only_for("Moderator")
|
||||||
|
if name:
|
||||||
|
doc = frappe.get_doc("Batch Course", name)
|
||||||
|
else:
|
||||||
|
doc = frappe.new_doc("Batch Course")
|
||||||
|
|
||||||
|
doc.update(
|
||||||
|
{
|
||||||
|
"course": course,
|
||||||
|
"evaluator": evaluator,
|
||||||
|
"parent": parent,
|
||||||
|
"parentfield": "courses",
|
||||||
|
"parenttype": "LMS Batch",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
doc.save()
|
||||||
|
|
||||||
|
return doc.name
|
||||||
|
|||||||
@@ -104,9 +104,7 @@ def update_meeting_details(eval, event, calendar):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_certificate_request(
|
def create_certificate_request(course, date, day, start_time, end_time, batch=None):
|
||||||
course, date, day, start_time, end_time, class_name=None
|
|
||||||
):
|
|
||||||
is_member = frappe.db.exists(
|
is_member = frappe.db.exists(
|
||||||
{"doctype": "LMS Enrollment", "course": course, "member": frappe.session.user}
|
{"doctype": "LMS Enrollment", "course": course, "member": frappe.session.user}
|
||||||
)
|
)
|
||||||
@@ -117,13 +115,13 @@ def create_certificate_request(
|
|||||||
eval.update(
|
eval.update(
|
||||||
{
|
{
|
||||||
"course": course,
|
"course": course,
|
||||||
"evaluator": get_evaluator(course, class_name),
|
"evaluator": get_evaluator(course, batch),
|
||||||
"member": frappe.session.user,
|
"member": frappe.session.user,
|
||||||
"date": date,
|
"date": date,
|
||||||
"day": day,
|
"day": day,
|
||||||
"start_time": start_time,
|
"start_time": start_time,
|
||||||
"end_time": end_time,
|
"end_time": end_time,
|
||||||
"class_name": class_name,
|
"batch": batch,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
eval.save(ignore_permissions=True)
|
eval.save(ignore_permissions=True)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class LMSCourse(Document):
|
|||||||
self.image = validate_image(self.image)
|
self.image = validate_image(self.image)
|
||||||
|
|
||||||
def validate_instructors(self):
|
def validate_instructors(self):
|
||||||
|
print(self.is_new(), not self.instructors)
|
||||||
if self.is_new() and not self.instructors:
|
if self.is_new() and not self.instructors:
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"default_currency",
|
"default_currency",
|
||||||
"column_break_cfcv",
|
"column_break_cfcv",
|
||||||
"razorpay_secret",
|
"razorpay_secret",
|
||||||
|
"apply_gst",
|
||||||
"signup_settings_tab",
|
"signup_settings_tab",
|
||||||
"signup_settings_section",
|
"signup_settings_section",
|
||||||
"terms_of_use",
|
"terms_of_use",
|
||||||
@@ -188,6 +189,7 @@
|
|||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "allow_student_progress",
|
"fieldname": "allow_student_progress",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Allow students to see each others progress in class"
|
"label": "Allow students to see each others progress in class"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -223,12 +225,18 @@
|
|||||||
"fieldname": "razorpay_secret",
|
"fieldname": "razorpay_secret",
|
||||||
"fieldtype": "Password",
|
"fieldtype": "Password",
|
||||||
"label": "Razorpay Secret"
|
"label": "Razorpay Secret"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "apply_gst",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Apply GST for India"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-08-02 18:59:01.267732",
|
"modified": "2023-08-29 09:54:48.030823",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
@@ -795,13 +795,13 @@ def has_graded_assessment(submission):
|
|||||||
return False if status == "Not Graded" else True
|
return False if status == "Not Graded" else True
|
||||||
|
|
||||||
|
|
||||||
def get_evaluator(course, class_name=None):
|
def get_evaluator(course, batch=None):
|
||||||
evaluator = None
|
evaluator = None
|
||||||
|
|
||||||
if class_name:
|
if batch:
|
||||||
evaluator = frappe.db.get_value(
|
evaluator = frappe.db.get_value(
|
||||||
"Batch Course",
|
"Batch Course",
|
||||||
{"parent": class_name, "course": course},
|
{"parent": batch, "course": course},
|
||||||
"evaluator",
|
"evaluator",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -871,11 +871,11 @@ def get_details(doctype, docname):
|
|||||||
details = frappe.db.get_value(
|
details = frappe.db.get_value(
|
||||||
"LMS Batch",
|
"LMS Batch",
|
||||||
docname,
|
docname,
|
||||||
["name", "title", "paid_class", "currency", "amount"],
|
["name", "title", "paid_batch", "currency", "amount"],
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
if not details.paid_class:
|
if not details.paid_batch:
|
||||||
frappe.throw(_("To join this class, please contact the Administrator."))
|
frappe.throw(_("To join this batch, please contact the Administrator."))
|
||||||
|
|
||||||
return details
|
return details
|
||||||
|
|
||||||
@@ -939,7 +939,7 @@ def verify_payment(response, doctype, docname, address, order_id):
|
|||||||
if doctype == "LMS Course":
|
if doctype == "LMS Course":
|
||||||
return create_membership(docname, payment)
|
return create_membership(docname, payment)
|
||||||
else:
|
else:
|
||||||
return add_student_to_class(docname, payment)
|
return add_student_to_batch(docname, payment)
|
||||||
|
|
||||||
|
|
||||||
def record_payment(address, response, client, doctype, docname):
|
def record_payment(address, response, client, doctype, docname):
|
||||||
@@ -967,10 +967,7 @@ def record_payment(address, response, client, doctype, docname):
|
|||||||
|
|
||||||
|
|
||||||
def get_payment_details(client, response, doctype, docname):
|
def get_payment_details(client, response, doctype, docname):
|
||||||
try:
|
payment = client.payment.fetch(response["razorpay_payment_id"])
|
||||||
payment = client.payment.fetch(response["razorpay_payment_id"])
|
|
||||||
except Exception as e:
|
|
||||||
frappe.log_error(e, "Error during payment fetch")
|
|
||||||
|
|
||||||
if payment:
|
if payment:
|
||||||
amount = payment["amount"] / 100
|
amount = payment["amount"] / 100
|
||||||
@@ -995,16 +992,16 @@ def create_membership(course, payment):
|
|||||||
return f"/courses/{course}/learn/1.1"
|
return f"/courses/{course}/learn/1.1"
|
||||||
|
|
||||||
|
|
||||||
def add_student_to_class(classname, payment):
|
def add_student_to_batch(batchname, payment):
|
||||||
student = frappe.new_doc("Batch Student")
|
student = frappe.new_doc("Batch Student")
|
||||||
student.update(
|
student.update(
|
||||||
{
|
{
|
||||||
"student": frappe.session.user,
|
"student": frappe.session.user,
|
||||||
"payment": payment,
|
"payment": payment,
|
||||||
"parent": classname,
|
"parent": batchname,
|
||||||
"parenttype": "LMS Batch",
|
"parenttype": "LMS Batch",
|
||||||
"parentfield": "students",
|
"parentfield": "students",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
student.save(ignore_permissions=True)
|
student.save(ignore_permissions=True)
|
||||||
return f"/classes/{classname}"
|
return f"/batches/{batchname}"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ frappe.ready(function () {
|
|||||||
let data = frappe.web_form.get_values();
|
let data = frappe.web_form.get_values();
|
||||||
if (data.class) {
|
if (data.class) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = `/classes/${data.class}`;
|
window.location.href = `/batches/${data.class}`;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,4 +65,5 @@ lms.patches.v1_0.paid_certificate_to_paid_course #18-08-2023
|
|||||||
lms.patches.v1_0.revert_class_registration #18-08-2023
|
lms.patches.v1_0.revert_class_registration #18-08-2023
|
||||||
lms.patches.v1_0.rename_lms_batch_doctype
|
lms.patches.v1_0.rename_lms_batch_doctype
|
||||||
lms.patches.v1_0.rename_lms_batch_membership_doctype
|
lms.patches.v1_0.rename_lms_batch_membership_doctype
|
||||||
lms.patches.v1_0.rename_lms_class_to_lms_batch
|
lms.patches.v1_0.rename_lms_class_to_lms_batch
|
||||||
|
lms.patches.v1_0.rename_classes_in_navbar
|
||||||
12
lms/patches/v1_0/rename_classes_in_navbar.py
Normal file
12
lms/patches/v1_0/rename_classes_in_navbar.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.db.set_value(
|
||||||
|
"Top Bar Item",
|
||||||
|
{"url": "/classes"},
|
||||||
|
{
|
||||||
|
"label": "Batches",
|
||||||
|
"url": "/batches",
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -911,7 +911,7 @@ input[type=checkbox] {
|
|||||||
.profile-name-section {
|
.profile-name-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 1rem 0 0.25rem;
|
margin: 0.5rem 0 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 550px) {
|
@media (max-width: 550px) {
|
||||||
@@ -2194,15 +2194,6 @@ select {
|
|||||||
grid-gap: 1rem;
|
grid-gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-remove-course {
|
|
||||||
opacity: 0;
|
|
||||||
margin-top: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-remove-course:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rows .grid-row .data-row,
|
.rows .grid-row .data-row,
|
||||||
.rows .grid-row .grid-footer-toolbar,
|
.rows .grid-row .grid-footer-toolbar,
|
||||||
.grid-form-heading {
|
.grid-form-heading {
|
||||||
@@ -2344,4 +2335,8 @@ select {
|
|||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
grid-gap: 0.5rem;
|
grid-gap: 0.5rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.batch-course-list .cards-parent {
|
||||||
|
row-gap: 3rem
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
{% set course = frappe.db.get_value("LMS Course", certificate.course, ["title", "name", "image"], as_dict=True) %}
|
{% set course = frappe.db.get_value("LMS Course", certificate.course, ["title", "name", "image"], as_dict=True) %}
|
||||||
|
|
||||||
<div class="common-card-style column-card medium">
|
<div class="common-card-style column-card medium">
|
||||||
<div class="font-weight-bold">
|
<div class="bold-heading">
|
||||||
{{ course.title }}
|
{{ course.title }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="vertically-center small">
|
<div class="vertically-center small">
|
||||||
<a class="dark-links" href="/classes">
|
<a class="dark-links" href="/batches">
|
||||||
{{ _("All Classes") }}
|
{{ _("All Batches") }}
|
||||||
</a>
|
</a>
|
||||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<span class="breadcrumb-destination">{{ _("Assignment Submission") }}</span>
|
<span class="breadcrumb-destination">{{ _("Assignment Submission") }}</span>
|
||||||
@@ -51,13 +51,18 @@
|
|||||||
|
|
||||||
{% macro SubmissionForm(assignment) %}
|
{% macro SubmissionForm(assignment) %}
|
||||||
<article class="field-parent">
|
<article class="field-parent">
|
||||||
{% if submission.name and is_moderator %}
|
{% if submission.name %}
|
||||||
<div class="field-group">
|
<div class="alert alert-info">
|
||||||
<div class="field-label">
|
{{ _("You've successfully submitted the assignment. Once the moderator grades your submission, you'll find the details here. Feel free to make edits to your submission if needed.") }}
|
||||||
{{ _("Student Name") }}
|
|
||||||
</div>
|
</div>
|
||||||
{{ submission.member_name }}
|
{% if is_moderator %}
|
||||||
</div>
|
<div class="field-group">
|
||||||
|
<div class="field-label">
|
||||||
|
{{ _("Student Name") }}
|
||||||
|
</div>
|
||||||
|
{{ submission.member_name }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="field-group">
|
<div class="field-group">
|
||||||
@@ -79,14 +84,15 @@
|
|||||||
<div class="btn btn-default btn-sm btn-upload mt-2 {% if submission.assignment_attachment %} hide {% endif %}" data-type="{{ assignment.type }}">
|
<div class="btn btn-default btn-sm btn-upload mt-2 {% if submission.assignment_attachment %} hide {% endif %}" data-type="{{ assignment.type }}">
|
||||||
{{ _("Browse").format(assignment.type) }}
|
{{ _("Browse").format(assignment.type) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="field-input flex justify-between align-center {% if not submission.assignment_attachment %} hide {% endif %}" id="assignment-preview">
|
<div class="field-input flex justify-between align-center overflow-auto
|
||||||
|
{% if not submission.assignment_attachment %} hide {% endif %}" id="assignment-preview">
|
||||||
<a class="clickable" {% if submission.assignment_attachment %} href="{{ submission.assignment_attachment }}" {% endif %}>
|
<a class="clickable" {% if submission.assignment_attachment %} href="{{ submission.assignment_attachment }}" {% endif %}>
|
||||||
{% if submission.assignment_attachment %} {{ submission.assignment_attachment }} {% endif %}
|
{% if submission.assignment_attachment %} {{ submission.assignment_attachment }} {% endif %}
|
||||||
</a>
|
</a>
|
||||||
<span class="btn btn-default btn-sm btn-close {% if not submission %} hide {% endif %}">
|
|
||||||
{{ _("Clear") }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<span class="btn btn-default btn-sm btn-close {% if not submission %} hide {% endif %} mt-2">
|
||||||
|
{{ _("Clear") }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if is_moderator %}
|
{% if is_moderator %}
|
||||||
|
|||||||
@@ -61,10 +61,10 @@
|
|||||||
<div class="breadcrumb">
|
<div class="breadcrumb">
|
||||||
{% if class_info %}
|
{% if class_info %}
|
||||||
<a class="dark-links" href="/courses">
|
<a class="dark-links" href="/courses">
|
||||||
{{ _("All Classes") }}
|
{{ _("All Batches") }}
|
||||||
</a>
|
</a>
|
||||||
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<a class="dark-links" href="/classes/{{ class_info.name }}">
|
<a class="dark-links" href="/batches/{{ class_info.name }}">
|
||||||
{{ class_info.title }}
|
{{ class_info.title }}
|
||||||
</a>
|
</a>
|
||||||
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
<div class="breadcrumb">
|
<div class="breadcrumb">
|
||||||
<a class="dark-links" href="/batches">{{ _("All Batches") }}</a>
|
<a class="dark-links" href="/batches">{{ _("All Batches") }}</a>
|
||||||
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
||||||
|
<a class="dark-links" href="/batches/details/{{ batch_info.name }}">{{ _("Batch Details") }}</a>
|
||||||
|
<img class="ml-1 mr-1" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<span class="breadcrumb-destination">{{ batch_info.title }}</span>
|
<span class="breadcrumb-destination">{{ batch_info.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
@@ -239,11 +241,6 @@
|
|||||||
<div class="bold-heading">
|
<div class="bold-heading">
|
||||||
{{ _("Courses") }}
|
{{ _("Courses") }}
|
||||||
</div>
|
</div>
|
||||||
{% if is_moderator %}
|
|
||||||
<button class="btn btn-default btn-sm btn-add-course">
|
|
||||||
{{ _("Add Courses") }}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -252,11 +249,6 @@
|
|||||||
{% for course in batch_courses %}
|
{% for course in batch_courses %}
|
||||||
<div class="h-100">
|
<div class="h-100">
|
||||||
{{ widgets.CourseCard(course=course, read_only=False) }}
|
{{ widgets.CourseCard(course=course, read_only=False) }}
|
||||||
<button class="btn icon-btn btn-default btn-block btn-remove-course" data-course="{{ course.name }}">
|
|
||||||
<svg class="icon icon-sm">
|
|
||||||
<use href="#icon-delete"></use>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -320,7 +312,7 @@
|
|||||||
{% set allow_progress = is_moderator or is_evaluator %}
|
{% set allow_progress = is_moderator or is_evaluator %}
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="data-row row">
|
<div class="data-row row">
|
||||||
<a class="col grid-static-col button-links {% if allow_progress %} clickable {% endif %}" {% if allow_progress %} href="/classes/{{ batch_info.name }}/students/{{ student.username }}" {% endif %}>
|
<a class="col grid-static-col button-links {% if allow_progress %} clickable {% endif %}" {% if allow_progress %} href="/batches/{{ batch_info.name }}/students/{{ student.username }}" {% endif %}>
|
||||||
{{ student.student_name }}
|
{{ student.student_name }}
|
||||||
</a>
|
</a>
|
||||||
<div class="col grid-static-col col-xs-2 text-right">
|
<div class="col grid-static-col col-xs-2 text-right">
|
||||||
|
|||||||
@@ -25,13 +25,6 @@ frappe.ready(() => {
|
|||||||
create_live_class(e);
|
create_live_class(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btn-add-course").click((e) => {
|
|
||||||
show_course_modal(e);
|
|
||||||
});
|
|
||||||
$(".btn-remove-course").click((e) => {
|
|
||||||
remove_course(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".btn-remove-assessment").click((e) => {
|
$(".btn-remove-assessment").click((e) => {
|
||||||
remove_assessment(e);
|
remove_assessment(e);
|
||||||
});
|
});
|
||||||
@@ -55,11 +48,11 @@ frappe.ready(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const create_live_class = (e) => {
|
const create_live_class = (e) => {
|
||||||
let class_name = $(".class-details").data("batch");
|
let batch_name = $(".class-details").data("batch");
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "lms.lms.doctype.lms_class.lms_class.create_live_class",
|
method: "lms.lms.doctype.lms_batch.lms_batch.create_live_class",
|
||||||
args: {
|
args: {
|
||||||
class_name: class_name,
|
batch_name: batch_name,
|
||||||
title: $("input[data-fieldname='meeting_title']").val(),
|
title: $("input[data-fieldname='meeting_title']").val(),
|
||||||
duration: $("input[data-fieldname='meeting_duration']").val(),
|
duration: $("input[data-fieldname='meeting_duration']").val(),
|
||||||
date: $("input[data-fieldname='meeting_date']").val(),
|
date: $("input[data-fieldname='meeting_date']").val(),
|
||||||
@@ -300,85 +293,6 @@ const get_timezones = () => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const show_course_modal = () => {
|
|
||||||
let course_modal = new frappe.ui.Dialog({
|
|
||||||
title: "Add Course",
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "LMS Course",
|
|
||||||
label: __("Course"),
|
|
||||||
fieldname: "course",
|
|
||||||
reqd: 1,
|
|
||||||
only_select: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "Course Evaluator",
|
|
||||||
label: __("Course Evaluator"),
|
|
||||||
fieldname: "evaluator",
|
|
||||||
only_select: 1,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
primary_action_label: __("Add"),
|
|
||||||
primary_action(values) {
|
|
||||||
add_course(values);
|
|
||||||
course_modal.hide();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
course_modal.show();
|
|
||||||
setTimeout(() => {
|
|
||||||
$(".modal-body").css("min-height", "200px");
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
const add_course = (values) => {
|
|
||||||
frappe.call({
|
|
||||||
method: "frappe.client.insert",
|
|
||||||
args: {
|
|
||||||
doc: {
|
|
||||||
doctype: "Batch Course",
|
|
||||||
course: values.course,
|
|
||||||
parenttype: "LMS Batch",
|
|
||||||
parentfield: "courses",
|
|
||||||
parent: $(".class-details").data("batch"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
callback(r) {
|
|
||||||
frappe.show_alert(
|
|
||||||
{
|
|
||||||
message: __("Course Added"),
|
|
||||||
indicator: "green",
|
|
||||||
},
|
|
||||||
2000
|
|
||||||
);
|
|
||||||
window.location.reload();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const remove_course = (e) => {
|
|
||||||
frappe.confirm("Are you sure you want to remove this course?", () => {
|
|
||||||
frappe.call({
|
|
||||||
method: "lms.lms.doctype.lms_class.lms_class.remove_course",
|
|
||||||
args: {
|
|
||||||
course: $(e.currentTarget).data("course"),
|
|
||||||
parent: $(".class-details").data("batch"),
|
|
||||||
},
|
|
||||||
callback(r) {
|
|
||||||
frappe.show_alert(
|
|
||||||
{
|
|
||||||
message: __("Course Removed"),
|
|
||||||
indicator: "green",
|
|
||||||
},
|
|
||||||
2000
|
|
||||||
);
|
|
||||||
window.location.reload();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const show_student_modal = () => {
|
const show_student_modal = () => {
|
||||||
let student_modal = new frappe.ui.Dialog({
|
let student_modal = new frappe.ui.Dialog({
|
||||||
title: "Add Student",
|
title: "Add Student",
|
||||||
@@ -435,13 +349,13 @@ const add_student = (values) => {
|
|||||||
|
|
||||||
const remove_student = (e) => {
|
const remove_student = (e) => {
|
||||||
frappe.confirm(
|
frappe.confirm(
|
||||||
"Are you sure you want to remove this student from the class?",
|
"Are you sure you want to remove this student from the batch?",
|
||||||
() => {
|
() => {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "lms.lms.doctype.lms_class.lms_class.remove_student",
|
method: "lms.lms.doctype.lms_batch.lms_batch.remove_student",
|
||||||
args: {
|
args: {
|
||||||
student: $(e.currentTarget).data("student"),
|
student: $(e.currentTarget).data("student"),
|
||||||
class_name: $(".class-details").data("batch"),
|
batch_name: $(".class-details").data("batch"),
|
||||||
},
|
},
|
||||||
callback: (data) => {
|
callback: (data) => {
|
||||||
frappe.show_alert(
|
frappe.show_alert(
|
||||||
@@ -547,7 +461,7 @@ const add_addessment = (values) => {
|
|||||||
const remove_assessment = (e) => {
|
const remove_assessment = (e) => {
|
||||||
frappe.confirm("Are you sure you want to remove this assessment?", () => {
|
frappe.confirm("Are you sure you want to remove this assessment?", () => {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "lms.lms.doctype.lms_class.lms_class.remove_assessment",
|
method: "lms.lms.doctype.lms_batch.lms_batch.remove_assessment",
|
||||||
args: {
|
args: {
|
||||||
assessment: $(e.currentTarget).data("assessment"),
|
assessment: $(e.currentTarget).data("assessment"),
|
||||||
parent: $(".class-details").data("batch"),
|
parent: $(".class-details").data("batch"),
|
||||||
@@ -580,6 +494,7 @@ const open_evaluation_form = (e) => {
|
|||||||
name: ["in", courses],
|
name: ["in", courses],
|
||||||
},
|
},
|
||||||
filter_description: " ",
|
filter_description: " ",
|
||||||
|
only_select: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldtype: "Date",
|
fieldtype: "Date",
|
||||||
@@ -615,7 +530,7 @@ const get_slots = () => {
|
|||||||
args: {
|
args: {
|
||||||
course: this.eval_form.get_value("course"),
|
course: this.eval_form.get_value("course"),
|
||||||
date: this.eval_form.get_value("date"),
|
date: this.eval_form.get_value("date"),
|
||||||
class_name: $(".class-details").data("batch"),
|
batch_name: $(".class-details").data("batch"),
|
||||||
},
|
},
|
||||||
callback: (r) => {
|
callback: (r) => {
|
||||||
if (r.message) {
|
if (r.message) {
|
||||||
@@ -677,7 +592,7 @@ const submit_evaluation_form = (values) => {
|
|||||||
start_time: this.current_slot.data("start"),
|
start_time: this.current_slot.data("start"),
|
||||||
end_time: this.current_slot.data("end"),
|
end_time: this.current_slot.data("end"),
|
||||||
day: this.current_slot.data("day"),
|
day: this.current_slot.data("day"),
|
||||||
class_name: $(".class-details").data("batch"),
|
batch_name: $(".class-details").data("batch"),
|
||||||
},
|
},
|
||||||
callback: (r) => {
|
callback: (r) => {
|
||||||
this.eval_form.hide();
|
this.eval_form.hide();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ def get_context(context):
|
|||||||
"start_time",
|
"start_time",
|
||||||
"end_time",
|
"end_time",
|
||||||
"category",
|
"category",
|
||||||
"paid_class",
|
"paid_batch",
|
||||||
"amount",
|
"amount",
|
||||||
"currency",
|
"currency",
|
||||||
"batch_details",
|
"batch_details",
|
||||||
|
|||||||
@@ -173,7 +173,12 @@
|
|||||||
|
|
||||||
|
|
||||||
{% macro CourseList(courses) %}
|
{% macro CourseList(courses) %}
|
||||||
<div>
|
<div class="batch-course-list">
|
||||||
|
{% if is_moderator %}
|
||||||
|
<button class="btn btn-default btn-sm btn-add-course pull-right">
|
||||||
|
{{ _("Add Courses") }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
{{ _("Courses") }}
|
{{ _("Courses") }}
|
||||||
</div>
|
</div>
|
||||||
@@ -182,13 +187,23 @@
|
|||||||
{% for course in courses %}
|
{% for course in courses %}
|
||||||
<div class="h-100">
|
<div class="h-100">
|
||||||
{{ widgets.CourseCard(course=course, read_only=False) }}
|
{{ widgets.CourseCard(course=course, read_only=False) }}
|
||||||
<button class="btn icon-btn btn-default btn-block btn-remove-course" data-course="{{ course.name }}">
|
{% if is_moderator %}
|
||||||
<svg class="icon icon-sm">
|
<div class="flex my-2 pull-right">
|
||||||
<use href="#icon-delete"></use>
|
<button class="btn icon-btn btn-default btn-edit-course"
|
||||||
</svg>
|
data-name="{{ course.batch_course }}" data-course="{{ course.name }}"
|
||||||
</button>
|
{% if course.evaluator %} data-evaluator="{{ course.evaluator }}" {% endif %}>
|
||||||
|
<svg class="icon icon-sm">
|
||||||
|
<use href="#icon-edit"></use>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button class="btn icon-btn btn-default btn-remove-course ml-2" data-course="{{ course.name }}">
|
||||||
|
<svg class="icon icon-sm">
|
||||||
|
<use href="#icon-delete"></use>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -1,3 +1,97 @@
|
|||||||
frappe.ready(() => {
|
frappe.ready(() => {
|
||||||
frappe.require("controls.bundle.js");
|
frappe.require("controls.bundle.js");
|
||||||
|
|
||||||
|
$(".btn-add-course").click((e) => {
|
||||||
|
show_course_modal(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".btn-edit-course").click((e) => {
|
||||||
|
show_course_modal(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".btn-remove-course").click((e) => {
|
||||||
|
remove_course(e);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const show_course_modal = (e) => {
|
||||||
|
const target = $(e.currentTarget);
|
||||||
|
const course = target.data("course");
|
||||||
|
const evaluator = target.data("evaluator");
|
||||||
|
const course_name = target.data("name");
|
||||||
|
|
||||||
|
let course_modal = new frappe.ui.Dialog({
|
||||||
|
title: "Add Course",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "LMS Course",
|
||||||
|
label: __("Course"),
|
||||||
|
fieldname: "course",
|
||||||
|
reqd: 1,
|
||||||
|
only_select: 1,
|
||||||
|
default: course || "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Course Evaluator",
|
||||||
|
label: __("Course Evaluator"),
|
||||||
|
fieldname: "evaluator",
|
||||||
|
only_select: 1,
|
||||||
|
default: evaluator || "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
primary_action_label: __("Add"),
|
||||||
|
primary_action(values) {
|
||||||
|
add_course(values, course_name);
|
||||||
|
course_modal.hide();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
course_modal.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
const add_course = (values, course_name) => {
|
||||||
|
frappe.call({
|
||||||
|
method: "lms.lms.doctype.lms_batch.lms_batch.add_course",
|
||||||
|
args: {
|
||||||
|
course: values.course,
|
||||||
|
evaluator: values.evaluator,
|
||||||
|
parent: $(".class-details").data("batch"),
|
||||||
|
name: course_name || "",
|
||||||
|
},
|
||||||
|
callback(r) {
|
||||||
|
frappe.show_alert(
|
||||||
|
{
|
||||||
|
message: course_name
|
||||||
|
? __("Course Updated")
|
||||||
|
: __("Course Added"),
|
||||||
|
indicator: "green",
|
||||||
|
},
|
||||||
|
2000
|
||||||
|
);
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const remove_course = (e) => {
|
||||||
|
frappe.confirm("Are you sure you want to remove this course?", () => {
|
||||||
|
frappe.call({
|
||||||
|
method: "lms.lms.doctype.lms_batch.lms_batch.remove_course",
|
||||||
|
args: {
|
||||||
|
course: $(e.currentTarget).data("course"),
|
||||||
|
parent: $(".class-details").data("batch"),
|
||||||
|
},
|
||||||
|
callback(r) {
|
||||||
|
frappe.show_alert(
|
||||||
|
{
|
||||||
|
message: __("Course Removed"),
|
||||||
|
indicator: "green",
|
||||||
|
},
|
||||||
|
2000
|
||||||
|
);
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def get_context(context):
|
|||||||
context.courses = frappe.get_all(
|
context.courses = frappe.get_all(
|
||||||
"Batch Course",
|
"Batch Course",
|
||||||
{"parent": batch_name},
|
{"parent": batch_name},
|
||||||
["name", "course", "title"],
|
["name as batch_course", "course", "title", "evaluator"],
|
||||||
order_by="creation desc",
|
order_by="creation desc",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -68,18 +68,18 @@
|
|||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="upcoming" role="tabpanel" aria-labelledby="upcoming">
|
<div class="tab-pane active" id="upcoming" role="tabpanel" aria-labelledby="upcoming">
|
||||||
{{ BatchCard(upcoming_batches, show_price=True) }}
|
{{ BatchCard(upcoming_batches, show_price=True, label="Upcoming") }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if is_moderator %}
|
{% if is_moderator %}
|
||||||
<div class="tab-pane" id="past" role="tabpanel" aria-labelledby="past">
|
<div class="tab-pane" id="past" role="tabpanel" aria-labelledby="past">
|
||||||
{{ BatchCard(past_batches, show_price=False) }}
|
{{ BatchCard(past_batches, show_price=False, label="Archived") }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if frappe.session.user != "Guest" %}
|
{% if frappe.session.user != "Guest" %}
|
||||||
<div class="tab-pane" id="my-batch" role="tabpanel" aria-labelledby="my-batches">
|
<div class="tab-pane" id="my-batch" role="tabpanel" aria-labelledby="my-batches">
|
||||||
{{ BatchCard(my_batches, show_price=False) }}
|
{{ BatchCard(my_batches, show_price=False, label="Enrolled") }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -87,7 +87,8 @@
|
|||||||
</article>
|
</article>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro BatchCard(batches, show_price=False) %}
|
{% macro BatchCard(batches, show_price=False, label="") %}
|
||||||
|
{% if batches | length %}
|
||||||
<div class="lms-card-parent">
|
<div class="lms-card-parent">
|
||||||
{% for batch in batches %}
|
{% for batch in batches %}
|
||||||
|
|
||||||
@@ -148,6 +149,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<p class="text-muted mt-3">
|
||||||
|
{{ _("No {0} batches").format(label|lower) }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro EmptyState() %}
|
{% macro EmptyState() %}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="common-page-style">
|
<div class="common-page-style">
|
||||||
{{ Header() }}
|
{{ Header() }}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{ Progress(class_info, student) }}
|
{{ Progress(batch, student) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -22,12 +22,12 @@
|
|||||||
{{ _("{0}").format(student.full_name) }}
|
{{ _("{0}").format(student.full_name) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="vertically-center">
|
<div class="vertically-center">
|
||||||
<a class="dark-links" href="/classes">
|
<a class="dark-links" href="/batches">
|
||||||
{{ _("All Classes") }}
|
{{ _("All Batches") }}
|
||||||
</a>
|
</a>
|
||||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<a class="dark-links" href="/classes/{{ class_info.name }}">
|
<a class="dark-links" href="/batches/{{ batch.name }}">
|
||||||
{{ class_info.name }}
|
{{ batch.name }}
|
||||||
</a>
|
</a>
|
||||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<span class="breadcrumb-destination">
|
<span class="breadcrumb-destination">
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_moderator %}
|
{% if is_moderator %}
|
||||||
<a class="btn btn-primary btn-sm btn-evaluate ml-2" href="/evaluation/new?member={{student.name}}&date={{frappe.utils.getdate()}}&class_name={{class_info.name}}">
|
<a class="btn btn-primary btn-sm btn-evaluate ml-2" href="/evaluation/new?member={{student.name}}&date={{frappe.utils.getdate()}}&class_name={{batch.name}}">
|
||||||
{{ _("Evaluate") }}
|
{{ _("Evaluate") }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
{% macro Progress(class_info, student) %}
|
{% macro Progress(batch, student) %}
|
||||||
{{ UpcomingEvals(upcoming_evals) }}
|
{{ UpcomingEvals(upcoming_evals) }}
|
||||||
{{ Assessments(class_info, student) }}
|
{{ Assessments(batch, student) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro UpcomingEvals(upcoming_evals) %}
|
{% macro UpcomingEvals(upcoming_evals) %}
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro Assessments(class_info, student) %}
|
{% macro Assessments(batch, student) %}
|
||||||
<div class="mb-8">
|
<div class="mb-8">
|
||||||
{% include "lms/templates/assessments.html" %}
|
{% include "lms/templates/assessments.html" %}
|
||||||
</div>
|
</div>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"can_read": ["LMS Course"]
|
"can_read": ["LMS Course"]
|
||||||
};
|
};
|
||||||
let courses = {{ courses | json }};
|
let courses = {{ courses | json }};
|
||||||
let class_name = "{{ class_info.name }}";
|
let batch_name = "{{ batch.name }}";
|
||||||
</script>
|
</script>
|
||||||
{{ include_script('controls.bundle.js') }}
|
{{ include_script('controls.bundle.js') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -12,7 +12,7 @@ def get_context(context):
|
|||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
|
|
||||||
student = frappe.form_dict["username"]
|
student = frappe.form_dict["username"]
|
||||||
class_name = frappe.form_dict["classname"]
|
batch_name = frappe.form_dict["batchname"]
|
||||||
context.is_moderator = has_course_moderator_role()
|
context.is_moderator = has_course_moderator_role()
|
||||||
context.is_evaluator = has_course_evaluator_role()
|
context.is_evaluator = has_course_evaluator_role()
|
||||||
|
|
||||||
@@ -29,13 +29,11 @@ def get_context(context):
|
|||||||
):
|
):
|
||||||
raise frappe.PermissionError(_("You don't have permission to access this page."))
|
raise frappe.PermissionError(_("You don't have permission to access this page."))
|
||||||
|
|
||||||
context.class_info = frappe.db.get_value(
|
context.batch = frappe.db.get_value("LMS Batch", batch_name, ["name"], as_dict=True)
|
||||||
"LMS Batch", class_name, ["name"], as_dict=True
|
|
||||||
)
|
|
||||||
|
|
||||||
context.courses = frappe.get_all(
|
context.courses = frappe.get_all(
|
||||||
"Batch Course", {"parent": class_name}, pluck="course"
|
"Batch Course", {"parent": batch_name}, pluck="course"
|
||||||
)
|
)
|
||||||
|
|
||||||
context.assessments = get_assessments(class_name, context.student.name)
|
context.assessments = get_assessments(batch_name, context.student.name)
|
||||||
context.upcoming_evals = get_upcoming_evals(context.student.name, context.courses)
|
context.upcoming_evals = get_upcoming_evals(context.student.name, context.courses)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<div class="">
|
<div class="">
|
||||||
<div class="flex mb-2">
|
<div class="flex mb-2">
|
||||||
<div class="field-label">
|
<div class="field-label">
|
||||||
{% set label = "Course Name" if module == "course" else "Class Name" %}
|
{% set label = "Course Name" if module == "course" else "Batch Name" %}
|
||||||
{{ _(label) }} : {{ title }}
|
{{ _(label) }} : {{ title }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ def get_context(context):
|
|||||||
if frappe.session.user == "Guest":
|
if frappe.session.user == "Guest":
|
||||||
raise frappe.PermissionError(_("You are not allowed to access this page."))
|
raise frappe.PermissionError(_("You are not allowed to access this page."))
|
||||||
|
|
||||||
if module not in ["course", "class"]:
|
if module not in ["course", "batch"]:
|
||||||
raise ValueError(_("Module is incorrect."))
|
raise ValueError(_("Module is incorrect."))
|
||||||
|
|
||||||
doctype = "LMS Course" if module == "course" else "LMS Batch"
|
doctype = "LMS Course" if module == "course" else "LMS Batch"
|
||||||
@@ -32,7 +32,7 @@ def get_context(context):
|
|||||||
"Batch Student", {"student": frappe.session.user, "parent": docname}
|
"Batch Student", {"student": frappe.session.user, "parent": docname}
|
||||||
)
|
)
|
||||||
if membership:
|
if membership:
|
||||||
raise frappe.PermissionError(_("You are already enrolled for this class"))
|
raise frappe.PermissionError(_("You are already enrolled for this batch."))
|
||||||
|
|
||||||
if doctype == "LMS Course":
|
if doctype == "LMS Course":
|
||||||
course = frappe.db.get_value(
|
course = frappe.db.get_value(
|
||||||
@@ -50,18 +50,18 @@ def get_context(context):
|
|||||||
context.currency = course.currency
|
context.currency = course.currency
|
||||||
|
|
||||||
else:
|
else:
|
||||||
class_info = frappe.db.get_value(
|
batch = frappe.db.get_value(
|
||||||
"LMS Batch",
|
"LMS Batch",
|
||||||
docname,
|
docname,
|
||||||
["title", "name", "paid_class", "amount", "currency"],
|
["title", "name", "paid_batch", "amount", "currency"],
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not class_info.paid_class:
|
if not batch.paid_batch:
|
||||||
raise frappe.PermissionError(
|
raise frappe.PermissionError(
|
||||||
_("To join this class, please contact the Administrator.")
|
_("To join this batch, please contact the Administrator.")
|
||||||
)
|
)
|
||||||
|
|
||||||
context.title = class_info.title
|
context.title = batch.title
|
||||||
context.amount = class_info.amount
|
context.amount = batch.amount
|
||||||
context.currency = class_info.currency
|
context.currency = batch.currency
|
||||||
|
|||||||
35
lms/www/certified_participants/certified_participants.html
Normal file
35
lms/www/certified_participants/certified_participants.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "lms/templates/lms_base.html" %}
|
||||||
|
{% block title %}
|
||||||
|
{{ _("Certified Participants") }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<main class="common-page-style">
|
||||||
|
<div class="container">
|
||||||
|
<header>
|
||||||
|
<div class="page-title">
|
||||||
|
{{ _("Certified Participants") }}
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
{{ ParticipantsList() }}
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% macro ParticipantsList() %}
|
||||||
|
<article class="member-parent">
|
||||||
|
{% for participant in participants %}
|
||||||
|
<div class="common-card-style column-card align-center">
|
||||||
|
{{ widgets.Avatar(member=participant, avatar_class="avatar-large") }}
|
||||||
|
<div class="bold-heading">
|
||||||
|
{{ participant.full_name }}
|
||||||
|
</div>
|
||||||
|
{% for course in participant.courses %}
|
||||||
|
<div>
|
||||||
|
{{ course }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</article>
|
||||||
|
{% endmacro %}
|
||||||
22
lms/www/certified_participants/certified_participants.py
Normal file
22
lms/www/certified_participants/certified_participants.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
context.no_cache = 1
|
||||||
|
context.members = frappe.get_all(
|
||||||
|
"LMS Certificate", pluck="member", order_by="creation desc", distinct=1
|
||||||
|
)
|
||||||
|
|
||||||
|
participants = []
|
||||||
|
for member in context.members:
|
||||||
|
details = frappe.db.get_value(
|
||||||
|
"User", member, ["name", "full_name", "user_image", "username", "enabled"], as_dict=1
|
||||||
|
)
|
||||||
|
courses = frappe.get_all("LMS Certificate", {"member": member}, pluck="course")
|
||||||
|
details.courses = []
|
||||||
|
for course in courses:
|
||||||
|
details.courses.append(frappe.db.get_value("LMS Course", course, "title"))
|
||||||
|
if details.enabled:
|
||||||
|
participants.append(details)
|
||||||
|
|
||||||
|
context.participants = participants
|
||||||
@@ -48,15 +48,15 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if show_creators_section %}
|
|
||||||
<a class="btn btn-default btn-sm" href="/courses/new-course/edit">
|
|
||||||
{{ _("Create a Course") }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<a class="btn btn-default btn-sm" id="open-search">
|
<a class="btn btn-default btn-sm" id="open-search">
|
||||||
{{ _("Search") }} (Ctrl + k)
|
{{ _("Search") }} (Ctrl + k)
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{% if show_creators_section %}
|
||||||
|
<a class="btn btn-primary btn-sm" href="/courses/new-course/edit">
|
||||||
|
{{ _("Create a Course") }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -65,8 +65,8 @@
|
|||||||
<div class="tab-pane active" id="profile" role="tabpanel" aria-labelledby="profile">
|
<div class="tab-pane active" id="profile" role="tabpanel" aria-labelledby="profile">
|
||||||
<div class="">
|
<div class="">
|
||||||
{{ About(member) }}
|
{{ About(member) }}
|
||||||
{{ EducationDetails(member) }}
|
|
||||||
{{ WorkDetails(member) }}
|
{{ WorkDetails(member) }}
|
||||||
|
{{ EducationDetails(member) }}
|
||||||
{{ ExternalCertification(member) }}
|
{{ ExternalCertification(member) }}
|
||||||
{{ Contact(member) }}
|
{{ Contact(member) }}
|
||||||
{{ Skills(member) }}
|
{{ Skills(member) }}
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
{% macro CoursesMentored(member, read_only) %}
|
{% macro CoursesMentored(member, read_only) %}
|
||||||
{% if member.get_mentored_courses() | length %}
|
{% if member.get_mentored_courses() | length %}
|
||||||
<div class="profile-courses">
|
<div class="profile-courses">
|
||||||
<div class="course-home-headings"> {{ _("Courses Mentored") }} </div>
|
<div class="page-title"> {{ _("Courses Mentored") }} </div>
|
||||||
<div class="cards-parent">
|
<div class="cards-parent">
|
||||||
{% for course in member.get_mentored_courses() %}
|
{% for course in member.get_mentored_courses() %}
|
||||||
{{ widgets.CourseCard(course=course, read_only=read_only) }}
|
{{ widgets.CourseCard(course=course, read_only=read_only) }}
|
||||||
@@ -202,7 +202,7 @@
|
|||||||
{% if has_course_moderator_role() %}
|
{% if has_course_moderator_role() %}
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="course-home-headings"> {{ _("Role Settings") }} </div>
|
<div class="page-title mb-2"> {{ _("Role Settings") }} </div>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<label class="role">
|
<label class="role">
|
||||||
<input type="checkbox" id="course-creator" data-role="Course Creator"
|
<input type="checkbox" id="course-creator" data-role="Course Creator"
|
||||||
@@ -223,7 +223,6 @@
|
|||||||
|
|
||||||
<!-- About Section -->
|
<!-- About Section -->
|
||||||
{% macro About(member) %}
|
{% macro About(member) %}
|
||||||
<div class="course-home-headings"> {{ _("About") }} </div>
|
|
||||||
<div class="description">
|
<div class="description">
|
||||||
{% if member.bio %}
|
{% if member.bio %}
|
||||||
{{ member.bio }}
|
{{ member.bio }}
|
||||||
@@ -236,7 +235,7 @@
|
|||||||
|
|
||||||
<!-- Work Preference -->
|
<!-- Work Preference -->
|
||||||
{% macro WorkPreference(member) %}
|
{% macro WorkPreference(member) %}
|
||||||
<div class="course-home-headings mt-10"> {{ _("Work Preference") }} </div>
|
<div class="page-title mt-10"> {{ _("Work Preference") }} </div>
|
||||||
<div> {{ member.attire }} </div>
|
<div> {{ member.attire }} </div>
|
||||||
<div> {{ member.collaboration }} </div>
|
<div> {{ member.collaboration }} </div>
|
||||||
<div> {{ member.role }} </div>
|
<div> {{ member.role }} </div>
|
||||||
@@ -249,7 +248,7 @@
|
|||||||
<!-- Career Preference -->
|
<!-- Career Preference -->
|
||||||
{% macro CareerPreference(member) %}
|
{% macro CareerPreference(member) %}
|
||||||
{% if member.preferred_functions or member.preferred_industries or member.preferred_location or member.dream_companies %}
|
{% if member.preferred_functions or member.preferred_industries or member.preferred_location or member.dream_companies %}
|
||||||
<div class="course-home-headings mt-10">
|
<div class="page-title mt-10">
|
||||||
{{ _("Career Preference") }}
|
{{ _("Career Preference") }}
|
||||||
</div>
|
</div>
|
||||||
<div class="profile-column-grid">
|
<div class="profile-column-grid">
|
||||||
@@ -294,7 +293,7 @@
|
|||||||
<!-- Contact Section -->
|
<!-- Contact Section -->
|
||||||
{% macro Contact(member) %}
|
{% macro Contact(member) %}
|
||||||
{% if member.linkedin or member.medium or member.github %}
|
{% if member.linkedin or member.medium or member.github %}
|
||||||
<div class="course-home-headings mt-10"> {{ _("Contact") }} </div>
|
<div class="page-title mt-10"> {{ _("Contact") }} </div>
|
||||||
<div class="profile-column-grid">
|
<div class="profile-column-grid">
|
||||||
{% if member.linkedin %}
|
{% if member.linkedin %}
|
||||||
{% set linkedin = member.linkedin[:-1] if member.linkedin[-1] == "/" else member.linkedin %}
|
{% set linkedin = member.linkedin[:-1] if member.linkedin[-1] == "/" else member.linkedin %}
|
||||||
@@ -323,7 +322,7 @@
|
|||||||
<!-- Skills -->
|
<!-- Skills -->
|
||||||
{% macro Skills(member) %}
|
{% macro Skills(member) %}
|
||||||
{% if member.skill | length %}
|
{% if member.skill | length %}
|
||||||
<div class="course-home-headings mt-10"> {{ _("Skills")}} </div>
|
<div class="page-title mt-10"> {{ _("Skills")}} </div>
|
||||||
<div class="profile-column-grid">
|
<div class="profile-column-grid">
|
||||||
{% for skill in member.skill %}
|
{% for skill in member.skill %}
|
||||||
<div class="description"> {{ skill.skill_name }} </div>
|
<div class="description"> {{ skill.skill_name }} </div>
|
||||||
@@ -336,11 +335,11 @@
|
|||||||
<!-- Education Details -->
|
<!-- Education Details -->
|
||||||
{% macro EducationDetails(member) %}
|
{% macro EducationDetails(member) %}
|
||||||
{% if member.education %}
|
{% if member.education %}
|
||||||
<div class="course-home-headings mt-10"> {{ _("Education") }} </div>
|
<div class="page-title mt-10 mb-2"> {{ _("Education") }} </div>
|
||||||
<div class="profile-grid-card">
|
<div class="profile-grid-card">
|
||||||
{% for edu in member.education %}
|
{% for edu in member.education %}
|
||||||
<div class="column-card-row">
|
<div class="column-card-row">
|
||||||
<div class="bold-title"> {{ edu.institution_name }} </div>
|
<div class="bold-heading"> {{ edu.institution_name }} </div>
|
||||||
<div class="profile-item"> {{ edu.degree_type }} <span></span> {{ edu.major }}
|
<div class="profile-item"> {{ edu.degree_type }} <span></span> {{ edu.major }}
|
||||||
{% if not member.hide_private %}
|
{% if not member.hide_private %}
|
||||||
<!-- {% if edu.grade_type %} {{ edu.grade_type }} {% endif %} -->
|
<!-- {% if edu.grade_type %} {{ edu.grade_type }} {% endif %} -->
|
||||||
@@ -362,17 +361,16 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
<!-- Work Details -->
|
|
||||||
{% macro WorkDetails(member) %}
|
{% macro WorkDetails(member) %}
|
||||||
{% set work_details = member.work_experience + member.internship %}
|
{% set work_details = member.work_experience + member.internship %}
|
||||||
|
|
||||||
{% if work_details | length %}
|
{% if work_details | length %}
|
||||||
<div class="course-home-headings mt-10"> {{ _("Work Experience") }} </div>
|
<div class="page-title mt-10 mb-2"> {{ _("Work Experience") }} </div>
|
||||||
<div class="profile-grid-card">
|
<div class="profile-grid-card">
|
||||||
|
|
||||||
{% for work in work_details %}
|
{% for work in work_details %}
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="bold-title"> {{ work.title }} </div>
|
<div class="bold-heading"> {{ work.title }} </div>
|
||||||
<div class="profile-item"> {{ work.company }} </div>
|
<div class="profile-item"> {{ work.company }} </div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
{{ frappe.utils.format_date(work.from_date, "MMM YYYY") }} -
|
{{ frappe.utils.format_date(work.from_date, "MMM YYYY") }} -
|
||||||
@@ -398,7 +396,7 @@
|
|||||||
<!-- Certifications -->
|
<!-- Certifications -->
|
||||||
{% macro ExternalCertification(member) %}
|
{% macro ExternalCertification(member) %}
|
||||||
{% if member.certification %}
|
{% if member.certification %}
|
||||||
<div class="course-home-headings mt-10"> {{ _("External Certification") }} </div>
|
<div class="page-title mt-10"> {{ _("External Certification") }} </div>
|
||||||
<div class="profile-grid-card">
|
<div class="profile-grid-card">
|
||||||
{% for cert in member.certification %}
|
{% for cert in member.certification %}
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="vertically-center small">
|
<div class="vertically-center small">
|
||||||
<a class="dark-links" href="/classes">
|
<a class="dark-links" href="/batches">
|
||||||
{{ _("All Classes") }}
|
{{ _("All Batches") }}
|
||||||
</a>
|
</a>
|
||||||
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
||||||
<span class="breadcrumb-destination">{{ _("Quiz Submission") }}</span>
|
<span class="breadcrumb-destination">{{ _("Quiz Submission") }}</span>
|
||||||
|
|||||||
@@ -61,13 +61,13 @@ def get_current_lesson_details(lesson_number, context, is_edit=False):
|
|||||||
return lesson_info
|
return lesson_info
|
||||||
|
|
||||||
|
|
||||||
def get_assessments(class_name, member=None):
|
def get_assessments(batch, member=None):
|
||||||
if not member:
|
if not member:
|
||||||
member = frappe.session.user
|
member = frappe.session.user
|
||||||
|
|
||||||
assessments = frappe.get_all(
|
assessments = frappe.get_all(
|
||||||
"LMS Assessment",
|
"LMS Assessment",
|
||||||
{"parent": class_name},
|
{"parent": batch},
|
||||||
["name", "assessment_type", "assessment_name"],
|
["name", "assessment_type", "assessment_name"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ def get_quiz_details(assessment, member):
|
|||||||
assessment.url = f"/quiz-submission/{assessment.assessment_name}/{submission_name}"
|
assessment.url = f"/quiz-submission/{assessment.assessment_name}/{submission_name}"
|
||||||
|
|
||||||
|
|
||||||
def is_student(class_name, member=None):
|
def is_student(batch, member=None):
|
||||||
if not member:
|
if not member:
|
||||||
member = frappe.session.user
|
member = frappe.session.user
|
||||||
|
|
||||||
@@ -140,6 +140,6 @@ def is_student(class_name, member=None):
|
|||||||
"Batch Student",
|
"Batch Student",
|
||||||
{
|
{
|
||||||
"student": member,
|
"student": member,
|
||||||
"parent": class_name,
|
"parent": batch,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user