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:
tanshu committed 2018-06-09 17:05:11 +05:30
1 parent b3cb01da02
commit 6be1dd5a3a
1380 files changed
+23914 -18722

No files matched your search

@@ -0,0 +1,70 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {MatPaginator, MatSort} from '@angular/material';
import {ActivatedRoute, Router} from '@angular/router';
import * as moment from 'moment';
import {StockMovementDataSource} from './stock-movement-datasource';
import {StockMovement} from './stock-movement';
@Component({
selector: 'app-stock-movement',
templateUrl: './stock-movement.component.html',
styleUrls: ['./stock-movement.component.css']
})
export class StockMovementComponent implements OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
dataSource: StockMovementDataSource;
form: FormGroup;
info: StockMovement;
selectedRowId: string;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['group', 'name', 'opening', 'purchase', 'issue', 'closing'];
constructor(
private route: ActivatedRoute,
private router: Router,
private fb: FormBuilder
) {
this.createForm();
}
ngOnInit() {
this.route.data
.subscribe((data: { info: StockMovement }) => {
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate()
});
this.dataSource = new StockMovementDataSource(this.paginator, this.sort, this.info.body);
});
}
show() {
const l = this.prepareSubmit();
this.router.navigate(['StockMovement'], {
queryParams: {
startDate: l.startDate,
finishDate: l.finishDate
}
});
}
createForm() {
this.form = this.fb.group({
startDate: '',
finishDate: '',
});
}
prepareSubmit(): StockMovement {
const formModel = this.form.value;
return {
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
body: []
};
}
}