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.
74 lines
2.0 KiB
Dart
74 lines
2.0 KiB
Dart
|
2 months ago
|
class CleanerTaskSearchResult {
|
||
|
|
int? id;
|
||
|
|
String? taskNo;
|
||
|
|
String? siteName;
|
||
|
|
String? buildingName;
|
||
|
|
String? floorName;
|
||
|
|
String? departmentName;
|
||
|
|
String? roomName;
|
||
|
|
String? locationDescription;
|
||
|
|
String? createdDate;
|
||
|
|
|
||
|
|
CleanerTaskSearchResult({
|
||
|
|
this.id,
|
||
|
|
this.taskNo,
|
||
|
|
this.siteName,
|
||
|
|
this.buildingName,
|
||
|
|
this.floorName,
|
||
|
|
this.departmentName,
|
||
|
|
this.roomName,
|
||
|
|
this.locationDescription,
|
||
|
|
this.createdDate,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory CleanerTaskSearchResult.fromJson(Map<String, dynamic> json) {
|
||
|
|
return CleanerTaskSearchResult(
|
||
|
|
id: json['id'],
|
||
|
|
taskNo: json['taskNo'],
|
||
|
|
siteName: json['siteName'],
|
||
|
|
buildingName: json['buildingName'],
|
||
|
|
floorName: json['floorName'],
|
||
|
|
departmentName: json['departmentName'],
|
||
|
|
roomName: json['roomName'],
|
||
|
|
locationDescription: json['locationDescription'],
|
||
|
|
createdDate: json['createdDate'],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toJson() {
|
||
|
|
return {
|
||
|
|
'id': id,
|
||
|
|
'taskNo': taskNo,
|
||
|
|
'siteName': siteName,
|
||
|
|
'buildingName': buildingName,
|
||
|
|
'floorName': floorName,
|
||
|
|
'departmentName': departmentName,
|
||
|
|
'roomName': roomName,
|
||
|
|
'locationDescription': locationDescription,
|
||
|
|
'createdDate': createdDate,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
String get fullLocation {
|
||
|
|
List<String> parts = [];
|
||
|
|
if (siteName != null && siteName!.isNotEmpty) parts.add(siteName!);
|
||
|
|
if (buildingName != null && buildingName!.isNotEmpty) parts.add(buildingName!);
|
||
|
|
if (floorName != null && floorName!.isNotEmpty) parts.add(floorName!);
|
||
|
|
if (departmentName != null && departmentName!.isNotEmpty) parts.add(departmentName!);
|
||
|
|
if (roomName != null && roomName!.isNotEmpty) parts.add('Room $roomName');
|
||
|
|
return parts.join(' - ');
|
||
|
|
}
|
||
|
|
|
||
|
|
String get departmentRoom {
|
||
|
|
if (departmentName != null && roomName != null) {
|
||
|
|
return '$departmentName / $roomName';
|
||
|
|
} else if (departmentName != null) {
|
||
|
|
return departmentName!;
|
||
|
|
} else if (roomName != null) {
|
||
|
|
return 'Room $roomName';
|
||
|
|
}
|
||
|
|
return '';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|