diff --git a/src/modules/events/components/CreateEventDialog.vue b/src/modules/events/components/CreateEventDialog.vue index 7bd43a0..ea10109 100644 --- a/src/modules/events/components/CreateEventDialog.vue +++ b/src/modules/events/components/CreateEventDialog.vue @@ -146,11 +146,7 @@ const formSchema = toTypedSchema( .array(z.enum(['lightning', 'fiat'])) .min(1, 'Enable at least one payment method'), fiat_currency: z.string().default("USD"), - // Required, and at least 1. A capacity of 0 used to mean - // "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), + amount_tickets: z.number().min(0).max(100000).default(0), price_per_ticket: z.number().min(0).default(0), email_notifications: z.boolean().default(false), nostr_notifications: z.boolean().default(false), @@ -199,7 +195,7 @@ const form = useForm({ currency: 'sat', payment_methods: ['lightning'], fiat_currency: 'USD', - amount_tickets: undefined, + amount_tickets: 0, price_per_ticket: 0, email_notifications: false, nostr_notifications: false, @@ -310,9 +306,7 @@ async function populateFromEvent(event: TicketedEvent) { currency: event.currency ?? 'sat', payment_methods: paymentMethodsOf(event), fiat_currency: event.fiat_currency ?? 'USD', - // 0 is no longer a valid capacity, so an existing zero-capacity event - // opens with the field empty and the organiser has to set a real one. - amount_tickets: event.amount_tickets || undefined, + amount_tickets: event.amount_tickets ?? 0, price_per_ticket: event.price_per_ticket ?? 0, email_notifications: event.extra?.email_notifications ?? false, nostr_notifications: event.extra?.nostr_notifications ?? false, @@ -435,8 +429,7 @@ const onSubmit = form.handleSubmit(async (formValues) => { if (acceptsFiat && formValues.fiat_currency) { eventData.fiat_currency = formValues.fiat_currency } - if (formValues.amount_tickets !== undefined) - eventData.amount_tickets = formValues.amount_tickets + if (formValues.amount_tickets) eventData.amount_tickets = formValues.amount_tickets if (formValues.price_per_ticket) eventData.price_per_ticket = formValues.price_per_ticket if (selectedCategories.value.length > 0) eventData.categories = selectedCategories.value @@ -700,9 +693,9 @@ const handleOpenChange = (open: boolean) => { Tickets - + - Total on sale + 0 = unlimited diff --git a/src/modules/events/views/MyEventsPage.vue b/src/modules/events/views/MyEventsPage.vue index a6a3405..4eb0c7c 100644 --- a/src/modules/events/views/MyEventsPage.vue +++ b/src/modules/events/views/MyEventsPage.vue @@ -173,7 +173,7 @@ function handleEventChanged() {
Tickets Available: - {{ event.amount_tickets }} + {{ event.amount_tickets - event.sold }}
Price: @@ -187,7 +187,7 @@ function handleEventChanged() { variant="default" :disabled=" event.status !== 'approved' || - event.amount_tickets < 1 || + event.amount_tickets <= event.sold || !isAuthenticated " @click="handlePurchaseClick(event)"