From 6b026a5a653a193a1bbeeec91aefa7490f810d24 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Fri, 27 Oct 2023 03:11:07 +0530 Subject: [PATCH] PFM-4409 --- .../providers/expenses_details_provider.dart | 6 ++++++ .../lib/repository/expenses_repo.dart | 21 ++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/frontend/mgramseva/lib/providers/expenses_details_provider.dart b/frontend/mgramseva/lib/providers/expenses_details_provider.dart index 4443c3536..e4508590b 100644 --- a/frontend/mgramseva/lib/providers/expenses_details_provider.dart +++ b/frontend/mgramseva/lib/providers/expenses_details_provider.dart @@ -405,8 +405,14 @@ class ExpensesDetailsProvider with ChangeNotifier { if(expenditureDetails.selectedVendor != null && (expenditureDetails.selectedVendor?.owner?.mobileNumber == null || expenditureDetails.selectedVendor!.owner!.mobileNumber.isEmpty)){ var mobileNumber = vendorList.firstWhere((vendor) => vendor.id == expenditureDetails.vendorId, orElse: () => Vendor('', '')).owner?.mobileNumber ?? ''; expenditureDetails.selectedVendor?.owner = Owner(mobileNumber); + if(expenditureDetails.mobileNumberController.text.isNotEmpty && expenditureDetails.mobileNumberController.text!=mobileNumber){ + return true; + } expenditureDetails.mobileNumberController.text = mobileNumber; } + if(expenditureDetails.mobileNumberController.text.isEmpty){ + return true; + } return false; } else { diff --git a/frontend/mgramseva/lib/repository/expenses_repo.dart b/frontend/mgramseva/lib/repository/expenses_repo.dart index 0d94078bc..b97f6b45d 100644 --- a/frontend/mgramseva/lib/repository/expenses_repo.dart +++ b/frontend/mgramseva/lib/repository/expenses_repo.dart @@ -56,16 +56,17 @@ class ExpensesRepository extends BaseService { )); if (res != null && res['vendor'] != null) { - var vendors = res['vendor']; - vendorList = []; - for (int i =0;i((e) { + if(e!=null){ + if(e['owner']==null){ + e['owner']={ + 'mobileNumber':'' + }; + } + } + return Vendor.fromJson(e); + }).toList(); } return vendorList; }