feature(Deltagarlista): Ny kolumn "Effekt" i genomförandehändelser (TV-703)

Squashed commit of the following:

commit 4ee981be8779922ce12e4a3158a11186a8666ebe
Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se>
Date:   Tue Sep 28 13:34:03 2021 +0200

    Ny kolymn under genomförandehändelser
This commit is contained in:
Daniel Appelgren
2021-09-28 13:47:26 +02:00
parent 3d30ac185c
commit be68be2846
4 changed files with 89 additions and 34 deletions

View File

@@ -13,8 +13,7 @@
<tr> <tr>
<th scope="col" class="deltagare-list-handelser__heading-row">Inkom</th> <th scope="col" class="deltagare-list-handelser__heading-row">Inkom</th>
<th scope="col" class="deltagare-list-handelser__heading-row">Händelse</th> <th scope="col" class="deltagare-list-handelser__heading-row">Händelse</th>
<th scope="col" class="deltagare-list-handelser__heading-row">Datum för händelse</th> <th scope="col" class="deltagare-list-handelser__heading-row">Effekt</th>
<th scope="col" class="deltagare-list-handelser__heading-row">Datum förklaring</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -23,8 +22,11 @@
<td class="deltagare-list-handelser__table-cell">{{handelse.receivedDate | date}}</td> <td class="deltagare-list-handelser__table-cell">{{handelse.receivedDate | date}}</td>
<td class="deltagare-list-handelser__table-cell" *ngIf="!handelse.isAvbrott; else isAvbrottCell"> <td class="deltagare-list-handelser__table-cell" *ngIf="!handelse.isAvbrott; else isAvbrottCell">
{{handelse.description}}</td> {{handelse.description}}</td>
<td class="deltagare-list-handelser__table-cell">{{handelse.tidpunkt | date }}</td> <td class="deltagare-list-handelser__table-cell">
<td class="deltagare-list-handelser__table-cell">{{handelse.tidpunktDescription}}</td> <ng-container *ngIf="handelse.effectDescription && handelse.effectDate">
{{handelse.effectDescription}}: {{handelse.effectDate | date }}
</ng-container>
</td>
<ng-template #isAvbrottCell> <ng-template #isAvbrottCell>
<td class="deltagare-list-handelser__avbrott-cell"> <td class="deltagare-list-handelser__avbrott-cell">
<msfa-icon [icon]="iconType.WARNING" size="l"></msfa-icon> <msfa-icon [icon]="iconType.WARNING" size="l"></msfa-icon>

View File

@@ -1,4 +1,27 @@
const GENOMFORANDEHANDELSE_EFFECT_MAP = {
Inrapporteringsdatum_GP: 'Inskickad datum',
Godkannandedatum_GP: 'Godkänd datum',
Avvisatdatum_GP: 'Ej godkänd datum',
Inrapporteringsdatum_PR: 'Inrapporterad datum',
Godkannandedatum_PR: 'Godkänd datum',
Avvisatdatum_PR: 'Ej godkänd datum',
Inrapporteringsdatum_SR: 'Inskickad datum',
Godkannandedatum_SR: 'Godkänd datum',
Avvisatdatum_SR: 'Ej godkänd datum',
Handlaggning_startad: 'Handläggning startad',
Andringsbeslutdatum: 'Ändringsbeslut datum',
Slut_avropsperiod: 'Nytt slutdatum',
};
export interface DeltagareHandelse { export interface DeltagareHandelse {
description: string;
receivedDate: Date;
isAvbrott: boolean;
effectDate: Date;
effectDescription: string;
}
interface DeltagareHandelseApiResponse {
description: string; description: string;
receivedDate: Date; receivedDate: Date;
isAvbrott: boolean; isAvbrott: boolean;
@@ -6,6 +29,18 @@ export interface DeltagareHandelse {
tidpunktDescription: string; tidpunktDescription: string;
} }
export interface DeltagareHandelseApiResponse { export interface DeltagareHandelserApiResponse {
data: DeltagareHandelse[]; data: DeltagareHandelseApiResponse[];
}
export function mapDeltagareHandelseApiResponse(
deltagareHandelseApiResponse: DeltagareHandelseApiResponse
): DeltagareHandelse {
const { description, receivedDate, isAvbrott } = deltagareHandelseApiResponse;
const effectDate = deltagareHandelseApiResponse.tidpunkt;
const effectDescription =
GENOMFORANDEHANDELSE_EFFECT_MAP[deltagareHandelseApiResponse.tidpunktDescription] ??
deltagareHandelseApiResponse.tidpunktDescription ??
'';
return { description, receivedDate, isAvbrott, effectDate, effectDescription };
} }

View File

@@ -1,7 +1,11 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { environment } from '@msfa-environment'; import { environment } from '@msfa-environment';
import { DeltagareHandelse, DeltagareHandelseApiResponse } from '@msfa-models/deltagare-handelse.model'; import {
DeltagareHandelse,
DeltagareHandelserApiResponse,
mapDeltagareHandelseApiResponse,
} from '@msfa-models/deltagare-handelse.model';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
@@ -18,11 +22,11 @@ export class DeltagareHandelserApiService {
} }
return this.httpClient return this.httpClient
.get<DeltagareHandelseApiResponse>(`${this._apiBaseUrl}/deltagare/${genomforandeReferens}/handelser`) .get<DeltagareHandelserApiResponse>(`${this._apiBaseUrl}/deltagare/${genomforandeReferens}/handelser`)
.pipe( .pipe(
map(({ data }) => { map(({ data }) => {
if (data) { if (data) {
return data; return data.map(genomforandeHandelse => mapDeltagareHandelseApiResponse(genomforandeHandelse));
} }
}) })
); );

View File

@@ -13,7 +13,21 @@ const HANDELSER = [
'Byte av leverantör bifall', 'Byte av leverantör bifall',
]; ];
const TIDPUNKT_DESCRIPTION = ['Handläggning startad', 'Inrapporteringsdatum slutredovisning']; const TIDPUNKT_DESCRIPTION = [
'Inrapporteringsdatum_GP',
'Godkannandedatum_GP',
'Avvisatdatum_GP',
'Inrapporteringsdatum_PR',
'Godkannandedatum_PR',
'Avvisatdatum_PR',
'Inrapporteringsdatum_SR',
'Godkannandedatum_SR',
'Avvisatdatum_SR',
'Handlaggning_startad',
'Andringsbeslutdatum',
'Slut_avropsperiod',
'',
];
function generateHandelser(amount = 10) { function generateHandelser(amount = 10) {
const handelser = []; const handelser = [];