feat: add codes component (#308)

* Add user interface
This commit is contained in:
Chirag Gupta
2018-10-10 20:37:36 +05:30
committed by Abhay Chawla
parent f56d7a7dc7
commit b517d015cc
7 changed files with 111 additions and 4 deletions
+34
View File
@@ -0,0 +1,34 @@
<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>&nbsp;&nbsp;
Add Code
</button>
</div>
<div class="container">
<div fxLayout="row">
<mat-form-field fxFlex>
<mat-label>Filter</mat-label>
<input matInput>
</mat-form-field>
</div>
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="codeName">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Code Name </th>
</ng-container>
<ng-container matColumnDef="systemDefined">
<th mat-header-cell *matHeaderCellDef mat-sort-header> System Defined </th>
</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 { CodesComponent } from './codes.component';
describe('CodesComponent', () => {
let component: CodesComponent;
let fixture: ComponentFixture<CodesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CodesComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CodesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
+28
View File
@@ -0,0 +1,28 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
@Component({
selector: 'mifosx-codes',
templateUrl: './codes.component.html',
styleUrls: ['./codes.component.scss']
})
export class CodesComponent implements OnInit {
/** Codes data. */
codesData: any;
/** Columns to be displayed in codes table. */
displayedColumns: string[] = ['codeName', 'systemDefined'];
/** Data source for codes table. */
dataSource: MatTableDataSource<any>;
/** Paginator for codes table. */
@ViewChild(MatPaginator) paginator: MatPaginator;
/** Sorter for codes table. */
@ViewChild(MatSort) sort: MatSort;
constructor() { }
ngOnInit() {
}
}
+17 -2
View File
@@ -1,15 +1,30 @@
import { NgModule } from '@angular/core';
/** Routing Imports */
import { Routes, RouterModule } from '@angular/router';
import { Route } from '../core/route/route.service';
import { extract } from '../core/i18n/i18n.service';
/** Component Imports */
import { SystemComponent } from './system.component';
import { CodesComponent } from './codes/codes.component';
const routes: Routes = [
Route.withShell([
{
path: 'system',
component: SystemComponent,
data: { title: extract('System'), breadcrumb: 'System' }
data: { title: extract('System'), breadcrumb: 'System' },
children: [
{
path: '',
component: SystemComponent
},
{
path: 'codes',
component: CodesComponent,
data: { title: extract('View Codes'), breadcrumb: 'Codes' }
}
]
}
])
];
+1 -1
View File
@@ -16,7 +16,7 @@
<p matLine>Add new extra fields to any entity in the form of data table</p>
</mat-list-item>
<mat-list-item>
<mat-list-item [routerLink]="['codes']">
<mat-icon matListIcon>
<fa-icon icon="list-ul" size="sm"></fa-icon>
</mat-icon>
+3 -1
View File
@@ -4,6 +4,7 @@ import { SharedModule } from '../shared/shared.module';
import { SystemComponent } from './system.component';
import { SystemRoutingModule } from './system-routing.module';
import { CodesComponent } from './codes/codes.component';
@NgModule({
imports: [
@@ -11,7 +12,8 @@ import { SystemRoutingModule } from './system-routing.module';
SharedModule
],
declarations: [
SystemComponent
SystemComponent,
CodesComponent
]
})
export class SystemModule { }