diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 38767b7..daf43ef 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -66,6 +66,8 @@ "whatsapp": "واتس اب", "reject": "يرفض", "approve": "يوافق", + "cancel": "إلغاء", + "requestedItems": "العناصر المطلوبة", "request": "طلب", "actions": "أجراءات", "delegate": "مندوب", @@ -97,6 +99,78 @@ "category": "فئة", "employeeEmailAddress": "عنوان البريد الإلكتروني للموظف", "payrollBranch": "فرع الرواتب", + "yourChangeHasBeenSavedSuccessfully": "تم حفظ التغيير الخاص بك بنجاح", + "code": "شفرة", + "unit": "وحدة", + "quantity": "كمية", + "dateRequired": "التاريخ مطلوب", + "lineStatus": "حالة الخط", + "statusDate": "تاريخ الحالة", + "transactionType": "نوع المعاملة", + "operatingUnit": "وحدة التشغيل", + "organizationCode": "كود المنظمة", + "organization": "منظمة", + "fromSubInventory": "من الجرد الفرعي", + "fromLocator": "من محدد المواقع", + "toSubInventory": "إلى الجرد الفرعي", + "toLocator": "إلى محدد المواقع", + "shipToLocator": "شحن إلى محدد المواقع", + "itemHistory": "تاريخ العنصر", + "mfg": "مبدع", + "lineType": "نوع الخط", + "price": "السعر", + "lineAmount": "مبلغ الخط", + "lineDiscount": "خصم الخط٪", + "needByDate": "القادمة إلى الأمام", + "promisedDate": "التسجيل وعد", + "deliverToLocation": "تسليم إلى الموقع", + "requisitionNumber": "رقم الطلب", + "requester": "مقدم الطلب", + "quotationAnalysis": "تحليل الاقتباس", + "subject": "موضوعات", + "description": "وصف", + "supplier": "المورد", + "site": "موقع", + "buyer": "مشتر", + "preparer": "معد", + "creationDate": "تاريخ الإنشاء", + "shipToLocation": "الشحن الى الموقع", + "quotationNumber": "رقم الإقتباس", + "quotationDate": "تاريخ الاقتباس", + "paymentTerms": "شروط الدفع", + "currency": "عملة", + "grossAmount": "المبلغ الإجمالي", + "discountAmount": "مقدار الخصم", + "customDuty": "الرسوم الجمركية", + "shipHandle": "مقبض السفينة", + "otherCharges": "رسوم أخرى", + "totalPOAmountWithVAT": "إجمالي مبلغ الشراء مع ضريبة القيمة المضافة", + "totalPOAmountInWords": "إجمالي مبلغ أمر الشراء بالكلمات", + "requestNumber": "رقم الطلب", + "uom": "UOM", + "operatingCode": "كود التشغيل", + "poNumber": "PO عدد", + "revision": "مراجعة", + "quantityOrdered": "الكمية المطلوبة", + "quantityReceived": "الكمية المستلمة", + "bonusQuantity": "كمية المكافأة", + "purchasePrice": "سعر الشراء", + "discountPer": "خصم ٪", + "balanceQuantity": "كمية التوازن", + "netPrice": "السعر الصافي", + "closureStatus": "حالة الإغلاق", + "quotationNetPrice": "صافي سعر الاقتباس", + "quotationUOM": "اقتباس UOM", + "quotationQty": "اقتباس الكمية", + "itemCode": "رمز الصنف", + "vendorName": "اسم البائع", + "quotationMFGPartNumber": "رقم الجزء MFG الاقتباس", + "quotationDeliveryDate": "تاريخ تسليم عرض الأسعار", + "quotationBonusQuantity": "كمية مكافأة الاقتباس", + "quotationLineTotal": "مجموع خط الاقتباس", + "rfqUOM": "RFQ UOM", + "rfqQty": "RFQ الكمية", + "rfqNumber": "رقم RFQ", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index fecbf3d..f39f530 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -66,6 +66,8 @@ "whatsapp": "Whatsapp", "reject": "Reject", "approve": "Approve", + "cancel": "Cancel", + "requestedItems": "Requested Items", "request": "Request", "actions": "Actions", "delegate": "Delegate", @@ -97,6 +99,78 @@ "category": "Category", "employeeEmailAddress": "Employee Email Address", "payrollBranch": "Payroll Branch", + "yourChangeHasBeenSavedSuccessfully": "Your change has been saved successfully", + "code": "Code", + "unit": "Unit", + "quantity": "Quantity", + "dateRequired": "Date Required", + "lineStatus": "Line Status", + "statusDate": "Status Date", + "transactionType": "Transaction Type", + "operatingUnit": "Operating Unit", + "organizationCode": "Organization Code", + "organization": "Organization", + "fromSubInventory": "From Sub Inventory", + "fromLocator": "From Locator", + "toSubInventory": "To Sub Inventory", + "toLocator": "To Locator", + "shipToLocator": "Ship To Locator", + "itemHistory": "Item History", + "mfg": "MFG", + "lineType": "Line Type", + "price": "Price", + "lineAmount": "Line Amount", + "lineDiscount": "Line Discount %", + "needByDate": "Need By Date", + "promisedDate": "Promised Date", + "deliverToLocation": "Deliver To Location", + "requisitionNumber": "Requisition Number", + "requester": "Requester", + "subject": "Subject", + "quotationAnalysis": "Quotation Analysis", + "description": "Description", + "supplier": "Supplier", + "site": "Site", + "buyer": "Buyer", + "preparer": "Preparer", + "creationDate": "Creation Date", + "shipToLocation": "Ship To Location", + "quotationNumber": "Quotation Number", + "quotationDate": "Quotation Date", + "paymentTerms": "Payment Terms", + "currency": "Currency", + "grossAmount": "Gross Amount", + "discountAmount": "Discount Amount", + "customDuty": "Custom Duty", + "shipHandle": "Ship Handle", + "otherCharges": "Other Charges", + "totalPOAmountWithVAT": "Total PO Amount With VAT", + "totalPOAmountInWords": "Total PO Amount In Words", + "requestNumber": "Request Number", + "uom": "UOM", + "operatingCode": "Operating Code", + "poNumber": "PO Number", + "revision": "Revision", + "quantityOrdered": "Quantity Ordered", + "quantityReceived": "Quantity Received", + "bonusQuantity": "Bonus Quantity", + "purchasePrice": "Purchase Price", + "discountPer": "Discount %", + "balanceQuantity": "Balance Quantity", + "netPrice": "Net Price", + "closureStatus": "Closure Status", + "quotationNetPrice": "Quotation Net Price", + "quotationUOM": "Quotation UOM", + "quotationQty": "Quotation Qty", + "itemCode": "item Code", + "vendorName": "Vendor Name", + "quotationMFGPartNumber": "Quotation MFG Part Number", + "quotationDeliveryDate": "Quotation Delivery Date", + "quotationBonusQuantity": "Quotation Bonus Quantity", + "quotationLineTotal": "Quotation Line Total", + "rfqUOM": "RFQ UOM", + "rfqQty": "RFQ Qty", + "rfqNumber": "RFQ Number", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index 48fd13b..625e700 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -7,11 +7,16 @@ import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; +import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; +import 'package:mohem_flutter_app/models/get_mo_Item_history_list_model.dart'; +import 'package:mohem_flutter_app/models/get_mo_notification_body_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_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/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; -import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; class WorkListApiClient { @@ -56,7 +61,7 @@ class WorkListApiClient { }, url, postParams); } - Future> getAttachments(int pNotificationID) async { + Future> getAttachments(int pNotificationID) async { String url = "${ApiConsts.erpRest}GET_ATTACHMENTS"; Map postParams = {"P_NOTIFICATION_ID": pNotificationID}; postParams.addAll(AppState().postParamsJson); @@ -115,7 +120,7 @@ class WorkListApiClient { }, url, postParams); } - Future getUserInformation(int pSelectedResopID) async { + Future getUserInformation(int pSelectedResopID, String selectedEmployeeNumber) async { String url = "${ApiConsts.erpRest}Get_UserInformation"; Map postParams = { "P_SELECTED_RESP_ID": pSelectedResopID, @@ -123,6 +128,7 @@ class WorkListApiClient { "P_PAGE_NUM": 1, }; postParams.addAll(AppState().postParamsJson); + postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber; return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); return responseData.memberInformationList![0]; @@ -158,4 +164,87 @@ class WorkListApiClient { return responseData.getAbsenceCollectionNotificationBodyList ?? []; }, url, postParams); } + + Future postNotificationActions(Map postParams) async { + String url = "${ApiConsts.erpRest}NOTIFICATION_ACTIONS"; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future> getMoNotificationBody(int pNotificationID, int pTransactionID) async { + String url = "${ApiConsts.erpRest}GET_MO_NOTIFICATION_BODY"; + Map postParams = { + "P_NOTIFICATION_ID": pNotificationID, + "P_TRANSACTION_ID": pTransactionID, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getMoNotificationBodyList ?? []; + }, url, postParams); + } + + Future getPoNotificationBody(int pNotificationID, int pTransactionID) async { + String url = "${ApiConsts.erpRest}GET_PO_NOTIFICATION_BODY"; + Map postParams = { + "P_NOTIFICATION_ID": pNotificationID, + "P_TRANSACTION_ID": pTransactionID, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getPoNotificationBodyList; + }, url, postParams); + } + + Future> getMoItemHistory(int pItemID, int pOrgID) async { + String url = "${ApiConsts.erpRest}GET_MO_ITEM_HISTORY"; + Map postParams = { + "P_ITEM_ID": pItemID, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + "P_ORG_ID": pOrgID, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getMoItemHistoryList ?? []; + }, url, postParams); + } + + Future> getPoItemHistory(int pItemID) async { + String url = "${ApiConsts.erpRest}GET_PO_ITEM_HISTORY"; + Map postParams = { + "P_ITEM_ID": pItemID, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getPoItemHistoryList ?? []; + }, url, postParams); + } + + Future> getQuotationAnalysis(int pItemID, int pPoHeaderId) async { + String url = "${ApiConsts.erpRest}GET_QUOTATION_ANALYSIS"; + Map postParams = { + "P_ITEM_ID": pItemID, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + "P_PO_HEADER_ID": pPoHeaderId, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getQuotationAnalysisList ?? []; + }, url, postParams); + } } diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 50aff0a..89493ee 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -3,6 +3,7 @@ import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/post_params_model.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist_response_model.dart'; class AppState { static final AppState _instance = AppState._internal(); @@ -43,7 +44,6 @@ class AppState { String? get getUserName => _username; - set setUserPassword(_password) => password = _password; MemberLoginListModel? _memberLoginList; @@ -63,4 +63,11 @@ class AppState { List? get privilegeListModel => _privilegeListModel; set setPrivilegeListModel(List? _privilegeListModel) => this._privilegeListModel = _privilegeListModel; + + List? workList; + + set setWorkList(List? _workList) => workList = _workList; + + int? workListIndex; + set setWorkListIndex(int? _workListIndex) => workListIndex = _workListIndex; } diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index ae8041f..3b200f5 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; // import 'package:fluttertoast/fluttertoast.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; @@ -64,7 +65,7 @@ class Utils { return await prefs.setString(key, value); } - static void handleException(dynamic exception, Function(String)? onErrorMessage) { + static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) { String errorMessage; if (exception is APIException) { if (exception.message == APIException.UNAUTHORIZED) { @@ -78,7 +79,19 @@ class Utils { if (onErrorMessage != null) { onErrorMessage(errorMessage); } else { - showToast(errorMessage); + if (errorMessage.contains("User session is not valid")) { + showDialog( + context: cxt, + builder: (cxt) => ConfirmDialog( + message: errorMessage, + onTap: (){ + Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route route) => false); + }, + ), + ); + } else { + showToast(errorMessage); + } } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 3eba985..9ae9bc7 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,6 +6,7 @@ import 'package:mohem_flutter_app/ui/login/login_screen.dart'; import 'package:mohem_flutter_app/ui/login/new_password_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_last_login_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_login_screen.dart'; +import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/missing_swipe/missing_swipe_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/work_list_screen.dart'; @@ -26,6 +27,7 @@ class AppRoutes { //Work List static const String workList = "/workList"; static const String missingSwipe = "/missingSwipe"; + static const String itemHistory = "/itemHistory"; static final Map routes = { login: (context) => LoginScreen(), @@ -39,5 +41,6 @@ class AppRoutes { //Work List workList: (context) => WorkListScreen(), missingSwipe: (context) => MissingSwipeScreen(), + itemHistory: (context) => ItemHistoryScreen(), }; } diff --git a/lib/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart index 9b90b2f..215f8d9 100644 --- a/lib/extensions/int_extensions.dart +++ b/lib/extensions/int_extensions.dart @@ -4,4 +4,6 @@ extension IntExtensions on int { Widget get height => SizedBox(height: toDouble()); Widget get width => SizedBox(width: toDouble()); + + Widget get makeItSquare => SizedBox(width: toDouble(), height: toDouble()); } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index a555432..30fa6f7 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -82,6 +82,8 @@ class CodegenLoader extends AssetLoader{ "whatsapp": "واتس اب", "reject": "يرفض", "approve": "يوافق", + "cancel": "إلغاء", + "requestedItems": "العناصر المطلوبة", "request": "طلب", "actions": "أجراءات", "delegate": "مندوب", @@ -113,6 +115,78 @@ class CodegenLoader extends AssetLoader{ "category": "فئة", "employeeEmailAddress": "عنوان البريد الإلكتروني للموظف", "payrollBranch": "فرع الرواتب", + "yourChangeHasBeenSavedSuccessfully": "تم حفظ التغيير الخاص بك بنجاح", + "code": "شفرة", + "unit": "وحدة", + "quantity": "كمية", + "dateRequired": "التاريخ مطلوب", + "lineStatus": "حالة الخط", + "statusDate": "تاريخ الحالة", + "transactionType": "نوع المعاملة", + "operatingUnit": "وحدة التشغيل", + "organizationCode": "كود المنظمة", + "organization": "منظمة", + "fromSubInventory": "من الجرد الفرعي", + "fromLocator": "من محدد المواقع", + "toSubInventory": "إلى الجرد الفرعي", + "toLocator": "إلى محدد المواقع", + "shipToLocator": "شحن إلى محدد المواقع", + "itemHistory": "تاريخ العنصر", + "mfg": "مبدع", + "lineType": "نوع الخط", + "price": "السعر", + "lineAmount": "مبلغ الخط", + "lineDiscount": "خصم الخط٪", + "needByDate": "القادمة إلى الأمام", + "promisedDate": "التسجيل وعد", + "deliverToLocation": "تسليم إلى الموقع", + "requisitionNumber": "رقم الطلب", + "requester": "مقدم الطلب", + "quotationAnalysis": "تحليل الاقتباس", + "subject": "موضوعات", + "description": "وصف", + "supplier": "المورد", + "site": "موقع", + "buyer": "مشتر", + "preparer": "معد", + "creationDate": "تاريخ الإنشاء", + "shipToLocation": "الشحن الى الموقع", + "quotationNumber": "رقم الإقتباس", + "quotationDate": "تاريخ الاقتباس", + "paymentTerms": "شروط الدفع", + "currency": "عملة", + "grossAmount": "المبلغ الإجمالي", + "discountAmount": "مقدار الخصم", + "customDuty": "الرسوم الجمركية", + "shipHandle": "مقبض السفينة", + "otherCharges": "رسوم أخرى", + "totalPOAmountWithVAT": "إجمالي مبلغ الشراء مع ضريبة القيمة المضافة", + "totalPOAmountInWords": "إجمالي مبلغ أمر الشراء بالكلمات", + "requestNumber": "رقم الطلب", + "uom": "UOM", + "operatingCode": "كود التشغيل", + "poNumber": "PO عدد", + "revision": "مراجعة", + "quantityOrdered": "الكمية المطلوبة", + "quantityReceived": "الكمية المستلمة", + "bonusQuantity": "كمية المكافأة", + "purchasePrice": "سعر الشراء", + "discountPer": "خصم ٪", + "balanceQuantity": "كمية التوازن", + "netPrice": "السعر الصافي", + "closureStatus": "حالة الإغلاق", + "quotationNetPrice": "صافي سعر الاقتباس", + "quotationUOM": "اقتباس UOM", + "quotationQty": "اقتباس الكمية", + "itemCode": "رمز الصنف", + "vendorName": "اسم البائع", + "quotationMFGPartNumber": "رقم الجزء MFG الاقتباس", + "quotationDeliveryDate": "تاريخ تسليم عرض الأسعار", + "quotationBonusQuantity": "كمية مكافأة الاقتباس", + "quotationLineTotal": "مجموع خط الاقتباس", + "rfqUOM": "RFQ UOM", + "rfqQty": "RFQ الكمية", + "rfqNumber": "رقم RFQ", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", @@ -220,6 +294,8 @@ static const Map en_US = { "whatsapp": "Whatsapp", "reject": "Reject", "approve": "Approve", + "cancel": "Cancel", + "requestedItems": "Requested Items", "request": "Request", "actions": "Actions", "delegate": "Delegate", @@ -251,6 +327,78 @@ static const Map en_US = { "category": "Category", "employeeEmailAddress": "Employee Email Address", "payrollBranch": "Payroll Branch", + "yourChangeHasBeenSavedSuccessfully": "Your change has been saved successfully", + "code": "Code", + "unit": "Unit", + "quantity": "Quantity", + "dateRequired": "Date Required", + "lineStatus": "Line Status", + "statusDate": "Status Date", + "transactionType": "Transaction Type", + "operatingUnit": "Operating Unit", + "organizationCode": "Organization Code", + "organization": "Organization", + "fromSubInventory": "From Sub Inventory", + "fromLocator": "From Locator", + "toSubInventory": "To Sub Inventory", + "toLocator": "To Locator", + "shipToLocator": "Ship To Locator", + "itemHistory": "Item History", + "mfg": "MFG", + "lineType": "Line Type", + "price": "Price", + "lineAmount": "Line Amount", + "lineDiscount": "Line Discount %", + "needByDate": "Need By Date", + "promisedDate": "Promised Date", + "deliverToLocation": "Deliver To Location", + "requisitionNumber": "Requisition Number", + "requester": "Requester", + "subject": "Subject", + "quotationAnalysis": "Quotation Analysis", + "description": "Description", + "supplier": "Supplier", + "site": "Site", + "buyer": "Buyer", + "preparer": "Preparer", + "creationDate": "Creation Date", + "shipToLocation": "Ship To Location", + "quotationNumber": "Quotation Number", + "quotationDate": "Quotation Date", + "paymentTerms": "Payment Terms", + "currency": "Currency", + "grossAmount": "Gross Amount", + "discountAmount": "Discount Amount", + "customDuty": "Custom Duty", + "shipHandle": "Ship Handle", + "otherCharges": "Other Charges", + "totalPOAmountWithVAT": "Total PO Amount With VAT", + "totalPOAmountInWords": "Total PO Amount In Words", + "requestNumber": "Request Number", + "uom": "UOM", + "operatingCode": "Operating Code", + "poNumber": "PO Number", + "revision": "Revision", + "quantityOrdered": "Quantity Ordered", + "quantityReceived": "Quantity Received", + "bonusQuantity": "Bonus Quantity", + "purchasePrice": "Purchase Price", + "discountPer": "Discount %", + "balanceQuantity": "Balance Quantity", + "netPrice": "Net Price", + "closureStatus": "Closure Status", + "quotationNetPrice": "Quotation Net Price", + "quotationUOM": "Quotation UOM", + "quotationQty": "Quotation Qty", + "itemCode": "item Code", + "vendorName": "Vendor Name", + "quotationMFGPartNumber": "Quotation MFG Part Number", + "quotationDeliveryDate": "Quotation Delivery Date", + "quotationBonusQuantity": "Quotation Bonus Quantity", + "quotationLineTotal": "Quotation Line Total", + "rfqUOM": "RFQ UOM", + "rfqQty": "RFQ Qty", + "rfqNumber": "RFQ Number", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index faaea1c..3dbdb7c 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -67,6 +67,8 @@ abstract class LocaleKeys { static const whatsapp = 'whatsapp'; static const reject = 'reject'; static const approve = 'approve'; + static const cancel = 'cancel'; + static const requestedItems = 'requestedItems'; static const request = 'request'; static const actions = 'actions'; static const delegate = 'delegate'; @@ -98,6 +100,78 @@ abstract class LocaleKeys { static const category = 'category'; static const employeeEmailAddress = 'employeeEmailAddress'; static const payrollBranch = 'payrollBranch'; + static const yourChangeHasBeenSavedSuccessfully = 'yourChangeHasBeenSavedSuccessfully'; + static const code = 'code'; + static const unit = 'unit'; + static const quantity = 'quantity'; + static const dateRequired = 'dateRequired'; + static const lineStatus = 'lineStatus'; + static const statusDate = 'statusDate'; + static const transactionType = 'transactionType'; + static const operatingUnit = 'operatingUnit'; + static const organizationCode = 'organizationCode'; + static const organization = 'organization'; + static const fromSubInventory = 'fromSubInventory'; + static const fromLocator = 'fromLocator'; + static const toSubInventory = 'toSubInventory'; + static const toLocator = 'toLocator'; + static const shipToLocator = 'shipToLocator'; + static const itemHistory = 'itemHistory'; + static const mfg = 'mfg'; + static const lineType = 'lineType'; + static const price = 'price'; + static const lineAmount = 'lineAmount'; + static const lineDiscount = 'lineDiscount'; + static const needByDate = 'needByDate'; + static const promisedDate = 'promisedDate'; + static const deliverToLocation = 'deliverToLocation'; + static const requisitionNumber = 'requisitionNumber'; + static const requester = 'requester'; + static const quotationAnalysis = 'quotationAnalysis'; + static const subject = 'subject'; + static const description = 'description'; + static const supplier = 'supplier'; + static const site = 'site'; + static const buyer = 'buyer'; + static const preparer = 'preparer'; + static const creationDate = 'creationDate'; + static const shipToLocation = 'shipToLocation'; + static const quotationNumber = 'quotationNumber'; + static const quotationDate = 'quotationDate'; + static const paymentTerms = 'paymentTerms'; + static const currency = 'currency'; + static const grossAmount = 'grossAmount'; + static const discountAmount = 'discountAmount'; + static const customDuty = 'customDuty'; + static const shipHandle = 'shipHandle'; + static const otherCharges = 'otherCharges'; + static const totalPOAmountWithVAT = 'totalPOAmountWithVAT'; + static const totalPOAmountInWords = 'totalPOAmountInWords'; + static const requestNumber = 'requestNumber'; + static const uom = 'uom'; + static const operatingCode = 'operatingCode'; + static const poNumber = 'poNumber'; + static const revision = 'revision'; + static const quantityOrdered = 'quantityOrdered'; + static const quantityReceived = 'quantityReceived'; + static const bonusQuantity = 'bonusQuantity'; + static const purchasePrice = 'purchasePrice'; + static const discountPer = 'discountPer'; + static const balanceQuantity = 'balanceQuantity'; + static const netPrice = 'netPrice'; + static const closureStatus = 'closureStatus'; + static const quotationNetPrice = 'quotationNetPrice'; + static const quotationUOM = 'quotationUOM'; + static const quotationQty = 'quotationQty'; + static const itemCode = 'itemCode'; + static const vendorName = 'vendorName'; + static const quotationMFGPartNumber = 'quotationMFGPartNumber'; + static const quotationDeliveryDate = 'quotationDeliveryDate'; + static const quotationBonusQuantity = 'quotationBonusQuantity'; + static const quotationLineTotal = 'quotationLineTotal'; + static const rfqUOM = 'rfqUOM'; + static const rfqQty = 'rfqQty'; + static const rfqNumber = 'rfqNumber'; static const msg = 'msg'; static const msg_named = 'msg_named'; static const clickMe = 'clickMe'; diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 956a0d0..138d686 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -1,10 +1,16 @@ import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; +import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; import 'package:mohem_flutter_app/models/get_basic_det_ntf_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_mo_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_mo_notification_body_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_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/member_login_list_model.dart'; +import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; @@ -78,7 +84,7 @@ class GenericResponseModel { List? getAddressDffStructureList; List? getAddressNotificationBodyList; List? getApprovesList; - List? getAttachementList; + List? getAttachementList; GetAttendanceTracking? getAttendanceTrackingList; List? getBasicDetColsStructureList; List? getBasicDetDffStructureList; @@ -116,7 +122,7 @@ class GenericResponseModel { List? getItemTypesList; List? getLookupValuesList; List? getMenuEntriesList; - List? getMoItemHistoryList; + List? getMoItemHistoryList; List? getMoNotificationBodyList; List? getNotificationButtonsList; List? getNotificationReassignModeList; @@ -132,10 +138,10 @@ class GenericResponseModel { List? getPendingReqFunctionsList; List? getPerformanceAppraisalList; List? getPhonesNotificationBodyList; - List? getPoItemHistoryList; - List? getPoNotificationBodyList; + List? getPoItemHistoryList; + GetPoNotificationBodyList? getPoNotificationBodyList; List? getPrNotificationBodyList; - List? getQuotationAnalysisList; + List? getQuotationAnalysisList; List? getRFCEmployeeListList; List? getRespondAttributeValueList; List? getSITCollectionNotificationBodyList; @@ -197,7 +203,7 @@ class GenericResponseModel { bool? mohemmIsInsertBusinessCardEnable; String? mohemmWifiPassword; String? mohemmWifiSSID; - String? notificationAction; + NotificationAction? notificationAction; List? notificationGetRespondAttributesList; List? notificationRespondRolesList; int? oracleOutPutNumber; @@ -598,7 +604,13 @@ class GenericResponseModel { getAddressDffStructureList = json['GetAddressDffStructureList']; getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; getApprovesList = json['GetApprovesList']; - getAttachementList = json['GetAttachementList']; + + if (json['GetAttachementList'] != null) { + getAttachementList = []; + json['GetAttachementList'].forEach((v) { + getAttachementList!.add(new GetAttachementList.fromJson(v)); + }); + } getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); getBasicDetColsStructureList = json['GetBasicDetColsStructureList']; getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; @@ -643,7 +655,12 @@ class GenericResponseModel { getItemTypesList = json['GetItemTypesList']; getLookupValuesList = json['GetLookupValuesList']; getMenuEntriesList = json["GetMenuEntriesList"] == null ? null : List.from(json["GetMenuEntriesList"].map((x) => GetMenuEntriesList.fromJson(x))); - getMoItemHistoryList = json['GetMoItemHistoryList']; + if (json['GetMoItemHistoryList'] != null) { + getMoItemHistoryList = []; + json['GetMoItemHistoryList'].forEach((v) { + getMoItemHistoryList!.add(new GetMoItemHistoryList.fromJson(v)); + }); + } if (json['GetMoNotificationBodyList'] != null) { getMoNotificationBodyList = []; @@ -672,10 +689,20 @@ class GenericResponseModel { getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; getPerformanceAppraisalList = json['GetPerformanceAppraisalList']; getPhonesNotificationBodyList = json['GetPhonesNotificationBodyList']; - getPoItemHistoryList = json['GetPoItemHistoryList']; - getPoNotificationBodyList = json['GetPoNotificationBodyList']; + if (json['GetPoItemHistoryList'] != null) { + getPoItemHistoryList = []; + json['GetPoItemHistoryList'].forEach((v) { + getPoItemHistoryList!.add(new GetPoItemHistoryList.fromJson(v)); + }); + } + getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? new GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPrNotificationBodyList = json['GetPrNotificationBodyList']; - getQuotationAnalysisList = json['GetQuotationAnalysisList']; + if (json['GetQuotationAnalysisList'] != null) { + getQuotationAnalysisList = []; + json['GetQuotationAnalysisList'].forEach((v) { + getQuotationAnalysisList!.add(new GetQuotationAnalysisList.fromJson(v)); + }); + } getRFCEmployeeListList = json['GetRFCEmployeeListList']; getRespondAttributeValueList = json['GetRespondAttributeValueList']; getSITCollectionNotificationBodyList = json['GetSITCollectionNotificationBodyList']; @@ -768,8 +795,7 @@ class GenericResponseModel { mohemmIsInsertBusinessCardEnable = json['Mohemm_IsInsertBusinessCardEnable']; mohemmWifiPassword = json['Mohemm_Wifi_Password']; mohemmWifiSSID = json['Mohemm_Wifi_SSID']; - notificationAction = json['NotificationAction']; - + notificationAction = json['NotificationAction'] != null ? NotificationAction.fromJson(json['NotificationAction']) : null; if (json['NotificationGetRespondAttributesList'] != null) { notificationGetRespondAttributesList = []; json['NotificationGetRespondAttributesList'].forEach((v) { @@ -780,7 +806,7 @@ class GenericResponseModel { if (json['NotificationRespondRolesList'] != null) { notificationRespondRolesList = []; json['NotificationGetRespondAttributesList'].forEach((v) { - // notificationRespondRolesList!.add(v); + // notificationRespondRolesList!.add(v); }); } @@ -941,7 +967,11 @@ class GenericResponseModel { data['GetAddressDffStructureList'] = this.getAddressDffStructureList; data['GetAddressNotificationBodyList'] = this.getAddressNotificationBodyList; data['GetApprovesList'] = this.getApprovesList; - data['GetAttachementList'] = this.getAttachementList; + + if (this.getAttachementList != null) { + data['GetAttachementList'] = this.getAttachementList!.map((v) => v.toJson()).toList(); + } + data['GetAttendanceTrackingList'] = this.getAttendanceTrackingList; data['GetBasicDetColsStructureList'] = this.getBasicDetColsStructureList; data['GetBasicDetDffStructureList'] = this.getBasicDetDffStructureList; @@ -983,7 +1013,9 @@ class GenericResponseModel { data['GetItemTypesList'] = this.getItemTypesList; data['GetLookupValuesList'] = this.getLookupValuesList; data['GetMenuEntriesList'] = this.getMenuEntriesList; - data['GetMoItemHistoryList'] = this.getMoItemHistoryList; + if (this.getMoItemHistoryList != null) { + data['GetMoItemHistoryList'] = this.getMoItemHistoryList!.map((v) => v.toJson()).toList(); + } if (this.getMoNotificationBodyList != null) { data['GetMoNotificationBodyList'] = this.getMoNotificationBodyList!.map((v) => v.toJson()).toList(); @@ -1006,10 +1038,17 @@ class GenericResponseModel { data['GetPendingReqFunctionsList'] = this.getPendingReqFunctionsList; data['GetPerformanceAppraisalList'] = this.getPerformanceAppraisalList; data['GetPhonesNotificationBodyList'] = this.getPhonesNotificationBodyList; - data['GetPoItemHistoryList'] = this.getPoItemHistoryList; - data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList; + if (this.getPoItemHistoryList != null) { + data['GetPoItemHistoryList'] = this.getPoItemHistoryList!.map((v) => v.toJson()).toList(); + } + + if (this.getPoNotificationBodyList != null) { + data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList!.toJson(); + } data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList; - data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList; + if (this.getQuotationAnalysisList != null) { + data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); + } data['GetRFCEmployeeListList'] = this.getRFCEmployeeListList; data['GetRespondAttributeValueList'] = this.getRespondAttributeValueList; data['GetSITCollectionNotificationBodyList'] = this.getSITCollectionNotificationBodyList; @@ -1088,7 +1127,10 @@ class GenericResponseModel { data['Mohemm_IsInsertBusinessCardEnable'] = this.mohemmIsInsertBusinessCardEnable; data['Mohemm_Wifi_Password'] = this.mohemmWifiPassword; data['Mohemm_Wifi_SSID'] = this.mohemmWifiSSID; - data['NotificationAction'] = this.notificationAction; + + if (this.notificationAction != null) { + data['NotificationAction'] = this.notificationAction!.toJson(); + } if (notificationGetRespondAttributesList != null) { data['NotificationGetRespondAttributesList'] = notificationGetRespondAttributesList!.map((v) => v.toJson()).toList(); diff --git a/lib/models/get_attachement_list_model.dart b/lib/models/get_attachement_list_model.dart new file mode 100644 index 0000000..79c43bb --- /dev/null +++ b/lib/models/get_attachement_list_model.dart @@ -0,0 +1,72 @@ +class GetAttachementList { + int? aTTACHEDDOCUMENTID; + int? cATEGORYID; + int? dATATYPEID; + int? dOCUMENTID; + String? eNTITYNAME; + String? fILECONTENTTYPE; + String? fILEDATA; + int? fILEID; + String? fILENAME; + String? pK1VALUE; + String? pK2VALUE; + String? pK3VALUE; + String? pK4VALUE; + String? pK5VALUE; + int? sEQNUM; + + GetAttachementList( + {this.aTTACHEDDOCUMENTID, + this.cATEGORYID, + this.dATATYPEID, + this.dOCUMENTID, + this.eNTITYNAME, + this.fILECONTENTTYPE, + this.fILEDATA, + this.fILEID, + this.fILENAME, + this.pK1VALUE, + this.pK2VALUE, + this.pK3VALUE, + this.pK4VALUE, + this.pK5VALUE, + this.sEQNUM}); + + GetAttachementList.fromJson(Map json) { + aTTACHEDDOCUMENTID = json['ATTACHED_DOCUMENT_ID']; + cATEGORYID = json['CATEGORY_ID']; + dATATYPEID = json['DATATYPE_ID']; + dOCUMENTID = json['DOCUMENT_ID']; + eNTITYNAME = json['ENTITY_NAME']; + fILECONTENTTYPE = json['FILE_CONTENT_TYPE']; + fILEDATA = json['FILE_DATA']; + fILEID = json['FILE_ID']; + fILENAME = json['FILE_NAME']; + pK1VALUE = json['PK1_VALUE']; + pK2VALUE = json['PK2_VALUE']; + pK3VALUE = json['PK3_VALUE']; + pK4VALUE = json['PK4_VALUE']; + pK5VALUE = json['PK5_VALUE']; + sEQNUM = json['SEQ_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['ATTACHED_DOCUMENT_ID'] = this.aTTACHEDDOCUMENTID; + data['CATEGORY_ID'] = this.cATEGORYID; + data['DATATYPE_ID'] = this.dATATYPEID; + data['DOCUMENT_ID'] = this.dOCUMENTID; + data['ENTITY_NAME'] = this.eNTITYNAME; + data['FILE_CONTENT_TYPE'] = this.fILECONTENTTYPE; + data['FILE_DATA'] = this.fILEDATA; + data['FILE_ID'] = this.fILEID; + data['FILE_NAME'] = this.fILENAME; + data['PK1_VALUE'] = this.pK1VALUE; + data['PK2_VALUE'] = this.pK2VALUE; + data['PK3_VALUE'] = this.pK3VALUE; + data['PK4_VALUE'] = this.pK4VALUE; + data['PK5_VALUE'] = this.pK5VALUE; + data['SEQ_NUM'] = this.sEQNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_mo_Item_history_list_model.dart b/lib/models/get_mo_Item_history_list_model.dart new file mode 100644 index 0000000..3604322 --- /dev/null +++ b/lib/models/get_mo_Item_history_list_model.dart @@ -0,0 +1,100 @@ +class GetMoItemHistoryList { + String? dATEREQUIRED; + String? dESCRIPTION; + String? fROMLOCATOR; + int? fROMROWNUM; + String? fROMSUBINVENTORYCODE; + String? iTEMCODE; + String? lINESTATUSDIS; + int? nOOFROWS; + String? oPERATINGUNITNAME; + String? oRGANIZATIONCODE; + int? oRGANIZATIONID; + String? oRGANIZATIONNAME; + int? qUANTITY; + String? rEQUESTNUMBER; + int? rOWNUM; + String? sHIPTOLOCATION; + String? sTATUSDATE; + String? tOLOCATOR; + int? tOROWNUM; + String? tOSUBINVENTORYCODE; + String? tRANSACTIONTYPENAME; + String? uNITOFMEASURE; + + GetMoItemHistoryList( + {this.dATEREQUIRED, + this.dESCRIPTION, + this.fROMLOCATOR, + this.fROMROWNUM, + this.fROMSUBINVENTORYCODE, + this.iTEMCODE, + this.lINESTATUSDIS, + this.nOOFROWS, + this.oPERATINGUNITNAME, + this.oRGANIZATIONCODE, + this.oRGANIZATIONID, + this.oRGANIZATIONNAME, + this.qUANTITY, + this.rEQUESTNUMBER, + this.rOWNUM, + this.sHIPTOLOCATION, + this.sTATUSDATE, + this.tOLOCATOR, + this.tOROWNUM, + this.tOSUBINVENTORYCODE, + this.tRANSACTIONTYPENAME, + this.uNITOFMEASURE}); + + GetMoItemHistoryList.fromJson(Map json) { + dATEREQUIRED = json['DATE_REQUIRED']; + dESCRIPTION = json['DESCRIPTION']; + fROMLOCATOR = json['FROM_LOCATOR']; + fROMROWNUM = json['FROM_ROW_NUM']; + fROMSUBINVENTORYCODE = json['FROM_SUBINVENTORY_CODE']; + iTEMCODE = json['ITEM_CODE']; + lINESTATUSDIS = json['LINE_STATUS_DIS']; + nOOFROWS = json['NO_OF_ROWS']; + oPERATINGUNITNAME = json['OPERATING_UNIT_NAME']; + oRGANIZATIONCODE = json['ORGANIZATION_CODE']; + oRGANIZATIONID = json['ORGANIZATION_ID']; + oRGANIZATIONNAME = json['ORGANIZATION_NAME']; + qUANTITY = json['QUANTITY']; + rEQUESTNUMBER = json['REQUEST_NUMBER']; + rOWNUM = json['ROW_NUM']; + sHIPTOLOCATION = json['SHIP_TO_LOCATION']; + sTATUSDATE = json['STATUS_DATE']; + tOLOCATOR = json['TO_LOCATOR']; + tOROWNUM = json['TO_ROW_NUM']; + tOSUBINVENTORYCODE = json['TO_SUBINVENTORY_CODE']; + tRANSACTIONTYPENAME = json['TRANSACTION_TYPE_NAME']; + uNITOFMEASURE = json['UNIT_OF_MEASURE']; + } + + Map toJson() { + final Map data = new Map(); + data['DATE_REQUIRED'] = this.dATEREQUIRED; + data['DESCRIPTION'] = this.dESCRIPTION; + data['FROM_LOCATOR'] = this.fROMLOCATOR; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['FROM_SUBINVENTORY_CODE'] = this.fROMSUBINVENTORYCODE; + data['ITEM_CODE'] = this.iTEMCODE; + data['LINE_STATUS_DIS'] = this.lINESTATUSDIS; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['OPERATING_UNIT_NAME'] = this.oPERATINGUNITNAME; + data['ORGANIZATION_CODE'] = this.oRGANIZATIONCODE; + data['ORGANIZATION_ID'] = this.oRGANIZATIONID; + data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME; + data['QUANTITY'] = this.qUANTITY; + data['REQUEST_NUMBER'] = this.rEQUESTNUMBER; + data['ROW_NUM'] = this.rOWNUM; + data['SHIP_TO_LOCATION'] = this.sHIPTOLOCATION; + data['STATUS_DATE'] = this.sTATUSDATE; + data['TO_LOCATOR'] = this.tOLOCATOR; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['TO_SUBINVENTORY_CODE'] = this.tOSUBINVENTORYCODE; + data['TRANSACTION_TYPE_NAME'] = this.tRANSACTIONTYPENAME; + data['UNIT_OF_MEASURE'] = this.uNITOFMEASURE; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_po_Item_history_list_model.dart b/lib/models/get_po_Item_history_list_model.dart new file mode 100644 index 0000000..d51861b --- /dev/null +++ b/lib/models/get_po_Item_history_list_model.dart @@ -0,0 +1,92 @@ +class GetPoItemHistoryList { + int? bALANCEQUANTITY; + int? bONUSQUANTITY; + String? bUYER; + String? cLOSEDCODE; + String? cREATIONDATE; + int? dISCOUNTPERCENTAGE; + int? fROMROWNUM; + int? iTEMID; + int? nETPRICE; + int? nOOFROWS; + String? oUNAME; + String? pONUMBER; + int? pURCHASEPRICE; + int? qUANTITYORDERED; + int? qUANTITYRECEIVED; + int? rEVISIONNUM; + int? rOWNUM; + String? sUPPLIER; + int? tOROWNUM; + String? uOM; + + GetPoItemHistoryList( + {this.bALANCEQUANTITY, + this.bONUSQUANTITY, + this.bUYER, + this.cLOSEDCODE, + this.cREATIONDATE, + this.dISCOUNTPERCENTAGE, + this.fROMROWNUM, + this.iTEMID, + this.nETPRICE, + this.nOOFROWS, + this.oUNAME, + this.pONUMBER, + this.pURCHASEPRICE, + this.qUANTITYORDERED, + this.qUANTITYRECEIVED, + this.rEVISIONNUM, + this.rOWNUM, + this.sUPPLIER, + this.tOROWNUM, + this.uOM}); + + GetPoItemHistoryList.fromJson(Map json) { + bALANCEQUANTITY = json['BALANCE_QUANTITY']; + bONUSQUANTITY = json['BONUS_QUANTITY']; + bUYER = json['BUYER']; + cLOSEDCODE = json['CLOSED_CODE']; + cREATIONDATE = json['CREATION_DATE']; + dISCOUNTPERCENTAGE = json['DISCOUNT_PERCENTAGE']; + fROMROWNUM = json['FROM_ROW_NUM']; + iTEMID = json['ITEM_ID']; + nETPRICE = json['NET_PRICE']; + nOOFROWS = json['NO_OF_ROWS']; + oUNAME = json['OU_NAME']; + pONUMBER = json['PO_NUMBER']; + pURCHASEPRICE = json['PURCHASE_PRICE']; + qUANTITYORDERED = json['QUANTITY_ORDERED']; + qUANTITYRECEIVED = json['QUANTITY_RECEIVED']; + rEVISIONNUM = json['REVISION_NUM']; + rOWNUM = json['ROW_NUM']; + sUPPLIER = json['SUPPLIER']; + tOROWNUM = json['TO_ROW_NUM']; + uOM = json['UOM']; + } + + Map toJson() { + final Map data = new Map(); + data['BALANCE_QUANTITY'] = this.bALANCEQUANTITY; + data['BONUS_QUANTITY'] = this.bONUSQUANTITY; + data['BUYER'] = this.bUYER; + data['CLOSED_CODE'] = this.cLOSEDCODE; + data['CREATION_DATE'] = this.cREATIONDATE; + data['DISCOUNT_PERCENTAGE'] = this.dISCOUNTPERCENTAGE; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['ITEM_ID'] = this.iTEMID; + data['NET_PRICE'] = this.nETPRICE; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['OU_NAME'] = this.oUNAME; + data['PO_NUMBER'] = this.pONUMBER; + data['PURCHASE_PRICE'] = this.pURCHASEPRICE; + data['QUANTITY_ORDERED'] = this.qUANTITYORDERED; + data['QUANTITY_RECEIVED'] = this.qUANTITYRECEIVED; + data['REVISION_NUM'] = this.rEVISIONNUM; + data['ROW_NUM'] = this.rOWNUM; + data['SUPPLIER'] = this.sUPPLIER; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['UOM'] = this.uOM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_po_notification_body_list_model.dart b/lib/models/get_po_notification_body_list_model.dart new file mode 100644 index 0000000..7b5c1cb --- /dev/null +++ b/lib/models/get_po_notification_body_list_model.dart @@ -0,0 +1,242 @@ + +class GetPoNotificationBodyList { + List? pOHeader; + List? pOLines; + String? pINFORMATION; + String? pQUESTION; + + GetPoNotificationBodyList( + {this.pOHeader, this.pOLines, this.pINFORMATION, this.pQUESTION}); + + GetPoNotificationBodyList.fromJson(Map json) { + if (json['POHeader'] != null) { + pOHeader = []; + json['POHeader'].forEach((v) { + pOHeader!.add(new POHeader.fromJson(v)); + }); + } + if (json['POLines'] != null) { + pOLines = []; + json['POLines'].forEach((v) { + pOLines!.add(new POLines.fromJson(v)); + }); + } + pINFORMATION = json['P_INFORMATION']; + pQUESTION = json['P_QUESTION']; + } + + Map toJson() { + final Map data = new Map(); + if (this.pOHeader != null) { + data['POHeader'] = this.pOHeader!.map((v) => v.toJson()).toList(); + } + if (this.pOLines != null) { + data['POLines'] = this.pOLines!.map((v) => v.toJson()).toList(); + } + data['P_INFORMATION'] = this.pINFORMATION; + data['P_QUESTION'] = this.pQUESTION; + return data; + } +} + +class POHeader { + String? bUYER; + String? cOMMENTS; + String? cREATIONDATE; + String? cURRENCYNAME; + int? cUSTOMDUTY; + int? dISCOUNTAMOUNT; + int? gROSSAMOUNT; + String? lOCCUR; + int? lOCCURTOTPOAMT; + int? oTHERCHARGES; + String? pAYMENTTERMS; + String? pONUMBER; + String? pREPARER; + String? qUOTATIONDATE; + String? qUOTATIONNUMBER; + int? sALESTAX; + int? sHIPHANDLE; + String? sHIPTOLOCATIONNAME; + int? tOTALPODISCOUNT; + int? tOTPOAMT; + String? tOTPOAMTWORD; + String? vENDORNAME; + String? vENDORSITECODE; + + POHeader( + {this.bUYER, + this.cOMMENTS, + this.cREATIONDATE, + this.cURRENCYNAME, + this.cUSTOMDUTY, + this.dISCOUNTAMOUNT, + this.gROSSAMOUNT, + this.lOCCUR, + this.lOCCURTOTPOAMT, + this.oTHERCHARGES, + this.pAYMENTTERMS, + this.pONUMBER, + this.pREPARER, + this.qUOTATIONDATE, + this.qUOTATIONNUMBER, + this.sALESTAX, + this.sHIPHANDLE, + this.sHIPTOLOCATIONNAME, + this.tOTALPODISCOUNT, + this.tOTPOAMT, + this.tOTPOAMTWORD, + this.vENDORNAME, + this.vENDORSITECODE}); + + POHeader.fromJson(Map json) { + bUYER = json['BUYER']; + cOMMENTS = json['COMMENTS']; + cREATIONDATE = json['CREATION_DATE']; + cURRENCYNAME = json['CURRENCY_NAME']; + cUSTOMDUTY = json['CUSTOM_DUTY']; + dISCOUNTAMOUNT = json['DISCOUNT_AMOUNT']; + gROSSAMOUNT = json['GROSS_AMOUNT']; + lOCCUR = json['LOC_CUR']; + lOCCURTOTPOAMT = json['LOC_CUR_TOT_PO_AMT']; + oTHERCHARGES = json['OTHER_CHARGES']; + pAYMENTTERMS = json['PAYMENT_TERMS']; + pONUMBER = json['PO_NUMBER']; + pREPARER = json['PREPARER']; + qUOTATIONDATE = json['QUOTATION_DATE']; + qUOTATIONNUMBER = json['QUOTATION_NUMBER']; + sALESTAX = json['SALES_TAX']; + sHIPHANDLE = json['SHIP_HANDLE']; + sHIPTOLOCATIONNAME = json['SHIP_TO_LOCATION_NAME']; + tOTALPODISCOUNT = json['TOTAL_PO_DISCOUNT']; + tOTPOAMT = json['TOT_PO_AMT']; + tOTPOAMTWORD = json['TOT_PO_AMT_WORD']; + vENDORNAME = json['VENDOR_NAME']; + vENDORSITECODE = json['VENDOR_SITE_CODE']; + } + + Map toJson() { + final Map data = new Map(); + data['BUYER'] = this.bUYER; + data['COMMENTS'] = this.cOMMENTS; + data['CREATION_DATE'] = this.cREATIONDATE; + data['CURRENCY_NAME'] = this.cURRENCYNAME; + data['CUSTOM_DUTY'] = this.cUSTOMDUTY; + data['DISCOUNT_AMOUNT'] = this.dISCOUNTAMOUNT; + data['GROSS_AMOUNT'] = this.gROSSAMOUNT; + data['LOC_CUR'] = this.lOCCUR; + data['LOC_CUR_TOT_PO_AMT'] = this.lOCCURTOTPOAMT; + data['OTHER_CHARGES'] = this.oTHERCHARGES; + data['PAYMENT_TERMS'] = this.pAYMENTTERMS; + data['PO_NUMBER'] = this.pONUMBER; + data['PREPARER'] = this.pREPARER; + data['QUOTATION_DATE'] = this.qUOTATIONDATE; + data['QUOTATION_NUMBER'] = this.qUOTATIONNUMBER; + data['SALES_TAX'] = this.sALESTAX; + data['SHIP_HANDLE'] = this.sHIPHANDLE; + data['SHIP_TO_LOCATION_NAME'] = this.sHIPTOLOCATIONNAME; + data['TOTAL_PO_DISCOUNT'] = this.tOTALPODISCOUNT; + data['TOT_PO_AMT'] = this.tOTPOAMT; + data['TOT_PO_AMT_WORD'] = this.tOTPOAMTWORD; + data['VENDOR_NAME'] = this.vENDORNAME; + data['VENDOR_SITE_CODE'] = this.vENDORSITECODE; + return data; + } +} + +class POLines { + String? dELIVERTOLOCATION; + int? fROMROWNUM; + String? iTEMCODE; + String? iTEMDESCRIPTION; + int? iTEMID; + int? lINEAMOUNT; + int? lINEDISCPERCENTAGE; + int? lINENUM; + String? lINETYPE; + String? mFG; + String? nEEDBYDATE; + int? nOOFROWS; + int? pOHEADERID; + String? pROMISEDDATE; + String? pRNUM; + int? qUANTITY; + String? rEQUESTOR; + int? rOWNUM; + int? tOROWNUM; + int? uNITPRICE; + String? uOM; + + POLines( + {this.dELIVERTOLOCATION, + this.fROMROWNUM, + this.iTEMCODE, + this.iTEMDESCRIPTION, + this.iTEMID, + this.lINEAMOUNT, + this.lINEDISCPERCENTAGE, + this.lINENUM, + this.lINETYPE, + this.mFG, + this.nEEDBYDATE, + this.nOOFROWS, + this.pOHEADERID, + this.pROMISEDDATE, + this.pRNUM, + this.qUANTITY, + this.rEQUESTOR, + this.rOWNUM, + this.tOROWNUM, + this.uNITPRICE, + this.uOM}); + + POLines.fromJson(Map json) { + dELIVERTOLOCATION = json['DELIVER_TO_LOCATION']; + fROMROWNUM = json['FROM_ROW_NUM']; + iTEMCODE = json['ITEM_CODE']; + iTEMDESCRIPTION = json['ITEM_DESCRIPTION']; + iTEMID = json['ITEM_ID']; + lINEAMOUNT = json['LINE_AMOUNT']; + lINEDISCPERCENTAGE = json['LINE_DISC_PERCENTAGE']; + lINENUM = json['LINE_NUM']; + lINETYPE = json['LINE_TYPE']; + mFG = json['MFG']; + nEEDBYDATE = json['NEED_BY_DATE']; + nOOFROWS = json['NO_OF_ROWS']; + pOHEADERID = json['PO_HEADER_ID']; + pROMISEDDATE = json['PROMISED_DATE']; + pRNUM = json['PR_NUM']; + qUANTITY = json['QUANTITY']; + rEQUESTOR = json['REQUESTOR']; + rOWNUM = json['ROW_NUM']; + tOROWNUM = json['TO_ROW_NUM']; + uNITPRICE = json['UNIT_PRICE']; + uOM = json['UOM']; + } + + Map toJson() { + final Map data = new Map(); + data['DELIVER_TO_LOCATION'] = this.dELIVERTOLOCATION; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['ITEM_CODE'] = this.iTEMCODE; + data['ITEM_DESCRIPTION'] = this.iTEMDESCRIPTION; + data['ITEM_ID'] = this.iTEMID; + data['LINE_AMOUNT'] = this.lINEAMOUNT; + data['LINE_DISC_PERCENTAGE'] = this.lINEDISCPERCENTAGE; + data['LINE_NUM'] = this.lINENUM; + data['LINE_TYPE'] = this.lINETYPE; + data['MFG'] = this.mFG; + data['NEED_BY_DATE'] = this.nEEDBYDATE; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['PO_HEADER_ID'] = this.pOHEADERID; + data['PROMISED_DATE'] = this.pROMISEDDATE; + data['PR_NUM'] = this.pRNUM; + data['QUANTITY'] = this.qUANTITY; + data['REQUESTOR'] = this.rEQUESTOR; + data['ROW_NUM'] = this.rOWNUM; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['UNIT_PRICE'] = this.uNITPRICE; + data['UOM'] = this.uOM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_quotation_analysis_list_model.dart b/lib/models/get_quotation_analysis_list_model.dart new file mode 100644 index 0000000..c0be32d --- /dev/null +++ b/lib/models/get_quotation_analysis_list_model.dart @@ -0,0 +1,84 @@ +class GetQuotationAnalysisList { + int? fROMROWNUM; + String? iTEMCODE; + String? iTEMDESC; + int? nOOFROWS; + String? qUOTBONUSQTY; + String? qUOTDELIVERYDATE; + int? qUOTLINETOTAL; + String? qUOTMFGPARTNUM; + String? qUOTNUM; + int? qUOTQTY; + int? qUOTUNITPRICE; + String? qUOTUOM; + String? rFQNUM; + int? rFQQTY; + String? rFQUOM; + int? rOWNUM; + int? tOROWNUM; + String? vENDORNAME; + + GetQuotationAnalysisList( + {this.fROMROWNUM, + this.iTEMCODE, + this.iTEMDESC, + this.nOOFROWS, + this.qUOTBONUSQTY, + this.qUOTDELIVERYDATE, + this.qUOTLINETOTAL, + this.qUOTMFGPARTNUM, + this.qUOTNUM, + this.qUOTQTY, + this.qUOTUNITPRICE, + this.qUOTUOM, + this.rFQNUM, + this.rFQQTY, + this.rFQUOM, + this.rOWNUM, + this.tOROWNUM, + this.vENDORNAME}); + + GetQuotationAnalysisList.fromJson(Map json) { + fROMROWNUM = json['FROM_ROW_NUM']; + iTEMCODE = json['ITEM_CODE']; + iTEMDESC = json['ITEM_DESC']; + nOOFROWS = json['NO_OF_ROWS']; + qUOTBONUSQTY = json['QUOT_BONUS_QTY']; + qUOTDELIVERYDATE = json['QUOT_DELIVERY_DATE']; + qUOTLINETOTAL = json['QUOT_LINE_TOTAL']; + qUOTMFGPARTNUM = json['QUOT_MFG_PART_NUM']; + qUOTNUM = json['QUOT_NUM']; + qUOTQTY = json['QUOT_QTY']; + qUOTUNITPRICE = json['QUOT_UNIT_PRICE']; + qUOTUOM = json['QUOT_UOM']; + rFQNUM = json['RFQ_NUM']; + rFQQTY = json['RFQ_QTY']; + rFQUOM = json['RFQ_UOM']; + rOWNUM = json['ROW_NUM']; + tOROWNUM = json['TO_ROW_NUM']; + vENDORNAME = json['VENDOR_NAME']; + } + + Map toJson() { + final Map data = new Map(); + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['ITEM_CODE'] = this.iTEMCODE; + data['ITEM_DESC'] = this.iTEMDESC; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['QUOT_BONUS_QTY'] = this.qUOTBONUSQTY; + data['QUOT_DELIVERY_DATE'] = this.qUOTDELIVERYDATE; + data['QUOT_LINE_TOTAL'] = this.qUOTLINETOTAL; + data['QUOT_MFG_PART_NUM'] = this.qUOTMFGPARTNUM; + data['QUOT_NUM'] = this.qUOTNUM; + data['QUOT_QTY'] = this.qUOTQTY; + data['QUOT_UNIT_PRICE'] = this.qUOTUNITPRICE; + data['QUOT_UOM'] = this.qUOTUOM; + data['RFQ_NUM'] = this.rFQNUM; + data['RFQ_QTY'] = this.rFQQTY; + data['RFQ_UOM'] = this.rFQUOM; + data['ROW_NUM'] = this.rOWNUM; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['VENDOR_NAME'] = this.vENDORNAME; + return data; + } +} \ No newline at end of file diff --git a/lib/models/member_information_list_model.dart b/lib/models/member_information_list_model.dart index da95ed0..dc64e53 100644 --- a/lib/models/member_information_list_model.dart +++ b/lib/models/member_information_list_model.dart @@ -32,7 +32,7 @@ class MemberInformationListModel { String? fREQUENCY; String? fREQUENCYMEANING; int? fROMROWNUM; - String? gRADEID; + int? gRADEID; String? gRADENAME; String? hIREDATE; int? jOBID; diff --git a/lib/models/notification_action_model.dart b/lib/models/notification_action_model.dart new file mode 100644 index 0000000..a1214e1 --- /dev/null +++ b/lib/models/notification_action_model.dart @@ -0,0 +1,18 @@ +class NotificationAction { + String? pRETURNMSG; + String? pRETURNSTATUS; + + NotificationAction({this.pRETURNMSG, this.pRETURNSTATUS}); + + NotificationAction.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + final Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index f15e244..9fab4b9 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -40,7 +40,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List? getMenuEntriesList; //Attendance Tracking API's & Methods - void fetchAttendanceTracking() async { + void fetchAttendanceTracking(context) async { try { attendanceTracking = await DashboardApiClient().getAttendanceTracking(); isAttendanceTrackingLoading = false; @@ -51,7 +51,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { // notifyListeners(); } catch (ex) { - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } @@ -90,12 +90,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { logger.wtf(ex); if (showLoading) Utils.hideLoading(context); notifyListeners(); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } //Missing Siwpe API's & Methods - Future fetchMissingSwipe() async { + Future fetchMissingSwipe(context) async { try { GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenMissingSwipes(); isMissingSwipeLoading = false; @@ -105,12 +105,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isMissingSwipeLoading = false; logger.wtf(ex); notifyListeners(); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } //Leave and Ticket Balance API's & Methods - Future fetchLeaveTicketBalance() async { + Future fetchLeaveTicketBalance(context) async { try { GenericResponseModel? genericResponseModel = await DashboardApiClient().getAccrualBalances(); isLeaveTicketBalanceLoading = false; @@ -121,7 +121,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isLeaveTicketBalanceLoading = false; logger.wtf(ex); notifyListeners(); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } @@ -140,7 +140,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } catch (ex) { logger.wtf(ex); notifyListeners(); - Utils.handleException(ex, null); + Utils.handleException(ex, null, null); } } @@ -155,7 +155,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } catch (ex) { logger.wtf(ex); notifyListeners(); - Utils.handleException(ex, null); + Utils.handleException(ex, null, null); } } @@ -176,4 +176,8 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { // } return menus; } + + void notify() { + notifyListeners(); + } } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index f7260cf..53f36f7 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -32,10 +32,10 @@ class _DashboardScreenState extends State { void initState() { super.initState(); data = Provider.of(context, listen: false); - data.fetchAttendanceTracking(); + data.fetchAttendanceTracking(context); data.fetchWorkListCounter(context); - data.fetchMissingSwipe(); - data.fetchLeaveTicketBalance(); + data.fetchMissingSwipe(context); + data.fetchLeaveTicketBalance(context); // data.fetchMenuEntries(); } diff --git a/lib/ui/login/forgot_password_screen.dart b/lib/ui/login/forgot_password_screen.dart index 17b105f..f058d43 100644 --- a/lib/ui/login/forgot_password_screen.dart +++ b/lib/ui/login/forgot_password_screen.dart @@ -69,7 +69,7 @@ class _ForgotPasswordScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 964c633..cdcdb94 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -75,6 +75,7 @@ class _LoginScreenState extends State { Utils.showLoading(context); firebaseToken = await _firebaseMessaging.getToken(); loginInfo = await LoginApiClient().getMobileLoginInfoNEW(firebaseToken ?? "", Platform.isAndroid ? "android" : "ios"); + loginInfo!.deviceToken = firebaseToken; if (loginInfo == null) { Utils.hideLoading(context); print("Device token not found"); @@ -87,7 +88,7 @@ class _LoginScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } @@ -119,7 +120,7 @@ class _LoginScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, (msg) { + Utils.handleException(ex, context, (msg) { Utils.confirmDialog(context, msg); }); } diff --git a/lib/ui/login/new_password_screen.dart b/lib/ui/login/new_password_screen.dart index e0a8f94..7f011e7 100644 --- a/lib/ui/login/new_password_screen.dart +++ b/lib/ui/login/new_password_screen.dart @@ -46,7 +46,7 @@ class _NewPasswordScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, (msg) { + Utils.handleException(ex, context, (msg) { Utils.confirmDialog(context, msg); }); } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 52ec751..21f4cf6 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -246,6 +248,15 @@ class _VerifyLastLoginScreenState extends State { Utils.showLoading(context); try { GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); + GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( + AppState().memberLoginList?.pEMAILADDRESS ?? "", + genericResponseModel?.pSESSIONID ?? 0, + genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "", + _flag, + AppState().memberLoginList?.pMOBILENUMBER ?? "", + AppState().getUserName!, + mobileLoginInfoListModel!.deviceToken!, + Platform.isAndroid ? "android" : "ios"); if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); // Navigator.pop(context); @@ -256,7 +267,7 @@ class _VerifyLastLoginScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } }, () => { diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index 8e9255f..5fb0d1f 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -692,7 +692,7 @@ class _VerifyLoginScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } }, () => { @@ -702,7 +702,7 @@ class _VerifyLoginScreenState extends State { } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } }, diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index b4ca256..0f4ea7b 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -99,7 +99,7 @@ // setState(() {}); // } catch (ex) { // print(ex); -// Utils.handleException(ex, null); +// Utils.handleException(ex, context, null); // Utils.hideLoading(context); // } // } @@ -132,7 +132,7 @@ // Utils.hideLoading(context); // Navigator.pop(context); // } catch (ex) { -// Utils.handleException(ex, null); +// Utils.handleException(ex, context, null); // Utils.hideLoading(context); // } // } diff --git a/lib/ui/work_list/item_history_screen.dart b/lib/ui/work_list/item_history_screen.dart new file mode 100644 index 0000000..904e578 --- /dev/null +++ b/lib/ui/work_list/item_history_screen.dart @@ -0,0 +1,182 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +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_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'; + +class ItemHistoryScreenParams { + String? title; + bool isItemHistory; + bool isMO; + int? pItemId; + int? pPoHeaderId; + int? pOrgId; + + ItemHistoryScreenParams({@required this.title, this.isItemHistory = true, this.isMO = true, this.pItemId, this.pPoHeaderId, this.pOrgId}); +} + +class ItemHistoryScreen extends StatefulWidget { + ItemHistoryScreen({Key? key}) : super(key: key); + + @override + _ItemHistoryScreenState createState() { + return _ItemHistoryScreenState(); + } +} + +class _ItemHistoryScreenState extends State { + ItemHistoryScreenParams? _screenParams; + + List moItemHistoryList = []; + List poItemHistoryList = []; + List quotationAnalysisList = []; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + void loadData() { + if (_screenParams == null) { + _screenParams = ModalRoute.of(context)!.settings.arguments as ItemHistoryScreenParams; + getDataFromApi(); + } + } + + void getDataFromApi() async { + try { + Utils.showLoading(context); + if (_screenParams!.isItemHistory) { + if (_screenParams!.isMO) { + moItemHistoryList = await WorkListApiClient().getMoItemHistory(_screenParams!.pItemId!, _screenParams!.pOrgId!); + } else { + poItemHistoryList = await WorkListApiClient().getPoItemHistory(_screenParams!.pItemId!); + } + } else { + quotationAnalysisList = await WorkListApiClient().getQuotationAnalysis(_screenParams!.pItemId!, _screenParams!.pPoHeaderId!); + } + + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + loadData(); + return Scaffold( + appBar: AppBarWidget(context, title: _screenParams?.title ?? ""), + backgroundColor: Colors.white, + body: ListView( + padding: const EdgeInsets.all(21), + physics: const BouncingScrollPhysics(), + children: [ + if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(), + if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(), + if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData() + ], + ), + ); + } + + Widget loadMoItemHistoryData() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.requestNumber.tr(), moItemHistoryList[index].rEQUESTNUMBER ?? ""), + ItemDetailView(LocaleKeys.uom.tr(), moItemHistoryList[index].uNITOFMEASURE ?? ""), + ItemDetailView(LocaleKeys.quantity.tr(), moItemHistoryList[index].qUANTITY?.toString() ?? ""), + ItemDetailView(LocaleKeys.dateRequired.tr(), moItemHistoryList[index].dATEREQUIRED ?? ""), + ItemDetailView(LocaleKeys.lineStatus.tr(), moItemHistoryList[index].lINESTATUSDIS ?? ""), + ItemDetailView(LocaleKeys.statusDate.tr(), moItemHistoryList[index].sTATUSDATE ?? ""), + ItemDetailView(LocaleKeys.transactionType.tr(), moItemHistoryList[index].tRANSACTIONTYPENAME ?? ""), + ItemDetailView(LocaleKeys.organization.tr(), moItemHistoryList[index].oRGANIZATIONNAME ?? ""), + ItemDetailView(LocaleKeys.operatingCode.tr(), moItemHistoryList[index].oRGANIZATIONCODE ?? ""), + ItemDetailView(LocaleKeys.operatingUnit.tr(), moItemHistoryList[index].oPERATINGUNITNAME ?? ""), + ItemDetailView(LocaleKeys.fromSubInventory.tr(), moItemHistoryList[index].fROMSUBINVENTORYCODE ?? ""), + ItemDetailView(LocaleKeys.fromLocator.tr(), moItemHistoryList[index].fROMLOCATOR ?? ""), + ItemDetailView(LocaleKeys.toSubInventory.tr(), moItemHistoryList[index].tOSUBINVENTORYCODE ?? ""), + ItemDetailView(LocaleKeys.toLocator.tr(), moItemHistoryList[index].tOLOCATOR ?? ""), + ItemDetailView(LocaleKeys.shipToLocation.tr(), moItemHistoryList[index].sHIPTOLOCATION ?? ""), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: moItemHistoryList.length); + } + + Widget loadPoItemHistoryData() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.operatingUnit.tr(), poItemHistoryList[index].oUNAME ?? ""), + ItemDetailView(LocaleKeys.poNumber.tr(), poItemHistoryList[index].pONUMBER ?? ""), + ItemDetailView(LocaleKeys.revision.tr(), poItemHistoryList[index].rEVISIONNUM?.toString() ?? ""), + ItemDetailView(LocaleKeys.creationDate.tr(), poItemHistoryList[index].cREATIONDATE ?? ""), + ItemDetailView(LocaleKeys.supplier.tr(), poItemHistoryList[index].sUPPLIER ?? ""), + ItemDetailView(LocaleKeys.buyer.tr(), poItemHistoryList[index].bUYER ?? ""), + ItemDetailView(LocaleKeys.uom.tr(), poItemHistoryList[index].uOM ?? ""), + ItemDetailView(LocaleKeys.quantityOrdered.tr(), poItemHistoryList[index].qUANTITYORDERED?.toString() ?? ""), + ItemDetailView(LocaleKeys.quantityReceived.tr(), poItemHistoryList[index].qUANTITYRECEIVED?.toString() ?? ""), + ItemDetailView(LocaleKeys.bonusQuantity.tr(), poItemHistoryList[index].bONUSQUANTITY?.toString() ?? ""), + ItemDetailView(LocaleKeys.purchasePrice.tr(), poItemHistoryList[index].pURCHASEPRICE?.toString() ?? ""), + ItemDetailView(LocaleKeys.discountPer.tr(), poItemHistoryList[index].dISCOUNTPERCENTAGE?.toString() ?? ""), + ItemDetailView(LocaleKeys.balanceQuantity.tr(), poItemHistoryList[index].bALANCEQUANTITY?.toString() ?? ""), + ItemDetailView(LocaleKeys.netPrice.tr(), poItemHistoryList[index].nETPRICE?.toString() ?? ""), + ItemDetailView(LocaleKeys.closureStatus.tr(), poItemHistoryList[index].cLOSEDCODE ?? ""), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: poItemHistoryList.length); + } + + Widget loadQuotationAnalysisData() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.quotationNumber.tr(), quotationAnalysisList[index].qUOTNUM ?? ""), + ItemDetailView(LocaleKeys.vendorName.tr(), quotationAnalysisList[index].vENDORNAME ?? ""), + ItemDetailView(LocaleKeys.itemCode.tr(), quotationAnalysisList[index].iTEMCODE ?? ""), + ItemDetailView(LocaleKeys.description.tr(), quotationAnalysisList[index].iTEMDESC ?? ""), + ItemDetailView(LocaleKeys.quotationQty.tr(), quotationAnalysisList[index].qUOTQTY?.toString() ?? ""), + ItemDetailView(LocaleKeys.quotationUOM.tr(), quotationAnalysisList[index].qUOTUOM ?? ""), + ItemDetailView(LocaleKeys.quotationNetPrice.tr(), quotationAnalysisList[index].qUOTUNITPRICE?.toString() ?? ""), + ItemDetailView(LocaleKeys.quotationLineTotal.tr(), quotationAnalysisList[index].qUOTLINETOTAL?.toString() ?? ""), + ItemDetailView(LocaleKeys.quotationBonusQuantity.tr(), quotationAnalysisList[index].qUOTBONUSQTY ?? ""), + ItemDetailView(LocaleKeys.quotationDeliveryDate.tr(), quotationAnalysisList[index].qUOTDELIVERYDATE ?? ""), + ItemDetailView(LocaleKeys.quotationMFGPartNumber.tr(), quotationAnalysisList[index].qUOTMFGPARTNUM ?? ""), + ItemDetailView(LocaleKeys.rfqNumber.tr(), quotationAnalysisList[index].rFQNUM ?? ""), + ItemDetailView(LocaleKeys.rfqQty.tr(), quotationAnalysisList[index].rFQQTY?.toString() ?? ""), + ItemDetailView(LocaleKeys.rfqUOM.tr(), quotationAnalysisList[index].rFQUOM ?? ""), + ], + ).objectContainerView(title: "${quotationAnalysisList[index].iTEMCODE}-${quotationAnalysisList[index].iTEMDESC}" ?? ""), + separatorBuilder: (cxt, index) => 12.height, + itemCount: quotationAnalysisList.length); + } +} diff --git a/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart b/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart index 652eba8..692f5d8 100644 --- a/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart +++ b/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart @@ -1,61 +1,54 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:mohem_flutter_app/extensions/string_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/widget_extensions.dart'; +import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; class AttachmentsFragment extends StatelessWidget { + final List getAttachmentList; + + AttachmentsFragment(this.getAttachmentList); + @override Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: double.infinity, - child: ListView.separated( - itemCount: 2, - padding: EdgeInsets.all(21), - itemBuilder: (context, index) { - return showItem(attachmentsList[index]); - }, - separatorBuilder: (BuildContext context, int index) { - return 21.height; - }, - ), - ); + return ListView.separated( + itemCount: getAttachmentList.length, + itemBuilder: (context, index) { + return Row( + children: [ + SvgPicture.asset(determineFileIcon(getAttachmentList[index].fILECONTENTTYPE ?? "")), + 12.width, + (getAttachmentList[index].fILENAME?.capitalizeFirstofEach ?? "").toText16().expanded, + ], + ).objectContainerView().onPress(() {}); + }, + separatorBuilder: (BuildContext context, int index) => 12.height, + ).paddingAll(21); } - Widget showItem(Attachments attachments) { - return Container( - width: double.infinity, - padding: EdgeInsets.all(21), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Row( - children: [ - SvgPicture.asset(attachments.icon), - 12.width, - attachments.title.toText16() - ], - ), - ); + String determineFileIcon(String fileContentType) { + String icon = ""; + switch (fileContentType) { + case "pdf": + icon = "assets/images/pdf.svg"; + break; + case "xls": + icon = "assets/images/xls.svg"; + break; + case "xlsx": + icon = "assets/images/xls.svg"; + break; + case "png": + icon = "assets/images/png.svg"; + break; + case "jpg": + icon = "assets/images/jpg.svg"; + break; + case "jpeg": + icon = "assets/images/jpg.svg"; + break; + } + return icon; } } - -class Attachments { - String title; - String icon; - - Attachments(this.title, this.icon); -} - -List attachmentsList = [ - Attachments("Attachment File Name.png", "assets/images/png.svg"), - Attachments("Attachment File Name.pdf", "assets/images/pdf.svg"), -]; diff --git a/lib/ui/work_list/missing_swipe/fragments/detail_fragment.dart b/lib/ui/work_list/missing_swipe/fragments/detail_fragment.dart index 9e42459..a8e6282 100644 --- a/lib/ui/work_list/missing_swipe/fragments/detail_fragment.dart +++ b/lib/ui/work_list/missing_swipe/fragments/detail_fragment.dart @@ -8,11 +8,14 @@ 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/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; class DetailFragment extends StatefulWidget { WorkListResponseModel? workListData; MemberInformationListModel? memberInformationListModel; + DetailFragment(this.workListData, this.memberInformationListModel); + @override State createState() => _DetailFragmentState(); } @@ -28,12 +31,12 @@ class _DetailFragmentState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - detailListItem(LocaleKeys.from.tr(), widget.workListData!.fROMUSER ?? ""), - detailListItem(LocaleKeys.to.tr(), widget.workListData!.tOUSER ?? ""), - detailListItem(LocaleKeys.sent.tr(), widget.workListData!.bEGINDATE ?? ""), - detailListItem(LocaleKeys.closed.tr(), widget.workListData!.eNDDATE ?? ""), - detailListItem(LocaleKeys.id.tr(), widget.workListData!.nOTIFICATIONID?.toString() ?? ""), - detailListItem(LocaleKeys.responder.tr(), widget.workListData!.rESPONDER ?? ""), + ItemDetailView(LocaleKeys.from.tr(), widget.workListData!.fROMUSER ?? ""), + ItemDetailView(LocaleKeys.to.tr(), widget.workListData!.tOUSER ?? ""), + ItemDetailView(LocaleKeys.sent.tr(), widget.workListData!.bEGINDATE ?? ""), + ItemDetailView(LocaleKeys.closed.tr(), widget.workListData!.eNDDATE ?? ""), + ItemDetailView(LocaleKeys.id.tr(), widget.workListData!.nOTIFICATIONID?.toString() ?? ""), + ItemDetailView(LocaleKeys.responder.tr(), widget.workListData!.rESPONDER ?? ""), ], ).objectContainerView(), 12.height, @@ -41,29 +44,29 @@ class _DetailFragmentState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - detailListItem(LocaleKeys.employeeNumber.tr(), widget.memberInformationListModel!.eMPLOYEENUMBER ?? ""), - detailListItem(LocaleKeys.employeeName.tr(), - (AppState().isArabic(context) ? widget.memberInformationListModel!.eMPLOYEEDISPLAYNAMEAr : widget.memberInformationListModel!.eMPLOYEEDISPLAYNAMEEn) ?? ""), - detailListItem(LocaleKeys.jobTitle.tr(), widget.memberInformationListModel!.pOSITIONNAME ?? ""), - detailListItem(LocaleKeys.grade.tr(), widget.memberInformationListModel!.gRADENAME ?? ""), - detailListItem(LocaleKeys.jobCategory.tr(), widget.memberInformationListModel!.pOSITIONNAME?.toString() ?? ""), - detailListItem(LocaleKeys.category.tr(), widget.memberInformationListModel!.eMPLOYMENTCATEGORYMEANING ?? ""), - detailListItem(LocaleKeys.employeeEmailAddress.tr(), widget.memberInformationListModel!.eMPLOYEEEMAILADDRESS ?? ""), - detailListItem(LocaleKeys.payrollBranch.tr(), widget.memberInformationListModel!.pAYROLLNAME ?? ""), + ItemDetailView(LocaleKeys.employeeNumber.tr(), widget.memberInformationListModel!.eMPLOYEENUMBER ?? ""), + ItemDetailView(LocaleKeys.employeeName.tr(), + (AppState().isArabic(context) ? widget.memberInformationListModel!.eMPLOYEENAMEAr : widget.memberInformationListModel!.eMPLOYEENAMEEn) ?? ""), + ItemDetailView(LocaleKeys.jobTitle.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), + ItemDetailView(LocaleKeys.grade.tr(), widget.memberInformationListModel!.gRADENAME ?? ""), + ItemDetailView(LocaleKeys.jobCategory.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), + ItemDetailView(LocaleKeys.category.tr(), widget.memberInformationListModel!.eMPLOYMENTCATEGORYMEANING ?? ""), + ItemDetailView(LocaleKeys.employeeEmailAddress.tr(), widget.memberInformationListModel!.eMPLOYEEEMAILADDRESS ?? ""), + ItemDetailView(LocaleKeys.payrollBranch.tr(), widget.memberInformationListModel!.pAYROLLNAME ?? ""), ], ).objectContainerView(), ], ).paddingAll(21); } - Widget detailListItem(String title, String value) { - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "$title:".toText12(isBold: true, color: const Color(0xff2D3238)), - 6.width, - (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor).expanded, - ], - ); + String makePositionName(String job) { + String jobName = ""; + List list = job.split(".").toList(); + if (list.length > 1) { + list.removeLast(); + jobName = list.join(" "); + } + return jobName; } + } diff --git a/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart b/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart index e7c26cf..d9ac454 100644 --- a/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart +++ b/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart @@ -7,13 +7,18 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart'; 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_absence_collection_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_stamp_ms_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist_response_model.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; class InfoFragment extends StatelessWidget { + WorkListResponseModel? workListData; + List poHeaderList; List? getAbsenceCollectionNotifications; List? getStampNotifications; - InfoFragment({this.getAbsenceCollectionNotifications, this.getStampNotifications}); + InfoFragment({this.workListData, this.poHeaderList = const [], this.getAbsenceCollectionNotifications, this.getStampNotifications}); @override Widget build(BuildContext context) { @@ -23,20 +28,72 @@ class InfoFragment extends StatelessWidget { child: ListView( padding: const EdgeInsets.all(21), children: [ + if ((workListData?.iTEMTYPE ?? "") == "INVMOA") + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""), + ItemDetailView(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""), + ItemDetailView(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""), + ItemDetailView(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""), + ItemDetailView(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""), + ItemDetailView(LocaleKeys.responder.tr(), workListData!.rESPONDER ?? ""), + ItemDetailView(LocaleKeys.subject.tr(), workListData!.sUBJECT ?? ""), + ], + ).objectContainerView(), if ((getAbsenceCollectionNotifications?.length ?? 0) > 0) getAbsenceCollectionNotificationsListView(getAbsenceCollectionNotifications ?? []).objectContainerView(title: "Absence Notifications"), - if ((getStampNotifications?.length ?? 0) > 0) getStampNotificationsListView(getStampNotifications ?? []).objectContainerView(title: "Stamp Notifications") + if ((getStampNotifications?.length ?? 0) > 0) getStampNotificationsListView(getStampNotifications ?? []).objectContainerView(title: "Stamp Notifications"), + if (poHeaderList.isNotEmpty) getPoNotificationsListView() ], ), ); } + Widget getPoNotificationsListView() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.description.tr(), workListData!.fROMUSER ?? ""), + ItemDetailView(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""), + ItemDetailView(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""), + ItemDetailView(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""), + ItemDetailView(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""), + ItemDetailView(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""), + ItemDetailView(LocaleKeys.supplier.tr(), poHeaderList[index].vENDORNAME ?? ""), + ItemDetailView(LocaleKeys.site.tr(), poHeaderList[index].vENDORSITECODE ?? ""), + ItemDetailView(LocaleKeys.buyer.tr(), poHeaderList[index].bUYER ?? ""), + ItemDetailView(LocaleKeys.preparer.tr(), poHeaderList[index].pREPARER ?? ""), + ItemDetailView(LocaleKeys.creationDate.tr(), poHeaderList[index].cREATIONDATE ?? ""), + ItemDetailView(LocaleKeys.shipToLocation.tr(), poHeaderList[index].sHIPTOLOCATIONNAME ?? ""), + ItemDetailView(LocaleKeys.quotationNumber.tr(), poHeaderList[index].qUOTATIONNUMBER ?? ""), + ItemDetailView(LocaleKeys.quotationDate.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), + ItemDetailView(LocaleKeys.paymentTerms.tr(), poHeaderList[index].pAYMENTTERMS ?? ""), + ItemDetailView(LocaleKeys.currency.tr(), poHeaderList[index].cURRENCYNAME ?? ""), + ItemDetailView(LocaleKeys.grossAmount.tr(), poHeaderList[index].gROSSAMOUNT?.toString() ?? ""), + ItemDetailView(LocaleKeys.discountAmount.tr(), poHeaderList[index].dISCOUNTAMOUNT?.toString() ?? ""), + ItemDetailView(LocaleKeys.customDuty.tr(), poHeaderList[index].cUSTOMDUTY?.toString() ?? ""), + ItemDetailView(LocaleKeys.shipHandle.tr(), poHeaderList[index].sHIPHANDLE?.toString() ?? ""), + ItemDetailView(LocaleKeys.otherCharges.tr(), poHeaderList[index].oTHERCHARGES?.toString() ?? ""), + ItemDetailView(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), + ItemDetailView(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 4.height, + itemCount: poHeaderList.length); + } + Widget getAbsenceCollectionNotificationsListView(List list) { List dataList = list.isEmpty ? [] : (list.first.collectionNotification ?? []); return ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) => detailListItem(dataList[index].sEGMENTPROMPT!, dataList[index].sEGMENTVALUEDSP!), + itemBuilder: (cxt, index) => ItemDetailView(dataList[index].sEGMENTPROMPT!, dataList[index].sEGMENTVALUEDSP!), separatorBuilder: (cxt, index) => 4.height, itemCount: dataList.length); } @@ -48,33 +105,22 @@ class InfoFragment extends StatelessWidget { itemBuilder: (cxt, index) => Column( mainAxisSize: MainAxisSize.min, children: [ - detailListItem(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), - detailListItem(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), - detailListItem(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), - detailListItem(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), - detailListItem(LocaleKeys.shiftType.tr(), list[index].sHTTYPEDESC.toString()), - detailListItem(LocaleKeys.shift.tr(), list[index].sHTNAME.toString()), - detailListItem(LocaleKeys.breakText.tr(), list[index].bREAKNAME.toString()), - detailListItem(LocaleKeys.actualSwipeStart.tr(), list[index].sHTACTUALSTARTTIME.toString()), - detailListItem(LocaleKeys.actualSwipeEnd.tr(), list[index].sHTACTUALENDTIME.toString()), - detailListItem(LocaleKeys.approvedSwipeStart.tr(), list[index].aPPROVEDSTARTTIME.toString()), - detailListItem(LocaleKeys.approvedSwipeStartReason.tr(), list[index].aPPROVEDSTARTREASON.toString()), - detailListItem(LocaleKeys.approvedSwipeEnd.tr(), ""), - detailListItem(LocaleKeys.approvedSwipeEndReason.tr(), list[index].aPPROVEDENDREASONDESC.toString()), + ItemDetailView(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), + ItemDetailView(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), + ItemDetailView(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), + ItemDetailView(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), + ItemDetailView(LocaleKeys.shiftType.tr(), list[index].sHTTYPEDESC.toString()), + ItemDetailView(LocaleKeys.shift.tr(), list[index].sHTNAME.toString()), + ItemDetailView(LocaleKeys.breakText.tr(), list[index].bREAKNAME.toString()), + ItemDetailView(LocaleKeys.actualSwipeStart.tr(), list[index].sHTACTUALSTARTTIME.toString()), + ItemDetailView(LocaleKeys.actualSwipeEnd.tr(), list[index].sHTACTUALENDTIME.toString()), + ItemDetailView(LocaleKeys.approvedSwipeStart.tr(), list[index].aPPROVEDSTARTTIME.toString()), + ItemDetailView(LocaleKeys.approvedSwipeStartReason.tr(), list[index].aPPROVEDSTARTREASON.toString()), + ItemDetailView(LocaleKeys.approvedSwipeEnd.tr(), ""), + ItemDetailView(LocaleKeys.approvedSwipeEndReason.tr(), list[index].aPPROVEDENDREASONDESC.toString()), ], ), separatorBuilder: (cxt, index) => 18.height, itemCount: list.length); } - - Widget detailListItem(String title, String value) { - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "$title:".toText12(isBold: true, color: const Color(0xff2D3238)), - 6.width, - (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor).expanded, - ], - ); - } } diff --git a/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart b/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart index f5a639b..9d1f8cf 100644 --- a/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart +++ b/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart @@ -1,86 +1,115 @@ +import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; -import 'package:mohem_flutter_app/classes/colors.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'; +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_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.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/item_detail_view_widget.dart'; -class RequestFragment extends StatefulWidget { - @override - State createState() => _RequestFragmentState(); -} +class RequestFragment extends StatelessWidget { + final List moNotificationBodyList; + final List poLinesList; -class _RequestFragmentState extends State { - bool isOpened = false; + RequestFragment({Key? key, this.moNotificationBodyList = const [], this.poLinesList = const []}) : super(key: key); @override Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: double.infinity, - child: Column( - children: [ - Container( - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - margin: EdgeInsets.all(21), - padding: EdgeInsets.only(top: 21, bottom: 21, right: 16, left: 16), - child: Column( + return ListView( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + children: [ + if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), + if (poLinesList.isNotEmpty) poLinesDataView(), + ], + ); + } + + Widget poLinesDataView() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ + ItemDetailView(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""), + ItemDetailView(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""), + ItemDetailView(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), + ItemDetailView(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""), + ItemDetailView(LocaleKeys.price.tr(), poLinesList[index].uNITPRICE?.toString() ?? ""), + ItemDetailView(LocaleKeys.lineAmount.tr(), poLinesList[index].lINEAMOUNT?.toString() ?? ""), + ItemDetailView(LocaleKeys.quantity.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), + ItemDetailView(LocaleKeys.lineDiscount.tr(), poLinesList[index].lINEDISCPERCENTAGE?.toString() ?? ""), + ItemDetailView(LocaleKeys.needByDate.tr(), poLinesList[index].nEEDBYDATE ?? ""), + ItemDetailView(LocaleKeys.promisedDate.tr(), poLinesList[index].pROMISEDDATE ?? ""), + ItemDetailView(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""), + ItemDetailView(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""), + ItemDetailView(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""), + 12.height, Row( children: [ - Expanded( - child: "Hardware Mobility 161 Messenger".toText16(), - ), - Icon(Icons.keyboard_arrow_down_rounded), + DefaultButton(LocaleKeys.itemHistory.tr(), () { + Navigator.pushNamed( + cxt, + AppRoutes.itemHistory, + arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID), + ); + }).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, ], - ), - Column( - children: [ - 12.height, - showItem("Code:", "3188000067"), - showItem("Quantity:", "1"), - showItem("Line Status:", "Pending Approval"), - showItem("Transection Type:", "Move Order Issue:"), - showItem("Organization Code:", "SWD"), - showItem("From Subinventory:", "SWD_MSPS"), - showItem("To Subinventory:", "SWD_MSPS"), - showItem("Ship To Location :", "SWD 11206-E.R. (Emergency Room)"), - showItem("Unit:", "Each"), - showItem("Date Required:", "12/23/2019 4:54:04 PM"), - showItem("Status Date:", "12/23/2019 4:54:04 PM"), - showItem("Operation Unit:", "Sehat Al Sewedi"), - showItem("Organization:", "Sehat Al Sewedi"), - showItem("From Locator:", "-"), - showItem("To Locator :", "-"), - ], - ), + ) ], - ), - ), - ], - ), - ); + ).objectContainerView(title: poLinesList[index].iTEMDESCRIPTION!), + separatorBuilder: (cxt, index) => 12.height, + itemCount: poLinesList.length); } - Widget showItem(String title, String value) { - return Padding( - padding: const EdgeInsets.only(top: 2, bottom: 2), - child: Row( - children: [ - title.toText12(isBold: true), - 6.width, - title.toText12(isBold: false, color: MyColors.normalTextColor), - ], - ), - ); + Widget moNotificationDataView() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.code.tr(), moNotificationBodyList[index].iTEMCODE ?? ""), + ItemDetailView(LocaleKeys.unit.tr(), moNotificationBodyList[index].uOM ?? ""), + ItemDetailView(LocaleKeys.quantity.tr(), moNotificationBodyList[index].qUANTITY?.toString() ?? ""), + ItemDetailView(LocaleKeys.dateRequired.tr(), moNotificationBodyList[index].dATEREQUIRED ?? ""), + ItemDetailView(LocaleKeys.lineStatus.tr(), moNotificationBodyList[index].lINESTATUS ?? ""), + ItemDetailView(LocaleKeys.statusDate.tr(), moNotificationBodyList[index].sTATUSDATE ?? ""), + ItemDetailView(LocaleKeys.transactionType.tr(), moNotificationBodyList[index].tRANSACTIONTYPENAME ?? ""), + ItemDetailView(LocaleKeys.operatingUnit.tr(), moNotificationBodyList[index].oPERATINGUNIT ?? ""), + ItemDetailView(LocaleKeys.organizationCode.tr(), moNotificationBodyList[index].oRGANIZATIONCODE ?? ""), + ItemDetailView(LocaleKeys.organization.tr(), moNotificationBodyList[index].oRGANIZATIONNAME ?? ""), + ItemDetailView(LocaleKeys.fromSubInventory.tr(), moNotificationBodyList[index].fROMSUBINVENTORY ?? ""), + ItemDetailView(LocaleKeys.fromLocator.tr(), moNotificationBodyList[index].fROMLOCATOR ?? ""), + ItemDetailView(LocaleKeys.toSubInventory.tr(), moNotificationBodyList[index].tOSUBINVENTORY ?? ""), + ItemDetailView(LocaleKeys.toLocator.tr(), moNotificationBodyList[index].tOLOCATOR ?? ""), + ItemDetailView(LocaleKeys.shipToLocator.tr(), moNotificationBodyList[index].sHIPTOLOCATION ?? ""), + 12.height, + DefaultButton(LocaleKeys.itemHistory.tr(), () { + Navigator.pushNamed( + cxt, + AppRoutes.itemHistory, + arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), pItemId: moNotificationBodyList[index].iTEMID, pOrgId: moNotificationBodyList[index].oRGID), + ); + }) + ], + ).objectContainerView(title: moNotificationBodyList[index].dESCRIPTION ?? ""), + separatorBuilder: (cxt, index) => 12.height, + itemCount: moNotificationBodyList.length); } } diff --git a/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart b/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart index 8d88404..02d06d3 100644 --- a/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart +++ b/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart @@ -4,6 +4,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -13,7 +14,10 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; +import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; +import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; +import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; @@ -25,6 +29,7 @@ import 'package:mohem_flutter_app/ui/work_list/missing_swipe/fragments/info_frag import 'package:mohem_flutter_app/ui/work_list/missing_swipe/fragments/request_fragment.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/accept_reject_input_dialog.dart'; class MissingSwipeScreen extends StatefulWidget { MissingSwipeScreen({Key? key}) : super(key: key); @@ -44,13 +49,17 @@ class _MissingSwipeScreenState extends State { MemberInformationListModel? memberInformationListModel; List notificationButtonsList = []; List actionHistoryList = []; + List getAttachmentList = []; List getStampNotifications = []; + List getMoNotificationBodyList = []; List? getAbsenceCollectionNotifications; List getNotificationRespondAttributes = []; + NotificationGetRespondAttributesList? notificationNoteInput; GenericResponseModel? getBasicNTFBody; GenericResponseModel? getICBody; GenericResponseModel? subordinatesLeavesModel; + GetPoNotificationBodyList? getPoNotificationBody; bool isCloseAvailable = false; bool isApproveAvailable = false; @@ -70,7 +79,7 @@ class _MissingSwipeScreenState extends State { try { Utils.showLoading(context); if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") { - memberInformationListModel = await WorkListApiClient().getUserInformation(-999); + memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!); } if (workListData!.iTEMTYPE == "HRSSA") { getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999); @@ -80,9 +89,19 @@ class _MissingSwipeScreenState extends State { if (workListData!.iTEMTYPE == "STAMP") { getStampNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999); } + if (workListData!.iTEMTYPE == "INVMOA") { + getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999); + } + if (workListData!.iTEMTYPE == "POAPPRV") { + getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999); + } getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!); + if (getNotificationRespondAttributes.isNotEmpty) { + notificationNoteInput = getNotificationRespondAttributes.first; + } notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!); actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); + getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); if (notificationButtonsList.isNotEmpty) { isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE"); @@ -93,16 +112,20 @@ class _MissingSwipeScreenState extends State { setState(() {}); } catch (ex) { Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } - @override - Widget build(BuildContext context) { + void getDataFromState() { if (workListData == null) { - workListData = ModalRoute.of(context)!.settings.arguments as WorkListResponseModel; + workListData = AppState().workList![AppState().workListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel; getData(); } + } + + @override + Widget build(BuildContext context) { + getDataFromState(); return Scaffold( appBar: AppBarWidget(context, title: LocaleKeys.details.tr()), @@ -145,10 +168,19 @@ class _MissingSwipeScreenState extends State { }); }, children: [ - InfoFragment(getAbsenceCollectionNotifications: getAbsenceCollectionNotifications, getStampNotifications: getStampNotifications), - (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") ? DetailFragment(workListData, memberInformationListModel) : RequestFragment(), + InfoFragment( + poHeaderList: getPoNotificationBody?.pOHeader ?? [], + workListData: workListData, + getAbsenceCollectionNotifications: getAbsenceCollectionNotifications, + getStampNotifications: getStampNotifications), + (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") + ? DetailFragment(workListData, memberInformationListModel) + : RequestFragment( + moNotificationBodyList: getMoNotificationBodyList, + poLinesList: getPoNotificationBody?.pOLines ?? [], + ), ActionsFragment(actionHistoryList), - AttachmentsFragment(), + AttachmentsFragment(getAttachmentList), ], ).expanded, if (isApproveAvailable || isRejectAvailable || isCloseAvailable) @@ -168,26 +200,26 @@ class _MissingSwipeScreenState extends State { if (isRejectAvailable) DefaultButton( LocaleKeys.reject.tr(), - () {}, + () => performAction("REJECTED"), colors: const [ - Color(0xffEB8C90), - Color(0xffDE6C70), + Color(0xffE47A7E), + Color(0xffDE6D71), ], ).expanded, if (isApproveAvailable && isRejectAvailable) 8.width, if (isApproveAvailable) DefaultButton( LocaleKeys.approve.tr(), - () {}, + () => performAction("APPROVED"), colors: const [ - Color(0xff32D892), - Color(0xff1AB170), + Color(0xff28C884), + Color(0xff1BB271), ], ).expanded, if (isCloseAvailable) DefaultButton( LocaleKeys.ok.tr(), - () {}, + () => performAction("CLOSE"), colors: const [ Color(0xff32D892), Color(0xff1AB170), @@ -227,7 +259,16 @@ class _MissingSwipeScreenState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, children: [ - myFab("Skip", "assets/images/skip.svg"), + myFab("Skip", "assets/images/skip.svg").onPress(() { + if (AppState().workList!.length - 1 > AppState().workListIndex!) { + AppState().setWorkListIndex = AppState().workListIndex! + 1; + workListData = null; + showFabOptions = false; + getDataFromState(); + } else if (AppState().workList!.length - 1 == AppState().workListIndex!) { + Navigator.pop(context); + } + }), 12.height, ...viewApiButtonsList(notificationButtonsList), ], @@ -348,4 +389,41 @@ class _MissingSwipeScreenState extends State { ], ); } + + void performAction(String actionMode) { + showDialog( + context: context, + builder: (cxt) => AcceptRejectInputDialog( + message: LocaleKeys.requestedItems.tr(), + notificationGetRespond: notificationNoteInput, + onTap: (note) { + Map payload = { + "P_ACTION_MODE": actionMode, + "P_APPROVER_INDEX": null, + "P_COMMENTS": "", + "P_FORWARD_TO_USER_NAME": "", + "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID!, + "RespondAttributeList": [ + if (notificationNoteInput != null) {notificationNoteInput!.attributeName: note} + ], + }; + + performNotificationAction(payload); + }, + ), + ); + } + + void performNotificationAction(Map payload) async { + try { + Utils.showLoading(context); + GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload); + Utils.hideLoading(context); + Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); + Navigator.pop(context, true); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } } diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 49fb8ac..fbc960e 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; @@ -56,6 +57,11 @@ class _WorkListScreenState extends State { super.initState(); providerData = Provider.of(context, listen: false); + calculateCounter(); + getWorkList(); + } + + void calculateCounter() { workListItemTypes.forEach((workListElement) { if (workListElement.key == "ITG") { workListElement.value = providerData.itgFormsModel?.totalCount ?? 0; @@ -66,7 +72,6 @@ class _WorkListScreenState extends State { } } }); - getWorkList(); } ItgFormsModel? itgFormsModel; @@ -88,12 +93,13 @@ class _WorkListScreenState extends State { } else { itgRequestTypeIndex = null; workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); + AppState().setWorkList = workList; } Utils.hideLoading(context); setState(() {}); } catch (ex) { Utils.hideLoading(context); - Utils.handleException(ex, null); + Utils.handleException(ex, context, null); } } @@ -188,7 +194,7 @@ class _WorkListScreenState extends State { }, separatorBuilder: (context, index) => 12.height, itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0, - padding: EdgeInsets.only(top: 16, left: 21, right: 21), + padding: const EdgeInsets.all(21), ), ) : Expanded( @@ -196,13 +202,13 @@ class _WorkListScreenState extends State { ? ((workList!).isEmpty ? "No History Available".toText16().center : ListView.separated( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { - return rowItem(workListItemTypes[workListItemIndex], workList![index]); + return rowItem(workListItemTypes[workListItemIndex], workList![index], index); }, separatorBuilder: (context, index) => 12.height, itemCount: workList?.length ?? 0, - padding: EdgeInsets.only(top: 21, left: 21, right: 21), + padding: const EdgeInsets.all(21), )) : const SizedBox(), ), @@ -271,10 +277,28 @@ class _WorkListScreenState extends State { ); } - Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData) { + Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) { return InkWell( - onTap: () { - Navigator.pushNamed(context, AppRoutes.missingSwipe, arguments: workData); + onTap: () async { + AppState().setWorkListIndex = index; + var data = workList![index]; + var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.missingSwipe, arguments: workData); + if (shouldReloadData != null) { + workList!.remove(data); + AppState().setWorkList = workList; + if (data.iTEMTYPE == "ITG") { + } else { + providerData.getOpenNotificationsList?.forEach((element) { + if (element.itemType == data.iTEMTYPE) { + element.openNtfNumber = element.openNtfNumber! - 1; + } + }); + providerData.workListCounter = providerData.workListCounter - 1; + providerData.notify(); + } + calculateCounter(); + if (mounted) setState(() {}); + } }, child: Container( width: double.infinity, diff --git a/lib/widgets/dialogs/accept_reject_input_dialog.dart b/lib/widgets/dialogs/accept_reject_input_dialog.dart new file mode 100644 index 0000000..479a47b --- /dev/null +++ b/lib/widgets/dialogs/accept_reject_input_dialog.dart @@ -0,0 +1,103 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +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/notification_get_respond_attributes_list_model.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/input_widget.dart'; + +class AcceptRejectInputDialog extends StatelessWidget { + final String? title; + final String? message; + final String? okTitle; + final NotificationGetRespondAttributesList? notificationGetRespond; + final Function(String) onTap; + + AcceptRejectInputDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.notificationGetRespond}) : super(key: key); + + String note = ""; + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: const RoundedRectangleBorder(), + insetPadding: const EdgeInsets.only(left: 21, right: 21), + child: Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Text( + title ?? LocaleKeys.confirm.tr(), + style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), + ), + ), + ), + IconButton( + padding: EdgeInsets.zero, + icon: const Icon(Icons.close), + color: const Color(0xff2B353E), + constraints: const BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ), + Text( + message ?? "", + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), + ), + if (notificationGetRespond != null) ...[ + 14.height, + InputWidget( + "Enter a Note", + notificationGetRespond!.attributeDisplayName!, + TextEditingController(), + isBackgroundEnable: true, + lines: 3, + onChange: (String note) { + this.note = note; + }, + ), + ], + 28.height, + Row( + children: [ + DefaultButton( + LocaleKeys.cancel.tr(), + () => Navigator.pop(context), + colors: const [MyColors.lightGreyEAColor, MyColors.lightGreyEAColor], + textColor: MyColors.darkTextColor, + ).expanded, + 10.width, + DefaultButton( + LocaleKeys.ok.tr(), + () { + Navigator.pop(context); + onTap(note); + }, + colors: const [ + Color(0xff28C884), + Color(0xff1BB271), + ], + ).expanded, + ], + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/item_detail_view_widget.dart b/lib/widgets/item_detail_view_widget.dart new file mode 100644 index 0000000..99f77d7 --- /dev/null +++ b/lib/widgets/item_detail_view_widget.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.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/widget_extensions.dart'; + +class ItemDetailView extends StatelessWidget { + final String title; + final String value; + const ItemDetailView(this.title, this.value, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "$title:".toText12(isBold: true, color: const Color(0xff2D3238)), + 6.width, + (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor).expanded, + ], + ); + } +}