From 33c2ad84601dad265cbee6ad2d285416bc040dc3 Mon Sep 17 00:00:00 2001 From: Krao Hasanee Date: Fri, 27 Mar 2026 00:40:06 -0400 Subject: [PATCH] Fix assign dropdown persistence, auto-assign on start Co-Authored-By: Claude Sonnet 4.6 --- src/pages/team/TaskDetail.jsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pages/team/TaskDetail.jsx b/src/pages/team/TaskDetail.jsx index d832e35..ae8782f 100755 --- a/src/pages/team/TaskDetail.jsx +++ b/src/pages/team/TaskDetail.jsx @@ -62,17 +62,26 @@ export default function TaskDetail() { setSaving(false); }; - const handleStart = () => updateStatus('in_progress', '✓ Job started — status set to In Progress.'); + const handleStart = async () => { + await supabase.from('tasks').update({ + status: 'in_progress', + assigned_to: currentUser.id, + assigned_name: currentUser.name, + }).eq('id', id); + setTask(t => ({ ...t, status: 'in_progress', assigned_to: currentUser.id, assigned_name: currentUser.name })); + setNotification('✓ Job started and assigned to you.'); + }; const handleOnHold = () => updateStatus('on_hold', '✓ Job placed on hold.'); const handleResume = () => updateStatus('in_progress', '✓ Job resumed — back to In Progress.'); const handleAssign = async (e) => { - const member = teamMembers.find(m => m.id === e.target.value); + const value = e.target.value; + const member = teamMembers.find(m => m.id === value); await supabase.from('tasks').update({ - assigned_to: e.target.value || null, + assigned_to: value || null, assigned_name: member?.name || null, }).eq('id', id); - setTask(t => ({ ...t, assigned_to: e.target.value || null, assigned_name: member?.name || null })); + setTask(t => ({ ...t, assigned_to: value || null, assigned_name: member?.name || null })); setNotification('✓ Job assigned.'); };