marco.pms.mobile/lib/model/AttendanceLogModel.dart

26 lines
741 B
Dart

class AttendanceLogModel {
final String name;
final String role;
final DateTime? checkIn;
final DateTime? checkOut;
final int activity;
AttendanceLogModel({
required this.name,
required this.role,
this.checkIn,
this.checkOut,
required this.activity,
});
factory AttendanceLogModel.fromJson(Map<String, dynamic> json) {
return AttendanceLogModel(
name: "${json['firstName'] ?? ''} ${json['lastName'] ?? ''}".trim(),
role: json['jobRoleName'] ?? '',
checkIn: json['checkInTime'] != null ? DateTime.tryParse(json['checkInTime']) : null,
checkOut: json['checkOutTime'] != null ? DateTime.tryParse(json['checkOutTime']) : null,
activity: json['activity'] ?? 0,
);
}
}