Revert yesterday changes

merge-requests/28/head
haroon amjad 3 years ago
parent 588e8f51f0
commit b2810b53ba

@ -134,15 +134,15 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0;
if (showLoading) Utils.hideLoading(context);
itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0);
GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications();
cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem;
if (cocCount != null) {
cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0);
workListCounter += cocFinalCount;
}
itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0);
if (showLoading) Utils.hideLoading(context);
notifyListeners();
} catch (ex) {
isWorkListLoading = false;

@ -120,8 +120,9 @@ class _WorkListScreenState extends State<WorkListScreen> {
ItgFormsModel? itgFormsModel;
int? itgRequestTypeIndex;
Future<void> getWorkList({bool showLoading = true, bool callWorkList = true}) async {
Future<void> getWorkList({bool showLoading = true}) async {
try {
if (showLoading) Utils.showLoading(context);
if (workListItemTypes[workListItemIndex].key == "ITG") {
itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType();
List<RequestDetails> requestAllList = [];
@ -137,36 +138,31 @@ class _WorkListScreenState extends State<WorkListScreen> {
itgRequestTypeIndex = 0;
}
} else {
if (showLoading) Utils.showLoading(context);
itgRequestTypeIndex = null;
if (callWorkList) {
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString());
AppState().setWorkList = workList;
}
if (showLoading) Utils.hideLoading(context);
setState(() {});
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString());
AppState().setWorkList = workList;
}
if (showLoading) Utils.hideLoading(context);
if (showLoading) setState(() {});
} catch (ex) {
if (showLoading) Utils.hideLoading(context);
if (showLoading) Utils.handleException(ex, context, null);
}
}
void _onRefresh({bool callWorkList = true}) async {
void _onRefresh() async {
try {
_refreshController.refreshCompleted();
if(callWorkList) Utils.showLoading(context);
Utils.showLoading(context);
List dataOnRefresh = await Future.wait([
providerData.fetchWorkListCounter(context, showLoading: true).then((value) {
setState(() {});
}),
getWorkList(showLoading: false, callWorkList: callWorkList),
providerData.fetchWorkListCounter(context, showLoading: false),
getWorkList(showLoading: false),
]);
calculateCounter();
if(callWorkList) Utils.hideLoading(context);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
if(callWorkList) Utils.hideLoading(context);
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@ -447,7 +443,6 @@ class _WorkListScreenState extends State<WorkListScreen> {
if (mounted) setState(() {});
}
} else {
_onRefresh(callWorkList: false);
if (mounted) setState(() {});
}
},

@ -40,7 +40,6 @@ import 'package:mohem_flutter_app/widgets/dialogs/accept_reject_input_dialog.dar
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
class WorkListDetailScreen extends StatefulWidget {
WorkListDetailScreen({Key? key}) : super(key: key);
@override
@ -100,8 +99,8 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getUserInformation();
}
getNotificationButtons();
notificationGetRespondAttributes();
getNotificationButtons();
getAttachments();
getActionHistory();
@ -503,7 +502,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
],
};
if (actionMode == "APPROVED" || actionMode == "APPROVE" || actionMode == "CLOSE") {
if (actionMode == "APPROVED" || actionMode == "APPROVE") {
performNotificationAction(payload);
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload);
@ -540,34 +539,34 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getEitNotificationBody() async {
try {
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
// }
}
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getUserInformation() async {
try {
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
// }
}
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@ -608,17 +607,17 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getAbsenceNotificationBody() async {
try {
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
// }
}
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@ -731,20 +730,20 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void notificationGetRespondAttributes() async {
try {
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
}
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
// }
}
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}

Loading…
Cancel
Save