feat: order search
This commit is contained in:
@@ -272,18 +272,26 @@ class OrderRemoteDatasource {
|
||||
String status = 'completed',
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
String? search,
|
||||
}) async {
|
||||
try {
|
||||
final authData = await AuthLocalDataSource().getAuthData();
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'page': page,
|
||||
'limit': limit,
|
||||
'status': status,
|
||||
'date_from': DateFormat('dd-MM-yyyy').format(dateFrom),
|
||||
'date_to': DateFormat('dd-MM-yyyy').format(dateTo),
|
||||
};
|
||||
|
||||
if (search != null && search.isNotEmpty) {
|
||||
params['search'] = search;
|
||||
}
|
||||
|
||||
final response = await dio.get(
|
||||
'${Variables.baseUrl}/api/v1/orders',
|
||||
queryParameters: {
|
||||
'page': page,
|
||||
'limit': limit,
|
||||
'status': status,
|
||||
'date_from': DateFormat('dd-MM-yyyy').format(dateFrom),
|
||||
'date_to': DateFormat('dd-MM-yyyy').format(dateTo),
|
||||
},
|
||||
queryParameters: params,
|
||||
options: Options(
|
||||
headers: {
|
||||
'Authorization': 'Bearer ${authData.token}',
|
||||
|
||||
Reference in New Issue
Block a user