import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { DomainType, PastoralDomain } from '../../entity/PastoralDomain'; import { PastoralDomainService } from '../../services/crudServices/pastoral-domain.service'; import { StateService } from '../../services/state.service'; import { MyAppBase } from '../MyAppBase'; import { first } from 'rxjs/operators'; import { DropDownOption } from '../../entity/dropDownOption'; @Component({ selector: 'ngx-join-domain', templateUrl: './join-domain.component.html', styleUrls: ['./join-domain.component.scss'] }) export class JoinDomainComponent extends MyAppBase { constructor( protected stateService: StateService, protected route: ActivatedRoute, protected pastoralDomainService: PastoralDomainService ) { super(stateService, route, pastoralDomainService); this.redirectIfNoDomains = false; } domainId: string; allDomains: PastoralDomain[]; domainOptions: DropDownOption[] = []; pageOnInit(): void { this.isLoading = true; this.pastoralDomainService.getAll().pipe(first()).subscribe(result => { this.allDomains = result.filter(d => d.type == DomainType.CellGroup || d.type == DomainType.HappinessGroup); this.domainOptions = this.allDomains.map(d => new DropDownOption(d.id, d.name)); this.isLoading = false; }); } joinDomain() { } }