|
|
|
|
@ -12,7 +12,7 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
bool isAllLoading = false;
|
|
|
|
|
bool isOpenLoading = false;
|
|
|
|
|
bool isInProgressLoading = false;
|
|
|
|
|
bool isCloseLoading = false;
|
|
|
|
|
bool isCompleteLoading = false;
|
|
|
|
|
bool isOverdueLoading = false;
|
|
|
|
|
bool isHighPriorityLoading = false;
|
|
|
|
|
bool isCalendarLoading = false;
|
|
|
|
|
@ -22,7 +22,7 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
AllRequestsAndCount allRequestsAndCount;
|
|
|
|
|
AllRequestsAndCount openRequests;
|
|
|
|
|
AllRequestsAndCount inProgressRequests;
|
|
|
|
|
AllRequestsAndCount closeRequests;
|
|
|
|
|
AllRequestsAndCount completedRequests;
|
|
|
|
|
AllRequestsAndCount overdueRequests;
|
|
|
|
|
AllRequestsAndCount highPriorityRequests;
|
|
|
|
|
AllRequestsAndCount calendarRequests;
|
|
|
|
|
@ -32,9 +32,8 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
getOverdueRequests();
|
|
|
|
|
getOpenRequests();
|
|
|
|
|
getInProgressRequests();
|
|
|
|
|
getCloseRequests();
|
|
|
|
|
getCompletedRequests();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<int> getAllRequests(BuildContext context, {int typeTransaction, SearchAllRequestsModel search}) async {
|
|
|
|
|
if (isAllLoading == true) return -2;
|
|
|
|
|
isAllLoading = true;
|
|
|
|
|
@ -51,7 +50,7 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
"typeTransaction": type,
|
|
|
|
|
"statusTransaction": status,
|
|
|
|
|
"priority": [0, 1],
|
|
|
|
|
"displayData": status,
|
|
|
|
|
"displayData": [],
|
|
|
|
|
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,
|
|
|
|
|
@ -230,15 +229,15 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<int> getCloseRequests() async {
|
|
|
|
|
if (isCloseLoading == true) return -2;
|
|
|
|
|
isCloseLoading = true;
|
|
|
|
|
if (closeRequests == null) notifyListeners();
|
|
|
|
|
Future<int> getCompletedRequests() async {
|
|
|
|
|
if (isCompleteLoading == true) return -2;
|
|
|
|
|
isCompleteLoading = true;
|
|
|
|
|
if (completedRequests == null) notifyListeners();
|
|
|
|
|
Response response;
|
|
|
|
|
try {
|
|
|
|
|
Map<String, dynamic> body = {
|
|
|
|
|
"typeTransaction": [1, 2, 3, 4],
|
|
|
|
|
"statusTransaction": [3],
|
|
|
|
|
"statusTransaction": [4],
|
|
|
|
|
"priority": [],
|
|
|
|
|
"displayData": []
|
|
|
|
|
};
|
|
|
|
|
@ -246,17 +245,47 @@ class AllRequestsProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
stateCode = response.statusCode;
|
|
|
|
|
if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
|
|
|
closeRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
|
|
|
|
|
completedRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
isCloseLoading = false;
|
|
|
|
|
isCompleteLoading = false;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
return response.statusCode;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
isCloseLoading = false;
|
|
|
|
|
isCompleteLoading = false;
|
|
|
|
|
stateCode = -1;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Future<int> getCloseRequests() async {
|
|
|
|
|
// if (isCloseLoading == true) return -2;
|
|
|
|
|
// isCloseLoading = true;
|
|
|
|
|
// if (closeRequests == null) notifyListeners();
|
|
|
|
|
// Response response;
|
|
|
|
|
// try {
|
|
|
|
|
// Map<String, dynamic> body = {
|
|
|
|
|
// "typeTransaction": [1, 2, 3, 4],
|
|
|
|
|
// "statusTransaction": [4],
|
|
|
|
|
// "priority": [],
|
|
|
|
|
// "displayData": []
|
|
|
|
|
// };
|
|
|
|
|
// response = await ApiManager.instance.post(URLs.getAllRequestsAndCount, body: body);
|
|
|
|
|
//
|
|
|
|
|
// stateCode = response.statusCode;
|
|
|
|
|
// if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
|
|
|
// closeRequests = AllRequestsAndCount.fromJson(json.decode(response.body)["data"]);
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// }
|
|
|
|
|
// isCloseLoading = false;
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// return response.statusCode;
|
|
|
|
|
// } catch (error) {
|
|
|
|
|
// isCloseLoading = false;
|
|
|
|
|
// stateCode = -1;
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// return -1;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|