From ed0e8c9eec6467f6e23e0784173cfb13df9192f3 Mon Sep 17 00:00:00 2001 From: Rahul Agrawal <12agrawalrahul@gmail.com> Date: Mon, 11 May 2026 08:29:47 +0530 Subject: [PATCH] feat: add section break in event proposal --- buzz/api/forms.py | 13 ++++- .../event_proposal/event_proposal.json | 11 +--- dashboard/src/pages/EventProposalForm.vue | 55 ++++++++++++++++--- 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/buzz/api/forms.py b/buzz/api/forms.py index d04c3268..8eb95ff6 100644 --- a/buzz/api/forms.py +++ b/buzz/api/forms.py @@ -8,6 +8,7 @@ from frappe.utils.data import cstr, sbool LAYOUT_FIELDTYPES = set(display_fieldtypes) +LAYOUT_BREAK_FIELDTYPES = {"Column Break", "Section Break"} EVENT_PROPOSAL_EXCLUDE_FIELDS = DEFAULT_FIELDS | { "naming_series", @@ -49,13 +50,21 @@ def _get_dial_codes() -> list: return codes -def get_form_fields(doctype: str, exclude_fields: set) -> list: +def get_form_fields(doctype: str, exclude_fields: set, with_layout_breaks: bool = False) -> list: meta = frappe.get_meta(doctype) fields = [] for df in meta.fields: if df.fieldname in exclude_fields: continue if df.fieldtype in LAYOUT_FIELDTYPES: + if with_layout_breaks and df.fieldtype in LAYOUT_BREAK_FIELDTYPES: + fields.append( + { + "fieldname": df.fieldname, + "fieldtype": df.fieldtype, + "label": df.label or "", + } + ) continue if df.hidden: continue @@ -306,7 +315,7 @@ def validate_event_proposal_settings(): @frappe.whitelist(allow_guest=True) # nosemgrep: frappe-semgrep-rules.rules.security.guest-whitelisted-method def get_event_proposal_form_data() -> dict: settings = validate_event_proposal_settings() - form_fields = get_form_fields("Event Proposal", EVENT_PROPOSAL_EXCLUDE_FIELDS) + form_fields = get_form_fields("Event Proposal", EVENT_PROPOSAL_EXCLUDE_FIELDS, with_layout_breaks=True) return { "form_fields": form_fields, diff --git a/buzz/proposals/doctype/event_proposal/event_proposal.json b/buzz/proposals/doctype/event_proposal/event_proposal.json index 97e6d722..b91b1eb1 100644 --- a/buzz/proposals/doctype/event_proposal/event_proposal.json +++ b/buzz/proposals/doctype/event_proposal/event_proposal.json @@ -7,10 +7,10 @@ "engine": "InnoDB", "field_order": [ "title", - "category", "free_webinar", - "medium", "column_break_bixo", + "category", + "medium", "status", "naming_series", "section_break_psfj", @@ -21,7 +21,6 @@ "end_time", "section_break_zajc", "short_description", - "column_break_yxbj", "about", "host_tab", "host", @@ -128,10 +127,6 @@ "label": "About the event", "reqd": 1 }, - { - "fieldname": "column_break_yxbj", - "fieldtype": "Column Break" - }, { "fieldname": "short_description", "fieldtype": "Small Text", @@ -178,7 +173,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-12-11 11:36:40.618179", + "modified": "2026-05-11 07:52:43.388259", "modified_by": "Administrator", "module": "Proposals", "name": "Event Proposal", diff --git a/dashboard/src/pages/EventProposalForm.vue b/dashboard/src/pages/EventProposalForm.vue index 3c3f4432..7f4182b2 100644 --- a/dashboard/src/pages/EventProposalForm.vue +++ b/dashboard/src/pages/EventProposalForm.vue @@ -37,14 +37,29 @@ -
- +
+
+
+ +
+
@@ -96,6 +111,30 @@ const rendered_success_message = computed(() => { return marked(msg); }); +const field_sections = computed(() => { + const fields = form_data.value?.form_fields || []; + const sections = []; + let current_section = [[]]; + for (const field of fields) { + if (field.fieldtype === "Section Break") { + if (current_section.some((col) => col.length)) { + sections.push(current_section); + } + current_section = [[]]; + continue; + } + if (field.fieldtype === "Column Break") { + current_section.push([]); + continue; + } + current_section[current_section.length - 1].push(field); + } + if (current_section.some((col) => col.length)) { + sections.push(current_section); + } + return sections; +}); + const form_data_resource = createResource({ url: "buzz.api.forms.get_event_proposal_form_data", auto: true,