Loading packages/admin-web-angular/src/app/@shared/render-component/product-takeaway-delivery/product-takeaway-delivery.component.ts +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: [ Loading @@ -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 ); } } packages/admin-web-angular/src/app/@shared/warehouse-product/forms/warehouse-products-table/warehouse-products-table.component.ts +2 −0 Original line number Diff line number Diff line Loading @@ -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 packages/common-angular/package.json +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ "name": "@ever-platform/common-angular", "description": "Ever Platform Shared Angular Core", "license": "AGPL-3.0", "version": "0.3.4", "version": "0.3.5", "homepage": "https://ever.co", "repository": { "type": "git", Loading packages/common-angular/src/routers/warehouse-products-router.service.ts +30 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,36 @@ export class WarehouseProductsRouter implements IWarehouseProductsRouter { return this._warehouseProductFactory(warehouseProduct); } async changeProductTakeaway( warehouseId: string, productId: string, isTakeaway: boolean ): Promise<WarehouseProduct> { const warehouseProduct = await this.router.run<IWarehouseProduct>( 'changeProductTakeaway', warehouseId, productId, isTakeaway ); return this._warehouseProductFactory(warehouseProduct); } async changeProductDelivery( warehouseId: string, productId: string, isDelivery: boolean ): Promise<WarehouseProduct> { const warehouseProduct = await this.router.run<IWarehouseProduct>( 'changeProductDelivery', warehouseId, productId, isDelivery ); return this._warehouseProductFactory(warehouseProduct); } async increaseSoldCount( warehouseId: string, productId: string, Loading packages/core/package.json +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ "name": "@ever-platform/core", "description": "Ever Platform Headless Framework", "license": "AGPL-3.0", "version": "0.3.14", "version": "0.3.15", "homepage": "https://ever.co", "repository": { "type": "git", Loading Loading
packages/admin-web-angular/src/app/@shared/render-component/product-takeaway-delivery/product-takeaway-delivery.component.ts +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: [ Loading @@ -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 ); } }
packages/admin-web-angular/src/app/@shared/warehouse-product/forms/warehouse-products-table/warehouse-products-table.component.ts +2 −0 Original line number Diff line number Diff line Loading @@ -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
packages/common-angular/package.json +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ "name": "@ever-platform/common-angular", "description": "Ever Platform Shared Angular Core", "license": "AGPL-3.0", "version": "0.3.4", "version": "0.3.5", "homepage": "https://ever.co", "repository": { "type": "git", Loading
packages/common-angular/src/routers/warehouse-products-router.service.ts +30 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,36 @@ export class WarehouseProductsRouter implements IWarehouseProductsRouter { return this._warehouseProductFactory(warehouseProduct); } async changeProductTakeaway( warehouseId: string, productId: string, isTakeaway: boolean ): Promise<WarehouseProduct> { const warehouseProduct = await this.router.run<IWarehouseProduct>( 'changeProductTakeaway', warehouseId, productId, isTakeaway ); return this._warehouseProductFactory(warehouseProduct); } async changeProductDelivery( warehouseId: string, productId: string, isDelivery: boolean ): Promise<WarehouseProduct> { const warehouseProduct = await this.router.run<IWarehouseProduct>( 'changeProductDelivery', warehouseId, productId, isDelivery ); return this._warehouseProductFactory(warehouseProduct); } async increaseSoldCount( warehouseId: string, productId: string, Loading
packages/core/package.json +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ "name": "@ever-platform/core", "description": "Ever Platform Headless Framework", "license": "AGPL-3.0", "version": "0.3.14", "version": "0.3.15", "homepage": "https://ever.co", "repository": { "type": "git", Loading