Files
ChurchAngular/src/app/cell-group/join-domain/join-domain.component.ts
T
Chris Chen 6301d6008b WIP
2024-02-28 15:17:41 -08:00

39 lines
1.4 KiB
TypeScript

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() {
}
}