Immediate feedback on sending IT Job Reminder
This commit is contained in:
parent
beb21e48d0
commit
ba155885c0
|
|
@ -407,34 +407,34 @@ 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 {
|
|
||||||
final currentUserId = ref.read(currentUserIdProvider);
|
// Start cooldown and give immediate feedback — notification fires async.
|
||||||
await ref.read(notificationsControllerProvider).createNotification(
|
setState(_startCooldown);
|
||||||
userIds: userIds,
|
showSuccessSnackBar(context, 'Reminder sent');
|
||||||
type: 'it_job_reminder',
|
|
||||||
actorId: currentUserId ?? '',
|
final currentUserId = ref.read(currentUserIdProvider);
|
||||||
fields: {'task_id': widget.task.id},
|
ref
|
||||||
pushTitle: 'IT Job Reminder',
|
.read(notificationsControllerProvider)
|
||||||
pushBody:
|
.createNotification(
|
||||||
'Please submit printed IT Job for Task #${widget.task.taskNumber ?? widget.task.id.substring(0, 8)}',
|
userIds: userIds,
|
||||||
pushData: {
|
type: 'it_job_reminder',
|
||||||
'task_id': widget.task.id,
|
actorId: currentUserId ?? '',
|
||||||
'navigate_to': '/tasks/${widget.task.id}',
|
fields: {'task_id': widget.task.id},
|
||||||
},
|
pushTitle: 'IT Job Reminder',
|
||||||
);
|
pushBody:
|
||||||
if (mounted) {
|
'Please submit printed IT Job for Task #${widget.task.taskNumber ?? widget.task.id.substring(0, 8)}',
|
||||||
setState(_startCooldown);
|
pushData: {
|
||||||
showSuccessSnackBar(context, 'Reminder sent');
|
'task_id': widget.task.id,
|
||||||
}
|
'navigate_to': '/tasks/${widget.task.id}',
|
||||||
} catch (e) {
|
},
|
||||||
if (mounted) showErrorSnackBar(context, 'Failed to send: $e');
|
)
|
||||||
}
|
.ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user