- Implemented employee skeleton card for loading states in the UI. - Created AssignedProjectsResponse and AssignedProject models for handling project assignments. - Enhanced EmployeeDetailBottomSheet to include project assignment button. - Developed AssignProjectBottomSheet for selecting projects to assign to employees. - Introduced EmployeeDetailPage for displaying detailed employee information. - Updated EmployeesScreen to support searching and filtering employees. - Improved layout and UI elements for better user experience.
94 lines
2.5 KiB
Dart
94 lines
2.5 KiB
Dart
class AssignedProjectsResponse {
|
|
final bool success;
|
|
final String message;
|
|
final List<AssignedProject> data;
|
|
final dynamic errors;
|
|
final int statusCode;
|
|
final DateTime timestamp;
|
|
|
|
AssignedProjectsResponse({
|
|
required this.success,
|
|
required this.message,
|
|
required this.data,
|
|
this.errors,
|
|
required this.statusCode,
|
|
required this.timestamp,
|
|
});
|
|
|
|
factory AssignedProjectsResponse.fromJson(Map<String, dynamic> json) {
|
|
return AssignedProjectsResponse(
|
|
success: json['success'] ?? false,
|
|
message: json['message'] ?? '',
|
|
data: (json['data'] as List<dynamic>?)
|
|
?.map((item) => AssignedProject.fromJson(item))
|
|
.toList() ??
|
|
[],
|
|
errors: json['errors'],
|
|
statusCode: json['statusCode'] ?? 0,
|
|
timestamp: DateTime.tryParse(json['timestamp'] ?? '') ?? DateTime.now(),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'success': success,
|
|
'message': message,
|
|
'data': data.map((p) => p.toJson()).toList(),
|
|
'errors': errors,
|
|
'statusCode': statusCode,
|
|
'timestamp': timestamp.toIso8601String(),
|
|
};
|
|
}
|
|
}
|
|
|
|
class AssignedProject {
|
|
final String id;
|
|
final String name;
|
|
final String shortName;
|
|
final String projectAddress;
|
|
final String contactPerson;
|
|
final DateTime? startDate;
|
|
final DateTime? endDate;
|
|
final String projectStatusId;
|
|
|
|
AssignedProject({
|
|
required this.id,
|
|
required this.name,
|
|
required this.shortName,
|
|
required this.projectAddress,
|
|
required this.contactPerson,
|
|
this.startDate,
|
|
this.endDate,
|
|
required this.projectStatusId,
|
|
});
|
|
|
|
factory AssignedProject.fromJson(Map<String, dynamic> json) {
|
|
return AssignedProject(
|
|
id: json['id'] ?? '',
|
|
name: json['name'] ?? '',
|
|
shortName: json['shortName'] ?? '',
|
|
projectAddress: json['projectAddress'] ?? '',
|
|
contactPerson: json['contactPerson'] ?? '',
|
|
startDate: json['startDate'] != null
|
|
? DateTime.tryParse(json['startDate'])
|
|
: null,
|
|
endDate:
|
|
json['endDate'] != null ? DateTime.tryParse(json['endDate']) : null,
|
|
projectStatusId: json['projectStatusId'] ?? '',
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'shortName': shortName,
|
|
'projectAddress': projectAddress,
|
|
'contactPerson': contactPerson,
|
|
'startDate': startDate?.toIso8601String(),
|
|
'endDate': endDate?.toIso8601String(),
|
|
'projectStatusId': projectStatusId,
|
|
};
|
|
}
|
|
}
|