From a86a5d9e77e8f663c6e6ddc45e1e978e36b1cf8e Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Wed, 4 Feb 2026 08:51:34 -0500 Subject: [PATCH] feat: Update NEXT_SPRINT_TASKS with new tasks and modify ViewOrdersCubit to handle null selectedDate --- apps/mobile/NEXT_SPRINT_TASKS.md | 1 + .../lib/src/presentation/blocs/view_orders_cubit.dart | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/mobile/NEXT_SPRINT_TASKS.md b/apps/mobile/NEXT_SPRINT_TASKS.md index d35afb90..562f85a1 100644 --- a/apps/mobile/NEXT_SPRINT_TASKS.md +++ b/apps/mobile/NEXT_SPRINT_TASKS.md @@ -16,3 +16,4 @@ - Update the dataconnect docs. - Track `lat` and `lng` in the staff preferred work locations (for now we are only storing the name). - Remove "Up Next (x)" counter from orders list in client app as it is confusing, becase the tab already has a badge showing the number of the upcoming orders. +- ` final String status;` in `OrderItem` make it an enum. diff --git a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart index 55d5c06c..3b7f5684 100644 --- a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart +++ b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart @@ -268,10 +268,16 @@ class ViewOrdersCubit extends Cubit { } int _calculateUpNextCount() { + if (state.selectedDate == null) return 0; + + final String selectedDateStr = DateFormat( + 'yyyy-MM-dd', + ).format(state.selectedDate!); + return state.orders .where( (OrderItem s) => - // TODO(orders): move PENDING to its own tab once available. + s.date == selectedDateStr && ['OPEN', 'FILLED', 'CONFIRMED', 'PENDING', 'ASSIGNED'] .contains(s.status), )