refactor: Update reorder suggestions to fetch and display completed orders with aggregated totals instead of individual shift roles.

This commit is contained in:
Achintha Isuru
2026-02-21 22:44:26 -05:00
parent 2c6cd9cd45
commit c5e48ffbc6
4 changed files with 160 additions and 33 deletions

View File

@@ -1,46 +1,51 @@
import 'package:equatable/equatable.dart';
/// Summary of a completed shift role used for reorder suggestions.
/// Summary of a completed order used for reorder suggestions.
class ReorderItem extends Equatable {
const ReorderItem({
required this.orderId,
required this.title,
required this.location,
required this.hourlyRate,
required this.hours,
required this.totalCost,
required this.workers,
required this.type,
this.hourlyRate = 0,
this.hours = 0,
});
/// Parent order id for the completed shift.
/// Unique identifier of the order.
final String orderId;
/// Display title (role + shift title).
/// Display title of the order (e.g., event name or first shift title).
final String title;
/// Location from the shift.
/// Location of the order (e.g., first shift location).
final String location;
/// Hourly rate from the role.
final double hourlyRate;
/// Total calculated cost for the order.
final double totalCost;
/// Total hours for the shift role.
final double hours;
/// Worker count for the shift role.
/// Total number of workers required for the order.
final int workers;
/// Order type (e.g., ONE_TIME).
/// The type of order (e.g., ONE_TIME, RECURRING).
final String type;
/// Average or primary hourly rate (optional, for display).
final double hourlyRate;
/// Total hours for the order (optional, for display).
final double hours;
@override
List<Object?> get props => <Object?>[
orderId,
title,
location,
hourlyRate,
hours,
totalCost,
workers,
type,
hourlyRate,
hours,
];
}