204 lines
5.4 KiB
Dart
204 lines
5.4 KiB
Dart
class ServiceProjectAllocationResponse {
|
|
final bool success;
|
|
final String message;
|
|
final List<ServiceProjectAllocation> data;
|
|
final dynamic errors;
|
|
final int statusCode;
|
|
final DateTime timestamp;
|
|
|
|
ServiceProjectAllocationResponse({
|
|
required this.success,
|
|
required this.message,
|
|
required this.data,
|
|
this.errors,
|
|
required this.statusCode,
|
|
required this.timestamp,
|
|
});
|
|
|
|
factory ServiceProjectAllocationResponse.fromJson(Map<String, dynamic> json) {
|
|
return ServiceProjectAllocationResponse(
|
|
success: json['success'] as bool,
|
|
message: json['message'] as String,
|
|
data: (json['data'] as List<dynamic>)
|
|
.map((e) => ServiceProjectAllocation.fromJson(e))
|
|
.toList(),
|
|
errors: json['errors'],
|
|
statusCode: json['statusCode'] as int,
|
|
timestamp: DateTime.parse(json['timestamp'] as String),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'success': success,
|
|
'message': message,
|
|
'data': data.map((e) => e.toJson()).toList(),
|
|
'errors': errors,
|
|
'statusCode': statusCode,
|
|
'timestamp': timestamp.toIso8601String(),
|
|
};
|
|
}
|
|
|
|
class ServiceProjectAllocation {
|
|
final String id;
|
|
final Project project;
|
|
final Employee employee;
|
|
final TeamRole teamRole;
|
|
final bool isActive;
|
|
final DateTime assignedAt;
|
|
final Employee assignedBy;
|
|
final DateTime? reAssignedAt;
|
|
final Employee? reAssignedBy;
|
|
|
|
ServiceProjectAllocation({
|
|
required this.id,
|
|
required this.project,
|
|
required this.employee,
|
|
required this.teamRole,
|
|
required this.isActive,
|
|
required this.assignedAt,
|
|
required this.assignedBy,
|
|
this.reAssignedAt,
|
|
this.reAssignedBy,
|
|
});
|
|
|
|
factory ServiceProjectAllocation.fromJson(Map<String, dynamic> json) {
|
|
return ServiceProjectAllocation(
|
|
id: json['id'] as String,
|
|
project: Project.fromJson(json['project']),
|
|
employee: Employee.fromJson(json['employee']),
|
|
teamRole: TeamRole.fromJson(json['teamRole']),
|
|
isActive: json['isActive'] as bool,
|
|
assignedAt: DateTime.parse(json['assignedAt'] as String),
|
|
assignedBy: Employee.fromJson(json['assignedBy']),
|
|
reAssignedAt: json['reAssignedAt'] != null
|
|
? DateTime.parse(json['reAssignedAt'])
|
|
: null,
|
|
reAssignedBy: json['reAssignedBy'] != null
|
|
? Employee.fromJson(json['reAssignedBy'])
|
|
: null,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'project': project.toJson(),
|
|
'employee': employee.toJson(),
|
|
'teamRole': teamRole.toJson(),
|
|
'isActive': isActive,
|
|
'assignedAt': assignedAt.toIso8601String(),
|
|
'assignedBy': assignedBy.toJson(),
|
|
'reAssignedAt': reAssignedAt?.toIso8601String(),
|
|
'reAssignedBy': reAssignedBy?.toJson(),
|
|
};
|
|
}
|
|
|
|
class Project {
|
|
final String id;
|
|
final String name;
|
|
final String shortName;
|
|
final DateTime assignedDate;
|
|
final String contactName;
|
|
final String contactPhone;
|
|
final String contactEmail;
|
|
|
|
Project({
|
|
required this.id,
|
|
required this.name,
|
|
required this.shortName,
|
|
required this.assignedDate,
|
|
required this.contactName,
|
|
required this.contactPhone,
|
|
required this.contactEmail,
|
|
});
|
|
|
|
factory Project.fromJson(Map<String, dynamic> json) {
|
|
return Project(
|
|
id: json['id'] as String,
|
|
name: json['name'] as String,
|
|
shortName: json['shortName'] as String,
|
|
assignedDate: DateTime.parse(json['assignedDate'] as String),
|
|
contactName: json['contactName'] as String,
|
|
contactPhone: json['contactPhone'] as String,
|
|
contactEmail: json['contactEmail'] as String,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'shortName': shortName,
|
|
'assignedDate': assignedDate.toIso8601String(),
|
|
'contactName': contactName,
|
|
'contactPhone': contactPhone,
|
|
'contactEmail': contactEmail,
|
|
};
|
|
}
|
|
|
|
class Employee {
|
|
final String id;
|
|
final String firstName;
|
|
final String lastName;
|
|
final String? email;
|
|
final String? photo;
|
|
final String jobRoleId;
|
|
final String jobRoleName;
|
|
|
|
Employee({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
this.email,
|
|
this.photo,
|
|
required this.jobRoleId,
|
|
required this.jobRoleName,
|
|
});
|
|
|
|
factory Employee.fromJson(Map<String, dynamic> json) {
|
|
return Employee(
|
|
id: json['id'] as String,
|
|
firstName: json['firstName'] as String,
|
|
lastName: json['lastName'] as String,
|
|
email: json['email'] as String?,
|
|
photo: json['photo'] as String?,
|
|
jobRoleId: json['jobRoleId'] as String,
|
|
jobRoleName: json['jobRoleName'] as String,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'firstName': firstName,
|
|
'lastName': lastName,
|
|
'email': email,
|
|
'photo': photo,
|
|
'jobRoleId': jobRoleId,
|
|
'jobRoleName': jobRoleName,
|
|
};
|
|
}
|
|
|
|
class TeamRole {
|
|
final String id;
|
|
final String name;
|
|
final String description;
|
|
|
|
TeamRole({
|
|
required this.id,
|
|
required this.name,
|
|
required this.description,
|
|
});
|
|
|
|
factory TeamRole.fromJson(Map<String, dynamic> json) {
|
|
return TeamRole(
|
|
id: json['id'] as String,
|
|
name: json['name'] as String,
|
|
description: json['description'] as String,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'description': description,
|
|
};
|
|
}
|