@@ -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 Tax Component
|
||||
</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 taxComponent"> {{ taxComponent.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="percentage">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Percentage </th>
|
||||
<td mat-cell *matCellDef="let taxComponent"> {{ taxComponent.percentage }} </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 { ManageTaxComponentsComponent } from './manage-tax-components.component';
|
||||
|
||||
describe('FixedDepositProductsComponent', () => {
|
||||
let component: ManageTaxComponentsComponent;
|
||||
let fixture: ComponentFixture<ManageTaxComponentsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageTaxComponentsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageTaxComponentsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
/** 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';
|
||||
|
||||
/**
|
||||
* Manage Tax Components component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-manage-tax-components',
|
||||
templateUrl: './manage-tax-components.component.html',
|
||||
styleUrls: ['./manage-tax-components.component.scss']
|
||||
})
|
||||
export class ManageTaxComponentsComponent implements OnInit {
|
||||
|
||||
/** Tax Components data. */
|
||||
taxComponentData: any;
|
||||
/** Columns to be displayed in tax component table. */
|
||||
displayedColumns: string[] = ['name', 'percentage'];
|
||||
/** Data source for tax component table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for tax component table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for tax component table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves the tax component data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { taxComponents: any }) => {
|
||||
this.taxComponentData = data.taxComponents;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in tax component table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tax component table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.setTaxComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for tax component table.
|
||||
*/
|
||||
setTaxComponents() {
|
||||
this.dataSource = new MatTableDataSource(this.taxComponentData);
|
||||
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';
|
||||
|
||||
/**
|
||||
* Manage Tax Component data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageTaxComponentsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
* Returns the tax components data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getTaxComponents();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<mat-nav-list>
|
||||
|
||||
<mat-list-item>
|
||||
<mat-list-item [routerLink]="['tax-components']">
|
||||
<mat-icon matListIcon>
|
||||
<fa-icon icon="building" size="sm"></fa-icon>
|
||||
</mat-icon>
|
||||
|
||||
@@ -15,12 +15,14 @@ import { RecurringDepositProductsComponent } from './recurring-deposit-products/
|
||||
import { ChargesComponent } from './charges/charges.component';
|
||||
import { FixedDepositProductsComponent } from './fixed-deposit-products/fixed-deposit-products.component';
|
||||
import { ProductsMixComponent } from './products-mix/products-mix.component';
|
||||
import { ManageTaxComponentsComponent } from './manage-tax-components/manage-tax-components.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
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 { ProductsMixResolver } from './products-mix/products-mix.resolver';
|
||||
import { ManageTaxComponentsResolver } from './manage-tax-components/manage-tax-components.resolver';
|
||||
|
||||
/** Products Routes */
|
||||
const routes: Routes = [
|
||||
@@ -35,8 +37,21 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'tax-configurations',
|
||||
component: ManageTaxConfigurationsComponent,
|
||||
data: { title: extract('Manage Tax Configurations'), breadcrumb: 'Manage Tax Configurations' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ManageTaxConfigurationsComponent,
|
||||
},
|
||||
{
|
||||
path: 'tax-components',
|
||||
component: ManageTaxComponentsComponent,
|
||||
resolve: {
|
||||
taxComponents: ManageTaxComponentsResolver
|
||||
},
|
||||
data: { title: extract('Manage Tax Components'), breadcrumb: 'Tax Components'},
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'recurring-deposit-products',
|
||||
@@ -88,6 +103,7 @@ const routes: Routes = [
|
||||
ChargesResolver,
|
||||
FixedDepositProductsResolver,
|
||||
ProductsMixResolver,
|
||||
ManageTaxComponentsResolver
|
||||
]
|
||||
})
|
||||
export class ProductsRoutingModule { }
|
||||
|
||||
@@ -12,6 +12,7 @@ import { RecurringDepositProductsComponent } from './recurring-deposit-products/
|
||||
import { ChargesComponent } from './charges/charges.component';
|
||||
import { FixedDepositProductsComponent } from './fixed-deposit-products/fixed-deposit-products.component';
|
||||
import { ProductsMixComponent } from './products-mix/products-mix.component';
|
||||
import { ManageTaxComponentsComponent } from './manage-tax-components/manage-tax-components.component';
|
||||
|
||||
/**
|
||||
* Products Module
|
||||
@@ -29,7 +30,8 @@ import { ProductsMixComponent } from './products-mix/products-mix.component';
|
||||
RecurringDepositProductsComponent,
|
||||
ChargesComponent,
|
||||
FixedDepositProductsComponent,
|
||||
ProductsMixComponent
|
||||
ProductsMixComponent,
|
||||
ManageTaxComponentsComponent
|
||||
],
|
||||
entryComponents: [
|
||||
]
|
||||
|
||||
@@ -39,6 +39,13 @@ export class ProductsService {
|
||||
return this.http.get('/fixeddepositproducts');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Tax Components data
|
||||
*/
|
||||
getTaxComponents(): Observable<any> {
|
||||
return this.http.get('/taxes/component');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Product mixes data
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user