PR details from PO implemented

merge-requests/174/head
haroon amjad 3 years ago
parent 1ebcbd1079
commit d49a030580

@ -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/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/date_uitl.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_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/get_attendance_tracking_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/itg_forms_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/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_main_response.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:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:platform_device_id/platform_device_id.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
class DashboardApiClient { class DashboardApiClient {
@ -109,11 +107,12 @@ class DashboardApiClient {
//Mark Attendance //Mark Attendance
Future<GenericResponseModel?> markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async { Future<GenericResponseModel?> markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async {
String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC"; String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC";
// var uuid = Uuid(); var uuid = Uuid();
// Generate a v4 (random) id // Generate a v4 (random) id
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"UID": await PlatformDeviceId.getDeviceId, //uuid.v4(), //Mobile Id // "UID": await PlatformDeviceId.getDeviceId, //uuid.v4(), //Mobile Id
"UID": uuid.v4(), //Mobile Id
"Latitude": lat, "Latitude": lat,
"Longitude": long, "Longitude": long,
"QRValue": QRValue, "QRValue": QRValue,

@ -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_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_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_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_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_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_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; return responseData.updateUserItemTypesList;
}, url, postParams); }, url, postParams);
} }
Future<GetPRInformationList?> getPRDetailsForPO(String poLineID) async {
String url = "${ApiConsts.erpRest}GET_PR_INFORMATION";
Map<String, dynamic> 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);
}
} }

