Merge pull request #140 in TEA/mina-sidor-fa-web from bugfix/TV-699 to next
Squashed commit of the following: commit 649afa24e8e5b1e99bc2c4bc7b5ac304bd79f7f1 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Sep 28 09:30:43 2021 +0200 Fixed small linting issues and text-change after PR commit bc3716f037d3b1fce8b55fc875d9d68cb555e2c6 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Sep 28 08:44:38 2021 +0200 Fixed issue with error state on handledare-select
This commit is contained in:
@@ -4,7 +4,7 @@ import { AvropCompact, AvropCompactData } from '@msfa-models/avrop.model';
|
||||
import { Handledare } from '@msfa-models/handledare.model';
|
||||
import { AvropApiService } from '@msfa-services/api/avrop-api.service';
|
||||
import { MultiselectFilterOption } from '@msfa-shared/components/multiselect/multiselect-filter-option';
|
||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
||||
import { BehaviorSubject, combineLatest, Observable, of } from 'rxjs';
|
||||
import { filter, map, switchMap, tap } from 'rxjs/operators';
|
||||
|
||||
type Step = 1 | 2 | 3 | 4;
|
||||
@@ -34,12 +34,13 @@ export class AvropService {
|
||||
public filteredKommuner$: Observable<MultiselectFilterOption[]> = this._filteredKommuner$.asObservable();
|
||||
public selectedAvrop$: Observable<AvropCompact[]> = this._selectedAvrop$.asObservable();
|
||||
public avropIsLocked$: Observable<boolean> = this._avropIsLocked$.asObservable();
|
||||
public selectedHandledare$: Observable<Handledare> = this._selectedHandledareId$.pipe(
|
||||
filter(selectedHandledare => !!selectedHandledare),
|
||||
public selectedHandledare$: Observable<Handledare | null> = this._selectedHandledareId$.pipe(
|
||||
switchMap(handledareId =>
|
||||
this.availableHandledare$.pipe(
|
||||
map(availableHandledare => availableHandledare.find(handledare => handledare.ciamUserId === handledareId))
|
||||
)
|
||||
handledareId
|
||||
? this.availableHandledare$.pipe(
|
||||
map(availableHandledare => availableHandledare.find(handledare => handledare.ciamUserId === handledareId))
|
||||
)
|
||||
: of(null as null)
|
||||
)
|
||||
);
|
||||
public handledareIsConfirmed$: Observable<boolean> = this._handledareIsConfirmed$.asObservable();
|
||||
@@ -201,6 +202,7 @@ export class AvropService {
|
||||
|
||||
public unconfirmHandledare(): void {
|
||||
this.resetError();
|
||||
this._selectedHandledareId$.next(null);
|
||||
this._handledareIsConfirmed$.next(false);
|
||||
}
|
||||
|
||||
@@ -221,6 +223,7 @@ export class AvropService {
|
||||
}
|
||||
|
||||
public assignHandledare(handledareId: string): void {
|
||||
this.resetError();
|
||||
this._selectedHandledareId$.next(handledareId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user