feat(shifts): enhance TodayShift and shift card components with client details and pay calculations

This commit is contained in:
Achintha Isuru
2026-03-18 15:39:05 -04:00
parent 77f8b8511c
commit 47508f54e4
4 changed files with 202 additions and 30 deletions

View File

@@ -17,6 +17,12 @@ class TodayShift extends Equatable {
required this.startTime,
required this.endTime,
required this.attendanceStatus,
this.clientName = '',
this.hourlyRateCents = 0,
this.hourlyRate = 0.0,
this.totalRateCents = 0,
this.totalRate = 0.0,
this.locationAddress,
this.clockInAt,
});
@@ -30,6 +36,12 @@ class TodayShift extends Equatable {
startTime: DateTime.parse(json['startTime'] as String),
endTime: DateTime.parse(json['endTime'] as String),
attendanceStatus: AttendanceStatusType.fromJson(json['attendanceStatus'] as String?),
clientName: json['clientName'] as String? ?? '',
hourlyRateCents: json['hourlyRateCents'] as int? ?? 0,
hourlyRate: (json['hourlyRate'] as num?)?.toDouble() ?? 0.0,
totalRateCents: json['totalRateCents'] as int? ?? 0,
totalRate: (json['totalRate'] as num?)?.toDouble() ?? 0.0,
locationAddress: json['locationAddress'] as String?,
clockInAt: json['clockInAt'] != null
? DateTime.parse(json['clockInAt'] as String)
: null,
@@ -48,6 +60,24 @@ class TodayShift extends Equatable {
/// Human-readable location label (clock-point or shift location).
final String location;
/// Name of the client / business for this shift.
final String clientName;
/// Pay rate in cents per hour.
final int hourlyRateCents;
/// Pay rate in dollars per hour.
final double hourlyRate;
/// Total pay for this shift in cents.
final int totalRateCents;
/// Total pay for this shift in dollars.
final double totalRate;
/// Full street address of the shift location, if available.
final String? locationAddress;
/// Scheduled start time.
final DateTime startTime;
@@ -67,6 +97,12 @@ class TodayShift extends Equatable {
'shiftId': shiftId,
'roleName': roleName,
'location': location,
'clientName': clientName,
'hourlyRateCents': hourlyRateCents,
'hourlyRate': hourlyRate,
'totalRateCents': totalRateCents,
'totalRate': totalRate,
'locationAddress': locationAddress,
'startTime': startTime.toIso8601String(),
'endTime': endTime.toIso8601String(),
'attendanceStatus': attendanceStatus.toJson(),
@@ -80,6 +116,12 @@ class TodayShift extends Equatable {
shiftId,
roleName,
location,
clientName,
hourlyRateCents,
hourlyRate,
totalRateCents,
totalRate,
locationAddress,
startTime,
endTime,
attendanceStatus,