|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:http/http.dart';
|
|
|
|
import 'package:http/http.dart';
|
|
|
|
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
|
|
|
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
|
|
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
import 'package:test_sa/models/all_requests_and_count_model.dart';
|
|
|
|
import 'package:test_sa/models/all_requests_and_count_model.dart';
|
|
|
|
import 'package:test_sa/models/enums/user_types.dart';
|
|
|
|
import 'package:test_sa/models/enums/user_types.dart';
|
|
|
|
import 'package:test_sa/models/ppm/recurrent_wo.dart';
|
|
|
|
import 'package:test_sa/models/ppm/recurrent_wo.dart';
|
|
|
|
@ -130,6 +131,24 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
SearchAllRequestsModel? searchedModel;
|
|
|
|
SearchAllRequestsModel? searchedModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<int> getStatues(BuildContext context) {
|
|
|
|
|
|
|
|
List<int> list = [1, 2, 3, 4];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (context.userProvider.user!.type != UsersTypes.normal_user) {
|
|
|
|
|
|
|
|
list.add(5);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
list.add(6); // task module
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (context.settingProvider.isUserFlowMedical && context.userProvider.user!.type != UsersTypes.normal_user) {
|
|
|
|
|
|
|
|
list.add(7); // task mod
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (context.userProvider.user!.type != UsersTypes.normal_user) {
|
|
|
|
|
|
|
|
// list.add(8); //
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<int> getAllRequests(BuildContext context, {int? typeTransaction, SearchAllRequestsModel? search}) async {
|
|
|
|
Future<int> getAllRequests(BuildContext context, {int? typeTransaction, SearchAllRequestsModel? search}) async {
|
|
|
|
if (isAllLoading == true) return -2;
|
|
|
|
if (isAllLoading == true) return -2;
|
|
|
|
isAllLoading = true;
|
|
|
|
isAllLoading = true;
|
|
|
|
@ -143,7 +162,7 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
final type = typeTransaction == null
|
|
|
|
final type = typeTransaction == null
|
|
|
|
? search?.typeTransaction == null || (search?.typeTransaction?.isEmpty ?? false)
|
|
|
|
? search?.typeTransaction == null || (search?.typeTransaction?.isEmpty ?? false)
|
|
|
|
? [1, 2, 3, 4, 5, 6,7]
|
|
|
|
? getStatues(context)
|
|
|
|
: search!.typeTransaction
|
|
|
|
: search!.typeTransaction
|
|
|
|
: [typeTransaction];
|
|
|
|
: [typeTransaction];
|
|
|
|
List<int> status = (search?.statuses == null || (search?.statuses?.isEmpty ?? false)) ? (((search?.isArchived ?? false) ? [3] : [1, 2, 4])) : search!.statuses!;
|
|
|
|
List<int> status = (search?.statuses == null || (search?.statuses?.isEmpty ?? false)) ? (((search?.isArchived ?? false) ? [3] : [1, 2, 4])) : search!.statuses!;
|
|
|
|
|