diff --git a/apps/mobile/apps/design_system_viewer/pubspec.yaml b/apps/mobile/apps/design_system_viewer/pubspec.yaml index c96bbd77..12a4a9d9 100644 --- a/apps/mobile/apps/design_system_viewer/pubspec.yaml +++ b/apps/mobile/apps/design_system_viewer/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 0.0.1 resolution: workspace environment: diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart b/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart index 0ff6481d..af448a4c 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart +++ b/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart @@ -6,7 +6,7 @@ /// Locales: 2 /// Strings: 1038 (519 per locale) /// -/// Built on 2026-01-29 at 06:58 UTC +/// Built on 2026-01-29 at 15:50 UTC // coverage:ignore-file // ignore_for_file: type=lint, unused_import diff --git a/apps/mobile/packages/design_system/lib/src/ui_constants.dart b/apps/mobile/packages/design_system/lib/src/ui_constants.dart index 819699b1..a13a28c9 100644 --- a/apps/mobile/packages/design_system/lib/src/ui_constants.dart +++ b/apps/mobile/packages/design_system/lib/src/ui_constants.dart @@ -37,4 +37,7 @@ class UiConstants { static const double space12 = 48.0; static const double space14 = 56.0; static const double space16 = 64.0; + static const double space20 = 80.0; + static const double space24 = 96.0; + static const double space32 = 128.0; } diff --git a/apps/mobile/packages/features/client/billing/lib/src/presentation/pages/billing_page.dart b/apps/mobile/packages/features/client/billing/lib/src/presentation/pages/billing_page.dart index 8fb39115..c51f0007 100644 --- a/apps/mobile/packages/features/client/billing/lib/src/presentation/pages/billing_page.dart +++ b/apps/mobile/packages/features/client/billing/lib/src/presentation/pages/billing_page.dart @@ -2,16 +2,16 @@ 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 '../blocs/billing_bloc.dart'; import '../blocs/billing_event.dart'; import '../blocs/billing_state.dart'; import '../widgets/billing_header.dart'; -import '../widgets/pending_invoices_section.dart'; -import '../widgets/payment_method_card.dart'; -import '../widgets/spending_breakdown_card.dart'; -import '../widgets/savings_card.dart'; import '../widgets/invoice_history_section.dart'; -import '../widgets/export_invoices_button.dart'; +import '../widgets/payment_method_card.dart'; +import '../widgets/pending_invoices_section.dart'; +import '../widgets/savings_card.dart'; +import '../widgets/spending_breakdown_card.dart'; /// The entry point page for the client billing feature. /// @@ -43,7 +43,6 @@ class BillingView extends StatelessWidget { return BlocBuilder( builder: (BuildContext context, BillingState state) { return Scaffold( - backgroundColor: UiColors.bgPrimary, body: Column( children: [ BillingHeader( @@ -89,9 +88,7 @@ class BillingView extends StatelessWidget { SavingsCard(savings: state.savings), const SizedBox(height: UiConstants.space6), InvoiceHistorySection(invoices: state.invoiceHistory), - const SizedBox(height: UiConstants.space6), - const ExportInvoicesButton(), - const SizedBox(height: UiConstants.space6), + const SizedBox(height: UiConstants.space24), ], ), ); diff --git a/apps/mobile/packages/features/client/billing/pubspec.yaml b/apps/mobile/packages/features/client/billing/pubspec.yaml index d8165fe9..74ec711f 100644 --- a/apps/mobile/packages/features/client/billing/pubspec.yaml +++ b/apps/mobile/packages/features/client/billing/pubspec.yaml @@ -1,7 +1,7 @@ name: billing description: Client Billing feature package publish_to: 'none' -version: 1.0.0+1 +version: 0.0.1 resolution: workspace environment: diff --git a/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/pages/coverage_page.dart b/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/pages/coverage_page.dart index 441c6040..6e935e45 100644 --- a/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/pages/coverage_page.dart +++ b/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/pages/coverage_page.dart @@ -24,7 +24,6 @@ class CoveragePage extends StatelessWidget { create: (BuildContext context) => Modular.get() ..add(CoverageLoadRequested(date: DateTime.now())), child: Scaffold( - backgroundColor: UiColors.background, body: BlocBuilder( builder: (BuildContext context, CoverageState state) { return Column( @@ -121,6 +120,7 @@ class CoveragePage extends StatelessWidget { ), const SizedBox(height: UiConstants.space3), CoverageShiftList(shifts: state.shifts), + const SizedBox(height: 100), ], ), ); diff --git a/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/widgets/coverage_shift_list.dart b/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/widgets/coverage_shift_list.dart index 0732c389..7ec0c0c5 100644 --- a/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/widgets/coverage_shift_list.dart +++ b/apps/mobile/packages/features/client/client_coverage/lib/src/presentation/widgets/coverage_shift_list.dart @@ -35,24 +35,23 @@ class CoverageShiftList extends StatelessWidget { if (shifts.isEmpty) { return Container( padding: const EdgeInsets.all(UiConstants.space8), + width: double.infinity, decoration: BoxDecoration( color: UiColors.bgPopup, borderRadius: UiConstants.radiusLg, border: Border.all(color: UiColors.border), ), child: Column( + spacing: UiConstants.space4, children: [ const Icon( UiIcons.users, size: UiConstants.space12, - color: UiColors.mutedForeground, + color: UiColors.textSecondary, ), - const SizedBox(height: UiConstants.space3), Text( 'No shifts scheduled for this day', - style: UiTypography.body2r.copyWith( - color: UiColors.mutedForeground, - ), + style: UiTypography.body2r.textSecondary, ), ], ), @@ -160,12 +159,15 @@ class _ShiftHeader extends StatelessWidget { ), ), child: Row( + spacing: UiConstants.space4, children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, + spacing: UiConstants.space2, children: [ Row( + spacing: UiConstants.space2, children: [ Container( width: UiConstants.space2, @@ -175,42 +177,43 @@ class _ShiftHeader extends StatelessWidget { shape: BoxShape.circle, ), ), - const SizedBox(width: UiConstants.space2), Text( title, - style: UiTypography.body1b.copyWith( - color: UiColors.textPrimary, - ), + style: UiTypography.body1b.textPrimary, ), ], ), - const SizedBox(height: UiConstants.space2), - Row( + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Icon( - UiIcons.mapPin, - size: UiConstants.space3, - color: UiColors.mutedForeground, + Row( + spacing: UiConstants.space1, + children: [ + const Icon( + UiIcons.mapPin, + size: UiConstants.space3, + color: UiColors.iconSecondary, + ), + Expanded(child: Text( + location, + style: UiTypography.body3r.textSecondary, + overflow: TextOverflow.ellipsis, + )), + ], ), - const SizedBox(width: UiConstants.space1), - Text( - location, - style: UiTypography.body3r.copyWith( - color: UiColors.mutedForeground, - ), - ), - const SizedBox(width: UiConstants.space3), - const Icon( - UiIcons.clock, - size: UiConstants.space3, - color: UiColors.mutedForeground, - ), - const SizedBox(width: UiConstants.space1), - Text( - startTime, - style: UiTypography.body3r.copyWith( - color: UiColors.mutedForeground, - ), + Row( + spacing: UiConstants.space1, + children: [ + const Icon( + UiIcons.clock, + size: UiConstants.space3, + color: UiColors.iconSecondary, + ), + Text( + startTime, + style: UiTypography.body3r.textSecondary, + ), + ], ), ], ), diff --git a/apps/mobile/packages/features/client/client_coverage/pubspec.yaml b/apps/mobile/packages/features/client/client_coverage/pubspec.yaml index 9f8fa88c..107ef9bf 100644 --- a/apps/mobile/packages/features/client/client_coverage/pubspec.yaml +++ b/apps/mobile/packages/features/client/client_coverage/pubspec.yaml @@ -1,6 +1,6 @@ name: client_coverage description: Client coverage feature for tracking daily shift coverage and worker status -version: 1.0.0 +version: 0.0.1 publish_to: none resolution: workspace @@ -33,4 +33,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 + flutter_lints: ^6.0.0 diff --git a/apps/mobile/packages/features/client/client_main/lib/src/presentation/pages/client_main_page.dart b/apps/mobile/packages/features/client/client_main/lib/src/presentation/pages/client_main_page.dart index 1429a78f..b01d1c9b 100644 --- a/apps/mobile/packages/features/client/client_main/lib/src/presentation/pages/client_main_page.dart +++ b/apps/mobile/packages/features/client/client_main/lib/src/presentation/pages/client_main_page.dart @@ -30,7 +30,7 @@ class ClientMainPage extends StatelessWidget { BlocProvider.of(context).navigateToTab(index); }, ); - }, + }, ), ), ); diff --git a/apps/mobile/packages/features/client/client_main/lib/src/presentation/widgets/client_main_bottom_bar.dart b/apps/mobile/packages/features/client/client_main/lib/src/presentation/widgets/client_main_bottom_bar.dart index e59987cf..d7d18428 100644 --- a/apps/mobile/packages/features/client/client_main/lib/src/presentation/widgets/client_main_bottom_bar.dart +++ b/apps/mobile/packages/features/client/client_main/lib/src/presentation/widgets/client_main_bottom_bar.dart @@ -99,13 +99,6 @@ class ClientMainBottomBar extends StatelessWidget { activeColor: activeColor, inactiveColor: inactiveColor, ), - _buildNavItem( - index: 4, - icon: UiIcons.chart, - label: t.client_main.tabs.reports, - activeColor: activeColor, - inactiveColor: inactiveColor, - ), ], ), ), diff --git a/apps/mobile/packages/features/client/home/lib/client_home.dart b/apps/mobile/packages/features/client/home/lib/client_home.dart index 5f75c860..ce9dfa18 100644 --- a/apps/mobile/packages/features/client/home/lib/client_home.dart +++ b/apps/mobile/packages/features/client/home/lib/client_home.dart @@ -1,5 +1,3 @@ -library client_home; - import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_data_connect/krow_data_connect.dart'; import 'src/data/repositories_impl/home_repository_impl.dart'; diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart index 23ff6846..24e96bb3 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart @@ -26,6 +26,8 @@ class ClientHomeBloc extends Bloc { on(_onWidgetVisibilityToggled); on(_onWidgetReordered); on(_onLayoutReset); + + add(ClientHomeStarted()); } Future _onStarted( diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart index e4e30728..ee5a22b2 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart @@ -24,8 +24,7 @@ class ClientHomePage extends StatelessWidget { final TranslationsClientHomeEn i18n = t.client_home; return BlocProvider( - create: (BuildContext context) => - Modular.get()..add(ClientHomeStarted()), + create: (BuildContext context) => Modular.get(), child: Scaffold( body: SafeArea( child: Column( @@ -59,19 +58,15 @@ class ClientHomePage extends StatelessWidget { 100, ), onReorder: (int oldIndex, int newIndex) { - BlocProvider.of(context).add( - ClientHomeWidgetReordered(oldIndex, newIndex), - ); + BlocProvider.of( + context, + ).add(ClientHomeWidgetReordered(oldIndex, newIndex)); }, children: state.widgetOrder.map((String id) { return Container( - key: ValueKey(id), + key: ValueKey(id), margin: const EdgeInsets.only(bottom: UiConstants.space4), - child: DashboardWidgetBuilder( - id: id, - state: state, - isEditMode: true, - ), + child: DashboardWidgetBuilder(id: id, state: state, isEditMode: true), ); }).toList(), ); diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart index eeebff38..4298a37d 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart @@ -24,21 +24,22 @@ class ActionsWidget extends StatelessWidget { return Row( children: [ - Expanded( - child: _ActionCard( - title: i18n.rapid, - subtitle: i18n.rapid_subtitle, - icon: UiIcons.zap, - color: const Color(0xFFFEF2F2), - borderColor: const Color(0xFFFECACA), - iconBgColor: const Color(0xFFFEE2E2), - iconColor: const Color(0xFFDC2626), - textColor: const Color(0xFF7F1D1D), - subtitleColor: const Color(0xFFB91C1C), - onTap: onRapidPressed, - ), - ), - const SizedBox(width: UiConstants.space2), + /// TODO: FEATURE_NOT_YET_IMPLEMENTED + // Expanded( + // child: _ActionCard( + // title: i18n.rapid, + // subtitle: i18n.rapid_subtitle, + // icon: UiIcons.zap, + // color: const Color(0xFFFEF2F2), + // borderColor: const Color(0xFFFECACA), + // iconBgColor: const Color(0xFFFEE2E2), + // iconColor: const Color(0xFFDC2626), + // textColor: const Color(0xFF7F1D1D), + // subtitleColor: const Color(0xFFB91C1C), + // onTap: onRapidPressed, + // ), + // ), + // const SizedBox(width: UiConstants.space2), Expanded( child: _ActionCard( title: i18n.create_order, diff --git a/apps/mobile/packages/features/client/home/pubspec.yaml b/apps/mobile/packages/features/client/home/pubspec.yaml index 7566f837..e75de091 100644 --- a/apps/mobile/packages/features/client/home/pubspec.yaml +++ b/apps/mobile/packages/features/client/home/pubspec.yaml @@ -22,6 +22,7 @@ dependencies: core_localization: path: ../../../core_localization krow_domain: ^0.0.1 + krow_data_connect: ^0.0.1 dev_dependencies: flutter_test: diff --git a/apps/mobile/packages/features/client/view_orders/pubspec.yaml b/apps/mobile/packages/features/client/view_orders/pubspec.yaml index dbf26cc2..5c419aa9 100644 --- a/apps/mobile/packages/features/client/view_orders/pubspec.yaml +++ b/apps/mobile/packages/features/client/view_orders/pubspec.yaml @@ -1,7 +1,7 @@ name: view_orders description: Client View Orders feature package publish_to: 'none' -version: 1.0.0+1 +version: 0.0.1 resolution: workspace environment: diff --git a/apps/mobile/packages/features/staff/availability/pubspec.yaml b/apps/mobile/packages/features/staff/availability/pubspec.yaml index 1b20e6bd..bed921c9 100644 --- a/apps/mobile/packages/features/staff/availability/pubspec.yaml +++ b/apps/mobile/packages/features/staff/availability/pubspec.yaml @@ -32,4 +32,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.0 + flutter_lints: ^6.0.0 diff --git a/apps/mobile/packages/features/staff/payments/lib/src/data/repositories/payments_repository_impl.dart b/apps/mobile/packages/features/staff/payments/lib/src/data/repositories/payments_repository_impl.dart index 303fca7f..5ac53641 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/data/repositories/payments_repository_impl.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/data/repositories/payments_repository_impl.dart @@ -1,5 +1,3 @@ -// ignore: unused_import -// import 'package:data_connect/data_connect.dart'; import '../../domain/entities/payment_summary.dart'; import '../../domain/entities/payment_transaction.dart'; import '../../domain/repositories/payments_repository.dart'; diff --git a/apps/mobile/packages/features/staff/payments/lib/src/data/repositories_impl/payments_repository_impl.dart b/apps/mobile/packages/features/staff/payments/lib/src/data/repositories_impl/payments_repository_impl.dart index 5abcd80b..fbdf84ac 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/data/repositories_impl/payments_repository_impl.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/data/repositories_impl/payments_repository_impl.dart @@ -1,22 +1,21 @@ -import 'package:krow_data_connect/krow_data_connect.dart'; -import 'package:krow_domain/krow_domain.dart'; +import '../../domain/entities/payment_summary.dart'; +import '../../domain/entities/payment_transaction.dart'; import '../../domain/repositories/payments_repository.dart'; +import '../datasources/payments_remote_datasource.dart'; /// Implementation of [PaymentsRepository]. -/// -/// This class handles the retrieval of payment data by delegating to the -/// [FinancialRepositoryMock] from the data connect package. -/// -/// It resides in the data layer and depends on the domain layer for the repository interface. class PaymentsRepositoryImpl implements PaymentsRepository { - final FinancialRepositoryMock financialRepository; + final PaymentsRemoteDataSource remoteDataSource; - /// Creates a [PaymentsRepositoryImpl] with the given [financialRepository]. - PaymentsRepositoryImpl({required this.financialRepository}); + PaymentsRepositoryImpl({required this.remoteDataSource}); @override - Future> getPayments() async { - // TODO: Get actual logged in staff ID - return await financialRepository.getStaffPayments('staff_1'); + Future getPaymentSummary() async { + return await remoteDataSource.fetchPaymentSummary(); + } + + @override + Future> getPaymentHistory(String period) async { + return await remoteDataSource.fetchPaymentHistory(period); } } diff --git a/apps/mobile/packages/features/staff/payments/lib/src/domain/entities/payment_summary.dart b/apps/mobile/packages/features/staff/payments/lib/src/domain/entities/payment_summary.dart new file mode 100644 index 00000000..de815145 --- /dev/null +++ b/apps/mobile/packages/features/staff/payments/lib/src/domain/entities/payment_summary.dart @@ -0,0 +1,23 @@ +import 'package:equatable/equatable.dart'; + +class PaymentSummary extends Equatable { + final double weeklyEarnings; + final double monthlyEarnings; + final double pendingEarnings; + final double totalEarnings; + + const PaymentSummary({ + required this.weeklyEarnings, + required this.monthlyEarnings, + required this.pendingEarnings, + required this.totalEarnings, + }); + + @override + List get props => [ + weeklyEarnings, + monthlyEarnings, + pendingEarnings, + totalEarnings, + ]; +} diff --git a/apps/mobile/packages/features/staff/payments/lib/src/domain/entities/payment_transaction.dart b/apps/mobile/packages/features/staff/payments/lib/src/domain/entities/payment_transaction.dart new file mode 100644 index 00000000..dff3eec0 --- /dev/null +++ b/apps/mobile/packages/features/staff/payments/lib/src/domain/entities/payment_transaction.dart @@ -0,0 +1,41 @@ +import 'package:equatable/equatable.dart'; + +class PaymentTransaction extends Equatable { + final String id; + final String title; + final String location; + final String address; + final String workedTime; + final double amount; + final String status; + final int hours; + final double rate; + final DateTime date; + + const PaymentTransaction({ + required this.id, + required this.title, + required this.location, + required this.address, + required this.workedTime, + required this.amount, + required this.status, + required this.hours, + required this.rate, + required this.date, + }); + + @override + List get props => [ + id, + title, + location, + address, + workedTime, + amount, + status, + hours, + rate, + date, + ]; +} diff --git a/apps/mobile/packages/features/staff/payments/lib/src/domain/repositories/payments_repository.dart b/apps/mobile/packages/features/staff/payments/lib/src/domain/repositories/payments_repository.dart index 71546c9e..b142805d 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/domain/repositories/payments_repository.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/domain/repositories/payments_repository.dart @@ -1,10 +1,14 @@ -import 'package:krow_domain/krow_domain.dart'; +import '../entities/payment_summary.dart'; +import '../entities/payment_transaction.dart'; /// Repository interface for Payments feature. /// /// Defines the contract for data access related to staff payments. /// Implementations of this interface should reside in the data layer. abstract class PaymentsRepository { - /// Fetches the list of payments for the current staff member. - Future> getPayments(); + /// Fetches the payment summary (earnings). + Future getPaymentSummary(); + + /// Fetches the payment history for a specific period. + Future> getPaymentHistory(String period); } diff --git a/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_history_usecase.dart b/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_history_usecase.dart index d5a3a3a8..01ceac51 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_history_usecase.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_history_usecase.dart @@ -1,20 +1,19 @@ import 'package:krow_core/core.dart'; -import 'package:krow_domain/krow_domain.dart'; import '../arguments/get_payment_history_arguments.dart'; +import '../entities/payment_transaction.dart'; import '../repositories/payments_repository.dart'; /// Use case to retrieve payment history filtered by a period. /// /// This use case delegates the data retrieval to [PaymentsRepository]. -class GetPaymentHistoryUseCase extends UseCase> { +class GetPaymentHistoryUseCase extends UseCase> { final PaymentsRepository repository; /// Creates a [GetPaymentHistoryUseCase]. GetPaymentHistoryUseCase(this.repository); @override - Future> call(GetPaymentHistoryArguments arguments) async { - // TODO: Implement filtering by period - return await repository.getPayments(); + Future> call(GetPaymentHistoryArguments arguments) async { + return await repository.getPaymentHistory(arguments.period); } } diff --git a/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_summary_usecase.dart b/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_summary_usecase.dart index 27b74290..b810454b 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_summary_usecase.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/domain/usecases/get_payment_summary_usecase.dart @@ -1,19 +1,16 @@ import 'package:krow_core/core.dart'; -import 'package:krow_domain/krow_domain.dart'; +import '../entities/payment_summary.dart'; import '../repositories/payments_repository.dart'; /// Use case to retrieve payment summary information. -/// -/// It fetches the full list of payments, which ideally should be aggregated -/// by the presentation layer or a specific data source method. -class GetPaymentSummaryUseCase extends NoInputUseCase> { +class GetPaymentSummaryUseCase extends NoInputUseCase { final PaymentsRepository repository; /// Creates a [GetPaymentSummaryUseCase]. GetPaymentSummaryUseCase(this.repository); @override - Future> call() async { - return await repository.getPayments(); + Future call() async { + return await repository.getPaymentSummary(); } } diff --git a/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_bloc.dart b/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_bloc.dart index 33887032..f2448175 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_bloc.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_bloc.dart @@ -1,9 +1,9 @@ import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:krow_domain/krow_domain.dart'; import '../../../domain/arguments/get_payment_history_arguments.dart'; -import '../../../domain/usecases/get_payment_summary_usecase.dart'; +import '../../../domain/entities/payment_summary.dart'; +import '../../../domain/entities/payment_transaction.dart'; import '../../../domain/usecases/get_payment_history_usecase.dart'; -import '../../models/payment_stats.dart'; +import '../../../domain/usecases/get_payment_summary_usecase.dart'; import 'payments_event.dart'; import 'payments_state.dart'; @@ -25,14 +25,13 @@ class PaymentsBloc extends Bloc { ) async { emit(PaymentsLoading()); try { - final List allPayments = await getPaymentSummary(); - final PaymentStats stats = _calculateStats(allPayments); + final PaymentSummary currentSummary = await getPaymentSummary(); - final List history = await getPaymentHistory( + final List history = await getPaymentHistory( const GetPaymentHistoryArguments('week'), ); emit(PaymentsLoaded( - summary: stats, + summary: currentSummary, history: history, activePeriod: 'week', )); @@ -48,7 +47,7 @@ class PaymentsBloc extends Bloc { final PaymentsState currentState = state; if (currentState is PaymentsLoaded) { try { - final List newHistory = await getPaymentHistory( + final List newHistory = await getPaymentHistory( GetPaymentHistoryArguments(event.period), ); emit(currentState.copyWith( @@ -60,38 +59,4 @@ class PaymentsBloc extends Bloc { } } } - - PaymentStats _calculateStats(List payments) { - double total = 0; - double pending = 0; - double weekly = 0; - double monthly = 0; - - final DateTime now = DateTime.now(); - - for (final StaffPayment p in payments) { - // Assuming all payments count towards total history - total += p.amount; - - if (p.status == PaymentStatus.pending) { - pending += p.amount; - } - - if (p.paidAt != null) { - if (now.difference(p.paidAt!).inDays < 7) { - weekly += p.amount; - } - if (now.month == p.paidAt!.month && now.year == p.paidAt!.year) { - monthly += p.amount; - } - } - } - - return PaymentStats( - totalEarnings: total, - pendingEarnings: pending, - weeklyEarnings: weekly, - monthlyEarnings: monthly, - ); - } } diff --git a/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_state.dart b/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_state.dart index 14e3af61..f3742ca3 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_state.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/presentation/blocs/payments/payments_state.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; -import 'package:krow_domain/krow_domain.dart'; -import '../../models/payment_stats.dart'; +import '../../../domain/entities/payment_summary.dart'; +import '../../../domain/entities/payment_transaction.dart'; abstract class PaymentsState extends Equatable { const PaymentsState(); @@ -14,8 +14,8 @@ class PaymentsInitial extends PaymentsState {} class PaymentsLoading extends PaymentsState {} class PaymentsLoaded extends PaymentsState { - final PaymentStats summary; - final List history; + final PaymentSummary summary; + final List history; final String activePeriod; const PaymentsLoaded({ @@ -25,8 +25,8 @@ class PaymentsLoaded extends PaymentsState { }); PaymentsLoaded copyWith({ - PaymentStats? summary, - List? history, + PaymentSummary? summary, + List? history, String? activePeriod, }) { return PaymentsLoaded( diff --git a/apps/mobile/packages/features/staff/payments/lib/src/presentation/pages/payments_page.dart b/apps/mobile/packages/features/staff/payments/lib/src/presentation/pages/payments_page.dart index d82f3588..188f8285 100644 --- a/apps/mobile/packages/features/staff/payments/lib/src/presentation/pages/payments_page.dart +++ b/apps/mobile/packages/features/staff/payments/lib/src/presentation/pages/payments_page.dart @@ -3,7 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:lucide_icons/lucide_icons.dart'; import 'package:intl/intl.dart'; -import 'package:krow_domain/krow_domain.dart'; +import '../../domain/entities/payment_transaction.dart'; import '../blocs/payments/payments_bloc.dart'; import '../blocs/payments/payments_event.dart'; import '../blocs/payments/payments_state.dart'; @@ -177,19 +177,19 @@ class _PaymentsPageState extends State { ), const SizedBox(height: 12), Column( - children: state.history.map((StaffPayment payment) { + children: state.history.map((PaymentTransaction payment) { return Padding( padding: const EdgeInsets.only(bottom: 8), child: PaymentHistoryItem( amount: payment.amount, - title: 'Assignment ${payment.assignmentId}', - location: 'Location', // TODO: Fetch from assignment - address: '', - date: payment.paidAt != null ? DateFormat('E, MMM d').format(payment.paidAt!) : 'Pending', - workedTime: '00:00 - 00:00', // TODO: Fetch from assignment - hours: 0, - rate: 0, - status: payment.status.toString().split('.').last, + title: payment.title, + location: payment.location, + address: payment.address, + date: DateFormat('E, MMM d').format(payment.date), + workedTime: payment.workedTime, + hours: payment.hours, + rate: payment.rate, + status: payment.status, ), ); }).toList(), diff --git a/apps/mobile/packages/features/staff/payments/pubspec.yaml b/apps/mobile/packages/features/staff/payments/pubspec.yaml index 5f3a2c18..35f7984b 100644 --- a/apps/mobile/packages/features/staff/payments/pubspec.yaml +++ b/apps/mobile/packages/features/staff/payments/pubspec.yaml @@ -30,4 +30,5 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.0 + flutter_lints: ^6.0.0 + \ No newline at end of file diff --git a/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/pubspec.yaml b/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/pubspec.yaml index f42071f2..e98a60a7 100644 --- a/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/pubspec.yaml +++ b/apps/mobile/packages/features/staff/profile_sections/compliance/certificates/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: flutter: diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/pubspec.yaml b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/pubspec.yaml index 4d6785ee..a8605f2a 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/pubspec.yaml +++ b/apps/mobile/packages/features/staff/profile_sections/finances/staff_bank_account/pubspec.yaml @@ -34,4 +34,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + flutter_lints: ^6.0.0 diff --git a/apps/mobile/packages/features/staff/profile_sections/finances/time_card/pubspec.yaml b/apps/mobile/packages/features/staff/profile_sections/finances/time_card/pubspec.yaml index d74dc6b2..311e8ca8 100644 --- a/apps/mobile/packages/features/staff/profile_sections/finances/time_card/pubspec.yaml +++ b/apps/mobile/packages/features/staff/profile_sections/finances/time_card/pubspec.yaml @@ -2,9 +2,10 @@ name: staff_time_card description: Staff Time Card Feature version: 0.0.1 publish_to: none +resolution: workspace environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' flutter: ">=3.0.0" dependencies: diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/attire/pubspec.yaml b/apps/mobile/packages/features/staff/profile_sections/onboarding/attire/pubspec.yaml index b87789a7..07a124c8 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/attire/pubspec.yaml +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/attire/pubspec.yaml @@ -31,4 +31,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + flutter_lints: ^6.0.0 diff --git a/apps/mobile/packages/features/staff/shifts/pubspec.yaml b/apps/mobile/packages/features/staff/shifts/pubspec.yaml index e10c7716..99360d7a 100644 --- a/apps/mobile/packages/features/staff/shifts/pubspec.yaml +++ b/apps/mobile/packages/features/staff/shifts/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: 'none' resolution: workspace environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' flutter: ">=3.0.0" dependencies: @@ -31,4 +31,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.0 + flutter_lints: ^6.0.0 diff --git a/apps/mobile/pubspec.lock b/apps/mobile/pubspec.lock index 9abb77a4..38ff23e3 100644 --- a/apps/mobile/pubspec.lock +++ b/apps/mobile/pubspec.lock @@ -65,13 +65,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - billing: - dependency: transitive - description: - path: "packages/features/client/billing" - relative: true - source: path - version: "1.0.0+1" bloc: dependency: transitive description: @@ -192,13 +185,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.2" - client_coverage: - dependency: transitive - description: - path: "packages/features/client/client_coverage" - relative: true - source: path - version: "1.0.0" clock: dependency: transitive description: @@ -1120,13 +1106,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.1" - staff_attire: - dependency: transitive - description: - path: "packages/features/staff/profile_sections/onboarding/attire" - relative: true - source: path - version: "0.0.1" staff_availability: dependency: transitive description: @@ -1134,20 +1113,6 @@ packages: relative: true source: path version: "0.0.1" - staff_bank_account: - dependency: transitive - description: - path: "packages/features/staff/profile_sections/finances/staff_bank_account" - relative: true - source: path - version: "0.0.1" - staff_certificates: - dependency: transitive - description: - path: "packages/features/staff/profile_sections/compliance/certificates" - relative: true - source: path - version: "0.0.1" staff_clock_in: dependency: transitive description: @@ -1155,41 +1120,6 @@ packages: relative: true source: path version: "0.0.1" - staff_documents: - dependency: transitive - description: - path: "packages/features/staff/profile_sections/compliance/documents" - relative: true - source: path - version: "0.0.1" - staff_payments: - dependency: transitive - description: - path: "packages/features/staff/payments" - relative: true - source: path - version: "0.0.1" - staff_shifts: - dependency: transitive - description: - path: "packages/features/staff/shifts" - relative: true - source: path - version: "0.0.1" - staff_tax_forms: - dependency: transitive - description: - path: "packages/features/staff/profile_sections/compliance/tax_forms" - relative: true - source: path - version: "0.0.1" - staff_time_card: - dependency: transitive - description: - path: "packages/features/staff/profile_sections/finances/time_card" - relative: true - source: path - version: "0.0.1" stream_channel: dependency: transitive description: diff --git a/apps/mobile/pubspec.yaml b/apps/mobile/pubspec.yaml index 0d3eba1a..dca6a804 100644 --- a/apps/mobile/pubspec.yaml +++ b/apps/mobile/pubspec.yaml @@ -12,16 +12,26 @@ workspace: - packages/features/staff/authentication - packages/features/staff/home - packages/features/staff/staff_main + - packages/features/staff/payments - packages/features/staff/profile - packages/features/staff/profile_sections/onboarding/emergency_contact - packages/features/staff/profile_sections/onboarding/experience - packages/features/staff/profile_sections/onboarding/profile_info + - packages/features/staff/profile_sections/onboarding/attire + - packages/features/staff/profile_sections/finances/staff_bank_account + - packages/features/staff/profile_sections/finances/time_card + - packages/features/staff/profile_sections/compliance/certificates + - packages/features/staff/profile_sections/compliance/documents + - packages/features/staff/profile_sections/compliance/tax_forms + - packages/features/staff/shifts - packages/features/client/authentication + - packages/features/client/billing - packages/features/client/home - packages/features/client/settings - packages/features/client/hubs - packages/features/client/create_order - packages/features/client/view_orders + - packages/features/client/client_coverage - packages/features/client/client_main - apps/staff - apps/client