marco.pms.mobileapp/lib/model/attendance_log_model.dart

32 lines
958 B
Dart

class AttendanceLogModel {
final String name;
final String role;
final DateTime? checkIn;
final DateTime? checkOut;
final int activity;
final int id;
final int employeeId;
AttendanceLogModel({
required this.name,
required this.role,
this.checkIn,
this.checkOut,
required this.activity,
required this.id,
required this.employeeId,
});
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,
id: json['id'] != null ? json['id'] : null,
employeeId: json['employeeId'] != null ? json['employeeId'] : null,
);
}
}