Unverified Commit 59d2a524 authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge branch 'develop' into l10n_develop

parents 522a64b7 14a90b38
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -269,6 +269,7 @@ All other brand and product names are trademarks, registered trademarks or servi

#### Copyright © 2016-present, Ever Co. LTD. All rights reserved.

![visitors](https://visitor-badge.laobi.icu/badge?page_id=ever-co.ever-platform)
[![Circle CI](https://circleci.com/gh/ever-co/ever.svg?style=svg)](https://circleci.com/gh/ever-co/ever)
[![codecov](https://codecov.io/gh/ever-co/ever/branch/master/graph/badge.svg)](https://codecov.io/gh/ever-co/ever)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e7b2b38660f44963989ac9d49ae76d4d)](https://www.codacy.com/app/Ever/ever?utm_source=github.com&utm_medium=referral&utm_content=ever-co/ever&utm_campaign=Badge_Grade)
+1 −1
Original line number Diff line number Diff line
{
	"name": "@ever-platform/admin-web-angular",
	"version": "0.3.9",
	"version": "0.3.10",
	"description": "Ever Admin",
	"license": "AGPL-3.0",
	"homepage": "https://ever.co",
+6 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ export class GeoLocationService {
								isManufacturing
								isCarrierRequired
								isDeliveryRequired
								isProductAvailable
								deliveryTimeMin
								deliveryTimeMax
								product {
@@ -71,7 +72,11 @@ export class GeoLocationService {
				pollInterval: 2000,
			})
			.valueChanges.pipe(
				map((res) => res.data.geoLocationProducts),
				map((res) =>
					res.data.geoLocationProducts.filter(
						(p) => p.warehouseProduct.isProductAvailable === true
					)
				),
				share()
			);
	}
+62 −57
Original line number Diff line number Diff line
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { WarehouseProductsRouter } from '@modules/client.common.angular2/routers/warehouse-products-router.service';
import WarehouseProduct from '@modules/server.common/entities/WarehouseProduct';

@Component({
	styles: [
@@ -7,73 +9,76 @@ import { Component, Input } from '@angular/core';
				white-space: nowrap;
				padding-bottom: 4px;
			}

			div img {
				width: 40px;
				height: 40px;
			}

			.icon-closed {
				color: red;
				margin-right: 3px;
			}

			.icon-checked {
				color: green;
				margin-right: 3px;
			}
		`,
	],
	template: `
		<div
			*ngIf="
				rowData.type.isDeliveryRequired && !rowData.type.isTakeaway;
				else takeaway
			"
		>
		<div>
				<i class="ion-md-checkmark icon-checked"></i>
				{{ 'WAREHOUSE_VIEW.PRODUCTS_TAB.DELIVERY' | translate }}
			</div>
			<div>
				<i class="ion-md-close icon-closed"></i>
				{{ 'WAREHOUSE_VIEW.PRODUCTS_TAB.TAKEAWAY' | translate }}
			</div>
		</div>
		<ng-template #takeaway>
			<div
				*ngIf="
					!rowData.type.isDeliveryRequired && rowData.type.isTakeaway;
					else both
				"
				<nb-checkbox
					[(ngModel)]="isDelivery"
					(checkedChange)="isDeliveryChange($event)"
					>{{
						'WAREHOUSE_VIEW.PRODUCTS_TAB.DELIVERY' | translate
					}}</nb-checkbox
				>
				<div>
					<i class="ion-md-close icon-closed"></i>
					{{ 'WAREHOUSE_VIEW.PRODUCTS_TAB.DELIVERY' | translate }}
				</div>
				<div>
					<i class="ion-md-checkmark icon-checked"></i>
					{{ 'WAREHOUSE_VIEW.PRODUCTS_TAB.TAKEAWAY' | translate }}
				</div>
			</div>
			<ng-template #both>
			<div>
					<div>
						<i class="ion-md-checkmark icon-checked"></i>
						{{ 'WAREHOUSE_VIEW.PRODUCTS_TAB.DELIVERY' | translate }}
					</div>
					<div>
						<i class="ion-md-checkmark icon-checked"></i>
						{{ 'WAREHOUSE_VIEW.PRODUCTS_TAB.TAKEAWAY' | translate }}
				<nb-checkbox
					[(ngModel)]="isTakeaway"
					(checkedChange)="isTakeawayChange($event)"
					>{{
						'WAREHOUSE_VIEW.PRODUCTS_TAB.TAKEAWAY' | translate
					}}</nb-checkbox
				>
			</div>
		</div>
			</ng-template>
		</ng-template>
	`,
})
export class ProductTakeawayDeliveryComponent {
export class ProductTakeawayDeliveryComponent implements OnInit {
	@Input()
	rowData: any;
	isDelivery: boolean;
	isTakeaway: boolean;
	wareHouseId: string;
	productId: string;

	constructor(private warehouseProductRouter: WarehouseProductsRouter) {}

	ngOnInit() {
		this.isDelivery = this.rowData.isDeliveryRequired;
		this.isTakeaway = this.rowData.isTakeaway;
		this.wareHouseId = this.rowData.storeId;
		this.productId = this.rowData.product.id;
	}

	constructor() {}
	async isDeliveryChange() {
		this.isDelivery = !this.isDelivery;

		if (!this.isDelivery && !this.isTakeaway) {
			this.isDelivery = true;
			alert('Atleast one type should be selected!');
			return;
		}
		this.rowData.isDeliveryRequired = this.isDelivery;
		await this.warehouseProductRouter.changeProductDelivery(
			this.wareHouseId,
			this.productId,
			this.rowData.isDeliveryRequired
		);
	}

	async isTakeawayChange() {
		this.isTakeaway = !this.isTakeaway;
		if (!this.isDelivery && !this.isTakeaway) {
			this.isTakeaway = true;
			alert('Atleast one type should be selected!');
			return;
		}
		this.rowData.isTakeaway = this.isTakeaway;
		await this.warehouseProductRouter.changeProductTakeaway(
			this.wareHouseId,
			this.productId,
			this.rowData.isTakeaway
		);
	}
}
+2 −0
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
				product: product.product,
				allCategories: this.categoriesInfo,
				isProductAvailable: product.isProductAvailable,
				isTakeaway: product.isTakeaway,
				isDeliveryRequired: product.isDeliveryRequired,
			};
		});

Loading