web-remote/src/app/components/service/service.component.ts

55 lines
1.5 KiB
TypeScript
Raw Normal View History

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
2018-08-22 20:04:41 +00:00
import { OpenLPService } from '../../openlp.service';
2019-11-07 18:02:26 +00:00
import { PageTitleService } from '../../page-title.service';
import { ServiceItem } from '../../responses';
@Component({
selector: 'openlp-service',
templateUrl: './service.component.html',
styleUrls: ['./service.component.scss'],
providers: [OpenLPService]
})
export class ServiceComponent implements OnInit {
items: ServiceItem[] = [];
2019-11-07 18:02:26 +00:00
ngOnInit() {
this.getServiceItems();
}
onItemSelected(item) {
2019-10-08 05:43:49 +00:00
this.openlpService.setServiceItem(item).subscribe(res => {});
this.router.navigate(['slides']);
}
getServiceItems() {
2018-08-20 12:12:30 +00:00
this.openlpService.getServiceItems().subscribe(items => this.items = items);
}
2019-11-07 18:02:26 +00:00
constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService,
private router: Router) {
pageTitleService.changePageTitle('Service');
openlpService.stateChanged$.subscribe(item => this.getServiceItems());
}
getIcon(item: ServiceItem): string {
if (item.plugin === 'songs') {
return 'queue_music';
} else if (item.plugin === 'images') {
return 'image';
} else if (item.plugin === 'bibles') {
return 'book';
} else if (item.plugin === 'media') {
return 'movie';
} else if (item.plugin === 'custom') {
return 'description';
} else if (item.plugin === 'presentations') {
return 'slideshow';
}
return 'crop_square';
}
}