committed by
Abhay Chawla
parent
e19229eb84
commit
30aa205dd9
@@ -0,0 +1,33 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" class="container m-b-20">
|
||||
<button mat-raised-button color="primary">
|
||||
<fa-icon icon="plus"></fa-icon> Add
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div fxLayout="row" fxLayoutGap="20px">
|
||||
<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="productName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Product Name </th>
|
||||
<td mat-cell *matCellDef="let productMix"> {{ productMix.productName }} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
table {
|
||||
width: 100%;
|
||||
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProductsMixComponent } from './products-mix.component';
|
||||
|
||||
describe('ProductsMixComponent', () => {
|
||||
let component: ProductsMixComponent;
|
||||
let fixture: ComponentFixture<ProductsMixComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ProductsMixComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProductsMixComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { of } from 'rxjs';
|
||||
|
||||
/**
|
||||
* Products Mix component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-products-mix',
|
||||
templateUrl: './products-mix.component.html',
|
||||
styleUrls: ['./products-mix.component.scss']
|
||||
})
|
||||
export class ProductsMixComponent implements OnInit {
|
||||
|
||||
/** productMix data. */
|
||||
productMixData: any;
|
||||
/** Columns to be displayed in products mix table. */
|
||||
displayedColumns: string[] = ['productName'];
|
||||
/** Data source for products mix table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Paginator for manage data tables table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for manage data tables table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves the products data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { products: any }) => {
|
||||
this.productMixData = data.products;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in products mix table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the products mix table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.setProductsMix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for products mix table.
|
||||
*/
|
||||
setProductsMix() {
|
||||
this.dataSource = new MatTableDataSource(this.productMixData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/** 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';
|
||||
|
||||
/**
|
||||
* Products Mix data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class ProductsMixResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
* Returns the products mix data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getProductMixes();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,10 @@ import { FixedDepositProductsComponent } from './fixed-deposit-products/fixed-de
|
||||
import { RecurringDepositProductsResolver } from './recurring-deposit-products/recurring-deposit-products.resolver';
|
||||
import { ChargesResolver } from './charges/charges.resolver';
|
||||
import { FixedDepositProductsResolver } from './fixed-deposit-products/fixed-deposit-products.resolver';
|
||||
import { ProductsMixComponent } from './products-mix/products-mix.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { ProductsMixResolver } from './products-mix/products-mix.resolver';
|
||||
|
||||
/** Products Routes */
|
||||
const routes: Routes = [
|
||||
@@ -60,6 +64,14 @@ const routes: Routes = [
|
||||
},
|
||||
data: { title: extract('Fixed Deposit Products'), breadcrumb: 'Fixed Deposit Products' },
|
||||
},
|
||||
{
|
||||
path: 'products-mix',
|
||||
component: ProductsMixComponent,
|
||||
resolve: {
|
||||
products: ProductsMixResolver
|
||||
},
|
||||
data: { title: extract('Products Mix'), breadcrumb: 'Products Mix' },
|
||||
},
|
||||
]
|
||||
}
|
||||
])
|
||||
@@ -76,7 +88,8 @@ const routes: Routes = [
|
||||
providers: [
|
||||
RecurringDepositProductsResolver,
|
||||
ChargesResolver,
|
||||
FixedDepositProductsResolver
|
||||
FixedDepositProductsResolver,
|
||||
ProductsMixResolver,
|
||||
]
|
||||
})
|
||||
export class ProductsRoutingModule { }
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<mat-nav-list>
|
||||
|
||||
<mat-list-item>
|
||||
<mat-list-item [routerLink]="['products-mix']">
|
||||
<mat-icon matListIcon>
|
||||
<fa-icon icon="random" size="sm"></fa-icon>
|
||||
</mat-icon>
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ManageTaxConfigurationsComponent } from './manage-tax-configurations/ma
|
||||
import { RecurringDepositProductsComponent } from './recurring-deposit-products/recurring-deposit-products.component';
|
||||
import { ChargesComponent } from './charges/charges.component';
|
||||
import { FixedDepositProductsComponent } from './fixed-deposit-products/fixed-deposit-products.component';
|
||||
import { ProductsMixComponent } from './products-mix/products-mix.component';
|
||||
|
||||
/**
|
||||
* Products Module
|
||||
@@ -27,7 +28,8 @@ import { FixedDepositProductsComponent } from './fixed-deposit-products/fixed-de
|
||||
ManageTaxConfigurationsComponent,
|
||||
RecurringDepositProductsComponent,
|
||||
ChargesComponent,
|
||||
FixedDepositProductsComponent
|
||||
FixedDepositProductsComponent,
|
||||
ProductsMixComponent
|
||||
],
|
||||
entryComponents: [
|
||||
]
|
||||
|
||||
@@ -42,4 +42,14 @@ export class ProductsService {
|
||||
return this.http.get('/fixeddepositproducts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches Product mixes.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getProductMixes(): Observable<any> {
|
||||
let httpParams = new HttpParams();
|
||||
httpParams = httpParams.set('associations', 'productMixes');
|
||||
return this.http.get('/loanproducts', { params: httpParams });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user