Enhancement in loan payment views (#1667)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2023-01-31 18:36:36 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent ffea817f76
commit b9a9a8694c
12 changed files with 73 additions and 25 deletions
@@ -49,7 +49,7 @@ export class LoanActionButtonResolver implements Resolve<Object> {
} else if (loanActionButton === 'Reschedule') { } else if (loanActionButton === 'Reschedule') {
return this.loansService.rescheduleLoanTemplate(); return this.loansService.rescheduleLoanTemplate();
} else if (loanActionButton === 'Prepay Loan') { } else if (loanActionButton === 'Prepay Loan') {
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan'); return this.loansService.getLoanPrepayLoanActionTemplate(loanId, null);
} else if (loanActionButton === 'Add Collateral') { } else if (loanActionButton === 'Add Collateral') {
return this.loansService.getLoanCollateralTemplate(loanId); return this.loansService.getLoanCollateralTemplate(loanId);
} else if (loanActionButton === 'Disburse to Savings') { } else if (loanActionButton === 'Disburse to Savings') {
+1 -3
View File
@@ -73,14 +73,12 @@ const routes: Routes = [
{ {
path: ':loanId', path: ':loanId',
data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' }, data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' },
resolve: {
loanDetailsData: LoanDetailsResolver
},
children: [ children: [
{ {
path: '', path: '',
component: LoansViewComponent, component: LoansViewComponent,
resolve: { resolve: {
loanDetailsData: LoanDetailsResolver,
loanDatatables: LoanDatatablesResolver loanDatatables: LoanDatatablesResolver
}, },
children: [ children: [
@@ -20,7 +20,7 @@
<td mat-cell *matCellDef="let charge"> {{ charge.chargeTimeType.value }} </td> <td mat-cell *matCellDef="let charge"> {{ charge.chargeTimeType.value }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="dueasof"> <ng-container matColumnDef="dueDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Due as of </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Due as of </th>
<td mat-cell *matCellDef="let charge"> {{ charge.dueDate | dateFormat }} </td> <td mat-cell *matCellDef="let charge"> {{ charge.dueDate | dateFormat }} </td>
</ng-container> </ng-container>
@@ -32,7 +32,7 @@
<ng-container matColumnDef="due"> <ng-container matColumnDef="due">
<th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Due </th> <th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Due </th>
<td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.currency.displaySymbol }}{{ charge.amount| number }} </td> <td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.currency.displaySymbol }} {{ charge.amount| number }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="paid"> <ng-container matColumnDef="paid">
@@ -35,7 +35,7 @@ export class ChargesTabComponent implements OnInit {
/** Status */ /** Status */
status: any; status: any;
/** Columns to be displayed in charges table. */ /** Columns to be displayed in charges table. */
displayedColumns: string[] = ['name', 'feepenalty', 'paymentdueat', 'dueasof', 'calculationtype', 'due', 'paid', 'waived', 'outstanding', 'actions']; displayedColumns: string[] = ['name', 'feepenalty', 'paymentdueat', 'dueDate', 'calculationtype', 'due', 'paid', 'waived', 'outstanding', 'actions'];
/** Data source for charges table. */ /** Data source for charges table. */
dataSource: MatTableDataSource<any>; dataSource: MatTableDataSource<any>;
@@ -24,7 +24,7 @@
{{ 'Principal' | translate }} {{ 'Principal' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.principalPortion | number }} {{ dataObject.principalPortion | number }}
</div> </div>
@@ -32,7 +32,7 @@
{{ 'Interest' | translate }} {{ 'Interest' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.interestPortion | number }} {{ dataObject.interestPortion | number }}
</div> </div>
@@ -40,7 +40,7 @@
{{ 'Fees' | translate }} {{ 'Fees' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.feeChargesPortion | number }} {{ dataObject.feeChargesPortion | number }}
</div> </div>
@@ -48,14 +48,16 @@
{{ 'Penalties' | translate }} {{ 'Penalties' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.penaltyChargesPortion | number }} {{ dataObject.penaltyChargesPortion | number }}
</div> </div>
</div> </div>
<mat-form-field> <mat-form-field appearance="fill">
<mat-label>Transaction Amount</mat-label> <mat-label>Transaction Amount</mat-label>
<input type="number" matInput required formControlName="transactionAmount"> <span matTextSuffix class="m-l-10">{{ dataObject.currency.code }}</span>
<span fxFlex="auto"></span>
<input type="number" matInput required class="right-input" formControlName="transactionAmount">
<mat-error *ngIf="repaymentLoanForm.controls.transactionAmount.hasError('required')"> <mat-error *ngIf="repaymentLoanForm.controls.transactionAmount.hasError('required')">
Transaction Amount <strong>is required</strong> Transaction Amount <strong>is required</strong>
</mat-error> </mat-error>
@@ -5,3 +5,11 @@
.container { .container {
max-width: 37rem; max-width: 37rem;
} }
.right-input {
text-align: right;
}
.right-label {
padding-right: 25px !important;
}
@@ -24,38 +24,40 @@
{{ 'Principal' | translate }} {{ 'Principal' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.principalPortion | number }} {{ prepayData.principalPortion | number }}
</div> </div>
<div fxFlex="50%" class="mat-body-strong"> <div fxFlex="50%" class="mat-body-strong">
{{ 'Interest' | translate }} {{ 'Interest' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.interestPortion | number }} {{ prepayData.interestPortion | number }}
</div> </div>
<div fxFlex="50%" class="mat-body-strong"> <div fxFlex="50%" class="mat-body-strong">
{{ 'Fees' | translate }} {{ 'Fees' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.feeChargesPortion | number }} {{ prepayData.feeChargesPortion | number }}
</div> </div>
<div fxFlex="50%" class="mat-body-strong"> <div fxFlex="50%" class="mat-body-strong">
{{ 'Penalties' | translate }} {{ 'Penalties' | translate }}
</div> </div>
<div fxFlex="50%" class="r-amount"> <div fxFlex="50%" class="r-amount right-label">
{{ dataObject.penaltyChargesPortion | number }} {{ prepayData.penaltyChargesPortion | number }}
</div> </div>
</div> </div>
<mat-form-field> <mat-form-field appearance="fill">
<mat-label>Transaction Amount</mat-label> <mat-label>Transaction Amount</mat-label>
<input type="number" matInput required formControlName="transactionAmount"> <span matTextSuffix class="m-l-10">{{ prepayData.currency.code }}</span>
<span fxFlex="auto"></span>
<input type="number" matInput required class="right-input" formControlName="transactionAmount">
<mat-error *ngIf="prepayLoanForm.controls.transactionAmount.hasError('required')"> <mat-error *ngIf="prepayLoanForm.controls.transactionAmount.hasError('required')">
Transaction Amount <strong>is required</strong> Transaction Amount <strong>is required</strong>
</mat-error> </mat-error>
@@ -5,3 +5,11 @@
.container { .container {
max-width: 37rem; max-width: 37rem;
} }
.right-input {
text-align: right;
}
.right-label {
padding-right: 25px !important;
}
@@ -37,6 +37,8 @@ export class PrepayLoanComponent implements OnInit {
/** Prepay Loan form. */ /** Prepay Loan form. */
prepayLoanForm: FormGroup; prepayLoanForm: FormGroup;
prepayData: any;
/** /**
* @param {FormBuilder} formBuilder Form Builder. * @param {FormBuilder} formBuilder Form Builder.
* @param {LoansService} loanService Loan Service. * @param {LoansService} loanService Loan Service.
@@ -61,6 +63,7 @@ export class PrepayLoanComponent implements OnInit {
this.maxDate = this.settingsService.businessDate; this.maxDate = this.settingsService.businessDate;
this.createprepayLoanForm(); this.createprepayLoanForm();
this.setPrepayLoanDetails(); this.setPrepayLoanDetails();
this.prepayData = this.dataObject;
} }
/** /**
@@ -84,6 +87,17 @@ export class PrepayLoanComponent implements OnInit {
this.prepayLoanForm.patchValue({ this.prepayLoanForm.patchValue({
transactionAmount: this.dataObject.amount transactionAmount: this.dataObject.amount
}); });
this.prepayLoanForm.get('transactionDate').valueChanges.subscribe((transactionDate: string) => {
const prepayDate = this.dateUtils.formatDate(transactionDate, this.settingsService.dateFormat);
this.loanService.getLoanPrepayLoanActionTemplate(this.loanId, prepayDate)
.subscribe((response: any) => {
this.prepayData = response;
this.prepayLoanForm.patchValue({
transactionAmount: this.prepayData.amount
});
});
});
} }
/** /**
@@ -73,7 +73,7 @@
</div> </div>
<div fxFlex="50%"> <div fxFlex="50%">
{{ transactionData.amount | currency:transactionData.currency.code }} {{ transactionData.currency.code }} {{ transactionData.amount | currency }} {{ transactionData.currency.code }}
</div> </div>
<div fxFlex="50%" class="mat-body-strong" *ngIf="transactionData.externalId"> <div fxFlex="50%" class="mat-body-strong" *ngIf="transactionData.externalId">
@@ -110,7 +110,7 @@
<ng-container matColumnDef="amount"> <ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef> Amount </th> <th mat-header-cell *matHeaderCellDef> Amount </th>
<td mat-cell *matCellDef="let transactionRel"> <td mat-cell *matCellDef="let transactionRel">
{{ transactionRel.amount | currency:transactionData.currency.code }} {{ transactionData.currency.code }} {{ transactionRel.amount | currency }} {{ transactionData.currency.code }}
</td> </td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
+11
View File
@@ -30,6 +30,17 @@ export class LoansService {
return this.http.get(`/loans/${loanId}/transactions/template`, { params: httpParams }); return this.http.get(`/loans/${loanId}/transactions/template`, { params: httpParams });
} }
getLoanPrepayLoanActionTemplate(loanId: string, transactionDate: string): Observable<any> {
if (!transactionDate) {
transactionDate = this.dateUtils.formatDate(this.settingsService.businessDate, this.settingsService.dateFormat);
}
const httpParams = new HttpParams().set('command', 'prepayLoan')
.set('transactionDate', transactionDate)
.set('locale', this.settingsService.language.code)
.set('dateFormat', this.settingsService.dateFormat);
return this.http.get(`/loans/${loanId}/transactions/template`, { params: httpParams });
}
getLoanForeclosureActionTemplate(loanId: string): Observable<any> { getLoanForeclosureActionTemplate(loanId: string): Observable<any> {
const httpParams = new HttpParams() const httpParams = new HttpParams()
.set('command', 'foreclosure') .set('command', 'foreclosure')
+5
View File
@@ -31,3 +31,8 @@ textarea.noresize {
.mat-tab-body-content { .mat-tab-body-content {
margin-bottom: 20px; margin-bottom: 20px;
} }
.mat-datepicker-input {
margin-top: 5px;
margin-bottom: 5px;
}