diff --git a/lms/lms/doctype/course_evaluator/course_evaluator.js b/lms/lms/doctype/course_evaluator/course_evaluator.js index eb893de9..dd14d6e0 100644 --- a/lms/lms/doctype/course_evaluator/course_evaluator.js +++ b/lms/lms/doctype/course_evaluator/course_evaluator.js @@ -2,5 +2,13 @@ // For license information, please see license.txt frappe.ui.form.on('Course Evaluator', { - + onload: (frm) => { + frm.set_query('evaluator', function(doc) { + return { + filters: { + "ignore_user_type": 1, + } + }; + }); + } }); diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.js b/lms/lms/doctype/lms_certificate/lms_certificate.js index c8a688a5..6a341a63 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.js +++ b/lms/lms/doctype/lms_certificate/lms_certificate.js @@ -2,13 +2,13 @@ // For license information, please see license.txt frappe.ui.form.on('LMS Certificate', { - onload: function (frm) { - frm.set_query("student", function (doc) { - return { - filters: { - "ignore_user_type": 1, - } - }; - }); - } + onload: function (frm) { + frm.set_query("member", function (doc) { + return { + filters: { + "ignore_user_type": 1, + } + }; + }); + } }); diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.json b/lms/lms/doctype/lms_certificate/lms_certificate.json index 16cc15b8..91ec1085 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.json +++ b/lms/lms/doctype/lms_certificate/lms_certificate.json @@ -7,6 +7,7 @@ "field_order": [ "course", "member", + "member_name", "column_break_3", "issue_date", "expiry_date" @@ -44,11 +45,18 @@ "label": "Member", "options": "User", "reqd": 1 + }, + { + "fetch_from": "member.full_name", + "fieldname": "member_name", + "fieldtype": "Data", + "label": "Member Name", + "read_only": 1 } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-04-05 14:19:34.409244", + "modified": "2022-04-06 11:49:36.077370", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate", @@ -70,6 +78,6 @@ "sort_field": "modified", "sort_order": "DESC", "states": [], - "title_field": "member", + "title_field": "member_name", "track_changes": 1 -} +} \ No newline at end of file diff --git a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.js b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.js index 752c06e7..b10da907 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.js +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.js @@ -20,5 +20,13 @@ frappe.ui.form.on('LMS Certificate Evaluation', { } }; }); + + frm.set_query('member', function(doc) { + return { + filters: { + "ignore_user_type": 1, + } + }; + }); } }); diff --git a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json index 70f5b3ae..e2413f9e 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json @@ -8,6 +8,7 @@ "field_order": [ "course", "member", + "member_name", "date", "start_time", "end_time", @@ -28,7 +29,6 @@ { "fieldname": "member", "fieldtype": "Link", - "in_list_view": 1, "in_standard_filter": 1, "label": "Member", "options": "User", @@ -68,11 +68,18 @@ "fieldname": "end_time", "fieldtype": "Time", "label": "End Time" + }, + { + "fetch_from": "member.full_name", + "fieldname": "member_name", + "fieldtype": "Data", + "label": "Member Name", + "read_only": 1 } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-04-01 16:26:39.168390", + "modified": "2022-04-06 11:44:17.051279", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Evaluation", @@ -93,5 +100,6 @@ ], "sort_field": "modified", "sort_order": "DESC", - "states": [] + "states": [], + "title_field": "member_name" } \ No newline at end of file diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.js b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.js index b491e032..24d6ef31 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.js +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.js @@ -9,5 +9,15 @@ frappe.ui.form.on('LMS Certificate Request', { frm: frm }); }); + }, + + onload: function(frm) { + frm.set_query('member', function(doc) { + return { + filters: { + "ignore_user_type": 1, + } + }; + }); } }); diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json index 94b71090..cbe66fb9 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json @@ -8,6 +8,7 @@ "field_order": [ "course", "member", + "member_name", "evaluator", "column_break_4", "date", @@ -72,11 +73,18 @@ { "fieldname": "column_break_4", "fieldtype": "Column Break" + }, + { + "fetch_from": "member.full_name", + "fieldname": "member_name", + "fieldtype": "Data", + "label": "Member Name", + "read_only": 1 } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-04-01 15:29:31.553492", + "modified": "2022-04-06 11:33:33.711545", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Request", @@ -97,5 +105,6 @@ ], "sort_field": "modified", "sort_order": "DESC", - "states": [] + "states": [], + "title_field": "member_name" } \ No newline at end of file diff --git a/lms/lms/doctype/lms_course/lms_course.json b/lms/lms/doctype/lms_course/lms_course.json index f4f50ce5..76cfcb11 100644 --- a/lms/lms/doctype/lms_course/lms_course.json +++ b/lms/lms/doctype/lms_course/lms_course.json @@ -36,9 +36,12 @@ "enable_certification", "expiry", "column_break_22", - "paid_certificate", "grant_certificate_after", - "evaluator" + "evaluator", + "pricing_section", + "paid_certificate", + "currency", + "price_certificate" ], "fields": [ { @@ -189,6 +192,25 @@ "fieldtype": "Link", "label": "Evaluator", "options": "Course Evaluator" + }, + { + "depends_on": "eval: doc.grant_certificate_after == \"Evaluation\"", + "fieldname": "pricing_section", + "fieldtype": "Section Break", + "label": "Pricing" + }, + { + "depends_on": "paid_certificate", + "fieldname": "price_certificate", + "fieldtype": "Currency", + "label": "Certificate Price" + }, + { + "depends_on": "paid_certificate", + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "options": "Currency" } ], "is_published_field": "published", @@ -214,7 +236,7 @@ "link_fieldname": "course" } ], - "modified": "2022-04-01 15:19:13.075063", + "modified": "2022-04-07 12:27:05.353788", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", diff --git a/lms/lms/widgets/CourseCard.html b/lms/lms/widgets/CourseCard.html index 28d7ee8f..01b1cdf8 100644 --- a/lms/lms/widgets/CourseCard.html +++ b/lms/lms/widgets/CourseCard.html @@ -60,12 +60,18 @@
- {{ progress }} Complete + {{ progress }} {{ _("Complete") }}
-
{{ progress }}% Completed
+
{{ progress }}% {{ _("Completed") }}
{% endif %} + {% if course.paid_certificate %} +
+ {{ _("Certificate Price: ") }} {{ frappe.utils.fmt_money(course.price_certificate, 2, course.currency) }} +
+ {% endif %} +
{{ member.full_name }}
-
{{ _("has successfully completed the course on") }}
+
{{ _("has successfully completed the course on") }}
{{ course.title }}
{% if certificate_request %} -

