refactor: remove OrderType entity and update order types to use UiOrderType
This commit is contained in:
@@ -34,7 +34,6 @@ export 'src/entities/shifts/break/break.dart';
|
||||
export 'src/adapters/shifts/break/break_adapter.dart';
|
||||
|
||||
// Orders & Requests
|
||||
export 'src/entities/orders/order_type.dart';
|
||||
export 'src/entities/orders/one_time_order.dart';
|
||||
export 'src/entities/orders/one_time_order_position.dart';
|
||||
export 'src/entities/orders/recurring_order.dart';
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a type of order that can be created (e.g., Rapid, One-Time).
|
||||
///
|
||||
/// This entity defines the identity and display metadata (keys) for the order type.
|
||||
/// UI-specific properties like colors and icons are handled by the presentation layer.
|
||||
class OrderType extends Equatable {
|
||||
|
||||
const OrderType({
|
||||
required this.id,
|
||||
required this.titleKey,
|
||||
required this.descriptionKey,
|
||||
});
|
||||
/// Unique identifier for the order type.
|
||||
final String id;
|
||||
|
||||
/// Translation key for the title.
|
||||
final String titleKey;
|
||||
|
||||
/// Translation key for the description.
|
||||
final String descriptionKey;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[id, titleKey, descriptionKey];
|
||||
}
|
||||
@@ -1,25 +1,35 @@
|
||||
import 'package:krow_domain/krow_domain.dart' as domain;
|
||||
class UiOrderType {
|
||||
const UiOrderType({
|
||||
required this.id,
|
||||
required this.titleKey,
|
||||
required this.descriptionKey,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String titleKey;
|
||||
final String descriptionKey;
|
||||
}
|
||||
|
||||
/// Order type constants for the create order feature
|
||||
const List<domain.OrderType> orderTypes = <domain.OrderType>[
|
||||
const List<UiOrderType> orderTypes = <UiOrderType>[
|
||||
/// TODO: FEATURE_NOT_YET_IMPLEMENTED
|
||||
// domain.OrderType(
|
||||
// UiOrderType(
|
||||
// id: 'rapid',
|
||||
// titleKey: 'client_create_order.types.rapid',
|
||||
// descriptionKey: 'client_create_order.types.rapid_desc',
|
||||
// ),
|
||||
domain.OrderType(
|
||||
UiOrderType(
|
||||
id: 'one-time',
|
||||
titleKey: 'client_create_order.types.one_time',
|
||||
descriptionKey: 'client_create_order.types.one_time_desc',
|
||||
),
|
||||
|
||||
domain.OrderType(
|
||||
UiOrderType(
|
||||
id: 'recurring',
|
||||
titleKey: 'client_create_order.types.recurring',
|
||||
descriptionKey: 'client_create_order.types.recurring_desc',
|
||||
),
|
||||
domain.OrderType(
|
||||
UiOrderType(
|
||||
id: 'permanent',
|
||||
titleKey: 'client_create_order.types.permanent',
|
||||
descriptionKey: 'client_create_order.types.permanent_desc',
|
||||
|
||||
@@ -68,7 +68,7 @@ class CreateOrderView extends StatelessWidget {
|
||||
),
|
||||
itemCount: orderTypes.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final OrderType type = orderTypes[index];
|
||||
final UiOrderType type = orderTypes[index];
|
||||
final OrderTypeUiMetadata ui = OrderTypeUiMetadata.fromId(
|
||||
id: type.id,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:firebase_data_connect/firebase_data_connect.dart' as fdc;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
import 'package:krow_domain/krow_domain.dart' as domain;
|
||||
@@ -31,7 +32,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
end: endTimestamp,
|
||||
)
|
||||
.execute();
|
||||
print(
|
||||
debugPrint(
|
||||
'ViewOrders range start=${start.toIso8601String()} end=${end.toIso8601String()} shiftRoles=${result.data.shiftRoles.length}',
|
||||
);
|
||||
|
||||
@@ -51,7 +52,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
|
||||
// final String status = filled >= workersNeeded ? 'filled' : 'open';
|
||||
final String status = shiftRole.shift.status?.stringValue ?? 'OPEN';
|
||||
|
||||
print(
|
||||
debugPrint(
|
||||
'ViewOrders item: date=$dateStr status=$status shiftId=${shiftRole.shiftId} '
|
||||
'roleId=${shiftRole.roleId} start=${shiftRole.startTime?.toJson()} '
|
||||
'end=${shiftRole.endTime?.toJson()} hours=$hours totalValue=$totalValue',
|
||||
|
||||
Reference in New Issue
Block a user