diff --git a/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue b/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue index d6e546581..d0e85d246 100644 --- a/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue +++ b/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue @@ -26,6 +26,10 @@ const props = defineProps({ type: String, required: true, }, + file: { + type: Object, + default: null, + }, createdAt: { type: Number, required: true, @@ -63,6 +67,22 @@ const menuItems = computed(() => { const createdAt = computed(() => dynamicTime(props.createdAt)); +const displayLink = computed(() => { + // For PDF uploads, show the filename instead of the generated external_link + if (props.file?.filename) { + return props.file.filename; + } + return props.externalLink; +}); + +const actualLink = computed(() => { + // For PDF uploads, return the actual file URL; for URLs, return the external_link + if (props.file?.url) { + return props.file.url; + } + return props.externalLink; +}); + const handleAction = ({ action, value }) => { toggleDropdown(false); emit('action', { action, value, id: props.id }); @@ -103,12 +123,15 @@ const handleAction = ({ action, value }) => { {{ assistant?.name || '' }} - - {{ externalLink }} - + {{ displayLink }} +
{{ createdAt }}
diff --git a/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue b/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue index 5f5156d8e..6cc1d999a 100644 --- a/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue @@ -58,11 +58,6 @@ const handleCreateDialogClose = () => { showCreateDialog.value = false; }; -const handleCreateDialogSuccess = () => { - // Document is already added to the store optimistically, no need to refetch - // The store action 'uploadPdf' or 'create' already adds the document via commit(mutationTypes.ADD) -}; - const handleAction = ({ action, id }) => { selectedDocument.value = documents.value.find( captainDocument => id === captainDocument.id @@ -159,6 +154,7 @@ onMounted(() => { :key="doc.id" :name="doc.name || doc.external_link" :external-link="doc.external_link" + :file="doc.file" :assistant="doc.assistant" :created-at="doc.created_at" @action="handleAction" @@ -176,7 +172,6 @@ onMounted(() => { v-if="showCreateDialog" ref="createDocumentDialog" @close="handleCreateDialogClose" - @success="handleCreateDialogSuccess" />