@@ -18,12 +18,12 @@ import { amountValueValidator } from 'app/shared/validators/amount-value.validat
1818import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module' ;
1919import { CdkTextareaAutosize } from '@angular/cdk/text-field' ;
2020import { LoanAccountActionsBaseComponent } from '../loan-account-actions-base.component' ;
21- import { WorkingCapitalLoanDiscountUpdateRequest } from 'app/loans/loans.service' ;
2221import { Currency } from 'app/shared/models/general.model' ;
2322import { InputAmountComponent } from 'app/shared/input-amount/input-amount.component' ;
23+ import { WorkingCapitalLoanDiscountUpdateRequest } from 'app/loans/models/working-capital/working-capital-loan-account.model' ;
2424
2525/**
26- * Update discount action for Working Capital Loan.
26+ * Discount Fee action for Working Capital Loan.
2727 */
2828@Component ( {
2929 selector : 'mifosx-update-discount' ,
@@ -61,7 +61,7 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
6161 }
6262 this . updateDiscountForm = this . formBuilder . group ( {
6363 transactionAmount : [
64- this . dataObject ?. discount ?? this . dataObject ?. discountAmount ?? '' ,
64+ this . dataObject ?. discount ?? this . dataObject ?. transactionAmount ?? '' ,
6565 [
6666 Validators . required ,
6767 Validators . min ( 0 ) ,
@@ -91,18 +91,20 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
9191 dateFormat : this . settingsService . dateFormat
9292 } ;
9393
94- this . loanService . applyWorkingCapitalLoanAccountCommand ( this . loanId , 'discountfee' , payload ) . subscribe ( {
95- next : ( ) => {
96- this . alertService . alert ( {
97- type : 'Success' ,
98- message : this . translateService . instant ( 'labels.messages.workingCapitalDiscountUpdated' )
99- } ) ;
100- this . gotoLoanDefaultView ( ) ;
101- } ,
102- error : ( error : HttpErrorResponse ) => {
103- this . submitErrorMessage = this . mapDiscountError ( error ) ;
104- }
105- } ) ;
94+ this . loanService
95+ . executeWorkingCapitalLoanAccountTransactionsCommand ( this . loanId , 'discountFee' , payload )
96+ . subscribe ( {
97+ next : ( ) => {
98+ this . alertService . alert ( {
99+ type : 'Success' ,
100+ message : this . translateService . instant ( 'labels.messages.workingCapitalDiscountUpdated' )
101+ } ) ;
102+ this . gotoLoanDefaultView ( ) ;
103+ } ,
104+ error : ( error : HttpErrorResponse ) => {
105+ this . submitErrorMessage = this . mapDiscountError ( error ) ;
106+ }
107+ } ) ;
106108 }
107109
108110 private mapDiscountError ( error : HttpErrorResponse ) : string {
0 commit comments