Upgrade to node 19 (#1696)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
99c2d4780d
commit
62b672d6d9
@@ -8,3 +8,7 @@
|
||||
Run Catch-Up
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container space-top">
|
||||
<mifosx-loan-locked></mifosx-loan-locked>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<div class="tab-container mat-typography" *ngIf="loans.length > 0">
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="start center">
|
||||
<div class="search-box" fxFlex="40%">
|
||||
<mat-form-field fxFlex="90%">
|
||||
<input matInput placeholder="Filter by loan Id or error" (keyup)="applyFilter($event.target.value)">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="60%" *ngIf="allowRunInlineJob">
|
||||
<button mat-raised-button color="success" *mifosxHasPermission="'EXECUTE_INLINE_JOB'" (click)="runInlineCOB()">
|
||||
<fa-icon icon="play" class="m-r-10"></fa-icon>{{'Start inline COB' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table mat-table [dataSource]="dataSource">
|
||||
|
||||
<ng-container matColumnDef="select">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
<mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"
|
||||
[indeterminate]="selection.hasValue() && !isAllSelected()" [aria-label]="checkboxLabel()">
|
||||
</mat-checkbox>
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null"
|
||||
[checked]="selection.isSelected(row)" [aria-label]="checkboxLabel(row)">
|
||||
</mat-checkbox>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="loanId">
|
||||
<th mat-header-cell *matHeaderCellDef> Loan Id </th>
|
||||
<td mat-cell *matCellDef="let loan" class="view-details"> {{loan.loanId}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="lockPlacedOn">
|
||||
<th mat-header-cell *matHeaderCellDef> Lock Placed On </th>
|
||||
<td mat-cell *matCellDef="let loan" class="view-details"> {{loan.lockPlacedOn | datetimeFormat}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="lockOwner">
|
||||
<th mat-header-cell *matHeaderCellDef> Lock Owner </th>
|
||||
<td mat-cell *matCellDef="let loan" class="view-details"> {{loan.lockOwner}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="error">
|
||||
<th mat-header-cell *matHeaderCellDef> Error </th>
|
||||
<td mat-cell *matCellDef="let loan" class="view-details"> {{loan.error}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="details">
|
||||
<th mat-header-cell *matHeaderCellDef> Details </th>
|
||||
<td mat-cell *matCellDef="let loan" class="view-details">
|
||||
<button mat-icon-button class="error-log" matTooltip="Error details" (click)="showDetails(loan)" matTooltipPosition="left">
|
||||
<fa-icon icon="exclamation-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
<button mat-icon-button matTooltip="View Loan Account" (click)="viewLoanAccount(loan)" matTooltipPosition="right">
|
||||
<fa-icon icon="eye" size="lg"></fa-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selection.toggle(row)">
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons [pageSize]="pageSize"
|
||||
[pageIndex]="currentPage" (page)="pageEvent = handlePage($event)">
|
||||
</mat-paginator>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="alert" *ngIf="loans.length === 0">
|
||||
|
||||
<div class="message">
|
||||
<i class="fa fa-exclamation-circle alert-check"></i>
|
||||
No loan locked available.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
.tab-container {
|
||||
padding: 1%;
|
||||
margin: 1%;
|
||||
|
||||
.mat-raised-button.mat-success {
|
||||
color: #fff;
|
||||
background-color: #32cd32;
|
||||
}
|
||||
.mat-raised-button.mat-reject {
|
||||
color: #fff;
|
||||
background-color: #ffa726;
|
||||
}
|
||||
#search-button {
|
||||
height: 2.5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.view-details{
|
||||
cursor: pointer;
|
||||
}
|
||||
table {
|
||||
tr.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.error-log {
|
||||
color: #ffa726;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoanLockedComponent } from './loan-locked.component';
|
||||
|
||||
describe('LoanLockedComponent', () => {
|
||||
let component: LoanLockedComponent;
|
||||
let fixture: ComponentFixture<LoanLockedComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ LoanLockedComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoanLockedComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,137 @@
|
||||
import { SelectionModel } from '@angular/cdk/collections';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
import { ErrorDialogComponent } from 'app/shared/error-dialog/error-dialog.component';
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
import { TasksService } from 'app/tasks/tasks.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loan-locked',
|
||||
templateUrl: './loan-locked.component.html',
|
||||
styleUrls: ['./loan-locked.component.scss']
|
||||
})
|
||||
export class LoanLockedComponent implements OnInit {
|
||||
|
||||
/** Loans Data */
|
||||
loans: any[];
|
||||
/** Batch Requests */
|
||||
batchRequests: any[];
|
||||
/** Datasource for loans disbursal table */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Row Selection */
|
||||
selection: SelectionModel<any>;
|
||||
/** Displayed Columns for loan disbursal data */
|
||||
displayedColumns: string[] = ['select', 'loanId', 'lockPlacedOn', 'lockOwner', 'error', 'details'];
|
||||
/** Paginator for the table */
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
currentPage = 0;
|
||||
pageSize = 10;
|
||||
/** Control for enable/disable button */
|
||||
allowRunInlineJob = false;
|
||||
/** Const for the jobName */
|
||||
jobName: String = 'LOAN_COB';
|
||||
|
||||
/**
|
||||
* @param {LoansService} loansService Loans Service
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private loansService: LoansService,
|
||||
private systemService: SystemService,
|
||||
private tasksService: TasksService,
|
||||
private dialog: MatDialog) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.dataSource = new MatTableDataSource(this.loans);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.selection = new SelectionModel(true, []);
|
||||
this.allowRunInlineJob = false;
|
||||
this.getLoansLocked(this.currentPage);
|
||||
}
|
||||
|
||||
applyFilter(filterValue: string = '') {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
handlePage(e: any) {
|
||||
if (this.currentPage !== e.pageIndex) {
|
||||
this.currentPage = e.pageIndex;
|
||||
this.pageSize = e.pageSize;
|
||||
this.getLoansLocked(this.currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
getLoansLocked(page: number) {
|
||||
this.tasksService.getAllLoansLocked(page, this.pageSize).subscribe((data: any) => {
|
||||
this.loans = data.content;
|
||||
this.allowRunInlineJob = false;
|
||||
this.selection = new SelectionModel(true, []);
|
||||
});
|
||||
}
|
||||
|
||||
/** Whether the number of selected elements matches the total number of rows. */
|
||||
isAllSelected() {
|
||||
const numSelected = this.selection.selected.length;
|
||||
if (numSelected === 0) {
|
||||
this.allowRunInlineJob = false;
|
||||
} else {
|
||||
this.allowRunInlineJob = true;
|
||||
}
|
||||
const numRows = this.dataSource.data.length;
|
||||
return numSelected === numRows;
|
||||
}
|
||||
|
||||
/** Selects all rows if they are not all selected; otherwise clear selection. */
|
||||
masterToggle() {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.data.forEach((row: any) => this.selection.select(row));
|
||||
}
|
||||
|
||||
/** The label for the checkbox on the passed row */
|
||||
checkboxLabel(row?: any): string {
|
||||
if (!row) {
|
||||
return `${this.isAllSelected() ? 'select' : 'deselect'} all`;
|
||||
}
|
||||
return `${this.selection.isSelected(row) ? 'deselect' : 'select'} row ${row.position + 1}`;
|
||||
}
|
||||
|
||||
showDetails(loan: any) {
|
||||
this.dialog.open(ErrorDialogComponent, {
|
||||
width: '960px',
|
||||
height: '400px',
|
||||
data: '<pre><code>' + loan.stacktrace + '</code></pre>'
|
||||
});
|
||||
}
|
||||
|
||||
viewLoanAccount(loan: any) {
|
||||
const loanId = loan.loanId;
|
||||
this.loansService.getLoanAccountDetails(loanId).subscribe((loanData: any) => {
|
||||
const clientId = loanData.clientId;
|
||||
this.router.navigateByUrl(`/clients/${clientId}/loans-accounts/${loanId}/general`);
|
||||
});
|
||||
}
|
||||
|
||||
runInlineCOB(): void {
|
||||
const loanIds: any = [];
|
||||
this.selection.selected.forEach((row: any) => {
|
||||
loanIds.push(row.loanId);
|
||||
});
|
||||
if (loanIds.length > 0) {
|
||||
const payload = {
|
||||
loanIds: loanIds
|
||||
};
|
||||
this.systemService.runInlineCOB(this.jobName, payload).subscribe((data: any) => {
|
||||
this.getLoansLocked(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoanLockedResolver } from './loan-locked.resolver';
|
||||
|
||||
describe('LoanLockedResolver', () => {
|
||||
let resolver: LoanLockedResolver;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
resolver = TestBed.inject(LoanLockedResolver);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(resolver).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
Router, Resolve,
|
||||
RouterStateSnapshot,
|
||||
ActivatedRouteSnapshot
|
||||
} from '@angular/router';
|
||||
import { TasksService } from 'app/tasks/tasks.service';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoanLockedResolver implements Resolve<boolean> {
|
||||
|
||||
/**
|
||||
* @param {TasksService} tasksService Tasks service.
|
||||
*/
|
||||
constructor(private tasksService: TasksService) { }
|
||||
|
||||
/**
|
||||
* Returns all the loans data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.tasksService.getAllLoansLocked(0, 200);
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@ import { WorkflowJobsComponent } from './manage-jobs/workflow-jobs/workflow-jobs
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { ManageExternalEventsComponent } from './manage-external-events/manage-external-events.component';
|
||||
import { CobWorkflowComponent } from './manage-jobs/cob-workflow/cob-workflow.component';
|
||||
import { LoanLockedComponent } from './manage-jobs/cob-workflow/loan-locked/loan-locked.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -141,7 +142,8 @@ import { CobWorkflowComponent } from './manage-jobs/cob-workflow/cob-workflow.co
|
||||
WorkflowJobsComponent,
|
||||
WorkflowDiagramComponent,
|
||||
ManageExternalEventsComponent,
|
||||
CobWorkflowComponent
|
||||
CobWorkflowComponent,
|
||||
LoanLockedComponent
|
||||
],
|
||||
})
|
||||
export class SystemModule { }
|
||||
|
||||
Reference in New Issue
Block a user