Skip to content

Commit 0618bf8

Browse files
WEB-1271: Working Capital Loan discount fee uses the active disbursement and shows its date
1 parent 709563c commit 0618bf8

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
>
2020
</mifosx-input-amount>
2121

22+
<mat-form-field>
23+
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
24+
<input matInput [value]="disbursementDate | dateFormat" readonly />
25+
</mat-form-field>
26+
2227
<mat-form-field>
2328
<mat-label>{{ 'labels.inputs.External Id' | translate }}</mat-label>
2429
<input matInput formControlName="externalId" />

‎src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
4848

4949
currency: Currency | null = null;
5050
disbursementTransactionId: number = 0;
51+
disbursementDate: number[] | string | null = null;
5152

5253
constructor() {
5354
super();
@@ -58,10 +59,13 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
5859
isSubmitting = false;
5960

6061
ngOnInit(): void {
61-
if (this.dataObject?.content && this.dataObject?.content.length > 0) {
62-
const disburseTransaction = this.dataObject?.content[0];
62+
const disburseTransaction = this.dataObject?.content?.find(
63+
(transaction: any) => transaction.type?.disbursement && !transaction.reversed
64+
);
65+
if (disburseTransaction) {
6366
this.currency = disburseTransaction.currency;
6467
this.disbursementTransactionId = disburseTransaction.id;
68+
this.disbursementDate = disburseTransaction.transactionDate;
6569
}
6670
this.updateDiscountForm = this.formBuilder.group({
6771
transactionAmount: [

0 commit comments

Comments
 (0)