Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
PFM-4136
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldevgarg committed Oct 16, 2023
1 parent 8cc5e33 commit 25f2d84
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
50 changes: 50 additions & 0 deletions frontend/mgramseva/lib/model/localization/language.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,53 @@ class LanguageList {
return data;
}
}
class PSPCLIntegration{
List<AccountNumberGpMapping>? accountNumberGpMapping;

PSPCLIntegration({this.accountNumberGpMapping});

PSPCLIntegration.fromJson(Map<String, dynamic> json) {
if (json['accountNumberGpMapping'] != null) {
accountNumberGpMapping = <AccountNumberGpMapping>[];
json['accountNumberGpMapping'].forEach((v) {
accountNumberGpMapping!.add(new AccountNumberGpMapping.fromJson(v));
});
}
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
accountNumber = json['accountNumber'];
departmentEntityName = json['departmentEntityName'];
departmentEntityCode = json['departmentEntityCode'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['accountNumber'] = this.accountNumber;
data['departmentEntityName'] = this.departmentEntityName;
data['departmentEntityCode'] = this.departmentEntityCode;
return data;
}
}
class MdmsRes {
CommonMasters? commonMasters;
BillingService? billingService;
Expand All @@ -40,6 +86,7 @@ class MdmsRes {
SubCategory? subCategory;
TaxPeriodListModel? taxPeriodList;
WCBillingSlabs? wcBillingSlabList;
PSPCLIntegration? pspclIntegration;

MdmsRes({this.commonMasters});

Expand Down Expand Up @@ -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<String, dynamic> toJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -520,7 +522,14 @@ class ExpensesDetailsProvider with ChangeNotifier {
}

List<DropdownMenuItem<Object>> getExpenseTypeList() {
var commonProvider = Provider.of<CommonProvider>(
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 ?? <ExpenseType>[])
.map((value) {
return DropdownMenuItem(
Expand Down
35 changes: 35 additions & 0 deletions frontend/mgramseva/lib/repository/core_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,41 @@ class CoreRepository extends BaseService {
}
return languageList.mdmsRes?.wcBillingSlabList;
}
Future<PSPCLIntegration?> 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<PaymentType> getPaymentTypeMDMS(Map body) async {
late PaymentType paymentType;
Expand Down

0 comments on commit 25f2d84

Please sign in to comment.