Attendance log now record both check in and out photos and allow IT Staffs, Dispatchers and Admins to view for verification
This commit is contained in:
@@ -13,8 +13,10 @@ class AttendanceLog {
|
||||
this.checkOutLat,
|
||||
this.checkOutLng,
|
||||
this.justification,
|
||||
this.checkOutJustification,
|
||||
this.verificationStatus = 'pending',
|
||||
this.verificationPhotoUrl,
|
||||
this.checkInVerificationPhotoUrl,
|
||||
this.checkOutVerificationPhotoUrl,
|
||||
});
|
||||
|
||||
final String id;
|
||||
@@ -28,8 +30,10 @@ class AttendanceLog {
|
||||
final double? checkOutLat;
|
||||
final double? checkOutLng;
|
||||
final String? justification;
|
||||
final String? checkOutJustification;
|
||||
final String verificationStatus; // pending, verified, unverified, skipped
|
||||
final String? verificationPhotoUrl;
|
||||
final String? checkInVerificationPhotoUrl;
|
||||
final String? checkOutVerificationPhotoUrl;
|
||||
|
||||
bool get isCheckedOut => checkOutAt != null;
|
||||
bool get isVerified => verificationStatus == 'verified';
|
||||
@@ -37,6 +41,8 @@ class AttendanceLog {
|
||||
verificationStatus == 'unverified' || verificationStatus == 'skipped';
|
||||
|
||||
factory AttendanceLog.fromMap(Map<String, dynamic> map) {
|
||||
// Support both old single-column and new dual-column schemas.
|
||||
final legacyUrl = map['verification_photo_url'] as String?;
|
||||
return AttendanceLog(
|
||||
id: map['id'] as String,
|
||||
userId: map['user_id'] as String,
|
||||
@@ -51,8 +57,12 @@ class AttendanceLog {
|
||||
checkOutLat: (map['check_out_lat'] as num?)?.toDouble(),
|
||||
checkOutLng: (map['check_out_lng'] as num?)?.toDouble(),
|
||||
justification: map['justification'] as String?,
|
||||
checkOutJustification: map['check_out_justification'] as String?,
|
||||
verificationStatus: map['verification_status'] as String? ?? 'pending',
|
||||
verificationPhotoUrl: map['verification_photo_url'] as String?,
|
||||
checkInVerificationPhotoUrl:
|
||||
map['check_in_verification_photo_url'] as String? ?? legacyUrl,
|
||||
checkOutVerificationPhotoUrl:
|
||||
map['check_out_verification_photo_url'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user