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

Commit

Permalink
Merge pull request #623 from egovernments/develop
Browse files Browse the repository at this point in the history
PFM-4136
  • Loading branch information
rahuldevgarg authored Oct 20, 2023
2 parents 965d256 + e38afa6 commit 6223997
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ class ExpensesDetailsModel {
paidDateCtrl.text = '';
allowEdit = true;
}
if(expenseType=='ELECTRICITY_BILL'){
allowEdit = false;
}
}

factory ExpensesDetailsModel.fromJson(Map<String, dynamic> json) =>
Expand Down
10 changes: 7 additions & 3 deletions frontend/mgramseva/lib/providers/expenses_details_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class ExpensesDetailsProvider with ChangeNotifier {
else fetchVendors();
if (expensesDetails != null) {
expenditureDetails = expensesDetails;
if(expenditureDetails.expenseType=='ELECTRICITY_BILL'){
expenditureDetails.allowEdit = false;
}
getStoreFileDetails();
} else if (id != null) {
var commonProvider =
Expand Down Expand Up @@ -524,16 +527,17 @@ class ExpensesDetailsProvider with ChangeNotifier {
notifyListeners();
}

List<DropdownMenuItem<Object>> getExpenseTypeList() {
List<DropdownMenuItem<Object>> getExpenseTypeList({bool isSearch=false}) {
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();
var temp_list = languageList?.mdmsRes?.expense?.expenseList?.toList();
if(res!.isNotEmpty){
languageList?.mdmsRes?.expense?.expenseList!.removeWhere((element) => element.code=="20101");
isSearch?{}:temp_list!.removeWhere((element) => element.code=="ELECTRICITY_BILL");
}
return (languageList?.mdmsRes?.expense?.expenseList ?? <ExpenseType>[])
return (temp_list ?? <ExpenseType>[])
.map((value) {
return DropdownMenuItem(
value: value.code,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class _ExpenseDetailsState extends State<ExpenseDetails> {
(expensesDetailsProvider
.expenditureDetails.isBillCancelled ??
false)) ||
!isUpdate)
!isUpdate) || (expensesDetailsProvider
.expenditureDetails.expenseType!='ELECTRICITY_BILL')
? () => expensesDetailsProvider.validateExpensesDetails(
context, isUpdate)
: null,
Expand Down Expand Up @@ -214,7 +215,7 @@ class _ExpenseDetailsState extends State<ExpenseDetails> {
'',
'',
expensesDetailsProvider.onChangeOfExpenses,
expensesDetailsProvider.getExpenseTypeList(),
expensesDetailsProvider.getExpenseTypeList(isSearch: isUpdate),
true,
isEnabled: expenseDetails.allowEdit,
requiredMessage:
Expand Down Expand Up @@ -471,7 +472,7 @@ class _ExpenseDetailsState extends State<ExpenseDetails> {
contextKey: expenseProvider
.expenseWalkthrougList[5].key,
),
if (isUpdate)
if (isUpdate && expenseDetails.expenseType!='ELECTRICITY_BILL')
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(
Expand Down Expand Up @@ -526,5 +527,5 @@ class _ExpenseDetailsState extends State<ExpenseDetails> {
));
}

bool get isUpdate => widget.id != null || widget.expensesDetails != null;
bool get isUpdate => widget.id != null || widget.expensesDetails != null ;
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _SearchExpenseState extends State<SearchExpense> {
'',
'',
onChangeOfExpense,
expensesDetailsProvider.getExpenseTypeList(),
expensesDetailsProvider.getExpenseTypeList(isSearch: true),
false,
hint:
'${ApplicationLocalizations.of(context).translate(i18.common.ELECTRICITY_HINT)}',
Expand Down
5 changes: 3 additions & 2 deletions frontend/mgramseva/lib/widgets/bottom_button_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class BottomButtonBar extends StatelessWidget {
final String label;
final Function()? callBack;
final Key? key;
BottomButtonBar(this.label, this.callBack, {this.key});
final bool isDisabled;
BottomButtonBar(this.label, this.callBack, {this.key, this.isDisabled=false});
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
Expand Down Expand Up @@ -44,7 +45,7 @@ class BottomButtonBar extends StatelessWidget {
print(ApplicationLocalizations.of(context).translate(this.label));
return ElevatedButton(
style: ElevatedButton.styleFrom(
primary: callBack == null ? Color.fromRGBO(244, 119, 56, 0.7) : null
primary: callBack != null ? Color.fromRGBO(244, 119, 56, 0.7) : Color.fromRGBO(235,235,228, 0.7)
),
child: Text(
ApplicationLocalizations.of(context).translate(this.label),
Expand Down
2 changes: 1 addition & 1 deletion frontend/mgramseva/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mgramseva",
"version": "1.2.9",
"version": "1.2.10",
"license": "egov"
}
2 changes: 1 addition & 1 deletion frontend/mgramseva/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.2.9+30
version: 1.2.10+30

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit 6223997

Please sign in to comment.