WEB-622 To have a button for printing a loan application (#3046)

This commit is contained in:
Soni Jay
2026-01-24 15:37:54 -06:00
committed by GitHub
parent 88d819a126
commit d36e2b6cb5
15 changed files with 55 additions and 1 deletions
@@ -182,6 +182,18 @@
<ng-container matColumnDef="Actions">
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
<td mat-cell class="center" *matCellDef="let element">
<!-- Print Icon -->
<button
class="account-action-button"
mat-raised-button
color="accent"
matTooltip="{{ 'tooltips.Print Loan Application' | translate }}"
matTooltipPosition="above"
aria-label="{{ 'tooltips.Print Loan Application' | translate }}"
(click)="openLoanApplicationReport($event, element.id)"
>
<i class="fa fa-print"></i>
</button>
@if (element.status.active) {
<button
class="account-action-button"
@@ -304,6 +316,22 @@
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Closed Date' | translate }}</th>
<td mat-cell *matCellDef="let element">{{ element.timeline.closedOnDate | dateFormat }}</td>
</ng-container>
<ng-container matColumnDef="Actions">
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
<td mat-cell class="center" *matCellDef="let element">
<!-- Print Icon -->
<button
class="account-action-button"
mat-raised-button
color="accent"
matTooltip="{{ 'tooltips.Print Loan Application' | translate }}"
matTooltipPosition="above"
(click)="openLoanApplicationReport($event, element.id)"
>
<i class="fa fa-print"></i>
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="closedLoansColumns"></tr>
<tr
mat-row
@@ -8,6 +8,7 @@
/** Angular Imports */
import { Component, OnInit, inject } from '@angular/core';
import { environment } from '../../../../environments/environment';
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
/** Custom Services. */
@@ -66,6 +67,17 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class GeneralTabComponent {
openLoanApplicationReport(event: MouseEvent, loanId: string) {
event.stopPropagation();
const baseApiUrl = environment.baseApiUrl?.replace(/\/$/, '') || '';
const apiProvider = environment.apiProvider?.replace(/\/$/, '') || '';
const apiVersion = environment.apiVersion?.replace(/\/$/, '') || '';
const tenantIdentifier = environment.fineractPlatformTenantId || 'default';
const locale = environment.defaultLanguage || 'en';
const dateFormat = 'dd MMMM yyyy';
const reportUrl = `${baseApiUrl}${apiProvider}${apiVersion}/runreports/LoanApplicationReport?tenantIdentifier=${tenantIdentifier}&locale=${locale}&dateFormat=${encodeURIComponent(dateFormat)}&R_loanId=${loanId}&output-type=PDF`;
window.open(reportUrl, '_blank', 'noopener,noreferrer');
}
private route = inject(ActivatedRoute);
private clientService = inject(ClientsService);
private router = inject(Router);
@@ -88,7 +100,8 @@ export class GeneralTabComponent {
'Loan Balance',
'Amount Paid',
'Type',
'Closed Date'
'Closed Date',
'Actions'
];
/** Open Savings Accounts Columns */
openSavingsColumns: string[] = [