Fix assign dropdown persistence, auto-assign on start
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -62,17 +62,26 @@ export default function TaskDetail() {
|
|||||||
setSaving(false);
|
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 handleOnHold = () => updateStatus('on_hold', '✓ Job placed on hold.');
|
||||||
const handleResume = () => updateStatus('in_progress', '✓ Job resumed — back to In Progress.');
|
const handleResume = () => updateStatus('in_progress', '✓ Job resumed — back to In Progress.');
|
||||||
|
|
||||||
const handleAssign = async (e) => {
|
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({
|
await supabase.from('tasks').update({
|
||||||
assigned_to: e.target.value || null,
|
assigned_to: value || null,
|
||||||
assigned_name: member?.name || null,
|
assigned_name: member?.name || null,
|
||||||
}).eq('id', id);
|
}).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.');
|
setNotification('✓ Job assigned.');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user