Unverified Commit 65ead4c8 authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge pull request #1169 from ever-co/feat/#42-view-delivery-or-takeaway

feat: view product takeaway or delivery
parents e562d40d f8423c60
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ import { StoreProductPriceComponent } from '@app/@shared/render-component/store-
import { StoreProductAmountComponent } from '@app/@shared/render-component/store-products-table/store-product-amount/store-product-amount.component';
import { ProductCategoriesComponent } from '@app/@shared/render-component/product-categories/product-categories';
import { ProductTitleRedirectComponent } from '@app/@shared/render-component/product-title-redirect/product-title-redirect.component';
import { Observable, forkJoin, Subject } from 'rxjs';
import { Observable, forkJoin, Subject, Subscription } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from 'rxjs/operators';
import WarehouseProduct from '@modules/server.common/entities/WarehouseProduct';
@@ -52,6 +52,9 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
	settingsSmartTable: object;
	sourceSmartTable = new LocalDataSource();
	selectedProducts: WarehouseProductViewModel[] = [];
	columnTitlePrefix = 'WAREHOUSE_VIEW.PRODUCTS_TAB.';
	subscription: Subscription;
	suffix: string;

	private ngDestroy$ = new Subject<void>();
	private categoriesInfo: any = [];
@@ -75,6 +78,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
	ngOnDestroy(): void {
		this.ngDestroy$.next();
		this.ngDestroy$.complete();
		this.subscription.unsubscribe();
	}

	async loadDataSmartTable(products: WarehouseProduct[], storeId: string) {
@@ -108,6 +112,9 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
				},
				price: product.price,
				qty: product.count,
				type: product.isTakeaway
					? this._translate(`${this.columnTitlePrefix}TAKEAWAY`)
					: this._translate(`${this.columnTitlePrefix}DELIVERY`),
				storeId,
				product: product.product,
				allCategories: this.categoriesInfo,
@@ -130,9 +137,8 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
	}

	private _loadSettingsSmartTable() {
		const columnTitlePrefix = 'WAREHOUSE_VIEW.PRODUCTS_TAB.';
		const getTranslate = (name: string): Observable<any> =>
			this._translateService.get(columnTitlePrefix + name);
			this._translateService.get(this.columnTitlePrefix + name);

		forkJoin(
			this._translateService.get('Id'),
@@ -142,7 +148,8 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
			getTranslate('DETAILS'),
			getTranslate('CATEGORY'),
			getTranslate('PRICE'),
			getTranslate('QUANTITY')
			getTranslate('QUANTITY'),
			getTranslate('TYPE')
		)
			.pipe(takeUntil(this.ngDestroy$))
			.subscribe(
@@ -155,6 +162,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
					category,
					price,
					quantity,
					type,
				]) => {
					this.settingsSmartTable = {
						mode: 'external',
@@ -211,6 +219,9 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
								type: 'custom',
								renderComponent: StoreProductAmountComponent,
							},
							type: {
								title: type,
							},
						},
						pager: {
							display: true,
@@ -226,4 +237,13 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
			this._loadSettingsSmartTable();
		});
	}

	private _translate(key: string) {
		this.subscription = this._translateService
			.stream(key)
			.subscribe((res) => {
				this.suffix = res;
			});
		return this.suffix;
	}
}
+3 −0
Original line number Diff line number Diff line
@@ -561,6 +561,9 @@
			"CATEGORY": "категория",
			"PRICE": "Цена",
			"QUANTITY": "количество",
			"TYPE": "Тип",
			"DELIVERY": "Доставка",
			"TAKEAWAY": "За вкъщи",
			"CLICK_ON_PRODUCT_IMAGE_TO_INCREASE_AVAILABLE_QUANTITY": "Кликнете върху Изображение на продукта, за да увеличите наличното количество"
		},
		"NEW_PRODUCT_TYPE": "Нов тип продукт",
+14 −11
Original line number Diff line number Diff line
@@ -552,17 +552,20 @@
			}
		},
		"PRODUCTS_TAB": {
			"PRODUCTS": "Products",
			"ADD_PRODUCTS": "Add Products",
			"DELETE": "Delete",
			"IMAGE": "Image",
			"TITLE": "Title",
			"DESCRIPTION": "Description",
			"DETAILS": "Details",
			"CATEGORY": "Category",
			"PRICE": "Price",
			"QUANTITY": "Quantity",
			"CLICK_ON_PRODUCT_IMAGE_TO_INCREASE_AVAILABLE_QUANTITY": "Click on Product Image to increase available quantity"
			"PRODUCTS": "Продукти",
			"ADD_PRODUCTS": "Добавяне на продукти",
			"DELETE": "Изтрий",
			"IMAGE": "Изображение",
			"TITLE": "Заглавие",
			"DESCRIPTION": "описание",
			"DETAILS": "детайли",
			"CATEGORY": "категория",
			"PRICE": "Цена",
			"QUANTITY": "количество",
			"TYPE": "Тип",
			"DELIVERY": "Доставка",
			"TAKEAWAY": "За вкъщи",
			"CLICK_ON_PRODUCT_IMAGE_TO_INCREASE_AVAILABLE_QUANTITY": "Кликнете върху Изображение на продукта, за да увеличите наличното количество"
		},
		"NEW_PRODUCT_TYPE": "New Type Product",
		"ADD_PRODUCTS": "Add Products",
+3 −0
Original line number Diff line number Diff line
@@ -562,6 +562,9 @@
			"CATEGORY": "Category",
			"PRICE": "Price",
			"QUANTITY": "Quantity",
			"TYPE": "Type",
			"DELIVERY": "Delivery",
			"TAKEAWAY": "Takeaway",
			"CLICK_ON_PRODUCT_IMAGE_TO_INCREASE_AVAILABLE_QUANTITY": "Click on Product Image to increase available quantity"
		},
		"NEW_PRODUCT_TYPE": "New Type Product",
+3 −0
Original line number Diff line number Diff line
@@ -562,6 +562,9 @@
			"CATEGORY": "Category",
			"PRICE": "Price",
			"QUANTITY": "Quantity",
			"TYPE": "Type",
			"DELIVERY": "Delivery",
			"TAKEAWAY": "Takeaway",
			"CLICK_ON_PRODUCT_IMAGE_TO_INCREASE_AVAILABLE_QUANTITY": "Click on Product Image to increase available quantity"
		},
		"NEW_PRODUCT_TYPE": "New Type Product",
Loading