|
|
|
|
@ -29,13 +29,13 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
AllRequestsAndCount calendarRequests;
|
|
|
|
|
|
|
|
|
|
final pageItemNumber = 10;
|
|
|
|
|
int pageNum=1;
|
|
|
|
|
int pageNum = 1;
|
|
|
|
|
bool nextPage = true;
|
|
|
|
|
|
|
|
|
|
void reset() {
|
|
|
|
|
allRequestsAndCount?.requestsDetails?.clear();
|
|
|
|
|
allRequestsAndCount = null;
|
|
|
|
|
pageNum=1;
|
|
|
|
|
pageNum = 1;
|
|
|
|
|
nextPage = true;
|
|
|
|
|
stateCode = null;
|
|
|
|
|
}
|
|
|
|
|
@ -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]
|
|
|
|
|
@ -65,8 +74,8 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
"statusTransaction": status,
|
|
|
|
|
"priority": [0, 1],
|
|
|
|
|
"displayData": [],
|
|
|
|
|
"pageNumber" : pageNum++,
|
|
|
|
|
"pageSize" : pageItemNumber,
|
|
|
|
|
"pageNumber": pageNum++,
|
|
|
|
|
"pageSize": pageItemNumber,
|
|
|
|
|
if (search?.requestNumber?.value?.isNotEmpty ?? false) "requestNumber": search.requestNumber.value,
|
|
|
|
|
if (search?.assetName?.value?.isNotEmpty ?? false) "assetName": search.assetName.value,
|
|
|
|
|
if (search?.assetNo?.value?.isNotEmpty ?? false) "assetNumber": search.assetNo.value,
|
|
|
|
|
@ -82,7 +91,7 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
|
|
|
if (allRequestsAndCount == null) {
|
|
|
|
|
allRequestsAndCount = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
|
|
|
|
|
} else{
|
|
|
|
|
} else {
|
|
|
|
|
allRequestsAndCount.requestsDetails.addAll(AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]).requestsDetails);
|
|
|
|
|
}
|
|
|
|
|
if (allRequestsAndCount.requestsDetails.length >= pageItemNumber) {
|
|
|
|
|
@ -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 {
|
|
|
|
|
@ -183,7 +193,7 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
stateCode = response.statusCode;
|
|
|
|
|
if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
|
|
|
overdueRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
|
|
|
|
|
overdueRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"][0]);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
isOverdueLoading = false;
|
|
|
|
|
|