feat(admin): event form parity with the webapp (v1.6.1-aio.13) #46

Merged
padreug merged 1 commit from feat/admin-form-parity into main 2026-09-10 14:43:37 +00:00
Owner

Brings the LNbits admin "New Event" / "Update Event" dialog up to parity with the webapp's CreateEventDialog.vue (webapp dev). Based on main (pre-promo-codes, #45), so it can land independently of #44 and #45.

What was wrong

  • Payment-method checkboxes never rendered. c2d9a96 (aio.8) wired the template to paymentMethodOptions and acceptsFiat but never defined them in index.js, so the q-option-group got options=undefined and the fiat-currency select was gated on undefined. Every event created from this UI since aio.8 has been Lightning-only unless it was edited through the webapp.
  • No Location or Categories fields, although the model, CRUD and NIP-52 publisher already carry both.
  • Naive datetimes. The form sent YYYY-MM-DDTHH:MM; _to_unix treats that as UTC, so 18:00 CEST entered here was published as 18:00 UTC (the webapp already stamps the offset).
  • Everything was effectively required. The Create button's disable check compared undefined fields to null, so info, closing date, ticket count and price all had to be touched before Create lit up. The webapp requires only a title and a start date.

Changes (static/js/index.js, static/js/index.vue)

  • Payment methods: two q-checkbox rails (Lightning / Card). Card is disabled with a tooltip when g.user.fiat_providers is empty, and lists the configured providers otherwise. Same rule as the webapp's useFiatProviders.
  • Location input (NIP-52 location) and Categories multi-select with the same 25-item list as the webapp's category.ts (NIP-52 t).
  • withLocalTzOffset on submit, mirroring the webapp; the events table shows YYYY-MM-DD HH:MM instead of the raw ISO string.
  • Validation rules: title + start required, end ≥ start on the folded date+time (reactive-rules), fiat currency required when a sat-priced event accepts Card. Create needs only wallet + title + start; end date / closing date explain their backend defaults.
  • Labels per the payment-rails vocabulary: "Unit" → "Price currency", "Fiat checkout currency" → "Fiat currency".
  • Fiat-priced events mirror fiat_currency = currency on save (as the webapp does) so the tickets_fiat_currency tag stays coherent.

Prettier-clean (3.8.3). No backend changes, no migration.

Deliberately not in scope

  • Banner stays an image URL (no pict-rs in the LNbits shell).
  • The public event page (display.vue) still does not render location / categories; separate follow-up.
  • Version is aio.13 on the assumption #44 = aio.11 and #45 = aio.12 land first; renumber whichever merges last.

Manual check

  1. Open Events → New Event on an instance whose user has no fiat provider: Card is greyed with the tooltip, Lightning is ticked, Create enables after wallet + title + start date.
  2. On demo (Stripe configured): tick Card, untick Lightning, keep price in sats → "Fiat currency" select appears and is required; save and confirm extra.payment_methods == ["fiat"] and allow_fiat == true on GET /events/api/v1/events.
  3. Set location + two categories, save, re-open edit: values round-trip; the NIP-52 event carries location and t tags.
  4. Enter a start time, save, check event_start_date carries :00+02:00 and the table shows YYYY-MM-DD HH:MM.

🤖 Generated with Claude Code

https://claude.ai/code/session_018b1bDExMX7W3a47wcgFUjb

