From 9362859013be51abae21fe160a2cec8b8980199f Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 31 Dec 2024 17:20:22 +0300 Subject: [PATCH] CEI notification body added. --- lib/api/my_attendance_api_client.dart | 2 +- lib/api/worklist/worklist_api_client.dart | 14 +++++++++++++ lib/models/generic_response_model.dart | 16 ++++++++------ lib/ui/work_list/worklist_detail_screen.dart | 22 +++++++++++++++++++- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/lib/api/my_attendance_api_client.dart b/lib/api/my_attendance_api_client.dart index 74e9855..37bf9e8 100644 --- a/lib/api/my_attendance_api_client.dart +++ b/lib/api/my_attendance_api_client.dart @@ -143,7 +143,7 @@ class MyAttendanceApiClient { if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID; return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); - return responseData.submitEITTransactionList!; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson()); + return responseData.submitCEITransactionList!; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson()); }, url, postParams); } diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index e08d30b..9667961 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -534,6 +534,20 @@ class WorkListApiClient { }, url, postParams); } + Future?> GetCeiNotificationBody(int? notificationId) async { + String url = "${ApiConsts.erpRest}GET_CEI_NOTIFICATION_BODY"; + Map postParams = { + "P_NOTIFICATION_ID": notificationId, + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getCEICollectionNotificationBodyList; + }, url, postParams); + } + Future?> getPhonesNotificationBodyList(int? notificationId) async { String url = "${ApiConsts.erpRest}GET_PHONES_NOTIFICATION_BODY"; Map postParams = { diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 4175e7f..e87c3e0 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -184,7 +184,7 @@ class GenericResponseModel { List? getBasicDetColsStructureList; List? getBasicDetDffStructureList; List? getBasicDetNtfBodyList; - List? getCEICollectionNotificationBodyList; + List? getCEICollectionNotificationBodyList; List? getCEIDFFStructureList; List? getCEITransactionList; List? getCcpTransactionsList; @@ -356,7 +356,7 @@ class GenericResponseModel { StartTermApprovalProcessList? startTermApprovalProcessList; SubmitAddressTransaction? submitAddressTransactionList; SubmitBasicDetailsTransactionList? submitBasicDetTransactionList; - String? submitCEITransactionList; + SubmitEITTransactionList? submitCEITransactionList; SubmitCcpTransactionList? submitCcpTransactionList; SubmitContactTransactionList? submitContactTransactionList; SubmitEITTransactionList? submitEITTransactionList; @@ -845,7 +845,9 @@ class GenericResponseModel { }); } - getCEICollectionNotificationBodyList = json['GetCEICollectionNotificationBodyList']; + getCEICollectionNotificationBodyList = json["GetCEICollectionNotificationBodyList"] == null + ? null + : List.from(json["GetCEICollectionNotificationBodyList"].map((x) => GetEitCollectionNotificationBodyList.fromJson(x))); if (json['GetCEIDFFStructureList'] != null) { getCEIDFFStructureList = []; @@ -1378,7 +1380,7 @@ class GenericResponseModel { submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; - submitCEITransactionList = json['SubmitCEITransactionList']; + submitCEITransactionList = json['SubmitCEITransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitCEITransactionList']) : null; submitCcpTransactionList = json['SubmitCcpTransactionList'] != null ? new SubmitCcpTransactionList.fromJson(json['SubmitCcpTransactionList']) : null; submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; @@ -1553,10 +1555,8 @@ class GenericResponseModel { if (this.getBasicDetNtfBodyList != null) { data['GetBasicDetNtfBodyList'] = this.getBasicDetNtfBodyList!.map((v) => v.toJson()).toList(); } - data['GetCEICollectionNotificationBodyList'] = this.getCEICollectionNotificationBodyList; - if (this.getCEIDFFStructureList != null) { data['GetCEIDFFStructureList'] = this.getCEIDFFStructureList!.map((v) => v.toJson()).toList(); } @@ -1855,6 +1855,10 @@ class GenericResponseModel { } data['SubmitCEITransactionList'] = this.submitCEITransactionList; + + if (this.submitCEITransactionList != null) { + data['SubmitCEITransactionList'] = this.submitCEITransactionList!.toJson(); + } if (this.submitCcpTransactionList != null) { data['SubmitCcpTransactionList'] = this.submitCcpTransactionList!.toJson(); } diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index ee595d1..69c669f 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -142,7 +142,9 @@ class _WorkListDetailScreenState extends State { if (workListData!.iTEMTYPE == "HRSSA") { if (workListData!.rEQUESTTYPE == "EIT") { getEitNotificationBody(); - } else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") { + } else if (workListData!.rEQUESTTYPE == "CEI") { + getCEINotificationBody(); + }else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") { getPhonesNotificationBody(); } else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") { getBasicDetNtfBody(); @@ -760,6 +762,24 @@ class _WorkListDetailScreenState extends State { } } + void getCEINotificationBody() async { + try { + if (apiCallCount == 0) Utils.showLoading(context); + apiCallCount++; + getEitCollectionNotificationBodyList!.clear(); + getEitCollectionNotificationBodyList = await WorkListApiClient().GetCeiNotificationBody(workListData!.nOTIFICATIONID); + apiCallCount--; + if (apiCallCount == 0) { + Utils.hideLoading(context); + setState(() {}); + } + } catch (ex) { + apiCallCount--; + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + void getEitNotificationBody() async { try { if (apiCallCount == 0) Utils.showLoading(context);