Don't propagate clicks on edit and box
This commit is contained in:
@@ -139,6 +139,23 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete, onUpdateProduc
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleProducedClick = (e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (job.status !== 'Closed') {
|
||||||
|
setIsEditingProduced(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEditClick = (e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onEdit(job);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteClick = (e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onDelete(job.id);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={`bg-gray-900 border-gray-700 text-white ${job.status === 'Tracked' ? 'border-l-4 border-l-cyan-600' : ''}`}>
|
<Card className={`bg-gray-900 border-gray-700 text-white ${job.status === 'Tracked' ? 'border-l-4 border-l-cyan-600' : ''}`}>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@@ -157,7 +174,7 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete, onUpdateProduc
|
|||||||
size="sm"
|
size="sm"
|
||||||
className="p-1 h-6 w-6 relative group"
|
className="p-1 h-6 w-6 relative group"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.stopPropagation();
|
||||||
copyBillOfMaterials();
|
copyBillOfMaterials();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -192,7 +209,7 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete, onUpdateProduc
|
|||||||
size="sm"
|
size="sm"
|
||||||
className="p-1 h-6 w-6 relative group"
|
className="p-1 h-6 w-6 relative group"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.stopPropagation();
|
||||||
copyConsumedMaterials();
|
copyConsumedMaterials();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -231,13 +248,14 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete, onUpdateProduc
|
|||||||
onChange={(e) => setProducedValue(e.target.value)}
|
onChange={(e) => setProducedValue(e.target.value)}
|
||||||
onBlur={handleProducedUpdate}
|
onBlur={handleProducedUpdate}
|
||||||
onKeyDown={handleProducedKeyPress}
|
onKeyDown={handleProducedKeyPress}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
className="w-24 h-6 px-2 py-1 inline-block bg-gray-800 border-gray-600 text-white"
|
className="w-24 h-6 px-2 py-1 inline-block bg-gray-800 border-gray-600 text-white"
|
||||||
min="0"
|
min="0"
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span
|
||||||
onClick={() => job.status !== 'Closed' && setIsEditingProduced(true)}
|
onClick={handleProducedClick}
|
||||||
className={job.status !== 'Closed' ? "cursor-pointer hover:text-blue-400" : undefined}
|
className={job.status !== 'Closed' ? "cursor-pointer hover:text-blue-400" : undefined}
|
||||||
title={job.status !== 'Closed' ? "Click to edit" : undefined}
|
title={job.status !== 'Closed' ? "Click to edit" : undefined}
|
||||||
>
|
>
|
||||||
@@ -255,7 +273,7 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete, onUpdateProduc
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onEdit(job)}
|
onClick={handleEditClick}
|
||||||
className="border-gray-600 hover:bg-gray-800"
|
className="border-gray-600 hover:bg-gray-800"
|
||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
@@ -263,7 +281,7 @@ const JobCard: React.FC<JobCardProps> = ({ job, onEdit, onDelete, onUpdateProduc
|
|||||||
<Button
|
<Button
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onDelete(job.id)}
|
onClick={handleDeleteClick}
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
|
Reference in New Issue
Block a user