Brings the LNbits admin "New Event" / "Update Event" dialog up to parity with the webapp's `CreateEventDialog.vue` (webapp `dev`). Based on `main` (pre-promo-codes, #45), so it can land independently of #44 and #45. ## What was wrong - **Payment-method checkboxes never rendered.** `c2d9a96` (aio.8) wired the template to `paymentMethodOptions` and `acceptsFiat` but never defined them in `index.js`, so the `q-option-group` got `options=undefined` and the fiat-currency select was gated on `undefined`. Every event created from this UI since aio.8 has been Lightning-only unless it was edited through the webapp. - **No Location or Categories fields**, although the model, CRUD and NIP-52 publisher already carry both. - **Naive datetimes.** The form sent `YYYY-MM-DDTHH:MM`; `_to_unix` treats that as UTC, so 18:00 CEST entered here was published as 18:00 UTC (the webapp already stamps the offset). - **Everything was effectively required.** The Create button's disable check compared `undefined` fields to `null`, so info, closing date, ticket count and price all had to be touched before Create lit up. The webapp requires only a title and a start date. ## Changes (`static/js/index.js`, `static/js/index.vue`) - Payment methods: two `q-checkbox` rails (Lightning / Card). Card is disabled with a tooltip when `g.user.fiat_providers` is empty, and lists the configured providers otherwise. Same rule as the webapp's `useFiatProviders`. - Location input (NIP-52 `location`) and Categories multi-select with the same 25-item list as the webapp's `category.ts` (NIP-52 `t`). - `withLocalTzOffset` on submit, mirroring the webapp; the events table shows `YYYY-MM-DD HH:MM` instead of the raw ISO string. - Validation rules: title + start required, end ≥ start on the folded date+time (`reactive-rules`), fiat currency required when a sat-priced event accepts Card. Create needs only wallet + title + start; end date / closing date explain their backend defaults. - Labels per the payment-rails vocabulary: "Unit" → "Price currency", "Fiat checkout currency" → "Fiat currency". - Fiat-priced events mirror `fiat_currency = currency` on save (as the webapp does) so the `tickets_fiat_currency` tag stays coherent. Prettier-clean (3.8.3). No backend changes, no migration. ## Deliberately not in scope - Banner stays an image URL (no pict-rs in the LNbits shell). - The public event page (`display.vue`) still does not render location / categories; separate follow-up. - Version is `aio.13` on the assumption #44 = aio.11 and #45 = aio.12 land first; renumber whichever merges last. ## Manual check 1. Open Events → New Event on an instance whose user has no fiat provider: Card is greyed with the tooltip, Lightning is ticked, Create enables after wallet + title + start date. 2. On demo (Stripe configured): tick Card, untick Lightning, keep price in sats → "Fiat currency" select appears and is required; save and confirm `extra.payment_methods == ["fiat"]` and `allow_fiat == true` on `GET /events/api/v1/events`. 3. Set location + two categories, save, re-open edit: values round-trip; the NIP-52 event carries `location` and `t` tags. 4. Enter a start time, save, check `event_start_date` carries `:00+02:00` and the table shows `YYYY-MM-DD HH:MM`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018b1bDExMX7W3a47wcgFUjb
feat(admin): event form parity with the webapp (1.6.1-aio.13)
Some checks failed
lint.yml / feat(admin): event form parity with the webapp (1.6.1-aio.13) (pull_request) Failing after 0s
lint.yml / feat(admin): event form parity with the webapp (1.6.1-aio.13) (push) Failing after 0s
f835766935
The LNbits admin form lagged the webapp's CreateEventDialog:

- Payment methods never rendered. c2d9a96 wired the template to
  `paymentMethodOptions` / `acceptsFiat` but never defined them, so the
  q-option-group got `options=undefined` and the fiat-currency select
  was gated on `undefined`. Rails are now two q-checkboxes; Card is
  disabled with an explanatory tooltip when `g.user.fiat_providers` is
  empty (same rule as the webapp) and names the providers otherwise.
- Location (NIP-52 `location` tag) and Categories (NIP-52 `t` tags,
  same 25-item list as the webapp's category.ts) were missing from the
  form even though the model, CRUD and publisher already carry them.
- Datetimes are stamped with the browser's UTC offset on submit, as the
  webapp does; `_to_unix` treats naive values as UTC, so 18:00 CEST
  entered here went out on Nostr as 18:00 UTC. Table columns render
  "YYYY-MM-DD HH:MM" instead of the raw ISO string.
- Validation: title + start date required, end >= start on the folded
  date+time, fiat currency required when a sat-priced event accepts
  card. Create is enabled once wallet + title + start are set; info,
  closing date, tickets and price were all effectively required before
  because the disable check compared undefined fields to null.
- Labels follow the payment-rails vocabulary: "Unit" -> "Price
  currency", "Fiat checkout currency" -> "Fiat currency"; ticket
  closing date and end date explain their defaults.
- A fiat-priced event mirrors `fiat_currency = currency` on save so the
  payload and the `tickets_fiat_currency` tag stay coherent.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018b1bDExMX7W3a47wcgFUjb
padreug deleted branch feat/admin-form-parity 2026-09-10 14:43:37 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/events!46
No description provided.