Add the ability to add participants to already created events
This commit is contained in:
@@ -29,9 +29,18 @@
|
||||
all_data = JSON.parse(sessionStorage.getItem(session_storage_id) || '{}');
|
||||
|
||||
try {
|
||||
event_status = StepStatus.Loading;
|
||||
const createdEvent = await createEventInSupabase(all_data.event);
|
||||
event_status = StepStatus.Success;
|
||||
let createdEvent;
|
||||
|
||||
if (all_data.isAddingParticipants && all_data.existingEventId) {
|
||||
// Skip event creation for existing events
|
||||
event_status = StepStatus.Success;
|
||||
createdEvent = { id: all_data.existingEventId, ...all_data.event };
|
||||
} else {
|
||||
// Create new event
|
||||
event_status = StepStatus.Loading;
|
||||
createdEvent = await createEventInSupabase(all_data.event);
|
||||
event_status = StepStatus.Success;
|
||||
}
|
||||
|
||||
participants_status = StepStatus.Loading;
|
||||
createdParticipants = await createParticipantsInSupabase(all_data.participants, createdEvent);
|
||||
@@ -141,13 +150,17 @@
|
||||
|
||||
<!-- Creating Event Entry -->
|
||||
<div class="mb-4 rounded border border-gray-300 bg-white p-4">
|
||||
<h2 class="mb-2 text-xl font-bold">Creating event</h2>
|
||||
<h2 class="mb-2 text-xl font-bold">
|
||||
{all_data.isAddingParticipants ? 'Using existing event' : 'Creating event'}
|
||||
</h2>
|
||||
{#if event_status === StepStatus.Waiting}
|
||||
<span class="text-black-600">Waiting...</span>
|
||||
{:else if event_status === StepStatus.Loading}
|
||||
<span class="text-black-600">Creating event...</span>
|
||||
{:else if event_status === StepStatus.Success}
|
||||
<span class="text-green-600">Event created successfully.</span>
|
||||
<span class="text-green-600">
|
||||
{all_data.isAddingParticipants ? 'Using existing event.' : 'Event created successfully.'}
|
||||
</span>
|
||||
{:else if event_status === StepStatus.Failure}
|
||||
<span class="text-red-600">Failed to create event.</span>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user