diff --git a/apps/mobile/packages/design_system/lib/src/ui_typography.dart b/apps/mobile/packages/design_system/lib/src/ui_typography.dart index b2224b11..b12fd24a 100644 --- a/apps/mobile/packages/design_system/lib/src/ui_typography.dart +++ b/apps/mobile/packages/design_system/lib/src/ui_typography.dart @@ -221,6 +221,14 @@ class UiTypography { color: UiColors.textPrimary, ); + /// Headline 4 Bold - Font: Instrument Sans, Size: 20, Height: 1.5 (#121826) + static final TextStyle headline4b = _primaryBase.copyWith( + fontWeight: FontWeight.w600, + fontSize: 18, + height: 1.5, + color: UiColors.textPrimary, + ); + /// Headline 5 Regular - Font: Instrument Sans, Size: 18, Height: 1.5 (#121826) static final TextStyle headline5r = _primaryBase.copyWith( fontWeight: FontWeight.w400, diff --git a/apps/mobile/packages/design_system/lib/src/widgets/ui_app_bar.dart b/apps/mobile/packages/design_system/lib/src/widgets/ui_app_bar.dart index b6a70e3e..77bb91b6 100644 --- a/apps/mobile/packages/design_system/lib/src/widgets/ui_app_bar.dart +++ b/apps/mobile/packages/design_system/lib/src/widgets/ui_app_bar.dart @@ -1,3 +1,4 @@ +import 'package:design_system/src/ui_typography.dart'; import 'package:flutter/material.dart'; import '../ui_icons.dart'; @@ -14,7 +15,7 @@ class UiAppBar extends StatelessWidget implements PreferredSizeWidget { this.leading, this.actions, this.height = kToolbarHeight, - this.centerTitle = true, + this.centerTitle = false, this.onLeadingPressed, this.showBackButton = true, this.bottom, @@ -56,6 +57,7 @@ class UiAppBar extends StatelessWidget implements PreferredSizeWidget { (title != null ? Text( title!, + style: UiTypography.headline4b, ) : null), leading: leading ?? diff --git a/apps/mobile/packages/features/client/create_order/lib/src/create_order_module.dart b/apps/mobile/packages/features/client/create_order/lib/src/create_order_module.dart index a99521d6..09416ced 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/create_order_module.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/create_order_module.dart @@ -8,12 +8,7 @@ import 'domain/usecases/create_one_time_order_usecase.dart'; import 'domain/usecases/create_permanent_order_usecase.dart'; import 'domain/usecases/create_recurring_order_usecase.dart'; import 'domain/usecases/create_rapid_order_usecase.dart'; -import 'domain/usecases/get_order_types_usecase.dart'; -import 'presentation/blocs/client_create_order_bloc.dart'; -import 'presentation/blocs/one_time_order_bloc.dart'; -import 'presentation/blocs/permanent_order_bloc.dart'; -import 'presentation/blocs/recurring_order_bloc.dart'; -import 'presentation/blocs/rapid_order_bloc.dart'; +import 'presentation/blocs/index.dart'; import 'presentation/pages/create_order_page.dart'; import 'presentation/pages/one_time_order_page.dart'; import 'presentation/pages/permanent_order_page.dart'; @@ -35,14 +30,12 @@ class ClientCreateOrderModule extends Module { i.addLazySingleton(ClientCreateOrderRepositoryImpl.new); // UseCases - i.addLazySingleton(GetOrderTypesUseCase.new); i.addLazySingleton(CreateOneTimeOrderUseCase.new); i.addLazySingleton(CreatePermanentOrderUseCase.new); i.addLazySingleton(CreateRecurringOrderUseCase.new); i.addLazySingleton(CreateRapidOrderUseCase.new); // BLoCs - i.add(ClientCreateOrderBloc.new); i.add(RapidOrderBloc.new); i.add(OneTimeOrderBloc.new); i.add(PermanentOrderBloc.new); diff --git a/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart b/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart index 221a07a3..18212431 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart @@ -18,39 +18,6 @@ class ClientCreateOrderRepositoryImpl implements ClientCreateOrderRepositoryInte final dc.DataConnectService _service; - @override - Future> getOrderTypes() { - return Future>.value(const [ - domain.OrderType( - id: 'one-time', - titleKey: 'client_create_order.types.one_time', - descriptionKey: 'client_create_order.types.one_time_desc', - ), - - /// TODO: FEATURE_NOT_YET_IMPLEMENTED - // domain.OrderType( - // id: 'rapid', - // titleKey: 'client_create_order.types.rapid', - // descriptionKey: 'client_create_order.types.rapid_desc', - // ), - domain.OrderType( - id: 'recurring', - titleKey: 'client_create_order.types.recurring', - descriptionKey: 'client_create_order.types.recurring_desc', - ), - // domain.OrderType( - // id: 'permanent', - // titleKey: 'client_create_order.types.permanent', - // descriptionKey: 'client_create_order.types.permanent_desc', - // ), - domain.OrderType( - id: 'permanent', - titleKey: 'client_create_order.types.permanent', - descriptionKey: 'client_create_order.types.permanent_desc', - ), - ]); - } - @override Future createOneTimeOrder(domain.OneTimeOrder order) async { return _service.run(() async { diff --git a/apps/mobile/packages/features/client/create_order/lib/src/domain/repositories/client_create_order_repository_interface.dart b/apps/mobile/packages/features/client/create_order/lib/src/domain/repositories/client_create_order_repository_interface.dart index d7eed014..3605ad41 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/domain/repositories/client_create_order_repository_interface.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/domain/repositories/client_create_order_repository_interface.dart @@ -3,15 +3,11 @@ import 'package:krow_domain/krow_domain.dart'; /// Interface for the Client Create Order repository. /// /// This repository is responsible for: -/// 1. Retrieving available order types for the client. -/// 2. Submitting different types of staffing orders (Rapid, One-Time). +/// 1. Submitting different types of staffing orders (Rapid, One-Time, Recurring, Permanent). /// /// It follows the KROW Clean Architecture by defining the contract in the /// domain layer, to be implemented in the data layer. abstract interface class ClientCreateOrderRepositoryInterface { - /// Retrieves the list of available order types (e.g., Rapid, One-Time, Recurring). - Future> getOrderTypes(); - /// Submits a one-time staffing order with specific details. /// /// [order] contains the date, location, and required positions. diff --git a/apps/mobile/packages/features/client/create_order/lib/src/domain/usecases/get_order_types_usecase.dart b/apps/mobile/packages/features/client/create_order/lib/src/domain/usecases/get_order_types_usecase.dart deleted file mode 100644 index 7fb0cc5a..00000000 --- a/apps/mobile/packages/features/client/create_order/lib/src/domain/usecases/get_order_types_usecase.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:krow_core/core.dart'; -import 'package:krow_domain/krow_domain.dart'; -import '../repositories/client_create_order_repository_interface.dart'; - -/// Use case for retrieving the available order types for a client. -/// -/// This use case fetches the list of supported staffing order types -/// from the [ClientCreateOrderRepositoryInterface]. -class GetOrderTypesUseCase implements NoInputUseCase> { - /// Creates a [GetOrderTypesUseCase]. - /// - /// Requires a [ClientCreateOrderRepositoryInterface] to interact with the data layer. - const GetOrderTypesUseCase(this._repository); - final ClientCreateOrderRepositoryInterface _repository; - - @override - Future> call() { - return _repository.getOrderTypes(); - } -} diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_bloc.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_bloc.dart deleted file mode 100644 index f414d6f4..00000000 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_bloc.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:krow_core/core.dart'; -import 'package:krow_domain/krow_domain.dart'; -import '../../domain/usecases/get_order_types_usecase.dart'; -import 'client_create_order_event.dart'; -import 'client_create_order_state.dart'; - -/// BLoC for managing the list of available order types. -class ClientCreateOrderBloc - extends Bloc - with BlocErrorHandler { - ClientCreateOrderBloc(this._getOrderTypesUseCase) - : super(const ClientCreateOrderInitial()) { - on(_onTypesRequested); - } - final GetOrderTypesUseCase _getOrderTypesUseCase; - - Future _onTypesRequested( - ClientCreateOrderTypesRequested event, - Emitter emit, - ) async { - await handleError( - emit: emit.call, - action: () async { - final List types = await _getOrderTypesUseCase(); - emit(ClientCreateOrderLoadSuccess(types)); - }, - onError: (String errorKey) => ClientCreateOrderLoadFailure(errorKey), - ); - } -} - diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_event.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_event.dart deleted file mode 100644 index a3328da4..00000000 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_event.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:equatable/equatable.dart'; - -abstract class ClientCreateOrderEvent extends Equatable { - const ClientCreateOrderEvent(); - - @override - List get props => []; -} - -class ClientCreateOrderTypesRequested extends ClientCreateOrderEvent { - const ClientCreateOrderTypesRequested(); -} - -class ClientCreateOrderTypeSelected extends ClientCreateOrderEvent { - const ClientCreateOrderTypeSelected(this.typeId); - final String typeId; - - @override - List get props => [typeId]; -} diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_state.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_state.dart deleted file mode 100644 index 8def2d1b..00000000 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/client_create_order_state.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:krow_domain/krow_domain.dart'; - -/// Base state for the [ClientCreateOrderBloc]. -abstract class ClientCreateOrderState extends Equatable { - const ClientCreateOrderState(); - - @override - List get props => []; -} - -/// Initial state when order types haven't been loaded yet. -class ClientCreateOrderInitial extends ClientCreateOrderState { - const ClientCreateOrderInitial(); -} - -/// State representing successfully loaded order types from the repository. -class ClientCreateOrderLoadSuccess extends ClientCreateOrderState { - const ClientCreateOrderLoadSuccess(this.orderTypes); - - /// The list of available order types retrieved from the domain. - final List orderTypes; - - @override - List get props => [orderTypes]; -} - -/// State representing a failure to load order types. -class ClientCreateOrderLoadFailure extends ClientCreateOrderState { - const ClientCreateOrderLoadFailure(this.error); - - final String error; - - @override - List get props => [error]; -} diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/index.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/index.dart new file mode 100644 index 00000000..36ed5304 --- /dev/null +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/index.dart @@ -0,0 +1,4 @@ +export 'one_time_order/index.dart'; +export 'rapid_order/index.dart'; +export 'recurring_order/index.dart'; +export 'permanent_order/index.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/index.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/index.dart new file mode 100644 index 00000000..c096a4c2 --- /dev/null +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/index.dart @@ -0,0 +1,3 @@ +export 'one_time_order_bloc.dart'; +export 'one_time_order_event.dart'; +export 'one_time_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_bloc.dart similarity index 97% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_bloc.dart index 6d1b9bfd..977e7823 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_bloc.dart @@ -1,10 +1,11 @@ +import 'package:client_create_order/src/domain/arguments/one_time_order_arguments.dart'; +import 'package:client_create_order/src/domain/usecases/create_one_time_order_usecase.dart'; import 'package:firebase_data_connect/firebase_data_connect.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_core/core.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart'; -import '../../domain/arguments/one_time_order_arguments.dart'; -import '../../domain/usecases/create_one_time_order_usecase.dart'; + import 'one_time_order_event.dart'; import 'one_time_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_event.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_event.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_event.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_event.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_state.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_state.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_state.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order/one_time_order_state.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/index.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/index.dart new file mode 100644 index 00000000..afc5e109 --- /dev/null +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/index.dart @@ -0,0 +1,3 @@ +export 'permanent_order_bloc.dart'; +export 'permanent_order_event.dart'; +export 'permanent_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_bloc.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_bloc.dart similarity index 99% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_bloc.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_bloc.dart index 1cd2b4f1..fbaaf3a9 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_bloc.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_bloc.dart @@ -1,9 +1,10 @@ +import 'package:client_create_order/src/domain/usecases/create_permanent_order_usecase.dart'; import 'package:firebase_data_connect/firebase_data_connect.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_core/core.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart' as domain; -import '../../domain/usecases/create_permanent_order_usecase.dart'; + import 'permanent_order_event.dart'; import 'permanent_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_event.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_event.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_event.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_event.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_state.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_state.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order_state.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/permanent_order/permanent_order_state.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/index.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/index.dart new file mode 100644 index 00000000..34b84929 --- /dev/null +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/index.dart @@ -0,0 +1,3 @@ +export 'rapid_order_bloc.dart'; +export 'rapid_order_event.dart'; +export 'rapid_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_bloc.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_bloc.dart similarity index 94% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_bloc.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_bloc.dart index 626b612e..b9fdedf5 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_bloc.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_bloc.dart @@ -1,7 +1,8 @@ +import 'package:client_create_order/src/domain/arguments/rapid_order_arguments.dart'; +import 'package:client_create_order/src/domain/usecases/create_rapid_order_usecase.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_core/core.dart'; -import '../../domain/arguments/rapid_order_arguments.dart'; -import '../../domain/usecases/create_rapid_order_usecase.dart'; + import 'rapid_order_event.dart'; import 'rapid_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_event.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_event.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_event.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_event.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_state.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_state.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order_state.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/rapid_order/rapid_order_state.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/index.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/index.dart new file mode 100644 index 00000000..cfcc77f5 --- /dev/null +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/index.dart @@ -0,0 +1,3 @@ +export 'recurring_order_bloc.dart'; +export 'recurring_order_event.dart'; +export 'recurring_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_bloc.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_bloc.dart similarity index 99% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_bloc.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_bloc.dart index fdc13713..e1f1f6c0 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_bloc.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_bloc.dart @@ -1,9 +1,10 @@ +import 'package:client_create_order/src/domain/usecases/create_recurring_order_usecase.dart'; import 'package:firebase_data_connect/firebase_data_connect.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_core/core.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart' as domain; -import '../../domain/usecases/create_recurring_order_usecase.dart'; + import 'recurring_order_event.dart'; import 'recurring_order_state.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_event.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_event.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_event.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_event.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_state.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_state.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order_state.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/recurring_order/recurring_order_state.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/create_order_page.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/create_order_page.dart index 641363e2..7bc1f023 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/create_order_page.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/create_order_page.dart @@ -1,26 +1,18 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_modular/flutter_modular.dart'; -import '../blocs/client_create_order_bloc.dart'; -import '../blocs/client_create_order_event.dart'; + import '../widgets/create_order/create_order_view.dart'; /// Main entry page for the client create order flow. /// -/// This page initializes the [ClientCreateOrderBloc] and displays the [CreateOrderView]. +/// This page displays the [CreateOrderView]. /// It follows the Krow Clean Architecture by being a [StatelessWidget] and -/// delegating its state and UI to other components. +/// delegating its UI to other components. class ClientCreateOrderPage extends StatelessWidget { /// Creates a [ClientCreateOrderPage]. const ClientCreateOrderPage({super.key}); @override Widget build(BuildContext context) { - return BlocProvider( - create: (BuildContext context) => - Modular.get() - ..add(const ClientCreateOrderTypesRequested()), - child: const CreateOrderView(), - ); + return const CreateOrderView(); } } diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/one_time_order_page.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/one_time_order_page.dart index a5c6202f..32d381a5 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/one_time_order_page.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/one_time_order_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; -import '../blocs/one_time_order_bloc.dart'; +import '../blocs/one_time_order/one_time_order_bloc.dart'; import '../widgets/one_time_order/one_time_order_view.dart'; /// Page for creating a one-time staffing order. diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/permanent_order_page.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/permanent_order_page.dart index cdcc26e3..3a16fc93 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/permanent_order_page.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/permanent_order_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; -import '../blocs/permanent_order_bloc.dart'; +import '../blocs/permanent_order/permanent_order_bloc.dart'; import '../widgets/permanent_order/permanent_order_view.dart'; /// Page for creating a permanent staffing order. diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/rapid_order_page.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/rapid_order_page.dart index 2bb444cf..46ea23f8 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/rapid_order_page.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/rapid_order_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; -import '../blocs/rapid_order_bloc.dart'; +import '../blocs/rapid_order/rapid_order_bloc.dart'; import '../widgets/rapid_order/rapid_order_view.dart'; /// Rapid Order Flow Page - Emergency staffing requests. diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/recurring_order_page.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/recurring_order_page.dart index 009c4d64..728f0ce3 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/recurring_order_page.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/pages/recurring_order_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; -import '../blocs/recurring_order_bloc.dart'; +import '../blocs/recurring_order/recurring_order_bloc.dart'; import '../widgets/recurring_order/recurring_order_view.dart'; /// Page for creating a recurring staffing order. diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/utils/order_types.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/utils/order_types.dart new file mode 100644 index 00000000..e1f7562c --- /dev/null +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/utils/order_types.dart @@ -0,0 +1,32 @@ +import 'package:krow_domain/krow_domain.dart' as domain; + +/// Order type constants for the create order feature +final List orderTypes = const [ + domain.OrderType( + id: 'one-time', + titleKey: 'client_create_order.types.one_time', + descriptionKey: 'client_create_order.types.one_time_desc', + ), + + /// TODO: FEATURE_NOT_YET_IMPLEMENTED + // domain.OrderType( + // id: 'rapid', + // titleKey: 'client_create_order.types.rapid', + // descriptionKey: 'client_create_order.types.rapid_desc', + // ), + domain.OrderType( + id: 'recurring', + titleKey: 'client_create_order.types.recurring', + descriptionKey: 'client_create_order.types.recurring_desc', + ), + // domain.OrderType( + // id: 'permanent', + // titleKey: 'client_create_order.types.permanent', + // descriptionKey: 'client_create_order.types.permanent_desc', + // ), + domain.OrderType( + id: 'permanent', + titleKey: 'client_create_order.types.permanent', + descriptionKey: 'client_create_order.types.permanent_desc', + ), +]; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/ui_entities/order_type_ui_metadata.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/utils/ui_entities/order_type_ui_metadata.dart similarity index 100% rename from apps/mobile/packages/features/client/create_order/lib/src/presentation/ui_entities/order_type_ui_metadata.dart rename to apps/mobile/packages/features/client/create_order/lib/src/presentation/utils/ui_entities/order_type_ui_metadata.dart diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/create_order/create_order_view.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/create_order/create_order_view.dart index 43c83549..505276cf 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/create_order/create_order_view.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/create_order/create_order_view.dart @@ -1,13 +1,11 @@ import 'package:core_localization/core_localization.dart'; 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_core/core.dart'; import 'package:krow_domain/krow_domain.dart'; -import '../../blocs/client_create_order_bloc.dart'; -import '../../blocs/client_create_order_state.dart'; -import '../../ui_entities/order_type_ui_metadata.dart'; +import '../../utils/order_types.dart'; +import '../../utils/ui_entities/order_type_ui_metadata.dart'; import '../order_type_card.dart'; /// Helper to map keys to localized strings. @@ -64,58 +62,50 @@ class CreateOrderView extends StatelessWidget { ), ), Expanded( - child: BlocBuilder( - builder: - (BuildContext context, ClientCreateOrderState state) { - if (state is ClientCreateOrderLoadSuccess) { - return GridView.builder( - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - mainAxisSpacing: UiConstants.space4, - crossAxisSpacing: UiConstants.space4, - childAspectRatio: 1, - ), - itemCount: state.orderTypes.length, - itemBuilder: (BuildContext context, int index) { - final OrderType type = state.orderTypes[index]; - final OrderTypeUiMetadata ui = - OrderTypeUiMetadata.fromId(id: type.id); + child: GridView.builder( + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + mainAxisSpacing: UiConstants.space4, + crossAxisSpacing: UiConstants.space4, + childAspectRatio: 1, + ), + itemCount: orderTypes.length, + itemBuilder: (BuildContext context, int index) { + final OrderType type = orderTypes[index]; + final OrderTypeUiMetadata ui = + OrderTypeUiMetadata.fromId(id: type.id); - return OrderTypeCard( - icon: ui.icon, - title: _getTranslation(key: type.titleKey), - description: _getTranslation( - key: type.descriptionKey, - ), - backgroundColor: ui.backgroundColor, - borderColor: ui.borderColor, - iconBackgroundColor: ui.iconBackgroundColor, - iconColor: ui.iconColor, - textColor: ui.textColor, - descriptionColor: ui.descriptionColor, - onTap: () { - switch (type.id) { - case 'rapid': - Modular.to.toCreateOrderRapid(); - break; - case 'one-time': - Modular.to.toCreateOrderOneTime(); - break; - case 'recurring': - Modular.to.toCreateOrderRecurring(); - break; - case 'permanent': - Modular.to.toCreateOrderPermanent(); - break; - } - }, - ); - }, - ); + return OrderTypeCard( + icon: ui.icon, + title: _getTranslation(key: type.titleKey), + description: _getTranslation( + key: type.descriptionKey, + ), + backgroundColor: ui.backgroundColor, + borderColor: ui.borderColor, + iconBackgroundColor: ui.iconBackgroundColor, + iconColor: ui.iconColor, + textColor: ui.textColor, + descriptionColor: ui.descriptionColor, + onTap: () { + switch (type.id) { + case 'rapid': + Modular.to.toCreateOrderRapid(); + break; + case 'one-time': + Modular.to.toCreateOrderOneTime(); + break; + case 'recurring': + Modular.to.toCreateOrderRecurring(); + break; + case 'permanent': + Modular.to.toCreateOrderPermanent(); + break; } - return const Center(child: CircularProgressIndicator()); }, + ); + }, ), ), ], @@ -124,4 +114,4 @@ class CreateOrderView extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart index babb3e06..7794a356 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart @@ -2,7 +2,7 @@ import 'package:core_localization/core_localization.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:krow_domain/krow_domain.dart'; -import '../../blocs/one_time_order_state.dart'; +import '../../blocs/one_time_order/one_time_order_state.dart'; /// A card widget for editing a specific position in a one-time order. /// Matches the prototype layout while using design system tokens. diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_view.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_view.dart index 3ca59a98..a55f4147 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_view.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_view.dart @@ -5,9 +5,9 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_core/core.dart'; import 'package:krow_domain/krow_domain.dart'; -import '../../blocs/one_time_order_bloc.dart'; -import '../../blocs/one_time_order_event.dart'; -import '../../blocs/one_time_order_state.dart'; +import '../../blocs/one_time_order/one_time_order_bloc.dart'; +import '../../blocs/one_time_order/one_time_order_event.dart'; +import '../../blocs/one_time_order/one_time_order_state.dart'; import 'one_time_order_date_picker.dart'; import 'one_time_order_event_name_input.dart'; import 'one_time_order_header.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_position_card.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_position_card.dart index eea6cb1a..e3fb7404 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_position_card.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_position_card.dart @@ -1,7 +1,7 @@ import 'package:core_localization/core_localization.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; -import '../../blocs/permanent_order_state.dart'; +import '../../blocs/permanent_order/permanent_order_state.dart'; /// A card widget for editing a specific position in a permanent order. class PermanentOrderPositionCard extends StatelessWidget { diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_view.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_view.dart index c5041687..538ac7e7 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_view.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/permanent_order/permanent_order_view.dart @@ -5,9 +5,9 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_core/core.dart'; import 'package:krow_domain/krow_domain.dart' show Vendor; -import '../../blocs/permanent_order_bloc.dart'; -import '../../blocs/permanent_order_event.dart'; -import '../../blocs/permanent_order_state.dart'; +import '../../blocs/permanent_order/permanent_order_bloc.dart'; +import '../../blocs/permanent_order/permanent_order_event.dart'; +import '../../blocs/permanent_order/permanent_order_state.dart'; import 'permanent_order_date_picker.dart'; import 'permanent_order_event_name_input.dart'; import 'permanent_order_header.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/rapid_order/rapid_order_view.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/rapid_order/rapid_order_view.dart index da6a5df4..3c51d7cb 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/rapid_order/rapid_order_view.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/rapid_order/rapid_order_view.dart @@ -5,9 +5,9 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:intl/intl.dart'; import 'package:krow_core/core.dart'; -import '../../blocs/rapid_order_bloc.dart'; -import '../../blocs/rapid_order_event.dart'; -import '../../blocs/rapid_order_state.dart'; +import '../../blocs/rapid_order/rapid_order_bloc.dart'; +import '../../blocs/rapid_order/rapid_order_event.dart'; +import '../../blocs/rapid_order/rapid_order_state.dart'; import 'rapid_order_example_card.dart'; import 'rapid_order_header.dart'; import 'rapid_order_success_view.dart'; diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_position_card.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_position_card.dart index f6b94670..a52be4b4 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_position_card.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_position_card.dart @@ -1,7 +1,7 @@ import 'package:core_localization/core_localization.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; -import '../../blocs/recurring_order_state.dart'; +import '../../blocs/recurring_order/recurring_order_state.dart'; /// A card widget for editing a specific position in a recurring order. class RecurringOrderPositionCard extends StatelessWidget { diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_view.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_view.dart index a6f173c8..3265e800 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_view.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/recurring_order/recurring_order_view.dart @@ -5,9 +5,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_core/core.dart'; -import '../../blocs/recurring_order_bloc.dart'; -import '../../blocs/recurring_order_event.dart'; -import '../../blocs/recurring_order_state.dart'; +import '../../blocs/recurring_order/recurring_order_bloc.dart'; +import '../../blocs/recurring_order/recurring_order_event.dart'; +import '../../blocs/recurring_order/recurring_order_state.dart'; import 'recurring_order_date_picker.dart'; import 'recurring_order_event_name_input.dart'; import 'recurring_order_header.dart';