diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index 7555dc6..76b10ce 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -5,7 +5,6 @@ import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart'; -import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; @@ -13,7 +12,6 @@ import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/itg/itg_main_response.dart'; import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; -import 'package:platform_device_id/platform_device_id.dart'; import 'package:uuid/uuid.dart'; class DashboardApiClient { @@ -109,11 +107,12 @@ class DashboardApiClient { //Mark Attendance Future markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async { String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC"; - // var uuid = Uuid(); + var uuid = Uuid(); // Generate a v4 (random) id Map postParams = { - "UID": await PlatformDeviceId.getDeviceId, //uuid.v4(), //Mobile Id + // "UID": await PlatformDeviceId.getDeviceId, //uuid.v4(), //Mobile Id + "UID": uuid.v4(), //Mobile Id "Latitude": lat, "Longitude": long, "QRValue": QRValue, @@ -201,18 +200,18 @@ class DashboardApiClient { }, url, postParams); } -Future setAdvertisementViewed(String masterID, int advertisementId) async { - String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed"; - - Map postParams = { - "ItgNotificationMasterId": masterID, - "EmployeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(), - "ItgAdvertisement": {"advertisementId": advertisementId, "acknowledgment": true} //Mobile Id - }; - postParams.addAll(AppState().postParamsJson); - return await ApiClient().postJsonForObject((json) { - // ItgMainRes responseData = ItgMainRes.fromJson(json); - return json; - }, url, postParams); -} + Future setAdvertisementViewed(String masterID, int advertisementId) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed"; + + Map postParams = { + "ItgNotificationMasterId": masterID, + "EmployeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(), + "ItgAdvertisement": {"advertisementId": advertisementId, "acknowledgment": true} //Mobile Id + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + // ItgMainRes responseData = ItgMainRes.fromJson(json); + return json; + }, url, postParams); + } } diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index 82b865c..d55dc8d 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dar import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_pr_information_list.dart'; import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; @@ -626,4 +627,19 @@ class WorkListApiClient { return responseData.updateUserItemTypesList; }, url, postParams); } + + Future getPRDetailsForPO(String poLineID) async { + String url = "${ApiConsts.erpRest}GET_PR_INFORMATION"; + Map postParams = { + "P_PO_LINE_ID": poLineID, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getPRInformationList; + }, url, postParams); + } + } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index ed00de4..a5677af 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -28,6 +28,7 @@ import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart'; import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_pr_information_list.dart'; import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; @@ -226,6 +227,7 @@ class GenericResponseModel { List? getPoItemHistoryList; GetPoNotificationBodyList? getPoNotificationBodyList; GetPrNotificationBodyList? getPrNotificationBodyList; + GetPRInformationList? getPRInformationList; List? getQuotationAnalysisList; List? getRFCEmployeeListList; List? getRespondAttributeValueList; @@ -490,6 +492,7 @@ class GenericResponseModel { this.getPoItemHistoryList, this.getPoNotificationBodyList, this.getPrNotificationBodyList, + this.getPRInformationList, this.getQuotationAnalysisList, this.getRFCEmployeeListList, this.getRespondAttributeValueList, @@ -979,6 +982,7 @@ class GenericResponseModel { } getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPrNotificationBodyList = json['GetPrNotificationBodyList'] != null ? GetPrNotificationBodyList.fromJson(json['GetPrNotificationBodyList']) : null; + getPRInformationList = json['PR_Information_List'] != null ? GetPRInformationList.fromJson(json['PR_Information_List']) : null; if (json['GetQuotationAnalysisList'] != null) { getQuotationAnalysisList = []; json['GetQuotationAnalysisList'].forEach((v) { @@ -1602,6 +1606,10 @@ class GenericResponseModel { data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson(); } + if (this.getPRInformationList != null) { + data['PR_Information_List'] = this.getPRInformationList!.toJson(); + } + if (this.getQuotationAnalysisList != null) { data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); } diff --git a/lib/models/get_po_notification_body_list_model.dart b/lib/models/get_po_notification_body_list_model.dart index d0473dc..a1a56e6 100644 --- a/lib/models/get_po_notification_body_list_model.dart +++ b/lib/models/get_po_notification_body_list_model.dart @@ -158,6 +158,7 @@ class POLines { String? nEEDBYDATE; int? nOOFROWS; int? pOHEADERID; + int? pOLINEID; String? pROMISEDDATE; String? pRNUM; num? qUANTITY; @@ -181,6 +182,7 @@ class POLines { this.nEEDBYDATE, this.nOOFROWS, this.pOHEADERID, + this.pOLINEID, this.pROMISEDDATE, this.pRNUM, this.qUANTITY, @@ -204,6 +206,7 @@ class POLines { nEEDBYDATE = json['NEED_BY_DATE']; nOOFROWS = json['NO_OF_ROWS']; pOHEADERID = json['PO_HEADER_ID']; + pOLINEID = json['PO_LINE_ID']; pROMISEDDATE = json['PROMISED_DATE']; pRNUM = json['PR_NUM']; qUANTITY = json['QUANTITY']; @@ -229,6 +232,7 @@ class POLines { data['NEED_BY_DATE'] = this.nEEDBYDATE; data['NO_OF_ROWS'] = this.nOOFROWS; data['PO_HEADER_ID'] = this.pOHEADERID; + data['PO_LINE_ID'] = this.pOLINEID; data['PROMISED_DATE'] = this.pROMISEDDATE; data['PR_NUM'] = this.pRNUM; data['QUANTITY'] = this.qUANTITY; diff --git a/lib/models/get_pr_information_list.dart b/lib/models/get_pr_information_list.dart new file mode 100644 index 0000000..33ede12 --- /dev/null +++ b/lib/models/get_pr_information_list.dart @@ -0,0 +1,125 @@ +class GetPRInformationList { + List? pRHeader; + List? pRLines; + String? pCURRENCYCODE; + + GetPRInformationList({this.pRHeader, this.pRLines, this.pCURRENCYCODE}); + + GetPRInformationList.fromJson(Map json) { + if (json['PRHeader'] != null) { + pRHeader = []; + json['PRHeader'].forEach((v) { + pRHeader!.add(new PRHeader.fromJson(v)); + }); + } + if (json['PRLines'] != null) { + pRLines = []; + json['PRLines'].forEach((v) { + pRLines!.add(new PRLines.fromJson(v)); + }); + } + pCURRENCYCODE = json['P_CURRENCY_CODE']; + } + + Map toJson() { + Map data = new Map(); + if (this.pRHeader != null) { + data['PRHeader'] = this.pRHeader!.map((v) => v.toJson()).toList(); + } + if (this.pRLines != null) { + data['PRLines'] = this.pRLines!.map((v) => v.toJson()).toList(); + } + data['P_CURRENCY_CODE'] = this.pCURRENCYCODE; + return data; + } +} + +class PRHeader { + String? dESCRIPTION; + String? pRNUMBER; + String? rEQUISITIONTOTAL; + String? tAXTOTAL; + + PRHeader({this.dESCRIPTION, this.pRNUMBER, this.rEQUISITIONTOTAL, this.tAXTOTAL}); + + PRHeader.fromJson(Map json) { + dESCRIPTION = json['DESCRIPTION']; + pRNUMBER = json['PR_NUMBER']; + rEQUISITIONTOTAL = json['REQUISITION_TOTAL']; + tAXTOTAL = json['TAX_TOTAL']; + } + + Map toJson() { + Map data = new Map(); + data['DESCRIPTION'] = this.dESCRIPTION; + data['PR_NUMBER'] = this.pRNUMBER; + data['REQUISITION_TOTAL'] = this.rEQUISITIONTOTAL; + data['TAX_TOTAL'] = this.tAXTOTAL; + return data; + } +} + +class PRLines { + String? cOSTCENTER; + String? dESCRIPTION; + int? fROMROWNUM; + int? iTEMAMU; + String? iTEMCODE; + int? lINEAMOUNT; + int? lINENUM; + int? nOOFROWS; + int? qUANTITY; + int? rOWNUM; + int? tOROWNUM; + int? uNITPRICE; + String? uOM; + + PRLines( + {this.cOSTCENTER, + this.dESCRIPTION, + this.fROMROWNUM, + this.iTEMAMU, + this.iTEMCODE, + this.lINEAMOUNT, + this.lINENUM, + this.nOOFROWS, + this.qUANTITY, + this.rOWNUM, + this.tOROWNUM, + this.uNITPRICE, + this.uOM}); + + PRLines.fromJson(Map json) { + cOSTCENTER = json['COST_CENTER']; + dESCRIPTION = json['DESCRIPTION']; + fROMROWNUM = json['FROM_ROW_NUM']; + iTEMAMU = json['ITEM_AMU']; + iTEMCODE = json['ITEM_CODE']; + lINEAMOUNT = json['LINE_AMOUNT']; + lINENUM = json['LINE_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + qUANTITY = json['QUANTITY']; + rOWNUM = json['ROW_NUM']; + tOROWNUM = json['TO_ROW_NUM']; + uNITPRICE = json['UNIT_PRICE']; + uOM = json['UOM']; + } + + Map toJson() { + Map data = new Map(); + data['COST_CENTER'] = this.cOSTCENTER; + data['DESCRIPTION'] = this.dESCRIPTION; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['ITEM_AMU'] = this.iTEMAMU; + data['ITEM_CODE'] = this.iTEMCODE; + data['LINE_AMOUNT'] = this.lINEAMOUNT; + data['LINE_NUM'] = this.lINENUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['QUANTITY'] = this.qUANTITY; + data['ROW_NUM'] = this.rOWNUM; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['UNIT_PRICE'] = this.uNITPRICE; + data['UOM'] = this.uOM; + return data; + } +} diff --git a/lib/ui/work_list/item_history_screen.dart b/lib/ui/work_list/item_history_screen.dart index a3c34a9..5aa18b3 100644 --- a/lib/ui/work_list/item_history_screen.dart +++ b/lib/ui/work_list/item_history_screen.dart @@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_mo_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; +import 'package:mohem_flutter_app/models/get_pr_information_list.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; @@ -18,8 +19,10 @@ class ItemHistoryScreenParams { int? pItemId; int? pPoHeaderId; int? pOrgId; + bool isPRInfo; + GetPRInformationList? getPRInformationList; - ItemHistoryScreenParams({@required this.title, this.isItemHistory = true, this.isMO = true, this.pItemId, this.pPoHeaderId, this.pOrgId}); + ItemHistoryScreenParams({@required this.title, this.isItemHistory = true, this.isMO = true, this.isPRInfo = false, this.getPRInformationList, this.pItemId, this.pPoHeaderId, this.pOrgId}); } class ItemHistoryScreen extends StatefulWidget { @@ -51,7 +54,9 @@ class _ItemHistoryScreenState extends State { void loadData() { if (_screenParams == null) { _screenParams = ModalRoute.of(context)!.settings.arguments as ItemHistoryScreenParams; - getDataFromApi(); + if (!_screenParams!.isPRInfo) { + getDataFromApi(); + } } } @@ -86,15 +91,45 @@ class _ItemHistoryScreenState extends State { padding: const EdgeInsets.all(21), physics: const BouncingScrollPhysics(), children: [ + if (_screenParams!.isPRInfo) prLinesDataView(), if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(), if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(), if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(), - if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty) Utils.getNoDataWidget(context), + if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty && !_screenParams!.isPRInfo) Utils.getNoDataWidget(context), ], ), ); } + Widget prLinesDataView() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + children: [ + ItemDetailGrid( + ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""), + ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""), + ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""), + ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""), + Container(), + isItLast: true, + ), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: _screenParams!.getPRInformationList!.pRLines!.length); + } + Widget loadMoItemHistoryData() { return ListView.separated( shrinkWrap: true, diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 9bc0222..7a489c3 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -1003,19 +1003,11 @@ class _WorkListDetailScreenState extends State { try { isActionHistoryLoaded = false; actionHistoryList.clear(); - // if (apiCallCount == 0) Utils.showLoading(context); - // apiCallCount++; actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); - // apiCallCount--; - // if (apiCallCount == 0) { - // Utils.hideLoading(context); setState(() { isActionHistoryLoaded = true; }); - // } } catch (ex) { - // apiCallCount--; - // Utils.hideLoading(context); Utils.handleException(ex, context, null); } } @@ -1024,88 +1016,15 @@ class _WorkListDetailScreenState extends State { try { isAttachmentLoaded = false; getAttachmentList.clear(); - // if (apiCallCount == 0) Utils.showLoading(context); - // apiCallCount++; getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); - // apiCallCount--; - // if (apiCallCount == 0) { - // Utils.hideLoading(context); setState(() { isAttachmentLoaded = true; }); - // } } catch (ex) { - // apiCallCount--; - // Utils.hideLoading(context); Utils.handleException(ex, context, null); } } - // Widget showUpdateContinueSheet(List list) { - // double itemHeight = 0; - // double itemWidth = 0; - // var size = MediaQuery.of(context).size; - // itemHeight = (size.height - kToolbarHeight - 24) / 9; - // itemWidth = size.width / 2; - // return Column( - // children: [ - // if ((workListData?.sUBJECT ?? "").isNotEmpty) workListData!.sUBJECT!.toText14().paddingOnly(top: 10, right: 21, left: 21, bottom: 21), - // ListView.separated( - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - // itemBuilder: (cxt, index) { - // List dataList = list.isEmpty ? [] : (list[index].collectionNotification ?? []); - // dataList = dataList.where((o) => o.displayFlag == "Y").toList(); - // bool isOdd = false; - // if (dataList.length % 2 != 0) { - // isOdd = true; - // dataList.add(new CollectionNotificationEit()); - // } - // return GridView.builder( - // itemCount: dataList.length, - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - // itemBuilder: (context, index) => ItemDetailViewGridItem( - // index, - // dataList[index].segmentPrompt, - // dataList[index].segmentValueDsp, - // isNeedToShowEmptyDivider: (dataList.length == index + 1) - // ? isOdd - // ? true - // : false - // : false, - // ), - // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - // crossAxisCount: 2, - // childAspectRatio: (itemWidth / itemHeight), - // ), - // ).objectContainerView(); - // }, - // separatorBuilder: (cxt, index) => 12.height, - // itemCount: list.length, - // ), - // Padding( - // padding: const EdgeInsets.only(right: 21, left: 21, bottom: 21), - // child: Row( - // children: [ - // DefaultButton( - // LocaleKeys.edit.tr(), - // () => performEditAction(), - // colors: const [Color(0xffE47A7E), Color(0xffDE6D71)], - // ).expanded, - // 8.width, - // DefaultButton( - // LocaleKeys.next.tr(), - // () => performNextAction(), - // colors: const [Color(0xff28C884), Color(0xff1BB271)], - // ).expanded, - // ], - // ), - // ), - // ], - // ); - // } - Widget showLoadingAnimation() { return Lottie.asset( 'assets/lottie/loading.json', diff --git a/lib/ui/work_list/worklist_fragments/request_fragment.dart b/lib/ui/work_list/worklist_fragments/request_fragment.dart index a13f91f..5a77597 100644 --- a/lib/ui/work_list/worklist_fragments/request_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/request_fragment.dart @@ -1,7 +1,9 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -10,7 +12,8 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; -import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_pr_information_list.dart'; +import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart' as get_pr_notification_body_list_model; import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; @@ -19,14 +22,14 @@ class RequestFragment extends StatelessWidget { final List moNotificationBodyList; final List itemCreationLines; final List poLinesList; - final List prLinesList; + final List prLinesList; RequestFragment({ Key? key, this.moNotificationBodyList = const [], this.itemCreationLines = const [], this.poLinesList = const [], - this.prLinesList = const [], + this.prLinesList = const [], }) : super(key: key); @override @@ -37,7 +40,7 @@ class RequestFragment extends StatelessWidget { padding: const EdgeInsets.all(21), children: [ if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), - if (poLinesList.isNotEmpty) poLinesDataView(), + if (poLinesList.isNotEmpty) poLinesDataView(context), if (itemCreationLines.isNotEmpty) itemCreationLinesView(), if (prLinesList.isNotEmpty) prLinesDataView(), ], @@ -45,7 +48,7 @@ class RequestFragment extends StatelessWidget { ); } - Widget poLinesDataView() { + Widget poLinesDataView(BuildContext context) { return ExpandableNotifier( child: ListView.separated( shrinkWrap: true, @@ -87,22 +90,38 @@ class RequestFragment extends StatelessWidget { 12.height, Row( children: [ - DefaultButton(LocaleKeys.itemHistory.tr(), () { - Navigator.pushNamed( - cxt, - AppRoutes.itemHistory, - arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID), - ); - }).expanded, + DefaultButton( + LocaleKeys.itemHistory.tr(), + () { + Navigator.pushNamed( + cxt, + AppRoutes.itemHistory, + arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID), + ); + }, + fontSize: 13, + ).expanded, 12.width, - DefaultButton(LocaleKeys.quotationAnalysis.tr(), () { - Navigator.pushNamed( - cxt, - AppRoutes.itemHistory, - arguments: ItemHistoryScreenParams( - isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID), - ); - }).expanded, + DefaultButton( + LocaleKeys.quotationAnalysis.tr(), + () { + Navigator.pushNamed( + cxt, + AppRoutes.itemHistory, + arguments: ItemHistoryScreenParams( + isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID), + ); + }, + fontSize: 13, + ).expanded, + 12.width, + DefaultButton( + "PR Details", + () { + getPRDetails(context, poLinesList[index].pOLINEID.toString()); + }, + fontSize: 13, + ).expanded, ], ) ], @@ -263,4 +282,23 @@ class RequestFragment extends StatelessWidget { separatorBuilder: (cxt, index) => 12.height, itemCount: itemCreationLines.length); } + + void getPRDetails(BuildContext context, String poLineID) async { + try { + Utils.showLoading(context); + GetPRInformationList? getPRInformationList = GetPRInformationList(); + getPRInformationList = await WorkListApiClient().getPRDetailsForPO(poLineID); + Utils.hideLoading(context); + + Navigator.pushNamed( + context, + AppRoutes.itemHistory, + arguments: ItemHistoryScreenParams( + isItemHistory: false, isMO: false, isPRInfo: true, getPRInformationList: getPRInformationList, title: "PR Details", pItemId: 0, pPoHeaderId: 0), + ); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } }