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; workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0;
if (showLoading) Utils.hideLoading(context); itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0);
GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications(); GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications();
cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem; cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem;
if (cocCount != null) { if (cocCount != null) {
cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0); cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0);
workListCounter += cocFinalCount; workListCounter += cocFinalCount;
} }
itgFormsModel = await DashboardApiClient().getItgFormsPendingTask(); if (showLoading) Utils.hideLoading(context);
workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0);
notifyListeners(); notifyListeners();
} catch (ex) { } catch (ex) {
isWorkListLoading = false; isWorkListLoading = false;

@ -120,8 +120,9 @@ class _WorkListScreenState extends State<WorkListScreen> {
ItgFormsModel? itgFormsModel; ItgFormsModel? itgFormsModel;
int? itgRequestTypeIndex; int? itgRequestTypeIndex;
Future<void> getWorkList({bool showLoading = true, bool callWorkList = true}) async { Future<void> getWorkList({bool showLoading = true}) async {
try { try {
if (showLoading) Utils.showLoading(context);
if (workListItemTypes[workListItemIndex].key == "ITG") { if (workListItemTypes[workListItemIndex].key == "ITG") {
itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType(); itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType();
List<RequestDetails> requestAllList = []; List<RequestDetails> requestAllList = [];
@ -137,36 +138,31 @@ class _WorkListScreenState extends State<WorkListScreen> {
itgRequestTypeIndex = 0; itgRequestTypeIndex = 0;
} }
} else { } else {
if (showLoading) Utils.showLoading(context);
itgRequestTypeIndex = null; itgRequestTypeIndex = null;
if (callWorkList) { workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString());
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString()); AppState().setWorkList = workList;
AppState().setWorkList = workList;
}
if (showLoading) Utils.hideLoading(context);
setState(() {});
} }
if (showLoading) Utils.hideLoading(context);
if (showLoading) setState(() {});
} catch (ex) { } catch (ex) {
if (showLoading) Utils.hideLoading(context); if (showLoading) Utils.hideLoading(context);
if (showLoading) Utils.handleException(ex, context, null); if (showLoading) Utils.handleException(ex, context, null);
} }
} }
void _onRefresh({bool callWorkList = true}) async { void _onRefresh() async {
try { try {
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
if(callWorkList) Utils.showLoading(context); Utils.showLoading(context);
List dataOnRefresh = await Future.wait([ List dataOnRefresh = await Future.wait([
providerData.fetchWorkListCounter(context, showLoading: true).then((value) { providerData.fetchWorkListCounter(context, showLoading: false),
setState(() {}); getWorkList(showLoading: false),
}),
getWorkList(showLoading: false, callWorkList: callWorkList),
]); ]);
calculateCounter(); calculateCounter();
if(callWorkList) Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
if(callWorkList) Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
@ -447,7 +443,6 @@ class _WorkListScreenState extends State<WorkListScreen> {
if (mounted) setState(() {}); if (mounted) setState(() {});
} }
} else { } else {
_onRefresh(callWorkList: false);
if (mounted) setState(() {}); 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'; import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
class WorkListDetailScreen extends StatefulWidget { class WorkListDetailScreen extends StatefulWidget {
WorkListDetailScreen({Key? key}) : super(key: key); WorkListDetailScreen({Key? key}) : super(key: key);
@override @override
@ -100,8 +99,8 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getUserInformation(); getUserInformation();
} }
getNotificationButtons();
notificationGetRespondAttributes(); notificationGetRespondAttributes();
getNotificationButtons();
getAttachments(); getAttachments();
getActionHistory(); getActionHistory();
@ -503,7 +502,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
} }
], ],
}; };
if (actionMode == "APPROVED" || actionMode == "APPROVE" || actionMode == "CLOSE") { if (actionMode == "APPROVED" || actionMode == "APPROVE") {
performNotificationAction(payload); performNotificationAction(payload);
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) { } else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload); performNotificationAction(payload);
@ -540,34 +539,34 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getEitNotificationBody() async { void getEitNotificationBody() async {
try { try {
// if (apiCallCount == 0) Utils.showLoading(context); if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++; apiCallCount++;
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID); getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
// apiCallCount--; apiCallCount--;
// if (apiCallCount == 0) { if (apiCallCount == 0) {
// Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
// } }
} catch (ex) { } catch (ex) {
// apiCallCount--; apiCallCount--;
// Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
void getUserInformation() async { void getUserInformation() async {
try { try {
// if (apiCallCount == 0) Utils.showLoading(context); if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++; apiCallCount++;
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!); memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
// apiCallCount--; apiCallCount--;
// if (apiCallCount == 0) { if (apiCallCount == 0) {
// Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
// } }
} catch (ex) { } catch (ex) {
// apiCallCount--; apiCallCount--;
// Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
@ -608,17 +607,17 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getAbsenceNotificationBody() async { void getAbsenceNotificationBody() async {
try { try {
// if (apiCallCount == 0) Utils.showLoading(context); if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++; apiCallCount++;
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID); getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
// apiCallCount--; apiCallCount--;
// if (apiCallCount == 0) { if (apiCallCount == 0) {
// Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
// } }
} catch (ex) { } catch (ex) {
// apiCallCount--; apiCallCount--;
// Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
@ -731,20 +730,20 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void notificationGetRespondAttributes() async { void notificationGetRespondAttributes() async {
try { try {
// if (apiCallCount == 0) Utils.showLoading(context); if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++; apiCallCount++;
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!); getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) { if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first; notificationNoteInput = getNotificationRespondAttributes.first;
} }
// apiCallCount--; apiCallCount--;
// if (apiCallCount == 0) { if (apiCallCount == 0) {
// Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
// } }
} catch (ex) { } catch (ex) {
// apiCallCount--; apiCallCount--;
// Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }

Loading…
Cancel
Save