Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion buzz/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,10 @@ def create_cancellation_request(booking_id: str, ticket_ids: list | None = None)
@frappe.whitelist(allow_guest=True) # nosemgrep: frappe-semgrep-rules.rules.security.guest-whitelisted-method
def get_user_info() -> dict:
if frappe.session.user == "Guest":
return {"is_logged_in": False}
return {
"is_logged_in": False,
"brand_image": frappe.get_cached_value("Website Settings", "Website Settings", "banner_image"),
}

user = frappe.get_cached_doc("User", frappe.session.user)

Expand Down
13 changes: 11 additions & 2 deletions buzz/api/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion buzz/events/doctype/event_category/event_category.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"description",
"column_break_mrmh",
"banner_image",
"meta_image",
"icon_svg"
],
"fields": [
Expand Down Expand Up @@ -45,6 +46,11 @@
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description"
},
{
"fieldname": "meta_image",
"fieldtype": "Attach Image",
"label": "Meta Image"
}
],
"grid_page_length": 50,
Expand All @@ -56,7 +62,7 @@
"link_fieldname": "event_category"
}
],
"modified": "2026-01-07 14:41:57.312742",
"modified": "2026-05-08 12:38:57.139602",
"modified_by": "Administrator",
"module": "Events",
"name": "Event Category",
Expand Down
1 change: 1 addition & 0 deletions buzz/events/doctype/event_category/event_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class EventCategory(Document):
description: DF.SmallText | None
enabled: DF.Check
icon_svg: DF.Code | None
meta_image: DF.AttachImage | None
slug: DF.Data | None
# end: auto-generated types

Expand Down
11 changes: 3 additions & 8 deletions buzz/proposals/doctype/event_proposal/event_proposal.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"engine": "InnoDB",
"field_order": [
"title",
"category",
"free_webinar",
"medium",
"column_break_bixo",
"category",
"medium",
"status",
"naming_series",
"section_break_psfj",
Expand All @@ -21,7 +21,6 @@
"end_time",
"section_break_zajc",
"short_description",
"column_break_yxbj",
"about",
"host_tab",
"host",
Expand Down Expand Up @@ -128,10 +127,6 @@
"label": "About the event",
"reqd": 1
},
{
"fieldname": "column_break_yxbj",
"fieldtype": "Column Break"
},
{
"fieldname": "short_description",
"fieldtype": "Small Text",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/components/EventDetailsHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<!-- Banner Image -->
<div
v-if="eventDetails.banner_image"
class="relative w-full h-48 md:h-64 lg:h-80 rounded-lg overflow-hidden mb-6"
class="relative w-full rounded-lg overflow-hidden mb-6"
>
<img
:src="eventDetails.banner_image"
:alt="eventDetails.title"
class="w-full h-auto object-cover contrast-100 brightness-100"
class="w-full h-auto max-h-80 object-cover contrast-100 brightness-100"
/>
</div>

Expand Down
55 changes: 47 additions & 8 deletions dashboard/src/pages/EventProposalForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,29 @@
</h1>
</div>

<div class="p-6 space-y-4">
<CustomFieldInput
v-for="field in form_data.form_fields"
:key="field.fieldname"
:field="{ ...field, mandatory: field.reqd }"
:model-value="form_values[field.fieldname]"
@update:model-value="form_values[field.fieldname] = $event"
/>
<div class="p-6 space-y-6">
<div
v-for="(section, section_index) in field_sections"
:key="section_index"
class="grid gap-4"
:style="{
gridTemplateColumns: `repeat(${section.length}, minmax(0, 1fr))`,
}"
>
<div
v-for="(column, column_index) in section"
:key="column_index"
class="space-y-4"
>
<CustomFieldInput
v-for="field in column"
:key="field.fieldname"
:field="{ ...field, mandatory: field.reqd }"
:model-value="form_values[field.fieldname]"
@update:model-value="form_values[field.fieldname] = $event"
/>
</div>
</div>
</div>

<div class="px-6 pb-6">
Expand Down Expand Up @@ -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,
Expand Down
Loading