* Push Notification Setup and attempt
* Office Ordering * Allow editing of Task and Ticket Details after creation
This commit is contained in:
@@ -370,6 +370,32 @@ class TicketsController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Update editable ticket fields such as subject, description, and office.
|
||||
Future<void> updateTicket({
|
||||
required String ticketId,
|
||||
String? subject,
|
||||
String? description,
|
||||
String? officeId,
|
||||
}) async {
|
||||
final payload = <String, dynamic>{};
|
||||
if (subject != null) payload['subject'] = subject;
|
||||
if (description != null) payload['description'] = description;
|
||||
if (officeId != null) payload['office_id'] = officeId;
|
||||
if (payload.isEmpty) return;
|
||||
|
||||
await _client.from('tickets').update(payload).eq('id', ticketId);
|
||||
|
||||
// record an activity row for edit operations (best-effort)
|
||||
try {
|
||||
final actorId = _client.auth.currentUser?.id;
|
||||
await _client.from('ticket_messages').insert({
|
||||
'ticket_id': ticketId,
|
||||
'sender_id': actorId,
|
||||
'content': 'Ticket updated',
|
||||
});
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
class OfficesController {
|
||||
|
||||
Reference in New Issue
Block a user