updates
This commit is contained in:
@@ -139,25 +139,14 @@ const getAttachmentName = (attachment: any) => {
|
||||
};
|
||||
|
||||
const getAttachmentUrl = (attachment: any) => {
|
||||
// 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 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 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`;
|
||||
// If it's just a URL, return it
|
||||
if (attachment.url) return attachment.url;
|
||||
// Otherwise return a placeholder
|
||||
return '#';
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-btn
|
||||
@click="handleMobileSave"
|
||||
@click="() => debouncedSaveInterest ? debouncedSaveInterest() : saveInterest()"
|
||||
variant="flat"
|
||||
color="success"
|
||||
block
|
||||
@@ -407,8 +407,46 @@
|
||||
prepend-inner-icon="mdi-tag"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<!-- Berth Recommendations field hidden per user request -->
|
||||
<v-col cols="12" md="12">
|
||||
<v-col cols="12" md="6">
|
||||
<v-autocomplete
|
||||
v-model="selectedBerthRecommendations"
|
||||
:items="groupedBerths"
|
||||
:item-title="(item) => item.isDivider ? '' : item['Mooring Number']"
|
||||
:item-value="(item) => item.isDivider ? null : item.Id"
|
||||
label="Berth Recommendations"
|
||||
variant="outlined"
|
||||
density="comfortable"
|
||||
multiple
|
||||
chips
|
||||
closable-chips
|
||||
:loading="loadingBerths"
|
||||
prepend-inner-icon="mdi-star"
|
||||
@update:model-value="updateBerthRecommendations"
|
||||
>
|
||||
<template v-slot:item="{ props, item }">
|
||||
<v-divider v-if="item.raw.isDivider" class="mt-2 mb-2">
|
||||
<template v-slot:default>
|
||||
<div class="text-caption text-medium-emphasis px-2">
|
||||
{{ item.raw.letter }}
|
||||
</div>
|
||||
</template>
|
||||
</v-divider>
|
||||
<v-list-item
|
||||
v-else
|
||||
v-bind="props"
|
||||
:title="item.raw['Mooring Number']"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:chip="{ props, item }">
|
||||
<v-chip
|
||||
v-bind="props"
|
||||
:text="item.raw['Mooring Number']"
|
||||
size="small"
|
||||
></v-chip>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-col>
|
||||
<v-col cols="12" md="6">
|
||||
<v-autocomplete
|
||||
v-model="selectedBerths"
|
||||
:items="groupedBerths"
|
||||
@@ -1056,18 +1094,9 @@ const updateBerths = async (newBerths: number[]) => {
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
toast.error("Failed to update berths. Please try again.");
|
||||
// Revert to original values on error
|
||||
selectedBerths.value = [...originalBerths.value];
|
||||
}
|
||||
@@ -1273,20 +1302,6 @@ 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();
|
||||
|
||||
Reference in New Issue
Block a user