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 2x 12x 12x 12x 12x | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { isEqual } from 'lodash-es'; import { CheckoutFacade } from 'ish-core/facades/checkout.facade'; import { ProductContextFacade } from 'ish-core/facades/product-context.facade'; import { LineItemUpdate } from 'ish-core/models/line-item-update/line-item-update.model'; import { LineItemView } from 'ish-core/models/line-item/line-item.model'; import { OrderLineItem } from 'ish-core/models/order/order.model'; @Component({ selector: 'ish-line-item-list-element', templateUrl: './line-item-list-element.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class LineItemListElementComponent implements OnInit { @Input({ required: true }) pli: Partial<LineItemView & OrderLineItem>; @Input() editable = true; @Input() lineItemViewType: 'simple' | 'availability'; constructor(private context: ProductContextFacade, private checkoutFacade: CheckoutFacade) {} ngOnInit() { this.context.hold(this.context.validDebouncedQuantityUpdate$(), quantity => { this.checkoutFacade.updateBasketItem({ itemId: this.pli.id, quantity }); }); } get oldPrice() { return isEqual(this.pli.singleBasePrice, this.pli.undiscountedSingleBasePrice) ? undefined : this.pli.undiscountedSingleBasePrice; } onUpdateItem(update: LineItemUpdate) { this.checkoutFacade.updateBasketItem(update); } onDeleteItem(itemId: string) { this.checkoutFacade.deleteBasketItem(itemId); } } |