device transfer added in filters

main_design2.0
Sikander Saleem 2 years ago
parent cfa749ab74
commit 9101783703

@ -48,12 +48,21 @@ class AllRequestsProvider extends ChangeNotifier {
getCompletedRequests();
}
SearchAllRequestsModel searchedModel;
Future<int> getAllRequests(BuildContext context, {int typeTransaction, SearchAllRequestsModel search}) async {
if (isAllLoading == true) return -2;
isAllLoading = true;
if (allRequestsAndCount == null) notifyListeners();
Response response;
try {
if (search != null) {
searchedModel = search;
} else if (searchedModel != null) {
search = searchedModel;
} else {
searchedModel = null;
}
final type = typeTransaction == null
? search?.typeTransaction == null || search.typeTransaction.isEmpty
? [1, 2, 3, 4]
@ -140,7 +149,8 @@ class AllRequestsProvider extends ChangeNotifier {
Future<int> getHighPriorityRequests() async {
if (isHighPriorityLoading == true) return -2;
isHighPriorityLoading = true; notifyListeners();
isHighPriorityLoading = true;
notifyListeners();
if (highPriorityRequests == null) notifyListeners();
Response response;
try {

@ -56,8 +56,9 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
}
final types = {
context.translation.serviceRequest: 1,
context.translation.preventiveMaintenance: 4,
context.translation.gasRefill: 2,
context.translation.deviceTransfer: 3,
context.translation.preventiveMaintenance: 4,
};
final statuses = {
context.translation.allRequests: 0,
@ -78,6 +79,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
context.translation.reset,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.blueStatus(context)),
).paddingAll(8).onPress(() {
Provider.of<AllRequestsProvider>(context, listen: false).searchedModel = null;
setState(() {
search.statuses?.clear();
search.typeTransaction?.clear();
@ -164,6 +166,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
if (search.startDate != null) search.endDate ??= DateTime.now();
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
requestsProvider.reset();
requestsProvider.searchedModel = search;
await requestsProvider.getAllRequests(context, search: search);
Navigator.pop(context);
Navigator.of(context).pop(search);

Loading…
Cancel
Save