2019-02-21 12:34:13 +01:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
|
2019-02-26 14:43:51 +01:00
|
|
|
import {
|
|
|
|
MotionBlockSlideData,
|
|
|
|
MotionBlockSlideMotionRepresentation,
|
|
|
|
MotionTitleInformation
|
|
|
|
} from './motion-block-slide-data';
|
2019-02-21 12:34:13 +01:00
|
|
|
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
|
|
|
|
import { StateCssClassMapping } from 'app/site/motions/models/view-workflow';
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2019-03-06 16:59:18 +01:00
|
|
|
import { BaseMotionSlideComponent } from '../base/base-motion-slide';
|
2019-02-21 12:34:13 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'os-motion-block-slide',
|
|
|
|
templateUrl: './motion-block-slide.component.html',
|
|
|
|
styleUrls: ['./motion-block-slide.component.scss']
|
|
|
|
})
|
2019-03-06 16:59:18 +01:00
|
|
|
export class MotionBlockSlideComponent extends BaseMotionSlideComponent<MotionBlockSlideData> {
|
|
|
|
public constructor(translate: TranslateService, motionRepo: MotionRepositoryService) {
|
|
|
|
super(translate, motionRepo);
|
2019-02-21 12:34:13 +01:00
|
|
|
}
|
|
|
|
|
2019-02-26 14:43:51 +01:00
|
|
|
public getMotionTitle(motion: MotionTitleInformation): string {
|
|
|
|
return this.motionRepo.getTitle(motion);
|
2019-02-21 12:34:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public getStateCssColor(motion: MotionBlockSlideMotionRepresentation): string {
|
|
|
|
return StateCssClassMapping[motion.recommendation.css_class] || '';
|
|
|
|
}
|
|
|
|
|
2019-02-21 15:06:14 +01:00
|
|
|
public getRecommendationLabel(motion: MotionBlockSlideMotionRepresentation): string {
|
2019-02-21 12:34:13 +01:00
|
|
|
let recommendation = this.translate.instant(motion.recommendation.name);
|
|
|
|
if (motion.recommendation_extension) {
|
2019-03-06 16:59:18 +01:00
|
|
|
recommendation +=
|
|
|
|
' ' + this.replaceReferencedMotions(motion.recommendation_extension, this.data.data.referenced_motions);
|
2019-02-21 12:34:13 +01:00
|
|
|
}
|
|
|
|
return recommendation;
|
|
|
|
}
|
|
|
|
}
|