From b940ddca255d9bbaaa6cef67a2e11cebec28e879 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 29 Aug 2023 09:55:40 +0530 Subject: [PATCH] fix: batch ui and ux --- README.md | 2 +- lms/hooks.py | 4 + lms/install.py | 2 +- .../course_evaluator/course_evaluator.py | 4 +- lms/lms/doctype/lms_batch/lms_batch.py | 22 ++++ .../lms_certificate_request.py | 8 +- lms/lms/doctype/lms_course/lms_course.py | 1 + .../doctype/lms_settings/lms_settings.json | 10 +- lms/lms/utils.py | 25 ++--- lms/lms/web_form/evaluation/evaluation.js | 2 +- lms/patches.txt | 3 +- lms/patches/v1_0/rename_classes_in_navbar.py | 12 ++ lms/public/css/style.css | 15 +-- lms/templates/certificates_section.html | 2 +- .../assignment_submission.html | 30 +++-- lms/www/batch/learn.html | 4 +- lms/www/batches/batch.html | 14 +-- lms/www/batches/batch.js | 105 ++---------------- lms/www/batches/batch.py | 2 +- lms/www/batches/batch_details.html | 29 +++-- lms/www/batches/batch_details.js | 94 ++++++++++++++++ lms/www/batches/batch_details.py | 2 +- lms/www/batches/index.html | 14 ++- lms/www/batches/progress.html | 20 ++-- lms/www/batches/progress.py | 10 +- lms/www/billing/billing.html | 2 +- lms/www/billing/billing.py | 18 +-- .../certified_participants.html | 35 ++++++ .../certified_participants.py | 22 ++++ lms/www/courses/index.html | 12 +- lms/www/profiles/profile.html | 26 ++--- lms/www/quiz_submission/quiz_submission.html | 4 +- lms/www/utils.py | 8 +- 33 files changed, 341 insertions(+), 222 deletions(-) create mode 100644 lms/patches/v1_0/rename_classes_in_navbar.py create mode 100644 lms/www/certified_participants/certified_participants.html create mode 100644 lms/www/certified_participants/certified_participants.py diff --git a/README.md b/README.md index 371a642b..f77ddfe8 100644 --- a/README.md +++ b/README.md @@ -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 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. ๐Ÿ’ฌ -- 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. ๐Ÿ“ˆ - Job Board where users can post and look for jobs. ๐Ÿ’ผ - People directory with each person's profile page ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ diff --git a/lms/hooks.py b/lms/hooks.py index 127d4886..e0b1461c 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -196,6 +196,10 @@ website_route_rules = [ "from_route": "/batches/details/", "to_route": "batches/batch_details", }, + { + "from_route": "/certified-participants", + "to_route": "certified_participants/certified_participants", + }, ] website_redirects = [ diff --git a/lms/install.py b/lms/install.py index 3bd0539b..5856b839 100644 --- a/lms/install.py +++ b/lms/install.py @@ -17,7 +17,7 @@ def add_pages_to_nav(): pages = [ {"label": "Explore", "idx": 1}, {"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": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5}, {"label": "People", "url": "/community", "parent": "Explore", "idx": 6}, diff --git a/lms/lms/doctype/course_evaluator/course_evaluator.py b/lms/lms/doctype/course_evaluator/course_evaluator.py index a7ed55a2..a3b03e10 100644 --- a/lms/lms/doctype/course_evaluator/course_evaluator.py +++ b/lms/lms/doctype/course_evaluator/course_evaluator.py @@ -37,8 +37,8 @@ class CourseEvaluator(Document): @frappe.whitelist() -def get_schedule(course, date, class_name=None): - evaluator = get_evaluator(course, class_name) +def get_schedule(course, date, batch=None): + evaluator = get_evaluator(course, batch) all_slots = frappe.get_all( "Evaluator Schedule", diff --git a/lms/lms/doctype/lms_batch/lms_batch.py b/lms/lms/doctype/lms_batch/lms_batch.py index 18fe318b..5a0b0467 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.py +++ b/lms/lms/doctype/lms_batch/lms_batch.py @@ -238,3 +238,25 @@ def fetch_lessons(courses): lessons.extend(get_lessons(course.get("course"))) 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 diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py index c9307fec..6368bd79 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py @@ -104,9 +104,7 @@ def update_meeting_details(eval, event, calendar): @frappe.whitelist() -def create_certificate_request( - course, date, day, start_time, end_time, class_name=None -): +def create_certificate_request(course, date, day, start_time, end_time, batch=None): is_member = frappe.db.exists( {"doctype": "LMS Enrollment", "course": course, "member": frappe.session.user} ) @@ -117,13 +115,13 @@ def create_certificate_request( eval.update( { "course": course, - "evaluator": get_evaluator(course, class_name), + "evaluator": get_evaluator(course, batch), "member": frappe.session.user, "date": date, "day": day, "start_time": start_time, "end_time": end_time, - "class_name": class_name, + "batch": batch, } ) eval.save(ignore_permissions=True) diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py index 58217d96..cd6f184f 100644 --- a/lms/lms/doctype/lms_course/lms_course.py +++ b/lms/lms/doctype/lms_course/lms_course.py @@ -20,6 +20,7 @@ class LMSCourse(Document): self.image = validate_image(self.image) def validate_instructors(self): + print(self.is_new(), not self.instructors) if self.is_new() and not self.instructors: frappe.get_doc( { diff --git a/lms/lms/doctype/lms_settings/lms_settings.json b/lms/lms/doctype/lms_settings/lms_settings.json index 4c8b4d35..4e1442c5 100644 --- a/lms/lms/doctype/lms_settings/lms_settings.json +++ b/lms/lms/doctype/lms_settings/lms_settings.json @@ -23,6 +23,7 @@ "default_currency", "column_break_cfcv", "razorpay_secret", + "apply_gst", "signup_settings_tab", "signup_settings_section", "terms_of_use", @@ -188,6 +189,7 @@ "default": "0", "fieldname": "allow_student_progress", "fieldtype": "Check", + "hidden": 1, "label": "Allow students to see each others progress in class" }, { @@ -223,12 +225,18 @@ "fieldname": "razorpay_secret", "fieldtype": "Password", "label": "Razorpay Secret" + }, + { + "default": "0", + "fieldname": "apply_gst", + "fieldtype": "Check", + "label": "Apply GST for India" } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2023-08-02 18:59:01.267732", + "modified": "2023-08-29 09:54:48.030823", "modified_by": "Administrator", "module": "LMS", "name": "LMS Settings", diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 892df016..ce2d14fb 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -795,13 +795,13 @@ def has_graded_assessment(submission): return False if status == "Not Graded" else True -def get_evaluator(course, class_name=None): +def get_evaluator(course, batch=None): evaluator = None - if class_name: + if batch: evaluator = frappe.db.get_value( "Batch Course", - {"parent": class_name, "course": course}, + {"parent": batch, "course": course}, "evaluator", ) @@ -871,11 +871,11 @@ def get_details(doctype, docname): details = frappe.db.get_value( "LMS Batch", docname, - ["name", "title", "paid_class", "currency", "amount"], + ["name", "title", "paid_batch", "currency", "amount"], as_dict=True, ) - if not details.paid_class: - frappe.throw(_("To join this class, please contact the Administrator.")) + if not details.paid_batch: + frappe.throw(_("To join this batch, please contact the Administrator.")) return details @@ -939,7 +939,7 @@ def verify_payment(response, doctype, docname, address, order_id): if doctype == "LMS Course": return create_membership(docname, payment) else: - return add_student_to_class(docname, payment) + return add_student_to_batch(docname, payment) 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): - try: - payment = client.payment.fetch(response["razorpay_payment_id"]) - except Exception as e: - frappe.log_error(e, "Error during payment fetch") + payment = client.payment.fetch(response["razorpay_payment_id"]) if payment: amount = payment["amount"] / 100 @@ -995,16 +992,16 @@ def create_membership(course, payment): 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.update( { "student": frappe.session.user, "payment": payment, - "parent": classname, + "parent": batchname, "parenttype": "LMS Batch", "parentfield": "students", } ) student.save(ignore_permissions=True) - return f"/classes/{classname}" + return f"/batches/{batchname}" diff --git a/lms/lms/web_form/evaluation/evaluation.js b/lms/lms/web_form/evaluation/evaluation.js index 3b0372f4..3214f8b6 100644 --- a/lms/lms/web_form/evaluation/evaluation.js +++ b/lms/lms/web_form/evaluation/evaluation.js @@ -3,7 +3,7 @@ frappe.ready(function () { let data = frappe.web_form.get_values(); if (data.class) { setTimeout(() => { - window.location.href = `/classes/${data.class}`; + window.location.href = `/batches/${data.class}`; }, 2000); } }; diff --git a/lms/patches.txt b/lms/patches.txt index 7325093e..a0c423b3 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -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.rename_lms_batch_doctype lms.patches.v1_0.rename_lms_batch_membership_doctype -lms.patches.v1_0.rename_lms_class_to_lms_batch \ No newline at end of file +lms.patches.v1_0.rename_lms_class_to_lms_batch +lms.patches.v1_0.rename_classes_in_navbar \ No newline at end of file diff --git a/lms/patches/v1_0/rename_classes_in_navbar.py b/lms/patches/v1_0/rename_classes_in_navbar.py new file mode 100644 index 00000000..133533a4 --- /dev/null +++ b/lms/patches/v1_0/rename_classes_in_navbar.py @@ -0,0 +1,12 @@ +import frappe + + +def execute(): + frappe.db.set_value( + "Top Bar Item", + {"url": "/classes"}, + { + "label": "Batches", + "url": "/batches", + }, + ) diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 537b04c3..77f435fb 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -911,7 +911,7 @@ input[type=checkbox] { .profile-name-section { display: flex; align-items: center; - margin: 1rem 0 0.25rem; + margin: 0.5rem 0 0.25rem; } @media (max-width: 550px) { @@ -2194,15 +2194,6 @@ select { 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 .grid-footer-toolbar, .grid-form-heading { @@ -2344,4 +2335,8 @@ select { grid-template-columns: 1fr 1fr; grid-gap: 0.5rem; margin-bottom: 1rem; +} + +.batch-course-list .cards-parent { + row-gap: 3rem } \ No newline at end of file diff --git a/lms/templates/certificates_section.html b/lms/templates/certificates_section.html index 20f02149..311d3ca6 100644 --- a/lms/templates/certificates_section.html +++ b/lms/templates/certificates_section.html @@ -6,7 +6,7 @@ {% set course = frappe.db.get_value("LMS Course", certificate.course, ["title", "name", "image"], as_dict=True) %}
-
+
{{ course.title }}
diff --git a/lms/www/assignment_submission/assignment_submission.html b/lms/www/assignment_submission/assignment_submission.html index 551c829f..5580acc9 100644 --- a/lms/www/assignment_submission/assignment_submission.html +++ b/lms/www/assignment_submission/assignment_submission.html @@ -29,8 +29,8 @@ {% endif %}
- - {{ _("All Classes") }} + + {{ _("All Batches") }} {{ _("Assignment Submission") }} @@ -51,13 +51,18 @@ {% macro SubmissionForm(assignment) %}
- {% if submission.name and is_moderator %} -
-
- {{ _("Student Name") }} + {% if submission.name %} +
+ {{ _("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.") }}
- {{ submission.member_name }} -
+ {% if is_moderator %} +
+
+ {{ _("Student Name") }} +
+ {{ submission.member_name }} +
+ {% endif %} {% endif %}
@@ -79,14 +84,15 @@
{{ _("Browse").format(assignment.type) }}
- {% if is_moderator %} diff --git a/lms/www/batch/learn.html b/lms/www/batch/learn.html index bf4a8d77..e368d7b2 100644 --- a/lms/www/batch/learn.html +++ b/lms/www/batch/learn.html @@ -61,10 +61,10 @@ @@ -252,11 +249,6 @@ {% for course in batch_courses %}
{{ widgets.CourseCard(course=course, read_only=False) }} -
{% endfor %} @@ -320,7 +312,7 @@ {% set allow_progress = is_moderator or is_evaluator %}
- + {{ student.student_name }}
diff --git a/lms/www/batches/batch.js b/lms/www/batches/batch.js index 5ffc09d7..1fdefaa3 100644 --- a/lms/www/batches/batch.js +++ b/lms/www/batches/batch.js @@ -25,13 +25,6 @@ frappe.ready(() => { 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) => { remove_assessment(e); }); @@ -55,11 +48,11 @@ frappe.ready(() => { }); const create_live_class = (e) => { - let class_name = $(".class-details").data("batch"); + let batch_name = $(".class-details").data("batch"); 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: { - class_name: class_name, + batch_name: batch_name, title: $("input[data-fieldname='meeting_title']").val(), duration: $("input[data-fieldname='meeting_duration']").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 = () => { let student_modal = new frappe.ui.Dialog({ title: "Add Student", @@ -435,13 +349,13 @@ const add_student = (values) => { const remove_student = (e) => { 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({ - method: "lms.lms.doctype.lms_class.lms_class.remove_student", + method: "lms.lms.doctype.lms_batch.lms_batch.remove_student", args: { student: $(e.currentTarget).data("student"), - class_name: $(".class-details").data("batch"), + batch_name: $(".class-details").data("batch"), }, callback: (data) => { frappe.show_alert( @@ -547,7 +461,7 @@ const add_addessment = (values) => { const remove_assessment = (e) => { frappe.confirm("Are you sure you want to remove this assessment?", () => { frappe.call({ - method: "lms.lms.doctype.lms_class.lms_class.remove_assessment", + method: "lms.lms.doctype.lms_batch.lms_batch.remove_assessment", args: { assessment: $(e.currentTarget).data("assessment"), parent: $(".class-details").data("batch"), @@ -580,6 +494,7 @@ const open_evaluation_form = (e) => { name: ["in", courses], }, filter_description: " ", + only_select: 1, }, { fieldtype: "Date", @@ -615,7 +530,7 @@ const get_slots = () => { args: { course: this.eval_form.get_value("course"), date: this.eval_form.get_value("date"), - class_name: $(".class-details").data("batch"), + batch_name: $(".class-details").data("batch"), }, callback: (r) => { if (r.message) { @@ -677,7 +592,7 @@ const submit_evaluation_form = (values) => { start_time: this.current_slot.data("start"), end_time: this.current_slot.data("end"), day: this.current_slot.data("day"), - class_name: $(".class-details").data("batch"), + batch_name: $(".class-details").data("batch"), }, callback: (r) => { this.eval_form.hide(); diff --git a/lms/www/batches/batch.py b/lms/www/batches/batch.py index c6a24c46..83fac64a 100644 --- a/lms/www/batches/batch.py +++ b/lms/www/batches/batch.py @@ -36,7 +36,7 @@ def get_context(context): "start_time", "end_time", "category", - "paid_class", + "paid_batch", "amount", "currency", "batch_details", diff --git a/lms/www/batches/batch_details.html b/lms/www/batches/batch_details.html index c79ea4da..1787a2da 100644 --- a/lms/www/batches/batch_details.html +++ b/lms/www/batches/batch_details.html @@ -173,7 +173,12 @@ {% macro CourseList(courses) %} -
+
+ {% if is_moderator %} + + {% endif %}
{{ _("Courses") }}
@@ -182,13 +187,23 @@ {% for course in courses %}
{{ widgets.CourseCard(course=course, read_only=False) }} - + {% if is_moderator %} +
+ + +
+ {% endif %}
- {% endfor %}
{% else %} diff --git a/lms/www/batches/batch_details.js b/lms/www/batches/batch_details.js index 5680d9ab..4774dfe2 100644 --- a/lms/www/batches/batch_details.js +++ b/lms/www/batches/batch_details.js @@ -1,3 +1,97 @@ frappe.ready(() => { 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(); + }, + }); + }); +}; diff --git a/lms/www/batches/batch_details.py b/lms/www/batches/batch_details.py index 269fbcff..d7d59b61 100644 --- a/lms/www/batches/batch_details.py +++ b/lms/www/batches/batch_details.py @@ -30,7 +30,7 @@ def get_context(context): context.courses = frappe.get_all( "Batch Course", {"parent": batch_name}, - ["name", "course", "title"], + ["name as batch_course", "course", "title", "evaluator"], order_by="creation desc", ) diff --git a/lms/www/batches/index.html b/lms/www/batches/index.html index e4340735..bf5f998f 100644 --- a/lms/www/batches/index.html +++ b/lms/www/batches/index.html @@ -68,18 +68,18 @@
- {{ BatchCard(upcoming_batches, show_price=True) }} + {{ BatchCard(upcoming_batches, show_price=True, label="Upcoming") }}
{% if is_moderator %}
- {{ BatchCard(past_batches, show_price=False) }} + {{ BatchCard(past_batches, show_price=False, label="Archived") }}
{% endif %} {% if frappe.session.user != "Guest" %}
- {{ BatchCard(my_batches, show_price=False) }} + {{ BatchCard(my_batches, show_price=False, label="Enrolled") }}
{% endif %} @@ -87,7 +87,8 @@
{% endmacro %} -{% macro BatchCard(batches, show_price=False) %} +{% macro BatchCard(batches, show_price=False, label="") %} +{% if batches | length %}
{% for batch in batches %} @@ -148,6 +149,11 @@
{% endfor %}
+{% else %} +

+ {{ _("No {0} batches").format(label|lower) }} +

+{% endif %} {% endmacro %} {% macro EmptyState() %} diff --git a/lms/www/batches/progress.html b/lms/www/batches/progress.html index 57921d3f..221264f7 100644 --- a/lms/www/batches/progress.html +++ b/lms/www/batches/progress.html @@ -8,7 +8,7 @@
{{ Header() }}
- {{ Progress(class_info, student) }} + {{ Progress(batch, student) }}
{% endblock %} @@ -22,12 +22,12 @@ {{ _("{0}").format(student.full_name) }}
- - {{ _("All Classes") }} + + {{ _("All Batches") }} - - {{ class_info.name }} + + {{ batch.name }} @@ -46,7 +46,7 @@ {% endif %} {% if is_moderator %} - + {{ _("Evaluate") }} {% endif %} @@ -57,9 +57,9 @@ {% endmacro %} -{% macro Progress(class_info, student) %} +{% macro Progress(batch, student) %} {{ UpcomingEvals(upcoming_evals) }} - {{ Assessments(class_info, student) }} + {{ Assessments(batch, student) }} {% endmacro %} {% macro UpcomingEvals(upcoming_evals) %} @@ -68,7 +68,7 @@
{% endmacro %} -{% macro Assessments(class_info, student) %} +{% macro Assessments(batch, student) %}
{% include "lms/templates/assessments.html" %}
@@ -84,7 +84,7 @@ "can_read": ["LMS Course"] }; let courses = {{ courses | json }}; - let class_name = "{{ class_info.name }}"; + let batch_name = "{{ batch.name }}"; {{ include_script('controls.bundle.js') }} {% endblock %} \ No newline at end of file diff --git a/lms/www/batches/progress.py b/lms/www/batches/progress.py index d7121be5..9f6c29ee 100644 --- a/lms/www/batches/progress.py +++ b/lms/www/batches/progress.py @@ -12,7 +12,7 @@ def get_context(context): context.no_cache = 1 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_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.")) - context.class_info = frappe.db.get_value( - "LMS Batch", class_name, ["name"], as_dict=True - ) + context.batch = frappe.db.get_value("LMS Batch", batch_name, ["name"], as_dict=True) 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) diff --git a/lms/www/billing/billing.html b/lms/www/billing/billing.html index 56e693e1..72643285 100644 --- a/lms/www/billing/billing.html +++ b/lms/www/billing/billing.html @@ -30,7 +30,7 @@
- {% set label = "Course Name" if module == "course" else "Class Name" %} + {% set label = "Course Name" if module == "course" else "Batch Name" %} {{ _(label) }} : {{ title }}
diff --git a/lms/www/billing/billing.py b/lms/www/billing/billing.py index ec37ae9c..11fe243d 100644 --- a/lms/www/billing/billing.py +++ b/lms/www/billing/billing.py @@ -9,7 +9,7 @@ def get_context(context): if frappe.session.user == "Guest": 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.")) 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} ) 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": course = frappe.db.get_value( @@ -50,18 +50,18 @@ def get_context(context): context.currency = course.currency else: - class_info = frappe.db.get_value( + batch = frappe.db.get_value( "LMS Batch", docname, - ["title", "name", "paid_class", "amount", "currency"], + ["title", "name", "paid_batch", "amount", "currency"], as_dict=True, ) - if not class_info.paid_class: + if not batch.paid_batch: 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.amount = class_info.amount - context.currency = class_info.currency + context.title = batch.title + context.amount = batch.amount + context.currency = batch.currency diff --git a/lms/www/certified_participants/certified_participants.html b/lms/www/certified_participants/certified_participants.html new file mode 100644 index 00000000..6435afb8 --- /dev/null +++ b/lms/www/certified_participants/certified_participants.html @@ -0,0 +1,35 @@ +{% extends "lms/templates/lms_base.html" %} +{% block title %} + {{ _("Certified Participants") }} +{% endblock %} + +{% block page_content %} +
+
+
+
+ {{ _("Certified Participants") }} +
+
+ {{ ParticipantsList() }} +
+
+{% endblock %} + +{% macro ParticipantsList() %} +
+ {% for participant in participants %} +
+ {{ widgets.Avatar(member=participant, avatar_class="avatar-large") }} +
+ {{ participant.full_name }} +
+ {% for course in participant.courses %} +
+ {{ course }} +
+ {% endfor %} +
+ {% endfor %} +
+{% endmacro %} \ No newline at end of file diff --git a/lms/www/certified_participants/certified_participants.py b/lms/www/certified_participants/certified_participants.py new file mode 100644 index 00000000..a0602219 --- /dev/null +++ b/lms/www/certified_participants/certified_participants.py @@ -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 diff --git a/lms/www/courses/index.html b/lms/www/courses/index.html index bb7ae213..52ea23f7 100644 --- a/lms/www/courses/index.html +++ b/lms/www/courses/index.html @@ -48,15 +48,15 @@ {% endif %} - {% if show_creators_section %} - - {{ _("Create a Course") }} - - {% endif %} - {{ _("Search") }} (Ctrl + k) + + {% if show_creators_section %} + + {{ _("Create a Course") }} + + {% endif %}
diff --git a/lms/www/profiles/profile.html b/lms/www/profiles/profile.html index 640493db..40127207 100644 --- a/lms/www/profiles/profile.html +++ b/lms/www/profiles/profile.html @@ -65,8 +65,8 @@
{{ About(member) }} - {{ EducationDetails(member) }} {{ WorkDetails(member) }} + {{ EducationDetails(member) }} {{ ExternalCertification(member) }} {{ Contact(member) }} {{ Skills(member) }} @@ -171,7 +171,7 @@ {% macro CoursesMentored(member, read_only) %} {% if member.get_mentored_courses() | length %}
-
{{ _("Courses Mentored") }}
+
{{ _("Courses Mentored") }}
{% for course in member.get_mentored_courses() %} {{ widgets.CourseCard(course=course, read_only=read_only) }} @@ -202,7 +202,7 @@ {% if has_course_moderator_role() %}
-
{{ _("Role Settings") }}
+
{{ _("Role Settings") }}