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.
84 lines
2.1 KiB
Dart
84 lines
2.1 KiB
Dart
class VisitsSearch{
|
|
String? deviceSerialNumber;
|
|
String? hospitalName;
|
|
String? brand;
|
|
String? model;
|
|
String? contactStatus;
|
|
DateTime? expectedDateFrom;
|
|
DateTime? expectedDateTo;
|
|
DateTime? actualDateFrom;
|
|
DateTime? actualDateTo;
|
|
int? statusValue;
|
|
|
|
VisitsSearch({
|
|
this.deviceSerialNumber,
|
|
this.statusValue,
|
|
this.brand,
|
|
this.hospitalName,
|
|
this.actualDateTo,
|
|
this.actualDateFrom,
|
|
this.model,
|
|
this.contactStatus,
|
|
this.expectedDateFrom,
|
|
this.expectedDateTo,
|
|
});
|
|
|
|
fromSearch(VisitsSearch newSearch){
|
|
deviceSerialNumber = newSearch.deviceSerialNumber;
|
|
brand = newSearch.brand;
|
|
hospitalName = newSearch.hospitalName;
|
|
actualDateTo = newSearch.actualDateTo;
|
|
actualDateFrom = newSearch.actualDateFrom;
|
|
model = newSearch.model;
|
|
contactStatus = newSearch.contactStatus;
|
|
expectedDateFrom = newSearch.expectedDateFrom;
|
|
expectedDateTo = newSearch.expectedDateTo;
|
|
statusValue = newSearch.statusValue;
|
|
}
|
|
|
|
String toSearchString(){
|
|
String _search = "";
|
|
if(deviceSerialNumber != null && (deviceSerialNumber?.isNotEmpty??false)){
|
|
_search += "&sn_id=$deviceSerialNumber";
|
|
}
|
|
|
|
if(hospitalName != null && (hospitalName?.isNotEmpty??false)){
|
|
_search += "&client=$hospitalName";
|
|
}
|
|
|
|
if(brand != null && (brand?.isNotEmpty??false)){
|
|
_search += "&brand=$brand";
|
|
}
|
|
|
|
if(model != null && (model?.isNotEmpty??false)){
|
|
_search += "&model=$model";
|
|
}
|
|
|
|
if(expectedDateFrom != null){
|
|
_search += "&expected_date_from=${(expectedDateFrom?.millisecondsSinceEpoch??0) ~/ 1000}";
|
|
}
|
|
|
|
if(expectedDateTo != null){
|
|
_search += "&expected_date_to=${(expectedDateTo?.millisecondsSinceEpoch??0) ~/1000}";
|
|
}
|
|
|
|
if(actualDateFrom != null){
|
|
_search += "&actual_date_from=${(actualDateFrom?.millisecondsSinceEpoch??0) ~/ 1000}";
|
|
}
|
|
|
|
if(actualDateTo != null){
|
|
_search += "&actual_date_to=${(actualDateTo?.millisecondsSinceEpoch??0) ~/1000}";
|
|
}
|
|
|
|
if(statusValue != null){
|
|
_search += "&status=$statusValue";
|
|
}
|
|
|
|
if(contactStatus != null){
|
|
_search += "&assigned_to=$contactStatus";
|
|
}
|
|
return _search;
|
|
}
|
|
}
|
|
|