Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x 1x 1x 1x 1x 3x 3x 3x 2x | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { SkuQuantityType } from 'ish-core/models/product/product.model'; import { GenerateLazyComponent } from 'ish-core/utils/module-loader/generate-lazy-component.decorator'; import { whenTruthy } from 'ish-core/utils/operators'; import { OrderTemplatesFacade } from '../../facades/order-templates.facade'; import { OrderTemplate } from '../../models/order-template/order-template.model'; @Component({ selector: 'ish-order-template-widget', templateUrl: './order-template-widget.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) @GenerateLazyComponent() export class OrderTemplateWidgetComponent implements OnInit { loading$: Observable<boolean>; orderTemplates$: Observable<OrderTemplate[]>; constructor(private facade: OrderTemplatesFacade) {} ngOnInit() { this.loading$ = this.facade.orderTemplateLoading$; this.orderTemplates$ = this.facade.orderTemplates$.pipe( whenTruthy(), map(orderTemplates => orderTemplates.slice(0, 3)) ); } getParts(template: OrderTemplate): SkuQuantityType[] { return template?.items.map(item => ({ sku: item.sku, quantity: item.desiredQuantity.value })); } } |