{{ _("Evaluation On") }} - {{ _(": {0} at {1}").format(frappe.utils.format_date(certificate_request.date, "medium"), +

{{ _("Evaluation On: ") }} + {{ _("{0} at {1}").format(frappe.utils.format_date(certificate_request.date, "medium"), frappe.utils.format_time(certificate_request.start_time, "short")) }}

{% endif %} @@ -131,7 +131,7 @@ {% endif %} -
+
@@ -151,6 +151,12 @@ {% endif %}
+ {% if course.paid_certificate %} +
+ {{ _("Certificate Price:") }} {{ frappe.utils.fmt_money(course.price_certificate, 2, course.currency) }} +
+ {% endif %} + {% set lesson_index = get_lesson_index(membership.current_lesson) if membership and membership.current_lesson else '1.1' %} @@ -173,12 +179,6 @@ {{ _("Checkout Course") }} - {% elif membership %} - - {{ _("Continue Learning") }} - - {% elif course.upcoming and not is_user_interested %}
@@ -191,6 +191,12 @@ style="color: inherit;"> {{ _("Manage the course") }} + + {% elif membership %} + + {{ _("Continue Learning") }} + {% endif %} {% set certificate = is_certified(course.name) %} @@ -210,6 +216,7 @@
{% endif %} {% endif %} +
diff --git a/lms/www/courses/course.py b/lms/www/courses/course.py index 406bc812..283fd56c 100644 --- a/lms/www/courses/course.py +++ b/lms/www/courses/course.py @@ -12,8 +12,8 @@ def get_context(context): raise frappe.Redirect course = frappe.db.get_value("LMS Course", course_name, - ["name", "title", "image", "short_introduction", "description", "published", "upcoming", - "disable_self_learning", "video_link", "enable_certification", "status", "grant_certificate_after"], + ["name", "title", "image", "short_introduction", "description", "published", "upcoming", "disable_self_learning", "status", + "video_link", "enable_certification", "grant_certificate_after", "paid_certificate", "price_certificate", "currency"], as_dict=True) related_courses = frappe.get_all("Related Courses", {"parent": course.name}, ["course"]) diff --git a/lms/www/courses/index.py b/lms/www/courses/index.py index 3c6c7c96..f35b3cc7 100644 --- a/lms/www/courses/index.py +++ b/lms/www/courses/index.py @@ -15,7 +15,8 @@ def get_context(context): def get_courses(): courses = frappe.get_all("LMS Course", filters={"published": True}, - fields=["name", "upcoming", "title", "image", "enable_certification"]) + fields=["name", "upcoming", "title", "image", "enable_certification", + "paid_certificate", "price_certificate", "currency"]) live_courses, upcoming_courses = [], [] for course in courses: diff --git a/lms/www/utils.py b/lms/www/utils.py index 3e99530c..81228e4e 100644 --- a/lms/www/utils.py +++ b/lms/www/utils.py @@ -9,7 +9,7 @@ def get_common_context(context): batch_name = None course = frappe.db.get_value("LMS Course", - frappe.form_dict["course"], ["name", "title", "video_link"], as_dict=True) + frappe.form_dict["course"], ["name", "title", "video_link", "enable_certification"], as_dict=True) if not course: context.template = "www/404.html" return