diff --git a/lms/lms/doctype/lms_batch/lms_batch.json b/lms/lms/doctype/lms_batch/lms_batch.json index beb3c22a..4cdb1e0a 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.json +++ b/lms/lms/doctype/lms_batch/lms_batch.json @@ -29,13 +29,6 @@ "section_break_jgji", "students", "courses", - "section_break_gsac", - "paid_batch", - "column_break_iens", - "amount", - "currency", - "section_break_ubxi", - "custom_component", "assessment_tab", "assessment", "schedule_tab", @@ -43,7 +36,18 @@ "column_break_anya", "show_live_class", "section_break_ontp", - "timetable" + "timetable", + "pricing_tab", + "section_break_gsac", + "paid_batch", + "column_break_iens", + "amount", + "currency", + "customisations_tab", + "section_break_ubxi", + "custom_component", + "column_break_pxgb", + "custom_script" ], "fields": [ { @@ -94,10 +98,9 @@ "reqd": 1 }, { - "description": "The HTML code entered here will be displayed on the batch details page.", "fieldname": "custom_component", "fieldtype": "Code", - "label": "Custom Component", + "label": "Custom HTML", "options": "HTML" }, { @@ -155,6 +158,7 @@ "options": "LMS Category" }, { + "description": "These customisations will work on the main batch page.", "fieldname": "section_break_ubxi", "fieldtype": "Section Break" }, @@ -165,8 +169,7 @@ }, { "fieldname": "section_break_gsac", - "fieldtype": "Section Break", - "label": "Pricing" + "fieldtype": "Section Break" }, { "fieldname": "column_break_iens", @@ -240,11 +243,31 @@ "fieldname": "meta_image", "fieldtype": "Attach Image", "label": "Meta Image" + }, + { + "fieldname": "column_break_pxgb", + "fieldtype": "Column Break" + }, + { + "fieldname": "customisations_tab", + "fieldtype": "Tab Break", + "label": "Customisations" + }, + { + "fieldname": "pricing_tab", + "fieldtype": "Tab Break", + "label": "Pricing" + }, + { + "fieldname": "custom_script", + "fieldtype": "Code", + "label": "Custom Script (JavaScript)", + "options": "Javascript" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-09-27 18:42:53.301107", + "modified": "2023-09-28 12:18:34.418812", "modified_by": "Administrator", "module": "LMS", "name": "LMS Batch", diff --git a/lms/www/batches/batch.html b/lms/www/batches/batch.html index bbfa676c..92700499 100644 --- a/lms/www/batches/batch.html +++ b/lms/www/batches/batch.html @@ -77,7 +77,9 @@ {% if batch_info.custom_component %} - {{ batch_info.custom_component }} +
+ {{ batch_info.custom_component }} +
{% endif %} {% endmacro %} @@ -150,6 +152,9 @@ {% endif %} + {% if custom_tabs_header %} + {% include custom_tabs_header %} + {% endif %}
@@ -192,6 +197,10 @@ {% endif %} + {% if custom_tabs_content %} + {% include custom_tabs_content %} + {% endif %} + {% endmacro %} @@ -202,17 +211,19 @@ {% set assessments = current_student.assessments %} {% set student = current_student %} -{% if student.name == frappe.session.user %} - -{% endif %} +
+ {% if student.name == frappe.session.user %} + + {% endif %} -
- {% include "lms/templates/upcoming_evals.html" %} -
-
- {% include "lms/templates/assessments.html" %} +
+ {% include "lms/templates/upcoming_evals.html" %} +
+
+ {% include "lms/templates/assessments.html" %} +
{% endmacro %} @@ -421,7 +432,7 @@ {{ CreateLiveClass(batch_info) }} {{ LiveClassList(batch_info, live_classes) }} -
+ {% endmacro %} @@ -547,10 +558,17 @@ {%- block script %} {{ super() }} + {% if batch_info.custom_script %} + + {% endif %} + + {% endblock %} \ No newline at end of file diff --git a/lms/www/batches/batch.py b/lms/www/batches/batch.py index 15d1b9d4..f3b31d90 100644 --- a/lms/www/batches/batch.py +++ b/lms/www/batches/batch.py @@ -32,6 +32,7 @@ def get_context(context): "description", "medium", "custom_component", + "custom_script", "seat_count", "start_time", "end_time", @@ -97,6 +98,13 @@ def get_context(context): ) context.legends = get_legends() + custom_tabs = frappe.get_hooks("lms_batch_tabs") + + if custom_tabs: + context.custom_tabs_header = (custom_tabs.get("header_html")[0],) + context.custom_tabs_content = (custom_tabs.get("content_html")[0],) + context.update(frappe.get_attr(custom_tabs.get("context")[0])()) + def get_all_quizzes(batch_name): filters = {} if has_course_moderator_role() else {"owner": frappe.session.user}