feat(products): add loan products component (#430)
Add loan products component to list all loan products. Fixes: #429
This commit is contained in:
@@ -25,6 +25,8 @@ export class StatusLookupPipe implements PipeTransform {
|
|||||||
'shareAccountStatusType.approved': 'status-approved',
|
'shareAccountStatusType.approved': 'status-approved',
|
||||||
'shareAccountStatusType.active': 'status-active',
|
'shareAccountStatusType.active': 'status-active',
|
||||||
'shareAccountStatusType.rejected': 'status-rejected',
|
'shareAccountStatusType.rejected': 'status-rejected',
|
||||||
|
'loanProduct.active': 'status-active',
|
||||||
|
'loanProduct.inActive': 'status-inactive'
|
||||||
};
|
};
|
||||||
return cssClassNameLookup[status];
|
return cssClassNameLookup[status];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||||
|
<button mat-raised-button color="primary" [routerLink]="['create']">
|
||||||
|
<fa-icon icon="plus"></fa-icon>
|
||||||
|
Create Loan Product
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div fxLayout="row">
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>Filter</mat-label>
|
||||||
|
<input matInput (keyup)="applyFilter($event.target.value)">
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mat-elevation-z8">
|
||||||
|
|
||||||
|
<table mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
|
||||||
|
<td mat-cell *matCellDef="let loanProduct"> {{ loanProduct.name }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="shortName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Short Name </th>
|
||||||
|
<td mat-cell *matCellDef="let loanProduct"> {{ loanProduct.shortName }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="closeDate">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Expiry Date </th>
|
||||||
|
<td mat-cell *matCellDef="let loanProduct"> {{ loanProduct.closeDate | date }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="status">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||||
|
<td mat-cell *matCellDef="let loanProduct">
|
||||||
|
<div [className]="loanProduct.status | statusLookup">
|
||||||
|
<fa-icon matTooltip="{{ loanProduct.status === 'loanProduct.active' ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LoanProductsComponent } from './loan-products.component';
|
||||||
|
|
||||||
|
describe('LoanProductsComponent', () => {
|
||||||
|
let component: LoanProductsComponent;
|
||||||
|
let fixture: ComponentFixture<LoanProductsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ LoanProductsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(LoanProductsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-products',
|
||||||
|
templateUrl: './loan-products.component.html',
|
||||||
|
styleUrls: ['./loan-products.component.scss']
|
||||||
|
})
|
||||||
|
export class LoanProductsComponent implements OnInit {
|
||||||
|
|
||||||
|
loanProductsData: any;
|
||||||
|
displayedColumns: string[] = ['name', 'shortName', 'closeDate', 'status'];
|
||||||
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe((data: { loanProducts: any }) => {
|
||||||
|
this.loanProductsData = data.loanProducts;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.loanProductsData);
|
||||||
|
this.dataSource.paginator = this.paginator;
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyFilter(filterValue: string) {
|
||||||
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { ProductsService } from '../products.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loan products data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class LoanProductsResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {ProductsService} productsService Products service.
|
||||||
|
*/
|
||||||
|
constructor(private productsService: ProductsService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the loan products data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<any> {
|
||||||
|
return this.productsService.getLoanProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import { extract } from '../core/i18n/i18n.service';
|
|||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { ProductsComponent } from './products.component';
|
import { ProductsComponent } from './products.component';
|
||||||
|
import { LoanProductsComponent } from './loan-products/loan-products.component';
|
||||||
import { ManageTaxConfigurationsComponent } from './manage-tax-configurations/manage-tax-configurations.component';
|
import { ManageTaxConfigurationsComponent } from './manage-tax-configurations/manage-tax-configurations.component';
|
||||||
import { RecurringDepositProductsComponent } from './recurring-deposit-products/recurring-deposit-products.component';
|
import { RecurringDepositProductsComponent } from './recurring-deposit-products/recurring-deposit-products.component';
|
||||||
import { ChargesComponent } from './charges/charges.component';
|
import { ChargesComponent } from './charges/charges.component';
|
||||||
@@ -18,6 +19,7 @@ import { ProductsMixComponent } from './products-mix/products-mix.component';
|
|||||||
import { ManageTaxComponentsComponent } from './manage-tax-components/manage-tax-components.component';
|
import { ManageTaxComponentsComponent } from './manage-tax-components/manage-tax-components.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
|
import { LoanProductsResolver } from './loan-products/loan-products.resolver';
|
||||||
import { RecurringDepositProductsResolver } from './recurring-deposit-products/recurring-deposit-products.resolver';
|
import { RecurringDepositProductsResolver } from './recurring-deposit-products/recurring-deposit-products.resolver';
|
||||||
import { ChargesResolver } from './charges/charges.resolver';
|
import { ChargesResolver } from './charges/charges.resolver';
|
||||||
import { FixedDepositProductsResolver } from './fixed-deposit-products/fixed-deposit-products.resolver';
|
import { FixedDepositProductsResolver } from './fixed-deposit-products/fixed-deposit-products.resolver';
|
||||||
@@ -35,6 +37,19 @@ const routes: Routes = [
|
|||||||
path: '',
|
path: '',
|
||||||
component: ProductsComponent
|
component: ProductsComponent
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'loan-products',
|
||||||
|
data: { title: extract('Loan Products'), breadcrumb: 'Loan Products' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: LoanProductsComponent,
|
||||||
|
resolve: {
|
||||||
|
loanProducts: LoanProductsResolver
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'tax-configurations',
|
path: 'tax-configurations',
|
||||||
data: { title: extract('Manage Tax Configurations'), breadcrumb: 'Manage Tax Configurations' },
|
data: { title: extract('Manage Tax Configurations'), breadcrumb: 'Manage Tax Configurations' },
|
||||||
@@ -99,6 +114,7 @@ const routes: Routes = [
|
|||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
providers: [
|
providers: [
|
||||||
|
LoanProductsResolver,
|
||||||
RecurringDepositProductsResolver,
|
RecurringDepositProductsResolver,
|
||||||
ChargesResolver,
|
ChargesResolver,
|
||||||
FixedDepositProductsResolver,
|
FixedDepositProductsResolver,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<mat-nav-list>
|
<mat-nav-list>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item [routerLink]="['loan-products']">
|
||||||
<mat-icon matListIcon>
|
<mat-icon matListIcon>
|
||||||
<fa-icon icon="briefcase" size="sm"></fa-icon>
|
<fa-icon icon="briefcase" size="sm"></fa-icon>
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
/** Custom Modules */
|
/** Custom Modules */
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { ProductsRoutingModule } from './products-routing.module';
|
import { ProductsRoutingModule } from './products-routing.module';
|
||||||
|
import { PipesModule } from 'app/pipes/pipes.module';
|
||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { ProductsComponent } from './products.component';
|
import { ProductsComponent } from './products.component';
|
||||||
|
import { LoanProductsComponent } from './loan-products/loan-products.component';
|
||||||
import { ManageTaxConfigurationsComponent } from './manage-tax-configurations/manage-tax-configurations.component';
|
import { ManageTaxConfigurationsComponent } from './manage-tax-configurations/manage-tax-configurations.component';
|
||||||
import { RecurringDepositProductsComponent } from './recurring-deposit-products/recurring-deposit-products.component';
|
import { RecurringDepositProductsComponent } from './recurring-deposit-products/recurring-deposit-products.component';
|
||||||
import { ChargesComponent } from './charges/charges.component';
|
import { ChargesComponent } from './charges/charges.component';
|
||||||
@@ -22,10 +25,12 @@ import { ManageTaxComponentsComponent } from './manage-tax-components/manage-tax
|
|||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
SharedModule,
|
SharedModule,
|
||||||
ProductsRoutingModule
|
ProductsRoutingModule,
|
||||||
|
PipesModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ProductsComponent,
|
ProductsComponent,
|
||||||
|
LoanProductsComponent,
|
||||||
ManageTaxConfigurationsComponent,
|
ManageTaxConfigurationsComponent,
|
||||||
RecurringDepositProductsComponent,
|
RecurringDepositProductsComponent,
|
||||||
ChargesComponent,
|
ChargesComponent,
|
||||||
@@ -34,6 +39,7 @@ import { ManageTaxComponentsComponent } from './manage-tax-components/manage-tax
|
|||||||
ManageTaxComponentsComponent
|
ManageTaxComponentsComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
]
|
],
|
||||||
|
providers: [DatePipe]
|
||||||
})
|
})
|
||||||
export class ProductsModule { }
|
export class ProductsModule { }
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ export class ProductsService {
|
|||||||
*/
|
*/
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Loan products data
|
||||||
|
*/
|
||||||
|
getLoanProducts(): Observable<any> {
|
||||||
|
return this.http.get('/loanproducts');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Observable<any>} Recurring deposit products data
|
* @returns {Observable<any>} Recurring deposit products data
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ $accent: $peter-river;
|
|||||||
|
|
||||||
//Status Colors Defined Here
|
//Status Colors Defined Here
|
||||||
$status-active: #00ce00;
|
$status-active: #00ce00;
|
||||||
|
$status-inactive: #666f73;
|
||||||
$status-deleted: #000000;
|
$status-deleted: #000000;
|
||||||
$status-pending: #ffa500;
|
$status-pending: #ffa500;
|
||||||
$status-approved: #0f36e4;
|
$status-approved: #0f36e4;
|
||||||
|
|||||||
@@ -1673,6 +1673,10 @@ textarea.noresize {
|
|||||||
color: $status-active;
|
color: $status-active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-inactive {
|
||||||
|
color: $status-inactive;
|
||||||
|
}
|
||||||
|
|
||||||
.status-deleted {
|
.status-deleted {
|
||||||
color: $status-deleted;
|
color: $status-deleted;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user