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