activity note added deticated button for copy

This commit is contained in:
Simon Pocrnjič 2025-10-19 10:16:15 +02:00
parent 424151497d
commit 90bbf1942c

View File

@ -7,9 +7,9 @@ import SecondaryButton from "@/Components/SecondaryButton.vue";
import DangerButton from "@/Components/DangerButton.vue"; import DangerButton from "@/Components/DangerButton.vue";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { library } from "@fortawesome/fontawesome-svg-core"; import { library } from "@fortawesome/fontawesome-svg-core";
import { faTrash, faEllipsisVertical } from "@fortawesome/free-solid-svg-icons"; import { faTrash, faEllipsisVertical, faCopy } from "@fortawesome/free-solid-svg-icons";
library.add(faTrash, faEllipsisVertical); library.add(faTrash, faEllipsisVertical, faCopy);
const props = defineProps({ const props = defineProps({
client_case: Object, client_case: Object,
@ -83,6 +83,22 @@ const confirmDeleteAction = () => {
confirmDelete.value = false; confirmDelete.value = false;
toDeleteRow.value = null; toDeleteRow.value = null;
}; };
// Copy function
const copyToClipboard = async (text) => {
try {
await navigator.clipboard.writeText(text);
// You could add a toast notification here if available
} catch (err) {
// Fallback for older browsers
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
}
};
</script> </script>
<template> <template>
@ -157,12 +173,24 @@ const confirmDeleteAction = () => {
</button> </button>
</template> </template>
<template #content> <template #content>
<div class="relative" @click.stop>
<div class="flex items-center justify-between p-1 border-b border-gray-200">
<span class="text-xs font-medium text-gray-600">Opomba</span>
<button
@click="copyToClipboard(row.note)"
class="flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-800 hover:bg-indigo-50 rounded transition-colors"
title="Kopiraj v odložišče"
>
<FontAwesomeIcon :icon="faCopy" class="text-xs" />
<span>Kopiraj</span>
</button>
</div>
<div <div
class="max-h-60 overflow-auto text-[12px] whitespace-pre-wrap break-words" class="max-h-60 overflow-auto text-[12px] whitespace-pre-wrap break-words p-2"
@click.stop
> >
{{ row.note }} {{ row.note }}
</div> </div>
</div>
</template> </template>
</Dropdown> </Dropdown>
</template> </template>