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

Merge branch 'develop' into feat/#21-is-product-available

parents 0dcb1513 edff55a3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ export class AddWarehouseProductsComponent implements OnInit, OnDestroy {
			};
			if (!resObj.takeProductDelivery && !resObj.takeProductTakeaway) {
				resObj.takeProductDelivery = true;
				resObj.takeProductTakeaway = true;
			}

			return resObj;
+25 −5
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';
@@ -55,6 +55,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 = [];
@@ -78,6 +81,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
	ngOnDestroy(): void {
		this.ngDestroy$.next();
		this.ngDestroy$.complete();
		this.subscription.unsubscribe();
	}

	async loadDataSmartTable(products: WarehouseProduct[], storeId: string) {
@@ -111,6 +115,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,
@@ -134,9 +141,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'),
@@ -147,7 +153,8 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
			getTranslate('CATEGORY'),
			getTranslate('PRICE'),
			getTranslate('QUANTITY'),
			getTranslate('AVAILABILITY')
			getTranslate('AVAILABILITY'),
			getTranslate('TYPE')
		)
			.pipe(takeUntil(this.ngDestroy$))
			.subscribe(
@@ -161,6 +168,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
					price,
					quantity,
					availability,
					type
				]) => {
					this.settingsSmartTable = {
						mode: 'external',
@@ -220,7 +228,10 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
							isAvailable: {
								title: availability,
								type: 'custom',
								renderComponent: IsAvailableCheckBox,
								renderComponent: IsAvailableCheckBox
              },
							type: {
								title: type,
							},
						},
						pager: {
@@ -237,4 +248,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;
	}
}
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ export type WarehouseBasicInfo = Pick<
	| 'carriersIds'
	| 'useOnlyRestrictedCarriersForDelivery'
	| 'preferRestrictedCarriersForDelivery'
	| 'ordersShortProcess'
>;

@Component({
@@ -84,6 +85,7 @@ export class BasicInfoFormComponent implements OnInit {
			hasRestrictedCarriers: [false, [Validators.required]],
			useOnlyRestrictedCarriersForDelivery: [false],
			preferRestrictedCarriersForDelivery: [false],
			ordersShortProcess: [false],
			carriersIds: [[]],
		});
	}
@@ -103,6 +105,7 @@ export class BasicInfoFormComponent implements OnInit {
			carriersIds: string[];
			useOnlyRestrictedCarriersForDelivery: boolean;
			preferRestrictedCarriersForDelivery: boolean;
			ordersShortProcess: boolean;
		};

		if (!basicInfo.logo) {
@@ -134,6 +137,7 @@ export class BasicInfoFormComponent implements OnInit {
						useOnlyRestrictedCarriersForDelivery: false,
						preferRestrictedCarriersForDelivery: false,
				  }),
			ordersShortProcess: basicInfo.ordersShortProcess,
		};
	}

@@ -144,6 +148,7 @@ export class BasicInfoFormComponent implements OnInit {
			{
				useOnlyRestrictedCarriersForDelivery: false,
				preferRestrictedCarriersForDelivery: false,
				ordersShortProcess: false,
			},
			basicInfo
		);
+9 −1
Original line number Diff line number Diff line
<div class="col-sm-12">
	<div class="row m-0">
		<div class="form-group offset-md-2 col-md-8">
		<div class="form-group offset-md-2 col-md-4">
			<nb-checkbox [(ngModel)]="isPaymentEnabled">
				{{
					'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.ALLOW_ONLINE_PAYMENT'
@@ -8,6 +8,14 @@
				}}
			</nb-checkbox>
		</div>
		<div class="form-group offset-md-2 col-md-4">
			<nb-checkbox [(ngModel)]="isCashPaymentEnabled">
				{{
					'FAKE_DATA.SETUP_MERCHANTS.PAYMENTS.ALLOW_CASH_PAYMENT'
						| translate
				}}
			</nb-checkbox>
		</div>
	</div>
	<div [hidden]="!isPaymentEnabled" class="row m-0">
		<div class="form-group offset-md-2 col-md-8">
+6 −0
Original line number Diff line number Diff line
@@ -19,17 +19,23 @@ export class PaymentsSettingsFormComponent {
	isEdit: boolean;

	isPaymentEnabled: boolean = false;
	isCashPaymentEnabled: boolean = true;

	get isPaymentValid() {
		return !this.isPaymentEnabled || this.paymentGateways.isValid;
	}

	get isCashPaymentValid() {
		return !this.isCashPaymentEnabled || this.paymentGateways.isValid;
	}

	get paymentsGateways(): IPaymentGatewayCreateObject[] {
		return this.paymentGateways.paymentsGateways;
	}

	setValue(merchant: Warehouse) {
		this.isPaymentEnabled = merchant.isPaymentEnabled;
		this.isCashPaymentEnabled = merchant.isCashPaymentEnabled;
		this.paymentGateways.setValue(merchant);
	}
}
Loading