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 43 44 45 46 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { groupBy } from 'lodash-es';
import { Observable, map } from 'rxjs';
import { CheckoutFacade } from 'ish-core/facades/checkout.facade';
import { LineItem } from 'ish-core/models/line-item/line-item.model';
import { GenerateLazyComponent } from 'ish-core/utils/module-loader/generate-lazy-component.decorator';
import { QuotingFacade } from '../../facades/quoting.facade';
@Component({
selector: 'ish-quoting-basket-line-items',
templateUrl: './quoting-basket-line-items.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
@GenerateLazyComponent()
export class QuotingBasketLineItemsComponent implements OnInit {
lineItems$: Observable<[string, LineItem[]][]>;
constructor(private checkoutFacade: CheckoutFacade, private quotingFacade: QuotingFacade) {}
ngOnInit() {
this.quotingFacade.loadQuoting();
this.lineItems$ = this.checkoutFacade.basket$.pipe(
map(basket =>
Object.entries(groupBy(basket?.lineItems, 'quote')).sort((a, b) =>
a[0] === 'undefined' ? -1 : b[0] === 'undefined' ? 1 : 0
)
)
);
}
getName(quoteId: string) {
return this.quotingFacade.name$(quoteId);
}
onDeleteQuote(quoteId: string) {
this.quotingFacade.deleteQuoteFromBasket(quoteId);
}
trackByFn(_: number, element: [string, LineItem[]]) {
// quoteId
return element[0];
}
}
|