barker/bookie/src/app/sales/running-tables/running-tables.component.ts

36 lines
956 B
TypeScript
Raw Normal View History

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { Table } from '../../core/table';
@Component({
selector: 'app-running-tables',
templateUrl: './running-tables.component.html',
styleUrls: ['./running-tables.component.css']
})
export class RunningTablesComponent implements OnInit {
list: Table[];
constructor(private router: Router, private route: ActivatedRoute) {
}
ngOnInit() {
this.route.data
.subscribe((data: { list: Table[] }) => {
this.list = data.list;
});
}
navigateToBill(table: Table): void {
2019-07-13 16:02:18 +00:00
const qp = {table: table.id};
if (table.voucherId) {
2019-07-13 16:02:18 +00:00
qp['voucher'] = table.voucherId;
}
2019-07-13 16:02:18 +00:00
const navigationExtras: NavigationExtras = {
queryParams: qp,
queryParamsHandling: 'merge',
preserveFragment: true
};
this.router.navigate(['/sales', 'bill'], navigationExtras);
}
}