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 37 38 39 40 41 42 | 2x 2x 2x 2x 4x 3x 3x 1x | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { ProductContextFacade } from 'ish-core/facades/product-context.facade'; import { QuoteContextFacade } from '../../facades/quote-context.facade'; import { QuoteItem, QuoteRequestItem } from '../../models/quoting/quoting.model'; @Component({ selector: 'ish-quote-line-item-list-element', templateUrl: './quote-line-item-list-element.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class QuoteLineItemListElementComponent implements OnInit { @Input({ required: true }) lineItem: Partial< Pick<QuoteRequestItem, 'id' | 'productSKU' | 'quantity' | 'singleBasePrice' | 'total'> & Pick< QuoteItem, 'id' | 'productSKU' | 'quantity' | 'originSingleBasePrice' | 'singleBasePrice' | 'total' | 'originTotal' > >; editable$: Observable<boolean>; constructor(private quoteContext: QuoteContextFacade, private productContext: ProductContextFacade) {} ngOnInit() { this.editable$ = this.quoteContext.select('editable'); this.productContext.hold(this.productContext.validDebouncedQuantityUpdate$(), quantity => { this.quoteContext.updateItem({ itemId: this.lineItem?.id, quantity, }); }); } onDeleteItem() { this.quoteContext.deleteItem(this.lineItem.id); } } |