today coverage ready

This commit is contained in:
José Salazar
2026-01-27 13:11:38 -05:00
parent 2261a6d72c
commit dbd4c2fdc8
7 changed files with 18232 additions and 18168 deletions

View File

@@ -17,8 +17,44 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
HomeRepositoryImpl(this._mock, this._dataConnect);
@override
Future<HomeDashboardData> getDashboardData() {
return _mock.getDashboardData();
Future<HomeDashboardData> getDashboardData() async {
final HomeDashboardData baseData = await _mock.getDashboardData();
final String? businessId = ClientSessionStore.instance.session?.business?.id;
if (businessId == null || businessId.isEmpty) {
return baseData;
}
final DateTime now = DateTime.now();
final DateTime start = DateTime(now.year, now.month, now.day);
final DateTime end = DateTime(now.year, now.month, now.day, 23, 59, 59, 999);
final fdc.QueryResult<
ListShiftRolesByBusinessAndDateRangeData,
ListShiftRolesByBusinessAndDateRangeVariables> result =
await _dataConnect
.listShiftRolesByBusinessAndDateRange(
businessId: businessId,
start: _toTimestamp(start),
end: _toTimestamp(end),
)
.execute();
int totalNeeded = 0;
int totalFilled = 0;
for (final ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole
in result.data.shiftRoles) {
totalNeeded += shiftRole.count;
totalFilled += shiftRole.assigned ?? 0;
}
return HomeDashboardData(
weeklySpending: baseData.weeklySpending,
next7DaysSpending: baseData.next7DaysSpending,
weeklyShifts: baseData.weeklyShifts,
next7DaysScheduled: baseData.next7DaysScheduled,
totalNeeded: totalNeeded,
totalFilled: totalFilled,
);
}
@override

View File

@@ -21,10 +21,16 @@ class ClientHomeState extends Equatable {
this.widgetOrder = const <String>[
'actions',
'reorder',
'coverage',
'spending',
'liveActivity',
],
this.widgetVisibility = const <String, bool>{
'actions': true,
'reorder': true,
'coverage': true,
'spending': true,
'liveActivity': true,
},
this.isEditMode = false,
this.errorMessage,