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/device/device_transfer_search.dart

68 lines
1.6 KiB
Dart

import '../hospital.dart';
import 'asset.dart';
@Deprecated("Use asset_transfer_search.dart instead of this one")
class DeviceTransferSearch {
Asset device;
String title, room;
bool mostRecent;
Hospital hospital;
Buildings building;
List<Buildings> buildingsList;
Floors floor;
List<Floors> floorsList;
Departments department;
List<Departments> departmentsList;
DeviceTransferSearch({
this.device,
this.hospital,
this.building,
this.floor,
this.department,
this.room,
this.title,
this.mostRecent = true,
});
Map<String, dynamic> toMap() {
Map<String, dynamic> search = {};
if (title != null && title.isNotEmpty) {
search["transferCode"] = title;
}
if (device != null) {
search["assetId"] = device.id;
}
if (mostRecent != null) {
search["mostRecent"] = mostRecent;
}
if (hospital?.id != null) {
search["destSiteId"] = hospital.id;
}
if (building?.id != null) {
search["destBuildingId"] = building.id;
}
if (floor?.id != null) {
search["destFloorId"] = floor.id;
}
if (department?.id != null) {
search["destDepartmentId"] = department.id;
}
if (room != null && room.isNotEmpty) {
search["destRoom"] = department.id;
}
return search;
}
void fromSearch(DeviceTransferSearch newSearch) {
title = newSearch.title;
room = newSearch.room;
mostRecent = newSearch.mostRecent;
device = newSearch.device;
hospital = newSearch.hospital;
building = newSearch.building;
floor = newSearch.floor;
department = newSearch.department;
}
}