diff --git a/src/components/JobCardDetails.tsx b/src/components/JobCardDetails.tsx index 2ca86d0..67b9e02 100644 --- a/src/components/JobCardDetails.tsx +++ b/src/components/JobCardDetails.tsx @@ -1,10 +1,11 @@ import { useState } from 'react'; -import { Calendar, Factory, Clock } from 'lucide-react'; +import { Calendar, Factory, Clock, Copy } from 'lucide-react'; import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'; import { Input } from '@/components/ui/input'; import { IndJob } from '@/lib/types'; import { useJobs } from '@/hooks/useDataService'; import { useToast } from '@/hooks/use-toast'; +import { useClipboard } from '@/hooks/useClipboard'; interface JobCardDetailsProps { job: IndJob; @@ -16,6 +17,8 @@ const JobCardDetails: React.FC = ({ job }) => { const { updateJob } = useJobs(); const { toast } = useToast(); + const { copying, copyToClipboard } = useClipboard(); + const formatDateTime = (dateString: string | null | undefined) => { if (!dateString) return 'Not set'; return new Date(dateString).toLocaleString('en-CA', { @@ -32,6 +35,11 @@ const JobCardDetails: React.FC = ({ job }) => { setTempValues({ ...tempValues, [fieldName]: currentValue || '' }); }; + const handleJobIdClick = async (e: React.MouseEvent) => { + e.stopPropagation(); + await copyToClipboard(job.id, 'id', 'Job ID copied to clipboard'); + }; + const handleFieldUpdate = async (fieldName: string, value: string) => { try { const dateValue = value ? new Date(value).toISOString() : null; @@ -95,7 +103,15 @@ const JobCardDetails: React.FC = ({ job }) => {
Job ID: - {job.id} + + {job.id} + {copying === 'id' && } +
diff --git a/src/components/JobCardHeader.tsx b/src/components/JobCardHeader.tsx index ff52c00..8a24c2a 100644 --- a/src/components/JobCardHeader.tsx +++ b/src/components/JobCardHeader.tsx @@ -34,11 +34,6 @@ const JobCardHeader: React.FC = ({ await copyToClipboard(job.outputItem, 'name', 'Job name copied to clipboard'); }; - const handleJobIdClick = async (e: React.MouseEvent) => { - e.stopPropagation(); - await copyToClipboard(job.id, 'id', 'Job ID copied to clipboard'); - }; - return (
@@ -64,17 +59,6 @@ const JobCardHeader: React.FC = ({ Sold: {itemsSold.toLocaleString()}
-
- ID: - {job.id} - {copying === 'id' && } - -