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/service_request/service_request_search.dart

57 lines
1.3 KiB
Dart

3 years ago
import 'package:test_sa/models/hospital.dart';
import 'package:test_sa/models/lookup.dart';
class ServiceRequestSearch {
3 years ago
String deviceSerialNumber;
3 years ago
String deviceNumber;
3 years ago
String deviceName;
3 years ago
Hospital hospital;
3 years ago
String model;
3 years ago
Lookup statusValue;
3 years ago
ServiceRequestSearch({
this.deviceSerialNumber,
3 years ago
this.deviceNumber,
3 years ago
this.statusValue,
this.deviceName,
this.model,
this.hospital,
});
fromSearch(ServiceRequestSearch newSearch) {
3 years ago
deviceSerialNumber = newSearch.deviceSerialNumber;
3 years ago
deviceNumber = newSearch.deviceNumber;
3 years ago
statusValue = newSearch.statusValue;
hospital = newSearch.hospital;
model = newSearch.model;
}
Map<String, dynamic> toMap() {
Map<String, dynamic> search = {};
if (deviceSerialNumber != null && deviceSerialNumber.isNotEmpty) {
3 years ago
search["assetSerialNumber"] = deviceSerialNumber;
}
if (deviceNumber != null && deviceNumber.isNotEmpty) {
3 years ago
search["assetNo"] = deviceNumber;
3 years ago
}
if (statusValue != null) {
3 years ago
search["status"] = statusValue.toMap();
3 years ago
}
if (deviceName != null && deviceName.isNotEmpty) {
3 years ago
search["assetName"] = deviceName;
3 years ago
}
if (hospital != null) {
3 years ago
search["site"] = hospital.name;
3 years ago
}
3 years ago
if (model != null) {
3 years ago
search["modelDefinition"] = model;
3 years ago
}
3 years ago
return search;
3 years ago
}
}