From 25f2d84994ad5bc8249f9677e369ef0f62c4d72d Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:19:37 +0530 Subject: [PATCH] PFM-4136 --- .../lib/model/localization/language.dart | 50 +++++++++++++++++++ .../providers/expenses_details_provider.dart | 9 ++++ .../mgramseva/lib/repository/core_repo.dart | 35 +++++++++++++ 3 files changed, 94 insertions(+) diff --git a/frontend/mgramseva/lib/model/localization/language.dart b/frontend/mgramseva/lib/model/localization/language.dart index 1c60bc706..a91299a3a 100644 --- a/frontend/mgramseva/lib/model/localization/language.dart +++ b/frontend/mgramseva/lib/model/localization/language.dart @@ -29,7 +29,53 @@ class LanguageList { return data; } } +class PSPCLIntegration{ + List? accountNumberGpMapping; + PSPCLIntegration({this.accountNumberGpMapping}); + + PSPCLIntegration.fromJson(Map json) { + if (json['accountNumberGpMapping'] != null) { + accountNumberGpMapping = []; + json['accountNumberGpMapping'].forEach((v) { + accountNumberGpMapping!.add(new AccountNumberGpMapping.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.accountNumberGpMapping != null) { + data['accountNumberGpMapping'] = + this.accountNumberGpMapping!.map((v) => v.toJson()).toList(); + } + return data; + } +} +class AccountNumberGpMapping { + String? accountNumber; + String? departmentEntityName; + String? departmentEntityCode; + + AccountNumberGpMapping( + {this.accountNumber, + this.departmentEntityName, + this.departmentEntityCode}); + + AccountNumberGpMapping.fromJson(Map json) { + accountNumber = json['accountNumber']; + departmentEntityName = json['departmentEntityName']; + departmentEntityCode = json['departmentEntityCode']; + } + + Map toJson() { + final Map data = new Map(); + data['accountNumber'] = this.accountNumber; + data['departmentEntityName'] = this.departmentEntityName; + data['departmentEntityCode'] = this.departmentEntityCode; + return data; + } +} class MdmsRes { CommonMasters? commonMasters; BillingService? billingService; @@ -40,6 +86,7 @@ class MdmsRes { SubCategory? subCategory; TaxPeriodListModel? taxPeriodList; WCBillingSlabs? wcBillingSlabList; + PSPCLIntegration? pspclIntegration; MdmsRes({this.commonMasters}); @@ -71,6 +118,9 @@ class MdmsRes { wcBillingSlabList = json['ws-services-calculation'] != null ? new WCBillingSlabs.fromJson(json['ws-services-calculation']) : null; + pspclIntegration = json['pspcl-integration'] != null + ? new PSPCLIntegration.fromJson(json['pspcl-integration']) + : null; } Map toJson() { diff --git a/frontend/mgramseva/lib/providers/expenses_details_provider.dart b/frontend/mgramseva/lib/providers/expenses_details_provider.dart index c18c437b2..797f5c0f5 100644 --- a/frontend/mgramseva/lib/providers/expenses_details_provider.dart +++ b/frontend/mgramseva/lib/providers/expenses_details_provider.dart @@ -432,6 +432,8 @@ class ExpensesDetailsProvider with ChangeNotifier { var res = await CoreRepository().getMdms(getExpenseMDMS( commonProvider.userDetails!.userRequest!.tenantId.toString())); languageList = res; + var pspcl = await CoreRepository().getPSPCLGpwscFromMdms(commonProvider.userDetails!.userRequest!.tenantId.toString().substring(0,2)); + languageList?.mdmsRes?.pspclIntegration = pspcl; notifyListeners(); } catch (e, s) { ErrorHandler.logError(e.toString(), s); @@ -520,7 +522,14 @@ class ExpensesDetailsProvider with ChangeNotifier { } List> getExpenseTypeList() { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); if (languageList?.mdmsRes?.expense?.expenseList != null) { + var res = languageList?.mdmsRes?.pspclIntegration?.accountNumberGpMapping?.where((element) => element.departmentEntityCode==commonProvider.userDetails?.selectedtenant?.city?.code).toList(); + if(res!.isNotEmpty){ + languageList?.mdmsRes?.expense?.expenseList!.removeWhere((element) => element.code=="20101"); + } return (languageList?.mdmsRes?.expense?.expenseList ?? []) .map((value) { return DropdownMenuItem( diff --git a/frontend/mgramseva/lib/repository/core_repo.dart b/frontend/mgramseva/lib/repository/core_repo.dart index 344fc7c28..cdfc971fc 100644 --- a/frontend/mgramseva/lib/repository/core_repo.dart +++ b/frontend/mgramseva/lib/repository/core_repo.dart @@ -107,6 +107,41 @@ class CoreRepository extends BaseService { } return languageList.mdmsRes?.wcBillingSlabList; } + Future getPSPCLGpwscFromMdms(String tenantId) async { + var body = { + "MdmsCriteria": { + "tenantId": tenantId, + "moduleDetails": [ + { + "moduleName": "pspcl-integration", + "masterDetails": [ + { + "name": "accountNumberGpMapping" + } + ] + } + ] + } + }; + late LanguageList languageList; + var res = await makeRequest( + url: Url.MDMS, + body: body, + method: RequestType.POST, + requestInfo: RequestInfo( + APIConstants.API_MODULE_NAME, + APIConstants.API_VERSION, + APIConstants.API_TS, + "_search", + APIConstants.API_DID, + APIConstants.API_KEY, + APIConstants.API_MESSAGE_ID, + "")); + if (res != null) { + languageList = LanguageList.fromJson(res); + } + return languageList.mdmsRes?.pspclIntegration; + } Future getPaymentTypeMDMS(Map body) async { late PaymentType paymentType;