From 62acd531b044cbf8b007fe61714242268156db39 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 6 Dec 2022 09:37:29 +0300 Subject: [PATCH] fixes --- .../items_for_sale_api_client.dart | 35 ++++++++++++++++++ lib/ui/work_list/worklist_detail_screen.dart | 37 ++++++++++--------- lib/widgets/app_bar_widget.dart | 2 +- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/lib/api/items_for_sale/items_for_sale_api_client.dart b/lib/api/items_for_sale/items_for_sale_api_client.dart index 436ae6e..eae6ffb 100644 --- a/lib/api/items_for_sale/items_for_sale_api_client.dart +++ b/lib/api/items_for_sale/items_for_sale_api_client.dart @@ -66,6 +66,41 @@ class ItemsForSaleApiClient { }, url, postParams); } + Future updateItemsForSale(int itemSaleID) async { + List getItemsForSaleList = []; + + String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateItemForSale"; + + // request.fields['itemSaleID'] = itemSaleID.toString(); + // request.fields['Channel'] = "31"; + // request.fields['isActive'] = "false"; + // request.fields['LogInToken'] = loginTokenID!; + // request.fields['Token'] = tokenID!; + // request.fields['MobileNo'] = empMobNum!; + // request.fields['EmployeeNumber'] = empNum!; + // request.fields['employeeNumber'] = empNum; + + Map postParams = { + "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "employeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "MobileNo": AppState().memberInformationList?.eMPLOYEEMOBILENUMBER, + "itemSaleID": itemSaleID.toString(), + "Channel": "31", + "isActive": "false", + "Token": AppState().postParamsObject?.tokenID + }; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((response) { + var body = json.decode(response['Mohemm_ITG_ResponseItem']); + + // body['result']['data'].forEach((v) { + // getItemsForSaleList.add(new GetItemsForSaleList.fromJson(v)); + // }); + return getItemsForSaleList; + }, url, postParams); + } + Future> getEmployeePostedAds() async { List employeePostedAdsList = []; diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 96bd09f..3f5655e 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -146,7 +146,7 @@ class _WorkListDetailScreenState extends State { getPRNotification(); } - if(controller.hasClients) { + if (controller.hasClients) { controller.jumpToPage(0); } @@ -210,6 +210,7 @@ class _WorkListDetailScreenState extends State { ); }, child: Stack( + key: ValueKey(AppState().workListIndex ?? 0), children: [ Column( children: [ @@ -251,19 +252,19 @@ class _WorkListDetailScreenState extends State { (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") ? DetailFragment(workListData, memberInformationListModel) : RequestFragment( - moNotificationBodyList: getMoNotificationBodyList, - poLinesList: getPoNotificationBody?.pOLines ?? [], - itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], - prLinesList: getPrNotificationBody?.pRLines ?? [], - ), + moNotificationBodyList: getMoNotificationBodyList, + poLinesList: getPoNotificationBody?.pOLines ?? [], + itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], + prLinesList: getPrNotificationBody?.pRLines ?? [], + ), isActionHistoryLoaded ? actionHistoryList.isEmpty - ? Utils.getNoDataWidget(context) - : ActionsFragment( - workListData!.nOTIFICATIONID, - actionHistoryList, - voidCallback: reloadWorkList, - ) + ? Utils.getNoDataWidget(context) + : ActionsFragment( + workListData!.nOTIFICATIONID, + actionHistoryList, + voidCallback: reloadWorkList, + ) : showLoadingAnimation(), InfoFragment( poHeaderList: getPoNotificationBody?.pOHeader ?? [], @@ -565,7 +566,7 @@ class _WorkListDetailScreenState extends State { Future performNetworkCall(BuildContext context, {String? email, String? userId}) async { showDialog( context: context, - builder: (BuildContext cxt) => ConfirmDialog( + builder: (cxt) => ConfirmDialog( message: LocaleKeys.wantToReject.tr(), okTitle: LocaleKeys.reject.tr(), onTap: () async { @@ -648,12 +649,12 @@ class _WorkListDetailScreenState extends State { print(actionMode); showDialog( context: context, - builder: (BuildContext cxt) => AcceptRejectInputDialog( + builder: (cxt) => AcceptRejectInputDialog( message: title != null ? null : LocaleKeys.requestedItems.tr(), title: title, notificationGetRespond: notificationNoteInput, actionMode: actionMode, - onTap: (String note) { + onTap: (note) { Map payload = { "P_ACTION_MODE": actionMode, "P_APPROVER_INDEX": null, @@ -934,9 +935,9 @@ class _WorkListDetailScreenState extends State { apiCallCount++; notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!); if (notificationButtonsList.isNotEmpty) { - isCloseAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "CLOSE"); - isApproveAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "APPROVED"); - isRejectAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "REJECTED"); + isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE"); + isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED"); + isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED"); } apiCallCount--; if (apiCallCount == 0) { diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart index fa59d3a..38cf570 100644 --- a/lib/widgets/app_bar_widget.dart +++ b/lib/widgets/app_bar_widget.dart @@ -20,7 +20,7 @@ AppBar AppBarWidget(BuildContext context, children: [ GestureDetector( behavior: HitTestBehavior.opaque, - onTap: Feedback.wrapForTap(() => Navigator.maybePop(context, true), context), + onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context), child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), ), 4.width,