permanent order v1

This commit is contained in:
José Salazar
2026-02-17 18:59:31 -05:00
parent 9fb138c4ee
commit 75e534620d
21 changed files with 2095 additions and 31 deletions

View File

@@ -39,6 +39,8 @@ 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/permanent_order.dart';
export 'src/entities/orders/permanent_order_position.dart';
export 'src/entities/orders/order_item.dart';
// Skills & Certs

View File

@@ -0,0 +1,96 @@
import 'package:equatable/equatable.dart';
import 'permanent_order_position.dart';
/// Represents a permanent staffing request spanning a date range.
class PermanentOrder extends Equatable {
const PermanentOrder({
required this.startDate,
required this.permanentDays,
required this.location,
required this.positions,
this.hub,
this.eventName,
this.vendorId,
this.roleRates = const <String, double>{},
});
/// Start date for the permanent schedule.
final DateTime startDate;
/// Days of the week to repeat on (e.g., ["SUN", "MON", ...]).
final List<String> permanentDays;
/// The primary location where the work will take place.
final String location;
/// The list of positions and headcounts required for this order.
final List<PermanentOrderPosition> positions;
/// Selected hub details for this order.
final PermanentOrderHubDetails? 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,
permanentDays,
location,
positions,
hub,
eventName,
vendorId,
roleRates,
];
}
/// Minimal hub details used during permanent order creation.
class PermanentOrderHubDetails extends Equatable {
const PermanentOrderHubDetails({
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 [PermanentOrder].
class PermanentOrderPosition extends Equatable {
const PermanentOrderPosition({
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.
PermanentOrderPosition copyWith({
String? role,
int? count,
String? startTime,
String? endTime,
String? lunchBreak,
String? location,
}) {
return PermanentOrderPosition(
role: role ?? this.role,
count: count ?? this.count,
startTime: startTime ?? this.startTime,
endTime: endTime ?? this.endTime,
lunchBreak: lunchBreak ?? this.lunchBreak,
location: location ?? this.location,
);
}
}