Updated ciam prod client-id

This commit is contained in:
Erik Tiekstra
2021-09-09 10:51:32 +02:00
parent 809d67e4e8
commit 7a60a39b1e
5 changed files with 99 additions and 102 deletions

View File

@@ -36,80 +36,82 @@
></digi-ng-progress-progressbar>
</div>
</div>
<div class="avrop__content">
<div class="avrop__filter" *ngIf="currentStep === 1">
<h3>Filter</h3>
<msfa-avrop-filters></msfa-avrop-filters>
</div>
<div class="avrop__select-handledare" *ngIf="currentStep === 2">
<ng-container *ngIf="availableHandledare$ | async as availableHandledare; else loadingRef">
<digi-form-select
*ngIf="availableHandledare?.length; else noAvailabeHandledare"
af-label="Välj handledare att tilldela"
af-placeholder="Välj handledare"
[afRequired]="true"
(afOnChange)="changeHandledare($event.detail)"
>
<option
*ngFor="let availableHandledare of availableHandledare"
[value]="availableHandledare.ciamUserId"
<ng-container *ngIf="avropData$ | async as avropData">
<div class="avrop__content" *ngIf="avropData.data.length; else noAvrop">
<div class="avrop__filter" *ngIf="currentStep === 1">
<h3>Filter</h3>
<msfa-avrop-filters></msfa-avrop-filters>
</div>
<div class="avrop__select-handledare" *ngIf="currentStep === 2">
<ng-container *ngIf="availableHandledare$ | async as availableHandledare; else loadingRef">
<digi-form-select
*ngIf="availableHandledare?.length; else noAvailabeHandledare"
af-label="Välj handledare att tilldela"
af-placeholder="Välj handledare"
[afRequired]="true"
(afOnChange)="changeHandledare($event.detail)"
>
{{ availableHandledare.fullName }}
</option>
</digi-form-select>
<option
*ngFor="let availableHandledare of availableHandledare"
[value]="availableHandledare.ciamUserId"
>
{{ availableHandledare.fullName }}
</option>
</digi-form-select>
<ng-template #noAvailableHandledare>
<p>Inga handledare har behörighet till markerade deltagare</p>
</ng-template>
</ng-container>
<ng-template #noAvailableHandledare>
<p>Inga handledare har behörighet till markerade deltagare</p>
</ng-template>
</ng-container>
</div>
<h3>Välj deltagare att tilldela handledare</h3>
<msfa-avrop-list
[availableAvrop]="avropData.data"
[paginationMeta]="avropData.meta"
[selectedAvrop]="selectedAvrop$ | async"
[isLocked]="avropIsLocked$ | async"
[isSubmitted]="avropIsSubmitted$ | async"
[handledare]="selectedHandledare$ | async"
[handledareConfirmed]="handledareConfirmed$ | async"
(selectionChanged)="updateSelectedAvrop($event)"
(paginated)="setNewPage($event)"
></msfa-avrop-list>
</div>
<h3>Välj deltagare att tilldela handledare</h3>
<msfa-avrop-list
*ngIf="avropData$ | async as avropData"
[availableAvrop]="avropData.data"
[paginationMeta]="avropData.meta"
[selectedAvrop]="selectedAvrop$ | async"
[isLocked]="avropIsLocked$ | async"
[isSubmitted]="avropIsSubmitted$ | async"
[handledare]="selectedHandledare$ | async"
[handledareConfirmed]="handledareConfirmed$ | async"
(selectionChanged)="updateSelectedAvrop($event)"
(paginated)="setNewPage($event)"
></msfa-avrop-list>
</div>
<div class="avrop__footer" [ngSwitch]="currentStep">
<digi-notification-alert
*ngIf="error$ | async as error"
af-heading="Felmeddelande"
af-variation="danger"
af-closeable="true"
(afOnClose)="resetError()"
>
<p>{{error}}</p>
</digi-notification-alert>
<div class="avrop__footer" *ngIf="avropData.data.length" [ngSwitch]="currentStep">
<digi-notification-alert
*ngIf="error$ | async as error"
af-heading="Felmeddelande"
af-variation="danger"
af-closeable="true"
(afOnClose)="resetError()"
>
<p>{{error}}</p>
</digi-notification-alert>
<div class="avrop__cta-wrapper">
<ng-container *ngSwitchCase="1">
<digi-button af-size="m" (afOnClick)="lockSelectedAvrop()">Nästa</digi-button>
</ng-container>
<ng-container *ngSwitchCase="2">
<digi-button af-variation="secondary" af-size="m" (afOnClick)="unlockSelectedAvrop()"
>Tillbaka</digi-button
>
<digi-button af-size="m" (afOnClick)="confirmHandledare()">Tilldela</digi-button>
</ng-container>
<ng-container *ngSwitchCase="3">
<digi-button af-variation="secondary" af-size="m" (afOnClick)="unconfirmHandledare()"
>Tillbaka</digi-button
>
<digi-button af-size="m" (afOnClick)="save()">Bekräfta tilldelning</digi-button>
</ng-container>
<ng-container *ngSwitchCase="4">
<digi-button af-size="m" (afOnClick)="returnToStep1()">Tillbaka till nya deltagare</digi-button>
</ng-container>
<div class="avrop__cta-wrapper">
<ng-container *ngSwitchCase="1">
<digi-button af-size="m" (afOnClick)="lockSelectedAvrop()">Nästa</digi-button>
</ng-container>
<ng-container *ngSwitchCase="2">
<digi-button af-variation="secondary" af-size="m" (afOnClick)="unlockSelectedAvrop()"
>Tillbaka</digi-button
>
<digi-button af-size="m" (afOnClick)="confirmHandledare()">Tilldela</digi-button>
</ng-container>
<ng-container *ngSwitchCase="3">
<digi-button af-variation="secondary" af-size="m" (afOnClick)="unconfirmHandledare()"
>Tillbaka</digi-button
>
<digi-button af-size="m" (afOnClick)="save()">Bekräfta tilldelning</digi-button>
</ng-container>
<ng-container *ngSwitchCase="4">
<digi-button af-size="m" (afOnClick)="returnToStep1()">Tillbaka till nya deltagare</digi-button>
</ng-container>
</div>
</div>
</div>
</ng-container>
</main>
</digi-typography>
</section>
@@ -120,4 +122,7 @@
<ng-template #noAvailabeHandledare>
<!-- lägg in lämpligt innehåll -->
</ng-template>
<ng-template #noAvrop>
<p>Det finns för tillfället inga nya deltagare att tilldela.</p>
</ng-template>
</msfa-layout>

