Files
ISA-Frontend/apps/core/application/src/lib/application.service.ts
Nino Righi 2b500784c4 Merged PR 806: Merge Wareneingang into Develop
Merge Wareneingang into Develop

Related work items: #1830, #1842, #1843, #2086, #2141
2021-09-06 15:04:18 +00:00

38 lines
973 B
TypeScript

import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { BehaviorSubject } from 'rxjs';
import { processRemoved, selectSection, setSection } from './store';
@Injectable()
export class ApplicationService {
private activatedProcessIdSubject = new BehaviorSubject<number>(undefined);
get activatedProcessId() {
return this.activatedProcessIdSubject.value;
}
get activatedProcessId$() {
return this.activatedProcessIdSubject.asObservable();
}
readonly section$ = this.store.select(selectSection);
constructor(private store: Store) {}
setActivatedProcessId(processId: number) {
if (this.activatedProcessId !== processId) {
this.activatedProcessIdSubject.next(processId);
}
}
removeProcess(processId: number) {
this.store.dispatch(processRemoved({ processId }));
}
createProcess() {}
setSection(section: 'customer' | 'branch') {
this.store.dispatch(setSection({ section }));
}
}