From cf4af2cbffae8233cafb72851feaee76ce51f215 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 10 Jun 2025 20:45:47 +0200 Subject: [PATCH] updates --- components/EOISection.vue | 51 +++++++++++------ components/EmailDetailsDialog.vue | 25 +++++--- components/InterestDetailsModal.vue | 69 +++++++++-------------- pages/dashboard/interest-list.vue | 2 +- server/api/email/generate-eoi-document.ts | 3 + 5 files changed, 82 insertions(+), 68 deletions(-) diff --git a/components/EOISection.vue b/components/EOISection.vue index 560b914..a163a38 100644 --- a/components/EOISection.vue +++ b/components/EOISection.vue @@ -94,12 +94,17 @@ Client Signature Link {{ interest['Full Name'] }} @@ -112,12 +117,17 @@ CC Signature Link Oscar Faragher @@ -130,12 +140,17 @@ Developer Signature Link David Mizrahi diff --git a/components/EmailDetailsDialog.vue b/components/EmailDetailsDialog.vue index e8d433d..0a88fd3 100644 --- a/components/EmailDetailsDialog.vue +++ b/components/EmailDetailsDialog.vue @@ -139,14 +139,25 @@ const getAttachmentName = (attachment: any) => { }; const getAttachmentUrl = (attachment: any) => { - // If attachment has a path and bucket, construct the download URL - if (attachment.path && attachment.bucket) { - return `/api/files/proxy-download?path=${encodeURIComponent(attachment.path)}&bucket=${attachment.bucket}`; + // If attachment is just a string (filename), assume it's in the client-emails bucket + if (typeof attachment === 'string') { + return `/api/files/proxy-download?fileName=${encodeURIComponent(attachment)}&bucket=client-emails`; } - // If it's just a URL, return it - if (attachment.url) return attachment.url; - // Otherwise return a placeholder - return '#'; + + // If it has a path property, use that + if (attachment?.path) { + const bucket = attachment.bucket || 'client-emails'; + return `/api/files/proxy-download?fileName=${encodeURIComponent(attachment.path)}&bucket=${bucket}`; + } + + // If it has a url property, use that directly + if (attachment?.url) { + return attachment.url; + } + + // Default fallback + const name = attachment?.name || attachment?.filename || 'attachment'; + return `/api/files/proxy-download?fileName=${encodeURIComponent(name)}&bucket=client-emails`; }; diff --git a/components/InterestDetailsModal.vue b/components/InterestDetailsModal.vue index ff5297a..d41026e 100644 --- a/components/InterestDetailsModal.vue +++ b/components/InterestDetailsModal.vue @@ -196,7 +196,7 @@ - - - - - - - + + { // Update original values originalBerths.value = [...newBerths]; + + // Show success message + if (toAdd.length > 0 || toRemove.length > 0) { + toast.success("Berths updated successfully"); + } } catch (error) { console.error("Failed to update berths:", error); - toast.error("Failed to update berths. Please try again."); + // Show more specific error message on mobile + const errorMessage = mobile.value + ? "Could not update berths. Please check your connection and try again." + : "Failed to update berths. Please try again."; + toast.error(errorMessage); // Revert to original values on error selectedBerths.value = [...originalBerths.value]; } @@ -1302,6 +1273,20 @@ const onInterestUpdated = async () => { } }; +// Handle mobile save - call the save function directly without debounce +const handleMobileSave = () => { + console.log('Mobile save button clicked'); + // Cancel any pending debounced saves + if (debouncedSaveInterest) { + debouncedSaveInterest.cancel(); + } + if (autoSave) { + autoSave.cancel(); + } + // Call save directly + saveInterest(); +}; + // Load berths when component mounts onMounted(() => { loadAvailableBerths(); diff --git a/pages/dashboard/interest-list.vue b/pages/dashboard/interest-list.vue index 4234dcc..bcbcbbe 100644 --- a/pages/dashboard/interest-list.vue +++ b/pages/dashboard/interest-list.vue @@ -125,7 +125,7 @@ :headers="headers" :items="filteredInterests" :search="search" - :sort-by="[{ key: 'Created At', order: 'desc' }, { key: 'Full Name', order: 'asc' }]" + :sort-by="[{ key: 'Id', order: 'desc' }]" must-sort hover :loading="loading" diff --git a/server/api/email/generate-eoi-document.ts b/server/api/email/generate-eoi-document.ts index b401fa3..982765f 100644 --- a/server/api/email/generate-eoi-document.ts +++ b/server/api/email/generate-eoi-document.ts @@ -29,6 +29,9 @@ export default defineEventHandler(async (event) => { throw createError({ statusCode: 401, statusMessage: "unauthenticated" }); } + // Set longer timeout for this endpoint to prevent 502 errors + event.node.res.setTimeout(60000); // 60 seconds + try { const body = await readBody(event); const { interestId } = body;