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.
974 lines
30 KiB
Dart
974 lines
30 KiB
Dart
import 'package:test_sa/models/base.dart';
|
|
import 'package:test_sa/models/lookup.dart';
|
|
import 'package:test_sa/models/new_models/assistant_employee.dart';
|
|
import 'package:test_sa/models/new_models/building.dart';
|
|
import 'package:test_sa/models/new_models/department.dart';
|
|
import 'package:test_sa/models/new_models/floor.dart';
|
|
import 'package:test_sa/models/new_models/mapped_sites.dart';
|
|
import 'package:test_sa/models/new_models/room_model.dart';
|
|
import 'package:test_sa/models/new_models/site.dart';
|
|
import 'package:test_sa/models/new_models/work_order_detail_model.dart';
|
|
import 'package:test_sa/models/timer_model.dart';
|
|
|
|
class TaskRequestModel {
|
|
final TaskData? data;
|
|
final String? message;
|
|
final String? title;
|
|
final String? innerMessage;
|
|
final int? responseCode;
|
|
final bool? isSuccess;
|
|
|
|
TaskRequestModel({
|
|
this.data,
|
|
this.message,
|
|
this.title,
|
|
this.innerMessage,
|
|
this.responseCode,
|
|
this.isSuccess,
|
|
});
|
|
|
|
factory TaskRequestModel.fromJson(Map<String, dynamic> json) => TaskRequestModel(
|
|
data: json['data'] != null ? TaskData.fromJson(json['data']) : null,
|
|
message: json['message'],
|
|
title: json['title'],
|
|
innerMessage: json['innerMessage'],
|
|
responseCode: json['responseCode'],
|
|
isSuccess: json['isSuccess'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'data': data?.toJson(),
|
|
'message': message,
|
|
'title': title,
|
|
'innerMessage': innerMessage,
|
|
'responseCode': responseCode,
|
|
'isSuccess': isSuccess,
|
|
};
|
|
}
|
|
|
|
class TaskData {
|
|
int? id;
|
|
int? statusValue;
|
|
String? taskJobNo;
|
|
TaskContactUser? userCreated;
|
|
List<TaskJobContactPerson>? taskJobContactPersons;
|
|
TaskTypeModel? taskType;
|
|
TaskJobStatus? taskJobStatus;
|
|
TaskAsset? asset;
|
|
Site? site;
|
|
Building? building;
|
|
Floor? floor;
|
|
Department? department;
|
|
Rooms? room;
|
|
String? callComment;
|
|
List<TaskJobAttachment>? taskJobAttachments;
|
|
TaskContactUser? assignedEngineer;
|
|
List<TaskJobAssistantEmployees>? taskJobAssistantEmployees = [];
|
|
TaskJobAssistantEmployees? modelAssistantEmployees;
|
|
List<AssistantEmployees>? assistantEmployees;
|
|
List<TaskJobHistory>? taskJobHistories;
|
|
Lookup? installationBuilding;
|
|
Lookup? installationFloor;
|
|
Lookup? installationDepartment;
|
|
String? serialNo;
|
|
String? installationDate;
|
|
Lookup? completedAction;
|
|
Lookup? impactStatus;
|
|
bool? isUserAcknowledge;
|
|
Lookup? typeOfAlert;
|
|
Lookup? riskLevel;
|
|
Lookup? resource;
|
|
Lookup? actionNeeded;
|
|
String? alertNo;
|
|
String? estimationDeliveryDate;
|
|
String? reasonOfFSCA;
|
|
String? correctiveActionDescription;
|
|
TaskContactUser? evaluatorUser;
|
|
List<TaskJobActivityEngineerTimer>? taskJobActivityEngineerTimers = [];
|
|
TimerModel? taskTimerModel = TimerModel();
|
|
double? totalWorkingHours = 0.0;
|
|
List<TimerModel>? timerModelList = [];
|
|
TimerModel? taskTimePicker;
|
|
|
|
TaskData(
|
|
{this.id,
|
|
this.statusValue,
|
|
this.taskJobNo,
|
|
this.userCreated,
|
|
this.taskJobContactPersons,
|
|
this.taskType,
|
|
this.taskJobStatus,
|
|
this.asset,
|
|
this.site,
|
|
this.building,
|
|
this.floor,
|
|
this.department,
|
|
this.room,
|
|
this.callComment,
|
|
this.taskJobAttachments,
|
|
this.assignedEngineer,
|
|
this.taskJobAssistantEmployees,
|
|
this.modelAssistantEmployees,
|
|
this.assistantEmployees,
|
|
this.taskJobHistories,
|
|
this.installationBuilding,
|
|
this.installationFloor,
|
|
this.installationDepartment,
|
|
this.serialNo,
|
|
this.installationDate,
|
|
this.completedAction,
|
|
this.impactStatus,
|
|
this.isUserAcknowledge,
|
|
this.typeOfAlert,
|
|
this.riskLevel,
|
|
this.resource,
|
|
this.actionNeeded,
|
|
this.alertNo,
|
|
this.estimationDeliveryDate,
|
|
this.reasonOfFSCA,
|
|
this.correctiveActionDescription,
|
|
this.evaluatorUser,
|
|
this.taskTimePicker});
|
|
|
|
TaskData.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
taskJobNo = json['taskJobNo'];
|
|
userCreated = json['userCreated'] != null ? TaskContactUser.fromJson(json['userCreated']) : null;
|
|
|
|
if (json['taskJobContactPersons'] != null) {
|
|
taskJobContactPersons = <TaskJobContactPerson>[];
|
|
json['taskJobContactPersons'].forEach((v) {
|
|
taskJobContactPersons!.add(TaskJobContactPerson.fromJson(v));
|
|
});
|
|
}
|
|
if (json['attachments'] != null) {
|
|
taskJobAttachments = <TaskJobAttachment>[];
|
|
json['attachments'].forEach((v) {
|
|
taskJobAttachments!.add(TaskJobAttachment.fromJson(v));
|
|
});
|
|
}
|
|
taskType = json['taskType'] != null ? TaskTypeModel.fromJson(json['taskType']) : null;
|
|
taskJobStatus = json['taskJobStatus'] != null ? TaskJobStatus.fromJson(json['taskJobStatus']) : null;
|
|
callComment = json['callComment'];
|
|
if (json['taskJobAttachments'] != null) {
|
|
taskJobAttachments = <TaskJobAttachment>[];
|
|
json['taskJobAttachments'].forEach((v) {
|
|
taskJobAttachments!.add(TaskJobAttachment.fromJson(v));
|
|
});
|
|
}
|
|
assignedEngineer = json['assignedEngineer'] != null ? TaskContactUser.fromJson(json['assignedEngineer']) : null;
|
|
|
|
asset = json['asset'] != null ? TaskAsset.fromJson(json['asset']) : null;
|
|
if (json['taskJobAssistantEmployees'] != null) {
|
|
taskJobAssistantEmployees = <TaskJobAssistantEmployees>[];
|
|
json['taskJobAssistantEmployees'].forEach((v) {
|
|
taskJobAssistantEmployees!.add(TaskJobAssistantEmployees.fromJson(v));
|
|
});
|
|
}
|
|
if (json['taskJobActivityEngineerTimers'] != null) {
|
|
taskJobActivityEngineerTimers = <TaskJobActivityEngineerTimer>[];
|
|
json['taskJobActivityEngineerTimers'].forEach((v) {
|
|
taskJobActivityEngineerTimers!.add(TaskJobActivityEngineerTimer.fromJson(v));
|
|
});
|
|
}
|
|
|
|
if (json['taskJobHistories'] != null) {
|
|
taskJobHistories = <TaskJobHistory>[];
|
|
json['taskJobHistories'].forEach((v) {
|
|
taskJobHistories!.add(TaskJobHistory.fromJson(v));
|
|
});
|
|
}
|
|
serialNo = json['serialNo'];
|
|
installationDate = json['installationDate'];
|
|
completedAction = json["completedAction"] == null ? null : Lookup.fromJson(json["completedAction"]);
|
|
impactStatus = json["impactStatus"] == null ? null : Lookup.fromJson(json["impactStatus"]);
|
|
actionNeeded = json["actionNeeded"] == null ? null : Lookup.fromJson(json["actionNeeded"]);
|
|
typeOfAlert = json["typeOfAlert"] == null ? null : Lookup.fromJson(json["typeOfAlert"]);
|
|
installationBuilding = json["installationBuilding"] == null ? null : Lookup.fromJson(json["installationBuilding"]);
|
|
installationDepartment = json["installationDepartment"] == null ? null : Lookup.fromJson(json["installationDepartment"]);
|
|
installationFloor = json["installationFloor"] == null ? null : Lookup.fromJson(json["installationFloor"]);
|
|
isUserAcknowledge = json['isUserAcknowledge'] ?? false;
|
|
riskLevel = json["riskLevel"] == null ? null : Lookup.fromJson(json["riskLevel"]);
|
|
resource = json["resource"] == null ? null : Lookup.fromJson(json["resource"]);
|
|
alertNo = json['alertNo'];
|
|
estimationDeliveryDate = json['estimationDeliveryDate'];
|
|
reasonOfFSCA = json['reasonOfFSCA'];
|
|
correctiveActionDescription = json['correctiveActionDescription'];
|
|
evaluatorUser = json['evaluatorUser'] != null ? TaskContactUser.fromJson(json['evaluatorUser']) : null;
|
|
site = json["site"] == null ? null : Site.fromJson(json["site"]);
|
|
building = json["building"] == null ? null : Building.fromJson(json["building"]);
|
|
floor = json["floor"] == null ? null : Floor.fromJson(json["floor"]);
|
|
department = json["department"] == null ? null : Department.fromJson(json["department"]);
|
|
room = json["room"] == null ? null : Rooms.fromJson(json["room"]);
|
|
}
|
|
|
|
TaskData.copyWith(TaskData taskData) {
|
|
id = taskData.id;
|
|
statusValue = taskData.statusValue;
|
|
taskJobNo = taskData.taskJobNo;
|
|
userCreated = taskData.userCreated;
|
|
taskJobContactPersons = taskData.taskJobContactPersons;
|
|
taskType = taskData.taskType;
|
|
taskJobStatus = taskData.taskJobStatus;
|
|
callComment = taskData.callComment;
|
|
taskJobAttachments = taskData.taskJobAttachments;
|
|
assignedEngineer = taskData.assignedEngineer;
|
|
asset = taskData.asset;
|
|
taskJobAssistantEmployees = taskData.taskJobAssistantEmployees;
|
|
taskJobActivityEngineerTimers = taskData.taskJobActivityEngineerTimers;
|
|
taskJobHistories = taskData.taskJobHistories;
|
|
serialNo = taskData.serialNo;
|
|
installationDate = taskData.installationDate;
|
|
completedAction = taskData.completedAction;
|
|
impactStatus = taskData.impactStatus;
|
|
actionNeeded = taskData.actionNeeded;
|
|
typeOfAlert = taskData.typeOfAlert;
|
|
installationBuilding = taskData.installationBuilding;
|
|
installationDepartment = taskData.installationDepartment;
|
|
installationFloor = taskData.installationFloor;
|
|
isUserAcknowledge = taskData.isUserAcknowledge;
|
|
riskLevel = taskData.riskLevel;
|
|
resource = taskData.resource;
|
|
alertNo = taskData.alertNo;
|
|
estimationDeliveryDate = taskData.estimationDeliveryDate;
|
|
reasonOfFSCA = taskData.reasonOfFSCA;
|
|
correctiveActionDescription = taskData.correctiveActionDescription;
|
|
evaluatorUser = taskData.evaluatorUser;
|
|
site = taskData.site;
|
|
building = taskData.building;
|
|
floor = taskData.floor;
|
|
department = taskData.department;
|
|
room = taskData.room;
|
|
|
|
taskTimerModel = taskData.taskTimerModel;
|
|
totalWorkingHours = taskData.totalWorkingHours;
|
|
timerModelList = taskData.timerModelList;
|
|
taskTimePicker = taskData.taskTimePicker;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
data['id'] = id;
|
|
data['statusValue'] = statusValue;
|
|
data['taskJobNo'] = taskJobNo;
|
|
|
|
if (userCreated != null) {
|
|
data['userCreated'] = userCreated!.toJson();
|
|
}
|
|
|
|
if (taskJobContactPersons != null) {
|
|
data['taskJobContactPersons'] = taskJobContactPersons!.map((e) => e.toJson()).toList();
|
|
}
|
|
|
|
if (taskType != null) {
|
|
data['taskType'] = taskType!.toJson();
|
|
}
|
|
|
|
if (taskJobStatus != null) {
|
|
data['taskJobStatus'] = taskJobStatus!.toJson();
|
|
}
|
|
|
|
data['asset'] = asset?.toJson();
|
|
data['site'] = site?.toJson();
|
|
data['building'] = building?.toJson();
|
|
data['floor'] = floor?.toJson();
|
|
data['department'] = department?.toJson();
|
|
data['room'] = room?.toJson();
|
|
data['callComment'] = callComment;
|
|
|
|
if (taskJobAttachments != null) {
|
|
data['taskJobAttachments'] = taskJobAttachments!.map((e) => e.toJson()).toList();
|
|
}
|
|
|
|
if (assignedEngineer != null) {
|
|
data['assignedEngineer'] = assignedEngineer!.toJson();
|
|
}
|
|
|
|
if (taskJobAssistantEmployees != null) {
|
|
data['taskJobAssistantEmployees'] = taskJobAssistantEmployees!.map((v) => v.toJson()).toList();
|
|
}
|
|
|
|
if (taskJobHistories != null) {
|
|
data['taskJobHistories'] = taskJobHistories!.map((e) => e.toJson()).toList();
|
|
}
|
|
|
|
if (installationBuilding != null) {
|
|
data['installationBuilding'] = installationBuilding!.toJson();
|
|
}
|
|
|
|
if (installationFloor != null) {
|
|
data['installationFloor'] = installationFloor!.toJson();
|
|
}
|
|
|
|
if (installationDepartment != null) {
|
|
data['installationDepartment'] = installationDepartment!.toJson();
|
|
}
|
|
|
|
data['serialNo'] = serialNo;
|
|
data['installationDate'] = installationDate;
|
|
|
|
if (completedAction != null) {
|
|
data['completedAction'] = completedAction!.toJson();
|
|
}
|
|
|
|
if (impactStatus != null) {
|
|
data['impactStatus'] = impactStatus!.toJson();
|
|
}
|
|
|
|
data['isUserAcknowledge'] = isUserAcknowledge;
|
|
|
|
if (typeOfAlert != null) {
|
|
data['typeOfAlert'] = typeOfAlert!.toJson();
|
|
}
|
|
|
|
if (riskLevel != null) {
|
|
data['riskLevel'] = riskLevel!.toJson();
|
|
}
|
|
|
|
if (resource != null) {
|
|
data['resource'] = resource!.toJson();
|
|
}
|
|
|
|
if (actionNeeded != null) {
|
|
data['actionNeeded'] = actionNeeded!.toJson();
|
|
}
|
|
|
|
data['alertNo'] = alertNo;
|
|
data['estimationDeliveryDate'] = estimationDeliveryDate;
|
|
data['reasonOfFSCA'] = reasonOfFSCA;
|
|
data['correctiveActionDescription'] = correctiveActionDescription;
|
|
|
|
if (evaluatorUser != null) {
|
|
data['evaluatorUser'] = evaluatorUser!.toJson();
|
|
}
|
|
|
|
if (taskJobActivityEngineerTimers != null) {
|
|
data['taskJobActivityEngineerTimers'] = taskJobActivityEngineerTimers!.map((e) => e.toJson()).toList();
|
|
}
|
|
|
|
return data;
|
|
}
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
// final Map<String, dynamic> data = <String, dynamic>{};
|
|
//
|
|
// data['id'] = id;
|
|
// data['statusValue'] = statusValue;
|
|
// data['taskJobNo'] = taskJobNo;
|
|
//
|
|
// if (userCreated != null) {
|
|
// data['userCreated'] = userCreated!.toJson();
|
|
// }
|
|
//
|
|
// if (taskJobContactPersons != null) {
|
|
// data['taskJobContactPersons'] = taskJobContactPersons!.map((e) => e.toJson()).toList();
|
|
// }
|
|
//
|
|
// if (taskType != null) {
|
|
// data['taskType'] = taskType!.toJson();
|
|
// }
|
|
//
|
|
// if (taskJobStatus != null) {
|
|
// data['taskJobStatus'] = taskJobStatus!.toJson();
|
|
// }
|
|
//
|
|
// data['asset'] = asset?.toJson();
|
|
// data['site'] = site;
|
|
// data['building'] = building;
|
|
// data['floor'] = floor;
|
|
// data['department'] = department;
|
|
// data['room'] = room;
|
|
// data['callComment'] = callComment;
|
|
//
|
|
// if (assignedEngineer != null) {
|
|
// data['assignedEngineer'] = assignedEngineer!.toJson();
|
|
// }
|
|
//
|
|
// if (taskJobAssistantEmployees != null) {
|
|
// data['taskJobAssistantEmployees'] = taskJobAssistantEmployees!.map((v) => v.toJson()).toList();
|
|
// }
|
|
// if (taskJobHistories != null) {
|
|
// data['taskJobHistories'] = taskJobHistories!.map((e) => e.toJson()).toList();
|
|
// }
|
|
// if (installationBuilding != null) {
|
|
// data['installationBuilding'] = installationBuilding!.toJson();
|
|
// }
|
|
// data['installationFloor'] = installationFloor;
|
|
// data['installationDepartment'] = installationDepartment;
|
|
// data['serialNo'] = serialNo;
|
|
// data['installationDate'] = installationDate;
|
|
// data['completedAction'] = completedAction;
|
|
// data['impactStatus'] = impactStatus;
|
|
// data['isUserAcknowledge'] = isUserAcknowledge;
|
|
// data['typeOfAlert'] = typeOfAlert;
|
|
// data['riskLevel'] = riskLevel;
|
|
// data['resource'] = resource;
|
|
// data['actionNeeded'] = actionNeeded;
|
|
// data['alertNo'] = alertNo;
|
|
// data['estimationDeliveryDate'] = estimationDeliveryDate;
|
|
// data['reasonOfFSCA'] = reasonOfFSCA;
|
|
// data['correctiveActionDescription'] = correctiveActionDescription;
|
|
//
|
|
// if (evaluatorUser != null) {
|
|
// data['evaluatorUser'] = evaluatorUser!.toJson();
|
|
// }
|
|
// if (taskJobActivityEngineerTimers != null) {
|
|
// data['taskJobActivityEngineerTimers'] = taskJobActivityEngineerTimers!.map((e) => e.toJson()).toList();
|
|
// }
|
|
// if (taskJobAttachments != null) {
|
|
// data['taskJobAttachments'] = taskJobAttachments?.map((e) => e.toJson()).toList();
|
|
// }
|
|
//
|
|
// return data;
|
|
// }
|
|
|
|
Map<String, dynamic> toEngineerUpdateJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['id'] = id;
|
|
data['statusValue'] = statusValue;
|
|
if (taskJobAssistantEmployees != null && taskJobAssistantEmployees!.isNotEmpty) {
|
|
data['taskJobAssistantEmployees'] = taskJobAssistantEmployees;
|
|
} else {
|
|
data['taskJobAssistantEmployees'] = [];
|
|
}
|
|
if (taskJobActivityEngineerTimers != null) {
|
|
data['taskJobActivityEngineerTimers'] = taskJobActivityEngineerTimers!.map((v) => v.toJson()).toList();
|
|
}
|
|
if (taskJobAttachments != null) {
|
|
data['attachments'] = taskJobAttachments!.map((v) => v.toJson()).toList();
|
|
}
|
|
data['installationBuildingId'] = building?.id;
|
|
data['installationFloorId'] = floor?.id;
|
|
data['installationDepartmentId'] = department?.id;
|
|
data['serialNo'] = serialNo;
|
|
data['installationDate'] = installationDate;
|
|
//this is not for recall and alert type..
|
|
if (taskType?.isRecallAndAlert == true && (typeOfAlert?.value == 2 || typeOfAlert?.value == 3)) {
|
|
data['completedActionId'] = actionNeeded?.id;
|
|
}
|
|
data['impactStatusId'] = impactStatus?.id;
|
|
data['isUserAcknowledge'] = isUserAcknowledge;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class TaskJobActivityEngineerTimer {
|
|
int? id;
|
|
String? startDate;
|
|
String? endDate;
|
|
double? totalWorkingHour;
|
|
String? comment;
|
|
|
|
TaskJobActivityEngineerTimer({
|
|
this.id,
|
|
this.startDate,
|
|
this.endDate,
|
|
this.totalWorkingHour,
|
|
this.comment,
|
|
});
|
|
|
|
factory TaskJobActivityEngineerTimer.fromJson(Map<String, dynamic> json) {
|
|
return TaskJobActivityEngineerTimer(
|
|
id: json['id'] as int?,
|
|
startDate: json['startDate'],
|
|
endDate: json['endDate'],
|
|
totalWorkingHour: (json['totalWorkingHours'] as num?)?.toDouble(),
|
|
comment: json['comment'] as String?,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'startDate': startDate,
|
|
'endDate': endDate,
|
|
'totalWorkingHours': totalWorkingHour,
|
|
'comment': comment,
|
|
};
|
|
}
|
|
}
|
|
|
|
class TaskContactUser {
|
|
String? userId;
|
|
String? userName;
|
|
String? email;
|
|
String? employeeId;
|
|
int? languageId;
|
|
String? extensionNo;
|
|
String? phoneNumber;
|
|
|
|
TaskContactUser({
|
|
this.userId,
|
|
this.userName,
|
|
this.email,
|
|
this.employeeId,
|
|
this.languageId,
|
|
this.extensionNo,
|
|
this.phoneNumber,
|
|
});
|
|
|
|
TaskContactUser.fromJson(Map<String, dynamic> json) {
|
|
userId = json['userId'];
|
|
userName = json['userName'];
|
|
email = json['email'];
|
|
employeeId = json['employeeId'];
|
|
languageId = json['languageId'];
|
|
extensionNo = json['extensionNo'];
|
|
phoneNumber = json['phoneNumber'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'userId': userId,
|
|
'userName': userName,
|
|
'email': email,
|
|
'employeeId': employeeId,
|
|
'languageId': languageId,
|
|
'extensionNo': extensionNo,
|
|
'phoneNumber': phoneNumber,
|
|
};
|
|
}
|
|
}
|
|
|
|
class TaskJobContactPerson {
|
|
final int? id;
|
|
final TaskContactUser? user;
|
|
|
|
TaskJobContactPerson({this.id, this.user});
|
|
|
|
factory TaskJobContactPerson.fromJson(Map<String, dynamic> json) => TaskJobContactPerson(
|
|
id: json['id'],
|
|
user: json['user'] != null ? TaskContactUser.fromJson(json['user']) : null,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'user': user?.toJson(),
|
|
};
|
|
}
|
|
|
|
class TaskTypeModel {
|
|
final int? id;
|
|
final String? typeName;
|
|
final RelatedTo? relatedTo;
|
|
final bool? linkWithMultiAssets;
|
|
final List<dynamic>? taskTypeRoles;
|
|
final bool? isInstallation;
|
|
final bool? isRecallAndAlert;
|
|
|
|
TaskTypeModel({
|
|
this.id,
|
|
this.typeName,
|
|
this.relatedTo,
|
|
this.linkWithMultiAssets,
|
|
this.taskTypeRoles,
|
|
this.isInstallation,
|
|
this.isRecallAndAlert,
|
|
});
|
|
|
|
factory TaskTypeModel.fromJson(Map<String, dynamic> json) => TaskTypeModel(
|
|
id: json['id'],
|
|
typeName: json['typeName'],
|
|
relatedTo: json['relatedTo'] != null ? RelatedTo.fromJson(json['relatedTo']) : null,
|
|
linkWithMultiAssets: json['linkWithMultiAssets'],
|
|
taskTypeRoles: json['taskTypeRoles'],
|
|
isInstallation: json['isInstallation'],
|
|
isRecallAndAlert: json['isRecallAndAlert'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'typeName': typeName,
|
|
'relatedTo': relatedTo?.toJson(),
|
|
'linkWithMultiAssets': linkWithMultiAssets,
|
|
'taskTypeRoles': taskTypeRoles,
|
|
'isInstallation': isInstallation,
|
|
'isRecallAndAlert': isRecallAndAlert,
|
|
};
|
|
}
|
|
|
|
class RelatedTo {
|
|
final int? id;
|
|
final String? name;
|
|
final int? value;
|
|
|
|
RelatedTo({this.id, this.name, this.value});
|
|
|
|
factory RelatedTo.fromJson(Map<String, dynamic> json) => RelatedTo(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
value: json['value'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'value': value,
|
|
};
|
|
}
|
|
|
|
class TaskJobStatus {
|
|
final int? id;
|
|
final String? name;
|
|
final int? value;
|
|
|
|
TaskJobStatus({this.id, this.name, this.value});
|
|
|
|
factory TaskJobStatus.fromJson(Map<String, dynamic> json) => TaskJobStatus(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
value: json['value'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'value': value,
|
|
};
|
|
}
|
|
|
|
class TaskJobAttachment {
|
|
final int? id;
|
|
final String? name;
|
|
String? createdBy;
|
|
|
|
TaskJobAttachment({this.id, this.name, this.createdBy});
|
|
|
|
factory TaskJobAttachment.fromJson(Map<String, dynamic> json) => TaskJobAttachment(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
createdBy: json['createdBy'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'createdBy': createdBy,
|
|
};
|
|
}
|
|
|
|
class TaskJobAssistantEmployees {
|
|
DateTime? startDate;
|
|
int? id;
|
|
String? assistantEnginerId;
|
|
DateTime? endDate;
|
|
double? workingHours;
|
|
String? comment;
|
|
AssignedEmployee? user;
|
|
AssistantEngineer? assistantEngineer;
|
|
AssistantEmployees? employee;
|
|
|
|
TaskJobAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.comment, this.assistantEnginerId, this.user, this.id, this.assistantEngineer});
|
|
|
|
TaskJobAssistantEmployees.fromJson(Map<String, dynamic> json) {
|
|
Map<String, dynamic> assistEmpData = {};
|
|
id = json['id'];
|
|
startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null;
|
|
endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null;
|
|
if (startDate != null && endDate != null) {
|
|
workingHours = endDate!.difference(startDate!).inMinutes / 60.0;
|
|
} else {
|
|
workingHours = null;
|
|
}
|
|
|
|
comment = json['comment'];
|
|
user = json['assistantEnginer'] != null ? AssignedEmployee.fromJson(json['assistantEnginer']) : null;
|
|
if (json['assistantEnginer'] != null) {
|
|
assistEmpData = {
|
|
'id': null,
|
|
'user': {
|
|
'id': user?.userId,
|
|
'name': user?.userName,
|
|
},
|
|
};
|
|
}
|
|
employee = AssistantEmployees.fromJson(assistEmpData);
|
|
assistantEngineer = json['assistantEnginer'] != null ? AssistantEngineer.fromJson(json['assistantEnginer']) : null;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['id'] = id ?? 0;
|
|
data['startDate'] = startDate?.toIso8601String();
|
|
data['endDate'] = endDate?.toIso8601String();
|
|
data['totalWorkingHours'] = workingHours;
|
|
data['comment'] = comment;
|
|
data['assistantEnginerId'] = user?.userId;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class TaskJobHistory {
|
|
final int? id;
|
|
final RelatedTo? action;
|
|
final TaskJobStatus? taskJobStatus;
|
|
final TaskContactUser? user;
|
|
final dynamic typeOfAlert;
|
|
final dynamic riskLevel;
|
|
final dynamic resource;
|
|
final dynamic actionNeeded;
|
|
final TaskContactUser? assignedEmployee;
|
|
final dynamic alertNo;
|
|
final String? estimationDeliveryDate;
|
|
final String? createdDate;
|
|
final BuildingData? installationBuilding;
|
|
final dynamic installationFloor;
|
|
final dynamic installationDepartment;
|
|
final String? installationDate;
|
|
final String? serialNo;
|
|
|
|
TaskJobHistory({
|
|
this.id,
|
|
this.action,
|
|
this.taskJobStatus,
|
|
this.user,
|
|
this.typeOfAlert,
|
|
this.riskLevel,
|
|
this.resource,
|
|
this.actionNeeded,
|
|
this.assignedEmployee,
|
|
this.alertNo,
|
|
this.estimationDeliveryDate,
|
|
this.createdDate,
|
|
this.installationBuilding,
|
|
this.installationFloor,
|
|
this.installationDepartment,
|
|
this.installationDate,
|
|
this.serialNo,
|
|
});
|
|
|
|
factory TaskJobHistory.fromJson(Map<String, dynamic> json) => TaskJobHistory(
|
|
id: json['id'],
|
|
action: json['action'] != null ? RelatedTo.fromJson(json['action']) : null,
|
|
taskJobStatus: json['taskJobStatus'] != null ? TaskJobStatus.fromJson(json['taskJobStatus']) : null,
|
|
user: json['user'] != null ? TaskContactUser.fromJson(json['user']) : null,
|
|
typeOfAlert: json['typeOfAlert'],
|
|
riskLevel: json['riskLevel'],
|
|
resource: json['resource'],
|
|
actionNeeded: json['actionNeeded'],
|
|
assignedEmployee: json['assignedEmployee'] != null ? TaskContactUser.fromJson(json['assignedEmployee']) : null,
|
|
alertNo: json['alertNo'],
|
|
estimationDeliveryDate: json['estimationDeliveryDate'],
|
|
createdDate: json['createdDate'],
|
|
installationBuilding: json['installationBuilding'] != null ? BuildingData.fromJson(json['installationBuilding']) : null,
|
|
installationFloor: json['installationFloor'],
|
|
installationDepartment: json['installationDepartment'],
|
|
installationDate: json['installationDate'],
|
|
serialNo: json['serialNo'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'action': action?.toJson(),
|
|
'taskJobStatus': taskJobStatus?.toJson(),
|
|
'user': user?.toJson(),
|
|
'typeOfAlert': typeOfAlert,
|
|
'riskLevel': riskLevel,
|
|
'resource': resource,
|
|
'actionNeeded': actionNeeded,
|
|
'assignedEmployee': assignedEmployee?.toJson(),
|
|
'alertNo': alertNo,
|
|
'estimationDeliveryDate': estimationDeliveryDate,
|
|
'createdDate': createdDate,
|
|
'installationBuilding': installationBuilding?.toJson(),
|
|
'installationFloor': installationFloor,
|
|
'installationDepartment': installationDepartment,
|
|
'installationDate': installationDate,
|
|
'serialNo': serialNo,
|
|
};
|
|
}
|
|
|
|
class BuildingData {
|
|
final int? id;
|
|
final String? name;
|
|
final int? value;
|
|
|
|
BuildingData({this.id, this.name, this.value});
|
|
|
|
factory BuildingData.fromJson(Map<String, dynamic> json) => BuildingData(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
value: json['value'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'value': value,
|
|
};
|
|
}
|
|
|
|
class AddTaskModel {
|
|
int? id;
|
|
int? taskTypeId;
|
|
List<int>? assetIds = [];
|
|
MappedSite? site;
|
|
MappedBuilding? building;
|
|
MappedFloor? floor;
|
|
MappedDepartment? department;
|
|
Rooms? room;
|
|
String? callComment;
|
|
Lookup? typeOfAlert;
|
|
Lookup? riskLevel;
|
|
Lookup? resource;
|
|
Lookup? actionNeeded;
|
|
TaskEvaluatorUser? taskEvaluatorUser;
|
|
String? alertNo;
|
|
String? estimationDeliveryDate;
|
|
List<TaskJobAttachment>? attachments;
|
|
String? reasonOfFSCA;
|
|
String? correctiveActionDescription;
|
|
|
|
AddTaskModel({
|
|
this.id,
|
|
this.taskTypeId,
|
|
this.assetIds,
|
|
this.site,
|
|
this.building,
|
|
this.floor,
|
|
this.department,
|
|
this.room,
|
|
this.callComment,
|
|
this.typeOfAlert,
|
|
this.riskLevel,
|
|
this.resource,
|
|
this.actionNeeded,
|
|
this.alertNo,
|
|
this.estimationDeliveryDate,
|
|
this.attachments,
|
|
this.reasonOfFSCA,
|
|
this.taskEvaluatorUser,
|
|
this.correctiveActionDescription,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'taskTypeId': taskTypeId,
|
|
'assetIds': assetIds ?? [],
|
|
'siteId': site?.id,
|
|
'buildingId': building?.clientBuildingId,
|
|
'floorId': floor?.clientFloorId,
|
|
'departmentId': department?.departmentId,
|
|
'roomId': room?.id,
|
|
'callComment': callComment,
|
|
'typeOfAlertId': typeOfAlert?.id,
|
|
'riskLevelId': riskLevel?.id,
|
|
'resourceId': resource?.id,
|
|
'actionNeededId': actionNeeded?.id,
|
|
'alertNo': alertNo,
|
|
'estimationDeliveryDate': estimationDeliveryDate,
|
|
'reasonOfFSCA': reasonOfFSCA,
|
|
'correctiveActionDescription': correctiveActionDescription,
|
|
'evaluatorUserId': taskEvaluatorUser?.userId,
|
|
'attachments': attachments?.map((x) => x.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
class TaskEvaluatorUser extends Base {
|
|
String? userId;
|
|
String? userName;
|
|
String? email;
|
|
String? employeeId;
|
|
int? languageId;
|
|
|
|
TaskEvaluatorUser({this.userId, this.userName, this.email, this.employeeId, this.languageId}) : super(name: userName, identifier: userId?.toString());
|
|
|
|
factory TaskEvaluatorUser.fromJson(Map<String, dynamic> json) {
|
|
return TaskEvaluatorUser(userId: json['userId'], userName: json['userName'], email: json['email'], employeeId: json['employeeId'], languageId: json['languageId']);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['userId'] = userId;
|
|
data['userName'] = userName;
|
|
data['email'] = email;
|
|
data['employeeId'] = employeeId;
|
|
data['languageId'] = languageId;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class AssistantEngineer {
|
|
String? userId;
|
|
String? userName;
|
|
String? email;
|
|
String? employeeId;
|
|
int? languageId;
|
|
|
|
AssistantEngineer({this.userId, this.userName, this.email, this.employeeId, this.languageId});
|
|
|
|
factory AssistantEngineer.fromJson(Map<String, dynamic> json) {
|
|
return AssistantEngineer(userId: json['userId'], userName: json['userName'], email: json['email'], employeeId: json['employeeId'], languageId: json['languageId']);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['userId'] = userId;
|
|
data['userName'] = userName;
|
|
data['email'] = email;
|
|
data['employeeId'] = employeeId;
|
|
data['languageId'] = languageId;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class TaskAsset {
|
|
int? id;
|
|
String? assetNumber;
|
|
String? serialNo;
|
|
String? assetName;
|
|
String? model;
|
|
String? manufacturer;
|
|
String? siteName;
|
|
int? siteId;
|
|
String? buildingName;
|
|
String? floorName;
|
|
String? departmentName;
|
|
String? roomName;
|
|
String? supplierName;
|
|
String? assetTypeName;
|
|
String? poNumber;
|
|
String? installationDate;
|
|
|
|
TaskAsset();
|
|
|
|
TaskAsset.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
assetNumber = json['assetNumber'];
|
|
serialNo = json['serialNo'];
|
|
assetName = json['assetName'];
|
|
model = json['model'];
|
|
manufacturer = json['manufacturer'];
|
|
siteName = json['siteName'];
|
|
siteId = json['siteId'];
|
|
buildingName = json['buildingName'];
|
|
floorName = json['floorName'];
|
|
departmentName = json['departmentName'];
|
|
roomName = json['roomName'];
|
|
supplierName = json['supplierName'];
|
|
assetTypeName = json['assetTypeName'];
|
|
poNumber = json['poNumber'];
|
|
installationDate = json['installationDate'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'assetNumber': assetNumber,
|
|
'serialNo': serialNo,
|
|
'assetName': assetName,
|
|
'model': model,
|
|
'manufacturer': manufacturer,
|
|
'siteName': siteName,
|
|
'siteId': siteId,
|
|
'buildingName': buildingName,
|
|
'floorName': floorName,
|
|
'departmentName': departmentName,
|
|
'roomName': roomName,
|
|
'supplierName': supplierName,
|
|
'assetTypeName': assetTypeName,
|
|
'poNumber': poNumber,
|
|
'installationDate': installationDate,
|
|
};
|
|
}
|