All files / projects/organization-management/src/app/pages/cost-center-detail cost-center-detail-page.component.ts

100% Statements 10/10
75% Branches 6/8
100% Functions 2/2
100% Lines 10/10

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 351x     1x         1x             1x             5x 5x       5x 5x 5x   5x      
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
 
import { AccountFacade } from 'ish-core/facades/account.facade';
import { CostCenter } from 'ish-core/models/cost-center/cost-center.model';
import { HttpError } from 'ish-core/models/http-error/http-error.model';
import { User } from 'ish-core/models/user/user.model';
 
import { OrganizationManagementFacade } from '../../facades/organization-management.facade';
 
@Component({
  selector: 'ish-cost-center-detail-page',
  templateUrl: './cost-center-detail-page.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CostCenterDetailPageComponent implements OnInit {
  costCenter$: Observable<CostCenter>;
  costCentersError$: Observable<HttpError>;
  user$: Observable<User>;
  isEditable$: Observable<boolean>;
 
  constructor(
    private accountFacade: AccountFacade,
    private organizationManagementFacade: OrganizationManagementFacade
  ) {}
 
  ngOnInit() {
    this.costCenter$ = this.organizationManagementFacade.selectedCostCenter$;
    this.costCentersError$ = this.organizationManagementFacade.costCentersError$;
    this.user$ = this.accountFacade.user$;
 
    this.isEditable$ = this.organizationManagementFacade.isCostCenterEditable(this.costCenter$);
  }
}