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