feat(programmer-tasks): loading states, confirmation & success dialogs

Day sheet dialogs (disapprove, justify): moved the async controller call
inside each dialog so loading state is owned there — button shows a
spinner and is disabled while the RPC is in flight; errors display inline
instead of via a snackbar after dialog close.

Detail screen (approve): added _approvingSheet bool; Approve button shows
CircularProgressIndicator while in flight. On success shows an AlertDialog
"Sheet Approved" with a check icon instead of silently updating state.

Approvals tab (bulk approve): upgraded post-approve feedback from a
snackbar to a success AlertDialog showing the count of approved sheets
and any skipped ones.

Day sheets tab (submit): added confirmation AlertDialog before the
existing submit flow so programmers don't accidentally submit mid-day.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
2026-09-28 22:31:50 +08:00
parent 2946945ce3
commit 88848138d9
4 changed files with 157 additions and 58 deletions
@@ -43,6 +43,26 @@ class _DaySheetsTabState extends ConsumerState<DaySheetsTab> {
// ---------------------------------------------------------------------------
Future<void> _submit(DateTime today) async {
final ok = await showDialog<bool>(
context: context,
builder: (ctx) => AlertDialog(
title: const Text("Submit today's work?"),
content: const Text(
"This will send your day sheet to admin for review."),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(false),
child: const Text('Cancel'),
),
FilledButton(
onPressed: () => Navigator.of(ctx).pop(true),
child: const Text('Submit'),
),
],
),
);
if (ok != true) return;
setState(() => _submitting = true);
try {
await ref.read(daySheetsControllerProvider).submit(today);