Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class LoanActionButtonResolver {
return this.loansService.getLoanActionTemplate(loanId, 'reAmortization');
} else if (loanActionButton === 'Attach Loan Originator') {
return this.organizationService.getLoanOriginators();
} else if (loanActionButton === 'Update discount') {
} else if (loanActionButton === 'Discount Fee') {
return this.loansService.getWorkingCapitalLoanDetails(loanId);
} else {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ <h3 class="mat-h3 margin-t flex-fill">{{ 'labels.heading.Terms' | translate }}</
<span class="flex-30">{{ 'labels.inputs.Total Payment Volume' | translate }}:</span>
<span class="flex-70">
{{
loansAccount.totalPaymentVolume
| currency: loansAccountProductTemplate.currency.code : 'symbol-narrow' : '1.2-2'
loansAccount.totalPayment | currency: loansAccountProductTemplate.currency.code : 'symbol-narrow' : '1.2-2'
}}
<span class="m-l-5">{{ loansAccountProductTemplate.currency.code }}</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,8 @@ <h4 class="mat-h4 flex-98">
@if (loanProductService.isWorkingCapital) {
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Total Payment Volume' | translate }}</mat-label>
<input
type="number"
matInput
mifosxPositiveNumber
min="0"
required
formControlName="totalPaymentVolume"
step="any"
/>
@if (loansAccountTermsForm.controls.totalPaymentVolume.hasError('highAmountValue')) {
<input type="number" matInput mifosxPositiveNumber min="0" required formControlName="totalPayment" step="any" />
@if (loansAccountTermsForm.controls.totalPayment.hasError('highAmountValue')) {
<mat-error>
{{ 'labels.inputs.Total Payment' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.higher than allowed' | translate }}</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export class LoansAccountTermsStepComponent extends LoanProductBaseComponent imp
discount: this.loansAccountTermsData.discountProposed || this.loansAccountTermsData.discount || '',
principalAmount: this.loansAccountTermsData.proposedPrincipal,
periodPaymentRate: this.loansAccountTermsData.periodPaymentRate,
totalPaymentVolume: this.loansAccountTermsData.totalPaymentVolume,
totalPayment: this.loansAccountTermsData.totalPayment,
repaymentEvery: this.loansAccountTermsData.repaymentEvery,
repaymentFrequencyType: this.loansAccountTermsData.repaymentFrequencyType?.id,
delinquencyGraceDays: this.loansAccountTermsData.delinquencyGraceDays,
Expand Down Expand Up @@ -723,7 +723,7 @@ export class LoansAccountTermsStepComponent extends LoanProductBaseComponent imp
amountValueValidator()
]
],
totalPaymentVolume: [
totalPayment: [
'',
[
Validators.required,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@
@if (actions['Attach Loan Originator']) {
<mifosx-attach-originator [dataObject]="actionButtonData"></mifosx-attach-originator>
}
@if (actions['Update discount']) {
@if (actions['Discount Fee']) {
<mifosx-update-discount [dataObject]="actionButtonData"></mifosx-update-discount>
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class LoanAccountActionsComponent {
'Buy Down Fee': boolean;
'Undo Write-off': boolean;
'Attach Loan Originator': boolean;
'Update discount': boolean;
'Discount Fee': boolean;
} = {
Close: false,
'Undo Approval': false,
Expand Down Expand Up @@ -179,7 +179,7 @@ export class LoanAccountActionsComponent {
'Buy Down Fee': false,
'Undo Write-off': false,
'Attach Loan Originator': false,
'Update discount': false
'Discount Fee': false
};

actionButtonData: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import { amountValueValidator } from 'app/shared/validators/amount-value.validat
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { LoanAccountActionsBaseComponent } from '../loan-account-actions-base.component';
import { WorkingCapitalLoanDiscountUpdateRequest } from 'app/loans/loans.service';
import { Currency } from 'app/shared/models/general.model';
import { InputAmountComponent } from 'app/shared/input-amount/input-amount.component';
import { WorkingCapitalLoanDiscountUpdateRequest } from 'app/loans/models/working-capital/working-capital-loan-account.model';

/**
* Update discount action for Working Capital Loan.
* Discount Fee action for Working Capital Loan.
*/
@Component({
selector: 'mifosx-update-discount',
Expand Down Expand Up @@ -61,7 +61,7 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
}
this.updateDiscountForm = this.formBuilder.group({
transactionAmount: [
this.dataObject?.discount ?? this.dataObject?.discountAmount ?? '',
this.dataObject?.discount ?? this.dataObject?.transactionAmount ?? '',
[
Validators.required,
Validators.min(0),
Expand Down Expand Up @@ -91,18 +91,20 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
dateFormat: this.settingsService.dateFormat
};

this.loanService.applyWorkingCapitalLoanAccountCommand(this.loanId, 'discountfee', payload).subscribe({
next: () => {
this.alertService.alert({
type: 'Success',
message: this.translateService.instant('labels.messages.workingCapitalDiscountUpdated')
});
this.gotoLoanDefaultView();
},
error: (error: HttpErrorResponse) => {
this.submitErrorMessage = this.mapDiscountError(error);
}
});
this.loanService
.executeWorkingCapitalLoanAccountTransactionsCommand(this.loanId, 'discountFee', payload)
.subscribe({
next: () => {
this.alertService.alert({
type: 'Success',
message: this.translateService.instant('labels.messages.workingCapitalDiscountUpdated')
});
this.gotoLoanDefaultView();
},
error: (error: HttpErrorResponse) => {
this.submitErrorMessage = this.mapDiscountError(error);
}
});
}

private mapDiscountError(error: HttpErrorResponse): string {
Expand Down
2 changes: 1 addition & 1 deletion src/app/loans/loans-view/loans-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class LoansViewComponent extends LoanProductBaseComponent implements OnIn
this.buttonConfig = new LoansAccountButtonConfiguration(this.status, this.loanSubStatus);
if (this.canShowWorkingCapitalDiscountUpdate()) {
this.buttonConfig.addButton({
name: 'Update discount',
name: 'Discount Fee',
icon: 'edit',
taskPermissionName: 'UPDATEDISCOUNT_WORKINGCAPITALLOAN'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import { CurrencyPipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { FormatNumberPipe } from '@pipes/format-number.pipe';
import { WorkingCapitalBalances } from 'app/loans/models/working-capital/working-capital-loan-account.model';
import { LoanProductBaseComponent } from 'app/products/loan-products/common/loan-product-base.component';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
Expand All @@ -20,7 +19,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
styleUrl: './loan-balances-tab.component.scss',
imports: [
...STANDALONE_SHARED_IMPORTS,
FormatNumberPipe,
CurrencyPipe
],
changeDetection: ChangeDetectionStrategy.OnPush
Expand Down
24 changes: 16 additions & 8 deletions src/app/loans/loans.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ import { Observable } from 'rxjs';
import { Dates } from 'app/core/utils/dates';
import { SettingsService } from 'app/settings/settings.service';
import { DisbursementData } from './models/loan-account.model';

export interface WorkingCapitalLoanDiscountUpdateRequest {
transactionAmount: number;
relatedResourceId: number;
note?: string;
locale: string;
dateFormat: string;
}
import { WorkingCapitalLoanDiscountUpdateRequest } from './models/working-capital/working-capital-loan-account.model';

/**
* Loans service.
Expand Down Expand Up @@ -383,6 +376,21 @@ export class LoansService {
return this.http.post(`/working-capital-loans/${loanId}`, data, { params: httpParams });
}

executeWorkingCapitalLoanAccountTransactionsCommand(
accountId: string,
command: string,
data: any,
transactionId?: any
): Observable<any> {
Comment thread
alberto-art3ch marked this conversation as resolved.
const httpParams = new HttpParams().set('command', command);
if (transactionId !== null && transactionId !== undefined) {
return this.http.post(`/working-capital-loans/${accountId}/transactions/${transactionId}`, data, {
params: httpParams
});
}
return this.http.post(`/working-capital-loans/${accountId}/transactions`, data, { params: httpParams });
}

addInterestPauseToLoan(loanId: any, data?: any): Observable<any> {
return this.http.post(`/loans/${loanId}/interest-pauses`, data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ export interface WorkingCapitalBalances {
totalDiscountFee?: number;
overpaymentAmount?: number;
}

export interface WorkingCapitalLoanDiscountUpdateRequest {
transactionAmount: number;
relatedResourceId: number;
note?: string;
locale: string;
dateFormat: string;
}
1 change: 1 addition & 0 deletions src/assets/translations/cs-CS.json
Original file line number Diff line number Diff line change
Expand Up @@ -3137,6 +3137,7 @@
"Deposit": "Vklad",
"Disburse": "Vyplatit",
"Disburse to Savings": "Výplata na Úspory",
"Discount Fee": "Poplatek za slevu",
"Edit Repayment Schedule": "Upravit splátkový kalendář",
"Foreclosure": "Exekuce",
"Frequent Postings": "Časté příspěvky",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -3139,6 +3139,7 @@
"Deposit": "Kaution",
"Disburse": "Auszahlen",
"Disburse to Savings": "An die Ersparnisse auszahlen",
"Discount Fee": "Rabattgebühr",
"Edit Repayment Schedule": "Bearbeiten Sie den Rückzahlungsplan",
"Foreclosure": "Zwangsvollstreckung",
"Frequent Postings": "Häufige Beiträge",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3133,6 +3133,7 @@
"Deposit": "Deposit",
"Disburse": "Disburse",
"Disburse to Savings": "Disburse to Savings",
"Discount Fee": "Discount Fee",
"Edit Repayment Schedule": "Edit Repayment Schedule",
"Foreclosure": "Foreclosure",
"Frequent Postings": "Frequent Postings",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/es-CL.json
Original file line number Diff line number Diff line change
Expand Up @@ -3138,6 +3138,7 @@
"Deposit": "Depósito",
"Disburse": "Desembolsar",
"Disburse to Savings": "Desembolsar a Ahorros",
"Discount Fee": "Tarifa de Descuento",
"Edit Repayment Schedule": "Editar calendario de pagos",
"Foreclosure": "Juicio hipotecario",
"Frequent Postings": "Publicaciones frecuentes",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,7 @@
"Deposit": "Depósito",
"Disburse": "Desembolsar",
"Disburse to Savings": "Desembolsar a Ahorros",
"Discount Fee": "Tarifa de Descuento",
"Edit Repayment Schedule": "Editar calendario de pagos",
"Foreclosure": "Juicio hipotecario",
"Frequent Postings": "Publicaciones frecuentes",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3140,6 +3140,7 @@
"Deposit": "Dépôt",
"Disburse": "Débourser",
"Disburse to Savings": "Versement de l'épargne",
"Discount Fee": "Frais d'escompte",
"Edit Repayment Schedule": "Modifier le calendrier de remboursement",
"Foreclosure": "Forclusion",
"Frequent Postings": "Publications fréquentes",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,7 @@
"Deposit": "Depositare",
"Disburse": "Sborsare",
"Disburse to Savings": "Versare al risparmio",
"Discount Fee": "Commissione di Sconto",
"Edit Repayment Schedule": "Modifica il piano di rimborso",
"Foreclosure": "Pignoramento",
"Frequent Postings": "Pubblicazioni frequenti",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/ko-KO.json
Original file line number Diff line number Diff line change
Expand Up @@ -3137,6 +3137,7 @@
"Deposit": "보증금",
"Disburse": "지불",
"Disburse to Savings": "저축으로 지출",
"Discount Fee": "할인 수수료",
"Edit Repayment Schedule": "상환 일정 편집",
"Foreclosure": "유질",
"Frequent Postings": "자주 게시되는 게시물",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/lt-LT.json
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,7 @@
"Deposit": "Užstatas",
"Disburse": "Išmokėti",
"Disburse to Savings": "Išmokėkite santaupoms",
"Discount Fee": "Nuolaidų mokestis",
"Edit Repayment Schedule": "Redaguoti grąžinimo grafiką",
"Foreclosure": "Uždarymas",
"Frequent Postings": "Dažni skelbimai",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/lv-LV.json
Original file line number Diff line number Diff line change
Expand Up @@ -3137,6 +3137,7 @@
"Deposit": "Depozīts",
"Disburse": "Izmaksāt",
"Disburse to Savings": "Izmaksa uzkrājumiem",
"Discount Fee": "Atlaides maksa",
"Edit Repayment Schedule": "Rediģēt atmaksas grafiku",
"Foreclosure": "Preces ierobežošana",
"Frequent Postings": "Bieža publicēšana",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/ne-NE.json
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,7 @@
"Deposit": "जम्मा",
"Disburse": "वितरण गर्नुहोस्",
"Disburse to Savings": "बचतमा वितरण गर्नुहोस्",
"Discount Fee": "छुट शुल्क",
"Edit Repayment Schedule": "पुन: भुक्तानी तालिका सम्पादन गर्नुहोस्",
"Foreclosure": "फोरक्लोजर",
"Frequent Postings": "बारम्बार पोस्टिंगहरू",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,7 @@
"Deposit": "Depósito",
"Disburse": "Desembolsar",
"Disburse to Savings": "Desembolsar para poupança",
"Discount Fee": "Taxa de Desconto",
"Edit Repayment Schedule": "Editar cronograma de reembolso",
"Foreclosure": "Execução hipotecária",
"Frequent Postings": "Postagens frequentes",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/sw-SW.json
Original file line number Diff line number Diff line change
Expand Up @@ -3133,6 +3133,7 @@
"Deposit": "Amana",
"Disburse": "Lipa",
"Disburse to Savings": "Lipa kwa Akiba",
"Discount Fee": "Ada ya Punguzo",
"Edit Repayment Schedule": "Badilisha Ratiba ya Ulipaji",
"Foreclosure": "Foreclosure",
"Frequent Postings": "Machapisho ya Mara kwa Mara",
Expand Down
Loading