All files / src/app/extensions/quoting/shared/basket-add-to-quote basket-add-to-quote.component.ts

92.85% Statements 13/14
75% Branches 12/16
75% Functions 3/4
92.85% Lines 13/14

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 421x 1x 1x     1x 1x   1x                     1x       2x 2x 2x 2x       1x       1x              
import { Location } from '@angular/common';
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
 
import { AccountFacade } from 'ish-core/facades/account.facade';
import { GenerateLazyComponent } from 'ish-core/utils/module-loader/generate-lazy-component.decorator';
 
import { QuotingFacade } from '../../facades/quoting.facade';
 
/**
 * The Basket Add To Quote Component displays a button which adds a product to a Quote Request.
 */
@Component({
  selector: 'ish-basket-add-to-quote',
  templateUrl: './basket-add-to-quote.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
@GenerateLazyComponent()
export class BasketAddToQuoteComponent implements OnInit {
  isLoggedIn$: Observable<boolean>;
 
  constructor(
    private quotingFacade: QuotingFacade,
    private accountFacade: AccountFacade,
    private location: Location,
    private router: Router
  ) {}
 
  ngOnInit() {
    this.isLoggedIn$ = this.accountFacade.isLoggedIn$;
  }
 
  addToQuote() {
    this.quotingFacade.createQuoteRequestFromBasket();
  }
 
  login() {
    this.router.navigate(['/login'], { queryParams: { messageKey: 'quotes', returnUrl: this.location.path() } });
  }
}