first version of recurring order

This commit is contained in:
José Salazar
2026-02-17 16:24:59 -05:00
parent 7c85eb44e5
commit 85c8a09d9e
22 changed files with 2068 additions and 38 deletions

View File

@@ -37,6 +37,8 @@ export 'src/adapters/shifts/break/break_adapter.dart';
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';
export 'src/entities/orders/recurring_order_position.dart';
export 'src/entities/orders/order_item.dart';
// Skills & Certs

View File

@@ -0,0 +1,101 @@
import 'package:equatable/equatable.dart';
import 'recurring_order_position.dart';
/// Represents a recurring staffing request spanning a date range.
class RecurringOrder extends Equatable {
const RecurringOrder({
required this.startDate,
required this.endDate,
required this.recurringDays,
required this.location,
required this.positions,
this.hub,
this.eventName,
this.vendorId,
this.roleRates = const <String, double>{},
});
/// Start date for the recurring schedule.
final DateTime startDate;
/// End date for the recurring schedule.
final DateTime endDate;
/// Days of the week to repeat on (e.g., ["S", "M", ...]).
final List<String> recurringDays;
/// The primary location where the work will take place.
final String location;
/// The list of positions and headcounts required for this order.
final List<RecurringOrderPosition> positions;
/// Selected hub details for this order.
final RecurringOrderHubDetails? hub;
/// Optional order name.
final String? eventName;
/// Selected vendor id for this order.
final String? vendorId;
/// Role hourly rates keyed by role id.
final Map<String, double> roleRates;
@override
List<Object?> get props => <Object?>[
startDate,
endDate,
recurringDays,
location,
positions,
hub,
eventName,
vendorId,
roleRates,
];
}
/// Minimal hub details used during recurring order creation.
class RecurringOrderHubDetails extends Equatable {
const RecurringOrderHubDetails({
required this.id,
required this.name,
required this.address,
this.placeId,
this.latitude,
this.longitude,
this.city,
this.state,
this.street,
this.country,
this.zipCode,
});
final String id;
final String name;
final String address;
final String? placeId;
final double? latitude;
final double? longitude;
final String? city;
final String? state;
final String? street;
final String? country;
final String? zipCode;
@override
List<Object?> get props => <Object?>[
id,
name,
address,
placeId,
latitude,
longitude,
city,
state,
street,
country,
zipCode,
];
}

View File

@@ -0,0 +1,60 @@
import 'package:equatable/equatable.dart';
/// Represents a specific position requirement within a [RecurringOrder].
class RecurringOrderPosition extends Equatable {
const RecurringOrderPosition({
required this.role,
required this.count,
required this.startTime,
required this.endTime,
this.lunchBreak = 'NO_BREAK',
this.location,
});
/// The job role or title required.
final String role;
/// The number of workers required for this position.
final int count;
/// The scheduled start time (e.g., "09:00 AM").
final String startTime;
/// The scheduled end time (e.g., "05:00 PM").
final String endTime;
/// The break duration enum value (e.g., NO_BREAK, MIN_15, MIN_30).
final String lunchBreak;
/// Optional specific location for this position, if different from the order's main location.
final String? location;
@override
List<Object?> get props => <Object?>[
role,
count,
startTime,
endTime,
lunchBreak,
location,
];
/// Creates a copy of this position with the given fields replaced.
RecurringOrderPosition copyWith({
String? role,
int? count,
String? startTime,
String? endTime,
String? lunchBreak,
String? location,
}) {
return RecurringOrderPosition(
role: role ?? this.role,
count: count ?? this.count,
startTime: startTime ?? this.startTime,
endTime: endTime ?? this.endTime,
lunchBreak: lunchBreak ?? this.lunchBreak,
location: location ?? this.location,
);
}
}