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.
96 lines
2.3 KiB
Dart
96 lines
2.3 KiB
Dart
import 'package:test_sa/models/hospital.dart';
|
|
import 'package:test_sa/models/lookup.dart';
|
|
|
|
class VisitsSearch {
|
|
String deviceSerialNumber;
|
|
String deviceName;
|
|
String deviceNumber;
|
|
Hospital hospital;
|
|
String brand;
|
|
Lookup model;
|
|
Lookup contactStatus;
|
|
DateTime expectedDateFrom;
|
|
DateTime expectedDateTo;
|
|
DateTime actualDateFrom;
|
|
DateTime actualDateTo;
|
|
Lookup statusValue;
|
|
bool mostRecent;
|
|
|
|
VisitsSearch({
|
|
this.deviceSerialNumber,
|
|
this.statusValue,
|
|
this.brand,
|
|
this.hospital,
|
|
this.actualDateTo,
|
|
this.actualDateFrom,
|
|
this.model,
|
|
this.contactStatus,
|
|
this.expectedDateFrom,
|
|
this.expectedDateTo,
|
|
this.deviceNumber,
|
|
this.deviceName
|
|
this.mostRecent,
|
|
});
|
|
|
|
fromSearch(VisitsSearch newSearch) {
|
|
deviceSerialNumber = newSearch.deviceSerialNumber;
|
|
brand = newSearch.brand;
|
|
hospital = newSearch.hospital;
|
|
actualDateTo = newSearch.actualDateTo;
|
|
actualDateFrom = newSearch.actualDateFrom;
|
|
model = newSearch.model;
|
|
contactStatus = newSearch.contactStatus;
|
|
expectedDateFrom = newSearch.expectedDateFrom;
|
|
expectedDateTo = newSearch.expectedDateTo;
|
|
statusValue = newSearch.statusValue;
|
|
mostRecent = newSearch.mostRecent;
|
|
deviceNumber=newSearch.deviceNumber;
|
|
deviceName=newSearch.deviceName;
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
Map<String, dynamic> _search = {};
|
|
if (deviceSerialNumber != null && deviceSerialNumber.isNotEmpty) {
|
|
_search["assetId"] = deviceSerialNumber;
|
|
}
|
|
|
|
if (hospital != null) {
|
|
_search["siteId"] = hospital.id;
|
|
}
|
|
|
|
if (brand != null && brand.isNotEmpty) {
|
|
// todo get new key
|
|
_search[""] = brand;
|
|
}
|
|
|
|
if (model != null) {
|
|
_search["modelId"] = model.id;
|
|
}
|
|
|
|
if (expectedDateFrom != null) {
|
|
_search["expectedDateFrom"] = expectedDateFrom.toIso8601String();
|
|
}
|
|
|
|
if (expectedDateTo != null) {
|
|
_search["expectedDateTo"] = expectedDateTo.toIso8601String();
|
|
}
|
|
|
|
if (actualDateFrom != null) {
|
|
_search["actualDateFrom"] = actualDateFrom.toIso8601String();
|
|
}
|
|
|
|
if (actualDateTo != null) {
|
|
_search["actualDateTo"] = actualDateTo.toIso8601String();
|
|
}
|
|
|
|
if (statusValue != null) {
|
|
_search["visitStatusId"] = statusValue.id;
|
|
}
|
|
|
|
if (contactStatus != null) {
|
|
_search["assignedToId"] = contactStatus.id;
|
|
}
|
|
return _search;
|
|
}
|
|
}
|