Immediate feedback on sending IT Job Reminder

This commit is contained in:
Marc Rejohn Castillano 2026-03-21 19:28:53 +08:00
parent beb21e48d0
commit ba155885c0

View File

@ -407,15 +407,21 @@ class _ItJobTileState extends ConsumerState<_ItJobTile> {
}
}
Future<void> _sendReminder() async {
void _sendReminder() {
final userIds = widget.assignees.map((a) => a.userId).toList();
if (userIds.isEmpty) {
showErrorSnackBar(context, 'No assigned staff');
return;
}
try {
// Start cooldown and give immediate feedback notification fires async.
setState(_startCooldown);
showSuccessSnackBar(context, 'Reminder sent');
final currentUserId = ref.read(currentUserIdProvider);
await ref.read(notificationsControllerProvider).createNotification(
ref
.read(notificationsControllerProvider)
.createNotification(
userIds: userIds,
type: 'it_job_reminder',
actorId: currentUserId ?? '',
@ -427,14 +433,8 @@ class _ItJobTileState extends ConsumerState<_ItJobTile> {
'task_id': widget.task.id,
'navigate_to': '/tasks/${widget.task.id}',
},
);
if (mounted) {
setState(_startCooldown);
showSuccessSnackBar(context, 'Reminder sent');
}
} catch (e) {
if (mounted) showErrorSnackBar(context, 'Failed to send: $e');
}
)
.ignore();
}
@override