View File

@@ -1,3 +1,4 @@
import { mapStringToSsn } from '@msfa-utils/map-string-to-ssn.util';
import { Address, mapResponseToAddress } from './address.model';
import { ContactInformationResponse } from './api/contact-information.response.model';
import { mapResponseToPhoneNumber, PhoneNumber } from './phonenumber.model';
@@ -12,23 +13,15 @@ export interface ContactInformation {
addresses: Address[];
}
export function mapResponseToContactInformation(contactInformation: ContactInformationResponse): ContactInformation {
export function mapResponseToContactInformation(data: ContactInformationResponse): ContactInformation {
const { fornamn, efternamn, personnummer, epost, telekomadresser, adresser } = data;
return {
firstName: contactInformation.fornamn,
lastName: contactInformation.efternamn,
fullName: `${contactInformation.fornamn} ${contactInformation.efternamn}`,
ssn: `${contactInformation.personnummer.substring(
0,
contactInformation.personnummer.length - 4
)}-${contactInformation.personnummer.substring(contactInformation.personnummer.length - 4)}`,
email: contactInformation.epost,
phoneNumbers: contactInformation.telekomadresser
? contactInformation.telekomadresser.map(phoneNumber => {
return mapResponseToPhoneNumber(phoneNumber);
})
: [],
addresses: contactInformation.adresser
? contactInformation.adresser.map(address => mapResponseToAddress(address))
: null,
firstName: fornamn || '',
lastName: efternamn || '',
fullName: fornamn && efternamn ? `${fornamn} ${efternamn}` : '',
ssn: personnummer ? mapStringToSsn(personnummer) : '',
email: epost || '',
phoneNumbers: telekomadresser ? telekomadresser.map(phoneNumber => mapResponseToPhoneNumber(phoneNumber)) : [],
addresses: adresser ? adresser.map(address => mapResponseToAddress(address)) : null,
};
}

View File

@@ -1,4 +1,5 @@
import { RoleEnum } from '@msfa-enums/role.enum';
import { mapStringToSsn } from '@msfa-utils/map-string-to-ssn.util';
import { EmployeeCompactResponse, EmployeeResponse } from './api/employee.response.model';
import { EmployeeTjanst, mapResponseToEmployeeTjanst } from './employee-tjanst.model';
import {
@@ -7,8 +8,6 @@ import {
} from './employee-utforande-verksamhet.model';
import { PaginationMeta } from './pagination-meta.model';
const CURRENT_YEAR = new Date().getFullYear().toString().slice(2, 4);
export interface EmployeeCompact {
id: string;
fullName: string;
@@ -16,7 +15,6 @@ export interface EmployeeCompact {
allaUtforandeVerksamheter: boolean;
utforandeVerksamheter: string[];
}
export interface Employee {
id: string;
firstName: string;
@@ -35,18 +33,6 @@ export interface EmployeesData {
meta: PaginationMeta;
}
function mapResponseToSsn(ssn: string): string {
ssn = ssn.replaceAll('-', '');
if (ssn.length === 10) {
const century = +CURRENT_YEAR - +ssn.slice(0, 2) > 0 ? '20' : '19';
ssn = ssn.padStart(12, century);
}
if (ssn.length === 12) {
ssn = `${ssn.slice(0, 8)}-${ssn.slice(8, 12)}`;
}
return ssn;
}
export function mapResponseToEmployeeCompact(data: EmployeeCompactResponse): EmployeeCompact {
const { ciamUserId, name, tjanst, allaUtforandeVerksamheter, utforandeVerksamhet } = data;
return {
@@ -76,7 +62,7 @@ export function mapResponseToEmployee(data: EmployeeResponse): Employee {
lastName,
fullName: `${firstName} ${lastName}`,
email,
ssn: ssn ? mapResponseToSsn(ssn) : null,
ssn: ssn ? mapStringToSsn(ssn) : null,
roles: roles || [],
tjanster: tjanster?.map(tjanst => mapResponseToEmployeeTjanst(tjanst)),
allaUtforandeVerksamheter,

View File

@@ -0,0 +1,13 @@
const CURRENT_YEAR = new Date().getFullYear().toString().slice(2, 4);
export function mapStringToSsn(ssn: string): string {
ssn = ssn.replaceAll('-', '');
if (ssn.length === 10) {
const century = +CURRENT_YEAR - +ssn.slice(0, 2) > 0 ? '20' : '19';
ssn = ssn.padStart(12, century);
}
if (ssn.length === 12) {
ssn = `${ssn.slice(0, 8)}-${ssn.slice(8, 12)}`;
}
return ssn;
}

View File

@@ -2,7 +2,7 @@ import { Environment } from '@msfa-models/environment.model';
export const environment: Environment = {
environment: 'prod',
clientId: '',
clientId: '71010833-e445-4bbc-926a-775247b7a6e3',
loginUrl: 'https://ciam.arbetsformedlingen.se/uas/oauth2/authorization?response_type=code&scope=openid',
logoutUrl: 'https://ciam.arbetsformedlingen.se/uas/logout',
production: true,