All files / src/app/extensions/quoting/shared/quote-view quote-view.component.ts

100% Statements 14/14
75% Branches 6/8
100% Functions 2/2
100% Lines 13/13

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 363x     3x   3x 3x               3x               3x 3x   3x     3x 3x 3x 3x 3x      
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
 
import { AccountFacade } from 'ish-core/facades/account.facade';
 
import { QuoteContextFacade, isQuoteStarted } from '../../facades/quote-context.facade';
import { QuotingHelper } from '../../models/quoting/quoting.helper';
import { Quote, QuoteRequest, QuoteStatus } from '../../models/quoting/quoting.model';
 
@Component({
  selector: 'ish-quote-view',
  templateUrl: './quote-view.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class QuoteViewComponent implements OnInit {
  quote$: Observable<Quote | QuoteRequest>;
  state$: Observable<QuoteStatus>;
  userEmail$: Observable<string>;
 
  isQuoteStarted$: Observable<boolean>;
  justSubmitted$: Observable<boolean>;
 
  asQuote = QuotingHelper.asQuote;
  asQuoteRequest = QuotingHelper.asQuoteRequest;
 
  constructor(private accountFacade: AccountFacade, private context: QuoteContextFacade) {}
 
  ngOnInit() {
    this.quote$ = this.context.select('entity');
    this.state$ = this.context.select('state');
    this.userEmail$ = this.accountFacade.userEmail$;
    this.isQuoteStarted$ = this.context.select(isQuoteStarted);
    this.justSubmitted$ = this.context.select('justSubmitted');
  }
}