Moved to Angular 6.0
---- Pending * Table width for the points column in incentive * Linting * keyboard navigation where it was used earlier * can remove the unused totals calculated serverside in productledger * spinner and loading bars * Activate Guard for Employee Function tabs * Progress for Fingerprint uploads * deleted reconcile and receipe features as they were not being used * focus the right control on component load
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {MatPaginator, MatSort} from '@angular/material';
|
||||
import {TrialBalanceDataSource} from './trial-balance-datasource';
|
||||
import {TrialBalance} from './trial-balance';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-trial-balance',
|
||||
templateUrl: './trial-balance.component.html',
|
||||
styleUrls: ['./trial-balance.component.css']
|
||||
})
|
||||
export class TrialBalanceComponent implements OnInit {
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
dataSource: TrialBalanceDataSource;
|
||||
form: FormGroup;
|
||||
info: TrialBalance;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['type', 'name', 'debit', 'credit'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: ''
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { info: TrialBalance }) => {
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate()
|
||||
});
|
||||
});
|
||||
this.dataSource = new TrialBalanceDataSource(this.paginator, this.sort, this.info.body);
|
||||
}
|
||||
|
||||
show() {
|
||||
const info = this.getInfo();
|
||||
this.router.navigate(['TrialBalance', info.date]);
|
||||
}
|
||||
|
||||
getInfo(): TrialBalance {
|
||||
const formModel = this.form.value;
|
||||
|
||||
return {
|
||||
date: moment(formModel.date).format('DD-MMM-YYYY')
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user