feat: Add cancellation reason handling and display in shift details

This commit is contained in:
Achintha Isuru
2026-03-19 16:36:35 -04:00
parent 56253893ed
commit bd2d5610b3
5 changed files with 91 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ class ShiftDetail extends Equatable {
required this.allowClockInOverride,
this.geofenceRadiusMeters,
this.nfcTagId,
this.cancellationReason,
});
/// Deserialises from the V2 API JSON response.
@@ -76,6 +77,7 @@ class ShiftDetail extends Equatable {
allowClockInOverride: json['allowClockInOverride'] as bool? ?? false,
geofenceRadiusMeters: json['geofenceRadiusMeters'] as int?,
nfcTagId: json['nfcTagId'] as String?,
cancellationReason: json['cancellationReason'] as String?,
);
}
@@ -157,6 +159,9 @@ class ShiftDetail extends Equatable {
/// NFC tag identifier for NFC-based clock-in.
final String? nfcTagId;
/// Reason the shift was cancelled, if applicable.
final String? cancellationReason;
/// Duration of the shift in hours.
double get durationHours {
return endTime.difference(startTime).inMinutes / 60;
@@ -194,6 +199,7 @@ class ShiftDetail extends Equatable {
'allowClockInOverride': allowClockInOverride,
'geofenceRadiusMeters': geofenceRadiusMeters,
'nfcTagId': nfcTagId,
'cancellationReason': cancellationReason,
};
}
@@ -225,5 +231,6 @@ class ShiftDetail extends Equatable {
allowClockInOverride,
geofenceRadiusMeters,
nfcTagId,
cancellationReason,
];
}