Loading packages/admin-web-angular/src/app/@shared/render-component/product-takeaway-delivery/product-takeaway-delivery.component.ts 0 → 100644 +79 −0 Original line number Diff line number Diff line import { Component, Input } from '@angular/core'; @Component({ styles: [ ` div { 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 " > <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 }} </div> </div> </ng-template> </ng-template> `, }) export class ProductTakeawayDeliveryComponent { @Input() rowData: any; constructor() {} } packages/admin-web-angular/src/app/@shared/render-component/render-components.module.ts +9 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ import { CustomerEmailComponent } from './customer-email/customer-email.componen import { CustomerPhoneComponent } from './customer-phone/customer-phone.component'; import { CheckboxComponent } from './customer-orders-table/checkbox/checkbox.component'; import { IsAvailableCheckBox } from './store-product-is-available-checkbox/is-available-checkbox.component'; import { ProductTakeawayDeliveryComponent } from './product-takeaway-delivery/product-takeaway-delivery.component'; import { TranslateModule } from '@ngx-translate/core'; const COMPONENTS = [ PriceCountInputComponent, Loading @@ -30,10 +32,16 @@ const COMPONENTS = [ CustomerEmailComponent, CustomerPhoneComponent, IsAvailableCheckBox, ProductTakeawayDeliveryComponent, ]; @NgModule({ imports: [CommonModule, ThemeModule, MomentModule], imports: [ CommonModule, ThemeModule, MomentModule, TranslateModule.forChild(), ], declarations: COMPONENTS, entryComponents: COMPONENTS, }) Loading packages/admin-web-angular/src/app/@shared/warehouse-product/forms/warehouse-products-table/warehouse-products-table.component.ts +9 −20 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ 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 { IsAvailableCheckBox } from '@app/@shared/render-component/store-product-is-available-checkbox/is-available-checkbox.component'; import { ProductTakeawayDeliveryComponent } from '@app/@shared/render-component/product-takeaway-delivery/product-takeaway-delivery.component'; export interface WarehouseProductViewModel { id: string; Loading Loading @@ -55,9 +56,6 @@ 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 = []; Loading @@ -81,7 +79,6 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { ngOnDestroy(): void { this.ngDestroy$.next(); this.ngDestroy$.complete(); this.subscription.unsubscribe(); } async loadDataSmartTable(products: WarehouseProduct[], storeId: string) { Loading Loading @@ -115,9 +112,7 @@ 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`), type: product, storeId, product: product.product, allCategories: this.categoriesInfo, Loading @@ -141,8 +136,9 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { } private _loadSettingsSmartTable() { let columnTitlePrefix = 'WAREHOUSE_VIEW.PRODUCTS_TAB.'; const getTranslate = (name: string): Observable<any> => this._translateService.get(this.columnTitlePrefix + name); this._translateService.get(columnTitlePrefix + name); forkJoin( this._translateService.get('Id'), Loading @@ -168,7 +164,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { price, quantity, availability, type type, ]) => { this.settingsSmartTable = { mode: 'external', Loading Loading @@ -228,10 +224,12 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { isAvailable: { title: availability, type: 'custom', renderComponent: IsAvailableCheckBox renderComponent: IsAvailableCheckBox, }, type: { title: type, type: 'custom', renderComponent: ProductTakeawayDeliveryComponent, }, }, pager: { Loading @@ -248,13 +246,4 @@ 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; } } Loading
packages/admin-web-angular/src/app/@shared/render-component/product-takeaway-delivery/product-takeaway-delivery.component.ts 0 → 100644 +79 −0 Original line number Diff line number Diff line import { Component, Input } from '@angular/core'; @Component({ styles: [ ` div { 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 " > <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 }} </div> </div> </ng-template> </ng-template> `, }) export class ProductTakeawayDeliveryComponent { @Input() rowData: any; constructor() {} }
packages/admin-web-angular/src/app/@shared/render-component/render-components.module.ts +9 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ import { CustomerEmailComponent } from './customer-email/customer-email.componen import { CustomerPhoneComponent } from './customer-phone/customer-phone.component'; import { CheckboxComponent } from './customer-orders-table/checkbox/checkbox.component'; import { IsAvailableCheckBox } from './store-product-is-available-checkbox/is-available-checkbox.component'; import { ProductTakeawayDeliveryComponent } from './product-takeaway-delivery/product-takeaway-delivery.component'; import { TranslateModule } from '@ngx-translate/core'; const COMPONENTS = [ PriceCountInputComponent, Loading @@ -30,10 +32,16 @@ const COMPONENTS = [ CustomerEmailComponent, CustomerPhoneComponent, IsAvailableCheckBox, ProductTakeawayDeliveryComponent, ]; @NgModule({ imports: [CommonModule, ThemeModule, MomentModule], imports: [ CommonModule, ThemeModule, MomentModule, TranslateModule.forChild(), ], declarations: COMPONENTS, entryComponents: COMPONENTS, }) Loading
packages/admin-web-angular/src/app/@shared/warehouse-product/forms/warehouse-products-table/warehouse-products-table.component.ts +9 −20 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ 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 { IsAvailableCheckBox } from '@app/@shared/render-component/store-product-is-available-checkbox/is-available-checkbox.component'; import { ProductTakeawayDeliveryComponent } from '@app/@shared/render-component/product-takeaway-delivery/product-takeaway-delivery.component'; export interface WarehouseProductViewModel { id: string; Loading Loading @@ -55,9 +56,6 @@ 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 = []; Loading @@ -81,7 +79,6 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { ngOnDestroy(): void { this.ngDestroy$.next(); this.ngDestroy$.complete(); this.subscription.unsubscribe(); } async loadDataSmartTable(products: WarehouseProduct[], storeId: string) { Loading Loading @@ -115,9 +112,7 @@ 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`), type: product, storeId, product: product.product, allCategories: this.categoriesInfo, Loading @@ -141,8 +136,9 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { } private _loadSettingsSmartTable() { let columnTitlePrefix = 'WAREHOUSE_VIEW.PRODUCTS_TAB.'; const getTranslate = (name: string): Observable<any> => this._translateService.get(this.columnTitlePrefix + name); this._translateService.get(columnTitlePrefix + name); forkJoin( this._translateService.get('Id'), Loading @@ -168,7 +164,7 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { price, quantity, availability, type type, ]) => { this.settingsSmartTable = { mode: 'external', Loading Loading @@ -228,10 +224,12 @@ export class WarehouseProductsComponent implements OnInit, OnDestroy { isAvailable: { title: availability, type: 'custom', renderComponent: IsAvailableCheckBox renderComponent: IsAvailableCheckBox, }, type: { title: type, type: 'custom', renderComponent: ProductTakeawayDeliveryComponent, }, }, pager: { Loading @@ -248,13 +246,4 @@ 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; } }