feat(products): add saving products component (#454)
Add saving products component to list all saving products. Fixes: #440
This commit is contained in:
@@ -14,6 +14,7 @@ import { LoanProductsComponent } from './loan-products/loan-products.component';
|
|||||||
import { CreateLoanProductComponent } from './loan-products/create-loan-product/create-loan-product.component';
|
import { CreateLoanProductComponent } from './loan-products/create-loan-product/create-loan-product.component';
|
||||||
import { ViewLoanProductComponent } from './loan-products/view-loan-product/view-loan-product.component';
|
import { ViewLoanProductComponent } from './loan-products/view-loan-product/view-loan-product.component';
|
||||||
import { EditLoanProductComponent } from './loan-products/edit-loan-product/edit-loan-product.component';
|
import { EditLoanProductComponent } from './loan-products/edit-loan-product/edit-loan-product.component';
|
||||||
|
import { SavingProductsComponent } from './saving-products/saving-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';
|
||||||
@@ -26,6 +27,7 @@ import { LoanProductsResolver } from './loan-products/loan-products.resolver';
|
|||||||
import { LoanProductsTemplateResolver } from './loan-products/loan-products-template.resolver';
|
import { LoanProductsTemplateResolver } from './loan-products/loan-products-template.resolver';
|
||||||
import { LoanProductResolver } from './loan-products/loan-product.resolver';
|
import { LoanProductResolver } from './loan-products/loan-product.resolver';
|
||||||
import { LoanProductAndTemplateResolver } from './loan-products/edit-loan-product/loan-product-and-template.resolver';
|
import { LoanProductAndTemplateResolver } from './loan-products/edit-loan-product/loan-product-and-template.resolver';
|
||||||
|
import { SavingProductsResolver } from './saving-products/saving-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';
|
||||||
@@ -85,6 +87,19 @@ const routes: Routes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'saving-products',
|
||||||
|
data: { title: extract('Saving Products'), breadcrumb: 'Saving Products' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: SavingProductsComponent,
|
||||||
|
resolve: {
|
||||||
|
savingProducts: SavingProductsResolver
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
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' },
|
||||||
@@ -153,6 +168,7 @@ const routes: Routes = [
|
|||||||
LoanProductsTemplateResolver,
|
LoanProductsTemplateResolver,
|
||||||
LoanProductResolver,
|
LoanProductResolver,
|
||||||
LoanProductAndTemplateResolver,
|
LoanProductAndTemplateResolver,
|
||||||
|
SavingProductsResolver,
|
||||||
RecurringDepositProductsResolver,
|
RecurringDepositProductsResolver,
|
||||||
ChargesResolver,
|
ChargesResolver,
|
||||||
FixedDepositProductsResolver,
|
FixedDepositProductsResolver,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<p matLine>Add new loan product or modify or inactivate loan product</p>
|
<p matLine>Add new loan product or modify or inactivate loan product</p>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item [routerLink]="['saving-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>
|
||||||
|
|||||||
@@ -26,6 +26,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';
|
||||||
import { ViewLoanProductComponent } from './loan-products/view-loan-product/view-loan-product.component';
|
import { ViewLoanProductComponent } from './loan-products/view-loan-product/view-loan-product.component';
|
||||||
import { EditLoanProductComponent } from './loan-products/edit-loan-product/edit-loan-product.component';
|
import { EditLoanProductComponent } from './loan-products/edit-loan-product/edit-loan-product.component';
|
||||||
|
import { SavingProductsComponent } from './saving-products/saving-products.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Products Module
|
* Products Module
|
||||||
@@ -56,7 +57,8 @@ import { EditLoanProductComponent } from './loan-products/edit-loan-product/edit
|
|||||||
ProductsMixComponent,
|
ProductsMixComponent,
|
||||||
ManageTaxComponentsComponent,
|
ManageTaxComponentsComponent,
|
||||||
ViewLoanProductComponent,
|
ViewLoanProductComponent,
|
||||||
EditLoanProductComponent
|
EditLoanProductComponent,
|
||||||
|
SavingProductsComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ export class ProductsService {
|
|||||||
return this.http.put(`/loanproducts/${loanProductId}`, loanProduct);
|
return this.http.put(`/loanproducts/${loanProductId}`, loanProduct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Saving products data
|
||||||
|
*/
|
||||||
|
getSavingProducts(): Observable<any> {
|
||||||
|
return this.http.get('/savingsproducts');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Observable<any>} Recurring deposit products data
|
* @returns {Observable<any>} Recurring deposit products data
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||||
|
<button mat-raised-button color="primary">
|
||||||
|
<fa-icon icon="plus"></fa-icon>
|
||||||
|
Create Saving 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 savingProduct"> {{ savingProduct.name }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="shortName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Short Name </th>
|
||||||
|
<td mat-cell *matCellDef="let savingProduct"> {{ savingProduct.shortName }} </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,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SavingProductsComponent } from './saving-products.component';
|
||||||
|
|
||||||
|
describe('SavingProductsComponent', () => {
|
||||||
|
let component: SavingProductsComponent;
|
||||||
|
let fixture: ComponentFixture<SavingProductsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ SavingProductsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(SavingProductsComponent);
|
||||||
|
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-saving-products',
|
||||||
|
templateUrl: './saving-products.component.html',
|
||||||
|
styleUrls: ['./saving-products.component.scss']
|
||||||
|
})
|
||||||
|
export class SavingProductsComponent implements OnInit {
|
||||||
|
|
||||||
|
savingProductsData: any;
|
||||||
|
displayedColumns: string[] = ['name', 'shortName'];
|
||||||
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe((data: { savingProducts: any }) => {
|
||||||
|
this.savingProductsData = data.savingProducts;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.savingProductsData);
|
||||||
|
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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saving products data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class SavingProductsResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {ProductsService} productsService Products service.
|
||||||
|
*/
|
||||||
|
constructor(private productsService: ProductsService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the saving products data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<any> {
|
||||||
|
return this.productsService.getSavingProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user