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