Immediate feedback on sending IT Job Reminder
This commit is contained in:
parent
beb21e48d0
commit
ba155885c0
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user