// Angular // import { Component, Input, Inject, OnInit } from '@angular/core'; // Other // import * as statics from '@fb/statics'; /** * @ngdoc fb-moejlighet-header * @name fb-moejlighet-header * @function * * @description * Header för möjlighet, används både av sidedrawer och lista */ @Component({ selector: 'fb-moejlighet-header', templateUrl: './fb-moejlighet-header.component.html' }) export class FbMoejlighetHeaderComponent implements OnInit { @Input() noOpenLink: boolean; @Input() moejlighet: fb.Moejlighet_MoejlighetLO; @Input() listTypDomain: any; @Input() aktivitetStatusDomain: any; chilliRatingClass: string; utfoerareInitialer: string = ''; constructor( @Inject('NavigationService') private readonly navigationService: fb.INavigationService ) { } ngOnInit(): void { this.initChilliRatingClass(); this.initUtfoerareInitialer(); } initChilliRatingClass(): void { if (!this.moejlighet.MaeklarObjekt.SannolikhetForUppdrag || this.moejlighet.MaeklarObjekt.SannolikhetForUppdrag.value === 0) { this.chilliRatingClass = 'fi-chilli-norating-centered'; } else { // fi-chilli-rating-0{{moejlighet.MaeklarObjekt.SannolikhetForUppdrag.value}}{{moejlighet.MaeklarObjekt.SannolikhetForUppdrag.value<3?'-center':'' const center: string = this.moejlighet.MaeklarObjekt.SannolikhetForUppdrag.value < 3 ? '-center' : ''; this.chilliRatingClass = `fi-chilli-rating-0${this.moejlighet.MaeklarObjekt.SannolikhetForUppdrag.value}${center}`; } } initUtfoerareInitialer(): void { if (statics.isDefined(this.moejlighet.Utfoerare) && statics.isDefined(this.moejlighet.Utfoerare.Initialer)) { this.utfoerareInitialer = this.moejlighet.Utfoerare.Initialer.value; } } openMaeklarObjekt(): void { if (!this.noOpenLink && this.moejlighet.MaeklarObjekt.StatusLagring.value !== fb.FasITDomain.StatusLagring.BORTTAGEN) { this.navigationService.findOpenObjekt(fb.FasITDomain.NavigationController.MAEKLAROBJEKT, this.moejlighet.MaeklarObjekt.MaeklarObjektId.value, true); } } }