diff --git a/src/modules/registratura/components/registry-table.tsx b/src/modules/registratura/components/registry-table.tsx index 0dc42b8..51fae21 100644 --- a/src/modules/registratura/components/registry-table.tsx +++ b/src/modules/registratura/components/registry-table.tsx @@ -12,6 +12,8 @@ import { Paperclip, Reply, CheckCircle2, + Copy, + Check, } from "lucide-react"; import { Button } from "@/shared/components/ui/button"; import { Badge } from "@/shared/components/ui/badge"; @@ -312,7 +314,10 @@ export function RegistryTable({ > {visibleCols.has("number") && ( - {entry.number} + + {entry.number} + + )} {visibleCols.has("date") && ( @@ -514,6 +519,37 @@ export function RegistryTable({ ); } +function CopyNumberButton({ entry }: { entry: RegistryEntry }) { + const [copied, setCopied] = useState(false); + + const handleCopy = (e: React.MouseEvent) => { + e.stopPropagation(); + const text = `nr. ${entry.number} din ${formatDate(entry.date)}`; + void navigator.clipboard.writeText(text).then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 1500); + }); + }; + + const Icon = copied ? Check : Copy; + + return ( + + ); +} + function formatDate(iso: string): string { try { return new Date(iso).toLocaleDateString("ro-RO", {