You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/models/new_models/workOrderDetail.dart

835 lines
18 KiB
Dart

class WorkOrderDetail {
WorkOrder data;
String message;
String title;
String innerMessage;
int responseCode;
bool isSuccess;
WorkOrderDetail({
this.data,
this.message,
this.title,
this.innerMessage,
this.responseCode,
this.isSuccess,
});
factory WorkOrderDetail.fromJson(Map<String, dynamic> json) {
return WorkOrderDetail(
data: WorkOrder.fromJson(json['data']),
message: json['message'],
title: json['title'],
innerMessage: json['innerMessage'],
responseCode: json['responseCode'],
isSuccess: json['isSuccess'],
);
}
Map<String, dynamic> toJson() {
return {
'data': data?.toJson(),
'message': message,
'title': title,
'innerMessage': innerMessage,
'responseCode': responseCode,
'isSuccess': isSuccess,
};
}
}
class WorkOrder {
String workOrderNo;
WorkOrderCreatedBy workOrderCreatedBy;
DateTime requestedDate;
Asset asset;
AssetGroup assetGroup;
Manufacturer manufacturer;
Model model;
AssetNDModel assetNDModel;
Site site;
Building building;
Floor floor;
Department department;
dynamic room;
AssetType assetType;
AssignedEmployee assignedEmployee;
dynamic lastActivityStatus;
Status status;
NextStep nextStep;
dynamic assetVerificationType;
List<WorkOrderContactPerson> workOrderContactPerson;
EquipmentStatus equipmentStatus;
Priority priority;
RequestedThrough requestedThrough;
TypeOfRequest typeofRequest;
dynamic loanAvailablity;
dynamic assetLoan;
dynamic safety;
ProblemDescription problemDescription;
String comments;
String voiceNote;
List<dynamic> workOrderAttachments;
dynamic returnToService;
dynamic serviceType;
dynamic failureReasone;
dynamic solution;
dynamic totalWorkingHours;
List<WorkOrderHistory> workOrderHistory;
List<dynamic> activityMaintenances;
List<dynamic> activitySpareParts;
List<dynamic> activityAssetToBeRetireds;
WorkOrder({
this.workOrderNo,
this.workOrderCreatedBy,
this.requestedDate,
this.asset,
this.assetGroup,
this.manufacturer,
this.model,
this.assetNDModel,
this.site,
this.building,
this.floor,
this.department,
this.room,
this.assetType,
this.assignedEmployee,
this.lastActivityStatus,
this.status,
this.nextStep,
this.assetVerificationType,
this.workOrderContactPerson,
this.equipmentStatus,
this.priority,
this.requestedThrough,
this.typeofRequest,
this.loanAvailablity,
this.assetLoan,
this.safety,
this.problemDescription,
this.comments,
this.voiceNote,
this.workOrderAttachments,
this.returnToService,
this.serviceType,
this.failureReasone,
this.solution,
this.totalWorkingHours,
this.workOrderHistory,
this.activityMaintenances,
this.activitySpareParts,
this.activityAssetToBeRetireds,
});
factory WorkOrder.fromJson(Map<String, dynamic> json) {
return WorkOrder(
workOrderNo: json['workOrderNo'],
workOrderCreatedBy: WorkOrderCreatedBy.fromJson(json['workOrderCreatedBy']),
requestedDate: DateTime.parse(json['requestedDate']),
asset: Asset.fromJson(json['asset']),
assetGroup: AssetGroup.fromJson(json['assetGroup']),
manufacturer: Manufacturer.fromJson(json['manufacturer']),
model: Model.fromJson(json['model']),
assetNDModel: AssetNDModel.fromJson(json['assetNDModel']),
site: Site.fromJson(json['site']),
building: Building.fromJson(json['building']),
floor: Floor.fromJson(json['floor']),
department: Department.fromJson(json['department']),
room: json['room'],
assetType: AssetType.fromJson(json['assetType']),
assignedEmployee: AssignedEmployee.fromJson(json['assignedEmployee']),
lastActivityStatus: json['lastActivityStatus'],
status: Status.fromJson(json['status']),
nextStep: NextStep.fromJson(json['nextStep']),
assetVerificationType: json['assetVerificationType'],
workOrderContactPerson: (json['workOrderContactPerson'] as List)
.map((i) => WorkOrderContactPerson.fromJson(i))
.toList(),
equipmentStatus: EquipmentStatus.fromJson(json['equipmentStatus']),
priority: Priority.fromJson(json['priority']),
requestedThrough: RequestedThrough.fromJson(json['requestedThrough']),
typeofRequest: TypeOfRequest.fromJson(json['typeofRequest']),
loanAvailablity: json['loanAvailablity'],
assetLoan: json['assetLoan'],
safety: json['safety'],
problemDescription: ProblemDescription.fromJson(json['problemDescription']),
comments: json['comments'],
voiceNote: json['voiceNote'],
workOrderAttachments: json['workOrderAttachments'] as List,
returnToService: json['returnToService'],
serviceType: json['serviceType'],
failureReasone: json['failureReasone'],
solution: json['solution'],
totalWorkingHours: json['totalWorkingHours'],
workOrderHistory: (json['workOrderHistory'] as List)
.map((i) => WorkOrderHistory.fromJson(i))
.toList(),
activityMaintenances: json['activityMaintenances'] as List,
activitySpareParts: json['activitySpareParts'] as List,
activityAssetToBeRetireds: json['activityAssetToBeRetireds'] as List,
);
}
Map<String, dynamic> toJson() {
return {
'workOrderNo': workOrderNo,
'workOrderCreatedBy': workOrderCreatedBy.toJson(),
'requestedDate': requestedDate.toIso8601String(),
'asset': asset.toJson(),
'assetGroup': assetGroup.toJson(),
'manufacturer': manufacturer.toJson(),
'model': model.toJson(),
'assetNDModel': assetNDModel.toJson(),
'site': site.toJson(),
'building': building.toJson(),
'floor': floor.toJson(),
'department': department.toJson(),
'room': room,
'assetType': assetType.toJson(),
'assignedEmployee': assignedEmployee.toJson(),
'lastActivityStatus': lastActivityStatus,
'status': status.toJson(),
'nextStep': nextStep.toJson(),
'assetVerificationType': assetVerificationType,
'workOrderContactPerson': workOrderContactPerson.map((i) => i.toJson()).toList(),
'equipmentStatus': equipmentStatus.toJson(),
'priority': priority.toJson(),
'requestedThrough': requestedThrough.toJson(),
'typeofRequest': typeofRequest.toJson(),
'loanAvailablity': loanAvailablity,
'assetLoan': assetLoan,
'safety': safety,
'problemDescription': problemDescription.toJson(),
'comments': comments,
'voiceNote': voiceNote,
'workOrderAttachments': workOrderAttachments,
'returnToService': returnToService,
'serviceType': serviceType,
'failureReasone': failureReasone,
'solution': solution,
'totalWorkingHours': totalWorkingHours,
'workOrderHistory': workOrderHistory.map((i) => i.toJson()).toList(),
'activityMaintenances': activityMaintenances,
'activitySpareParts': activitySpareParts,
'activityAssetToBeRetireds': activityAssetToBeRetireds,
};
}
}
class WorkOrderCreatedBy {
String id;
String userName;
WorkOrderCreatedBy({this.id, this.userName});
factory WorkOrderCreatedBy.fromJson(Map<String, dynamic> json) {
return WorkOrderCreatedBy(
id: json['id'],
userName: json['userName'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'userName': userName,
};
}
}
class Asset {
int id;
String assetNumber;
Asset({this.id, this.assetNumber});
factory Asset.fromJson(Map<String, dynamic> json) {
return Asset(
id: json['id'],
assetNumber: json['assetNumber'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'assetNumber': assetNumber,
};
}
}
class AssetGroup {
int id;
String name;
AssetGroup({this.id, this.name});
factory AssetGroup.fromJson(Map<String, dynamic> json) {
return AssetGroup(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class Manufacturer {
int id;
String name;
Manufacturer({this.id, this.name});
factory Manufacturer.fromJson(Map<String, dynamic> json) {
return Manufacturer(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class Model {
int id;
String name;
Model({this.id, this.name});
factory Model.fromJson(Map<String, dynamic> json) {
return Model(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class AssetNDModel {
int id;
String name;
AssetNDModel({this.id, this.name});
factory AssetNDModel.fromJson(Map<String, dynamic> json) {
return AssetNDModel(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class Site {
int id;
String siteName;
Site({this.id, this.siteName});
factory Site.fromJson(Map<String, dynamic> json) {
return Site(
id: json['id'],
siteName: json['siteName'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'siteName': siteName,
};
}
}
class Building {
int id;
String name;
int value;
Building({this.id, this.name, this.value});
factory Building.fromJson(Map<String, dynamic> json) {
return Building(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class Floor {
int id;
String name;
int value;
Floor({this.id, this.name, this.value});
factory Floor.fromJson(Map<String, dynamic> json) {
return Floor(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class Department {
int id;
String name;
Department({this.id, this.name});
factory Department.fromJson(Map<String, dynamic> json) {
return Department(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class AssetType {
int id;
String name;
int value;
AssetType({this.id, this.name, this.value});
factory AssetType.fromJson(Map<String, dynamic> json) {
return AssetType(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class AssignedEmployee {
String id;
String userName;
AssignedEmployee({this.id, this.userName});
factory AssignedEmployee.fromJson(Map<String, dynamic> json) {
return AssignedEmployee(
id: json['id'],
userName: json['userName'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'userName': userName,
};
}
}
class Status {
int id;
String name;
int value;
Status({this.id, this.name, this.value});
factory Status.fromJson(Map<String, dynamic> json) {
return Status(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class NextStep {
int id;
String name;
int value;
NextStep({this.id, this.name, this.value});
factory NextStep.fromJson(Map<String, dynamic> json) {
return NextStep(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class WorkOrderContactPerson {
int id;
String name;
String employeeId;
String position;
String extension;
String email;
String mobilePhone;
ContactUser contactUser;
WorkOrderContactPerson({
this.id,
this.name,
this.employeeId,
this.position,
this.extension,
this.email,
this.mobilePhone,
this.contactUser,
});
factory WorkOrderContactPerson.fromJson(Map<String, dynamic> json) {
return WorkOrderContactPerson(
id: json['id'],
name: json['name'],
employeeId: json['employeeId'],
position: json['position'],
extension: json['extension'],
email: json['email'],
mobilePhone: json['mobilePhone'],
contactUser: ContactUser.fromJson(json['contactUser']),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'employeeId': employeeId,
'position': position,
'extension': extension,
'email': email,
'mobilePhone': mobilePhone,
'contactUser': contactUser.toJson(),
};
}
}
class ContactUser {
String id;
String userName;
ContactUser({
this.id,
this.userName,
});
factory ContactUser.fromJson(Map<String, dynamic> json) {
return ContactUser(
id: json['id'],
userName: json['userName'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'userName': userName,
};
}
}
class EquipmentStatus {
int id;
String name;
int value;
EquipmentStatus({this.id, this.name, this.value});
factory EquipmentStatus.fromJson(Map<String, dynamic> json) {
return EquipmentStatus(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class Priority {
int id;
String name;
int value;
Priority({this.id, this.name, this.value});
factory Priority.fromJson(Map<String, dynamic> json) {
return Priority(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class RequestedThrough {
int id;
String name;
RequestedThrough({this.id, this.name});
factory RequestedThrough.fromJson(Map<String, dynamic> json) {
return RequestedThrough(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class TypeOfRequest {
int id;
String name;
TypeOfRequest({this.id, this.name});
factory TypeOfRequest.fromJson(Map<String, dynamic> json) {
return TypeOfRequest(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class ProblemDescription {
int id;
String name;
ProblemDescription({this.id, this.name});
factory ProblemDescription.fromJson(Map<String, dynamic> json) {
return ProblemDescription(
id: json['id'],
name: json['name'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
};
}
}
class WorkOrderHistory {
int id;
WorkOrderStatus workOrderStatus;
dynamic activityStatus; // Since activityStatus is null, it's dynamic
String date;
HistoryUser user;
Step step;
dynamic fixRemotelyStartTime; // Since it's null, it's dynamic
dynamic fixRemotelyEndTime; // Since it's null, it's dynamic
dynamic fixRemotelyWorkingHours; // Since it's null, it's dynamic
String comments;
dynamic needAVisitDateTime; // Since it's null, it's dynamic
WorkOrderHistory({
this.id,
this.workOrderStatus,
this.activityStatus,
this.date,
this.user,
this.step,
this.fixRemotelyStartTime,
this.fixRemotelyEndTime,
this.fixRemotelyWorkingHours,
this.comments,
this.needAVisitDateTime,
});
factory WorkOrderHistory.fromJson(Map<String, dynamic> json) {
return WorkOrderHistory(
id: json['id'],
workOrderStatus: WorkOrderStatus.fromJson(json['workorderStatus']),
activityStatus: json['activityStatus'],
date: json['date'],
user: HistoryUser.fromJson(json['user']),
step: Step.fromJson(json['step']),
fixRemotelyStartTime: json['fixRemotlyStartTime'],
fixRemotelyEndTime: json['fixRemotlyEndTime'],
fixRemotelyWorkingHours: json['fixRemotlyWorkingHours'],
comments: json['comments'] ?? "",
needAVisitDateTime: json['needAVisitDateTime'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'workorderStatus': workOrderStatus.toJson(),
'activityStatus': activityStatus,
'date': date,
'user': user.toJson(),
'step': step.toJson(),
'fixRemotelyStartTime': fixRemotelyStartTime,
'fixRemotelyEndTime': fixRemotelyEndTime,
'fixRemotelyWorkingHours': fixRemotelyWorkingHours,
'comments': comments,
'needAVisitDateTime': needAVisitDateTime,
};
}
}
class WorkOrderStatus {
int id;
String name;
int value;
WorkOrderStatus({
this.id,
this.name,
this.value,
});
factory WorkOrderStatus.fromJson(Map<String, dynamic> json) {
return WorkOrderStatus(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}
class HistoryUser {
String id;
String userName;
HistoryUser({
this.id,
this.userName,
});
factory HistoryUser.fromJson(Map<String, dynamic> json) {
return HistoryUser(
id: json['id'],
userName: json['userName'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'userName': userName,
};
}
}
class Step {
int id;
String name;
int value;
Step({
this.id,
this.name,
this.value,
});
factory Step.fromJson(Map<String, dynamic> json) {
return Step(
id: json['id'],
name: json['name'],
value: json['value'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'value': value,
};
}
}