fix(deltagare): Changed the way addresses are handled. Now we show address-type even if no address is available. (TV-712)
Squashed commit of the following: commit f49d49910dc335693f9c7825abbee59459f5d88b Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Thu Sep 30 08:43:15 2021 +0200 Changed address handling inside contactinformation for deltagare
This commit is contained in:
@@ -12,7 +12,21 @@
|
||||
ariaLabelType="personnummer"
|
||||
></msfa-hide-text>
|
||||
</dd>
|
||||
<ng-container *ngFor="let address of contactInformation.addresses">
|
||||
<dt>Folkbokföringsadress</dt>
|
||||
<dd *ngIf="contactInformation.officialAddress as address; else emptyDD">
|
||||
<address>
|
||||
{{ address.street }}<br />
|
||||
{{ address.postalCode }} {{ address.city }}
|
||||
</address>
|
||||
</dd>
|
||||
<dt>Postadress</dt>
|
||||
<dd *ngIf="contactInformation.postalAddress as address; else emptyDD">
|
||||
<address>
|
||||
{{ address.street }}<br />
|
||||
{{ address.postalCode }} {{ address.city }}
|
||||
</address>
|
||||
</dd>
|
||||
<!-- <ng-container *ngFor="let address of contactInformation.addresses">
|
||||
<dt>{{address.type}}:</dt>
|
||||
<dd>
|
||||
<address>
|
||||
@@ -20,7 +34,7 @@
|
||||
{{ address.postalCode }} {{ address.city }}
|
||||
</address>
|
||||
</dd>
|
||||
</ng-container>
|
||||
</ng-container> -->
|
||||
<dt>Telefon:</dt>
|
||||
<ng-container *ngIf="contactInformation.phoneNumbers?.length; else emptyDD">
|
||||
<ng-container *ngFor="let phoneNumber of contactInformation.phoneNumbers">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AddressType, getAddressType } from '@msfa-enums/address-type.enum';
|
||||
import { mapStringToSsn } from '@msfa-utils/map-string-to-ssn.util';
|
||||
import { Address, mapResponseToAddress } from './address.model';
|
||||
import { ContactInformationResponse } from './api/contact-information.response.model';
|
||||
@@ -10,11 +11,15 @@ export interface ContactInformation {
|
||||
ssn: string;
|
||||
email: string;
|
||||
phoneNumbers: PhoneNumber[];
|
||||
addresses: Address[];
|
||||
// addresses: Address[];
|
||||
officialAddress: Address;
|
||||
postalAddress: Address;
|
||||
}
|
||||
|
||||
export function mapResponseToContactInformation(data: ContactInformationResponse): ContactInformation {
|
||||
const { fornamn, efternamn, personnummer, epost, telekomadresser, adresser } = data;
|
||||
const officialAddress = adresser?.find(({ adresstyp }) => getAddressType(adresstyp) === AddressType.OFFICIAL);
|
||||
const postalAddress = adresser?.find(({ adresstyp }) => getAddressType(adresstyp) === AddressType.POSTAL);
|
||||
|
||||
return {
|
||||
firstName: fornamn || '',
|
||||
@@ -27,6 +32,8 @@ export function mapResponseToContactInformation(data: ContactInformationResponse
|
||||
.filter(phoneNumber => phoneNumber.landskod && phoneNumber.nummer_utan_inledande_nolla)
|
||||
.map(phoneNumber => mapResponseToPhoneNumber(phoneNumber))
|
||||
: [],
|
||||
addresses: adresser ? adresser.map(address => mapResponseToAddress(address)) : null,
|
||||
officialAddress: officialAddress ? mapResponseToAddress(officialAddress) : null,
|
||||
postalAddress: postalAddress ? mapResponseToAddress(postalAddress) : null,
|
||||
// addresses: adresser ? adresser.map(address => mapResponseToAddress(address)) : null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,7 +32,9 @@ export interface Deltagare {
|
||||
ssn: string;
|
||||
email: string;
|
||||
phoneNumbers: PhoneNumber[];
|
||||
addresses: Address[];
|
||||
officialAddress: Address;
|
||||
postalAddress: Address;
|
||||
// addresses: Address[];
|
||||
driversLicense: DriversLicense;
|
||||
educations: Education[];
|
||||
highestEducation: HighestEducation;
|
||||
|
||||
Reference in New Issue
Block a user