* Push Notification Setup and attempt
* Office Ordering * Allow editing of Task and Ticket Details after creation
This commit is contained in:
@@ -685,6 +685,35 @@ class TasksController {
|
||||
await _client.from('tasks').update(payload).eq('id', taskId);
|
||||
}
|
||||
|
||||
/// Update editable task fields such as title, description, office or linked ticket.
|
||||
Future<void> updateTaskFields({
|
||||
required String taskId,
|
||||
String? title,
|
||||
String? description,
|
||||
String? officeId,
|
||||
String? ticketId,
|
||||
}) async {
|
||||
final payload = <String, dynamic>{};
|
||||
if (title != null) payload['title'] = title;
|
||||
if (description != null) payload['description'] = description;
|
||||
if (officeId != null) payload['office_id'] = officeId;
|
||||
if (ticketId != null) payload['ticket_id'] = ticketId;
|
||||
if (payload.isEmpty) return;
|
||||
|
||||
await _client.from('tasks').update(payload).eq('id', taskId);
|
||||
|
||||
// record an activity log for edit operations (best-effort)
|
||||
try {
|
||||
final actorId = _client.auth.currentUser?.id;
|
||||
await _insertActivityRows(_client, {
|
||||
'task_id': taskId,
|
||||
'actor_id': actorId,
|
||||
'action_type': 'updated',
|
||||
'meta': payload,
|
||||
});
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
// Auto-assignment logic executed once on creation.
|
||||
Future<void> _autoAssignTask({
|
||||
required String taskId,
|
||||
|
||||
Reference in New Issue
Block a user