Compare commits
No commits in common. "9ad8d42e5821b61d15219c748ec961f2c1011d1d" and "8203c54feb6e9c9ca3caa47b65a192329acaecd7" have entirely different histories.
9ad8d42e58
...
8203c54feb
2 changed files with 8 additions and 15 deletions
|
|
@ -146,11 +146,7 @@ const formSchema = toTypedSchema(
|
||||||
.array(z.enum(['lightning', 'fiat']))
|
.array(z.enum(['lightning', 'fiat']))
|
||||||
.min(1, 'Enable at least one payment method'),
|
.min(1, 'Enable at least one payment method'),
|
||||||
fiat_currency: z.string().default("USD"),
|
fiat_currency: z.string().default("USD"),
|
||||||
// Required, and at least 1. A capacity of 0 used to mean
|
amount_tickets: z.number().min(0).max(100000).default(0),
|
||||||
// "unlimited", but the backend reads `amount_tickets < 1` as sold
|
|
||||||
// out everywhere (aiolabs/events#34), so a 0 produced an event that
|
|
||||||
// advertised unlimited tickets and refused every purchase.
|
|
||||||
amount_tickets: z.number().min(1, 'Set how many tickets are on sale').max(100000),
|
|
||||||
price_per_ticket: z.number().min(0).default(0),
|
price_per_ticket: z.number().min(0).default(0),
|
||||||
email_notifications: z.boolean().default(false),
|
email_notifications: z.boolean().default(false),
|
||||||
nostr_notifications: z.boolean().default(false),
|
nostr_notifications: z.boolean().default(false),
|
||||||
|
|
@ -199,7 +195,7 @@ const form = useForm({
|
||||||
currency: 'sat',
|
currency: 'sat',
|
||||||
payment_methods: ['lightning'],
|
payment_methods: ['lightning'],
|
||||||
fiat_currency: 'USD',
|
fiat_currency: 'USD',
|
||||||
amount_tickets: undefined,
|
amount_tickets: 0,
|
||||||
price_per_ticket: 0,
|
price_per_ticket: 0,
|
||||||
email_notifications: false,
|
email_notifications: false,
|
||||||
nostr_notifications: false,
|
nostr_notifications: false,
|
||||||
|
|
@ -310,9 +306,7 @@ async function populateFromEvent(event: TicketedEvent) {
|
||||||
currency: event.currency ?? 'sat',
|
currency: event.currency ?? 'sat',
|
||||||
payment_methods: paymentMethodsOf(event),
|
payment_methods: paymentMethodsOf(event),
|
||||||
fiat_currency: event.fiat_currency ?? 'USD',
|
fiat_currency: event.fiat_currency ?? 'USD',
|
||||||
// 0 is no longer a valid capacity, so an existing zero-capacity event
|
amount_tickets: event.amount_tickets ?? 0,
|
||||||
// opens with the field empty and the organiser has to set a real one.
|
|
||||||
amount_tickets: event.amount_tickets || undefined,
|
|
||||||
price_per_ticket: event.price_per_ticket ?? 0,
|
price_per_ticket: event.price_per_ticket ?? 0,
|
||||||
email_notifications: event.extra?.email_notifications ?? false,
|
email_notifications: event.extra?.email_notifications ?? false,
|
||||||
nostr_notifications: event.extra?.nostr_notifications ?? false,
|
nostr_notifications: event.extra?.nostr_notifications ?? false,
|
||||||
|
|
@ -435,8 +429,7 @@ const onSubmit = form.handleSubmit(async (formValues) => {
|
||||||
if (acceptsFiat && formValues.fiat_currency) {
|
if (acceptsFiat && formValues.fiat_currency) {
|
||||||
eventData.fiat_currency = formValues.fiat_currency
|
eventData.fiat_currency = formValues.fiat_currency
|
||||||
}
|
}
|
||||||
if (formValues.amount_tickets !== undefined)
|
if (formValues.amount_tickets) eventData.amount_tickets = formValues.amount_tickets
|
||||||
eventData.amount_tickets = formValues.amount_tickets
|
|
||||||
if (formValues.price_per_ticket) eventData.price_per_ticket = formValues.price_per_ticket
|
if (formValues.price_per_ticket) eventData.price_per_ticket = formValues.price_per_ticket
|
||||||
if (selectedCategories.value.length > 0) eventData.categories = selectedCategories.value
|
if (selectedCategories.value.length > 0) eventData.categories = selectedCategories.value
|
||||||
|
|
||||||
|
|
@ -700,9 +693,9 @@ const handleOpenChange = (open: boolean) => {
|
||||||
<FormItem class="min-w-0">
|
<FormItem class="min-w-0">
|
||||||
<FormLabel>Tickets</FormLabel>
|
<FormLabel>Tickets</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input type="number" min="1" max="100000" placeholder="50" v-bind="componentField" />
|
<Input type="number" min="0" max="100000" placeholder="0" v-bind="componentField" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormDescription class="text-xs">Total on sale</FormDescription>
|
<FormDescription class="text-xs">0 = unlimited</FormDescription>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ function handleEventChanged() {
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<span class="text-muted-foreground">Tickets Available:</span>
|
<span class="text-muted-foreground">Tickets Available:</span>
|
||||||
<span class="text-foreground">{{ event.amount_tickets }}</span>
|
<span class="text-foreground">{{ event.amount_tickets - event.sold }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<span class="text-muted-foreground">Price:</span>
|
<span class="text-muted-foreground">Price:</span>
|
||||||
|
|
@ -187,7 +187,7 @@ function handleEventChanged() {
|
||||||
variant="default"
|
variant="default"
|
||||||
:disabled="
|
:disabled="
|
||||||
event.status !== 'approved' ||
|
event.status !== 'approved' ||
|
||||||
event.amount_tickets < 1 ||
|
event.amount_tickets <= event.sold ||
|
||||||
!isAuthenticated
|
!isAuthenticated
|
||||||
"
|
"
|
||||||
@click="handlePurchaseClick(event)"
|
@click="handlePurchaseClick(event)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue