Asset Transfer Search Dialog Done
parent
5aedb12004
commit
90fe4e76b7
@ -1,49 +1,64 @@
|
|||||||
import '../lookup.dart';
|
import 'package:test_sa/models/device/device.dart';
|
||||||
|
|
||||||
|
import '../hospital.dart';
|
||||||
|
|
||||||
class DeviceTransferSearch {
|
class DeviceTransferSearch {
|
||||||
String assetName, assetNumber, site;
|
Device device;
|
||||||
|
String title, room;
|
||||||
bool mostRecent;
|
bool mostRecent;
|
||||||
Lookup dateOperator;
|
Hospital hospital;
|
||||||
String from, to;
|
Buildings building;
|
||||||
|
List<Buildings> buildingsList;
|
||||||
|
Floors floor;
|
||||||
|
List<Floors> floorsList;
|
||||||
|
Departments department;
|
||||||
|
List<Departments> departmentsList;
|
||||||
|
|
||||||
DeviceTransferSearch({
|
DeviceTransferSearch({
|
||||||
this.assetName,
|
this.device,
|
||||||
this.assetNumber,
|
this.hospital,
|
||||||
this.site,
|
this.building,
|
||||||
|
this.floor,
|
||||||
|
this.department,
|
||||||
|
this.room,
|
||||||
|
this.title,
|
||||||
this.mostRecent,
|
this.mostRecent,
|
||||||
this.dateOperator,
|
|
||||||
this.from,
|
|
||||||
this.to,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
Map<String, dynamic> search = {};
|
Map<String, dynamic> search = {};
|
||||||
if (assetName != null && assetName.isNotEmpty) {
|
if (title != null && title.isNotEmpty) {
|
||||||
search["assetName"] = assetName;
|
search["transferCode"] = title;
|
||||||
|
}
|
||||||
|
if (device != null) {
|
||||||
|
search["assetId"] = device.id;
|
||||||
|
}
|
||||||
|
if (hospital?.id != null) {
|
||||||
|
search["destSiteId"] = hospital.id;
|
||||||
}
|
}
|
||||||
if (assetNumber != null && assetNumber.isNotEmpty) {
|
if (building?.id != null) {
|
||||||
search["assetNumber"] = assetNumber;
|
search["destBuildingId"] = building.id;
|
||||||
}
|
}
|
||||||
if (site != null && site.isNotEmpty) {
|
if (floor?.id != null) {
|
||||||
search["site"] = site;
|
search["destFloorId"] = floor.id;
|
||||||
}
|
}
|
||||||
if (dateOperator != null && from != null) {
|
if (department?.id != null) {
|
||||||
search["requestedDateSymbol"] = dateOperator.toMap();
|
search["destDepartmentId"] = department.id;
|
||||||
search["requestedDateFrom"] = from;
|
|
||||||
}
|
}
|
||||||
if (dateOperator != null && to != null) {
|
if (room != null && room.isNotEmpty) {
|
||||||
search["requestedDateTo"] = to;
|
search["destRoom"] = department.id;
|
||||||
}
|
}
|
||||||
return search;
|
return search;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fromSearch(DeviceTransferSearch newSearch) {
|
void fromSearch(DeviceTransferSearch newSearch) {
|
||||||
assetName = newSearch.assetName;
|
title = newSearch.title;
|
||||||
assetNumber = newSearch.assetNumber;
|
room = newSearch.room;
|
||||||
site = newSearch.site;
|
|
||||||
mostRecent = newSearch.mostRecent;
|
mostRecent = newSearch.mostRecent;
|
||||||
from = newSearch.from;
|
device = newSearch.device;
|
||||||
to = newSearch.to;
|
hospital = newSearch.hospital;
|
||||||
dateOperator = newSearch.dateOperator;
|
building = newSearch.building;
|
||||||
|
floor = newSearch.floor;
|
||||||
|
department = newSearch.department;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue