feat(admin): event form parity with the webapp (1.6.1-aio.13)
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
This commit is contained in:
parent
f11e84d967
commit
f835766935
3 changed files with 222 additions and 59 deletions
|
|
@ -479,8 +479,10 @@
|
|||
filled
|
||||
dense
|
||||
v-model.trim="formDialog.data.name"
|
||||
type="name"
|
||||
label="Title of event "
|
||||
type="text"
|
||||
label="Title of event *"
|
||||
lazy-rules
|
||||
:rules="[val => !!val || 'Title is required']"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col q-pl-sm">
|
||||
|
|
@ -504,6 +506,30 @@
|
|||
label="Info about the event"
|
||||
hint="Markdown supported"
|
||||
></q-input>
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.trim="formDialog.data.location"
|
||||
type="text"
|
||||
label="Location"
|
||||
hint="Venue or address, e.g. Salle des fêtes, Foix. Published as the NIP-52 location tag."
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="place"></q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
<q-select
|
||||
filled
|
||||
dense
|
||||
multiple
|
||||
use-chips
|
||||
emit-value
|
||||
map-options
|
||||
v-model="formDialog.data.categories"
|
||||
:options="categoryOptions"
|
||||
label="Categories"
|
||||
hint="Published as NIP-52 hashtags so clients can filter the feed."
|
||||
></q-select>
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
|
|
@ -512,25 +538,16 @@
|
|||
label="Image URL"
|
||||
hint="Optional banner image to display on the event page"
|
||||
></q-input>
|
||||
<div class="row q-mt-lg">
|
||||
<div class="col-4">Ticket closing date</div>
|
||||
<div class="col-8">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.trim="formDialog.data.closing_date"
|
||||
type="date"
|
||||
></q-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-4">Event begins</div>
|
||||
<div class="col-4">Event begins *</div>
|
||||
<div class="col-5">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.trim="formDialog.data.event_start_day"
|
||||
type="date"
|
||||
lazy-rules
|
||||
:rules="[val => !!val || 'Start date is required']"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
|
|
@ -552,6 +569,10 @@
|
|||
dense
|
||||
v-model.trim="formDialog.data.event_end_day"
|
||||
type="date"
|
||||
hint="Defaults to the start date"
|
||||
lazy-rules
|
||||
reactive-rules
|
||||
:rules="[validateEndDate]"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
|
|
@ -564,6 +585,18 @@
|
|||
></q-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-4">Ticket sales close</div>
|
||||
<div class="col-8">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.trim="formDialog.data.closing_date"
|
||||
type="date"
|
||||
hint="Optional. Defaults to the event end date."
|
||||
></q-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col">
|
||||
<q-select
|
||||
|
|
@ -571,7 +604,7 @@
|
|||
dense
|
||||
v-model="formDialog.data.currency"
|
||||
type="text"
|
||||
label="Unit"
|
||||
label="Price currency"
|
||||
:options="currencies"
|
||||
></q-select>
|
||||
</div>
|
||||
|
|
@ -581,7 +614,9 @@
|
|||
dense
|
||||
v-model.number="formDialog.data.amount_tickets"
|
||||
type="number"
|
||||
label="Amount of tickets "
|
||||
min="0"
|
||||
label="Amount of tickets"
|
||||
hint="0 = unlimited"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
|
@ -600,34 +635,57 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="q-mt-sm">
|
||||
<div class="text-caption text-grey-7">Payment methods *</div>
|
||||
<q-option-group
|
||||
v-model="formDialog.data.extra.payment_methods"
|
||||
type="checkbox"
|
||||
inline
|
||||
:options="paymentMethodOptions"
|
||||
></q-option-group>
|
||||
<div class="text-subtitle2">Payment methods *</div>
|
||||
<div class="text-caption text-grey-7">
|
||||
Card / fiat checkout goes through the fiat provider configured on
|
||||
this LNbits instance. Untick Lightning for a card-only event.
|
||||
Pick the rails buyers can pay with. Untick Lightning for a
|
||||
card-only sale.
|
||||
</div>
|
||||
<div class="row q-col-gutter-md q-mt-xs">
|
||||
<div
|
||||
v-for="opt in paymentMethodOptions"
|
||||
:key="opt.value"
|
||||
class="col-12 col-sm-6"
|
||||
>
|
||||
<!-- The span carries the tooltip: a disabled checkbox
|
||||
swallows pointer events, the wrapper still hovers. -->
|
||||
<span class="inline-block full-width">
|
||||
<q-checkbox
|
||||
v-model="formDialog.data.extra.payment_methods"
|
||||
:val="opt.value"
|
||||
:label="opt.label"
|
||||
:disable="opt.value === 'fiat' && !hasFiatProvider"
|
||||
></q-checkbox>
|
||||
<div class="text-caption text-grey-7 q-pl-lg">
|
||||
<span v-text="opt.hint"></span>
|
||||
<span
|
||||
v-if="opt.value === 'fiat' && hasFiatProvider"
|
||||
v-text="' (' + fiatProviderNames + ')'"
|
||||
></span>
|
||||
</div>
|
||||
<q-tooltip
|
||||
v-if="opt.value === 'fiat' && !hasFiatProvider"
|
||||
max-width="280px"
|
||||
>
|
||||
Your LNbits user has no fiat provider configured. Ask the
|
||||
instance admin to enable Stripe, PayPal or Square (Admin →
|
||||
Fiat providers) to accept card payments.
|
||||
</q-tooltip>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<q-select
|
||||
v-if="
|
||||
acceptsFiat &&
|
||||
['sat', 'sats'].includes(
|
||||
(formDialog.data.currency || '').toLowerCase()
|
||||
)
|
||||
"
|
||||
v-if="acceptsFiat && isSatPrice"
|
||||
filled
|
||||
dense
|
||||
v-model="formDialog.data.fiat_currency"
|
||||
label="Fiat checkout currency"
|
||||
:options="
|
||||
currencies.filter(
|
||||
c => !['sat', 'sats'].includes((c || '').toLowerCase())
|
||||
)
|
||||
"
|
||||
label="Fiat currency"
|
||||
hint="Currency card buyers are charged in."
|
||||
:options="fiatCurrencyOptions"
|
||||
lazy-rules
|
||||
:rules="[
|
||||
val => !!val || 'Pick a fiat currency for buyers paying by card'
|
||||
]"
|
||||
></q-select>
|
||||
<q-expansion-item
|
||||
group="advanced"
|
||||
|
|
@ -779,14 +837,9 @@
|
|||
unelevated
|
||||
color="primary"
|
||||
:disable="
|
||||
formDialog.data.wallet == null ||
|
||||
formDialog.data.name == null ||
|
||||
formDialog.data.info == null ||
|
||||
formDialog.data.closing_date == null ||
|
||||
formDialog.data.event_start_day == null ||
|
||||
formDialog.data.event_end_day == null ||
|
||||
formDialog.data.amount_tickets == null ||
|
||||
formDialog.data.price_per_ticket == null
|
||||
!formDialog.data.wallet ||
|
||||
!formDialog.data.name ||
|
||||
!formDialog.data.event_start_day
|
||||
"
|
||||
type="submit"
|
||||
>Create Event</q-btn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue