feat: batch meta and raw details

This commit is contained in:
Jannat Patel
2023-09-27 19:21:57 +05:30
parent 5614a6203f
commit 0fcea692c7
5 changed files with 59 additions and 1 deletions

View File

@@ -22,7 +22,11 @@
"seat_count", "seat_count",
"section_break_6", "section_break_6",
"description", "description",
"batch_details_raw",
"column_break_hlqw",
"batch_details", "batch_details",
"meta_image",
"section_break_jgji",
"students", "students",
"courses", "courses",
"section_break_gsac", "section_break_gsac",
@@ -218,11 +222,29 @@
{ {
"fieldname": "section_break_ontp", "fieldname": "section_break_ontp",
"fieldtype": "Section Break" "fieldtype": "Section Break"
},
{
"fieldname": "batch_details_raw",
"fieldtype": "HTML Editor",
"label": "Batch Details Raw"
},
{
"fieldname": "column_break_hlqw",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_jgji",
"fieldtype": "Section Break"
},
{
"fieldname": "meta_image",
"fieldtype": "Attach Image",
"label": "Meta Image"
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2023-09-20 14:40:45.940540", "modified": "2023-09-27 18:42:53.301107",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "LMS Batch", "name": "LMS Batch",

View File

@@ -194,6 +194,8 @@ def create_batch(
end_date, end_date,
description=None, description=None,
batch_details=None, batch_details=None,
batch_details_raw=None,
meta_image=None,
seat_count=0, seat_count=0,
start_time=None, start_time=None,
end_time=None, end_time=None,
@@ -218,6 +220,8 @@ def create_batch(
"end_date": end_date, "end_date": end_date,
"description": description, "description": description,
"batch_details": batch_details, "batch_details": batch_details,
"batch_details_raw": batch_details_raw,
"image": meta_image,
"seat_count": seat_count, "seat_count": seat_count,
"start_time": start_time, "start_time": start_time,
"end_time": end_time, "end_time": end_time,

View File

@@ -340,6 +340,18 @@ const open_batch_dialog = () => {
default: batch_info && batch_info.batch_details, default: batch_info && batch_info.batch_details,
reqd: 1, reqd: 1,
}, },
{
fieldtype: "HTML Editor",
label: __("Batch Details Raw"),
fieldname: "batch_details_raw",
default: batch_info && batch_info.batch_details_raw,
},
{
fieldtype: "Attach Image",
label: __("Meta Image"),
fieldname: "meta_image",
default: batch_info && batch_info.image,
},
{ {
fieldtype: "Section Break", fieldtype: "Section Break",
label: __("Pricing"), label: __("Pricing"),

View File

@@ -14,6 +14,7 @@
{{ CourseList(courses) }} {{ CourseList(courses) }}
</div> </div>
</div> </div>
{{ BatchDetailsRaw() }}
</div> </div>
{% endblock %} {% endblock %}
@@ -216,6 +217,15 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% macro BatchDetailsRaw() %}
{% if batch_info.batch_details_raw %}
<div class="mt-10 pt-10">
{{ batch_info.batch_details_raw }}
</div>
{% endif %}
{% endmacro %}
{%- block script %} {%- block script %}
{{ super() }} {{ super() }}
{% if is_moderator %} {% if is_moderator %}

View File

@@ -29,6 +29,8 @@ def get_context(context):
"end_time", "end_time",
"seat_count", "seat_count",
"published", "published",
"meta_image",
"batch_details_raw",
], ],
as_dict=1, as_dict=1,
) )
@@ -67,3 +69,11 @@ def get_context(context):
context.student_count = frappe.db.count("Batch Student", {"parent": batch_name}) context.student_count = frappe.db.count("Batch Student", {"parent": batch_name})
context.seats_left = context.batch_info.seat_count - context.student_count context.seats_left = context.batch_info.seat_count - context.student_count
context.metatags = {
"title": context.batch_info.title,
"image": context.batch_info.meta_image,
"description": context.batch_info.description,
"keywords": context.batch_info.title,
"og:type": "website",
}