Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@ -1,18 +1,17 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {Table} from '../../core/table';
|
||||
import {TableService} from '../../tables/table.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { Table } from '../../core/table';
|
||||
import { TableService } from '../../tables/table.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RunningTablesResolver implements Resolve<Table[]> {
|
||||
constructor(private ser: TableService) {}
|
||||
|
||||
constructor(private ser: TableService, private router: Router) {
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Table[]> {
|
||||
resolve(): Observable<Table[]> {
|
||||
return this.ser.running();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,14 +4,20 @@
|
||||
</mat-card-title-group>
|
||||
<mat-card-content fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<mat-divider></mat-divider>
|
||||
<mat-card fxLayout="column" class="square-button" matRipple
|
||||
*ngFor="let table of list" (click)="navigateToBill(table)"
|
||||
[class.running]="table.status === 'running'" [class.printed]="table.status === 'printed'">
|
||||
<h3 class="item-name">{{table.name}}</h3>
|
||||
<mat-card-subtitle class="center">{{table.guest}}</mat-card-subtitle>
|
||||
<span class="center">{{table.pax || 0}} / {{table.seats}} Seats</span>
|
||||
<span class="center" *ngIf="table.date">{{table.date}}</span>
|
||||
<span class="center" *ngIf="table.amount">{{table.amount | currency:'INR'}}</span>
|
||||
<mat-card
|
||||
fxLayout="column"
|
||||
class="square-button"
|
||||
matRipple
|
||||
*ngFor="let table of list"
|
||||
(click)="navigateToBill(table)"
|
||||
[class.running]="table.status === 'running'"
|
||||
[class.printed]="table.status === 'printed'"
|
||||
>
|
||||
<h3 class="item-name">{{ table.name }}</h3>
|
||||
<mat-card-subtitle class="center">{{ table.guest }}</mat-card-subtitle>
|
||||
<span class="center">{{ table.pax || 0 }} / {{ table.seats }} Seats</span>
|
||||
<span class="center" *ngIf="table.date">{{ table.date }}</span>
|
||||
<span class="center" *ngIf="table.amount">{{ table.amount | currency: 'INR' }}</span>
|
||||
</mat-card>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
@ -8,9 +8,8 @@ describe('RunningTablesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RunningTablesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [RunningTablesComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@ -1,34 +1,33 @@
|
||||
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']
|
||||
styleUrls: ['./running-tables.component.css'],
|
||||
})
|
||||
export class RunningTablesComponent implements OnInit {
|
||||
list: Table[];
|
||||
|
||||
constructor(private router: Router, private route: ActivatedRoute) {
|
||||
}
|
||||
constructor(private router: Router, private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { list: Table[] }) => {
|
||||
this.list = data.list;
|
||||
});
|
||||
this.route.data.subscribe((data: { list: Table[] }) => {
|
||||
this.list = data.list;
|
||||
});
|
||||
}
|
||||
|
||||
navigateToBill(table: Table): void {
|
||||
const qp = {table: table.id};
|
||||
const qp = { table: table.id };
|
||||
if (table.voucherId) {
|
||||
qp['voucher'] = table.voucherId;
|
||||
qp.voucher = table.voucherId;
|
||||
}
|
||||
const navigationExtras: NavigationExtras = {
|
||||
queryParams: qp,
|
||||
queryParamsHandling: 'merge',
|
||||
preserveFragment: true
|
||||
preserveFragment: true,
|
||||
};
|
||||
this.router.navigate(['/sales', 'bill'], navigationExtras);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user