Merge pull request #154 in TEA/mina-sidor-fa-web from bugfix/TV-709 to develop
Squashed commit of the following: commit 18214dbad7c905366b8996acd7b325239e0b7702 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 11:11:39 2021 +0200 TV-709 indent commit a696166e8db059b1926be16d730c59e448fc15cc Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 11:09:24 2021 +0200 TV-709 deleted personnummer and use ssn instead commit 3ecb095b0cb1384d463a6ef57aff8ee3989bab05 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 10:29:21 2021 +0200 TV-709 remove optional commit 073b96ce2cc11d3ec454edad6f0541314198f420 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 10:23:11 2021 +0200 TV-709 update endpoint for avvikelsereport, contact info refactoring
This commit is contained in:
@@ -8,13 +8,14 @@ import { ConfirmDialog } from '@msfa-enums/confirm-dialog.enum';
|
||||
import { DayOrPartOfDay } from '@msfa-enums/day-or-part-of-day.enum';
|
||||
import { FranvaroOrsaksKodEnum } from '@msfa-enums/franvaro-orsak-kod.enum';
|
||||
import { KandaOrsakerEnum } from '@msfa-enums/kanda-orsaker-kod.enum';
|
||||
import { ContactInformationCompact } from '@msfa-models/api/contact-information.response.model';
|
||||
import { AvvikelseAlternativ } from '@msfa-models/avvikelse-alternativ.model';
|
||||
import { Avvikelse } from '@msfa-models/avvikelse.model';
|
||||
import { ContactInformation } from '@msfa-models/contact-information.model';
|
||||
import { FragorForAvvikelser } from '@msfa-models/fragor-for-avvikelser.model';
|
||||
import { FranvaroAlternativ } from '@msfa-models/franvaro-alternativ.model';
|
||||
import { OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
||||
import { KandaAvvikelseKoder, OrsaksKoderFranvaro } from '@msfa-models/orsaks-koder-franvaro.model';
|
||||
import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service';
|
||||
import {
|
||||
AnnanKandOrsakeIsRequiredCheck,
|
||||
DateIsRequiredCheck,
|
||||
@@ -52,9 +53,9 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
||||
private _showSuccessNotification$ = new BehaviorSubject<boolean>(false);
|
||||
private _showDangerNotification$ = new BehaviorSubject<boolean>(false);
|
||||
|
||||
contactInformation$: Observable<ContactInformationCompact> = this.activatedRoute.params.pipe(
|
||||
contactInformation$: Observable<ContactInformation> = this.activatedRoute.params.pipe(
|
||||
switchMap(({ genomforandeReferens }) =>
|
||||
this.deltagareAvvikelseService.getContactInformationCompact$(genomforandeReferens)
|
||||
this.deltagareApiService.fetchContactInformation$(genomforandeReferens)
|
||||
)
|
||||
);
|
||||
franvaroOrsaker$: Observable<OrsaksKoderFranvaro[]>;
|
||||
@@ -62,7 +63,7 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
||||
andraKandaOrsaker$: Observable<KandaAvvikelseKoder[]>;
|
||||
fragor1$: Observable<FragorForAvvikelser[]>;
|
||||
fragor2$: Observable<FragorForAvvikelser[]>;
|
||||
contactInformation: ContactInformationCompact;
|
||||
contactInformation: ContactInformation;
|
||||
sizeTextArea: FormTextareaSize.S;
|
||||
todayDate = new Date().toISOString().slice(0, 10);
|
||||
avvikelseAlternatives: RadiobuttonModel[] = avvikelseAlternatives;
|
||||
@@ -77,9 +78,10 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private deltagareAvvikelseService: DeltagareAvvikelseService,
|
||||
private deltagareApiService: DeltagareApiService,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute
|
||||
) {}
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.contactInformation$.pipe(first()).subscribe(contactInformation => {
|
||||
@@ -171,9 +173,9 @@ export class DeltagareAvvikelseComponent implements OnInit {
|
||||
const postAvvikelse: Avvikelse = {
|
||||
datum_for_rapportering: this.todayDate,
|
||||
arbetssokande: {
|
||||
personnummer: this.contactInformation.personnummer.toString(),
|
||||
fornamn: this.contactInformation.fornamn.toString(),
|
||||
efternamn: this.contactInformation.efternamn.toString(),
|
||||
personnummer: this.contactInformation.ssn,
|
||||
fornamn: this.contactInformation.firstName,
|
||||
efternamn: this.contactInformation.lastName,
|
||||
},
|
||||
sokandeId: +this.activatedRoute.snapshot.params['genomforandeReferens'],
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { FranvaroOrsaksKodEnum } from '@msfa-enums/franvaro-orsak-kod.enum';
|
||||
import { ContactInformationCompact } from '@msfa-models/api/contact-information.response.model';
|
||||
import { Avvikelse } from '@msfa-models/avvikelse.model';
|
||||
import { FragorForAvvikelser } from '@msfa-models/fragor-for-avvikelser.model';
|
||||
import { OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
||||
@@ -39,10 +38,6 @@ export class DeltagareAvvikelseService {
|
||||
return this.avvikelseApiService.createAvvikelse$(avvikelse, alternative);
|
||||
}
|
||||
|
||||
public getContactInformationCompact$(id: number): Observable<ContactInformationCompact> {
|
||||
return this.avvikelseApiService.getContactInformation$(id);
|
||||
}
|
||||
|
||||
private sortOrsaksKoder(orsaksKoder: OrsaksKoderFranvaro[]): OrsaksKoderFranvaro[] {
|
||||
orsaksKoder.map(orsak => {
|
||||
if (+orsak.value == FranvaroOrsaksKodEnum.Sjuk) {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<p class="report-layout__description">{{description}}</p>
|
||||
<div class="report-layout__deltagare-info">
|
||||
<h2>{{reportSubTitle}}</h2>
|
||||
<div class="report-layout__name">{{contactInformation.fornamn + ' ' + contactInformation.efternamn}}</div>
|
||||
<div class="report-layout__name">{{contactInformation.firstName + ' ' + contactInformation.lastName}}</div>
|
||||
<div class="report-layout__personnummer">
|
||||
<span>Personnummer:</span>
|
||||
<msfa-hide-text
|
||||
symbols="********-****"
|
||||
[changingText]="contactInformation.personnummer"
|
||||
[changingText]="contactInformation.ssn"
|
||||
ariaLabelType="Personnumer"
|
||||
></msfa-hide-text>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ContactInformationCompact } from '@msfa-models/api/contact-information.response.model';
|
||||
import { ContactInformation } from '@msfa-models/contact-information.model';
|
||||
import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { DeltagareAvvikelseService } from '../../pages/deltagare-report/services/deltagare-avvikelse.service';
|
||||
|
||||
@Component({
|
||||
selector: 'msfa-report-layout',
|
||||
@@ -24,11 +24,11 @@ export class ReportLayoutComponent {
|
||||
@Input() showSuccessNotification = false;
|
||||
@Input() showDangerNotification = false;
|
||||
|
||||
contactInformation$: Observable<ContactInformationCompact> = this.activatedRoute.params.pipe(
|
||||
contactInformation$: Observable<ContactInformation> = this.activatedRoute.params.pipe(
|
||||
switchMap(({ genomforandeReferens }) =>
|
||||
this.deltagareAvvikelseService.getContactInformationCompact$(genomforandeReferens)
|
||||
this.deltagareApiService.fetchContactInformation$(genomforandeReferens)
|
||||
)
|
||||
);
|
||||
|
||||
constructor(private deltagareAvvikelseService: DeltagareAvvikelseService, private activatedRoute: ActivatedRoute) {}
|
||||
constructor(private deltagareApiService: DeltagareApiService, private activatedRoute: ActivatedRoute) { }
|
||||
}
|
||||
|
||||
@@ -10,18 +10,3 @@ export interface ContactInformationResponse {
|
||||
adresser: AddressResponse[];
|
||||
}
|
||||
|
||||
export interface ContactInformationCompact {
|
||||
fornamn: string;
|
||||
efternamn: string;
|
||||
personnummer: string;
|
||||
}
|
||||
|
||||
export function mapResponseToContactInformationCompact(data: ContactInformationResponse): ContactInformationCompact {
|
||||
const { fornamn, efternamn, personnummer } = data;
|
||||
|
||||
return {
|
||||
fornamn,
|
||||
efternamn,
|
||||
personnummer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,10 @@ import { Injectable } from '@angular/core';
|
||||
import { Alternative } from '@msfa-enums/alternative.enum';
|
||||
import { ErrorType } from '@msfa-enums/error-type.enum';
|
||||
import { environment } from '@msfa-environment';
|
||||
|
||||
import {
|
||||
ContactInformationCompact,
|
||||
ContactInformationResponse,
|
||||
mapResponseToContactInformationCompact
|
||||
} from '@msfa-models/api/contact-information.response.model';
|
||||
import { FragorForAvvikelserResponse } from '@msfa-models/api/fragor-for-avvikelser.response';
|
||||
import { KandaAvvikelseKoderResponse } from '@msfa-models/api/kanda-avvikelse-koder.response.model';
|
||||
import { OrsaksKoderAvvikelseResponse } from '@msfa-models/api/orsaks-koder-avvikelse.response.model';
|
||||
import { Avvikelse, AvvikelseRequestData, mapAvvikelseRequestDataToAvvikelse } from '@msfa-models/avvikelse.model';
|
||||
import { errorToCustomError } from '@msfa-models/error/custom-error';
|
||||
import { FragorForAvvikelser, mapResponseToFragorForAvvikelser } from '@msfa-models/fragor-for-avvikelser.model';
|
||||
import { mapResponseToOrsaksKoderAvvikelse, OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
||||
import {
|
||||
@@ -23,7 +16,7 @@ import {
|
||||
OrsaksKoderFranvaro
|
||||
} from '@msfa-models/orsaks-koder-franvaro.model';
|
||||
import { ErrorService } from '@msfa-services/error.service';
|
||||
import { Observable, of, throwError } from 'rxjs';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError, filter, map, take } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@@ -62,18 +55,6 @@ export class AvvikelseApiService {
|
||||
)
|
||||
}
|
||||
|
||||
public getContactInformation$(id: number): Observable<ContactInformationCompact> {
|
||||
return this.httpClient.get<{ data: ContactInformationResponse }>(`${this._apiBaseUrl}/deltagare/${id}/contact`).pipe(
|
||||
filter(response => !!response?.data),
|
||||
map(({ data }) => mapResponseToContactInformationCompact(data),
|
||||
catchError(error => {
|
||||
this.errorService.add(errorToCustomError(error));
|
||||
return of({});
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
public createAvvikelse$(avvikelse: Avvikelse, alternative: string): Observable<Avvikelse> {
|
||||
|
||||
return this.httpClient
|
||||
@@ -103,7 +84,3 @@ export class AvvikelseApiService {
|
||||
|
||||
constructor(private httpClient: HttpClient, private errorService: ErrorService) { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user