feat: integrate TimeCard feature with Firebase support and restructure related components

This commit is contained in:
Achintha Isuru
2026-01-30 15:29:19 -05:00
parent 772d59a7dd
commit 4fb2f17ea5
10 changed files with 152 additions and 56 deletions

View File

@@ -0,0 +1,78 @@
import 'package:equatable/equatable.dart';
/// Status of a time card.
enum TimeCardStatus {
/// Waiting for approval or payment.
pending,
/// Approved by manager.
approved,
/// Payment has been issued.
paid,
/// Disputed by staff or client.
disputed;
/// Whether the card is approved.
bool get isApproved => this == TimeCardStatus.approved;
/// Whether the card is paid.
bool get isPaid => this == TimeCardStatus.paid;
/// Whether the card is disputed.
bool get isDisputed => this == TimeCardStatus.disputed;
/// Whether the card is pending.
bool get isPending => this == TimeCardStatus.pending;
}
/// Represents a time card for a staff member.
class TimeCard extends Equatable {
/// Unique identifier of the time card (often matches Application ID).
final String id;
/// Title of the shift.
final String shiftTitle;
/// Name of the client business.
final String clientName;
/// Date of the shift.
final DateTime date;
/// Actual or scheduled start time.
final String startTime;
/// Actual or scheduled end time.
final String endTime;
/// Total hours worked.
final double totalHours;
/// Hourly pay rate.
final double hourlyRate;
/// Total pay amount.
final double totalPay;
/// Current status of the time card.
final TimeCardStatus status;
/// Location name.
final String? location;
/// Creates a [TimeCard].
const TimeCard({
required this.id,
required this.shiftTitle,
required this.clientName,
required this.date,
required this.startTime,
required this.endTime,
required this.totalHours,
required this.hourlyRate,
required this.totalPay,
required this.status,
this.location,
});
@override
List<Object?> get props => [
id,
shiftTitle,
clientName,
date,
startTime,
endTime,
totalHours,
hourlyRate,
totalPay,
status,
location,
];
}