mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
38 lines
973 B
TypeScript
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 }));
|
|
}
|
|
}
|