Refactor event form to use separate date/time inputs with validation
All checks were successful
Build And Push Image / docker (push) Successful in 1m26s

- Split combined datetime pickers into separate date and time fields
- Add validation for past dates and time consistency
- Implement error message display with dismissible alerts
- Add watchers to combine date/time values into ISO strings
- Set minimum date constraints to prevent past date selection
- Add delete endpoint for events
This commit is contained in:
2025-08-13 22:23:06 +02:00
parent 9ee0b2f14e
commit 44aee8f2f9
4 changed files with 371 additions and 29 deletions

View File

@@ -274,22 +274,52 @@ export function createNocoDBEventsClient() {
},
/**
* Find a single event by ID
* Find a single event by ID (supports both database Id and business event_id)
*/
async findOne(id: string) {
console.log('[nocodb-events] Fetching event ID:', id);
try {
const result = await $fetch<Event>(`${createEventTableUrl(EventTable.Events)}/${id}`, {
// First, try to fetch by database Id (numeric)
if (/^\d+$/.test(id)) {
console.log('[nocodb-events] Using database Id lookup for:', id);
const result = await $fetch<Event>(`${createEventTableUrl(EventTable.Events)}/${id}`, {
headers: {
"xc-token": getNocoDbConfiguration().token,
},
});
console.log('[nocodb-events] Successfully retrieved event by database Id:', result.id || (result as any).Id);
return normalizeEventFieldsFromNocoDB(result);
}
// Otherwise, search by business event_id
console.log('[nocodb-events] Using event_id lookup for:', id);
const results = await $fetch<{list: Event[]}>(`${createEventTableUrl(EventTable.Events)}`, {
headers: {
"xc-token": getNocoDbConfiguration().token,
},
params: {
where: `(event_id,eq,${id})`,
limit: 1
}
});
console.log('[nocodb-events] Successfully retrieved event:', result.id || (result as any).Id);
return normalizeEventFieldsFromNocoDB(result);
if (results.list && results.list.length > 0) {
console.log('[nocodb-events] Successfully found event by event_id:', results.list[0].id || (results.list[0] as any).Id);
return normalizeEventFieldsFromNocoDB(results.list[0]);
}
console.log('[nocodb-events] No event found with event_id:', id);
throw createError({
statusCode: 404,
statusMessage: 'Event not found'
});
} catch (error: any) {
console.error('[nocodb-events] Error fetching event:', error);
if (error.statusCode === 404) {
throw error; // Re-throw 404 errors as-is
}
handleNocoDbError(error, 'getEventById', 'Event');
throw error;
}