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.
57 lines
1.3 KiB
Dart
57 lines
1.3 KiB
Dart
import 'package:test_sa/models/hospital.dart';
|
|
import 'package:test_sa/models/lookup.dart';
|
|
|
|
class ServiceRequestSearch {
|
|
String deviceSerialNumber;
|
|
String deviceNumber;
|
|
String deviceName;
|
|
Hospital hospital;
|
|
String model;
|
|
Lookup statusValue;
|
|
|
|
ServiceRequestSearch({
|
|
this.deviceSerialNumber,
|
|
this.deviceNumber,
|
|
this.statusValue,
|
|
this.deviceName,
|
|
this.model,
|
|
this.hospital,
|
|
});
|
|
|
|
fromSearch(ServiceRequestSearch newSearch) {
|
|
deviceSerialNumber = newSearch.deviceSerialNumber;
|
|
deviceNumber = newSearch.deviceNumber;
|
|
statusValue = newSearch.statusValue;
|
|
hospital = newSearch.hospital;
|
|
model = newSearch.model;
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
Map<String, dynamic> search = {};
|
|
if (deviceSerialNumber != null && deviceSerialNumber.isNotEmpty) {
|
|
search["assetSerialNumber"] = deviceSerialNumber;
|
|
}
|
|
|
|
if (deviceNumber != null && deviceNumber.isNotEmpty) {
|
|
search["assetNo"] = deviceNumber;
|
|
}
|
|
|
|
if (statusValue != null) {
|
|
search["status"] = statusValue.toMap();
|
|
}
|
|
|
|
if (deviceName != null && deviceName.isNotEmpty) {
|
|
search["assetName"] = deviceName;
|
|
}
|
|
|
|
if (hospital != null) {
|
|
search["site"] = hospital.name;
|
|
}
|
|
|
|
if (model != null) {
|
|
search["modelDefinition"] = model;
|
|
}
|
|
return search;
|
|
}
|
|
}
|