@ -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_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_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_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_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_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
@ -226,6 +227,7 @@ class GenericResponseModel {
List<GetPoItemHistoryList>? getPoItemHistoryList; List<GetPoItemHistoryList>? getPoItemHistoryList;
GetPoNotificationBodyList? getPoNotificationBodyList; GetPoNotificationBodyList? getPoNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList; GetPrNotificationBodyList? getPrNotificationBodyList;
GetPRInformationList? getPRInformationList;
List<GetQuotationAnalysisList>? getQuotationAnalysisList; List<GetQuotationAnalysisList>? getQuotationAnalysisList;
List<GetRFCEmployeeList>? getRFCEmployeeListList; List<GetRFCEmployeeList>? getRFCEmployeeListList;
List<String>? getRespondAttributeValueList; List<String>? getRespondAttributeValueList;
@ -490,6 +492,7 @@ class GenericResponseModel {
this.getPoItemHistoryList, this.getPoItemHistoryList,
this.getPoNotificationBodyList, this.getPoNotificationBodyList,
this.getPrNotificationBodyList, this.getPrNotificationBodyList,
this.getPRInformationList,
this.getQuotationAnalysisList, this.getQuotationAnalysisList,
this.getRFCEmployeeListList, this.getRFCEmployeeListList,
this.getRespondAttributeValueList, this.getRespondAttributeValueList,
@ -979,6 +982,7 @@ class GenericResponseModel {
} }
getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null;
getPrNotificationBodyList = json['GetPrNotificationBodyList'] != null ? GetPrNotificationBodyList.fromJson(json['GetPrNotificationBodyList']) : 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) { if (json['GetQuotationAnalysisList'] != null) {
getQuotationAnalysisList = <GetQuotationAnalysisList>[]; getQuotationAnalysisList = <GetQuotationAnalysisList>[];
json['GetQuotationAnalysisList'].forEach((v) { json['GetQuotationAnalysisList'].forEach((v) {
@ -1602,6 +1606,10 @@ class GenericResponseModel {
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson(); data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson();
} }
if (this.getPRInformationList != null) {
data['PR_Information_List'] = this.getPRInformationList!.toJson();
}
if (this.getQuotationAnalysisList != null) { if (this.getQuotationAnalysisList != null) {
data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList();
} }

@ -158,6 +158,7 @@ class POLines {
String? nEEDBYDATE; String? nEEDBYDATE;
int? nOOFROWS; int? nOOFROWS;
int? pOHEADERID; int? pOHEADERID;
int? pOLINEID;
String? pROMISEDDATE; String? pROMISEDDATE;
String? pRNUM; String? pRNUM;
num? qUANTITY; num? qUANTITY;
@ -181,6 +182,7 @@ class POLines {
this.nEEDBYDATE, this.nEEDBYDATE,
this.nOOFROWS, this.nOOFROWS,
this.pOHEADERID, this.pOHEADERID,
this.pOLINEID,
this.pROMISEDDATE, this.pROMISEDDATE,
this.pRNUM, this.pRNUM,
this.qUANTITY, this.qUANTITY,
@ -204,6 +206,7 @@ class POLines {
nEEDBYDATE = json['NEED_BY_DATE']; nEEDBYDATE = json['NEED_BY_DATE'];
nOOFROWS = json['NO_OF_ROWS']; nOOFROWS = json['NO_OF_ROWS'];
pOHEADERID = json['PO_HEADER_ID']; pOHEADERID = json['PO_HEADER_ID'];
pOLINEID = json['PO_LINE_ID'];
pROMISEDDATE = json['PROMISED_DATE']; pROMISEDDATE = json['PROMISED_DATE'];
pRNUM = json['PR_NUM']; pRNUM = json['PR_NUM'];
qUANTITY = json['QUANTITY']; qUANTITY = json['QUANTITY'];
@ -229,6 +232,7 @@ class POLines {
data['NEED_BY_DATE'] = this.nEEDBYDATE; data['NEED_BY_DATE'] = this.nEEDBYDATE;
data['NO_OF_ROWS'] = this.nOOFROWS; data['NO_OF_ROWS'] = this.nOOFROWS;
data['PO_HEADER_ID'] = this.pOHEADERID; data['PO_HEADER_ID'] = this.pOHEADERID;
data['PO_LINE_ID'] = this.pOLINEID;
data['PROMISED_DATE'] = this.pROMISEDDATE; data['PROMISED_DATE'] = this.pROMISEDDATE;
data['PR_NUM'] = this.pRNUM; data['PR_NUM'] = this.pRNUM;
data['QUANTITY'] = this.qUANTITY; data['QUANTITY'] = this.qUANTITY;

@ -0,0 +1,125 @@
class GetPRInformationList {
List<PRHeader>? pRHeader;
List<PRLines>? pRLines;
String? pCURRENCYCODE;
GetPRInformationList({this.pRHeader, this.pRLines, this.pCURRENCYCODE});
GetPRInformationList.fromJson(Map<String, dynamic> json) {
if (json['PRHeader'] != null) {
pRHeader = <PRHeader>[];
json['PRHeader'].forEach((v) {
pRHeader!.add(new PRHeader.fromJson(v));
});
}
if (json['PRLines'] != null) {
pRLines = <PRLines>[];
json['PRLines'].forEach((v) {
pRLines!.add(new PRLines.fromJson(v));
});
}
pCURRENCYCODE = json['P_CURRENCY_CODE'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
dESCRIPTION = json['DESCRIPTION'];
pRNUMBER = json['PR_NUMBER'];
rEQUISITIONTOTAL = json['REQUISITION_TOTAL'];
tAXTOTAL = json['TAX_TOTAL'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> 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<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -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/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_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_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/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -18,8 +19,10 @@ class ItemHistoryScreenParams {
int? pItemId; int? pItemId;
int? pPoHeaderId; int? pPoHeaderId;
int? pOrgId; 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 { class ItemHistoryScreen extends StatefulWidget {
@ -51,9 +54,11 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
void loadData() { void loadData() {
if (_screenParams == null) { if (_screenParams == null) {
_screenParams = ModalRoute.of(context)!.settings.arguments as ItemHistoryScreenParams; _screenParams = ModalRoute.of(context)!.settings.arguments as ItemHistoryScreenParams;
if (!_screenParams!.isPRInfo) {
getDataFromApi(); getDataFromApi();
} }
} }
}
void getDataFromApi() async { void getDataFromApi() async {
try { try {
@ -86,15 +91,45 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
children: [ children: [
if (_screenParams!.isPRInfo) prLinesDataView(),
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(), if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(), if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(),
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(), 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() { Widget loadMoItemHistoryData() {
return ListView.separated( return ListView.separated(
shrinkWrap: true, shrinkWrap: true,

@ -1003,19 +1003,11 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try { try {
isActionHistoryLoaded = false; isActionHistoryLoaded = false;
actionHistoryList.clear(); actionHistoryList.clear();
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() { setState(() {
isActionHistoryLoaded = true; isActionHistoryLoaded = true;
}); });
// }
} catch (ex) { } catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
@ -1024,88 +1016,15 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try { try {
isAttachmentLoaded = false; isAttachmentLoaded = false;
getAttachmentList.clear(); getAttachmentList.clear();
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() { setState(() {
isAttachmentLoaded = true; isAttachmentLoaded = true;
}); });
// }
} catch (ex) { } catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
// Widget showUpdateContinueSheet(List<GetEitCollectionNotificationBodyList> 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<CollectionNotificationEit> 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() { Widget showLoadingAnimation() {
return Lottie.asset( return Lottie.asset(
'assets/lottie/loading.json', 'assets/lottie/loading.json',

@ -1,7 +1,9 @@
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flutter/material.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/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_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_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_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_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/ui/work_list/item_history_screen.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -19,14 +22,14 @@ class RequestFragment extends StatelessWidget {
final List<GetMoNotificationBodyList> moNotificationBodyList; final List<GetMoNotificationBodyList> moNotificationBodyList;
final List<ItemCreationLines> itemCreationLines; final List<ItemCreationLines> itemCreationLines;
final List<POLines> poLinesList; final List<POLines> poLinesList;
final List<PRLines> prLinesList; final List<get_pr_notification_body_list_model.PRLines> prLinesList;
RequestFragment({ RequestFragment({
Key? key, Key? key,
this.moNotificationBodyList = const <GetMoNotificationBodyList>[], this.moNotificationBodyList = const <GetMoNotificationBodyList>[],
this.itemCreationLines = const <ItemCreationLines>[], this.itemCreationLines = const <ItemCreationLines>[],
this.poLinesList = const <POLines>[], this.poLinesList = const <POLines>[],
this.prLinesList = const <PRLines>[], this.prLinesList = const <get_pr_notification_body_list_model.PRLines>[],
}) : super(key: key); }) : super(key: key);
@override @override
@ -37,7 +40,7 @@ class RequestFragment extends StatelessWidget {
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
children: [ children: [
if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), if (moNotificationBodyList.isNotEmpty) moNotificationDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(), if (poLinesList.isNotEmpty) poLinesDataView(context),
if (itemCreationLines.isNotEmpty) itemCreationLinesView(), if (itemCreationLines.isNotEmpty) itemCreationLinesView(),
if (prLinesList.isNotEmpty) prLinesDataView(), if (prLinesList.isNotEmpty) prLinesDataView(),
], ],
@ -45,7 +48,7 @@ class RequestFragment extends StatelessWidget {
); );
} }
Widget poLinesDataView() { Widget poLinesDataView(BuildContext context) {
return ExpandableNotifier( return ExpandableNotifier(
child: ListView.separated( child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
@ -87,22 +90,38 @@ class RequestFragment extends StatelessWidget {
12.height, 12.height,
Row( Row(
children: [ children: [
DefaultButton(LocaleKeys.itemHistory.tr(), () { DefaultButton(
LocaleKeys.itemHistory.tr(),
() {
Navigator.pushNamed( Navigator.pushNamed(
cxt, cxt,
AppRoutes.itemHistory, AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID), arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID),
); );
}).expanded, },
fontSize: 13,
).expanded,
12.width, 12.width,
DefaultButton(LocaleKeys.quotationAnalysis.tr(), () { DefaultButton(
LocaleKeys.quotationAnalysis.tr(),
() {
Navigator.pushNamed( Navigator.pushNamed(
cxt, cxt,
AppRoutes.itemHistory, AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams( arguments: ItemHistoryScreenParams(
isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID), isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID),
); );
}).expanded, },
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, separatorBuilder: (cxt, index) => 12.height,
itemCount: itemCreationLines.length); 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);
}
}
} }

Loading…
Cancel
Save