Commit 0dcb1513 authored by sunko's avatar sunko
Browse files

fix: refactor available

parent 9f0b05cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
	"name": "@ever-platform/admin-web-angular",
	"version": "0.3.3",
	"version": "0.3.7",
	"description": "Ever Admin",
	"license": "AGPL-3.0",
	"homepage": "https://ever.co",
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import { ProductImageComponent } from './product-image/product-image.component';
import { CustomerEmailComponent } from './customer-email/customer-email.component';
import { CustomerPhoneComponent } from './customer-phone/customer-phone.component';
import { CheckboxComponent } from './customer-orders-table/checkbox/checkbox.component';
import { IsAviavableCheckBox } from './store-product-is-aviavable-checkbox/is-aviavable-checkbox.component';
import { IsAvailableCheckBox } from './store-product-is-available-checkbox/is-available-checkbox.component';

const COMPONENTS = [
	PriceCountInputComponent,
@@ -29,7 +29,7 @@ const COMPONENTS = [
	ProductImageComponent,
	CustomerEmailComponent,
	CustomerPhoneComponent,
	IsAviavableCheckBox,
	IsAvailableCheckBox,
];

@NgModule({
+6 −5
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import { WarehouseProductsRouter } from '@modules/client.common.angular2/routers
		`,
	],
})
export class IsAviavableCheckBox implements ViewCell, OnInit {
export class IsAvailableCheckBox implements ViewCell, OnInit {
	@Input() rowData: any;
	@Input() value: string;
	isChecked: boolean;
@@ -32,18 +32,19 @@ export class IsAviavableCheckBox implements ViewCell, OnInit {
	productId: string;
	constructor(private warehouseProductRouter: WarehouseProductsRouter) {}
	ngOnInit() {
		this.isChecked = this.rowData.isProductAviavable;
		this.isChecked = this.rowData.isProductAvailable;
		this.wareHouseId = this.rowData.storeId;
		this.productId = this.rowData.product.id;
		console.warn(this.rowData);
	}

	async clickHandler() {
		this.isChecked = !this.isChecked;
		this.rowData.isProductAviavable = this.isChecked;
		await this.warehouseProductRouter.changeProductAviavability(
		this.rowData.isProductAvailable = this.isChecked;
		await this.warehouseProductRouter.changeProductAvailability(
			this.wareHouseId,
			this.productId,
			this.rowData.isProductAviavable
			this.rowData.isProductAvailable
		);
	}
}
+4 −4
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import { ProductsCategoryService } from '@app/@core/data/productsCategory.servic
import Product from '@modules/server.common/entities/Product';
import { StoreProductImageComponent } from '@app/@shared/render-component/store-products-table/store-product-image/store-product-image.component';
import { CheckboxComponent } from '@app/@shared/render-component/customer-orders-table/checkbox/checkbox.component';
import { IsAviavableCheckBox } from '@app/@shared/render-component/store-product-is-aviavable-checkbox/is-aviavable-checkbox.component';
import { IsAvailableCheckBox } from '@app/@shared/render-component/store-product-is-available-checkbox/is-available-checkbox.component';

export interface WarehouseProductViewModel {
	id: string;
@@ -34,7 +34,7 @@ export interface WarehouseProductViewModel {
	storeId: string;
	product: Product;
	allCategories: any[];
	isProductAviavable: boolean;
	isProductAvailable: boolean;
}

@Component({
@@ -114,7 +114,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
				storeId,
				product: product.product,
				allCategories: this.categoriesInfo,
				isProductAviavable: product.isProductAviavable,
				isProductAvailable: product.isProductAvailable,
			};
		});

@@ -220,7 +220,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy {
							isAvailable: {
								title: availability,
								type: 'custom',
								renderComponent: IsAviavableCheckBox,
								renderComponent: IsAvailableCheckBox,
							},
						},
						pager: {
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
	"name": "@ever-platform/common-angular",
	"description": "Ever Platform Shared Angular Core",
	"license": "AGPL-3.0",
	"version": "0.3.1",
	"version": "0.3.4",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
Loading