Fix: Save/Update voucher - timedelta was days instead of minutes

Fix: Product list for sale was sending product_version_id instead of version_id this was borking on products with multiple versions
Change: Update Product Prices initially does not show list. Only the date and Menu Category List
This commit is contained in:
2020-11-13 09:34:49 +05:30
parent 9317150bde
commit 67cb1e3d80
10 changed files with 44 additions and 22 deletions

View File

@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { map } from 'rxjs/operators';
import { MenuCategory } from '../core/menu-category';
import { ToasterService } from '../core/toaster.service';
@ -37,12 +38,17 @@ export class UpdateProductPricesComponent implements OnInit {
}
ngOnInit() {
this.route.data.subscribe(
(data: { menuCategories: MenuCategory[]; info: UpdateProductPrices }) => {
this.route.data
.pipe(
map((data: { menuCategories: MenuCategory[]; info: UpdateProductPrices }) => {
data.menuCategories.unshift(new MenuCategory({ id: null, name: '-- All Categories --' }));
return data;
}),
)
.subscribe((data: { menuCategories: MenuCategory[]; info: UpdateProductPrices }) => {
this.menuCategories = data.menuCategories;
this.loadData(data.info);
},
);
});
}
loadData(info: UpdateProductPrices) {
@ -67,7 +73,7 @@ export class UpdateProductPricesComponent implements OnInit {
show() {
const info = this.getInfo();
const route = ['update-product-prices'];
if (info.menuCategoryId !== undefined) route.push(info.menuCategoryId);
if (info.menuCategoryId !== null) route.push(info.menuCategoryId);
this.router.navigate(route, {
queryParams: {
date: info.date,