Merge branch with resolved conflicts - restructured features and added new modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
||||
=
|
||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class GenocideLogic extends GetxController {
|
||||
@@ -44,7 +45,8 @@ class GenocideLogic extends GetxController {
|
||||
if (loadingMore) {
|
||||
isLoadingMore.value = true;
|
||||
} else {
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.loading();
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -69,20 +71,25 @@ class GenocideLogic extends GetxController {
|
||||
onSuccess: (res) async {
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.empty();
|
||||
} else {
|
||||
if (loadingMore) {
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
|
||||
PaginationModel<PoultryOrder>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.success(
|
||||
PaginationModel<PoultryOrder>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(poultryOrderList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(res!);
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.success(res!);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -134,10 +141,8 @@ class GenocideLogic extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> onRefresh() async {
|
||||
currentPage.value = 1;
|
||||
await getPoultryOrderList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user