Skip to content

Commit 9697d90

Browse files
Merge pull request #2635 from JohnAlva/saving_changes
WEB-305:Enables the interest receivables accounting account, when the overdraft field is enabled.
2 parents 6f0f4f8 + 1281e7a commit 9697d90

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/app/products/saving-products/create-saving-product/create-saving-product.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@
7474
[accountingRuleData]="accountingRuleData"
7575
[isDormancyTrackingActive]="savingProductSettingsForm.get('isDormancyTrackingActive')"
7676
[savingProductFormValid]="savingProductFormValid"
77+
[allowOverdraft]="savingProductSettingsForm.get('allowOverdraft')"
7778
>
7879
</mifosx-saving-product-accounting-step>
7980
</mat-step>
80-
8181
<mat-step state="preview" *ngIf="savingProductFormValid" completed>
8282
<ng-template matStepLabel>{{ 'labels.inputs.PREVIEW' | translate }}</ng-template>
8383

src/app/products/saving-products/edit-saving-product/edit-saving-product.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
[accountingRuleData]="accountingRuleData"
7777
[isDormancyTrackingActive]="savingProductSettingsForm.get('isDormancyTrackingActive')"
7878
[savingProductFormValid]="savingProductFormValidAndNotPristine"
79+
[allowOverdraft]="savingProductSettingsForm.get('allowOverdraft')"
7980
>
8081
</mifosx-saving-product-accounting-step>
8182
</mat-step>

src/app/products/saving-products/saving-product-stepper/saving-product-accounting-step/saving-product-accounting-step.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ <h4 class="mat-h4 flex-98">{{ 'labels.heading.Assets' | translate }}</h4>
5454

5555
<mifosx-gl-account-selector
5656
class="flex-48"
57-
*ngIf="isAccrualAccounting()"
57+
*ngIf="isAccrualAccounting() && allowOverdraft.value"
5858
[inputFormControl]="savingProductAccountingForm.controls.interestReceivableAccountId"
5959
[glAccountList]="assetAccountData"
60-
[required]="true"
60+
[required]="false"
6161
[inputLabel]="'Interest Receivable'"
6262
>
6363
</mifosx-gl-account-selector>

src/app/products/saving-products/saving-product-stepper/saving-product-accounting-step/saving-product-accounting-step.component.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class SavingProductAccountingStepComponent implements OnInit {
7070
@Input() accountingRuleData: any;
7171
@Input() isDormancyTrackingActive: UntypedFormControl;
7272
@Input() savingProductFormValid: boolean;
73+
@Input() allowOverdraft: UntypedFormControl;
7374

7475
savingProductAccountingForm: UntypedFormGroup;
7576

@@ -256,10 +257,16 @@ export class SavingProductAccountingStepComponent implements OnInit {
256257
'penaltiesReceivableAccountId',
257258
new UntypedFormControl('', Validators.required)
258259
);
259-
this.savingProductAccountingForm.addControl(
260-
'interestReceivableAccountId',
261-
new UntypedFormControl('', Validators.required)
262-
);
260+
if (this.allowOverdraft.value) {
261+
this.savingProductAccountingForm.addControl('interestReceivableAccountId', new UntypedFormControl(''));
262+
}
263+
this.allowOverdraft.valueChanges.subscribe((allowOverdraft: boolean) => {
264+
if (allowOverdraft) {
265+
this.savingProductAccountingForm.addControl('interestReceivableAccountId', new UntypedFormControl(''));
266+
} else {
267+
this.savingProductAccountingForm.removeControl('interestReceivableAccountId');
268+
}
269+
});
263270
this.savingProductAccountingForm.addControl(
264271
'interestPayableAccountId',
265272
new UntypedFormControl('', Validators.required)

0 commit comments

Comments
 (0)