95 lines
2.0 KiB
Dart
95 lines
2.0 KiB
Dart
class UserAccount {
|
|
UserAccount({
|
|
this.id,
|
|
required this.employeeNo,
|
|
required this.employeeName,
|
|
this.email,
|
|
this.mobileNo,
|
|
this.group,
|
|
this.isActive = true,
|
|
this.isDeleted = false,
|
|
this.note,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
});
|
|
|
|
final int? id;
|
|
final String employeeNo;
|
|
final String employeeName;
|
|
final String? email;
|
|
final String? mobileNo;
|
|
final UserGroup? group;
|
|
final bool isActive;
|
|
final bool isDeleted;
|
|
final String? note;
|
|
final DateTime? createdAt;
|
|
final DateTime? updatedAt;
|
|
|
|
UserAccount copyWith({
|
|
int? id,
|
|
String? employeeNo,
|
|
String? employeeName,
|
|
String? email,
|
|
String? mobileNo,
|
|
UserGroup? group,
|
|
bool? isActive,
|
|
bool? isDeleted,
|
|
String? note,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) {
|
|
return UserAccount(
|
|
id: id ?? this.id,
|
|
employeeNo: employeeNo ?? this.employeeNo,
|
|
employeeName: employeeName ?? this.employeeName,
|
|
email: email ?? this.email,
|
|
mobileNo: mobileNo ?? this.mobileNo,
|
|
group: group ?? this.group,
|
|
isActive: isActive ?? this.isActive,
|
|
isDeleted: isDeleted ?? this.isDeleted,
|
|
note: note ?? this.note,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
}
|
|
}
|
|
|
|
class UserGroup {
|
|
UserGroup({required this.id, required this.groupName});
|
|
|
|
final int id;
|
|
final String groupName;
|
|
}
|
|
|
|
class UserInput {
|
|
UserInput({
|
|
required this.employeeNo,
|
|
required this.employeeName,
|
|
required this.groupId,
|
|
this.email,
|
|
this.mobileNo,
|
|
this.isActive = true,
|
|
this.note,
|
|
});
|
|
|
|
final String employeeNo;
|
|
final String employeeName;
|
|
final int groupId;
|
|
final String? email;
|
|
final String? mobileNo;
|
|
final bool isActive;
|
|
final String? note;
|
|
|
|
Map<String, dynamic> toPayload() {
|
|
return {
|
|
'employee_no': employeeNo,
|
|
'employee_name': employeeName,
|
|
'group_id': groupId,
|
|
'email': email,
|
|
'mobile_no': mobileNo,
|
|
'is_active': isActive,
|
|
'note': note,
|
|
};
|
|
}
|
|
}
|