feat: add manage tax groups component
- Add manage tax groups component Fixes: #398
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<mat-nav-list>
|
<mat-nav-list>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item [routerLink]="['tax-groups']">
|
||||||
<mat-icon matListIcon>
|
<mat-icon matListIcon>
|
||||||
<fa-icon icon="building" size="sm"></fa-icon>
|
<fa-icon icon="building" size="sm"></fa-icon>
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<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 Groups
|
||||||
|
</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 taxGroups"> {{ taxGroups.name }} </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 { ManageTaxGroupsComponent } from './manage-tax-groups.component';
|
||||||
|
|
||||||
|
describe('ManageTaxGroupsComponent', () => {
|
||||||
|
let component: ManageTaxGroupsComponent;
|
||||||
|
let fixture: ComponentFixture<ManageTaxGroupsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ManageTaxGroupsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ManageTaxGroupsComponent);
|
||||||
|
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 Groups component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-manage-tax-groups',
|
||||||
|
templateUrl: './manage-tax-groups.component.html',
|
||||||
|
styleUrls: ['./manage-tax-groups.component.scss']
|
||||||
|
})
|
||||||
|
export class ManageTaxGroupsComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Tax Groups data. */
|
||||||
|
taxGroupsData: any;
|
||||||
|
/** Columns to be displayed in tax groups table. */
|
||||||
|
displayedColumns: string[] = ['name'];
|
||||||
|
/** Data source for tax groups table. */
|
||||||
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
/** Paginator for tax groups table. */
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
/** Sorter for tax groups table. */
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the tax groups data from `resolve`.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe(( data: { taxGroups: any }) => {
|
||||||
|
this.taxGroupsData = data.taxGroups;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters data in tax groups table based on passed value.
|
||||||
|
* @param {string} filterValue Value to filter data.
|
||||||
|
*/
|
||||||
|
applyFilter(filterValue: string) {
|
||||||
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the tax groups table.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.setTaxGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the data source, paginator and sorter for tax groups table.
|
||||||
|
*/
|
||||||
|
setTaxGroups() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.taxGroupsData);
|
||||||
|
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 Groups data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class ManageTaxGroupsResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ProductsService} productsService Products service.
|
||||||
|
*/
|
||||||
|
constructor(private productsService: ProductsService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tax groups data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<any> {
|
||||||
|
return this.productsService.getTaxGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ import { FixedDepositProductsComponent } from './fixed-deposit-products/fixed-de
|
|||||||
import { CreateFixedDepositProductComponent } from './fixed-deposit-products/create-fixed-deposit-product/create-fixed-deposit-product.component';
|
import { CreateFixedDepositProductComponent } from './fixed-deposit-products/create-fixed-deposit-product/create-fixed-deposit-product.component';
|
||||||
import { ProductsMixComponent } from './products-mix/products-mix.component';
|
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 { ManageTaxGroupsComponent } from './manage-tax-groups/manage-tax-groups.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
import { LoanProductsResolver } from './loan-products/loan-products.resolver';
|
import { LoanProductsResolver } from './loan-products/loan-products.resolver';
|
||||||
@@ -49,6 +50,7 @@ import { FixedDepositProductsResolver } from './fixed-deposit-products/fixed-dep
|
|||||||
import { FixedDepositProductsTemplateResolver } from './fixed-deposit-products/fixed-deposit-products-template.resolver';
|
import { FixedDepositProductsTemplateResolver } from './fixed-deposit-products/fixed-deposit-products-template.resolver';
|
||||||
import { ProductsMixResolver } from './products-mix/products-mix.resolver';
|
import { ProductsMixResolver } from './products-mix/products-mix.resolver';
|
||||||
import { ManageTaxComponentsResolver } from './manage-tax-components/manage-tax-components.resolver';
|
import { ManageTaxComponentsResolver } from './manage-tax-components/manage-tax-components.resolver';
|
||||||
|
import { ManageTaxGroupsResolver } from './manage-tax-groups/manage-tax-groups.resolver';
|
||||||
|
|
||||||
/** Products Routes */
|
/** Products Routes */
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -203,6 +205,14 @@ const routes: Routes = [
|
|||||||
},
|
},
|
||||||
data: { title: extract('Manage Tax Components'), breadcrumb: 'Tax Components'},
|
data: { title: extract('Manage Tax Components'), breadcrumb: 'Tax Components'},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'tax-groups',
|
||||||
|
component: ManageTaxGroupsComponent,
|
||||||
|
resolve: {
|
||||||
|
taxGroups: ManageTaxGroupsResolver
|
||||||
|
},
|
||||||
|
data: { title: extract('Manage Tax Groups'), breadcrumb: 'Tax Groups'},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -281,7 +291,8 @@ const routes: Routes = [
|
|||||||
FixedDepositProductsResolver,
|
FixedDepositProductsResolver,
|
||||||
FixedDepositProductsTemplateResolver,
|
FixedDepositProductsTemplateResolver,
|
||||||
ProductsMixResolver,
|
ProductsMixResolver,
|
||||||
ManageTaxComponentsResolver
|
ManageTaxComponentsResolver,
|
||||||
|
ManageTaxGroupsResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ProductsRoutingModule { }
|
export class ProductsRoutingModule { }
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import { FixedDepositProductChargesStepComponent } from './fixed-deposit-product
|
|||||||
import { FixedDepositProductAccountingStepComponent } from './fixed-deposit-products/fixed-deposit-product-stepper/fixed-deposit-product-accounting-step/fixed-deposit-product-accounting-step.component';
|
import { FixedDepositProductAccountingStepComponent } from './fixed-deposit-products/fixed-deposit-product-stepper/fixed-deposit-product-accounting-step/fixed-deposit-product-accounting-step.component';
|
||||||
import { FixedDepositProductPreviewStepComponent } from './fixed-deposit-products/fixed-deposit-product-stepper/fixed-deposit-product-preview-step/fixed-deposit-product-preview-step.component';
|
import { FixedDepositProductPreviewStepComponent } from './fixed-deposit-products/fixed-deposit-product-stepper/fixed-deposit-product-preview-step/fixed-deposit-product-preview-step.component';
|
||||||
import { DepositProductIncentiveFormDialogComponent } from './deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component';
|
import { DepositProductIncentiveFormDialogComponent } from './deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component';
|
||||||
|
import { ManageTaxGroupsComponent } from './manage-tax-groups/manage-tax-groups.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Products Module
|
* Products Module
|
||||||
@@ -122,7 +123,8 @@ import { DepositProductIncentiveFormDialogComponent } from './deposit-product-in
|
|||||||
FixedDepositProductChargesStepComponent,
|
FixedDepositProductChargesStepComponent,
|
||||||
FixedDepositProductAccountingStepComponent,
|
FixedDepositProductAccountingStepComponent,
|
||||||
FixedDepositProductPreviewStepComponent,
|
FixedDepositProductPreviewStepComponent,
|
||||||
DepositProductIncentiveFormDialogComponent
|
DepositProductIncentiveFormDialogComponent,
|
||||||
|
ManageTaxGroupsComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
DepositProductIncentiveFormDialogComponent
|
DepositProductIncentiveFormDialogComponent
|
||||||
|
|||||||
@@ -126,6 +126,13 @@ export class ProductsService {
|
|||||||
return this.http.get('/taxes/component');
|
return this.http.get('/taxes/component');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Tax Groups data
|
||||||
|
*/
|
||||||
|
getTaxGroups(): Observable<any> {
|
||||||
|
return this.http.get('/taxes/group');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Observable<any>} Product mixes data
|
* @returns {Observable<any>} Product mixes data
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user