Initial Commit: Duty Schedule and Attendance Logbook
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import '../utils/app_time.dart';
|
||||
|
||||
class AttendanceLog {
|
||||
AttendanceLog({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.dutyScheduleId,
|
||||
required this.checkInAt,
|
||||
required this.checkInLat,
|
||||
required this.checkInLng,
|
||||
this.checkOutAt,
|
||||
this.checkOutLat,
|
||||
this.checkOutLng,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String userId;
|
||||
final String dutyScheduleId;
|
||||
final DateTime checkInAt;
|
||||
final double checkInLat;
|
||||
final double checkInLng;
|
||||
final DateTime? checkOutAt;
|
||||
final double? checkOutLat;
|
||||
final double? checkOutLng;
|
||||
|
||||
bool get isCheckedOut => checkOutAt != null;
|
||||
|
||||
factory AttendanceLog.fromMap(Map<String, dynamic> map) {
|
||||
return AttendanceLog(
|
||||
id: map['id'] as String,
|
||||
userId: map['user_id'] as String,
|
||||
dutyScheduleId: map['duty_schedule_id'] as String,
|
||||
checkInAt: AppTime.parse(map['check_in_at'] as String),
|
||||
checkInLat: (map['check_in_lat'] as num).toDouble(),
|
||||
checkInLng: (map['check_in_lng'] as num).toDouble(),
|
||||
checkOutAt: map['check_out_at'] == null
|
||||
? null
|
||||
: AppTime.parse(map['check_out_at'] as String),
|
||||
checkOutLat: (map['check_out_lat'] as num?)?.toDouble(),
|
||||
checkOutLng: (map['check_out_lng'] as num?)?.toDouble(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user