WEB-280: Add additional field which would return available disbursement amount with over applied amount

This commit is contained in:
mariiaKraievska
2025-08-20 14:19:14 +03:00
parent f6e55c4006
commit 36f7ac7bbd
24 changed files with 150 additions and 18 deletions
@@ -33,6 +33,12 @@
</span></span </span></span
> >
</div> </div>
<div class="flex-fill" *ngIf="data.loanData?.delinquent?.availableDisbursementAmountWithOverApplied !== undefined">
<span class="flex-50">{{ 'labels.inputs.Available Disbursement Amount (with Over Applied)' | translate }}:</span>
<span class="flex-50">{{
data.loanData.delinquent.availableDisbursementAmountWithOverApplied | formatNumber
}}</span>
</div>
</div> </div>
</div> </div>
@@ -278,5 +278,19 @@
}}&nbsp;{{ 'labels.text.Days' | translate }} }}&nbsp;{{ 'labels.text.Days' | translate }}
</span> </span>
</div> </div>
<div
class="flex-fill layout-row"
*ngIf="
loanDetails &&
loanDetails.delinquent &&
loanDetails.delinquent.availableDisbursementAmountWithOverApplied !== undefined
"
>
<span class="flex-50">{{ 'labels.inputs.Available Disbursement Amount (with Over Applied)' | translate }}</span>
<span class="flex-50">{{
loanDetails.delinquent.availableDisbursementAmountWithOverApplied | formatNumber
}}</span>
</div>
</div> </div>
</div> </div>
@@ -40,6 +40,12 @@
> >
</mifosx-input-amount> </mifosx-input-amount>
<!-- Display Available Disbursement Amount with Over Applied if available -->
<mat-form-field>
<mat-label>{{ 'labels.inputs.Available Disbursement Amount (with Over Applied)' | translate }}</mat-label>
<input matInput [value]="loanData.availableDisbursementAmountWithOverApplied | formatNumber" readonly />
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-label>{{ 'labels.inputs.Transaction Amount' | translate }}</mat-label> <mat-label>{{ 'labels.inputs.Transaction Amount' | translate }}</mat-label>
<input matInput type="number" required formControlName="approvedLoanAmount" /> <input matInput type="number" required formControlName="approvedLoanAmount" />
@@ -10,7 +10,9 @@ import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model'; import { Currency } from 'app/shared/models/general.model';
import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component'; import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component';
import { CdkTextareaAutosize } from '@angular/cdk/text-field'; import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { FormatNumberPipe } from '../../../../pipes/format-number.pipe';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { MatIcon } from '@angular/material/icon';
/** /**
* Approve Loan component. * Approve Loan component.
@@ -22,7 +24,9 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
imports: [ imports: [
...STANDALONE_SHARED_IMPORTS, ...STANDALONE_SHARED_IMPORTS,
InputAmountComponent, InputAmountComponent,
CdkTextareaAutosize CdkTextareaAutosize,
FormatNumberPipe,
MatIcon
] ]
}) })
export class ApproveLoanComponent implements OnInit { export class ApproveLoanComponent implements OnInit {
@@ -70,6 +74,19 @@ export class ApproveLoanComponent implements OnInit {
expectedDisbursementDate: new Date(response.timeline.expectedDisbursementDate) expectedDisbursementDate: new Date(response.timeline.expectedDisbursementDate)
}); });
}); });
// Get delinquency data for available disbursement amount with over applied
this.loanService.getLoanDelinquencyDataForTemplate(this.loanId).subscribe((delinquencyData: any) => {
// Check if the field is at root level
if (delinquencyData.availableDisbursementAmountWithOverApplied !== undefined) {
this.loanData.availableDisbursementAmountWithOverApplied =
delinquencyData.availableDisbursementAmountWithOverApplied;
}
// Also check if it's in delinquent object
if (delinquencyData.delinquent) {
this.loanData.delinquent = delinquencyData.delinquent;
}
});
} }
/** /**
@@ -29,6 +29,12 @@
> >
</mifosx-input-amount> </mifosx-input-amount>
<!-- Display Available Disbursement Amount with Over Applied if available -->
<mat-form-field>
<mat-label>{{ 'labels.inputs.Available Disbursement Amount (with Over Applied)' | translate }}</mat-label>
<input matInput [value]="dataObject.availableDisbursementAmountWithOverApplied | formatNumber" readonly />
</mat-form-field>
<mat-form-field *ngIf="dataObject.fixedEmiAmount"> <mat-form-field *ngIf="dataObject.fixedEmiAmount">
<mat-label>{{ 'labels.inputs.Fixed EMI amount' | translate }}</mat-label> <mat-label>{{ 'labels.inputs.Fixed EMI amount' | translate }}</mat-label>
<input matInput type="number" formControlName="fixedEmiAmount" /> <input matInput type="number" formControlName="fixedEmiAmount" />
@@ -13,7 +13,9 @@ import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model'; import { Currency } from 'app/shared/models/general.model';
import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component'; import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component';
import { CdkTextareaAutosize } from '@angular/cdk/text-field'; import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { FormatNumberPipe } from '../../../../pipes/format-number.pipe';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { MatIcon } from '@angular/material/icon';
@Component({ @Component({
selector: 'mifosx-disburse-to-savings-account', selector: 'mifosx-disburse-to-savings-account',
@@ -22,7 +24,9 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
imports: [ imports: [
...STANDALONE_SHARED_IMPORTS, ...STANDALONE_SHARED_IMPORTS,
InputAmountComponent, InputAmountComponent,
CdkTextareaAutosize CdkTextareaAutosize,
FormatNumberPipe,
MatIcon
] ]
}) })
export class DisburseToSavingsAccountComponent implements OnInit { export class DisburseToSavingsAccountComponent implements OnInit {
@@ -59,6 +63,20 @@ export class DisburseToSavingsAccountComponent implements OnInit {
if (this.dataObject.currency) { if (this.dataObject.currency) {
this.currency = this.dataObject.currency; this.currency = this.dataObject.currency;
} }
// Get delinquency data for available disbursement amount with over applied
const loanId = this.route.snapshot.params['loanId'];
this.loanService.getLoanDelinquencyDataForTemplate(loanId).subscribe((delinquencyData: any) => {
// Check if the field is at root level
if (delinquencyData.availableDisbursementAmountWithOverApplied !== undefined) {
this.dataObject.availableDisbursementAmountWithOverApplied =
delinquencyData.availableDisbursementAmountWithOverApplied;
}
// Also check if it's in delinquent object
if (delinquencyData.delinquent) {
this.dataObject.delinquent = delinquencyData.delinquent;
}
});
} }
/** /**
@@ -29,6 +29,12 @@
> >
</mifosx-input-amount> </mifosx-input-amount>
<!-- Display Available Disbursement Amount with Over Applied if available -->
<mat-form-field>
<mat-label>{{ 'labels.inputs.Available Disbursement Amount (with Over Applied)' | translate }}</mat-label>
<input matInput [value]="dataObject.availableDisbursementAmountWithOverApplied | formatNumber" readonly />
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-label>{{ 'labels.inputs.External Id' | translate }}</mat-label> <mat-label>{{ 'labels.inputs.External Id' | translate }}</mat-label>
<input matInput formControlName="externalId" /> <input matInput formControlName="externalId" />
@@ -17,7 +17,9 @@ import { Currency } from 'app/shared/models/general.model';
import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component'; import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component';
import { MatSlideToggle } from '@angular/material/slide-toggle'; import { MatSlideToggle } from '@angular/material/slide-toggle';
import { CdkTextareaAutosize } from '@angular/cdk/text-field'; import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { FormatNumberPipe } from '../../../../pipes/format-number.pipe';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { MatIcon } from '@angular/material/icon';
/** /**
* Disburse Loan Option * Disburse Loan Option
@@ -30,7 +32,9 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
...STANDALONE_SHARED_IMPORTS, ...STANDALONE_SHARED_IMPORTS,
InputAmountComponent, InputAmountComponent,
MatSlideToggle, MatSlideToggle,
CdkTextareaAutosize CdkTextareaAutosize,
FormatNumberPipe,
MatIcon
] ]
}) })
export class DisburseComponent implements OnInit { export class DisburseComponent implements OnInit {
@@ -78,6 +82,19 @@ export class DisburseComponent implements OnInit {
if (this.dataObject.currency) { if (this.dataObject.currency) {
this.currency = this.dataObject.currency; this.currency = this.dataObject.currency;
} }
// Get delinquency data for available disbursement amount with over applied
this.loanService.getLoanDelinquencyDataForTemplate(this.loanId).subscribe((delinquencyData: any) => {
// Check if the field is at root level
if (delinquencyData.availableDisbursementAmountWithOverApplied !== undefined) {
this.dataObject.availableDisbursementAmountWithOverApplied =
delinquencyData.availableDisbursementAmountWithOverApplied;
}
// Also check if it's in delinquent object
if (delinquencyData.delinquent) {
this.dataObject.delinquent = delinquencyData.delinquent;
}
});
} }
/** /**
@@ -86,6 +86,19 @@ export class ViewGuarantorsComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.guarantorDetails = this.dataObject.guarantors; this.guarantorDetails = this.dataObject.guarantors;
// Get delinquency data for available disbursement amount with over applied
this.loansService.getLoanDelinquencyDataForTemplate(this.loanId).subscribe((delinquencyData: any) => {
// Check if the field is at root level
if (delinquencyData.availableDisbursementAmountWithOverApplied !== undefined) {
this.dataObject.availableDisbursementAmountWithOverApplied =
delinquencyData.availableDisbursementAmountWithOverApplied;
}
// Also check if it's in delinquent object
if (delinquencyData.delinquent) {
this.dataObject.delinquent = delinquencyData.delinquent;
}
});
} }
toggleGuarantorsDetailsOverview() { toggleGuarantorsDetailsOverview() {
+17 -2
View File
@@ -29,7 +29,12 @@ export class LoansService {
} }
getLoanActionTemplate(loanId: string, command: string): Observable<any> { getLoanActionTemplate(loanId: string, command: string): Observable<any> {
const httpParams = new HttpParams().set('command', command); let httpParams = new HttpParams().set('command', command);
// Add associations for specific commands that need delinquency data
if (command === 'disburse' || command === 'disbursetosavings') {
httpParams = httpParams.set('associations', 'delinquency');
}
return this.http.get(`/loans/${loanId}/transactions/template`, { params: httpParams }); return this.http.get(`/loans/${loanId}/transactions/template`, { params: httpParams });
} }
@@ -92,6 +97,16 @@ export class LoansService {
return this.http.get(`/loans/${loanId}`, { params: httpParams }); return this.http.get(`/loans/${loanId}`, { params: httpParams });
} }
/**
* Get Loan Delinquency Data for template usage
* @param {string} loanId Loan Id
* @returns {Observable<any>}
*/
getLoanDelinquencyDataForTemplate(loanId: string): Observable<any> {
const httpParams = new HttpParams().set('associations', 'delinquency');
return this.http.get(`/loans/${loanId}`, { params: httpParams });
}
getDelinquencyActions(loanId: string) { getDelinquencyActions(loanId: string) {
return this.http.get(`/loans/${loanId}/delinquency-actions`); return this.http.get(`/loans/${loanId}/delinquency-actions`);
} }
@@ -469,7 +484,7 @@ export class LoansService {
* @returns {Observable<any>} * @returns {Observable<any>}
*/ */
getLoanApprovalTemplate(loanId: string): Observable<any> { getLoanApprovalTemplate(loanId: string): Observable<any> {
const httpParams = new HttpParams().set('templateType', 'approval'); const httpParams = new HttpParams().set('templateType', 'approval').set('associations', 'delinquency');
return this.http.get(`/loans/${loanId}/template`, { params: httpParams }); return this.http.get(`/loans/${loanId}/template`, { params: httpParams });
} }
@@ -8,6 +8,7 @@ export interface DelinquencyRange {
export interface DelinquentData { export interface DelinquentData {
availableDisbursementAmount: number; availableDisbursementAmount: number;
availableDisbursementAmountWithOverApplied: number;
pastDueDays: number; pastDueDays: number;
nextPaymentDueDate: number[]; nextPaymentDueDate: number[];
delinquentDays: number; delinquentDays: number;
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Poplatky za odkup", "Buy down fees": "Poplatky za odkup",
"Income from Buy down fees": "Příjmy z poplatků za odkup", "Income from Buy down fees": "Příjmy z poplatků za odkup",
"Buy down fee Expense": "Náklady na poplatek za odkup", "Buy down fee Expense": "Náklady na poplatek za odkup",
"Skip Interest Refund Transaction Posting": "Přeskočit zaúčtování vrácení úroků" "Skip Interest Refund Transaction Posting": "Přeskočit zaúčtování vrácení úroků",
"Available Disbursement Amount (with Over Applied)": "Dostupná částka k výplatě (s přeplatkem)"
}, },
"links": { "links": {
"Community": "Společenství", "Community": "Společenství",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Buy-Down-Gebühren", "Buy down fees": "Buy-Down-Gebühren",
"Income from Buy down fees": "Einnahmen aus Buy-Down-Gebühren", "Income from Buy down fees": "Einnahmen aus Buy-Down-Gebühren",
"Buy down fee Expense": "Aufwendungen aus Buy-Down-Gebühren", "Buy down fee Expense": "Aufwendungen aus Buy-Down-Gebühren",
"Skip Interest Refund Transaction Posting": "Buchung der Zinsrückerstattung überspringen" "Skip Interest Refund Transaction Posting": "Buchung der Zinsrückerstattung überspringen",
"Available Disbursement Amount (with Over Applied)": "Verfügbarer Auszahlungsbetrag (mit Überzahlung)"
}, },
"links": { "links": {
"Community": "Gemeinschaft", "Community": "Gemeinschaft",
+2 -1
View File
@@ -2507,7 +2507,8 @@
"Buy down fees": "Buy down fees", "Buy down fees": "Buy down fees",
"Income from Buy down fees": "Income from Buy down fees", "Income from Buy down fees": "Income from Buy down fees",
"Buy down fee Expense": "Buy down fee Expense", "Buy down fee Expense": "Buy down fee Expense",
"Skip Interest Refund Transaction Posting": "Skip Interest Refund Transaction Posting" "Skip Interest Refund Transaction Posting": "Skip Interest Refund Transaction Posting",
"Available Disbursement Amount (with Over Applied)": "Available Disbursement Amount (with Over Applied)"
}, },
"links": { "links": {
"Community": "Community", "Community": "Community",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Tarifas de compra anticipada", "Buy down fees": "Tarifas de compra anticipada",
"Income from Buy down fees": "Ingresos por comisiones de compra inicial", "Income from Buy down fees": "Ingresos por comisiones de compra inicial",
"Buy down fee Expense": "Gastos por comisiones de compra inicial", "Buy down fee Expense": "Gastos por comisiones de compra inicial",
"Skip Interest Refund Transaction Posting": "Omitir el registro de la devolución de intereses" "Skip Interest Refund Transaction Posting": "Omitir el registro de la devolución de intereses",
"Available Disbursement Amount (with Over Applied)": "Monto disponible para desembolso (con sobreaplicación)"
}, },
"links": { "links": {
"Community": "Comunidad", "Community": "Comunidad",
+2 -1
View File
@@ -2501,7 +2501,8 @@
"Income from Buy down fees": "Ingresos por comisiones de compra inicial", "Income from Buy down fees": "Ingresos por comisiones de compra inicial",
"Buy down fee Expense": "Gastos por comisiones de compra inicial", "Buy down fee Expense": "Gastos por comisiones de compra inicial",
"Skip Interest Refund Transaction Posting": "Omitir el registro de la devolución de intereses", "Skip Interest Refund Transaction Posting": "Omitir el registro de la devolución de intereses",
"Incorporation Date": "Fecha de Constitución" "Incorporation Date": "Fecha de Constitución",
"Available Disbursement Amount (with Over Applied)": "Monto disponible para desembolso (con sobreaplicación)"
}, },
"links": { "links": {
"Community": "Comunidad", "Community": "Comunidad",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Frais d'achat", "Buy down fees": "Frais d'achat",
"Income from Buy down fees": "Revenus des commissions de rachat", "Income from Buy down fees": "Revenus des commissions de rachat",
"Buy down fee Expense": "Charges des commissions de rachat", "Buy down fee Expense": "Charges des commissions de rachat",
"Skip Interest Refund Transaction Posting": "Ignorer la comptabilisation du remboursement des intérêts" "Skip Interest Refund Transaction Posting": "Ignorer la comptabilisation du remboursement des intérêts",
"Available Disbursement Amount (with Over Applied)": "Montant de décaissement disponible (avec sur-application)"
}, },
"links": { "links": {
"Community": "Communauté", "Community": "Communauté",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Commissioni di acquisto", "Buy down fees": "Commissioni di acquisto",
"Income from Buy down fees": "Proventi da commissioni di buy down", "Income from Buy down fees": "Proventi da commissioni di buy down",
"Buy down fee Expense": "Spese da commissioni di buy down", "Buy down fee Expense": "Spese da commissioni di buy down",
"Skip Interest Refund Transaction Posting": "Salta la registrazione del rimborso degli interessi" "Skip Interest Refund Transaction Posting": "Salta la registrazione del rimborso degli interessi",
"Available Disbursement Amount (with Over Applied)": "Importo di disbrigo disponibile (con sovraapplicazione)"
}, },
"links": { "links": {
"Community": "Comunità", "Community": "Comunità",
+2 -1
View File
@@ -2501,7 +2501,8 @@
"Buy down fees": "매수 수수료", "Buy down fees": "매수 수수료",
"Income from Buy down fees": "매입 수수료 수입", "Income from Buy down fees": "매입 수수료 수입",
"Buy down fee Expense": "매입 수수료 비용", "Buy down fee Expense": "매입 수수료 비용",
"Skip Interest Refund Transaction Posting": "이자 환불 거래 게시 건너뛰기" "Skip Interest Refund Transaction Posting": "이자 환불 거래 게시 건너뛰기",
"Available Disbursement Amount (with Over Applied)": "초과 적용 금액을 포함한 사용 가능한 지급 금액"
}, },
"links": { "links": {
"Community": "지역 사회", "Community": "지역 사회",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Išpirkimo mokesčiai", "Buy down fees": "Išpirkimo mokesčiai",
"Income from Buy down fees": "Pajamos iš supirkimo mokesčių", "Income from Buy down fees": "Pajamos iš supirkimo mokesčių",
"Buy down fee Expense": "Supirkimo mokesčio išlaidos", "Buy down fee Expense": "Supirkimo mokesčio išlaidos",
"Skip Interest Refund Transaction Posting": "Praleisti palūkanų grąžinimo įrašą" "Skip Interest Refund Transaction Posting": "Praleisti palūkanų grąžinimo įrašą",
"Available Disbursement Amount (with Over Applied)": "Galimas išmokėjimo kiekis (su pertekliumi)"
}, },
"links": { "links": {
"Community": "bendruomenė", "Community": "bendruomenė",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Iepirkuma maksas", "Buy down fees": "Iepirkuma maksas",
"Income from Buy down fees": "Ienākumi no akciju izpirkšanas komisijas maksām", "Income from Buy down fees": "Ienākumi no akciju izpirkšanas komisijas maksām",
"Buy down fee Expense": "Akciju izpirkšanas komisijas izdevumi", "Buy down fee Expense": "Akciju izpirkšanas komisijas izdevumi",
"Skip Interest Refund Transaction Posting": "Izlaist procentu atmaksas ierakstu" "Skip Interest Refund Transaction Posting": "Izlaist procentu atmaksas ierakstu",
"Available Disbursement Amount (with Over Applied)": "Pieejamā izmaksas summa (ar pārsniegumu)"
}, },
"links": { "links": {
"Community": "kopiena", "Community": "kopiena",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "खरिद शुल्क", "Buy down fees": "खरिद शुल्क",
"Income from Buy down fees": "खरिद शुल्कबाट हुने आम्दानी", "Income from Buy down fees": "खरिद शुल्कबाट हुने आम्दानी",
"Buy down fee Expense": "खरीद शुल्क खर्च", "Buy down fee Expense": "खरीद शुल्क खर्च",
"Skip Interest Refund Transaction Posting": "ब्याज फिर्ता पोस्टिङ्ग छोड्नुहोस्" "Skip Interest Refund Transaction Posting": "ब्याज फिर्ता पोस्टिङ्ग छोड्नुहोस्",
"Available Disbursement Amount (with Over Applied)": "उपलब्ध भुक्तानी रकम (अधिक लागू रकम सहित)"
}, },
"links": { "links": {
"Community": "समुदाय", "Community": "समुदाय",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Taxas de compra antecipada", "Buy down fees": "Taxas de compra antecipada",
"Income from Buy down fees": "Receita com taxas de recompra", "Income from Buy down fees": "Receita com taxas de recompra",
"Buy down fee Expense": "Despesa com taxas de recompra", "Buy down fee Expense": "Despesa com taxas de recompra",
"Skip Interest Refund Transaction Posting": "Ignorar o lançamento do reembolso de juros" "Skip Interest Refund Transaction Posting": "Ignorar o lançamento do reembolso de juros",
"Available Disbursement Amount (with Over Applied)": "Valor de desembolso disponível (com sobreaplicação)"
}, },
"links": { "links": {
"Community": "Comunidade", "Community": "Comunidade",
+2 -1
View File
@@ -2500,7 +2500,8 @@
"Buy down fees": "Nunua ada za chini", "Buy down fees": "Nunua ada za chini",
"Income from Buy down fees": "Mapato kutoka kwa ada ya Kununua", "Income from Buy down fees": "Mapato kutoka kwa ada ya Kununua",
"Buy down fee Expense": "Kununua ada ya chini Gharama", "Buy down fee Expense": "Kununua ada ya chini Gharama",
"Skip Interest Refund Transaction Posting": "Ruka uchapishaji wa muamala wa kurejesha riba" "Skip Interest Refund Transaction Posting": "Ruka uchapishaji wa muamala wa kurejesha riba",
"Available Disbursement Amount (with Over Applied)": "Tillgängligt utbetalningsbelopp (med överbetalning)"
}, },
"links": { "links": {
"Community": "Jumuiya", "Community": "Jumuiya",