From 4f97760e8a2600413667c347b54ad4715c4e06d2 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 26 Sep 2023 22:40:00 +0530 Subject: [PATCH] fix: billing flow issues --- .../lms_certificate_evaluation.json | 23 ++++++++++++++++--- lms/www/billing/billing.html | 2 +- lms/www/billing/billing.js | 12 ++++++---- lms/www/billing/billing.py | 6 +++-- 4 files changed, 33 insertions(+), 10 deletions(-) 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 eb66ee71..998ce8bc 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json @@ -84,7 +84,7 @@ "fieldname": "status", "fieldtype": "Select", "label": "Status", - "options": "Pass\nFail", + "options": "Pending\nIn Progress\nPass\nFail", "reqd": 1 }, { @@ -106,7 +106,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-08-23 14:51:21.947169", + "modified": "2023-09-26 19:44:43.594892", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Evaluation", @@ -139,6 +139,23 @@ ], "sort_field": "modified", "sort_order": "DESC", - "states": [], + "states": [ + { + "color": "Green", + "title": "Pass" + }, + { + "color": "Red", + "title": "Fail" + }, + { + "color": "Blue", + "title": "Pending" + }, + { + "color": "Orange", + "title": "In Progress" + } + ], "title_field": "member_name" } \ No newline at end of file diff --git a/lms/www/billing/billing.html b/lms/www/billing/billing.html index bf1c1213..b97ca3b3 100644 --- a/lms/www/billing/billing.html +++ b/lms/www/billing/billing.html @@ -42,7 +42,7 @@ {% if gst_applied %} - + {{ _("18% GST included") }} {% endif %} diff --git a/lms/www/billing/billing.js b/lms/www/billing/billing.js index 5a5bc8a2..3be9b310 100644 --- a/lms/www/billing/billing.js +++ b/lms/www/billing/billing.js @@ -105,7 +105,7 @@ const setup_billing = () => { }; const generate_payment_link = (e) => { - address = this.billing.get_values(); + let new_address = this.billing.get_values(); let doctype = $(e.currentTarget).attr("data-doctype"); let docname = decodeURIComponent($(e.currentTarget).attr("data-name")); @@ -114,8 +114,8 @@ const generate_payment_link = (e) => { args: { doctype: doctype, docname: docname, - phone: address.phone, - country: address.country, + phone: new_address.phone, + country: new_address.country, }, callback: (data) => { data.message.handler = (response) => { @@ -123,7 +123,7 @@ const generate_payment_link = (e) => { response, doctype, docname, - address, + new_address, data.message.order_id ); }; @@ -156,6 +156,7 @@ const handle_success = (response, doctype, docname, address, order_id) => { }; const change_currency = () => { + $("#gst-message").removeClass("hide"); let country = this.billing.get_value("country"); if (exception_country.includes(country)) { update_price(original_price_formatted); @@ -173,6 +174,9 @@ const change_currency = () => { if (current_price != data.message) { update_price(data.message); } + if (!data.message.includes("INR")) { + $("#gst-message").addClass("hide"); + } }, }); }; diff --git a/lms/www/billing/billing.py b/lms/www/billing/billing.py index 9c6c49ca..ad1d45d3 100644 --- a/lms/www/billing/billing.py +++ b/lms/www/billing/billing.py @@ -14,8 +14,7 @@ def get_context(context): validate_access(doctype, docname, module) get_billing_details(context) - context.original_amount = context.amount - context.original_currency = context.currency + context.exception_country = frappe.get_all( "Payment Country", filters={"parent": "LMS Settings"}, pluck="country" ) @@ -28,6 +27,9 @@ def get_context(context): if context.currency == "INR": context.amount, context.gst_applied = apply_gst(context.amount, None) + context.original_amount = context.amount + context.original_currency = context.currency + def validate_access(doctype, docname, module): if frappe.session.user == "Guest":