3.6 KiB
3.6 KiB
Plan: Event Proposal Public Form
Context
Event Proposal DocType exists but is only accessible via the Frappe desk. We want a public-facing form at /dashboard/event-proposal that anyone can submit, controlled by a toggle in Pohodex Event Manager Settings.
Changes
1. Pohodex Event Manager Settings DocType
File: event_manager/events/doctype/buzz_settings/buzz_settings.json
Add a new Proposals Tab Break (before Communications tab) with:
| Field | Type | Notes |
|---|---|---|
proposals_tab |
Tab Break | Label: "Proposals" |
event_proposals_section |
Section Break | Label: "Event Proposals" |
accept_event_proposals |
Check | Label: "Accept Event Proposals", default 0 |
allow_guest_event_proposals |
Check | Label: "Allow Guest Submission", depends_on: eval:doc.accept_event_proposals, default 0 |
event_proposal_success_message |
Markdown Editor | depends_on: eval:doc.accept_event_proposals, Label: "Success Message" |
2. Backend API
File: event_manager/api/forms.py
2a. Add EVENT_PROPOSAL_EXCLUDE_FIELDS
EVENT_PROPOSAL_EXCLUDE_FIELDS = STANDARD_EXCLUDE_FIELDS | {
"naming_series",
"amended_from",
"host",
}
status and submitted_by are already in STANDARD_EXCLUDE_FIELDS.
2b. get_event_proposal_form_data() — whitelist, allow_guest
- Read
Pohodex Event Manager Settings— ifaccept_event_proposalsis falsy, throw DoesNotExistError - If guest not allowed and user is Guest, throw AuthenticationError
- Call
get_form_fields("Event Proposal", EVENT_PROPOSAL_EXCLUDE_FIELDS) - Read success message from settings
- Return
{form_fields, form_title, success_title, success_message, closed}
2c. submit_event_proposal(data) — whitelist, allow_guest
- Same settings + guest check
- Parse data via
frappe.parse_json - Build doc from allowed fields only (filter through
get_form_fields) frappe.get_doc(doc_data).insert(ignore_permissions=True)
3. Frontend Route
File: dashboard/src/router.ts
Add route:
{
path: "/event-proposal",
name: "event-proposal",
meta: { isPublic: true },
component: () => import("@/pages/EventProposalForm.vue"),
}
4. New Page: EventProposalForm.vue
File: dashboard/src/pages/EventProposalForm.vue
Slimmed-down version of BaseCustomEventForm:
- No
eventRoute/formRouteprops - No
EventDetailsHeader - No
CustomFieldsSection - Calls
get_event_proposal_form_dataon mount - Submits to
submit_event_proposal - Reuses
CustomFieldInputfor field rendering - Reuses table dialog pattern for Table fields
- Shows success/closed/error states same as BaseCustomEventForm
Files Summary
| File | Action | Change |
|---|---|---|
event_manager/events/doctype/buzz_settings/buzz_settings.json |
Modify | Add Proposals tab with toggle + success message |
event_manager/api/forms.py |
Modify | Add 2 endpoints + exclude set |
dashboard/src/router.ts |
Modify | Add 1 route |
dashboard/src/pages/EventProposalForm.vue |
New | Public form page |
Implementation Order
- Update Pohodex Event Manager Settings JSON +
bench migrate - Add API endpoints in
event_manager/api/forms.py - Add route + create
EventProposalForm.vue - Test end-to-end
Verification
- Enable "Accept Event Proposals" in Pohodex Event Manager Settings
- Navigate to
/dashboard/event-proposal— form renders with Event Proposal fields (minus status, naming_series, amended_from, host) - Submit form — Event Proposal doc created with status "Received"
- Disable toggle — form shows not found
- Check success message renders after submission