Big Chunk of updates on way to making the sales portion working

This commit is contained in:
Amritanshu
2019-07-06 13:46:18 +05:30
parent 87076d9c00
commit d69ab0063a
83 changed files with 1621 additions and 415 deletions

View File

@ -0,0 +1,18 @@
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";
@Injectable({
providedIn: 'root'
})
export class RunningTablesResolver implements Resolve<Table[]> {
constructor(private ser: TableService, private router: Router) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Table[]> {
return this.ser.list();
}
}

View File

@ -0,0 +1,5 @@
.square-button {
min-width: 150px;
max-width: 150px;
min-height: 150px;
}

View File

@ -0,0 +1,10 @@
<mat-card>
<mat-card-title-group>
<mat-card-title>Running Tables</mat-card-title>
</mat-card-title-group>
<mat-card-content fxLayout="row wrap" fxLayoutGap="grid 20px">
<button mat-raised-button class="square-button" [routerLink]="['/sales', 'menu-categories']">Menu Categories</button>
<button mat-raised-button class="square-button"
*ngFor="let table of list" [routerLink]="['/bills', 'new']" [queryParams]="{table: table.id}" queryParamsHandling="merge">{{table.name}}</button>
</mat-card-content>
</mat-card>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RunningTablesComponent } from './running-tables.component';
describe('RunningTablesComponent', () => {
let component: RunningTablesComponent;
let fixture: ComponentFixture<RunningTablesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RunningTablesComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RunningTablesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } 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 route: ActivatedRoute) {
}
ngOnInit() {
this.route.data
.subscribe((data: { list: Table[] }) => {
this.list = data.list;
});
}
}