diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py index 7cc082a4..2d56bd63 100644 --- a/lms/lms/doctype/lms_course/lms_course.py +++ b/lms/lms/doctype/lms_course/lms_course.py @@ -5,7 +5,7 @@ import json import random import frappe from frappe.model.document import Document -from frappe.utils import cint +from frappe.utils import cint, validate_phone_number from frappe.utils.telemetry import capture from lms.lms.utils import get_chapters, can_create_courses from ...utils import generate_slug, validate_image @@ -213,6 +213,9 @@ def save_course( published, upcoming, image=None, + paid_course=False, + course_price=None, + currency=None, ): if not can_create_courses(): return @@ -232,6 +235,9 @@ def save_course( "tags": tags, "published": cint(published), "upcoming": cint(upcoming), + "paid_course": cint(paid_course), + "course_price": course_price, + "currency": currency, } ) doc.save(ignore_permissions=True) @@ -360,6 +366,7 @@ def reorder_chapter(chapter_array): @frappe.whitelist() def get_payment_options(course, phone): + validate_phone_number(phone, True) course_details = frappe.db.get_value( "LMS Course", course, ["name", "title", "currency", "course_price"], as_dict=True ) diff --git a/lms/lms/utils.py b/lms/lms/utils.py index d472e6cf..0758d0c5 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -475,7 +475,7 @@ def get_evaluation_details(course, member=None): def format_amount(amount, currency): amount_reduced = amount / 1000 if amount_reduced < 1: - return amount + return fmt_money(amount, 0, currency) precision = 0 if amount % 1000 == 0 else 1 return _("{0}k").format(fmt_money(amount_reduced, precision, currency)) diff --git a/lms/public/css/style.css b/lms/public/css/style.css index c3768a6c..823b9e52 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -421,7 +421,7 @@ input[type=checkbox] { } .course-price { - font-weight: 700; + font-weight: 500; } .view-course-link { diff --git a/lms/templates/reviews_cta.html b/lms/templates/reviews_cta.html index 73bd63a7..dfb06f44 100644 --- a/lms/templates/reviews_cta.html +++ b/lms/templates/reviews_cta.html @@ -2,7 +2,7 @@ {{ _("Write a review") }} -{% elif not is_instructor(course.name) and frappe.session.user == "Guest" %} +{% elif not is_instructor and frappe.session.user == "Guest" %} {{ _("Write a review") }} diff --git a/lms/www/billing/__init__.py b/lms/www/billing/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lms/www/billing/billing.html b/lms/www/billing/billing.html index 373461d9..31e84e04 100644 --- a/lms/www/billing/billing.html +++ b/lms/www/billing/billing.html @@ -15,7 +15,7 @@ {% endblock %} {% macro Header() %} -