fix: add ignore_for_file to data connect Repos and modify CI to avoid analyzing deleted files
This commit is contained in:
2
.github/workflows/mobile-ci.yml
vendored
2
.github/workflows/mobile-ci.yml
vendored
@@ -150,7 +150,7 @@ jobs:
|
||||
FAILED_FILES=()
|
||||
|
||||
while IFS= read -r file; do
|
||||
if [[ -n "$file" && "$file" == *.dart ]]; then
|
||||
if [[ -n "$file" && "$file" == *.dart && -f "$file" ]]; then
|
||||
echo "📝 Analyzing: $file"
|
||||
|
||||
if ! flutter analyze "$file" --no-fatal-infos 2>&1 | tee -a lint_output.txt; then
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:staff_authentication/staff_authentication.dart';
|
||||
|
||||
/// A widget that listens to session state changes and handles global reactions.
|
||||
///
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
library core;
|
||||
library;
|
||||
|
||||
export 'src/domain/arguments/usecase_argument.dart';
|
||||
export 'src/domain/usecases/usecase.dart';
|
||||
|
||||
@@ -22,16 +22,16 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
/// }
|
||||
/// ```
|
||||
class CoreBlocObserver extends BlocObserver {
|
||||
/// Whether to log state changes (can be verbose in production)
|
||||
final bool logStateChanges;
|
||||
|
||||
/// Whether to log events
|
||||
final bool logEvents;
|
||||
|
||||
CoreBlocObserver({
|
||||
this.logStateChanges = false,
|
||||
this.logEvents = true,
|
||||
});
|
||||
/// Whether to log state changes (can be verbose in production)
|
||||
final bool logStateChanges;
|
||||
|
||||
/// Whether to log events
|
||||
final bool logEvents;
|
||||
|
||||
@override
|
||||
void onCreate(BlocBase bloc) {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
/// final homePath = ClientPaths.home;
|
||||
/// final shiftsPath = StaffPaths.shifts;
|
||||
/// ```
|
||||
library;
|
||||
|
||||
export 'client/route_paths.dart';
|
||||
export 'client/navigator.dart';
|
||||
|
||||
@@ -8,11 +8,11 @@ sealed class LocaleEvent {
|
||||
|
||||
/// Event triggered when the user wants to change the application locale.
|
||||
class ChangeLocale extends LocaleEvent {
|
||||
/// The new locale to apply.
|
||||
final Locale locale;
|
||||
|
||||
/// Creates a [ChangeLocale] event.
|
||||
const ChangeLocale(this.locale);
|
||||
/// The new locale to apply.
|
||||
final Locale locale;
|
||||
}
|
||||
|
||||
/// Event triggered to load the saved locale from persistent storage.
|
||||
|
||||
@@ -11,11 +11,11 @@ abstract interface class LocaleLocalDataSource {
|
||||
|
||||
/// Implementation of [LocaleLocalDataSource] using [SharedPreferencesAsync].
|
||||
class LocaleLocalDataSourceImpl implements LocaleLocalDataSource {
|
||||
static const String _localeKey = 'app_locale';
|
||||
final SharedPreferencesAsync _sharedPreferences;
|
||||
|
||||
/// Creates a [LocaleLocalDataSourceImpl] with the required [SharedPreferencesAsync] instance.
|
||||
LocaleLocalDataSourceImpl(this._sharedPreferences);
|
||||
static const String _localeKey = 'app_locale';
|
||||
final SharedPreferencesAsync _sharedPreferences;
|
||||
|
||||
@override
|
||||
Future<void> saveLanguageCode(String languageCode) async {
|
||||
|
||||
@@ -3,10 +3,10 @@ import '../repositories/locale_repository_interface.dart';
|
||||
|
||||
/// Use case to retrieve the default locale.
|
||||
class GetDefaultLocaleUseCase {
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
/// Creates a [GetDefaultLocaleUseCase] with the required [LocaleRepositoryInterface].
|
||||
GetDefaultLocaleUseCase(this._repository);
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
/// Retrieves the default locale.
|
||||
Locale call() {
|
||||
|
||||
@@ -7,10 +7,10 @@ import '../repositories/locale_repository_interface.dart';
|
||||
/// This class extends [NoInputUseCase] and interacts with [LocaleRepositoryInterface]
|
||||
/// to fetch the saved locale.
|
||||
class GetLocaleUseCase extends NoInputUseCase<Locale?> {
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
/// Creates a [GetLocaleUseCase] with the required [LocaleRepositoryInterface].
|
||||
GetLocaleUseCase(this._repository);
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
@override
|
||||
Future<Locale> call() {
|
||||
|
||||
@@ -3,10 +3,10 @@ import '../repositories/locale_repository_interface.dart';
|
||||
|
||||
/// Use case to retrieve the list of supported locales.
|
||||
class GetSupportedLocalesUseCase {
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
/// Creates a [GetSupportedLocalesUseCase] with the required [LocaleRepositoryInterface].
|
||||
GetSupportedLocalesUseCase(this._repository);
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
/// Retrieves the supported locales.
|
||||
List<Locale> call() {
|
||||
|
||||
@@ -7,10 +7,10 @@ import '../repositories/locale_repository_interface.dart';
|
||||
/// This class extends [UseCase] and interacts with [LocaleRepositoryInterface]
|
||||
/// to save a given locale.
|
||||
class SetLocaleUseCase extends UseCase<Locale, void> {
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
/// Creates a [SetLocaleUseCase] with the required [LocaleRepositoryInterface].
|
||||
SetLocaleUseCase(this._repository);
|
||||
final LocaleRepositoryInterface _repository;
|
||||
|
||||
@override
|
||||
Future<void> call(Locale input) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_data_connect/src/core/ref.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../../domain/repositories/billing_connector_repository.dart';
|
||||
@@ -13,7 +15,7 @@ class BillingConnectorRepositoryImpl implements BillingConnectorRepository {
|
||||
@override
|
||||
Future<List<BusinessBankAccount>> getBankAccounts({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.GetAccountsByOwnerIdData, dc.GetAccountsByOwnerIdVariables> result = await _service.connector
|
||||
.getAccountsByOwnerId(ownerId: businessId)
|
||||
.execute();
|
||||
|
||||
@@ -24,21 +26,21 @@ class BillingConnectorRepositoryImpl implements BillingConnectorRepository {
|
||||
@override
|
||||
Future<double> getCurrentBillAmount({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.ListInvoicesByBusinessIdData, dc.ListInvoicesByBusinessIdVariables> result = await _service.connector
|
||||
.listInvoicesByBusinessId(businessId: businessId)
|
||||
.execute();
|
||||
|
||||
return result.data.invoices
|
||||
.map(_mapInvoice)
|
||||
.where((i) => i.status == InvoiceStatus.open)
|
||||
.fold<double>(0.0, (sum, item) => sum + item.totalAmount);
|
||||
.where((Invoice i) => i.status == InvoiceStatus.open)
|
||||
.fold<double>(0.0, (double sum, Invoice item) => sum + item.totalAmount);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<Invoice>> getInvoiceHistory({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.ListInvoicesByBusinessIdData, dc.ListInvoicesByBusinessIdVariables> result = await _service.connector
|
||||
.listInvoicesByBusinessId(businessId: businessId)
|
||||
.limit(10)
|
||||
.execute();
|
||||
@@ -50,13 +52,13 @@ class BillingConnectorRepositoryImpl implements BillingConnectorRepository {
|
||||
@override
|
||||
Future<List<Invoice>> getPendingInvoices({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.ListInvoicesByBusinessIdData, dc.ListInvoicesByBusinessIdVariables> result = await _service.connector
|
||||
.listInvoicesByBusinessId(businessId: businessId)
|
||||
.execute();
|
||||
|
||||
return result.data.invoices
|
||||
.map(_mapInvoice)
|
||||
.where((i) =>
|
||||
.where((Invoice i) =>
|
||||
i.status == InvoiceStatus.open || i.status == InvoiceStatus.disputed)
|
||||
.toList();
|
||||
});
|
||||
@@ -83,7 +85,7 @@ class BillingConnectorRepositoryImpl implements BillingConnectorRepository {
|
||||
end = DateTime(now.year, now.month + 1, 0, 23, 59, 59);
|
||||
}
|
||||
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByBusinessAndDatesSummaryData, dc.ListShiftRolesByBusinessAndDatesSummaryVariables> result = await _service.connector
|
||||
.listShiftRolesByBusinessAndDatesSummary(
|
||||
businessId: businessId,
|
||||
start: _service.toTimestamp(start),
|
||||
@@ -91,17 +93,17 @@ class BillingConnectorRepositoryImpl implements BillingConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final shiftRoles = result.data.shiftRoles;
|
||||
if (shiftRoles.isEmpty) return [];
|
||||
final List<dc.ListShiftRolesByBusinessAndDatesSummaryShiftRoles> shiftRoles = result.data.shiftRoles;
|
||||
if (shiftRoles.isEmpty) return <InvoiceItem>[];
|
||||
|
||||
final Map<String, _RoleSummary> summary = {};
|
||||
for (final role in shiftRoles) {
|
||||
final roleId = role.roleId;
|
||||
final roleName = role.role.name;
|
||||
final hours = role.hours ?? 0.0;
|
||||
final totalValue = role.totalValue ?? 0.0;
|
||||
final Map<String, _RoleSummary> summary = <String, _RoleSummary>{};
|
||||
for (final dc.ListShiftRolesByBusinessAndDatesSummaryShiftRoles role in shiftRoles) {
|
||||
final String roleId = role.roleId;
|
||||
final String roleName = role.role.name;
|
||||
final double hours = role.hours ?? 0.0;
|
||||
final double totalValue = role.totalValue ?? 0.0;
|
||||
|
||||
final existing = summary[roleId];
|
||||
final _RoleSummary? existing = summary[roleId];
|
||||
if (existing == null) {
|
||||
summary[roleId] = _RoleSummary(
|
||||
roleId: roleId,
|
||||
@@ -118,7 +120,7 @@ class BillingConnectorRepositoryImpl implements BillingConnectorRepository {
|
||||
}
|
||||
|
||||
return summary.values
|
||||
.map((item) => InvoiceItem(
|
||||
.map((_RoleSummary item) => InvoiceItem(
|
||||
id: item.roleId,
|
||||
invoiceId: item.roleId,
|
||||
staffId: item.roleName,
|
||||
@@ -197,3 +199,4 @@ class _RoleSummary {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_data_connect/src/core/ref.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
@@ -20,7 +22,7 @@ class CoverageConnectorRepositoryImpl implements CoverageConnectorRepository {
|
||||
final DateTime start = DateTime(date.year, date.month, date.day);
|
||||
final DateTime end = DateTime(date.year, date.month, date.day, 23, 59, 59, 999);
|
||||
|
||||
final shiftRolesResult = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByBusinessAndDateRangeData, dc.ListShiftRolesByBusinessAndDateRangeVariables> shiftRolesResult = await _service.connector
|
||||
.listShiftRolesByBusinessAndDateRange(
|
||||
businessId: businessId,
|
||||
start: _service.toTimestamp(start),
|
||||
@@ -28,7 +30,7 @@ class CoverageConnectorRepositoryImpl implements CoverageConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final applicationsResult = await _service.connector
|
||||
final QueryResult<dc.ListStaffsApplicationsByBusinessForDayData, dc.ListStaffsApplicationsByBusinessForDayVariables> applicationsResult = await _service.connector
|
||||
.listStaffsApplicationsByBusinessForDay(
|
||||
businessId: businessId,
|
||||
dayStart: _service.toTimestamp(start),
|
||||
@@ -49,13 +51,13 @@ class CoverageConnectorRepositoryImpl implements CoverageConnectorRepository {
|
||||
List<dynamic> applications,
|
||||
DateTime date,
|
||||
) {
|
||||
if (shiftRoles.isEmpty && applications.isEmpty) return [];
|
||||
if (shiftRoles.isEmpty && applications.isEmpty) return <CoverageShift>[];
|
||||
|
||||
final Map<String, _CoverageGroup> groups = {};
|
||||
final Map<String, _CoverageGroup> groups = <String, _CoverageGroup>{};
|
||||
|
||||
for (final sr in shiftRoles) {
|
||||
final String key = '${sr.shiftId}:${sr.roleId}';
|
||||
final startTime = _service.toDateTime(sr.startTime);
|
||||
final DateTime? startTime = _service.toDateTime(sr.startTime);
|
||||
|
||||
groups[key] = _CoverageGroup(
|
||||
shiftId: sr.shiftId,
|
||||
@@ -65,14 +67,14 @@ class CoverageConnectorRepositoryImpl implements CoverageConnectorRepository {
|
||||
startTime: startTime != null ? DateFormat('HH:mm').format(startTime) : '00:00',
|
||||
workersNeeded: sr.count,
|
||||
date: _service.toDateTime(sr.shift.date) ?? date,
|
||||
workers: [],
|
||||
workers: <CoverageWorker>[],
|
||||
);
|
||||
}
|
||||
|
||||
for (final app in applications) {
|
||||
final String key = '${app.shiftId}:${app.roleId}';
|
||||
if (!groups.containsKey(key)) {
|
||||
final startTime = _service.toDateTime(app.shiftRole.startTime);
|
||||
final DateTime? startTime = _service.toDateTime(app.shiftRole.startTime);
|
||||
groups[key] = _CoverageGroup(
|
||||
shiftId: app.shiftId,
|
||||
roleId: app.roleId,
|
||||
@@ -81,11 +83,11 @@ class CoverageConnectorRepositoryImpl implements CoverageConnectorRepository {
|
||||
startTime: startTime != null ? DateFormat('HH:mm').format(startTime) : '00:00',
|
||||
workersNeeded: app.shiftRole.count,
|
||||
date: _service.toDateTime(app.shiftRole.shift.date) ?? date,
|
||||
workers: [],
|
||||
workers: <CoverageWorker>[],
|
||||
);
|
||||
}
|
||||
|
||||
final checkIn = _service.toDateTime(app.checkInTime);
|
||||
final DateTime? checkIn = _service.toDateTime(app.checkInTime);
|
||||
groups[key]!.workers.add(
|
||||
CoverageWorker(
|
||||
name: app.staff.fullName,
|
||||
@@ -96,7 +98,7 @@ class CoverageConnectorRepositoryImpl implements CoverageConnectorRepository {
|
||||
}
|
||||
|
||||
return groups.values
|
||||
.map((g) => CoverageShift(
|
||||
.map((_CoverageGroup g) => CoverageShift(
|
||||
id: '${g.shiftId}:${g.roleId}',
|
||||
title: g.title,
|
||||
location: g.location,
|
||||
@@ -153,3 +155,4 @@ class _CoverageGroup {
|
||||
final DateTime date;
|
||||
final List<CoverageWorker> workers;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_data_connect/src/core/ref.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../../domain/repositories/home_connector_repository.dart';
|
||||
@@ -13,13 +15,13 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
@override
|
||||
Future<HomeDashboardData> getDashboardData({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final now = DateTime.now();
|
||||
final daysFromMonday = now.weekday - DateTime.monday;
|
||||
final monday = DateTime(now.year, now.month, now.day).subtract(Duration(days: daysFromMonday));
|
||||
final weekRangeStart = monday;
|
||||
final weekRangeEnd = monday.add(const Duration(days: 13, hours: 23, minutes: 59, seconds: 59));
|
||||
final DateTime now = DateTime.now();
|
||||
final int daysFromMonday = now.weekday - DateTime.monday;
|
||||
final DateTime monday = DateTime(now.year, now.month, now.day).subtract(Duration(days: daysFromMonday));
|
||||
final DateTime weekRangeStart = monday;
|
||||
final DateTime weekRangeEnd = monday.add(const Duration(days: 13, hours: 23, minutes: 59, seconds: 59));
|
||||
|
||||
final completedResult = await _service.connector
|
||||
final QueryResult<dc.GetCompletedShiftsByBusinessIdData, dc.GetCompletedShiftsByBusinessIdVariables> completedResult = await _service.connector
|
||||
.getCompletedShiftsByBusinessId(
|
||||
businessId: businessId,
|
||||
dateFrom: _service.toTimestamp(weekRangeStart),
|
||||
@@ -32,14 +34,14 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
int weeklyShifts = 0;
|
||||
int next7DaysScheduled = 0;
|
||||
|
||||
for (final shift in completedResult.data.shifts) {
|
||||
final shiftDate = _service.toDateTime(shift.date);
|
||||
for (final dc.GetCompletedShiftsByBusinessIdShifts shift in completedResult.data.shifts) {
|
||||
final DateTime? shiftDate = _service.toDateTime(shift.date);
|
||||
if (shiftDate == null) continue;
|
||||
|
||||
final offset = shiftDate.difference(weekRangeStart).inDays;
|
||||
final int offset = shiftDate.difference(weekRangeStart).inDays;
|
||||
if (offset < 0 || offset > 13) continue;
|
||||
|
||||
final cost = shift.cost ?? 0.0;
|
||||
final double cost = shift.cost ?? 0.0;
|
||||
if (offset <= 6) {
|
||||
weeklySpending += cost;
|
||||
weeklyShifts += 1;
|
||||
@@ -49,10 +51,10 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
}
|
||||
}
|
||||
|
||||
final start = DateTime(now.year, now.month, now.day);
|
||||
final end = start.add(const Duration(hours: 23, minutes: 59, seconds: 59));
|
||||
final DateTime start = DateTime(now.year, now.month, now.day);
|
||||
final DateTime end = start.add(const Duration(hours: 23, minutes: 59, seconds: 59));
|
||||
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByBusinessAndDateRangeData, dc.ListShiftRolesByBusinessAndDateRangeVariables> result = await _service.connector
|
||||
.listShiftRolesByBusinessAndDateRange(
|
||||
businessId: businessId,
|
||||
start: _service.toTimestamp(start),
|
||||
@@ -62,7 +64,7 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
|
||||
int totalNeeded = 0;
|
||||
int totalFilled = 0;
|
||||
for (final shiftRole in result.data.shiftRoles) {
|
||||
for (final dc.ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole in result.data.shiftRoles) {
|
||||
totalNeeded += shiftRole.count;
|
||||
totalFilled += shiftRole.assigned ?? 0;
|
||||
}
|
||||
@@ -81,10 +83,10 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
@override
|
||||
Future<List<ReorderItem>> getRecentReorders({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final now = DateTime.now();
|
||||
final start = now.subtract(const Duration(days: 30));
|
||||
final DateTime now = DateTime.now();
|
||||
final DateTime start = now.subtract(const Duration(days: 30));
|
||||
|
||||
final result = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByBusinessDateRangeCompletedOrdersData, dc.ListShiftRolesByBusinessDateRangeCompletedOrdersVariables> result = await _service.connector
|
||||
.listShiftRolesByBusinessDateRangeCompletedOrders(
|
||||
businessId: businessId,
|
||||
start: _service.toTimestamp(start),
|
||||
@@ -92,7 +94,7 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
return result.data.shiftRoles.map((shiftRole) {
|
||||
return result.data.shiftRoles.map((dc.ListShiftRolesByBusinessDateRangeCompletedOrdersShiftRoles shiftRole) {
|
||||
final String location = shiftRole.shift.location ?? shiftRole.shift.locationAddress ?? '';
|
||||
final String type = shiftRole.shift.order.orderType.stringValue;
|
||||
return ReorderItem(
|
||||
@@ -108,3 +110,4 @@ class HomeConnectorRepositoryImpl implements HomeConnectorRepository {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'dart:convert';
|
||||
import 'package:firebase_data_connect/src/core/ref.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
@@ -17,11 +19,11 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
Future<List<Hub>> getHubs({required String businessId}) async {
|
||||
return _service.run(() async {
|
||||
final String teamId = await _getOrCreateTeamId(businessId);
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.GetTeamHubsByTeamIdData, dc.GetTeamHubsByTeamIdVariables> response = await _service.connector
|
||||
.getTeamHubsByTeamId(teamId: teamId)
|
||||
.execute();
|
||||
|
||||
return response.data.teamHubs.map((h) {
|
||||
return response.data.teamHubs.map((dc.GetTeamHubsByTeamIdTeamHubs h) {
|
||||
return Hub(
|
||||
id: h.id,
|
||||
businessId: businessId,
|
||||
@@ -54,7 +56,7 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
? await _fetchPlaceAddress(placeId)
|
||||
: null;
|
||||
|
||||
final result = await _service.connector
|
||||
final OperationResult<dc.CreateTeamHubData, dc.CreateTeamHubVariables> result = await _service.connector
|
||||
.createTeamHub(
|
||||
teamId: teamId,
|
||||
hubName: name,
|
||||
@@ -101,7 +103,7 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
? await _fetchPlaceAddress(placeId)
|
||||
: null;
|
||||
|
||||
final builder = _service.connector.updateTeamHub(id: id);
|
||||
final dc.UpdateTeamHubVariablesBuilder builder = _service.connector.updateTeamHub(id: id);
|
||||
|
||||
if (name != null) builder.hubName(name);
|
||||
if (address != null) builder.address(address);
|
||||
@@ -141,7 +143,7 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
@override
|
||||
Future<void> deleteHub({required String businessId, required String id}) async {
|
||||
return _service.run(() async {
|
||||
final ordersRes = await _service.connector
|
||||
final QueryResult<dc.ListOrdersByBusinessAndTeamHubData, dc.ListOrdersByBusinessAndTeamHubVariables> ordersRes = await _service.connector
|
||||
.listOrdersByBusinessAndTeamHub(businessId: businessId, teamHubId: id)
|
||||
.execute();
|
||||
|
||||
@@ -158,7 +160,7 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
// --- HELPERS ---
|
||||
|
||||
Future<String> _getOrCreateTeamId(String businessId) async {
|
||||
final teamsRes = await _service.connector
|
||||
final QueryResult<dc.GetTeamsByOwnerIdData, dc.GetTeamsByOwnerIdVariables> teamsRes = await _service.connector
|
||||
.getTeamsByOwnerId(ownerId: businessId)
|
||||
.execute();
|
||||
|
||||
@@ -168,7 +170,7 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
|
||||
// Logic to fetch business details to create a team name if missing
|
||||
// For simplicity, we assume one exists or we create a generic one
|
||||
final createRes = await _service.connector
|
||||
final OperationResult<dc.CreateTeamData, dc.CreateTeamVariables> createRes = await _service.connector
|
||||
.createTeam(
|
||||
teamName: 'Business Team',
|
||||
ownerId: businessId,
|
||||
@@ -184,30 +186,30 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
final Uri uri = Uri.https(
|
||||
'maps.googleapis.com',
|
||||
'/maps/api/place/details/json',
|
||||
{
|
||||
<String, dynamic>{
|
||||
'place_id': placeId,
|
||||
'fields': 'address_component',
|
||||
'key': AppConfig.googleMapsApiKey,
|
||||
},
|
||||
);
|
||||
try {
|
||||
final response = await http.get(uri);
|
||||
final http.Response response = await http.get(uri);
|
||||
if (response.statusCode != 200) return null;
|
||||
|
||||
final payload = json.decode(response.body) as Map<String, dynamic>;
|
||||
final Map<String, dynamic> payload = json.decode(response.body) as Map<String, dynamic>;
|
||||
if (payload['status'] != 'OK') return null;
|
||||
|
||||
final result = payload['result'] as Map<String, dynamic>?;
|
||||
final components = result?['address_components'] as List<dynamic>?;
|
||||
final Map<String, dynamic>? result = payload['result'] as Map<String, dynamic>?;
|
||||
final List<dynamic>? components = result?['address_components'] as List<dynamic>?;
|
||||
if (components == null || components.isEmpty) return null;
|
||||
|
||||
String? streetNumber, route, city, state, country, zipCode;
|
||||
|
||||
for (var entry in components) {
|
||||
final component = entry as Map<String, dynamic>;
|
||||
final types = component['types'] as List<dynamic>? ?? [];
|
||||
final longName = component['long_name'] as String?;
|
||||
final shortName = component['short_name'] as String?;
|
||||
final Map<String, dynamic> component = entry as Map<String, dynamic>;
|
||||
final List<dynamic> types = component['types'] as List<dynamic>? ?? <dynamic>[];
|
||||
final String? longName = component['long_name'] as String?;
|
||||
final String? shortName = component['short_name'] as String?;
|
||||
|
||||
if (types.contains('street_number')) {
|
||||
streetNumber = longName;
|
||||
@@ -224,8 +226,8 @@ class HubsConnectorRepositoryImpl implements HubsConnectorRepository {
|
||||
}
|
||||
}
|
||||
|
||||
final street = [streetNumber, route]
|
||||
.where((v) => v != null && v.isNotEmpty)
|
||||
final String street = <String?>[streetNumber, route]
|
||||
.where((String? v) => v != null && v.isNotEmpty)
|
||||
.join(' ')
|
||||
.trim();
|
||||
|
||||
@@ -257,3 +259,4 @@ class _PlaceAddress {
|
||||
final String? country;
|
||||
final String? zipCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_data_connect/firebase_data_connect.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
@@ -21,25 +22,25 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForDailyOpsByBusinessData, dc.ListShiftsForDailyOpsByBusinessVariables> response = await _service.connector
|
||||
.listShiftsForDailyOpsByBusiness(
|
||||
businessId: id,
|
||||
date: _service.toTimestamp(date),
|
||||
)
|
||||
.execute();
|
||||
|
||||
final shifts = response.data.shifts;
|
||||
final List<dc.ListShiftsForDailyOpsByBusinessShifts> shifts = response.data.shifts;
|
||||
|
||||
int scheduledShifts = shifts.length;
|
||||
final int scheduledShifts = shifts.length;
|
||||
int workersConfirmed = 0;
|
||||
int inProgressShifts = 0;
|
||||
int completedShifts = 0;
|
||||
|
||||
final List<DailyOpsShift> dailyOpsShifts = [];
|
||||
final List<DailyOpsShift> dailyOpsShifts = <DailyOpsShift>[];
|
||||
|
||||
for (final shift in shifts) {
|
||||
for (final dc.ListShiftsForDailyOpsByBusinessShifts shift in shifts) {
|
||||
workersConfirmed += shift.filled ?? 0;
|
||||
final statusStr = shift.status?.stringValue ?? '';
|
||||
final String statusStr = shift.status?.stringValue ?? '';
|
||||
if (statusStr == 'IN_PROGRESS') inProgressShifts++;
|
||||
if (statusStr == 'COMPLETED') completedShifts++;
|
||||
|
||||
@@ -73,7 +74,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListInvoicesForSpendByBusinessData, dc.ListInvoicesForSpendByBusinessVariables> response = await _service.connector
|
||||
.listInvoicesForSpendByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -81,22 +82,22 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final invoices = response.data.invoices;
|
||||
final List<dc.ListInvoicesForSpendByBusinessInvoices> invoices = response.data.invoices;
|
||||
|
||||
double totalSpend = 0.0;
|
||||
int paidInvoices = 0;
|
||||
int pendingInvoices = 0;
|
||||
int overdueInvoices = 0;
|
||||
|
||||
final List<SpendInvoice> spendInvoices = [];
|
||||
final Map<DateTime, double> dailyAggregates = {};
|
||||
final Map<String, double> industryAggregates = {};
|
||||
final List<SpendInvoice> spendInvoices = <SpendInvoice>[];
|
||||
final Map<DateTime, double> dailyAggregates = <DateTime, double>{};
|
||||
final Map<String, double> industryAggregates = <String, double>{};
|
||||
|
||||
for (final inv in invoices) {
|
||||
final amount = (inv.amount ?? 0.0).toDouble();
|
||||
for (final dc.ListInvoicesForSpendByBusinessInvoices inv in invoices) {
|
||||
final double amount = (inv.amount ?? 0.0).toDouble();
|
||||
totalSpend += amount;
|
||||
|
||||
final statusStr = inv.status.stringValue;
|
||||
final String statusStr = inv.status.stringValue;
|
||||
if (statusStr == 'PAID') {
|
||||
paidInvoices++;
|
||||
} else if (statusStr == 'PENDING') {
|
||||
@@ -105,49 +106,49 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
overdueInvoices++;
|
||||
}
|
||||
|
||||
final industry = inv.vendor?.serviceSpecialty ?? 'Other';
|
||||
final String industry = inv.vendor.serviceSpecialty ?? 'Other';
|
||||
industryAggregates[industry] = (industryAggregates[industry] ?? 0.0) + amount;
|
||||
|
||||
final issueDateTime = inv.issueDate.toDateTime();
|
||||
final DateTime issueDateTime = inv.issueDate.toDateTime();
|
||||
spendInvoices.add(SpendInvoice(
|
||||
id: inv.id,
|
||||
invoiceNumber: inv.invoiceNumber ?? '',
|
||||
issueDate: issueDateTime,
|
||||
amount: amount,
|
||||
status: statusStr,
|
||||
vendorName: inv.vendor?.companyName ?? 'Unknown',
|
||||
vendorName: inv.vendor.companyName ?? 'Unknown',
|
||||
industry: industry,
|
||||
));
|
||||
|
||||
// Chart data aggregation
|
||||
final date = DateTime(issueDateTime.year, issueDateTime.month, issueDateTime.day);
|
||||
final DateTime date = DateTime(issueDateTime.year, issueDateTime.month, issueDateTime.day);
|
||||
dailyAggregates[date] = (dailyAggregates[date] ?? 0.0) + amount;
|
||||
}
|
||||
|
||||
// Ensure chart data covers all days in range
|
||||
final Map<DateTime, double> completeDailyAggregates = {};
|
||||
final Map<DateTime, double> completeDailyAggregates = <DateTime, double>{};
|
||||
for (int i = 0; i <= endDate.difference(startDate).inDays; i++) {
|
||||
final date = startDate.add(Duration(days: i));
|
||||
final normalizedDate = DateTime(date.year, date.month, date.day);
|
||||
final DateTime date = startDate.add(Duration(days: i));
|
||||
final DateTime normalizedDate = DateTime(date.year, date.month, date.day);
|
||||
completeDailyAggregates[normalizedDate] =
|
||||
dailyAggregates[normalizedDate] ?? 0.0;
|
||||
}
|
||||
|
||||
final List<SpendChartPoint> chartData = completeDailyAggregates.entries
|
||||
.map((e) => SpendChartPoint(date: e.key, amount: e.value))
|
||||
.map((MapEntry<DateTime, double> e) => SpendChartPoint(date: e.key, amount: e.value))
|
||||
.toList()
|
||||
..sort((a, b) => a.date.compareTo(b.date));
|
||||
..sort((SpendChartPoint a, SpendChartPoint b) => a.date.compareTo(b.date));
|
||||
|
||||
final List<SpendIndustryCategory> industryBreakdown = industryAggregates.entries
|
||||
.map((e) => SpendIndustryCategory(
|
||||
.map((MapEntry<String, double> e) => SpendIndustryCategory(
|
||||
name: e.key,
|
||||
amount: e.value,
|
||||
percentage: totalSpend > 0 ? (e.value / totalSpend * 100) : 0,
|
||||
))
|
||||
.toList()
|
||||
..sort((a, b) => b.amount.compareTo(a.amount));
|
||||
..sort((SpendIndustryCategory a, SpendIndustryCategory b) => b.amount.compareTo(a.amount));
|
||||
|
||||
final daysCount = endDate.difference(startDate).inDays + 1;
|
||||
final int daysCount = endDate.difference(startDate).inDays + 1;
|
||||
|
||||
return SpendReport(
|
||||
totalSpend: totalSpend,
|
||||
@@ -170,7 +171,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForCoverageData, dc.ListShiftsForCoverageVariables> response = await _service.connector
|
||||
.listShiftsForCoverage(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -178,36 +179,36 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final shifts = response.data.shifts;
|
||||
final List<dc.ListShiftsForCoverageShifts> shifts = response.data.shifts;
|
||||
|
||||
int totalNeeded = 0;
|
||||
int totalFilled = 0;
|
||||
final Map<DateTime, (int, int)> dailyStats = {};
|
||||
final Map<DateTime, (int, int)> dailyStats = <DateTime, (int, int)>{};
|
||||
|
||||
for (final shift in shifts) {
|
||||
final shiftDate = shift.date?.toDateTime() ?? DateTime.now();
|
||||
final date = DateTime(shiftDate.year, shiftDate.month, shiftDate.day);
|
||||
for (final dc.ListShiftsForCoverageShifts shift in shifts) {
|
||||
final DateTime shiftDate = shift.date?.toDateTime() ?? DateTime.now();
|
||||
final DateTime date = DateTime(shiftDate.year, shiftDate.month, shiftDate.day);
|
||||
|
||||
final needed = shift.workersNeeded ?? 0;
|
||||
final filled = shift.filled ?? 0;
|
||||
final int needed = shift.workersNeeded ?? 0;
|
||||
final int filled = shift.filled ?? 0;
|
||||
|
||||
totalNeeded += needed;
|
||||
totalFilled += filled;
|
||||
|
||||
final current = dailyStats[date] ?? (0, 0);
|
||||
final (int, int) current = dailyStats[date] ?? (0, 0);
|
||||
dailyStats[date] = (current.$1 + needed, current.$2 + filled);
|
||||
}
|
||||
|
||||
final List<CoverageDay> dailyCoverage = dailyStats.entries.map((e) {
|
||||
final needed = e.value.$1;
|
||||
final filled = e.value.$2;
|
||||
final List<CoverageDay> dailyCoverage = dailyStats.entries.map((MapEntry<DateTime, (int, int)> e) {
|
||||
final int needed = e.value.$1;
|
||||
final int filled = e.value.$2;
|
||||
return CoverageDay(
|
||||
date: e.key,
|
||||
needed: needed,
|
||||
filled: filled,
|
||||
percentage: needed == 0 ? 100.0 : (filled / needed) * 100.0,
|
||||
);
|
||||
}).toList()..sort((a, b) => a.date.compareTo(b.date));
|
||||
}).toList()..sort((CoverageDay a, CoverageDay b) => a.date.compareTo(b.date));
|
||||
|
||||
return CoverageReport(
|
||||
overallCoverage: totalNeeded == 0 ? 100.0 : (totalFilled / totalNeeded) * 100.0,
|
||||
@@ -226,7 +227,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForForecastByBusinessData, dc.ListShiftsForForecastByBusinessVariables> response = await _service.connector
|
||||
.listShiftsForForecastByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -234,43 +235,43 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final shifts = response.data.shifts;
|
||||
final List<dc.ListShiftsForForecastByBusinessShifts> shifts = response.data.shifts;
|
||||
|
||||
double projectedSpend = 0.0;
|
||||
int projectedWorkers = 0;
|
||||
double totalHours = 0.0;
|
||||
final Map<DateTime, (double, int)> dailyStats = {};
|
||||
final Map<DateTime, (double, int)> dailyStats = <DateTime, (double, int)>{};
|
||||
|
||||
// Weekly stats: index -> (cost, count, hours)
|
||||
final Map<int, (double, int, double)> weeklyStats = {
|
||||
final Map<int, (double, int, double)> weeklyStats = <int, (double, int, double)>{
|
||||
0: (0.0, 0, 0.0),
|
||||
1: (0.0, 0, 0.0),
|
||||
2: (0.0, 0, 0.0),
|
||||
3: (0.0, 0, 0.0),
|
||||
};
|
||||
|
||||
for (final shift in shifts) {
|
||||
final shiftDate = shift.date?.toDateTime() ?? DateTime.now();
|
||||
final date = DateTime(shiftDate.year, shiftDate.month, shiftDate.day);
|
||||
for (final dc.ListShiftsForForecastByBusinessShifts shift in shifts) {
|
||||
final DateTime shiftDate = shift.date?.toDateTime() ?? DateTime.now();
|
||||
final DateTime date = DateTime(shiftDate.year, shiftDate.month, shiftDate.day);
|
||||
|
||||
final cost = (shift.cost ?? 0.0).toDouble();
|
||||
final workers = shift.workersNeeded ?? 0;
|
||||
final hoursVal = (shift.hours ?? 0).toDouble();
|
||||
final shiftTotalHours = hoursVal * workers;
|
||||
final double cost = (shift.cost ?? 0.0).toDouble();
|
||||
final int workers = shift.workersNeeded ?? 0;
|
||||
final double hoursVal = (shift.hours ?? 0).toDouble();
|
||||
final double shiftTotalHours = hoursVal * workers;
|
||||
|
||||
projectedSpend += cost;
|
||||
projectedWorkers += workers;
|
||||
totalHours += shiftTotalHours;
|
||||
|
||||
final current = dailyStats[date] ?? (0.0, 0);
|
||||
final (double, int) current = dailyStats[date] ?? (0.0, 0);
|
||||
dailyStats[date] = (current.$1 + cost, current.$2 + workers);
|
||||
|
||||
// Weekly logic
|
||||
final diffDays = shiftDate.difference(startDate).inDays;
|
||||
final int diffDays = shiftDate.difference(startDate).inDays;
|
||||
if (diffDays >= 0) {
|
||||
final weekIndex = diffDays ~/ 7;
|
||||
final int weekIndex = diffDays ~/ 7;
|
||||
if (weekIndex < 4) {
|
||||
final wCurrent = weeklyStats[weekIndex]!;
|
||||
final (double, int, double) wCurrent = weeklyStats[weekIndex]!;
|
||||
weeklyStats[weekIndex] = (
|
||||
wCurrent.$1 + cost,
|
||||
wCurrent.$2 + 1,
|
||||
@@ -280,17 +281,17 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}
|
||||
}
|
||||
|
||||
final List<ForecastPoint> chartData = dailyStats.entries.map((e) {
|
||||
final List<ForecastPoint> chartData = dailyStats.entries.map((MapEntry<DateTime, (double, int)> e) {
|
||||
return ForecastPoint(
|
||||
date: e.key,
|
||||
projectedCost: e.value.$1,
|
||||
workersNeeded: e.value.$2,
|
||||
);
|
||||
}).toList()..sort((a, b) => a.date.compareTo(b.date));
|
||||
}).toList()..sort((ForecastPoint a, ForecastPoint b) => a.date.compareTo(b.date));
|
||||
|
||||
final List<ForecastWeek> weeklyBreakdown = [];
|
||||
final List<ForecastWeek> weeklyBreakdown = <ForecastWeek>[];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
final stats = weeklyStats[i]!;
|
||||
final (double, int, double) stats = weeklyStats[i]!;
|
||||
weeklyBreakdown.add(ForecastWeek(
|
||||
weekNumber: i + 1,
|
||||
totalCost: stats.$1,
|
||||
@@ -300,8 +301,8 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
));
|
||||
}
|
||||
|
||||
final weeksCount = (endDate.difference(startDate).inDays / 7).ceil();
|
||||
final avgWeeklySpend = weeksCount > 0 ? projectedSpend / weeksCount : 0.0;
|
||||
final int weeksCount = (endDate.difference(startDate).inDays / 7).ceil();
|
||||
final double avgWeeklySpend = weeksCount > 0 ? projectedSpend / weeksCount : 0.0;
|
||||
|
||||
return ForecastReport(
|
||||
projectedSpend: projectedSpend,
|
||||
@@ -324,7 +325,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForPerformanceByBusinessData, dc.ListShiftsForPerformanceByBusinessVariables> response = await _service.connector
|
||||
.listShiftsForPerformanceByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -332,7 +333,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final shifts = response.data.shifts;
|
||||
final List<dc.ListShiftsForPerformanceByBusinessShifts> shifts = response.data.shifts;
|
||||
|
||||
int totalNeeded = 0;
|
||||
int totalFilled = 0;
|
||||
@@ -340,7 +341,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
double totalFillTimeSeconds = 0.0;
|
||||
int filledShiftsWithTime = 0;
|
||||
|
||||
for (final shift in shifts) {
|
||||
for (final dc.ListShiftsForPerformanceByBusinessShifts shift in shifts) {
|
||||
totalNeeded += shift.workersNeeded ?? 0;
|
||||
totalFilled += shift.filled ?? 0;
|
||||
if ((shift.status?.stringValue ?? '') == 'COMPLETED') {
|
||||
@@ -348,8 +349,8 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
}
|
||||
|
||||
if (shift.filledAt != null && shift.createdAt != null) {
|
||||
final createdAt = shift.createdAt!.toDateTime();
|
||||
final filledAt = shift.filledAt!.toDateTime();
|
||||
final DateTime createdAt = shift.createdAt!.toDateTime();
|
||||
final DateTime filledAt = shift.filledAt!.toDateTime();
|
||||
totalFillTimeSeconds += filledAt.difference(createdAt).inSeconds;
|
||||
filledShiftsWithTime++;
|
||||
}
|
||||
@@ -366,7 +367,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
completionRate: completionRate,
|
||||
onTimeRate: 95.0,
|
||||
avgFillTimeHours: avgFillTimeHours,
|
||||
keyPerformanceIndicators: [
|
||||
keyPerformanceIndicators: <PerformanceMetric>[
|
||||
PerformanceMetric(label: 'Fill Rate', value: '${fillRate.toStringAsFixed(1)}%', trend: 0.02),
|
||||
PerformanceMetric(label: 'Completion', value: '${completionRate.toStringAsFixed(1)}%', trend: 0.05),
|
||||
PerformanceMetric(label: 'Avg Fill Time', value: '${avgFillTimeHours.toStringAsFixed(1)}h', trend: -0.1),
|
||||
@@ -384,7 +385,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
return _service.run(() async {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
|
||||
final shiftsResponse = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForNoShowRangeByBusinessData, dc.ListShiftsForNoShowRangeByBusinessVariables> shiftsResponse = await _service.connector
|
||||
.listShiftsForNoShowRangeByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -392,34 +393,34 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final shiftIds = shiftsResponse.data.shifts.map((s) => s.id).toList();
|
||||
final List<String> shiftIds = shiftsResponse.data.shifts.map((dc.ListShiftsForNoShowRangeByBusinessShifts s) => s.id).toList();
|
||||
if (shiftIds.isEmpty) {
|
||||
return const NoShowReport(totalNoShows: 0, noShowRate: 0, flaggedWorkers: []);
|
||||
return const NoShowReport(totalNoShows: 0, noShowRate: 0, flaggedWorkers: <NoShowWorker>[]);
|
||||
}
|
||||
|
||||
final appsResponse = await _service.connector
|
||||
final QueryResult<dc.ListApplicationsForNoShowRangeData, dc.ListApplicationsForNoShowRangeVariables> appsResponse = await _service.connector
|
||||
.listApplicationsForNoShowRange(shiftIds: shiftIds)
|
||||
.execute();
|
||||
|
||||
final apps = appsResponse.data.applications;
|
||||
final noShowApps = apps.where((a) => (a.status.stringValue) == 'NO_SHOW').toList();
|
||||
final noShowStaffIds = noShowApps.map((a) => a.staffId).toSet().toList();
|
||||
final List<dc.ListApplicationsForNoShowRangeApplications> apps = appsResponse.data.applications;
|
||||
final List<dc.ListApplicationsForNoShowRangeApplications> noShowApps = apps.where((dc.ListApplicationsForNoShowRangeApplications a) => (a.status.stringValue) == 'NO_SHOW').toList();
|
||||
final List<String> noShowStaffIds = noShowApps.map((dc.ListApplicationsForNoShowRangeApplications a) => a.staffId).toSet().toList();
|
||||
|
||||
if (noShowStaffIds.isEmpty) {
|
||||
return NoShowReport(
|
||||
totalNoShows: noShowApps.length,
|
||||
noShowRate: apps.isEmpty ? 0 : (noShowApps.length / apps.length) * 100.0,
|
||||
flaggedWorkers: [],
|
||||
flaggedWorkers: <NoShowWorker>[],
|
||||
);
|
||||
}
|
||||
|
||||
final staffResponse = await _service.connector
|
||||
final QueryResult<dc.ListStaffForNoShowReportData, dc.ListStaffForNoShowReportVariables> staffResponse = await _service.connector
|
||||
.listStaffForNoShowReport(staffIds: noShowStaffIds)
|
||||
.execute();
|
||||
|
||||
final staffList = staffResponse.data.staffs;
|
||||
final List<dc.ListStaffForNoShowReportStaffs> staffList = staffResponse.data.staffs;
|
||||
|
||||
final List<NoShowWorker> flaggedWorkers = staffList.map((s) => NoShowWorker(
|
||||
final List<NoShowWorker> flaggedWorkers = staffList.map((dc.ListStaffForNoShowReportStaffs s) => NoShowWorker(
|
||||
id: s.id,
|
||||
fullName: s.fullName ?? '',
|
||||
noShowCount: s.noShowCount ?? 0,
|
||||
@@ -444,7 +445,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
final String id = businessId ?? await _service.getBusinessId();
|
||||
|
||||
// Use forecast query for hours/cost data
|
||||
final shiftsResponse = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForForecastByBusinessData, dc.ListShiftsForForecastByBusinessVariables> shiftsResponse = await _service.connector
|
||||
.listShiftsForForecastByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -453,7 +454,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
.execute();
|
||||
|
||||
// Use performance query for avgFillTime (has filledAt + createdAt)
|
||||
final perfResponse = await _service.connector
|
||||
final QueryResult<dc.ListShiftsForPerformanceByBusinessData, dc.ListShiftsForPerformanceByBusinessVariables> perfResponse = await _service.connector
|
||||
.listShiftsForPerformanceByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -461,7 +462,7 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final invoicesResponse = await _service.connector
|
||||
final QueryResult<dc.ListInvoicesForSpendByBusinessData, dc.ListInvoicesForSpendByBusinessVariables> invoicesResponse = await _service.connector
|
||||
.listInvoicesForSpendByBusiness(
|
||||
businessId: id,
|
||||
startDate: _service.toTimestamp(startDate),
|
||||
@@ -469,15 +470,15 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
)
|
||||
.execute();
|
||||
|
||||
final forecastShifts = shiftsResponse.data.shifts;
|
||||
final perfShifts = perfResponse.data.shifts;
|
||||
final invoices = invoicesResponse.data.invoices;
|
||||
final List<dc.ListShiftsForForecastByBusinessShifts> forecastShifts = shiftsResponse.data.shifts;
|
||||
final List<dc.ListShiftsForPerformanceByBusinessShifts> perfShifts = perfResponse.data.shifts;
|
||||
final List<dc.ListInvoicesForSpendByBusinessInvoices> invoices = invoicesResponse.data.invoices;
|
||||
|
||||
// Aggregate hours and fill rate from forecast shifts
|
||||
double totalHours = 0;
|
||||
int totalNeeded = 0;
|
||||
|
||||
for (final shift in forecastShifts) {
|
||||
for (final dc.ListShiftsForForecastByBusinessShifts shift in forecastShifts) {
|
||||
totalHours += (shift.hours ?? 0).toDouble();
|
||||
totalNeeded += shift.workersNeeded ?? 0;
|
||||
}
|
||||
@@ -488,13 +489,13 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
double totalFillTimeSeconds = 0;
|
||||
int filledShiftsWithTime = 0;
|
||||
|
||||
for (final shift in perfShifts) {
|
||||
for (final dc.ListShiftsForPerformanceByBusinessShifts shift in perfShifts) {
|
||||
perfNeeded += shift.workersNeeded ?? 0;
|
||||
perfFilled += shift.filled ?? 0;
|
||||
|
||||
if (shift.filledAt != null && shift.createdAt != null) {
|
||||
final createdAt = shift.createdAt!.toDateTime();
|
||||
final filledAt = shift.filledAt!.toDateTime();
|
||||
final DateTime createdAt = shift.createdAt!.toDateTime();
|
||||
final DateTime filledAt = shift.filledAt!.toDateTime();
|
||||
totalFillTimeSeconds += filledAt.difference(createdAt).inSeconds;
|
||||
filledShiftsWithTime++;
|
||||
}
|
||||
@@ -502,19 +503,19 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
|
||||
// Aggregate total spend from invoices
|
||||
double totalSpend = 0;
|
||||
for (final inv in invoices) {
|
||||
for (final dc.ListInvoicesForSpendByBusinessInvoices inv in invoices) {
|
||||
totalSpend += (inv.amount ?? 0).toDouble();
|
||||
}
|
||||
|
||||
// Fetch no-show rate using forecast shift IDs
|
||||
final shiftIds = forecastShifts.map((s) => s.id).toList();
|
||||
final List<String> shiftIds = forecastShifts.map((dc.ListShiftsForForecastByBusinessShifts s) => s.id).toList();
|
||||
double noShowRate = 0;
|
||||
if (shiftIds.isNotEmpty) {
|
||||
final appsResponse = await _service.connector
|
||||
final QueryResult<dc.ListApplicationsForNoShowRangeData, dc.ListApplicationsForNoShowRangeVariables> appsResponse = await _service.connector
|
||||
.listApplicationsForNoShowRange(shiftIds: shiftIds)
|
||||
.execute();
|
||||
final apps = appsResponse.data.applications;
|
||||
final noShowApps = apps.where((a) => (a.status.stringValue) == 'NO_SHOW').toList();
|
||||
final List<dc.ListApplicationsForNoShowRangeApplications> apps = appsResponse.data.applications;
|
||||
final List<dc.ListApplicationsForNoShowRangeApplications> noShowApps = apps.where((dc.ListApplicationsForNoShowRangeApplications a) => (a.status.stringValue) == 'NO_SHOW').toList();
|
||||
noShowRate = apps.isEmpty ? 0 : (noShowApps.length / apps.length) * 100.0;
|
||||
}
|
||||
|
||||
@@ -533,3 +534,4 @@ class ReportsConnectorRepositoryImpl implements ReportsConnectorRepository {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_data_connect/firebase_data_connect.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
@@ -22,12 +23,12 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
required DateTime end,
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final query = _service.connector
|
||||
final dc.GetApplicationsByStaffIdVariablesBuilder query = _service.connector
|
||||
.getApplicationsByStaffId(staffId: staffId)
|
||||
.dayStart(_service.toTimestamp(start))
|
||||
.dayEnd(_service.toTimestamp(end));
|
||||
|
||||
final response = await query.execute();
|
||||
final QueryResult<dc.GetApplicationsByStaffIdData, dc.GetApplicationsByStaffIdVariables> response = await query.execute();
|
||||
return _mapApplicationsToShifts(response.data.applications);
|
||||
});
|
||||
}
|
||||
@@ -42,29 +43,29 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
// First, fetch all available shift roles for the vendor/business
|
||||
// Use the session owner ID (vendorId)
|
||||
final String? vendorId = dc.StaffSessionStore.instance.session?.ownerId;
|
||||
if (vendorId == null || vendorId.isEmpty) return [];
|
||||
if (vendorId == null || vendorId.isEmpty) return <Shift>[];
|
||||
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByVendorIdData, dc.ListShiftRolesByVendorIdVariables> response = await _service.connector
|
||||
.listShiftRolesByVendorId(vendorId: vendorId)
|
||||
.execute();
|
||||
|
||||
final allShiftRoles = response.data.shiftRoles;
|
||||
final List<dc.ListShiftRolesByVendorIdShiftRoles> allShiftRoles = response.data.shiftRoles;
|
||||
|
||||
// Fetch current applications to filter out already booked shifts
|
||||
final myAppsResponse = await _service.connector
|
||||
final QueryResult<dc.GetApplicationsByStaffIdData, dc.GetApplicationsByStaffIdVariables> myAppsResponse = await _service.connector
|
||||
.getApplicationsByStaffId(staffId: staffId)
|
||||
.execute();
|
||||
final Set<String> appliedShiftIds =
|
||||
myAppsResponse.data.applications.map((a) => a.shiftId).toSet();
|
||||
myAppsResponse.data.applications.map((dc.GetApplicationsByStaffIdApplications a) => a.shiftId).toSet();
|
||||
|
||||
final List<Shift> mappedShifts = [];
|
||||
for (final sr in allShiftRoles) {
|
||||
final List<Shift> mappedShifts = <Shift>[];
|
||||
for (final dc.ListShiftRolesByVendorIdShiftRoles sr in allShiftRoles) {
|
||||
if (appliedShiftIds.contains(sr.shiftId)) continue;
|
||||
|
||||
final DateTime? shiftDate = _service.toDateTime(sr.shift.date);
|
||||
final startDt = _service.toDateTime(sr.startTime);
|
||||
final endDt = _service.toDateTime(sr.endTime);
|
||||
final createdDt = _service.toDateTime(sr.createdAt);
|
||||
final DateTime? startDt = _service.toDateTime(sr.startTime);
|
||||
final DateTime? endDt = _service.toDateTime(sr.endTime);
|
||||
final DateTime? createdDt = _service.toDateTime(sr.createdAt);
|
||||
|
||||
mappedShifts.add(
|
||||
Shift(
|
||||
@@ -96,8 +97,8 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
}
|
||||
|
||||
if (query != null && query.isNotEmpty) {
|
||||
final lowerQuery = query.toLowerCase();
|
||||
return mappedShifts.where((s) {
|
||||
final String lowerQuery = query.toLowerCase();
|
||||
return mappedShifts.where((Shift s) {
|
||||
return s.title.toLowerCase().contains(lowerQuery) ||
|
||||
s.clientName.toLowerCase().contains(lowerQuery);
|
||||
}).toList();
|
||||
@@ -112,7 +113,7 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
return _service.run(() async {
|
||||
// Current schema doesn't have a specific "pending assignment" query that differs from confirmed
|
||||
// unless we filter by status. In the old repo it was returning an empty list.
|
||||
return [];
|
||||
return <Shift>[];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -124,10 +125,10 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
if (roleId != null && roleId.isNotEmpty) {
|
||||
final roleResult = await _service.connector
|
||||
final QueryResult<dc.GetShiftRoleByIdData, dc.GetShiftRoleByIdVariables> roleResult = await _service.connector
|
||||
.getShiftRoleById(shiftId: shiftId, roleId: roleId)
|
||||
.execute();
|
||||
final sr = roleResult.data.shiftRole;
|
||||
final dc.GetShiftRoleByIdShiftRole? sr = roleResult.data.shiftRole;
|
||||
if (sr == null) return null;
|
||||
|
||||
final DateTime? startDt = _service.toDateTime(sr.startTime);
|
||||
@@ -137,17 +138,17 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
bool hasApplied = false;
|
||||
String status = 'open';
|
||||
|
||||
final appsResponse = await _service.connector
|
||||
final QueryResult<dc.GetApplicationsByStaffIdData, dc.GetApplicationsByStaffIdVariables> appsResponse = await _service.connector
|
||||
.getApplicationsByStaffId(staffId: staffId)
|
||||
.execute();
|
||||
|
||||
final app = appsResponse.data.applications
|
||||
.where((a) => a.shiftId == shiftId && a.shiftRole.roleId == roleId)
|
||||
final dc.GetApplicationsByStaffIdApplications? app = appsResponse.data.applications
|
||||
.where((dc.GetApplicationsByStaffIdApplications a) => a.shiftId == shiftId && a.shiftRole.roleId == roleId)
|
||||
.firstOrNull;
|
||||
|
||||
if (app != null) {
|
||||
hasApplied = true;
|
||||
final s = app.status.stringValue;
|
||||
final String s = app.status.stringValue;
|
||||
status = _mapApplicationStatus(s);
|
||||
}
|
||||
|
||||
@@ -180,8 +181,8 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
);
|
||||
}
|
||||
|
||||
final result = await _service.connector.getShiftById(id: shiftId).execute();
|
||||
final s = result.data.shift;
|
||||
final QueryResult<dc.GetShiftByIdData, dc.GetShiftByIdVariables> result = await _service.connector.getShiftById(id: shiftId).execute();
|
||||
final dc.GetShiftByIdShift? s = result.data.shift;
|
||||
if (s == null) return null;
|
||||
|
||||
int? required;
|
||||
@@ -189,17 +190,17 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
Break? breakInfo;
|
||||
|
||||
try {
|
||||
final rolesRes = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByShiftIdData, dc.ListShiftRolesByShiftIdVariables> rolesRes = await _service.connector
|
||||
.listShiftRolesByShiftId(shiftId: shiftId)
|
||||
.execute();
|
||||
if (rolesRes.data.shiftRoles.isNotEmpty) {
|
||||
required = 0;
|
||||
filled = 0;
|
||||
for (var r in rolesRes.data.shiftRoles) {
|
||||
for (dc.ListShiftRolesByShiftIdShiftRoles r in rolesRes.data.shiftRoles) {
|
||||
required = (required ?? 0) + r.count;
|
||||
filled = (filled ?? 0) + (r.assigned ?? 0);
|
||||
}
|
||||
final firstRole = rolesRes.data.shiftRoles.first;
|
||||
final dc.ListShiftRolesByShiftIdShiftRoles firstRole = rolesRes.data.shiftRoles.first;
|
||||
breakInfo = BreakAdapter.fromData(
|
||||
isPaid: firstRole.isBreakPaid ?? false,
|
||||
breakTime: firstRole.breakType?.stringValue,
|
||||
@@ -207,9 +208,9 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
final startDt = _service.toDateTime(s.startTime);
|
||||
final endDt = _service.toDateTime(s.endTime);
|
||||
final createdDt = _service.toDateTime(s.createdAt);
|
||||
final DateTime? startDt = _service.toDateTime(s.startTime);
|
||||
final DateTime? endDt = _service.toDateTime(s.endTime);
|
||||
final DateTime? createdDt = _service.toDateTime(s.createdAt);
|
||||
|
||||
return Shift(
|
||||
id: s.id,
|
||||
@@ -243,17 +244,17 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
String? roleId,
|
||||
}) async {
|
||||
return _service.run(() async {
|
||||
final targetRoleId = roleId ?? '';
|
||||
final String targetRoleId = roleId ?? '';
|
||||
if (targetRoleId.isEmpty) throw Exception('Missing role id.');
|
||||
|
||||
final roleResult = await _service.connector
|
||||
final QueryResult<dc.GetShiftRoleByIdData, dc.GetShiftRoleByIdVariables> roleResult = await _service.connector
|
||||
.getShiftRoleById(shiftId: shiftId, roleId: targetRoleId)
|
||||
.execute();
|
||||
final role = roleResult.data.shiftRole;
|
||||
final dc.GetShiftRoleByIdShiftRole? role = roleResult.data.shiftRole;
|
||||
if (role == null) throw Exception('Shift role not found');
|
||||
|
||||
final shiftResult = await _service.connector.getShiftById(id: shiftId).execute();
|
||||
final shift = shiftResult.data.shift;
|
||||
final QueryResult<dc.GetShiftByIdData, dc.GetShiftByIdVariables> shiftResult = await _service.connector.getShiftById(id: shiftId).execute();
|
||||
final dc.GetShiftByIdShift? shift = shiftResult.data.shift;
|
||||
if (shift == null) throw Exception('Shift not found');
|
||||
|
||||
// Validate daily limit
|
||||
@@ -262,7 +263,7 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
final DateTime dayStartUtc = DateTime.utc(shiftDate.year, shiftDate.month, shiftDate.day);
|
||||
final DateTime dayEndUtc = dayStartUtc.add(const Duration(days: 1)).subtract(const Duration(microseconds: 1));
|
||||
|
||||
final validationResponse = await _service.connector
|
||||
final QueryResult<dc.VaidateDayStaffApplicationData, dc.VaidateDayStaffApplicationVariables> validationResponse = await _service.connector
|
||||
.vaidateDayStaffApplication(staffId: staffId)
|
||||
.dayStart(_service.toTimestamp(dayStartUtc))
|
||||
.dayEnd(_service.toTimestamp(dayEndUtc))
|
||||
@@ -274,7 +275,7 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
}
|
||||
|
||||
// Check for existing application
|
||||
final existingAppRes = await _service.connector
|
||||
final QueryResult<dc.GetApplicationByStaffShiftAndRoleData, dc.GetApplicationByStaffShiftAndRoleVariables> existingAppRes = await _service.connector
|
||||
.getApplicationByStaffShiftAndRole(
|
||||
staffId: staffId,
|
||||
shiftId: shiftId,
|
||||
@@ -294,7 +295,7 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
|
||||
String? createdAppId;
|
||||
try {
|
||||
final createRes = await _service.connector.createApplication(
|
||||
final OperationResult<dc.CreateApplicationData, dc.CreateApplicationVariables> createRes = await _service.connector.createApplication(
|
||||
shiftId: shiftId,
|
||||
staffId: staffId,
|
||||
roleId: targetRoleId,
|
||||
@@ -343,19 +344,19 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
Future<List<Shift>> getCancelledShifts({required String staffId}) async {
|
||||
return _service.run(() async {
|
||||
// Logic would go here to fetch by REJECTED status if needed
|
||||
return [];
|
||||
return <Shift>[];
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<Shift>> getHistoryShifts({required String staffId}) async {
|
||||
return _service.run(() async {
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.ListCompletedApplicationsByStaffIdData, dc.ListCompletedApplicationsByStaffIdVariables> response = await _service.connector
|
||||
.listCompletedApplicationsByStaffId(staffId: staffId)
|
||||
.execute();
|
||||
|
||||
final List<Shift> shifts = [];
|
||||
for (final app in response.data.applications) {
|
||||
final List<Shift> shifts = <Shift>[];
|
||||
for (final dc.ListCompletedApplicationsByStaffIdApplications app in response.data.applications) {
|
||||
final String roleName = app.shiftRole.role.name;
|
||||
final String orderName = (app.shift.order.eventName ?? '').trim().isNotEmpty
|
||||
? app.shift.order.eventName!
|
||||
@@ -478,12 +479,12 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
) async {
|
||||
return _service.run(() async {
|
||||
// First try to find the application
|
||||
final appsResponse = await _service.connector
|
||||
final QueryResult<dc.GetApplicationsByStaffIdData, dc.GetApplicationsByStaffIdVariables> appsResponse = await _service.connector
|
||||
.getApplicationsByStaffId(staffId: staffId)
|
||||
.execute();
|
||||
|
||||
final app = appsResponse.data.applications
|
||||
.where((a) => a.shiftId == shiftId)
|
||||
final dc.GetApplicationsByStaffIdApplications? app = appsResponse.data.applications
|
||||
.where((dc.GetApplicationsByStaffIdApplications a) => a.shiftId == shiftId)
|
||||
.firstOrNull;
|
||||
|
||||
if (app != null) {
|
||||
@@ -493,12 +494,12 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
.execute();
|
||||
} else if (newStatus == dc.ApplicationStatus.REJECTED) {
|
||||
// If declining but no app found, create a rejected application
|
||||
final rolesRes = await _service.connector
|
||||
final QueryResult<dc.ListShiftRolesByShiftIdData, dc.ListShiftRolesByShiftIdVariables> rolesRes = await _service.connector
|
||||
.listShiftRolesByShiftId(shiftId: shiftId)
|
||||
.execute();
|
||||
|
||||
if (rolesRes.data.shiftRoles.isNotEmpty) {
|
||||
final firstRole = rolesRes.data.shiftRoles.first;
|
||||
final dc.ListShiftRolesByShiftIdShiftRoles firstRole = rolesRes.data.shiftRoles.first;
|
||||
await _service.connector.createApplication(
|
||||
shiftId: shiftId,
|
||||
staffId: staffId,
|
||||
@@ -513,3 +514,4 @@ class ShiftsConnectorRepositoryImpl implements ShiftsConnectorRepository {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,10 +105,10 @@ class StaffConnectorRepositoryImpl implements StaffConnectorRepository {
|
||||
/// Checks if personal info is complete.
|
||||
bool _isPersonalInfoComplete(GetStaffPersonalInfoCompletionStaff? staff) {
|
||||
if (staff == null) return false;
|
||||
final String? fullName = staff.fullName;
|
||||
final String fullName = staff.fullName;
|
||||
final String? email = staff.email;
|
||||
final String? phone = staff.phone;
|
||||
return (fullName?.trim().isNotEmpty ?? false) &&
|
||||
return (fullName.trim().isNotEmpty ?? false) &&
|
||||
(email?.trim().isNotEmpty ?? false) &&
|
||||
(phone?.trim().isNotEmpty ?? false);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_auth/firebase_auth.dart' as firebase;
|
||||
import 'package:firebase_data_connect/firebase_data_connect.dart' as fdc;
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -197,7 +198,6 @@ class DataConnectService with DataErrorHandler, SessionHandlerMixin {
|
||||
}
|
||||
|
||||
/// Executes an operation with centralized error handling.
|
||||
@override
|
||||
Future<T> run<T>(
|
||||
Future<T> Function() operation, {
|
||||
bool requiresAuthentication = true,
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
class ClientBusinessSession {
|
||||
final String id;
|
||||
final String businessName;
|
||||
final String? email;
|
||||
final String? city;
|
||||
final String? contactName;
|
||||
final String? companyLogoUrl;
|
||||
|
||||
const ClientBusinessSession({
|
||||
required this.id,
|
||||
@@ -14,15 +8,23 @@ class ClientBusinessSession {
|
||||
this.contactName,
|
||||
this.companyLogoUrl,
|
||||
});
|
||||
final String id;
|
||||
final String businessName;
|
||||
final String? email;
|
||||
final String? city;
|
||||
final String? contactName;
|
||||
final String? companyLogoUrl;
|
||||
}
|
||||
|
||||
class ClientSession {
|
||||
final ClientBusinessSession? business;
|
||||
|
||||
const ClientSession({required this.business});
|
||||
final ClientBusinessSession? business;
|
||||
}
|
||||
|
||||
class ClientSessionStore {
|
||||
|
||||
ClientSessionStore._();
|
||||
ClientSession? _session;
|
||||
|
||||
ClientSession? get session => _session;
|
||||
@@ -36,6 +38,4 @@ class ClientSessionStore {
|
||||
}
|
||||
|
||||
static final ClientSessionStore instance = ClientSessionStore._();
|
||||
|
||||
ClientSessionStore._();
|
||||
}
|
||||
|
||||
@@ -85,8 +85,9 @@ class UiTheme {
|
||||
overlayColor: WidgetStateProperty.resolveWith((
|
||||
Set<WidgetState> states,
|
||||
) {
|
||||
if (states.contains(WidgetState.hovered))
|
||||
if (states.contains(WidgetState.hovered)) {
|
||||
return UiColors.buttonPrimaryHover;
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -6,6 +6,19 @@ import '../ui_icons.dart';
|
||||
///
|
||||
/// This widget provides a consistent look and feel for top app bars across the application.
|
||||
class UiAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
|
||||
const UiAppBar({
|
||||
super.key,
|
||||
this.title,
|
||||
this.titleWidget,
|
||||
this.leading,
|
||||
this.actions,
|
||||
this.height = kToolbarHeight,
|
||||
this.centerTitle = true,
|
||||
this.onLeadingPressed,
|
||||
this.showBackButton = true,
|
||||
this.bottom,
|
||||
});
|
||||
/// The title text to display in the app bar.
|
||||
final String? title;
|
||||
|
||||
@@ -36,19 +49,6 @@ class UiAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
/// Typically a [TabBar]. Only widgets that implement [PreferredSizeWidget] can be used at the bottom of an app bar.
|
||||
final PreferredSizeWidget? bottom;
|
||||
|
||||
const UiAppBar({
|
||||
super.key,
|
||||
this.title,
|
||||
this.titleWidget,
|
||||
this.leading,
|
||||
this.actions,
|
||||
this.height = kToolbarHeight,
|
||||
this.centerTitle = true,
|
||||
this.onLeadingPressed,
|
||||
this.showBackButton = true,
|
||||
this.bottom,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
|
||||
@@ -3,6 +3,96 @@ import '../ui_constants.dart';
|
||||
|
||||
/// A custom button widget with different variants and icon support.
|
||||
class UiButton extends StatelessWidget {
|
||||
|
||||
/// Creates a [UiButton] with a custom button builder.
|
||||
const UiButton({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
required this.buttonBuilder,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a primary button using [ElevatedButton].
|
||||
const UiButton.primary({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _elevatedButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a secondary button using [OutlinedButton].
|
||||
const UiButton.secondary({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _outlinedButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a text button using [TextButton].
|
||||
const UiButton.text({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _textButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a ghost button (transparent background).
|
||||
const UiButton.ghost({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _textButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
/// The text to display on the button.
|
||||
final String? text;
|
||||
|
||||
@@ -39,100 +129,10 @@ class UiButton extends StatelessWidget {
|
||||
)
|
||||
buttonBuilder;
|
||||
|
||||
/// Creates a [UiButton] with a custom button builder.
|
||||
const UiButton({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
required this.buttonBuilder,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a primary button using [ElevatedButton].
|
||||
UiButton.primary({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _elevatedButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a secondary button using [OutlinedButton].
|
||||
UiButton.secondary({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _outlinedButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a text button using [TextButton].
|
||||
UiButton.text({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _textButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
/// Creates a ghost button (transparent background).
|
||||
UiButton.ghost({
|
||||
super.key,
|
||||
this.text,
|
||||
this.child,
|
||||
this.onPressed,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.style,
|
||||
this.iconSize = 20,
|
||||
this.size = UiButtonSize.large,
|
||||
this.fullWidth = false,
|
||||
}) : buttonBuilder = _textButtonBuilder,
|
||||
assert(
|
||||
text != null || child != null,
|
||||
'Either text or child must be provided',
|
||||
);
|
||||
|
||||
@override
|
||||
/// Builds the button UI.
|
||||
Widget build(BuildContext context) {
|
||||
final ButtonStyle? mergedStyle = style != null
|
||||
final ButtonStyle mergedStyle = style != null
|
||||
? _getSizeStyle().merge(style)
|
||||
: _getSizeStyle();
|
||||
|
||||
|
||||
@@ -29,6 +29,19 @@ enum UiChipVariant {
|
||||
|
||||
/// A custom chip widget with supports for different sizes, themes, and icons.
|
||||
class UiChip extends StatelessWidget {
|
||||
|
||||
/// Creates a [UiChip].
|
||||
const UiChip({
|
||||
super.key,
|
||||
required this.label,
|
||||
this.size = UiChipSize.medium,
|
||||
this.variant = UiChipVariant.secondary,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.onTap,
|
||||
this.onTrailingIconTap,
|
||||
this.isSelected = false,
|
||||
});
|
||||
/// The text label to display.
|
||||
final String label;
|
||||
|
||||
@@ -53,19 +66,6 @@ class UiChip extends StatelessWidget {
|
||||
/// Whether the chip is currently selected/active.
|
||||
final bool isSelected;
|
||||
|
||||
/// Creates a [UiChip].
|
||||
const UiChip({
|
||||
super.key,
|
||||
required this.label,
|
||||
this.size = UiChipSize.medium,
|
||||
this.variant = UiChipVariant.secondary,
|
||||
this.leadingIcon,
|
||||
this.trailingIcon,
|
||||
this.onTap,
|
||||
this.onTrailingIconTap,
|
||||
this.isSelected = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Color backgroundColor = _getBackgroundColor();
|
||||
|
||||
@@ -5,26 +5,6 @@ import '../ui_constants.dart';
|
||||
|
||||
/// A custom icon button with blur effect and different variants.
|
||||
class UiIconButton extends StatelessWidget {
|
||||
/// The icon to display.
|
||||
final IconData icon;
|
||||
|
||||
/// The size of the icon button.
|
||||
final double size;
|
||||
|
||||
/// The size of the icon.
|
||||
final double iconSize;
|
||||
|
||||
/// The background color of the button.
|
||||
final Color backgroundColor;
|
||||
|
||||
/// The color of the icon.
|
||||
final Color iconColor;
|
||||
|
||||
/// Whether to apply blur effect.
|
||||
final bool useBlur;
|
||||
|
||||
/// Callback when the button is tapped.
|
||||
final VoidCallback? onTap;
|
||||
|
||||
/// Creates a [UiIconButton] with custom properties.
|
||||
const UiIconButton({
|
||||
@@ -59,6 +39,26 @@ class UiIconButton extends StatelessWidget {
|
||||
}) : backgroundColor = UiColors.primary.withAlpha(96),
|
||||
iconColor = UiColors.primary,
|
||||
useBlur = true;
|
||||
/// The icon to display.
|
||||
final IconData icon;
|
||||
|
||||
/// The size of the icon button.
|
||||
final double size;
|
||||
|
||||
/// The size of the icon.
|
||||
final double iconSize;
|
||||
|
||||
/// The background color of the button.
|
||||
final Color backgroundColor;
|
||||
|
||||
/// The color of the icon.
|
||||
final Color iconColor;
|
||||
|
||||
/// Whether to apply blur effect.
|
||||
final bool useBlur;
|
||||
|
||||
/// Callback when the button is tapped.
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
/// Builds the icon button UI.
|
||||
|
||||
@@ -8,6 +8,26 @@ import '../ui_colors.dart';
|
||||
///
|
||||
/// This widget combines a label and a [TextField] with consistent styling.
|
||||
class UiTextField extends StatelessWidget {
|
||||
|
||||
const UiTextField({
|
||||
super.key,
|
||||
this.label,
|
||||
this.hintText,
|
||||
this.onChanged,
|
||||
this.controller,
|
||||
this.keyboardType,
|
||||
this.maxLines = 1,
|
||||
this.obscureText = false,
|
||||
this.textInputAction,
|
||||
this.onSubmitted,
|
||||
this.autofocus = false,
|
||||
this.inputFormatters,
|
||||
this.prefixIcon,
|
||||
this.suffixIcon,
|
||||
this.suffix,
|
||||
this.readOnly = false,
|
||||
this.onTap,
|
||||
});
|
||||
/// The label text to display above the text field.
|
||||
final String? label;
|
||||
|
||||
@@ -56,26 +76,6 @@ class UiTextField extends StatelessWidget {
|
||||
/// Callback when the text field is tapped.
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const UiTextField({
|
||||
super.key,
|
||||
this.label,
|
||||
this.hintText,
|
||||
this.onChanged,
|
||||
this.controller,
|
||||
this.keyboardType,
|
||||
this.maxLines = 1,
|
||||
this.obscureText = false,
|
||||
this.textInputAction,
|
||||
this.onSubmitted,
|
||||
this.autofocus = false,
|
||||
this.inputFormatters,
|
||||
this.prefixIcon,
|
||||
this.suffixIcon,
|
||||
this.suffix,
|
||||
this.readOnly = false,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
|
||||
@@ -2,18 +2,18 @@ import '../../entities/availability/availability_slot.dart';
|
||||
|
||||
/// Adapter for [AvailabilitySlot] domain entity.
|
||||
class AvailabilityAdapter {
|
||||
static const Map<String, Map<String, String>> _slotDefinitions = {
|
||||
'MORNING': {
|
||||
static const Map<String, Map<String, String>> _slotDefinitions = <String, Map<String, String>>{
|
||||
'MORNING': <String, String>{
|
||||
'id': 'morning',
|
||||
'label': 'Morning',
|
||||
'timeRange': '4:00 AM - 12:00 PM',
|
||||
},
|
||||
'AFTERNOON': {
|
||||
'AFTERNOON': <String, String>{
|
||||
'id': 'afternoon',
|
||||
'label': 'Afternoon',
|
||||
'timeRange': '12:00 PM - 6:00 PM',
|
||||
},
|
||||
'EVENING': {
|
||||
'EVENING': <String, String>{
|
||||
'id': 'evening',
|
||||
'label': 'Evening',
|
||||
'timeRange': '6:00 PM - 12:00 AM',
|
||||
@@ -22,7 +22,7 @@ class AvailabilityAdapter {
|
||||
|
||||
/// Converts a backend slot name (e.g. 'MORNING') to a Domain [AvailabilitySlot].
|
||||
static AvailabilitySlot fromPrimitive(String slotName, {bool isAvailable = false}) {
|
||||
final def = _slotDefinitions[slotName.toUpperCase()] ?? _slotDefinitions['MORNING']!;
|
||||
final Map<String, String> def = _slotDefinitions[slotName.toUpperCase()] ?? _slotDefinitions['MORNING']!;
|
||||
return AvailabilitySlot(
|
||||
id: def['id']!,
|
||||
label: def['label']!,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import '../../entities/shifts/shift.dart';
|
||||
import '../../entities/clock_in/attendance_status.dart';
|
||||
|
||||
/// Adapter for Clock In related data.
|
||||
|
||||
@@ -18,7 +18,7 @@ class TaxFormAdapter {
|
||||
final TaxFormType formType = _stringToType(type);
|
||||
final TaxFormStatus formStatus = _stringToStatus(status);
|
||||
final Map<String, dynamic> formDetails =
|
||||
formData is Map ? Map<String, dynamic>.from(formData as Map) : <String, dynamic>{};
|
||||
formData is Map ? Map<String, dynamic>.from(formData) : <String, dynamic>{};
|
||||
|
||||
if (formType == TaxFormType.i9) {
|
||||
return I9TaxForm(
|
||||
|
||||
@@ -2,10 +2,6 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a specific time slot within a day (e.g., Morning, Afternoon, Evening).
|
||||
class AvailabilitySlot extends Equatable {
|
||||
final String id;
|
||||
final String label;
|
||||
final String timeRange;
|
||||
final bool isAvailable;
|
||||
|
||||
const AvailabilitySlot({
|
||||
required this.id,
|
||||
@@ -13,6 +9,10 @@ class AvailabilitySlot extends Equatable {
|
||||
required this.timeRange,
|
||||
this.isAvailable = true,
|
||||
});
|
||||
final String id;
|
||||
final String label;
|
||||
final String timeRange;
|
||||
final bool isAvailable;
|
||||
|
||||
AvailabilitySlot copyWith({
|
||||
String? id,
|
||||
@@ -29,5 +29,5 @@ class AvailabilitySlot extends Equatable {
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, label, timeRange, isAvailable];
|
||||
List<Object?> get props => <Object?>[id, label, timeRange, isAvailable];
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ import 'availability_slot.dart';
|
||||
|
||||
/// Represents availability configuration for a specific date.
|
||||
class DayAvailability extends Equatable {
|
||||
final DateTime date;
|
||||
final bool isAvailable;
|
||||
final List<AvailabilitySlot> slots;
|
||||
|
||||
const DayAvailability({
|
||||
required this.date,
|
||||
this.isAvailable = false,
|
||||
this.slots = const [],
|
||||
this.slots = const <AvailabilitySlot>[],
|
||||
});
|
||||
final DateTime date;
|
||||
final bool isAvailable;
|
||||
final List<AvailabilitySlot> slots;
|
||||
|
||||
DayAvailability copyWith({
|
||||
DateTime? date,
|
||||
@@ -27,5 +27,5 @@ class DayAvailability extends Equatable {
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [date, isAvailable, slots];
|
||||
List<Object?> get props => <Object?>[date, isAvailable, slots];
|
||||
}
|
||||
|
||||
@@ -2,11 +2,6 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Simple entity to hold attendance state
|
||||
class AttendanceStatus extends Equatable {
|
||||
final bool isCheckedIn;
|
||||
final DateTime? checkInTime;
|
||||
final DateTime? checkOutTime;
|
||||
final String? activeShiftId;
|
||||
final String? activeApplicationId;
|
||||
|
||||
const AttendanceStatus({
|
||||
this.isCheckedIn = false,
|
||||
@@ -15,9 +10,14 @@ class AttendanceStatus extends Equatable {
|
||||
this.activeShiftId,
|
||||
this.activeApplicationId,
|
||||
});
|
||||
final bool isCheckedIn;
|
||||
final DateTime? checkInTime;
|
||||
final DateTime? checkOutTime;
|
||||
final String? activeShiftId;
|
||||
final String? activeApplicationId;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
isCheckedIn,
|
||||
checkInTime,
|
||||
checkOutTime,
|
||||
|
||||
@@ -2,10 +2,6 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Summary of staff earnings.
|
||||
class PaymentSummary extends Equatable {
|
||||
final double weeklyEarnings;
|
||||
final double monthlyEarnings;
|
||||
final double pendingEarnings;
|
||||
final double totalEarnings;
|
||||
|
||||
const PaymentSummary({
|
||||
required this.weeklyEarnings,
|
||||
@@ -13,9 +9,13 @@ class PaymentSummary extends Equatable {
|
||||
required this.pendingEarnings,
|
||||
required this.totalEarnings,
|
||||
});
|
||||
final double weeklyEarnings;
|
||||
final double monthlyEarnings;
|
||||
final double pendingEarnings;
|
||||
final double totalEarnings;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
weeklyEarnings,
|
||||
monthlyEarnings,
|
||||
pendingEarnings,
|
||||
|
||||
@@ -23,6 +23,21 @@ enum TimeCardStatus {
|
||||
|
||||
/// Represents a time card for a staff member.
|
||||
class TimeCard extends Equatable {
|
||||
|
||||
/// Creates a [TimeCard].
|
||||
const TimeCard({
|
||||
required this.id,
|
||||
required this.shiftTitle,
|
||||
required this.clientName,
|
||||
required this.date,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
required this.totalHours,
|
||||
required this.hourlyRate,
|
||||
required this.totalPay,
|
||||
required this.status,
|
||||
this.location,
|
||||
});
|
||||
/// Unique identifier of the time card (often matches Application ID).
|
||||
final String id;
|
||||
/// Title of the shift.
|
||||
@@ -46,23 +61,8 @@ class TimeCard extends Equatable {
|
||||
/// Location name.
|
||||
final String? location;
|
||||
|
||||
/// Creates a [TimeCard].
|
||||
const TimeCard({
|
||||
required this.id,
|
||||
required this.shiftTitle,
|
||||
required this.clientName,
|
||||
required this.date,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
required this.totalHours,
|
||||
required this.hourlyRate,
|
||||
required this.totalPay,
|
||||
required this.status,
|
||||
this.location,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
shiftTitle,
|
||||
clientName,
|
||||
|
||||
@@ -26,7 +26,7 @@ class PermanentOrder extends Equatable {
|
||||
final Map<String, double> roleRates;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
startDate,
|
||||
permanentDays,
|
||||
positions,
|
||||
|
||||
@@ -4,6 +4,15 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Attire items are specific clothing or equipment required for jobs.
|
||||
class AttireItem extends Equatable {
|
||||
|
||||
/// Creates an [AttireItem].
|
||||
const AttireItem({
|
||||
required this.id,
|
||||
required this.label,
|
||||
this.iconName,
|
||||
this.imageUrl,
|
||||
this.isMandatory = false,
|
||||
});
|
||||
/// Unique identifier of the attire item.
|
||||
final String id;
|
||||
|
||||
@@ -19,15 +28,6 @@ class AttireItem extends Equatable {
|
||||
/// Whether this item is mandatory for onboarding.
|
||||
final bool isMandatory;
|
||||
|
||||
/// Creates an [AttireItem].
|
||||
const AttireItem({
|
||||
required this.id,
|
||||
required this.label,
|
||||
this.iconName,
|
||||
this.imageUrl,
|
||||
this.isMandatory = false,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[id, label, iconName, imageUrl, isMandatory];
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ enum ExperienceSkill {
|
||||
|
||||
static ExperienceSkill? fromString(String value) {
|
||||
try {
|
||||
return ExperienceSkill.values.firstWhere((e) => e.value == value);
|
||||
return ExperienceSkill.values.firstWhere((ExperienceSkill e) => e.value == value);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ enum Industry {
|
||||
|
||||
static Industry? fromString(String value) {
|
||||
try {
|
||||
return Industry.values.firstWhere((e) => e.value == value);
|
||||
return Industry.values.firstWhere((Industry e) => e.value == value);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,17 @@ enum DocumentStatus {
|
||||
|
||||
/// Represents a staff compliance document.
|
||||
class StaffDocument extends Equatable {
|
||||
|
||||
const StaffDocument({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.documentId,
|
||||
required this.name,
|
||||
this.description,
|
||||
required this.status,
|
||||
this.documentUrl,
|
||||
this.expiryDate,
|
||||
});
|
||||
/// The unique identifier of the staff document record.
|
||||
final String id;
|
||||
|
||||
@@ -35,19 +46,8 @@ class StaffDocument extends Equatable {
|
||||
/// The expiry date of the document.
|
||||
final DateTime? expiryDate;
|
||||
|
||||
const StaffDocument({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.documentId,
|
||||
required this.name,
|
||||
this.description,
|
||||
required this.status,
|
||||
this.documentUrl,
|
||||
this.expiryDate,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
staffId,
|
||||
documentId,
|
||||
|
||||
@@ -5,6 +5,18 @@ enum TaxFormType { i9, w4 }
|
||||
enum TaxFormStatus { notStarted, inProgress, submitted, approved, rejected }
|
||||
|
||||
abstract class TaxForm extends Equatable {
|
||||
|
||||
const TaxForm({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.description,
|
||||
this.status = TaxFormStatus.notStarted,
|
||||
this.staffId,
|
||||
this.formData = const <String, dynamic>{},
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
final String id;
|
||||
TaxFormType get type;
|
||||
final String title;
|
||||
@@ -16,20 +28,8 @@ abstract class TaxForm extends Equatable {
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
const TaxForm({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.description,
|
||||
this.status = TaxFormStatus.notStarted,
|
||||
this.staffId,
|
||||
this.formData = const {},
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
type,
|
||||
title,
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class CoverageReport extends Equatable {
|
||||
final double overallCoverage;
|
||||
final int totalNeeded;
|
||||
final int totalFilled;
|
||||
final List<CoverageDay> dailyCoverage;
|
||||
|
||||
const CoverageReport({
|
||||
required this.overallCoverage,
|
||||
@@ -12,16 +9,16 @@ class CoverageReport extends Equatable {
|
||||
required this.totalFilled,
|
||||
required this.dailyCoverage,
|
||||
});
|
||||
final double overallCoverage;
|
||||
final int totalNeeded;
|
||||
final int totalFilled;
|
||||
final List<CoverageDay> dailyCoverage;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [overallCoverage, totalNeeded, totalFilled, dailyCoverage];
|
||||
List<Object?> get props => <Object?>[overallCoverage, totalNeeded, totalFilled, dailyCoverage];
|
||||
}
|
||||
|
||||
class CoverageDay extends Equatable {
|
||||
final DateTime date;
|
||||
final int needed;
|
||||
final int filled;
|
||||
final double percentage;
|
||||
|
||||
const CoverageDay({
|
||||
required this.date,
|
||||
@@ -29,7 +26,12 @@ class CoverageDay extends Equatable {
|
||||
required this.filled,
|
||||
required this.percentage,
|
||||
});
|
||||
final DateTime date;
|
||||
final int needed;
|
||||
final int filled;
|
||||
final double percentage;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [date, needed, filled, percentage];
|
||||
List<Object?> get props => <Object?>[date, needed, filled, percentage];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class DailyOpsReport extends Equatable {
|
||||
final int scheduledShifts;
|
||||
final int workersConfirmed;
|
||||
final int inProgressShifts;
|
||||
final int completedShifts;
|
||||
final List<DailyOpsShift> shifts;
|
||||
|
||||
const DailyOpsReport({
|
||||
required this.scheduledShifts,
|
||||
@@ -14,9 +10,14 @@ class DailyOpsReport extends Equatable {
|
||||
required this.completedShifts,
|
||||
required this.shifts,
|
||||
});
|
||||
final int scheduledShifts;
|
||||
final int workersConfirmed;
|
||||
final int inProgressShifts;
|
||||
final int completedShifts;
|
||||
final List<DailyOpsShift> shifts;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
scheduledShifts,
|
||||
workersConfirmed,
|
||||
inProgressShifts,
|
||||
@@ -26,15 +27,6 @@ class DailyOpsReport extends Equatable {
|
||||
}
|
||||
|
||||
class DailyOpsShift extends Equatable {
|
||||
final String id;
|
||||
final String title;
|
||||
final String location;
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
final int workersNeeded;
|
||||
final int filled;
|
||||
final String status;
|
||||
final double? hourlyRate;
|
||||
|
||||
const DailyOpsShift({
|
||||
required this.id,
|
||||
@@ -47,9 +39,18 @@ class DailyOpsShift extends Equatable {
|
||||
required this.status,
|
||||
this.hourlyRate,
|
||||
});
|
||||
final String id;
|
||||
final String title;
|
||||
final String location;
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
final int workersNeeded;
|
||||
final int filled;
|
||||
final String status;
|
||||
final double? hourlyRate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
title,
|
||||
location,
|
||||
@@ -61,3 +62,4 @@ class DailyOpsShift extends Equatable {
|
||||
hourlyRate,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class ForecastReport extends Equatable {
|
||||
|
||||
const ForecastReport({
|
||||
required this.projectedSpend,
|
||||
required this.projectedWorkers,
|
||||
required this.averageLaborCost,
|
||||
required this.chartData,
|
||||
this.totalShifts = 0,
|
||||
this.totalHours = 0.0,
|
||||
this.avgWeeklySpend = 0.0,
|
||||
this.weeklyBreakdown = const <ForecastWeek>[],
|
||||
});
|
||||
final double projectedSpend;
|
||||
final int projectedWorkers;
|
||||
final double averageLaborCost;
|
||||
@@ -12,19 +24,8 @@ class ForecastReport extends Equatable {
|
||||
final double avgWeeklySpend;
|
||||
final List<ForecastWeek> weeklyBreakdown;
|
||||
|
||||
const ForecastReport({
|
||||
required this.projectedSpend,
|
||||
required this.projectedWorkers,
|
||||
required this.averageLaborCost,
|
||||
required this.chartData,
|
||||
this.totalShifts = 0,
|
||||
this.totalHours = 0.0,
|
||||
this.avgWeeklySpend = 0.0,
|
||||
this.weeklyBreakdown = const [],
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
projectedSpend,
|
||||
projectedWorkers,
|
||||
averageLaborCost,
|
||||
@@ -37,26 +38,21 @@ class ForecastReport extends Equatable {
|
||||
}
|
||||
|
||||
class ForecastPoint extends Equatable {
|
||||
final DateTime date;
|
||||
final double projectedCost;
|
||||
final int workersNeeded;
|
||||
|
||||
const ForecastPoint({
|
||||
required this.date,
|
||||
required this.projectedCost,
|
||||
required this.workersNeeded,
|
||||
});
|
||||
final DateTime date;
|
||||
final double projectedCost;
|
||||
final int workersNeeded;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [date, projectedCost, workersNeeded];
|
||||
List<Object?> get props => <Object?>[date, projectedCost, workersNeeded];
|
||||
}
|
||||
|
||||
class ForecastWeek extends Equatable {
|
||||
final int weekNumber;
|
||||
final double totalCost;
|
||||
final int shiftsCount;
|
||||
final double hoursCount;
|
||||
final double avgCostPerShift;
|
||||
|
||||
const ForecastWeek({
|
||||
required this.weekNumber,
|
||||
@@ -65,9 +61,14 @@ class ForecastWeek extends Equatable {
|
||||
required this.hoursCount,
|
||||
required this.avgCostPerShift,
|
||||
});
|
||||
final int weekNumber;
|
||||
final double totalCost;
|
||||
final int shiftsCount;
|
||||
final double hoursCount;
|
||||
final double avgCostPerShift;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
weekNumber,
|
||||
totalCost,
|
||||
shiftsCount,
|
||||
@@ -75,3 +76,4 @@ class ForecastWeek extends Equatable {
|
||||
avgCostPerShift,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class NoShowReport extends Equatable {
|
||||
final int totalNoShows;
|
||||
final double noShowRate;
|
||||
final List<NoShowWorker> flaggedWorkers;
|
||||
|
||||
const NoShowReport({
|
||||
required this.totalNoShows,
|
||||
required this.noShowRate,
|
||||
required this.flaggedWorkers,
|
||||
});
|
||||
final int totalNoShows;
|
||||
final double noShowRate;
|
||||
final List<NoShowWorker> flaggedWorkers;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [totalNoShows, noShowRate, flaggedWorkers];
|
||||
List<Object?> get props => <Object?>[totalNoShows, noShowRate, flaggedWorkers];
|
||||
}
|
||||
|
||||
class NoShowWorker extends Equatable {
|
||||
final String id;
|
||||
final String fullName;
|
||||
final int noShowCount;
|
||||
final double reliabilityScore;
|
||||
|
||||
const NoShowWorker({
|
||||
required this.id,
|
||||
@@ -27,7 +24,12 @@ class NoShowWorker extends Equatable {
|
||||
required this.noShowCount,
|
||||
required this.reliabilityScore,
|
||||
});
|
||||
final String id;
|
||||
final String fullName;
|
||||
final int noShowCount;
|
||||
final double reliabilityScore;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, fullName, noShowCount, reliabilityScore];
|
||||
List<Object?> get props => <Object?>[id, fullName, noShowCount, reliabilityScore];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class PerformanceReport extends Equatable {
|
||||
final double fillRate;
|
||||
final double completionRate;
|
||||
final double onTimeRate;
|
||||
final double avgFillTimeHours; // in hours
|
||||
final List<PerformanceMetric> keyPerformanceIndicators;
|
||||
|
||||
const PerformanceReport({
|
||||
required this.fillRate,
|
||||
@@ -14,22 +10,28 @@ class PerformanceReport extends Equatable {
|
||||
required this.avgFillTimeHours,
|
||||
required this.keyPerformanceIndicators,
|
||||
});
|
||||
final double fillRate;
|
||||
final double completionRate;
|
||||
final double onTimeRate;
|
||||
final double avgFillTimeHours; // in hours
|
||||
final List<PerformanceMetric> keyPerformanceIndicators;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [fillRate, completionRate, onTimeRate, avgFillTimeHours, keyPerformanceIndicators];
|
||||
List<Object?> get props => <Object?>[fillRate, completionRate, onTimeRate, avgFillTimeHours, keyPerformanceIndicators];
|
||||
}
|
||||
|
||||
class PerformanceMetric extends Equatable {
|
||||
final String label;
|
||||
final String value;
|
||||
final double trend; // e.g. 0.05 for +5%
|
||||
class PerformanceMetric extends Equatable { // e.g. 0.05 for +5%
|
||||
|
||||
const PerformanceMetric({
|
||||
required this.label,
|
||||
required this.value,
|
||||
required this.trend,
|
||||
});
|
||||
final String label;
|
||||
final String value;
|
||||
final double trend;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [label, value, trend];
|
||||
List<Object?> get props => <Object?>[label, value, trend];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class ReportsSummary extends Equatable {
|
||||
final double totalHours;
|
||||
final double otHours;
|
||||
final double totalSpend;
|
||||
final double fillRate;
|
||||
final double avgFillTimeHours;
|
||||
final double noShowRate;
|
||||
|
||||
const ReportsSummary({
|
||||
required this.totalHours,
|
||||
@@ -16,9 +11,15 @@ class ReportsSummary extends Equatable {
|
||||
required this.avgFillTimeHours,
|
||||
required this.noShowRate,
|
||||
});
|
||||
final double totalHours;
|
||||
final double otHours;
|
||||
final double totalSpend;
|
||||
final double fillRate;
|
||||
final double avgFillTimeHours;
|
||||
final double noShowRate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
totalHours,
|
||||
otHours,
|
||||
totalSpend,
|
||||
@@ -27,3 +28,4 @@ class ReportsSummary extends Equatable {
|
||||
noShowRate,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class SpendReport extends Equatable {
|
||||
final double totalSpend;
|
||||
final double averageCost;
|
||||
final int paidInvoices;
|
||||
final int pendingInvoices;
|
||||
final int overdueInvoices;
|
||||
final List<SpendInvoice> invoices;
|
||||
final List<SpendChartPoint> chartData;
|
||||
final List<SpendIndustryCategory> industryBreakdown;
|
||||
|
||||
const SpendReport({
|
||||
required this.totalSpend,
|
||||
@@ -20,9 +13,17 @@ class SpendReport extends Equatable {
|
||||
required this.chartData,
|
||||
required this.industryBreakdown,
|
||||
});
|
||||
final double totalSpend;
|
||||
final double averageCost;
|
||||
final int paidInvoices;
|
||||
final int pendingInvoices;
|
||||
final int overdueInvoices;
|
||||
final List<SpendInvoice> invoices;
|
||||
final List<SpendChartPoint> chartData;
|
||||
final List<SpendIndustryCategory> industryBreakdown;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
totalSpend,
|
||||
averageCost,
|
||||
paidInvoices,
|
||||
@@ -35,28 +36,21 @@ class SpendReport extends Equatable {
|
||||
}
|
||||
|
||||
class SpendIndustryCategory extends Equatable {
|
||||
final String name;
|
||||
final double amount;
|
||||
final double percentage;
|
||||
|
||||
const SpendIndustryCategory({
|
||||
required this.name,
|
||||
required this.amount,
|
||||
required this.percentage,
|
||||
});
|
||||
final String name;
|
||||
final double amount;
|
||||
final double percentage;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [name, amount, percentage];
|
||||
List<Object?> get props => <Object?>[name, amount, percentage];
|
||||
}
|
||||
|
||||
class SpendInvoice extends Equatable {
|
||||
final String id;
|
||||
final String invoiceNumber;
|
||||
final DateTime issueDate;
|
||||
final double amount;
|
||||
final String status;
|
||||
final String vendorName;
|
||||
final String? industry;
|
||||
|
||||
const SpendInvoice({
|
||||
required this.id,
|
||||
@@ -67,17 +61,25 @@ class SpendInvoice extends Equatable {
|
||||
required this.vendorName,
|
||||
this.industry,
|
||||
});
|
||||
final String id;
|
||||
final String invoiceNumber;
|
||||
final DateTime issueDate;
|
||||
final double amount;
|
||||
final String status;
|
||||
final String vendorName;
|
||||
final String? industry;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, invoiceNumber, issueDate, amount, status, vendorName, industry];
|
||||
List<Object?> get props => <Object?>[id, invoiceNumber, issueDate, amount, status, vendorName, industry];
|
||||
}
|
||||
|
||||
class SpendChartPoint extends Equatable {
|
||||
|
||||
const SpendChartPoint({required this.date, required this.amount});
|
||||
final DateTime date;
|
||||
final double amount;
|
||||
|
||||
const SpendChartPoint({required this.date, required this.amount});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [date, amount];
|
||||
List<Object?> get props => <Object?>[date, amount];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,35 +2,6 @@ import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/src/entities/shifts/break/break.dart';
|
||||
|
||||
class Shift extends Equatable {
|
||||
final String id;
|
||||
final String title;
|
||||
final String clientName;
|
||||
final String? logoUrl;
|
||||
final double hourlyRate;
|
||||
final String location;
|
||||
final String locationAddress;
|
||||
final String date;
|
||||
final String startTime;
|
||||
final String endTime;
|
||||
final String createdDate;
|
||||
final bool? tipsAvailable;
|
||||
final bool? travelTime;
|
||||
final bool? mealProvided;
|
||||
final bool? parkingAvailable;
|
||||
final bool? gasCompensation;
|
||||
final String? description;
|
||||
final String? instructions;
|
||||
final List<ShiftManager>? managers;
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
final String? status;
|
||||
final int? durationDays; // For multi-day shifts
|
||||
final int? requiredSlots;
|
||||
final int? filledSlots;
|
||||
final String? roleId;
|
||||
final bool? hasApplied;
|
||||
final double? totalValue;
|
||||
final Break? breakInfo;
|
||||
|
||||
const Shift({
|
||||
required this.id,
|
||||
@@ -63,6 +34,35 @@ class Shift extends Equatable {
|
||||
this.totalValue,
|
||||
this.breakInfo,
|
||||
});
|
||||
final String id;
|
||||
final String title;
|
||||
final String clientName;
|
||||
final String? logoUrl;
|
||||
final double hourlyRate;
|
||||
final String location;
|
||||
final String locationAddress;
|
||||
final String date;
|
||||
final String startTime;
|
||||
final String endTime;
|
||||
final String createdDate;
|
||||
final bool? tipsAvailable;
|
||||
final bool? travelTime;
|
||||
final bool? mealProvided;
|
||||
final bool? parkingAvailable;
|
||||
final bool? gasCompensation;
|
||||
final String? description;
|
||||
final String? instructions;
|
||||
final List<ShiftManager>? managers;
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
final String? status;
|
||||
final int? durationDays; // For multi-day shifts
|
||||
final int? requiredSlots;
|
||||
final int? filledSlots;
|
||||
final String? roleId;
|
||||
final bool? hasApplied;
|
||||
final double? totalValue;
|
||||
final Break? breakInfo;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[
|
||||
|
||||
@@ -32,8 +32,8 @@ sealed class AuthException extends AppException {
|
||||
|
||||
/// Thrown when email/password combination is incorrect.
|
||||
class InvalidCredentialsException extends AuthException {
|
||||
const InvalidCredentialsException({String? technicalMessage})
|
||||
: super(code: 'AUTH_001', technicalMessage: technicalMessage);
|
||||
const InvalidCredentialsException({super.technicalMessage})
|
||||
: super(code: 'AUTH_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.invalid_credentials';
|
||||
@@ -41,8 +41,8 @@ class InvalidCredentialsException extends AuthException {
|
||||
|
||||
/// Thrown when attempting to register with an email that already exists.
|
||||
class AccountExistsException extends AuthException {
|
||||
const AccountExistsException({String? technicalMessage})
|
||||
: super(code: 'AUTH_002', technicalMessage: technicalMessage);
|
||||
const AccountExistsException({super.technicalMessage})
|
||||
: super(code: 'AUTH_002');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.account_exists';
|
||||
@@ -50,8 +50,8 @@ class AccountExistsException extends AuthException {
|
||||
|
||||
/// Thrown when the user session has expired.
|
||||
class SessionExpiredException extends AuthException {
|
||||
const SessionExpiredException({String? technicalMessage})
|
||||
: super(code: 'AUTH_003', technicalMessage: technicalMessage);
|
||||
const SessionExpiredException({super.technicalMessage})
|
||||
: super(code: 'AUTH_003');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.session_expired';
|
||||
@@ -59,8 +59,8 @@ class SessionExpiredException extends AuthException {
|
||||
|
||||
/// Thrown when user profile is not found in database after Firebase auth.
|
||||
class UserNotFoundException extends AuthException {
|
||||
const UserNotFoundException({String? technicalMessage})
|
||||
: super(code: 'AUTH_004', technicalMessage: technicalMessage);
|
||||
const UserNotFoundException({super.technicalMessage})
|
||||
: super(code: 'AUTH_004');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.user_not_found';
|
||||
@@ -68,8 +68,8 @@ class UserNotFoundException extends AuthException {
|
||||
|
||||
/// Thrown when user is not authorized for the current app (wrong role).
|
||||
class UnauthorizedAppException extends AuthException {
|
||||
const UnauthorizedAppException({String? technicalMessage})
|
||||
: super(code: 'AUTH_005', technicalMessage: technicalMessage);
|
||||
const UnauthorizedAppException({super.technicalMessage})
|
||||
: super(code: 'AUTH_005');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.unauthorized_app';
|
||||
@@ -77,8 +77,8 @@ class UnauthorizedAppException extends AuthException {
|
||||
|
||||
/// Thrown when password doesn't meet security requirements.
|
||||
class WeakPasswordException extends AuthException {
|
||||
const WeakPasswordException({String? technicalMessage})
|
||||
: super(code: 'AUTH_006', technicalMessage: technicalMessage);
|
||||
const WeakPasswordException({super.technicalMessage})
|
||||
: super(code: 'AUTH_006');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.weak_password';
|
||||
@@ -86,8 +86,8 @@ class WeakPasswordException extends AuthException {
|
||||
|
||||
/// Thrown when sign-up process fails.
|
||||
class SignUpFailedException extends AuthException {
|
||||
const SignUpFailedException({String? technicalMessage})
|
||||
: super(code: 'AUTH_007', technicalMessage: technicalMessage);
|
||||
const SignUpFailedException({super.technicalMessage})
|
||||
: super(code: 'AUTH_007');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.sign_up_failed';
|
||||
@@ -95,8 +95,8 @@ class SignUpFailedException extends AuthException {
|
||||
|
||||
/// Thrown when sign-in process fails.
|
||||
class SignInFailedException extends AuthException {
|
||||
const SignInFailedException({String? technicalMessage})
|
||||
: super(code: 'AUTH_008', technicalMessage: technicalMessage);
|
||||
const SignInFailedException({super.technicalMessage})
|
||||
: super(code: 'AUTH_008');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.sign_in_failed';
|
||||
@@ -104,8 +104,8 @@ class SignInFailedException extends AuthException {
|
||||
|
||||
/// Thrown when email exists but password doesn't match.
|
||||
class PasswordMismatchException extends AuthException {
|
||||
const PasswordMismatchException({String? technicalMessage})
|
||||
: super(code: 'AUTH_009', technicalMessage: technicalMessage);
|
||||
const PasswordMismatchException({super.technicalMessage})
|
||||
: super(code: 'AUTH_009');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.password_mismatch';
|
||||
@@ -113,8 +113,8 @@ class PasswordMismatchException extends AuthException {
|
||||
|
||||
/// Thrown when account exists only with Google provider (no password).
|
||||
class GoogleOnlyAccountException extends AuthException {
|
||||
const GoogleOnlyAccountException({String? technicalMessage})
|
||||
: super(code: 'AUTH_010', technicalMessage: technicalMessage);
|
||||
const GoogleOnlyAccountException({super.technicalMessage})
|
||||
: super(code: 'AUTH_010');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.google_only_account';
|
||||
@@ -131,8 +131,8 @@ sealed class HubException extends AppException {
|
||||
|
||||
/// Thrown when attempting to delete a hub that has active orders.
|
||||
class HubHasOrdersException extends HubException {
|
||||
const HubHasOrdersException({String? technicalMessage})
|
||||
: super(code: 'HUB_001', technicalMessage: technicalMessage);
|
||||
const HubHasOrdersException({super.technicalMessage})
|
||||
: super(code: 'HUB_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.hub.has_orders';
|
||||
@@ -140,8 +140,8 @@ class HubHasOrdersException extends HubException {
|
||||
|
||||
/// Thrown when hub is not found.
|
||||
class HubNotFoundException extends HubException {
|
||||
const HubNotFoundException({String? technicalMessage})
|
||||
: super(code: 'HUB_002', technicalMessage: technicalMessage);
|
||||
const HubNotFoundException({super.technicalMessage})
|
||||
: super(code: 'HUB_002');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.hub.not_found';
|
||||
@@ -149,8 +149,8 @@ class HubNotFoundException extends HubException {
|
||||
|
||||
/// Thrown when hub creation fails.
|
||||
class HubCreationFailedException extends HubException {
|
||||
const HubCreationFailedException({String? technicalMessage})
|
||||
: super(code: 'HUB_003', technicalMessage: technicalMessage);
|
||||
const HubCreationFailedException({super.technicalMessage})
|
||||
: super(code: 'HUB_003');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.hub.creation_failed';
|
||||
@@ -167,8 +167,8 @@ sealed class OrderException extends AppException {
|
||||
|
||||
/// Thrown when order creation is attempted without a hub.
|
||||
class OrderMissingHubException extends OrderException {
|
||||
const OrderMissingHubException({String? technicalMessage})
|
||||
: super(code: 'ORDER_001', technicalMessage: technicalMessage);
|
||||
const OrderMissingHubException({super.technicalMessage})
|
||||
: super(code: 'ORDER_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.order.missing_hub';
|
||||
@@ -176,8 +176,8 @@ class OrderMissingHubException extends OrderException {
|
||||
|
||||
/// Thrown when order creation is attempted without a vendor.
|
||||
class OrderMissingVendorException extends OrderException {
|
||||
const OrderMissingVendorException({String? technicalMessage})
|
||||
: super(code: 'ORDER_002', technicalMessage: technicalMessage);
|
||||
const OrderMissingVendorException({super.technicalMessage})
|
||||
: super(code: 'ORDER_002');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.order.missing_vendor';
|
||||
@@ -185,8 +185,8 @@ class OrderMissingVendorException extends OrderException {
|
||||
|
||||
/// Thrown when order creation fails.
|
||||
class OrderCreationFailedException extends OrderException {
|
||||
const OrderCreationFailedException({String? technicalMessage})
|
||||
: super(code: 'ORDER_003', technicalMessage: technicalMessage);
|
||||
const OrderCreationFailedException({super.technicalMessage})
|
||||
: super(code: 'ORDER_003');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.order.creation_failed';
|
||||
@@ -194,8 +194,8 @@ class OrderCreationFailedException extends OrderException {
|
||||
|
||||
/// Thrown when shift creation fails.
|
||||
class ShiftCreationFailedException extends OrderException {
|
||||
const ShiftCreationFailedException({String? technicalMessage})
|
||||
: super(code: 'ORDER_004', technicalMessage: technicalMessage);
|
||||
const ShiftCreationFailedException({super.technicalMessage})
|
||||
: super(code: 'ORDER_004');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.order.shift_creation_failed';
|
||||
@@ -203,8 +203,8 @@ class ShiftCreationFailedException extends OrderException {
|
||||
|
||||
/// Thrown when order is missing required business context.
|
||||
class OrderMissingBusinessException extends OrderException {
|
||||
const OrderMissingBusinessException({String? technicalMessage})
|
||||
: super(code: 'ORDER_005', technicalMessage: technicalMessage);
|
||||
const OrderMissingBusinessException({super.technicalMessage})
|
||||
: super(code: 'ORDER_005');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.order.missing_business';
|
||||
@@ -221,8 +221,8 @@ sealed class ProfileException extends AppException {
|
||||
|
||||
/// Thrown when staff profile is not found.
|
||||
class StaffProfileNotFoundException extends ProfileException {
|
||||
const StaffProfileNotFoundException({String? technicalMessage})
|
||||
: super(code: 'PROFILE_001', technicalMessage: technicalMessage);
|
||||
const StaffProfileNotFoundException({super.technicalMessage})
|
||||
: super(code: 'PROFILE_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.profile.staff_not_found';
|
||||
@@ -230,8 +230,8 @@ class StaffProfileNotFoundException extends ProfileException {
|
||||
|
||||
/// Thrown when business profile is not found.
|
||||
class BusinessNotFoundException extends ProfileException {
|
||||
const BusinessNotFoundException({String? technicalMessage})
|
||||
: super(code: 'PROFILE_002', technicalMessage: technicalMessage);
|
||||
const BusinessNotFoundException({super.technicalMessage})
|
||||
: super(code: 'PROFILE_002');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.profile.business_not_found';
|
||||
@@ -239,8 +239,8 @@ class BusinessNotFoundException extends ProfileException {
|
||||
|
||||
/// Thrown when profile update fails.
|
||||
class ProfileUpdateFailedException extends ProfileException {
|
||||
const ProfileUpdateFailedException({String? technicalMessage})
|
||||
: super(code: 'PROFILE_003', technicalMessage: technicalMessage);
|
||||
const ProfileUpdateFailedException({super.technicalMessage})
|
||||
: super(code: 'PROFILE_003');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.profile.update_failed';
|
||||
@@ -257,8 +257,8 @@ sealed class ShiftException extends AppException {
|
||||
|
||||
/// Thrown when no open roles are available for a shift.
|
||||
class NoOpenRolesException extends ShiftException {
|
||||
const NoOpenRolesException({String? technicalMessage})
|
||||
: super(code: 'SHIFT_001', technicalMessage: technicalMessage);
|
||||
const NoOpenRolesException({super.technicalMessage})
|
||||
: super(code: 'SHIFT_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.shift.no_open_roles';
|
||||
@@ -266,8 +266,8 @@ class NoOpenRolesException extends ShiftException {
|
||||
|
||||
/// Thrown when application for shift is not found.
|
||||
class ApplicationNotFoundException extends ShiftException {
|
||||
const ApplicationNotFoundException({String? technicalMessage})
|
||||
: super(code: 'SHIFT_002', technicalMessage: technicalMessage);
|
||||
const ApplicationNotFoundException({super.technicalMessage})
|
||||
: super(code: 'SHIFT_002');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.shift.application_not_found';
|
||||
@@ -275,8 +275,8 @@ class ApplicationNotFoundException extends ShiftException {
|
||||
|
||||
/// Thrown when no active shift is found for clock out.
|
||||
class NoActiveShiftException extends ShiftException {
|
||||
const NoActiveShiftException({String? technicalMessage})
|
||||
: super(code: 'SHIFT_003', technicalMessage: technicalMessage);
|
||||
const NoActiveShiftException({super.technicalMessage})
|
||||
: super(code: 'SHIFT_003');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.shift.no_active_shift';
|
||||
@@ -288,8 +288,8 @@ class NoActiveShiftException extends ShiftException {
|
||||
|
||||
/// Thrown when there is no network connection.
|
||||
class NetworkException extends AppException {
|
||||
const NetworkException({String? technicalMessage})
|
||||
: super(code: 'NET_001', technicalMessage: technicalMessage);
|
||||
const NetworkException({super.technicalMessage})
|
||||
: super(code: 'NET_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.generic.no_connection';
|
||||
@@ -297,8 +297,8 @@ class NetworkException extends AppException {
|
||||
|
||||
/// Thrown when an unexpected error occurs.
|
||||
class UnknownException extends AppException {
|
||||
const UnknownException({String? technicalMessage})
|
||||
: super(code: 'UNKNOWN', technicalMessage: technicalMessage);
|
||||
const UnknownException({super.technicalMessage})
|
||||
: super(code: 'UNKNOWN');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.generic.unknown';
|
||||
@@ -306,8 +306,8 @@ class UnknownException extends AppException {
|
||||
|
||||
/// Thrown when the server returns an error (500, etc.).
|
||||
class ServerException extends AppException {
|
||||
const ServerException({String? technicalMessage})
|
||||
: super(code: 'SRV_001', technicalMessage: technicalMessage);
|
||||
const ServerException({super.technicalMessage})
|
||||
: super(code: 'SRV_001');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.generic.server_error';
|
||||
@@ -315,8 +315,8 @@ class ServerException extends AppException {
|
||||
|
||||
/// Thrown when the service is unavailable (Data Connect down).
|
||||
class ServiceUnavailableException extends AppException {
|
||||
const ServiceUnavailableException({String? technicalMessage})
|
||||
: super(code: 'SRV_002', technicalMessage: technicalMessage);
|
||||
const ServiceUnavailableException({super.technicalMessage})
|
||||
: super(code: 'SRV_002');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.generic.service_unavailable';
|
||||
@@ -324,8 +324,8 @@ class ServiceUnavailableException extends AppException {
|
||||
|
||||
/// Thrown when user is not authenticated.
|
||||
class NotAuthenticatedException extends AppException {
|
||||
const NotAuthenticatedException({String? technicalMessage})
|
||||
: super(code: 'AUTH_NOT_LOGGED', technicalMessage: technicalMessage);
|
||||
const NotAuthenticatedException({super.technicalMessage})
|
||||
: super(code: 'AUTH_NOT_LOGGED');
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.auth.not_authenticated';
|
||||
|
||||
@@ -55,7 +55,7 @@ class ClientAuthBloc extends Bloc<ClientAuthEvent, ClientAuthState>
|
||||
emit(state.copyWith(status: ClientAuthStatus.loading));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final User user = await _signInWithEmail(
|
||||
SignInWithEmailArguments(email: event.email, password: event.password),
|
||||
@@ -77,7 +77,7 @@ class ClientAuthBloc extends Bloc<ClientAuthEvent, ClientAuthState>
|
||||
emit(state.copyWith(status: ClientAuthStatus.loading));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final User user = await _signUpWithEmail(
|
||||
SignUpWithEmailArguments(
|
||||
@@ -103,7 +103,7 @@ class ClientAuthBloc extends Bloc<ClientAuthEvent, ClientAuthState>
|
||||
emit(state.copyWith(status: ClientAuthStatus.loading));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final User user = await _signInWithSocial(
|
||||
SignInWithSocialArguments(provider: event.provider),
|
||||
@@ -125,7 +125,7 @@ class ClientAuthBloc extends Bloc<ClientAuthEvent, ClientAuthState>
|
||||
emit(state.copyWith(status: ClientAuthStatus.loading));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
await _signOut();
|
||||
emit(state.copyWith(status: ClientAuthStatus.signedOut, user: null));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../../domain/repositories/billing_repository.dart';
|
||||
@@ -7,8 +8,6 @@ import '../../domain/repositories/billing_repository.dart';
|
||||
/// This implementation follows the "Buffer Layer" pattern by using a dedicated
|
||||
/// connector repository from the data_connect package.
|
||||
class BillingRepositoryImpl implements BillingRepository {
|
||||
final dc.BillingConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
BillingRepositoryImpl({
|
||||
dc.BillingConnectorRepository? connectorRepository,
|
||||
@@ -16,28 +15,30 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
}) : _connectorRepository = connectorRepository ??
|
||||
dc.DataConnectService.instance.getBillingRepository(),
|
||||
_service = service ?? dc.DataConnectService.instance;
|
||||
final dc.BillingConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<List<BusinessBankAccount>> getBankAccounts() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getBankAccounts(businessId: businessId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<double> getCurrentBillAmount() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getCurrentBillAmount(businessId: businessId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<Invoice>> getInvoiceHistory() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getInvoiceHistory(businessId: businessId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<Invoice>> getPendingInvoices() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getPendingInvoices(businessId: businessId);
|
||||
}
|
||||
|
||||
@@ -49,10 +50,11 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
|
||||
@override
|
||||
Future<List<InvoiceItem>> getSpendingBreakdown(BillingPeriod period) async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getSpendingBreakdown(
|
||||
businessId: businessId,
|
||||
period: period,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class BillingBloc extends Bloc<BillingEvent, BillingState>
|
||||
) async {
|
||||
emit(state.copyWith(status: BillingStatus.loading));
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final List<dynamic> results =
|
||||
await Future.wait<dynamic>(<Future<dynamic>>[
|
||||
@@ -102,7 +102,7 @@ class BillingBloc extends Bloc<BillingEvent, BillingState>
|
||||
Emitter<BillingState> emit,
|
||||
) async {
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final List<InvoiceItem> spendingItems =
|
||||
await _getSpendingBreakdown.call(event.period);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../../domain/repositories/coverage_repository.dart';
|
||||
@@ -7,8 +8,6 @@ import '../../domain/repositories/coverage_repository.dart';
|
||||
/// This implementation follows the "Buffer Layer" pattern by using a dedicated
|
||||
/// connector repository from the data_connect package.
|
||||
class CoverageRepositoryImpl implements CoverageRepository {
|
||||
final dc.CoverageConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
CoverageRepositoryImpl({
|
||||
dc.CoverageConnectorRepository? connectorRepository,
|
||||
@@ -16,10 +15,12 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
}) : _connectorRepository = connectorRepository ??
|
||||
dc.DataConnectService.instance.getCoverageRepository(),
|
||||
_service = service ?? dc.DataConnectService.instance;
|
||||
final dc.CoverageConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<List<CoverageShift>> getShiftsForDate({required DateTime date}) async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getShiftsForDate(
|
||||
businessId: businessId,
|
||||
date: date,
|
||||
@@ -58,3 +59,4 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class CoverageBloc extends Bloc<CoverageEvent, CoverageState>
|
||||
);
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
// Fetch shifts and stats concurrently
|
||||
final List<Object> results = await Future.wait<Object>(<Future<Object>>[
|
||||
|
||||
@@ -36,7 +36,7 @@ class ClientMainBottomBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Translations.of(context);
|
||||
final Translations t = Translations.of(context);
|
||||
// Client App colors from design system
|
||||
const Color activeColor = UiColors.textPrimary;
|
||||
const Color inactiveColor = UiColors.textInactive;
|
||||
|
||||
@@ -20,7 +20,7 @@ class ClientCreateOrderBloc
|
||||
Emitter<ClientCreateOrderState> emit,
|
||||
) async {
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final List<OrderType> types = await _getOrderTypesUseCase();
|
||||
emit(ClientCreateOrderLoadSuccess(types));
|
||||
|
||||
@@ -220,7 +220,7 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState>
|
||||
) async {
|
||||
emit(state.copyWith(status: OneTimeOrderStatus.loading));
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final Map<String, double> roleRates = <String, double>{
|
||||
for (final OneTimeOrderRoleOption role in state.roles)
|
||||
|
||||
@@ -272,7 +272,7 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
|
||||
) async {
|
||||
emit(state.copyWith(status: PermanentOrderStatus.loading));
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final Map<String, double> roleRates = <String, double>{
|
||||
for (final PermanentOrderRoleOption role in state.roles)
|
||||
@@ -280,7 +280,7 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
|
||||
};
|
||||
final PermanentOrderHubOption? selectedHub = state.selectedHub;
|
||||
if (selectedHub == null) {
|
||||
throw domain.OrderMissingHubException();
|
||||
throw const domain.OrderMissingHubException();
|
||||
}
|
||||
final domain.PermanentOrder order = domain.PermanentOrder(
|
||||
startDate: state.startDate,
|
||||
|
||||
@@ -69,7 +69,7 @@ class RapidOrderBloc extends Bloc<RapidOrderEvent, RapidOrderState>
|
||||
emit(const RapidOrderSubmitting());
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
await _createRapidOrderUseCase(
|
||||
RapidOrderArguments(description: message),
|
||||
|
||||
@@ -289,7 +289,7 @@ class RecurringOrderBloc extends Bloc<RecurringOrderEvent, RecurringOrderState>
|
||||
) async {
|
||||
emit(state.copyWith(status: RecurringOrderStatus.loading));
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final Map<String, double> roleRates = <String, double>{
|
||||
for (final RecurringOrderRoleOption role in state.roles)
|
||||
@@ -297,7 +297,7 @@ class RecurringOrderBloc extends Bloc<RecurringOrderEvent, RecurringOrderState>
|
||||
};
|
||||
final RecurringOrderHubOption? selectedHub = state.selectedHub;
|
||||
if (selectedHub == null) {
|
||||
throw domain.OrderMissingHubException();
|
||||
throw const domain.OrderMissingHubException();
|
||||
}
|
||||
final domain.RecurringOrder order = domain.RecurringOrder(
|
||||
startDate: state.startDate,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:firebase_data_connect/src/core/ref.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../../domain/repositories/home_repository_interface.dart';
|
||||
@@ -7,8 +9,6 @@ import '../../domain/repositories/home_repository_interface.dart';
|
||||
/// This implementation follows the "Buffer Layer" pattern by using a dedicated
|
||||
/// connector repository from the data_connect package.
|
||||
class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
final dc.HomeConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
HomeRepositoryImpl({
|
||||
dc.HomeConnectorRepository? connectorRepository,
|
||||
@@ -16,10 +16,12 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
}) : _connectorRepository = connectorRepository ??
|
||||
dc.DataConnectService.instance.getHomeRepository(),
|
||||
_service = service ?? dc.DataConnectService.instance;
|
||||
final dc.HomeConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<HomeDashboardData> getDashboardData() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getDashboardData(businessId: businessId);
|
||||
}
|
||||
|
||||
@@ -37,16 +39,16 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
|
||||
return await _service.run(() async {
|
||||
final String businessId = await _service.getBusinessId();
|
||||
final businessResult = await _service.connector
|
||||
final QueryResult<dc.GetBusinessByIdData, dc.GetBusinessByIdVariables> businessResult = await _service.connector
|
||||
.getBusinessById(id: businessId)
|
||||
.execute();
|
||||
|
||||
final b = businessResult.data.business;
|
||||
final dc.GetBusinessByIdBusiness? b = businessResult.data.business;
|
||||
if (b == null) {
|
||||
throw Exception('Business data not found for ID: $businessId');
|
||||
}
|
||||
|
||||
final updatedSession = dc.ClientSession(
|
||||
final dc.ClientSession updatedSession = dc.ClientSession(
|
||||
business: dc.ClientBusinessSession(
|
||||
id: b.id,
|
||||
businessName: b.businessName,
|
||||
@@ -67,7 +69,8 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
||||
|
||||
@override
|
||||
Future<List<ReorderItem>> getRecentReorders() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getRecentReorders(businessId: businessId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class ClientHomeBloc extends Bloc<ClientHomeEvent, ClientHomeState>
|
||||
) async {
|
||||
emit(state.copyWith(status: ClientHomeStatus.loading));
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
// Get session data
|
||||
final UserSessionData sessionData = await _getUserSessionDataUseCase();
|
||||
|
||||
@@ -651,9 +651,9 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
||||
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 0.95,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: UiColors.bgPrimary,
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(UiConstants.space6)),
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(UiConstants.space6)),
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../../domain/repositories/hub_repository_interface.dart';
|
||||
@@ -7,8 +8,6 @@ import '../../domain/repositories/hub_repository_interface.dart';
|
||||
/// This implementation follows the "Buffer Layer" pattern by using a dedicated
|
||||
/// connector repository from the data_connect package.
|
||||
class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
final dc.HubsConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
HubRepositoryImpl({
|
||||
dc.HubsConnectorRepository? connectorRepository,
|
||||
@@ -16,10 +15,12 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
}) : _connectorRepository = connectorRepository ??
|
||||
dc.DataConnectService.instance.getHubsRepository(),
|
||||
_service = service ?? dc.DataConnectService.instance;
|
||||
final dc.HubsConnectorRepository _connectorRepository;
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<List<Hub>> getHubs() async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.getHubs(businessId: businessId);
|
||||
}
|
||||
|
||||
@@ -36,7 +37,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
String? country,
|
||||
String? zipCode,
|
||||
}) async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.createHub(
|
||||
businessId: businessId,
|
||||
name: name,
|
||||
@@ -54,7 +55,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
|
||||
@override
|
||||
Future<void> deleteHub(String id) async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.deleteHub(businessId: businessId, id: id);
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
String? country,
|
||||
String? zipCode,
|
||||
}) async {
|
||||
final businessId = await _service.getBusinessId();
|
||||
final String businessId = await _service.getBusinessId();
|
||||
return _connectorRepository.updateHub(
|
||||
businessId: businessId,
|
||||
id: id,
|
||||
@@ -96,3 +97,4 @@ class HubRepositoryImpl implements HubRepositoryInterface {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class ClientHubsBloc extends Bloc<ClientHubsEvent, ClientHubsState>
|
||||
emit(state.copyWith(status: ClientHubsStatus.loading));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
final List<Hub> hubs = await _getHubsUseCase();
|
||||
emit(state.copyWith(status: ClientHubsStatus.success, hubs: hubs));
|
||||
@@ -92,7 +92,7 @@ class ClientHubsBloc extends Bloc<ClientHubsEvent, ClientHubsState>
|
||||
emit(state.copyWith(status: ClientHubsStatus.actionInProgress));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
await _createHubUseCase(
|
||||
CreateHubArguments(
|
||||
@@ -132,7 +132,7 @@ class ClientHubsBloc extends Bloc<ClientHubsEvent, ClientHubsState>
|
||||
emit(state.copyWith(status: ClientHubsStatus.actionInProgress));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
await _updateHubUseCase(
|
||||
UpdateHubArguments(
|
||||
@@ -172,7 +172,7 @@ class ClientHubsBloc extends Bloc<ClientHubsEvent, ClientHubsState>
|
||||
emit(state.copyWith(status: ClientHubsStatus.actionInProgress));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
await _deleteHubUseCase(DeleteHubArguments(hubId: event.hubId));
|
||||
final List<Hub> hubs = await _getHubsUseCase();
|
||||
@@ -198,7 +198,7 @@ class ClientHubsBloc extends Bloc<ClientHubsEvent, ClientHubsState>
|
||||
emit(state.copyWith(status: ClientHubsStatus.actionInProgress));
|
||||
|
||||
await handleError(
|
||||
emit: emit,
|
||||
emit: emit.call,
|
||||
action: () async {
|
||||
await _assignNfcTagUseCase(
|
||||
AssignNfcTagArguments(hubId: event.hubId, nfcTagId: event.nfcTagId),
|
||||
|
||||
@@ -7,10 +7,10 @@ import '../../domain/repositories/reports_repository.dart';
|
||||
/// This implementation follows the "Buffer Layer" pattern by using a dedicated
|
||||
/// connector repository from the data_connect package.
|
||||
class ReportsRepositoryImpl implements ReportsRepository {
|
||||
final ReportsConnectorRepository _connectorRepository;
|
||||
|
||||
ReportsRepositoryImpl({ReportsConnectorRepository? connectorRepository})
|
||||
: _connectorRepository = connectorRepository ?? DataConnectService.instance.getReportsRepository();
|
||||
final ReportsConnectorRepository _connectorRepository;
|
||||
|
||||
@override
|
||||
Future<DailyOpsReport> getDailyOpsReport({
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/coverage_report.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'coverage_event.dart';
|
||||
import 'coverage_state.dart';
|
||||
|
||||
class CoverageBloc extends Bloc<CoverageEvent, CoverageState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
CoverageBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(CoverageInitial()) {
|
||||
on<LoadCoverageReport>(_onLoadCoverageReport);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadCoverageReport(
|
||||
LoadCoverageReport event,
|
||||
@@ -18,7 +20,7 @@ class CoverageBloc extends Bloc<CoverageEvent, CoverageState> {
|
||||
) async {
|
||||
emit(CoverageLoading());
|
||||
try {
|
||||
final report = await _reportsRepository.getCoverageReport(
|
||||
final CoverageReport report = await _reportsRepository.getCoverageReport(
|
||||
businessId: event.businessId,
|
||||
startDate: event.startDate,
|
||||
endDate: event.endDate,
|
||||
@@ -29,3 +31,4 @@ class CoverageBloc extends Bloc<CoverageEvent, CoverageState> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class CoverageEvent extends Equatable {
|
||||
const CoverageEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadCoverageReport extends CoverageEvent {
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
const LoadCoverageReport({
|
||||
this.businessId,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, startDate, endDate];
|
||||
List<Object?> get props => <Object?>[businessId, startDate, endDate];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class CoverageState extends Equatable {
|
||||
const CoverageState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class CoverageInitial extends CoverageState {}
|
||||
@@ -13,19 +14,20 @@ class CoverageInitial extends CoverageState {}
|
||||
class CoverageLoading extends CoverageState {}
|
||||
|
||||
class CoverageLoaded extends CoverageState {
|
||||
final CoverageReport report;
|
||||
|
||||
const CoverageLoaded(this.report);
|
||||
final CoverageReport report;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [report];
|
||||
List<Object?> get props => <Object?>[report];
|
||||
}
|
||||
|
||||
class CoverageError extends CoverageState {
|
||||
final String message;
|
||||
|
||||
const CoverageError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/daily_ops_report.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'daily_ops_event.dart';
|
||||
import 'daily_ops_state.dart';
|
||||
|
||||
class DailyOpsBloc extends Bloc<DailyOpsEvent, DailyOpsState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
DailyOpsBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(DailyOpsInitial()) {
|
||||
on<LoadDailyOpsReport>(_onLoadDailyOpsReport);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadDailyOpsReport(
|
||||
LoadDailyOpsReport event,
|
||||
@@ -18,7 +19,7 @@ class DailyOpsBloc extends Bloc<DailyOpsEvent, DailyOpsState> {
|
||||
) async {
|
||||
emit(DailyOpsLoading());
|
||||
try {
|
||||
final report = await _reportsRepository.getDailyOpsReport(
|
||||
final DailyOpsReport report = await _reportsRepository.getDailyOpsReport(
|
||||
businessId: event.businessId,
|
||||
date: event.date,
|
||||
);
|
||||
|
||||
@@ -4,18 +4,18 @@ abstract class DailyOpsEvent extends Equatable {
|
||||
const DailyOpsEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadDailyOpsReport extends DailyOpsEvent {
|
||||
final String? businessId;
|
||||
final DateTime date;
|
||||
|
||||
const LoadDailyOpsReport({
|
||||
this.businessId,
|
||||
required this.date,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime date;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, date];
|
||||
List<Object?> get props => <Object?>[businessId, date];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class DailyOpsState extends Equatable {
|
||||
const DailyOpsState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class DailyOpsInitial extends DailyOpsState {}
|
||||
@@ -13,19 +14,20 @@ class DailyOpsInitial extends DailyOpsState {}
|
||||
class DailyOpsLoading extends DailyOpsState {}
|
||||
|
||||
class DailyOpsLoaded extends DailyOpsState {
|
||||
final DailyOpsReport report;
|
||||
|
||||
const DailyOpsLoaded(this.report);
|
||||
final DailyOpsReport report;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [report];
|
||||
List<Object?> get props => <Object?>[report];
|
||||
}
|
||||
|
||||
class DailyOpsError extends DailyOpsState {
|
||||
final String message;
|
||||
|
||||
const DailyOpsError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/forecast_report.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'forecast_event.dart';
|
||||
import 'forecast_state.dart';
|
||||
|
||||
class ForecastBloc extends Bloc<ForecastEvent, ForecastState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
ForecastBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(ForecastInitial()) {
|
||||
on<LoadForecastReport>(_onLoadForecastReport);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadForecastReport(
|
||||
LoadForecastReport event,
|
||||
@@ -18,7 +19,7 @@ class ForecastBloc extends Bloc<ForecastEvent, ForecastState> {
|
||||
) async {
|
||||
emit(ForecastLoading());
|
||||
try {
|
||||
final report = await _reportsRepository.getForecastReport(
|
||||
final ForecastReport report = await _reportsRepository.getForecastReport(
|
||||
businessId: event.businessId,
|
||||
startDate: event.startDate,
|
||||
endDate: event.endDate,
|
||||
|
||||
@@ -4,20 +4,20 @@ abstract class ForecastEvent extends Equatable {
|
||||
const ForecastEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadForecastReport extends ForecastEvent {
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
const LoadForecastReport({
|
||||
this.businessId,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, startDate, endDate];
|
||||
List<Object?> get props => <Object?>[businessId, startDate, endDate];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class ForecastState extends Equatable {
|
||||
const ForecastState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class ForecastInitial extends ForecastState {}
|
||||
@@ -13,19 +14,20 @@ class ForecastInitial extends ForecastState {}
|
||||
class ForecastLoading extends ForecastState {}
|
||||
|
||||
class ForecastLoaded extends ForecastState {
|
||||
final ForecastReport report;
|
||||
|
||||
const ForecastLoaded(this.report);
|
||||
final ForecastReport report;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [report];
|
||||
List<Object?> get props => <Object?>[report];
|
||||
}
|
||||
|
||||
class ForecastError extends ForecastState {
|
||||
final String message;
|
||||
|
||||
const ForecastError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/no_show_report.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'no_show_event.dart';
|
||||
import 'no_show_state.dart';
|
||||
|
||||
class NoShowBloc extends Bloc<NoShowEvent, NoShowState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
NoShowBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(NoShowInitial()) {
|
||||
on<LoadNoShowReport>(_onLoadNoShowReport);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadNoShowReport(
|
||||
LoadNoShowReport event,
|
||||
@@ -18,7 +19,7 @@ class NoShowBloc extends Bloc<NoShowEvent, NoShowState> {
|
||||
) async {
|
||||
emit(NoShowLoading());
|
||||
try {
|
||||
final report = await _reportsRepository.getNoShowReport(
|
||||
final NoShowReport report = await _reportsRepository.getNoShowReport(
|
||||
businessId: event.businessId,
|
||||
startDate: event.startDate,
|
||||
endDate: event.endDate,
|
||||
|
||||
@@ -4,20 +4,20 @@ abstract class NoShowEvent extends Equatable {
|
||||
const NoShowEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadNoShowReport extends NoShowEvent {
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
const LoadNoShowReport({
|
||||
this.businessId,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, startDate, endDate];
|
||||
List<Object?> get props => <Object?>[businessId, startDate, endDate];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class NoShowState extends Equatable {
|
||||
const NoShowState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class NoShowInitial extends NoShowState {}
|
||||
@@ -13,19 +14,20 @@ class NoShowInitial extends NoShowState {}
|
||||
class NoShowLoading extends NoShowState {}
|
||||
|
||||
class NoShowLoaded extends NoShowState {
|
||||
final NoShowReport report;
|
||||
|
||||
const NoShowLoaded(this.report);
|
||||
final NoShowReport report;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [report];
|
||||
List<Object?> get props => <Object?>[report];
|
||||
}
|
||||
|
||||
class NoShowError extends NoShowState {
|
||||
final String message;
|
||||
|
||||
const NoShowError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/performance_report.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'performance_event.dart';
|
||||
import 'performance_state.dart';
|
||||
|
||||
class PerformanceBloc extends Bloc<PerformanceEvent, PerformanceState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
PerformanceBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(PerformanceInitial()) {
|
||||
on<LoadPerformanceReport>(_onLoadPerformanceReport);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadPerformanceReport(
|
||||
LoadPerformanceReport event,
|
||||
@@ -18,7 +19,7 @@ class PerformanceBloc extends Bloc<PerformanceEvent, PerformanceState> {
|
||||
) async {
|
||||
emit(PerformanceLoading());
|
||||
try {
|
||||
final report = await _reportsRepository.getPerformanceReport(
|
||||
final PerformanceReport report = await _reportsRepository.getPerformanceReport(
|
||||
businessId: event.businessId,
|
||||
startDate: event.startDate,
|
||||
endDate: event.endDate,
|
||||
|
||||
@@ -4,20 +4,20 @@ abstract class PerformanceEvent extends Equatable {
|
||||
const PerformanceEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadPerformanceReport extends PerformanceEvent {
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
const LoadPerformanceReport({
|
||||
this.businessId,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, startDate, endDate];
|
||||
List<Object?> get props => <Object?>[businessId, startDate, endDate];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class PerformanceState extends Equatable {
|
||||
const PerformanceState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class PerformanceInitial extends PerformanceState {}
|
||||
@@ -13,19 +14,20 @@ class PerformanceInitial extends PerformanceState {}
|
||||
class PerformanceLoading extends PerformanceState {}
|
||||
|
||||
class PerformanceLoaded extends PerformanceState {
|
||||
final PerformanceReport report;
|
||||
|
||||
const PerformanceLoaded(this.report);
|
||||
final PerformanceReport report;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [report];
|
||||
List<Object?> get props => <Object?>[report];
|
||||
}
|
||||
|
||||
class PerformanceError extends PerformanceState {
|
||||
final String message;
|
||||
|
||||
const PerformanceError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/spend_report.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'spend_event.dart';
|
||||
import 'spend_state.dart';
|
||||
|
||||
class SpendBloc extends Bloc<SpendEvent, SpendState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
SpendBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(SpendInitial()) {
|
||||
on<LoadSpendReport>(_onLoadSpendReport);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadSpendReport(
|
||||
LoadSpendReport event,
|
||||
@@ -18,7 +19,7 @@ class SpendBloc extends Bloc<SpendEvent, SpendState> {
|
||||
) async {
|
||||
emit(SpendLoading());
|
||||
try {
|
||||
final report = await _reportsRepository.getSpendReport(
|
||||
final SpendReport report = await _reportsRepository.getSpendReport(
|
||||
businessId: event.businessId,
|
||||
startDate: event.startDate,
|
||||
endDate: event.endDate,
|
||||
|
||||
@@ -4,20 +4,20 @@ abstract class SpendEvent extends Equatable {
|
||||
const SpendEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadSpendReport extends SpendEvent {
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
const LoadSpendReport({
|
||||
this.businessId,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, startDate, endDate];
|
||||
List<Object?> get props => <Object?>[businessId, startDate, endDate];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class SpendState extends Equatable {
|
||||
const SpendState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class SpendInitial extends SpendState {}
|
||||
@@ -13,19 +14,20 @@ class SpendInitial extends SpendState {}
|
||||
class SpendLoading extends SpendState {}
|
||||
|
||||
class SpendLoaded extends SpendState {
|
||||
final SpendReport report;
|
||||
|
||||
const SpendLoaded(this.report);
|
||||
final SpendReport report;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [report];
|
||||
List<Object?> get props => <Object?>[report];
|
||||
}
|
||||
|
||||
class SpendError extends SpendState {
|
||||
final String message;
|
||||
|
||||
const SpendError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_domain/src/entities/reports/reports_summary.dart';
|
||||
import '../../../domain/repositories/reports_repository.dart';
|
||||
import 'reports_summary_event.dart';
|
||||
import 'reports_summary_state.dart';
|
||||
|
||||
class ReportsSummaryBloc extends Bloc<ReportsSummaryEvent, ReportsSummaryState> {
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
ReportsSummaryBloc({required ReportsRepository reportsRepository})
|
||||
: _reportsRepository = reportsRepository,
|
||||
super(ReportsSummaryInitial()) {
|
||||
on<LoadReportsSummary>(_onLoadReportsSummary);
|
||||
}
|
||||
final ReportsRepository _reportsRepository;
|
||||
|
||||
Future<void> _onLoadReportsSummary(
|
||||
LoadReportsSummary event,
|
||||
@@ -18,7 +19,7 @@ class ReportsSummaryBloc extends Bloc<ReportsSummaryEvent, ReportsSummaryState>
|
||||
) async {
|
||||
emit(ReportsSummaryLoading());
|
||||
try {
|
||||
final summary = await _reportsRepository.getReportsSummary(
|
||||
final ReportsSummary summary = await _reportsRepository.getReportsSummary(
|
||||
businessId: event.businessId,
|
||||
startDate: event.startDate,
|
||||
endDate: event.endDate,
|
||||
|
||||
@@ -4,20 +4,20 @@ abstract class ReportsSummaryEvent extends Equatable {
|
||||
const ReportsSummaryEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class LoadReportsSummary extends ReportsSummaryEvent {
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
const LoadReportsSummary({
|
||||
this.businessId,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
final String? businessId;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [businessId, startDate, endDate];
|
||||
List<Object?> get props => <Object?>[businessId, startDate, endDate];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -5,7 +6,7 @@ abstract class ReportsSummaryState extends Equatable {
|
||||
const ReportsSummaryState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => <Object?>[];
|
||||
}
|
||||
|
||||
class ReportsSummaryInitial extends ReportsSummaryState {}
|
||||
@@ -13,19 +14,20 @@ class ReportsSummaryInitial extends ReportsSummaryState {}
|
||||
class ReportsSummaryLoading extends ReportsSummaryState {}
|
||||
|
||||
class ReportsSummaryLoaded extends ReportsSummaryState {
|
||||
final ReportsSummary summary;
|
||||
|
||||
const ReportsSummaryLoaded(this.summary);
|
||||
final ReportsSummary summary;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [summary];
|
||||
List<Object?> get props => <Object?>[summary];
|
||||
}
|
||||
|
||||
class ReportsSummaryError extends ReportsSummaryState {
|
||||
final String message;
|
||||
|
||||
const ReportsSummaryError(this.message);
|
||||
final String message;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
List<Object?> get props => <Object?>[message];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:client_reports/src/presentation/blocs/coverage/coverage_bloc.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/coverage/coverage_event.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/coverage/coverage_state.dart';
|
||||
@@ -23,12 +24,12 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => Modular.get<CoverageBloc>()
|
||||
create: (BuildContext context) => Modular.get<CoverageBloc>()
|
||||
..add(LoadCoverageReport(startDate: _startDate, endDate: _endDate)),
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: BlocBuilder<CoverageBloc, CoverageState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, CoverageState state) {
|
||||
if (state is CoverageLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -38,10 +39,10 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
}
|
||||
|
||||
if (state is CoverageLoaded) {
|
||||
final report = state.report;
|
||||
final CoverageReport report = state.report;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Header
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
@@ -52,16 +53,16 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [UiColors.primary, UiColors.tagInProgress],
|
||||
colors: <Color>[UiColors.primary, UiColors.tagInProgress],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -81,7 +82,7 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.coverage_report.title,
|
||||
style: const TextStyle(
|
||||
@@ -113,10 +114,10 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Summary Cards
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: _CoverageSummaryCard(
|
||||
label: context.t.client_reports.coverage_report.metrics.avg_coverage,
|
||||
@@ -152,7 +153,7 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
if (report.dailyCoverage.isEmpty)
|
||||
Center(child: Text(context.t.client_reports.coverage_report.empty_state))
|
||||
else
|
||||
...report.dailyCoverage.map((day) => _CoverageListItem(
|
||||
...report.dailyCoverage.map((CoverageDay day) => _CoverageListItem(
|
||||
date: DateFormat('EEE, MMM dd').format(day.date),
|
||||
needed: day.needed,
|
||||
filled: day.filled,
|
||||
@@ -176,10 +177,6 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
|
||||
}
|
||||
|
||||
class _CoverageSummaryCard extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
|
||||
const _CoverageSummaryCard({
|
||||
required this.label,
|
||||
@@ -187,6 +184,10 @@ class _CoverageSummaryCard extends StatelessWidget {
|
||||
required this.icon,
|
||||
required this.color,
|
||||
});
|
||||
final String label;
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -195,7 +196,7 @@ class _CoverageSummaryCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 10,
|
||||
@@ -204,7 +205,7 @@ class _CoverageSummaryCard extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
@@ -224,10 +225,6 @@ class _CoverageSummaryCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _CoverageListItem extends StatelessWidget {
|
||||
final String date;
|
||||
final int needed;
|
||||
final int filled;
|
||||
final double percentage;
|
||||
|
||||
const _CoverageListItem({
|
||||
required this.date,
|
||||
@@ -235,6 +232,10 @@ class _CoverageListItem extends StatelessWidget {
|
||||
required this.filled,
|
||||
required this.percentage,
|
||||
});
|
||||
final String date;
|
||||
final int needed;
|
||||
final int filled;
|
||||
final double percentage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -255,11 +256,11 @@ class _CoverageListItem extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(date, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 4),
|
||||
// Progress Bar
|
||||
@@ -278,7 +279,7 @@ class _CoverageListItem extends StatelessWidget {
|
||||
const SizedBox(width: 16),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'$filled/$needed',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
@@ -298,3 +299,4 @@ class _CoverageListItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:krow_domain/src/entities/reports/daily_ops_report.dart';
|
||||
|
||||
class DailyOpsReportPage extends StatefulWidget {
|
||||
const DailyOpsReportPage({super.key});
|
||||
@@ -49,12 +50,12 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => Modular.get<DailyOpsBloc>()
|
||||
create: (BuildContext context) => Modular.get<DailyOpsBloc>()
|
||||
..add(LoadDailyOpsReport(date: _selectedDate)),
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: BlocBuilder<DailyOpsBloc, DailyOpsState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, DailyOpsState state) {
|
||||
if (state is DailyOpsLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -64,10 +65,10 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
}
|
||||
|
||||
if (state is DailyOpsLoaded) {
|
||||
final report = state.report;
|
||||
final DailyOpsReport report = state.report;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Header
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
@@ -78,7 +79,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
colors: <Color>[
|
||||
UiColors.primary,
|
||||
UiColors.buttonPrimaryHover
|
||||
],
|
||||
@@ -88,9 +89,9 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -110,7 +111,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.daily_ops_report
|
||||
.title,
|
||||
@@ -189,7 +190,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Date Selector
|
||||
GestureDetector(
|
||||
onTap: () => _pickDate(context),
|
||||
@@ -198,7 +199,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.06),
|
||||
blurRadius: 4,
|
||||
@@ -208,9 +209,9 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
UiIcons.calendar,
|
||||
size: 16,
|
||||
@@ -246,7 +247,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
mainAxisSpacing: 12,
|
||||
crossAxisSpacing: 12,
|
||||
childAspectRatio: 1.2,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
_OpsStatCard(
|
||||
label: context.t.client_reports
|
||||
.daily_ops_report.metrics.scheduled.label,
|
||||
@@ -339,7 +340,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
),
|
||||
)
|
||||
else
|
||||
...report.shifts.map((shift) => _ShiftListItem(
|
||||
...report.shifts.map((DailyOpsShift shift) => _ShiftListItem(
|
||||
title: shift.title,
|
||||
location: shift.location,
|
||||
time:
|
||||
@@ -376,11 +377,6 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
}
|
||||
|
||||
class _OpsStatCard extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
final String subValue;
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
|
||||
const _OpsStatCard({
|
||||
required this.label,
|
||||
@@ -389,6 +385,11 @@ class _OpsStatCard extends StatelessWidget {
|
||||
required this.color,
|
||||
required this.icon,
|
||||
});
|
||||
final String label;
|
||||
final String value;
|
||||
final String subValue;
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -397,7 +398,7 @@ class _OpsStatCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.06),
|
||||
blurRadius: 4,
|
||||
@@ -408,9 +409,9 @@ class _OpsStatCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 14, color: color),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -429,7 +430,7 @@ class _OpsStatCard extends StatelessWidget {
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
@@ -467,13 +468,6 @@ class _OpsStatCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _ShiftListItem extends StatelessWidget {
|
||||
final String title;
|
||||
final String location;
|
||||
final String time;
|
||||
final String workers;
|
||||
final String rate;
|
||||
final String status;
|
||||
final Color statusColor;
|
||||
|
||||
const _ShiftListItem({
|
||||
required this.title,
|
||||
@@ -484,6 +478,13 @@ class _ShiftListItem extends StatelessWidget {
|
||||
required this.status,
|
||||
required this.statusColor,
|
||||
});
|
||||
final String title;
|
||||
final String location;
|
||||
final String time;
|
||||
final String workers;
|
||||
final String rate;
|
||||
final String status;
|
||||
final Color statusColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -493,7 +494,7 @@ class _ShiftListItem extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.02),
|
||||
blurRadius: 2,
|
||||
@@ -501,14 +502,14 @@ class _ShiftListItem extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
@@ -519,7 +520,7 @@ class _ShiftListItem extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
UiIcons.mapPin,
|
||||
size: 10,
|
||||
@@ -565,7 +566,7 @@ class _ShiftListItem extends StatelessWidget {
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
_infoItem(
|
||||
context,
|
||||
UiIcons.clock,
|
||||
@@ -591,12 +592,12 @@ class _ShiftListItem extends StatelessWidget {
|
||||
Widget _infoItem(
|
||||
BuildContext context, IconData icon, String label, String value) {
|
||||
return Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 12, color: UiColors.textSecondary),
|
||||
const SizedBox(width: 6),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 10, color: UiColors.pinInactive),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:client_reports/src/presentation/blocs/forecast/forecast_bloc.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/forecast/forecast_event.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/forecast/forecast_state.dart';
|
||||
@@ -24,12 +25,12 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => Modular.get<ForecastBloc>()
|
||||
create: (BuildContext context) => Modular.get<ForecastBloc>()
|
||||
..add(LoadForecastReport(startDate: _startDate, endDate: _endDate)),
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: BlocBuilder<ForecastBloc, ForecastState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, ForecastState state) {
|
||||
if (state is ForecastLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -39,10 +40,10 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
}
|
||||
|
||||
if (state is ForecastLoaded) {
|
||||
final report = state.report;
|
||||
final ForecastReport report = state.report;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Header
|
||||
_buildHeader(context),
|
||||
|
||||
@@ -53,7 +54,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Metrics Grid
|
||||
_buildMetricsGrid(context, report),
|
||||
const SizedBox(height: 16),
|
||||
@@ -82,7 +83,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
)
|
||||
else
|
||||
...report.weeklyBreakdown.map(
|
||||
(week) => _WeeklyBreakdownItem(week: week),
|
||||
(ForecastWeek week) => _WeeklyBreakdownItem(week: week),
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
@@ -112,16 +113,16 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
decoration: const BoxDecoration(
|
||||
color: UiColors.primary,
|
||||
gradient: LinearGradient(
|
||||
colors: [UiColors.primary, Color(0xFF0020A0)], // Deep blue gradient
|
||||
colors: <Color>[UiColors.primary, Color(0xFF0020A0)], // Deep blue gradient
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -141,7 +142,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.forecast_report.title,
|
||||
style: UiTypography.headline3m.copyWith(color: UiColors.white),
|
||||
@@ -180,7 +181,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
}
|
||||
|
||||
Widget _buildMetricsGrid(BuildContext context, ForecastReport report) {
|
||||
final t = context.t.client_reports.forecast_report;
|
||||
final TranslationsClientReportsForecastReportEn t = context.t.client_reports.forecast_report;
|
||||
return GridView.count(
|
||||
crossAxisCount: 2,
|
||||
shrinkWrap: true,
|
||||
@@ -188,7 +189,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
mainAxisSpacing: 12,
|
||||
crossAxisSpacing: 12,
|
||||
childAspectRatio: 1.3,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
_MetricCard(
|
||||
icon: UiIcons.dollar,
|
||||
label: t.metrics.four_week_forecast,
|
||||
@@ -232,7 +233,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 10,
|
||||
@@ -241,7 +242,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.forecast_report.chart_title,
|
||||
style: UiTypography.headline4m,
|
||||
@@ -257,9 +258,9 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// X Axis labels manually if chart doesn't handle them perfectly or for custom look
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const [
|
||||
children: <Widget>[
|
||||
Text('W1', style: TextStyle(color: UiColors.textSecondary, fontSize: 12)),
|
||||
Text('W1', style: TextStyle(color: UiColors.transparent, fontSize: 12)), // Spacer
|
||||
Text('W2', style: TextStyle(color: UiColors.textSecondary, fontSize: 12)),
|
||||
@@ -276,12 +277,6 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
|
||||
}
|
||||
|
||||
class _MetricCard extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String value;
|
||||
final String badgeText;
|
||||
final Color iconColor;
|
||||
final Color badgeColor;
|
||||
|
||||
const _MetricCard({
|
||||
required this.icon,
|
||||
@@ -291,6 +286,12 @@ class _MetricCard extends StatelessWidget {
|
||||
required this.iconColor,
|
||||
required this.badgeColor,
|
||||
});
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String value;
|
||||
final String badgeText;
|
||||
final Color iconColor;
|
||||
final Color badgeColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -299,7 +300,7 @@ class _MetricCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 8,
|
||||
@@ -309,9 +310,9 @@ class _MetricCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 16, color: iconColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -349,13 +350,13 @@ class _MetricCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _WeeklyBreakdownItem extends StatelessWidget {
|
||||
final ForecastWeek week;
|
||||
|
||||
const _WeeklyBreakdownItem({required this.week});
|
||||
final ForecastWeek week;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = context.t.client_reports.forecast_report.weekly_breakdown;
|
||||
final TranslationsClientReportsForecastReportWeeklyBreakdownEn t = context.t.client_reports.forecast_report.weekly_breakdown;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
@@ -365,10 +366,10 @@ class _WeeklyBreakdownItem extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
t.week(index: week.weekNumber),
|
||||
style: UiTypography.headline4m,
|
||||
@@ -391,7 +392,7 @@ class _WeeklyBreakdownItem extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
_buildStat(t.shifts, week.shiftsCount.toString()),
|
||||
_buildStat(t.hours, week.hoursCount.toStringAsFixed(0)),
|
||||
_buildStat(t.avg_shift, NumberFormat.currency(symbol: r'$', decimalDigits: 0).format(week.avgCostPerShift)),
|
||||
@@ -405,7 +406,7 @@ class _WeeklyBreakdownItem extends StatelessWidget {
|
||||
Widget _buildStat(String label, String value) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(label, style: UiTypography.footnote1r.textSecondary),
|
||||
const SizedBox(height: 4),
|
||||
Text(value, style: UiTypography.body1m),
|
||||
@@ -415,9 +416,9 @@ class _WeeklyBreakdownItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _ForecastChart extends StatelessWidget {
|
||||
final List<ForecastPoint> points;
|
||||
|
||||
const _ForecastChart({required this.points});
|
||||
final List<ForecastPoint> points;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -430,11 +431,11 @@ class _ForecastChart extends StatelessWidget {
|
||||
show: true,
|
||||
drawVerticalLine: false,
|
||||
horizontalInterval: 5000, // Dynamic?
|
||||
getDrawingHorizontalLine: (value) {
|
||||
return FlLine(
|
||||
getDrawingHorizontalLine: (double value) {
|
||||
return const FlLine(
|
||||
color: UiColors.borderInactive,
|
||||
strokeWidth: 1,
|
||||
dashArray: [5, 5],
|
||||
dashArray: <int>[5, 5],
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -443,9 +444,9 @@ class _ForecastChart extends StatelessWidget {
|
||||
minX: 0,
|
||||
maxX: points.length.toDouble() - 1,
|
||||
// minY: 0, // Let it scale automatically
|
||||
lineBarsData: [
|
||||
lineBarsData: <LineChartBarData>[
|
||||
LineChartBarData(
|
||||
spots: points.asMap().entries.map((e) {
|
||||
spots: points.asMap().entries.map((MapEntry<int, ForecastPoint> e) {
|
||||
return FlSpot(e.key.toDouble(), e.value.projectedCost);
|
||||
}).toList(),
|
||||
isCurved: true,
|
||||
@@ -454,7 +455,7 @@ class _ForecastChart extends StatelessWidget {
|
||||
isStrokeCapRound: true,
|
||||
dotData: FlDotData(
|
||||
show: true,
|
||||
getDotPainter: (spot, percent, barData, index) {
|
||||
getDotPainter: (FlSpot spot, double percent, LineChartBarData barData, int index) {
|
||||
return FlDotCirclePainter(
|
||||
radius: 4,
|
||||
color: UiColors.textWarning,
|
||||
@@ -473,3 +474,4 @@ class _ForecastChart extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/no_show/no_show_bloc.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/no_show/no_show_event.dart';
|
||||
@@ -17,18 +18,18 @@ class NoShowReportPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
DateTime _startDate = DateTime.now().subtract(const Duration(days: 30));
|
||||
DateTime _endDate = DateTime.now();
|
||||
final DateTime _startDate = DateTime.now().subtract(const Duration(days: 30));
|
||||
final DateTime _endDate = DateTime.now();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => Modular.get<NoShowBloc>()
|
||||
create: (BuildContext context) => Modular.get<NoShowBloc>()
|
||||
..add(LoadNoShowReport(startDate: _startDate, endDate: _endDate)),
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: BlocBuilder<NoShowBloc, NoShowState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, NoShowState state) {
|
||||
if (state is NoShowLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -38,12 +39,12 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
}
|
||||
|
||||
if (state is NoShowLoaded) {
|
||||
final report = state.report;
|
||||
final uniqueWorkers = report.flaggedWorkers.length;
|
||||
final NoShowReport report = state.report;
|
||||
final int uniqueWorkers = report.flaggedWorkers.length;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
// ── Header ──────────────────────────────────────────
|
||||
children: <Widget>[
|
||||
// ── Header ──────────────────────────────────────────
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 60,
|
||||
@@ -53,7 +54,7 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
colors: <Color>[
|
||||
UiColors.primary,
|
||||
UiColors.buttonPrimaryHover,
|
||||
],
|
||||
@@ -63,9 +64,9 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -85,7 +86,7 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.no_show_report.title,
|
||||
style: const TextStyle(
|
||||
@@ -150,17 +151,17 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
),
|
||||
),
|
||||
|
||||
// ── Content ─────────────────────────────────────────
|
||||
// ── Content ─────────────────────────────────────────
|
||||
Transform.translate(
|
||||
offset: const Offset(0, -16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// 3-chip summary row (matches prototype)
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: _SummaryChip(
|
||||
icon: UiIcons.warning,
|
||||
@@ -220,7 +221,7 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
)
|
||||
else
|
||||
...report.flaggedWorkers.map(
|
||||
(worker) => _WorkerCard(worker: worker),
|
||||
(NoShowWorker worker) => _WorkerCard(worker: worker),
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
@@ -240,12 +241,8 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Summary chip (top 3 stats) ───────────────────────────────────────────────
|
||||
// ── Summary chip (top 3 stats) ───────────────────────────────────────────────
|
||||
class _SummaryChip extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final Color iconColor;
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
const _SummaryChip({
|
||||
required this.icon,
|
||||
@@ -253,6 +250,10 @@ class _SummaryChip extends StatelessWidget {
|
||||
required this.label,
|
||||
required this.value,
|
||||
});
|
||||
final IconData icon;
|
||||
final Color iconColor;
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -261,7 +262,7 @@ class _SummaryChip extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.06),
|
||||
blurRadius: 8,
|
||||
@@ -271,9 +272,9 @@ class _SummaryChip extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 12, color: iconColor),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
@@ -304,11 +305,11 @@ class _SummaryChip extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Worker card with risk badge + latest incident ────────────────────────────
|
||||
// ── Worker card with risk badge + latest incident ────────────────────────────
|
||||
class _WorkerCard extends StatelessWidget {
|
||||
final NoShowWorker worker;
|
||||
|
||||
const _WorkerCard({required this.worker});
|
||||
final NoShowWorker worker;
|
||||
|
||||
String _riskLabel(BuildContext context, int count) {
|
||||
if (count >= 3) return context.t.client_reports.no_show_report.risks.high;
|
||||
@@ -330,9 +331,9 @@ class _WorkerCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final riskLabel = _riskLabel(context, worker.noShowCount);
|
||||
final riskColor = _riskColor(worker.noShowCount);
|
||||
final riskBg = _riskBg(worker.noShowCount);
|
||||
final String riskLabel = _riskLabel(context, worker.noShowCount);
|
||||
final Color riskColor = _riskColor(worker.noShowCount);
|
||||
final Color riskBg = _riskBg(worker.noShowCount);
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
@@ -340,7 +341,7 @@ class _WorkerCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 6,
|
||||
@@ -348,12 +349,12 @@ class _WorkerCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
@@ -370,7 +371,7 @@ class _WorkerCard extends StatelessWidget {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
worker.fullName,
|
||||
style: const TextStyle(
|
||||
@@ -416,7 +417,7 @@ class _WorkerCard extends StatelessWidget {
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.no_show_report.latest_incident,
|
||||
style: const TextStyle(
|
||||
@@ -447,4 +448,5 @@ class _WorkerCard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Insight line ─────────────────────────────────────────────────────────────
|
||||
// ── Insight line ─────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/src/entities/reports/performance_report.dart';
|
||||
|
||||
class PerformanceReportPage extends StatefulWidget {
|
||||
const PerformanceReportPage({super.key});
|
||||
@@ -15,18 +16,18 @@ class PerformanceReportPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
DateTime _startDate = DateTime.now().subtract(const Duration(days: 30));
|
||||
DateTime _endDate = DateTime.now();
|
||||
final DateTime _startDate = DateTime.now().subtract(const Duration(days: 30));
|
||||
final DateTime _endDate = DateTime.now();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => Modular.get<PerformanceBloc>()
|
||||
create: (BuildContext context) => Modular.get<PerformanceBloc>()
|
||||
..add(LoadPerformanceReport(startDate: _startDate, endDate: _endDate)),
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: BlocBuilder<PerformanceBloc, PerformanceState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, PerformanceState state) {
|
||||
if (state is PerformanceLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -36,10 +37,10 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
}
|
||||
|
||||
if (state is PerformanceLoaded) {
|
||||
final report = state.report;
|
||||
final PerformanceReport report = state.report;
|
||||
|
||||
// Compute overall score (0–100) from the 4 KPIs
|
||||
final overallScore = ((report.fillRate * 0.3) +
|
||||
final double overallScore = ((report.fillRate * 0.3) +
|
||||
(report.completionRate * 0.3) +
|
||||
(report.onTimeRate * 0.25) +
|
||||
// avg fill time: 3h target → invert to score
|
||||
@@ -49,24 +50,24 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
0.15))
|
||||
.clamp(0.0, 100.0);
|
||||
|
||||
final scoreLabel = overallScore >= 90
|
||||
final String scoreLabel = overallScore >= 90
|
||||
? context.t.client_reports.performance_report.overall_score.excellent
|
||||
: overallScore >= 75
|
||||
? context.t.client_reports.performance_report.overall_score.good
|
||||
: context.t.client_reports.performance_report.overall_score.needs_work;
|
||||
final scoreLabelColor = overallScore >= 90
|
||||
final Color scoreLabelColor = overallScore >= 90
|
||||
? UiColors.success
|
||||
: overallScore >= 75
|
||||
? UiColors.textWarning
|
||||
: UiColors.error;
|
||||
final scoreLabelBg = overallScore >= 90
|
||||
final Color scoreLabelBg = overallScore >= 90
|
||||
? UiColors.tagSuccess
|
||||
: overallScore >= 75
|
||||
? UiColors.tagPending
|
||||
: UiColors.tagError;
|
||||
|
||||
// KPI rows: label, value, target, color, met status
|
||||
final kpis = [
|
||||
final List<_KpiData> kpis = <_KpiData>[
|
||||
_KpiData(
|
||||
icon: UiIcons.users,
|
||||
iconColor: UiColors.primary,
|
||||
@@ -119,7 +120,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// ── Header ───────────────────────────────────────────
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
@@ -130,16 +131,16 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [UiColors.primary, UiColors.buttonPrimaryHover],
|
||||
colors: <Color>[UiColors.primary, UiColors.buttonPrimaryHover],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -159,7 +160,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.performance_report
|
||||
.title,
|
||||
@@ -229,7 +230,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// ── Overall Score Hero Card ───────────────────
|
||||
Container(
|
||||
width: double.infinity,
|
||||
@@ -240,7 +241,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF0F4FF),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 10,
|
||||
@@ -249,7 +250,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
UiIcons.chart,
|
||||
size: 32,
|
||||
@@ -258,7 +259,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
context.t.client_reports.performance_report.overall_score.title,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: UiColors.textSecondary,
|
||||
),
|
||||
@@ -303,7 +304,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 10,
|
||||
@@ -312,7 +313,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.performance_report.kpis_title,
|
||||
style: const TextStyle(
|
||||
@@ -324,7 +325,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
...kpis.map(
|
||||
(kpi) => _KpiRow(kpi: kpi),
|
||||
(_KpiData kpi) => _KpiRow(kpi: kpi),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -349,15 +350,6 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
|
||||
|
||||
// ── KPI data model ────────────────────────────────────────────────────────────
|
||||
class _KpiData {
|
||||
final IconData icon;
|
||||
final Color iconColor;
|
||||
final String label;
|
||||
final String target;
|
||||
final double value; // 0–100 for bar
|
||||
final String displayValue;
|
||||
final Color barColor;
|
||||
final bool met;
|
||||
final bool close;
|
||||
|
||||
const _KpiData({
|
||||
required this.icon,
|
||||
@@ -370,27 +362,36 @@ class _KpiData {
|
||||
required this.met,
|
||||
required this.close,
|
||||
});
|
||||
final IconData icon;
|
||||
final Color iconColor;
|
||||
final String label;
|
||||
final String target;
|
||||
final double value; // 0–100 for bar
|
||||
final String displayValue;
|
||||
final Color barColor;
|
||||
final bool met;
|
||||
final bool close;
|
||||
}
|
||||
|
||||
// ── KPI row widget ────────────────────────────────────────────────────────────
|
||||
class _KpiRow extends StatelessWidget {
|
||||
final _KpiData kpi;
|
||||
|
||||
const _KpiRow({required this.kpi});
|
||||
final _KpiData kpi;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final badgeText = kpi.met
|
||||
final String badgeText = kpi.met
|
||||
? context.t.client_reports.performance_report.kpis.met
|
||||
: kpi.close
|
||||
? context.t.client_reports.performance_report.kpis.close
|
||||
: context.t.client_reports.performance_report.kpis.miss;
|
||||
final badgeColor = kpi.met
|
||||
final Color badgeColor = kpi.met
|
||||
? UiColors.success
|
||||
: kpi.close
|
||||
? UiColors.textWarning
|
||||
: UiColors.error;
|
||||
final badgeBg = kpi.met
|
||||
final Color badgeBg = kpi.met
|
||||
? UiColors.tagSuccess
|
||||
: kpi.close
|
||||
? UiColors.tagPending
|
||||
@@ -399,9 +400,9 @@ class _KpiRow extends StatelessWidget {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
@@ -415,7 +416,7 @@ class _KpiRow extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
kpi.label,
|
||||
style: const TextStyle(
|
||||
@@ -437,7 +438,7 @@ class _KpiRow extends StatelessWidget {
|
||||
// Value + badge inline (matches prototype)
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
kpi.displayValue,
|
||||
style: const TextStyle(
|
||||
|
||||
@@ -24,7 +24,7 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
late ReportsSummaryBloc _summaryBloc;
|
||||
|
||||
// Date ranges per tab: Today, Week, Month, Quarter
|
||||
final List<(DateTime, DateTime)> _dateRanges = [
|
||||
final List<(DateTime, DateTime)> _dateRanges = <(DateTime, DateTime)>[
|
||||
(
|
||||
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day),
|
||||
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day,
|
||||
@@ -64,7 +64,7 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
}
|
||||
|
||||
void _loadSummary(int tabIndex) {
|
||||
final range = _dateRanges[tabIndex];
|
||||
final (DateTime, DateTime) range = _dateRanges[tabIndex];
|
||||
_summaryBloc.add(LoadReportsSummary(
|
||||
startDate: range.$1,
|
||||
endDate: range.$2,
|
||||
@@ -85,7 +85,7 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Header with title and tabs
|
||||
ReportsHeader(
|
||||
tabController: _tabController,
|
||||
@@ -93,20 +93,20 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
),
|
||||
|
||||
// Content
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Key Metrics Grid
|
||||
const MetricsGrid(),
|
||||
MetricsGrid(),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(height: 24),
|
||||
|
||||
// Quick Reports Section
|
||||
const QuickReportsSection(),
|
||||
QuickReportsSection(),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:client_reports/src/presentation/blocs/spend/spend_bloc.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/spend/spend_event.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/spend/spend_state.dart';
|
||||
@@ -24,10 +25,10 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final now = DateTime.now();
|
||||
final DateTime now = DateTime.now();
|
||||
// Monday alignment logic
|
||||
final diff = now.weekday - DateTime.monday;
|
||||
final monday = now.subtract(Duration(days: diff));
|
||||
final int diff = now.weekday - DateTime.monday;
|
||||
final DateTime monday = now.subtract(Duration(days: diff));
|
||||
_startDate = DateTime(monday.year, monday.month, monday.day);
|
||||
_endDate = _startDate.add(const Duration(days: 6, hours: 23, minutes: 59, seconds: 59));
|
||||
}
|
||||
@@ -35,12 +36,12 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => Modular.get<SpendBloc>()
|
||||
create: (BuildContext context) => Modular.get<SpendBloc>()
|
||||
..add(LoadSpendReport(startDate: _startDate, endDate: _endDate)),
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: BlocBuilder<SpendBloc, SpendState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, SpendState state) {
|
||||
if (state is SpendLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -50,10 +51,10 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
}
|
||||
|
||||
if (state is SpendLoaded) {
|
||||
final report = state.report;
|
||||
final SpendReport report = state.report;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Header
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
@@ -67,9 +68,9 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -89,7 +90,7 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.spend_report.title,
|
||||
style: const TextStyle(
|
||||
@@ -167,10 +168,10 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Summary Cards (New Style)
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: _SpendStatCard(
|
||||
label: context.t.client_reports.spend_report
|
||||
@@ -209,7 +210,7 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 10,
|
||||
@@ -219,7 +220,7 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.spend_report.chart_title,
|
||||
style: const TextStyle(
|
||||
@@ -262,9 +263,9 @@ class _SpendReportPageState extends State<SpendReportPage> {
|
||||
}
|
||||
|
||||
class _SpendBarChart extends StatelessWidget {
|
||||
final List<dynamic> chartData;
|
||||
|
||||
const _SpendBarChart({required this.chartData});
|
||||
final List<dynamic> chartData;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -272,14 +273,14 @@ class _SpendBarChart extends StatelessWidget {
|
||||
BarChartData(
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
maxY: (chartData.fold<double>(0,
|
||||
(prev, element) =>
|
||||
(double prev, element) =>
|
||||
element.amount > prev ? element.amount : prev) *
|
||||
1.2)
|
||||
.ceilToDouble(),
|
||||
barTouchData: BarTouchData(
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipPadding: const EdgeInsets.all(8),
|
||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||
getTooltipItem: (BarChartGroupData group, int groupIndex, BarChartRodData rod, int rodIndex) {
|
||||
return BarTooltipItem(
|
||||
'\$${rod.toY.round()}',
|
||||
const TextStyle(
|
||||
@@ -296,7 +297,7 @@ class _SpendBarChart extends StatelessWidget {
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 30,
|
||||
getTitlesWidget: (value, meta) {
|
||||
getTitlesWidget: (double value, TitleMeta meta) {
|
||||
if (value.toInt() >= chartData.length) return const SizedBox();
|
||||
final date = chartData[value.toInt()].date;
|
||||
return SideTitleWidget(
|
||||
@@ -317,7 +318,7 @@ class _SpendBarChart extends StatelessWidget {
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 40,
|
||||
getTitlesWidget: (value, meta) {
|
||||
getTitlesWidget: (double value, TitleMeta meta) {
|
||||
if (value == 0) return const SizedBox();
|
||||
return SideTitleWidget(
|
||||
axisSide: meta.axisSide,
|
||||
@@ -343,7 +344,7 @@ class _SpendBarChart extends StatelessWidget {
|
||||
show: true,
|
||||
drawVerticalLine: false,
|
||||
horizontalInterval: 1000,
|
||||
getDrawingHorizontalLine: (value) => FlLine(
|
||||
getDrawingHorizontalLine: (double value) => const FlLine(
|
||||
color: UiColors.bgSecondary,
|
||||
strokeWidth: 1,
|
||||
),
|
||||
@@ -351,9 +352,9 @@ class _SpendBarChart extends StatelessWidget {
|
||||
borderData: FlBorderData(show: false),
|
||||
barGroups: List.generate(
|
||||
chartData.length,
|
||||
(index) => BarChartGroupData(
|
||||
(int index) => BarChartGroupData(
|
||||
x: index,
|
||||
barRods: [
|
||||
barRods: <BarChartRodData>[
|
||||
BarChartRodData(
|
||||
toY: chartData[index].amount,
|
||||
color: UiColors.success,
|
||||
@@ -371,11 +372,6 @@ class _SpendBarChart extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _SpendStatCard extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
final String pillText;
|
||||
final Color themeColor;
|
||||
final IconData icon;
|
||||
|
||||
const _SpendStatCard({
|
||||
required this.label,
|
||||
@@ -384,6 +380,11 @@ class _SpendStatCard extends StatelessWidget {
|
||||
required this.themeColor,
|
||||
required this.icon,
|
||||
});
|
||||
final String label;
|
||||
final String value;
|
||||
final String pillText;
|
||||
final Color themeColor;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -392,7 +393,7 @@ class _SpendStatCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.06),
|
||||
blurRadius: 8,
|
||||
@@ -402,9 +403,9 @@ class _SpendStatCard extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 14, color: themeColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -453,9 +454,9 @@ class _SpendStatCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _SpendByIndustryCard extends StatelessWidget {
|
||||
final List<SpendIndustryCategory> industries;
|
||||
|
||||
const _SpendByIndustryCard({required this.industries});
|
||||
final List<SpendIndustryCategory> industries;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -464,7 +465,7 @@ class _SpendByIndustryCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.04),
|
||||
blurRadius: 10,
|
||||
@@ -474,7 +475,7 @@ class _SpendByIndustryCard extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.client_reports.spend_report.spend_by_industry,
|
||||
style: const TextStyle(
|
||||
@@ -495,14 +496,14 @@ class _SpendByIndustryCard extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
else
|
||||
...industries.map((ind) => Padding(
|
||||
...industries.map((SpendIndustryCategory ind) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
ind.name,
|
||||
style: const TextStyle(
|
||||
@@ -547,3 +548,4 @@ class _SpendByIndustryCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,17 @@ import 'package:flutter/material.dart';
|
||||
/// Shows a metric with an icon, label, value, and a badge with contextual
|
||||
/// information. Used in the metrics grid of the reports page.
|
||||
class MetricCard extends StatelessWidget {
|
||||
|
||||
const MetricCard({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.value,
|
||||
required this.badgeText,
|
||||
required this.badgeColor,
|
||||
required this.badgeTextColor,
|
||||
required this.iconColor,
|
||||
});
|
||||
/// The icon to display for this metric.
|
||||
final IconData icon;
|
||||
|
||||
@@ -27,17 +38,6 @@ class MetricCard extends StatelessWidget {
|
||||
/// Color for the icon.
|
||||
final Color iconColor;
|
||||
|
||||
const MetricCard({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.value,
|
||||
required this.badgeText,
|
||||
required this.badgeColor,
|
||||
required this.badgeTextColor,
|
||||
required this.iconColor,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -45,7 +45,7 @@ class MetricCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.06),
|
||||
blurRadius: 4,
|
||||
@@ -56,10 +56,10 @@ class MetricCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Icon and Label
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Icon(icon, size: 16, color: iconColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -78,7 +78,7 @@ class MetricCard extends StatelessWidget {
|
||||
// Value and Badge
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:krow_domain/src/entities/reports/reports_summary.dart';
|
||||
|
||||
import 'metric_card.dart';
|
||||
|
||||
@@ -25,7 +26,7 @@ class MetricsGrid extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<ReportsSummaryBloc, ReportsSummaryState>(
|
||||
builder: (context, state) {
|
||||
builder: (BuildContext context, ReportsSummaryState state) {
|
||||
// Loading or Initial State
|
||||
if (state is ReportsSummaryLoading || state is ReportsSummaryInitial) {
|
||||
return const Padding(
|
||||
@@ -45,7 +46,7 @@ class MetricsGrid extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const Icon(UiIcons.warning,
|
||||
color: UiColors.error, size: 16),
|
||||
const SizedBox(width: 8),
|
||||
@@ -63,8 +64,8 @@ class MetricsGrid extends StatelessWidget {
|
||||
}
|
||||
|
||||
// Loaded State
|
||||
final summary = (state as ReportsSummaryLoaded).summary;
|
||||
final currencyFmt = NumberFormat.currency(
|
||||
final ReportsSummary summary = (state as ReportsSummaryLoaded).summary;
|
||||
final NumberFormat currencyFmt = NumberFormat.currency(
|
||||
symbol: '\$', decimalDigits: 0);
|
||||
|
||||
return GridView.count(
|
||||
@@ -74,7 +75,7 @@ class MetricsGrid extends StatelessWidget {
|
||||
mainAxisSpacing: 12,
|
||||
crossAxisSpacing: 12,
|
||||
childAspectRatio: 1.2,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Total Hours
|
||||
MetricCard(
|
||||
icon: UiIcons.clock,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -18,7 +19,7 @@ class QuickReportsSection extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Title
|
||||
Text(
|
||||
context.t.client_reports.quick_reports.title,
|
||||
@@ -33,7 +34,7 @@ class QuickReportsSection extends StatelessWidget {
|
||||
mainAxisSpacing: 12,
|
||||
crossAxisSpacing: 12,
|
||||
childAspectRatio: 1.3,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Daily Operations
|
||||
ReportCard(
|
||||
icon: UiIcons.calendar,
|
||||
@@ -89,3 +90,4 @@ class QuickReportsSection extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@ import 'package:flutter_modular/flutter_modular.dart';
|
||||
/// Displays an icon, name, and a quick navigation to a report page.
|
||||
/// Used in the quick reports grid of the reports page.
|
||||
class ReportCard extends StatelessWidget {
|
||||
|
||||
const ReportCard({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.name,
|
||||
required this.iconBgColor,
|
||||
required this.iconColor,
|
||||
required this.route,
|
||||
});
|
||||
/// The icon to display for this report.
|
||||
final IconData icon;
|
||||
|
||||
@@ -23,15 +32,6 @@ class ReportCard extends StatelessWidget {
|
||||
/// Navigation route to the report page.
|
||||
final String route;
|
||||
|
||||
const ReportCard({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.name,
|
||||
required this.iconBgColor,
|
||||
required this.iconColor,
|
||||
required this.route,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
@@ -41,7 +41,7 @@ class ReportCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.02),
|
||||
blurRadius: 2,
|
||||
@@ -51,7 +51,7 @@ class ReportCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Icon Container
|
||||
Container(
|
||||
width: 40,
|
||||
@@ -65,7 +65,7 @@ class ReportCard extends StatelessWidget {
|
||||
// Name and Export Info
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
@@ -78,7 +78,7 @@ class ReportCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
UiIcons.download,
|
||||
size: 12,
|
||||
|
||||
@@ -32,7 +32,7 @@ class ReportsHeader extends StatelessWidget {
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
colors: <Color>[
|
||||
UiColors.primary,
|
||||
UiColors.buttonPrimaryHover,
|
||||
],
|
||||
@@ -41,10 +41,10 @@ class ReportsHeader extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Title and Back Button
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Modular.to.toClientHome(),
|
||||
child: Container(
|
||||
@@ -104,7 +104,7 @@ class ReportsHeader extends StatelessWidget {
|
||||
),
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
dividerColor: Colors.transparent,
|
||||
tabs: [
|
||||
tabs: <Widget>[
|
||||
Tab(text: context.t.client_reports.tabs.today),
|
||||
Tab(text: context.t.client_reports.tabs.week),
|
||||
Tab(text: context.t.client_reports.tabs.month),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs
|
||||
import 'package:client_reports/src/data/repositories_impl/reports_repository_impl.dart';
|
||||
import 'package:client_reports/src/domain/repositories/reports_repository.dart';
|
||||
import 'package:client_reports/src/presentation/blocs/daily_ops/daily_ops_bloc.dart';
|
||||
@@ -19,7 +20,7 @@ import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
|
||||
class ReportsModule extends Module {
|
||||
@override
|
||||
List<Module> get imports => [DataConnectModule()];
|
||||
List<Module> get imports => <Module>[DataConnectModule()];
|
||||
|
||||
@override
|
||||
void binds(Injector i) {
|
||||
@@ -44,3 +45,4 @@ class ReportsModule extends Module {
|
||||
r.child('/no-show', child: (_) => const NoShowReportPage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user