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

@@ -4,38 +4,40 @@
</p>
<digi-table af-size="s" *ngIf="deltagareHandelser$ | async; let deltagareHandelser">
<ng-container
*ngIf="deltagareHandelser.length > 0; else noEvents"
>
<table>
<caption class="msfa__a11y-sr-only">Lista med alla händelser för {{deltagare?.fullName}}</caption>
<thead>
<tr>
<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">Datum för händelse</th>
<th scope="col" class="deltagare-list-handelser__heading-row">Datum förklaring</th>
</tr>
</thead>
<tbody>
<ng-container
*ngIf="deltagareHandelser.length > 0; else noEvents"
>
<table>
<caption class="msfa__a11y-sr-only">Lista med alla händelser för {{deltagare?.fullName}}</caption>
<thead>
<tr>
<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">Effekt</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let handelse of deltagareHandelser;">
<td class="deltagare-list-handelser__table-cell">{{handelse.receivedDate | date}}</td>
<td class="deltagare-list-handelser__table-cell" *ngIf="!handelse.isAvbrott; else isAvbrottCell">
<tr *ngFor="let handelse of deltagareHandelser;">
<td class="deltagare-list-handelser__table-cell">{{handelse.receivedDate | date}}</td>
<td class="deltagare-list-handelser__table-cell" *ngIf="!handelse.isAvbrott; else isAvbrottCell">
{{handelse.description}}</td>
<td class="deltagare-list-handelser__table-cell">
<ng-container *ngIf="handelse.effectDescription && handelse.effectDate">
{{handelse.effectDescription}}: {{handelse.effectDate | date }}
</ng-container>
</td>
<ng-template #isAvbrottCell>
<td class="deltagare-list-handelser__avbrott-cell">
<msfa-icon [icon]="iconType.WARNING" size="l"></msfa-icon>
{{handelse.description}}</td>
<td class="deltagare-list-handelser__table-cell">{{handelse.tidpunkt | date }}</td>
<td class="deltagare-list-handelser__table-cell">{{handelse.tidpunktDescription}}</td>
<ng-template #isAvbrottCell>
<td class="deltagare-list-handelser__avbrott-cell">
<msfa-icon [icon]="iconType.WARNING" size="l"></msfa-icon>
{{handelse.description}}</td>
</ng-template>
</tr>
</ng-template>
</tr>
</tbody>
</table>
</ng-container>
</tbody>
</table>
</ng-container>
</digi-table>
</div>

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 {
description: string;
receivedDate: Date;
isAvbrott: boolean;
effectDate: Date;
effectDescription: string;
}
interface DeltagareHandelseApiResponse {
description: string;
receivedDate: Date;
isAvbrott: boolean;
@@ -6,6 +29,18 @@ export interface DeltagareHandelse {
tidpunktDescription: string;
}
export interface DeltagareHandelseApiResponse {
data: DeltagareHandelse[];
export interface DeltagareHandelserApiResponse {
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 { Injectable } from '@angular/core';
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 { map } from 'rxjs/operators';
@@ -18,11 +22,11 @@ export class DeltagareHandelserApiService {
}
return this.httpClient
.get<DeltagareHandelseApiResponse>(`${this._apiBaseUrl}/deltagare/${genomforandeReferens}/handelser`)
.get<DeltagareHandelserApiResponse>(`${this._apiBaseUrl}/deltagare/${genomforandeReferens}/handelser`)
.pipe(
map(({ data }) => {
if (data) {
return data;
return data.map(genomforandeHandelse => mapDeltagareHandelseApiResponse(genomforandeHandelse));
}
})
);

View File

@@ -13,7 +13,21 @@ const HANDELSER = [
'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) {
const handelser = [];