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:
Erik Tiekstra
2021-09-28 09:31:30 +02:00
parent 60f5cb047b
commit 86a5734749
5 changed files with 17 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
- **deltagare:** Now fetching data using "genomforandeReferens" instead of "sokandeId" to avoid wrong data. [TV-692](https://jira.arbetsformedlingen.se/browse/TV-692)
- **authorization:** Whenever the API throws a "403 Forbidden" error we now show an unauthorized message. [TV-695](https://jira.arbetsformedlingen.se/browse/TV-695)
- **avrop:** Fixed error-state on handledare select. [TV-699](https://jira.arbetsformedlingen.se/browse/TV-699)
## [2.0.0](https://bitbucket.arbetsformedlingen.se/projects/tea/repos/mina-sidor-fa-web/compare/diff?targetBranch=refs%2Ftags%2Fv1.5.0&sourceBranch=refs%2Ftags%2Fv2.0.0) (2021-09-24)

View File

@@ -51,14 +51,12 @@
af-label="Välj handledare att tilldela"
af-placeholder="Välj handledare"
[afRequired]="true"
af-validation="error"
af-validation-text="Handledare måste väljas"
[afValidation]="(error$ | async) ? 'error' : 'neutral'"
(afOnChange)="changeHandledare($event.detail)"
>
<option
*ngFor="let availableHandledare of availableHandledare"
[value]="availableHandledare.ciamUserId"
>
{{ availableHandledare.fullName }}
<option *ngFor="let handledare of availableHandledare" [value]="handledare.ciamUserId">
{{ handledare.fullName }}
</option>
</digi-form-select>
@@ -68,7 +66,7 @@
</ng-container>
</div>
<h3>Välj deltagare att tilldela handledare</h3>
<h3 *ngIf="currentStep === 1">Välj deltagare att tilldela handledare</h3>
<msfa-avrop-list
[availableAvrop]="avropData.data"
[paginationMeta]="avropData.meta"

View File

@@ -17,7 +17,7 @@ export class AvropComponent {
avropData$: Observable<AvropCompactData> = this.avropService.avropData$;
selectedAvrop$: Observable<AvropCompact[]> = this.avropService.selectedAvrop$;
availableHandledare$: Observable<Handledare[]> = this.avropService.availableHandledare$;
selectedHandledare$: Observable<Handledare> = this.avropService.selectedHandledare$;
selectedHandledare$: Observable<Handledare | null> = this.avropService.selectedHandledare$;
avropIsLocked$: Observable<boolean> = this.avropService.avropIsLocked$;
handledareConfirmed$: Observable<boolean> = this.avropService.handledareIsConfirmed$;
avropIsSubmitted$: Observable<boolean> = this.avropService.avropIsSubmitted$;

View File

@@ -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);
}

View File

@@ -4,6 +4,7 @@
- **deltagare:** Now fetching data using "genomforandeReferens" instead of "sokandeId" to avoid wrong data. [TV-692](https://jira.arbetsformedlingen.se/browse/TV-692)
- **authorization:** Whenever the API throws a "403 Forbidden" error we now show an unauthorized message. [TV-695](https://jira.arbetsformedlingen.se/browse/TV-695)
- **avrop:** Fixed error-state on handledare select. [TV-699](https://jira.arbetsformedlingen.se/browse/TV-699)
## [2.0.0](https://bitbucket.arbetsformedlingen.se/projects/tea/repos/mina-sidor-fa-web/compare/diff?targetBranch=refs%2Ftags%2Fv1.5.0&sourceBranch=refs%2Ftags%2Fv2.0.0) (2021-09-24)