feat: Add hourly rate field to order position arguments and update related blocs

This commit is contained in:
Achintha Isuru
2026-03-19 23:59:00 -04:00
parent 1e4c8982a5
commit b10ef57d37
6 changed files with 46 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ class OneTimeOrderPositionArgument extends UseCaseArgument {
required this.endTime,
this.roleName,
this.lunchBreak,
this.hourlyRateCents,
});
/// The role ID for this position.
@@ -30,9 +31,19 @@ class OneTimeOrderPositionArgument extends UseCaseArgument {
/// Break duration label (e.g. `'MIN_30'`, `'NO_BREAK'`), if set.
final String? lunchBreak;
/// Hourly rate in cents for this position, if set.
final int? hourlyRateCents;
@override
List<Object?> get props =>
<Object?>[roleId, roleName, workerCount, startTime, endTime, lunchBreak];
List<Object?> get props => <Object?>[
roleId,
roleName,
workerCount,
startTime,
endTime,
lunchBreak,
hourlyRateCents,
];
}
/// Typed arguments for [CreateOneTimeOrderUseCase].
@@ -84,6 +95,7 @@ class OneTimeOrderArguments extends UseCaseArgument {
p.lunchBreak != 'NO_BREAK' &&
p.lunchBreak!.isNotEmpty)
'lunchBreakMinutes': breakMinutesFromLabel(p.lunchBreak!),
if (p.hourlyRateCents != null) 'hourlyRateCents': p.hourlyRateCents,
};
}).toList();

View File

@@ -9,6 +9,7 @@ class PermanentOrderPositionArgument extends UseCaseArgument {
required this.startTime,
required this.endTime,
this.roleName,
this.hourlyRateCents,
});
/// The role ID for this position.
@@ -26,9 +27,18 @@ class PermanentOrderPositionArgument extends UseCaseArgument {
/// Shift end time in HH:mm format.
final String endTime;
/// Hourly rate in cents for this position, if set.
final int? hourlyRateCents;
@override
List<Object?> get props =>
<Object?>[roleId, roleName, workerCount, startTime, endTime];
List<Object?> get props => <Object?>[
roleId,
roleName,
workerCount,
startTime,
endTime,
hourlyRateCents,
];
}
/// Typed arguments for [CreatePermanentOrderUseCase].
@@ -95,6 +105,7 @@ class PermanentOrderArguments extends UseCaseArgument {
'workerCount': p.workerCount,
'startTime': toUtcTimeHHmm(startDate, p.startTime),
'endTime': toUtcTimeHHmm(startDate, p.endTime),
if (p.hourlyRateCents != null) 'hourlyRateCents': p.hourlyRateCents,
};
}).toList();

View File

@@ -9,6 +9,7 @@ class RecurringOrderPositionArgument extends UseCaseArgument {
required this.startTime,
required this.endTime,
this.roleName,
this.hourlyRateCents,
});
/// The role ID for this position.
@@ -26,9 +27,18 @@ class RecurringOrderPositionArgument extends UseCaseArgument {
/// Shift end time in HH:mm format.
final String endTime;
/// Hourly rate in cents for this position, if set.
final int? hourlyRateCents;
@override
List<Object?> get props =>
<Object?>[roleId, roleName, workerCount, startTime, endTime];
List<Object?> get props => <Object?>[
roleId,
roleName,
workerCount,
startTime,
endTime,
hourlyRateCents,
];
}
/// Typed arguments for [CreateRecurringOrderUseCase].
@@ -100,6 +110,7 @@ class RecurringOrderArguments extends UseCaseArgument {
'workerCount': p.workerCount,
'startTime': toUtcTimeHHmm(startDate, p.startTime),
'endTime': toUtcTimeHHmm(startDate, p.endTime),
if (p.hourlyRateCents != null) 'hourlyRateCents': p.hourlyRateCents,
};
}).toList();

View File

@@ -265,6 +265,8 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState>
startTime: p.startTime,
endTime: p.endTime,
lunchBreak: p.lunchBreak,
hourlyRateCents:
role != null ? (role.costPerHour * 100).round() : null,
);
}).toList();

View File

@@ -360,6 +360,8 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
workerCount: p.count,
startTime: p.startTime,
endTime: p.endTime,
hourlyRateCents:
role != null ? (role.costPerHour * 100).round() : null,
);
}).toList();

View File

@@ -380,6 +380,8 @@ class RecurringOrderBloc extends Bloc<RecurringOrderEvent, RecurringOrderState>
workerCount: p.count,
startTime: p.startTime,
endTime: p.endTime,
hourlyRateCents:
role != null ? (role.costPerHour * 100).round() : null,
);
}).toList();