Beer consumption report can choose menu category for beer
This commit is contained in:
@ -53,7 +53,7 @@ class Inventory:
|
|||||||
type_: Mapped[InventoryType] = mapped_column(
|
type_: Mapped[InventoryType] = mapped_column(
|
||||||
"type", Enum(InventoryType), server_default=text("regular"), nullable=False
|
"type", Enum(InventoryType), server_default=text("regular"), nullable=False
|
||||||
)
|
)
|
||||||
parent_id: Mapped[uuid.UUID | None] = mapped_column(Uuid, ForeignKey("inventories.id"), nullable=True)
|
parent_id: Mapped[uuid.UUID | None] = mapped_column(Uuid, ForeignKey("inventories.id"), nullable=True, index=True)
|
||||||
|
|
||||||
kot: Mapped[Kot] = relationship(back_populates="inventories")
|
kot: Mapped[Kot] = relationship(back_populates="inventories")
|
||||||
tax: Mapped[Tax] = relationship(back_populates="inventories")
|
tax: Mapped[Tax] = relationship(back_populates="inventories")
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class InventoryModifier:
|
|||||||
__table_args__ = (UniqueConstraint("inventory_id", "modifier_id"),)
|
__table_args__ = (UniqueConstraint("inventory_id", "modifier_id"),)
|
||||||
|
|
||||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, server_default=text("gen_random_uuid()"))
|
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, server_default=text("gen_random_uuid()"))
|
||||||
inventory_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("inventories.id"), nullable=False)
|
inventory_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("inventories.id"), nullable=False, index=True)
|
||||||
modifier_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("modifiers.id"), nullable=False)
|
modifier_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("modifiers.id"), nullable=False)
|
||||||
price: Mapped[Decimal] = mapped_column(Numeric(precision=15, scale=2), nullable=False)
|
price: Mapped[Decimal] = mapped_column(Numeric(precision=15, scale=2), nullable=False)
|
||||||
|
|
||||||
|
|||||||
@ -24,5 +24,5 @@ class RoleInclude:
|
|||||||
|
|
||||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, server_default=text("gen_random_uuid()"))
|
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, server_default=text("gen_random_uuid()"))
|
||||||
|
|
||||||
role_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("roles.id"), nullable=False)
|
role_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("roles.id"), nullable=False, index=True)
|
||||||
included_role_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("roles.id"), nullable=False)
|
included_role_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("roles.id"), nullable=False, index=True)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ from ..schemas.sale_category import SaleCategoryLink
|
|||||||
from ..schemas.stock_keeping_unit import StockKeepingUnit as StockKeepingUnitSchema
|
from ..schemas.stock_keeping_unit import StockKeepingUnit as StockKeepingUnitSchema
|
||||||
from ..schemas.tax import TaxLink
|
from ..schemas.tax import TaxLink
|
||||||
from ..schemas.user_token import UserToken
|
from ..schemas.user_token import UserToken
|
||||||
from . import _pv_onclause, _sv_onclause, effective_date
|
from . import _pv_active, _pv_onclause, _sv_onclause, effective_date
|
||||||
|
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
@ -241,7 +241,6 @@ def update_route(
|
|||||||
or new_data_sku.has_happy_hour != sku.has_happy_hour
|
or new_data_sku.has_happy_hour != sku.has_happy_hour
|
||||||
or new_data_sku.menu_category.id_ != sku.menu_category_id
|
or new_data_sku.menu_category.id_ != sku.menu_category_id
|
||||||
)
|
)
|
||||||
print(f"SKU Changed: {sku_changed} for {sku.id}")
|
|
||||||
sku.sku.sort_order = new_data_sku.sort_order
|
sku.sku.sort_order = new_data_sku.sort_order
|
||||||
sku.sku.is_not_available = new_data_sku.is_not_available
|
sku.sku.is_not_available = new_data_sku.is_not_available
|
||||||
if sku_changed:
|
if sku_changed:
|
||||||
@ -471,7 +470,6 @@ def show_term(
|
|||||||
) -> list[ProductQuery]:
|
) -> list[ProductQuery]:
|
||||||
product_version_onclause = _pv_onclause(date_)
|
product_version_onclause = _pv_onclause(date_)
|
||||||
sku_version_onclause = _sv_onclause(date_)
|
sku_version_onclause = _sv_onclause(date_)
|
||||||
print(f"Fetching products for MenuCategory: {mc}, SaleCategory: {sc}, Date: {date_}")
|
|
||||||
list_: list[ProductQuery] = []
|
list_: list[ProductQuery] = []
|
||||||
query = (
|
query = (
|
||||||
select(SkuVersion)
|
select(SkuVersion)
|
||||||
@ -525,17 +523,6 @@ def show_id(
|
|||||||
date_: date = Depends(effective_date),
|
date_: date = Depends(effective_date),
|
||||||
user: UserToken = Security(get_user, scopes=["products"]),
|
user: UserToken = Security(get_user, scopes=["products"]),
|
||||||
) -> schemas.Product:
|
) -> schemas.Product:
|
||||||
pv_active = and_(
|
|
||||||
ProductVersion.product_id == id_,
|
|
||||||
or_(ProductVersion.valid_from == None, ProductVersion.valid_from <= date_), # noqa: E711
|
|
||||||
or_(ProductVersion.valid_till == None, ProductVersion.valid_till >= date_), # noqa: E711
|
|
||||||
)
|
|
||||||
|
|
||||||
sku_version_onclause = and_(
|
|
||||||
SkuVersion.sku_id == StockKeepingUnit.id,
|
|
||||||
or_(SkuVersion.valid_from == None, SkuVersion.valid_from <= date_), # noqa: E711
|
|
||||||
or_(SkuVersion.valid_till == None, SkuVersion.valid_till >= date_), # noqa: E711
|
|
||||||
)
|
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
version: ProductVersion = (
|
version: ProductVersion = (
|
||||||
db.execute(
|
db.execute(
|
||||||
@ -543,9 +530,9 @@ def show_id(
|
|||||||
.join(ProductVersion.sale_category)
|
.join(ProductVersion.sale_category)
|
||||||
.join(ProductVersion.product)
|
.join(ProductVersion.product)
|
||||||
.join(Product.skus)
|
.join(Product.skus)
|
||||||
.join(SkuVersion, onclause=sku_version_onclause)
|
.join(SkuVersion, onclause=_sv_onclause(date_))
|
||||||
.join(SkuVersion.menu_category)
|
.join(SkuVersion.menu_category)
|
||||||
.where(pv_active)
|
.where(ProductVersion.product_id == id_, _pv_active(date_))
|
||||||
.order_by(
|
.order_by(
|
||||||
StockKeepingUnit.sort_order,
|
StockKeepingUnit.sort_order,
|
||||||
SkuVersion.units,
|
SkuVersion.units,
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import uuid
|
||||||
|
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Security
|
from fastapi import APIRouter, Depends, Security
|
||||||
@ -16,6 +18,7 @@ from ...models.stock_keeping_unit import StockKeepingUnit
|
|||||||
from ...models.voucher import Voucher
|
from ...models.voucher import Voucher
|
||||||
from ...models.voucher_type import VoucherType
|
from ...models.voucher_type import VoucherType
|
||||||
from ...schemas.beer_consumption_report import BeerConsumptionReport, BeerConsumptionReportItem
|
from ...schemas.beer_consumption_report import BeerConsumptionReport, BeerConsumptionReportItem
|
||||||
|
from ...schemas.menu_category import MenuCategoryLink
|
||||||
from ...schemas.user_token import UserToken
|
from ...schemas.user_token import UserToken
|
||||||
from .. import _pv_onclause, _sv_onclause
|
from .. import _pv_onclause, _sv_onclause
|
||||||
from . import check_audit_permission, report_finish_date, report_start_date
|
from . import check_audit_permission, report_finish_date, report_start_date
|
||||||
@ -28,6 +31,7 @@ router = APIRouter()
|
|||||||
def beer_consumption(
|
def beer_consumption(
|
||||||
start_date: date = Depends(report_start_date),
|
start_date: date = Depends(report_start_date),
|
||||||
finish_date: date = Depends(report_finish_date),
|
finish_date: date = Depends(report_finish_date),
|
||||||
|
m: uuid.UUID | None = None, # Menu Category
|
||||||
r: bool | None = True,
|
r: bool | None = True,
|
||||||
h: bool | None = True,
|
h: bool | None = True,
|
||||||
st: bool | None = True,
|
st: bool | None = True,
|
||||||
@ -47,6 +51,7 @@ def beer_consumption(
|
|||||||
.join(Kot.inventories)
|
.join(Kot.inventories)
|
||||||
.join(Inventory.sku)
|
.join(Inventory.sku)
|
||||||
.join(SkuVersion, onclause=sku_version_onclause)
|
.join(SkuVersion, onclause=sku_version_onclause)
|
||||||
|
.join(SkuVersion.menu_category)
|
||||||
.join(StockKeepingUnit.product)
|
.join(StockKeepingUnit.product)
|
||||||
.join(ProductVersion, onclause=product_version_onclause)
|
.join(ProductVersion, onclause=product_version_onclause)
|
||||||
.where(
|
.where(
|
||||||
@ -55,6 +60,8 @@ def beer_consumption(
|
|||||||
day <= finish_date,
|
day <= finish_date,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if m:
|
||||||
|
query = query.where(SkuVersion.menu_category_id == m)
|
||||||
if h is False and r is not False:
|
if h is False and r is not False:
|
||||||
query = query.where(Inventory.is_happy_hour == h)
|
query = query.where(Inventory.is_happy_hour == h)
|
||||||
if r is False and h is not False:
|
if r is False and h is not False:
|
||||||
@ -89,6 +96,7 @@ def beer_consumption(
|
|||||||
return BeerConsumptionReport(
|
return BeerConsumptionReport(
|
||||||
start_date=start_date,
|
start_date=start_date,
|
||||||
finish_date=finish_date,
|
finish_date=finish_date,
|
||||||
|
menu_category=MenuCategoryLink(id_=m, name="", skus=[]) if m else None,
|
||||||
regular=r,
|
regular=r,
|
||||||
happy=h,
|
happy=h,
|
||||||
staff=st,
|
staff=st,
|
||||||
|
|||||||
@ -13,6 +13,7 @@ from pydantic import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from . import Daf, to_camel
|
from . import Daf, to_camel
|
||||||
|
from .menu_category import MenuCategoryLink
|
||||||
|
|
||||||
|
|
||||||
class BeerConsumptionReportItem(BaseModel):
|
class BeerConsumptionReportItem(BaseModel):
|
||||||
@ -56,6 +57,7 @@ class BeerConsumptionReportItem(BaseModel):
|
|||||||
class BeerConsumptionReport(BaseModel):
|
class BeerConsumptionReport(BaseModel):
|
||||||
start_date: date
|
start_date: date
|
||||||
finish_date: date
|
finish_date: date
|
||||||
|
menu_category: MenuCategoryLink | None
|
||||||
regular: bool | None
|
regular: bool | None
|
||||||
happy: bool | None
|
happy: bool | None
|
||||||
staff: bool | None
|
staff: bool | None
|
||||||
|
|||||||
@ -31,6 +31,16 @@
|
|||||||
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #finishDate></mat-datepicker>
|
<mat-datepicker #finishDate></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field class="flex-auto">
|
||||||
|
<mat-label>Menu Category</mat-label>
|
||||||
|
<mat-select formControlName="menuCategory" (selectionChange)="filterOn($event.value)">
|
||||||
|
@for (mc of menuCategories; track mc) {
|
||||||
|
<mat-option [value]="mc.id">
|
||||||
|
{{ mc.name }}
|
||||||
|
</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
<button mat-raised-button class="flex-auto basis-1-5" color="primary" (click)="show()">Show</button>
|
<button mat-raised-button class="flex-auto basis-1-5" color="primary" (click)="show()">Show</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-container sm:max-lg:flex-col">
|
<div class="row-container sm:max-lg:flex-col">
|
||||||
@ -51,7 +61,7 @@
|
|||||||
@for (col of info.headers; track col) {
|
@for (col of info.headers; track col) {
|
||||||
<ng-container matColumnDef="{{ col }}">
|
<ng-container matColumnDef="{{ col }}">
|
||||||
<mat-header-cell *matHeaderCellDef class="right">{{ col }}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef class="right">{{ col }}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row" class="right">{{ row[col] }}</mat-cell>
|
<mat-cell *matCellDef="let row" class="right">{{ row[col] | number: '1.2-2' }}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { CommonModule } from '@angular/common';
|
||||||
import { Component, OnInit, inject } from '@angular/core';
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
@ -6,10 +7,12 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
import { MatTableModule } from '@angular/material/table';
|
import { MatTableModule } from '@angular/material/table';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
|
import { MenuCategory } from '../core/menu-category';
|
||||||
import { ToCsvService } from '../shared/to-csv.service';
|
import { ToCsvService } from '../shared/to-csv.service';
|
||||||
import { BeerSaleExportHeaderInterface } from './beer-sale-export-header-interface';
|
import { BeerSaleExportHeaderInterface } from './beer-sale-export-header-interface';
|
||||||
import { BeerSaleReport } from './beer-sale-report';
|
import { BeerSaleReport } from './beer-sale-report';
|
||||||
@ -20,13 +23,14 @@ import { BeerSaleReportDataSource } from './beer-sale-report-datasource';
|
|||||||
templateUrl: './beer-sale-report.component.html',
|
templateUrl: './beer-sale-report.component.html',
|
||||||
styleUrls: ['./beer-sale-report.component.css'],
|
styleUrls: ['./beer-sale-report.component.css'],
|
||||||
imports: [
|
imports: [
|
||||||
|
CommonModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
|
|
||||||
MatCheckboxModule,
|
MatCheckboxModule,
|
||||||
MatDatepickerModule,
|
MatDatepickerModule,
|
||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
|
MatSelectModule,
|
||||||
MatTableModule,
|
MatTableModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
],
|
],
|
||||||
@ -36,11 +40,13 @@ export class BeerSaleReportComponent implements OnInit {
|
|||||||
private router = inject(Router);
|
private router = inject(Router);
|
||||||
private toCsv = inject(ToCsvService);
|
private toCsv = inject(ToCsvService);
|
||||||
|
|
||||||
|
menuCategories: MenuCategory[] = [];
|
||||||
info: BeerSaleReport = new BeerSaleReport();
|
info: BeerSaleReport = new BeerSaleReport();
|
||||||
dataSource: BeerSaleReportDataSource = new BeerSaleReportDataSource(this.info.data);
|
dataSource: BeerSaleReportDataSource = new BeerSaleReportDataSource(this.info.data);
|
||||||
form: FormGroup<{
|
form: FormGroup<{
|
||||||
startDate: FormControl<Date>;
|
startDate: FormControl<Date>;
|
||||||
finishDate: FormControl<Date>;
|
finishDate: FormControl<Date>;
|
||||||
|
menuCategory: FormControl<string>;
|
||||||
regular: FormControl<boolean>;
|
regular: FormControl<boolean>;
|
||||||
happy: FormControl<boolean>;
|
happy: FormControl<boolean>;
|
||||||
staff: FormControl<boolean>;
|
staff: FormControl<boolean>;
|
||||||
@ -55,6 +61,7 @@ export class BeerSaleReportComponent implements OnInit {
|
|||||||
this.form = new FormGroup({
|
this.form = new FormGroup({
|
||||||
startDate: new FormControl(new Date(), { nonNullable: true }),
|
startDate: new FormControl(new Date(), { nonNullable: true }),
|
||||||
finishDate: new FormControl(new Date(), { nonNullable: true }),
|
finishDate: new FormControl(new Date(), { nonNullable: true }),
|
||||||
|
menuCategory: new FormControl('', { nonNullable: true }),
|
||||||
regular: new FormControl<boolean>(true, { nonNullable: true }),
|
regular: new FormControl<boolean>(true, { nonNullable: true }),
|
||||||
happy: new FormControl<boolean>(true, { nonNullable: true }),
|
happy: new FormControl<boolean>(true, { nonNullable: true }),
|
||||||
staff: new FormControl<boolean>(true, { nonNullable: true }),
|
staff: new FormControl<boolean>(true, { nonNullable: true }),
|
||||||
@ -64,12 +71,14 @@ export class BeerSaleReportComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.data.subscribe((value) => {
|
this.route.data.subscribe((value) => {
|
||||||
const data = value as { info: BeerSaleReport };
|
const data = value as { info: BeerSaleReport; menuCategories: MenuCategory[] };
|
||||||
this.info = data.info;
|
this.info = data.info;
|
||||||
|
this.menuCategories = data.menuCategories;
|
||||||
this.displayedColumns = ['date'].concat(this.info.headers);
|
this.displayedColumns = ['date'].concat(this.info.headers);
|
||||||
this.form.setValue({
|
this.form.setValue({
|
||||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||||
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||||
|
menuCategory: this.info.menuCategory?.id ?? '',
|
||||||
regular: this.info.regular,
|
regular: this.info.regular,
|
||||||
happy: this.info.happy,
|
happy: this.info.happy,
|
||||||
staff: this.info.staff,
|
staff: this.info.staff,
|
||||||
@ -85,6 +94,7 @@ export class BeerSaleReportComponent implements OnInit {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
startDate: info.startDate,
|
startDate: info.startDate,
|
||||||
finishDate: info.finishDate,
|
finishDate: info.finishDate,
|
||||||
|
menuCategory: info.menuCategory?.id ?? '',
|
||||||
regular: info.regular,
|
regular: info.regular,
|
||||||
happy: info.happy,
|
happy: info.happy,
|
||||||
staff: info.staff,
|
staff: info.staff,
|
||||||
@ -93,12 +103,18 @@ export class BeerSaleReportComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterOn(id: string) {
|
||||||
|
const mc = this.menuCategories.find((x) => x.id === id);
|
||||||
|
this.info.menuCategory = mc ? mc : new MenuCategory({ id });
|
||||||
|
}
|
||||||
|
|
||||||
getInfo(): BeerSaleReport {
|
getInfo(): BeerSaleReport {
|
||||||
const formModel = this.form.value;
|
const formModel = this.form.value;
|
||||||
|
|
||||||
return new BeerSaleReport({
|
return new BeerSaleReport({
|
||||||
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
||||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||||
|
menuCategory: this.info.menuCategory,
|
||||||
regular: formModel.regular,
|
regular: formModel.regular,
|
||||||
happy: formModel.happy,
|
happy: formModel.happy,
|
||||||
staff: formModel.staff,
|
staff: formModel.staff,
|
||||||
|
|||||||
@ -7,9 +7,10 @@ import { BeerSaleReportService } from './beer-sale-report.service';
|
|||||||
export const beerSaleReportResolver: ResolveFn<BeerSaleReport> = (route) => {
|
export const beerSaleReportResolver: ResolveFn<BeerSaleReport> = (route) => {
|
||||||
const startDate = route.queryParamMap.get('startDate') ?? null;
|
const startDate = route.queryParamMap.get('startDate') ?? null;
|
||||||
const finishDate = route.queryParamMap.get('finishDate') ?? null;
|
const finishDate = route.queryParamMap.get('finishDate') ?? null;
|
||||||
|
const menuCategory = route.queryParamMap.get('menuCategory') ?? null;
|
||||||
const regular = route.queryParamMap.get('regular') !== 'false';
|
const regular = route.queryParamMap.get('regular') !== 'false';
|
||||||
const happy = route.queryParamMap.get('happy') !== 'false';
|
const happy = route.queryParamMap.get('happy') !== 'false';
|
||||||
const staff = route.queryParamMap.get('staff') !== 'false';
|
const staff = route.queryParamMap.get('staff') !== 'false';
|
||||||
const nc = route.queryParamMap.get('nc') !== 'false';
|
const nc = route.queryParamMap.get('nc') !== 'false';
|
||||||
return inject(BeerSaleReportService).get(startDate, finishDate, regular, happy, staff, nc);
|
return inject(BeerSaleReportService).get(startDate, finishDate, menuCategory, regular, happy, staff, nc);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
import { authGuard } from '../auth/auth-guard.service';
|
import { authGuard } from '../auth/auth-guard.service';
|
||||||
|
import { menuCategoryListResolver } from '../menu-category/menu-category-list.resolver';
|
||||||
import { BeerSaleReportComponent } from './beer-sale-report.component';
|
import { BeerSaleReportComponent } from './beer-sale-report.component';
|
||||||
import { beerSaleReportResolver } from './beer-sale-report.resolver';
|
import { beerSaleReportResolver } from './beer-sale-report.resolver';
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ export const routes: Routes = [
|
|||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
info: beerSaleReportResolver,
|
info: beerSaleReportResolver,
|
||||||
|
menuCategories: menuCategoryListResolver,
|
||||||
},
|
},
|
||||||
runGuardsAndResolvers: 'always',
|
runGuardsAndResolvers: 'always',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -19,6 +19,7 @@ export class BeerSaleReportService {
|
|||||||
get(
|
get(
|
||||||
startDate: string | null,
|
startDate: string | null,
|
||||||
finishDate: string | null,
|
finishDate: string | null,
|
||||||
|
menuCategory: string | null,
|
||||||
regular: boolean,
|
regular: boolean,
|
||||||
happy: boolean,
|
happy: boolean,
|
||||||
staff: boolean,
|
staff: boolean,
|
||||||
@ -31,6 +32,9 @@ export class BeerSaleReportService {
|
|||||||
if (finishDate !== null) {
|
if (finishDate !== null) {
|
||||||
options.params = options.params.set('f', finishDate);
|
options.params = options.params.set('f', finishDate);
|
||||||
}
|
}
|
||||||
|
if (menuCategory != null) {
|
||||||
|
options.params = options.params.set('m', menuCategory);
|
||||||
|
}
|
||||||
options.params = options.params.set('r', regular);
|
options.params = options.params.set('r', regular);
|
||||||
options.params = options.params.set('h', happy);
|
options.params = options.params.set('h', happy);
|
||||||
options.params = options.params.set('st', staff);
|
options.params = options.params.set('st', staff);
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
|
import { MenuCategory } from '../core/menu-category';
|
||||||
import { BeerSaleReportItem } from './beer-sale-report-item';
|
import { BeerSaleReportItem } from './beer-sale-report-item';
|
||||||
|
|
||||||
export class BeerSaleReport {
|
export class BeerSaleReport {
|
||||||
startDate: string;
|
startDate: string;
|
||||||
finishDate: string;
|
finishDate: string;
|
||||||
|
menuCategory: MenuCategory;
|
||||||
regular: boolean;
|
regular: boolean;
|
||||||
happy: boolean;
|
happy: boolean;
|
||||||
staff: boolean;
|
staff: boolean;
|
||||||
@ -13,6 +15,7 @@ export class BeerSaleReport {
|
|||||||
public constructor(init?: Partial<BeerSaleReport>) {
|
public constructor(init?: Partial<BeerSaleReport>) {
|
||||||
this.startDate = '';
|
this.startDate = '';
|
||||||
this.finishDate = '';
|
this.finishDate = '';
|
||||||
|
this.menuCategory = new MenuCategory();
|
||||||
this.regular = true;
|
this.regular = true;
|
||||||
this.happy = true;
|
this.happy = true;
|
||||||
this.staff = true;
|
this.staff = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user