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/visits/visits_search.dart

54 lines
2.0 KiB
Dart

class VisitsSearch {
String? deviceSerialNumber;
String? hospitalName;
String? brand;
String? model;
String? contactStatus;
DateTime? expectedDateFrom;
DateTime? expectedDateTo;
DateTime? actualDateFrom;
DateTime? actualDateTo;
int? statusValue;
3 years ago
VisitsSearch({
this.deviceSerialNumber,
this.statusValue,
this.brand,
this.hospitalName,
this.actualDateTo,
this.actualDateFrom,
this.model,
this.contactStatus,
this.expectedDateFrom,
this.expectedDateTo,
});
fromSearch(VisitsSearch newSearch) {
3 years ago
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;
}
Map<String, dynamic> queryParameters() {
return <String, dynamic>{
if (deviceSerialNumber != null && (deviceSerialNumber?.isNotEmpty ?? false)) 'sn_id': deviceSerialNumber,
if (statusValue != null) 'status': statusValue?.toString(),
if (hospitalName != null && (hospitalName?.isNotEmpty ?? false)) 'client': hospitalName,
if (brand != null && (brand?.isNotEmpty ?? false)) 'brand': brand,
if (model != null && (model?.isNotEmpty ?? false)) 'model': model,
if (expectedDateFrom != null) 'expected_date_from': (expectedDateFrom?.millisecondsSinceEpoch ?? 0) ~/ 1000,
if (expectedDateTo != null) 'expected_date_to': (expectedDateTo?.millisecondsSinceEpoch ?? 0) ~/ 1000,
if (actualDateFrom != null) 'actual_date_from': (actualDateFrom?.millisecondsSinceEpoch ?? 0) ~/ 1000,
if (actualDateTo != null) 'actual_date_to': (actualDateTo?.millisecondsSinceEpoch ?? 0) ~/ 1000,
if (contactStatus != null) 'assigned_to': contactStatus,
};
3 years ago
}
}