feat(slutredovisning): Added denial motivation to Slutredovisning. (TV-941)

Merge in TEA/mina-sidor-fa-web from feature/TV-941-report-denial-motivation to develop

Squashed commit of the following:

commit 6a6c60efc0f9b6fc3514f30237eefe1fa9bb8278
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Fri Dec 3 07:10:49 2021 +0100

    Updated after PR

commit bbf5d8d4e32b7055311d96421291fff36f62e30f
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Thu Dec 2 08:49:23 2021 +0100

    Updated after PR

commit 5c1968029e86312a54dc082ff3fd28593178e29d
Merge: 1e4d6a70 395452e6
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Thu Dec 2 08:47:10 2021 +0100

    Merge branch 'develop' into feature/TV-941-report-denial-motivation

commit 1e4d6a7093271353a99b75d3519ff1463b8f36dd
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Nov 30 14:29:36 2021 +0100

    Removed lorem text

commit efdea175a377956cc7f3b3c80230fa10d8ef5ec3
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Nov 30 14:15:47 2021 +0100

    Added motivation text to reports list and slutredovisning view

commit c47e1c97e65f5ef43ee55b9656c8a206050855c3
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Nov 30 12:29:17 2021 +0100

    Added motivation to händelser list
This commit is contained in:
Erik Tiekstra
2021-12-03 14:31:15 +01:00
parent 938014abcf
commit 57113f45f3
21 changed files with 246 additions and 108 deletions

View File

@@ -20,6 +20,17 @@
{{ report.date | date:'shortTime' }} {{ report.date | date:'shortTime' }}
</td> </td>
<td>{{ report.status }}</td> <td>{{ report.status }}</td>
<td>
<digi-button
*ngIf="report.motivation"
af-variation="tertiary"
af-size="s"
(click)="openMotivationDialog(report)"
>
<ui-icon slot="icon" uiType="info"></ui-icon>
Motivering till beslut
</digi-button>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -36,3 +47,17 @@
af-result-name="rapporter" af-result-name="rapporter"
></digi-navigation-pagination> ></digi-navigation-pagination>
</div> </div>
<digi-ng-dialog
*ngIf="activeReportMotivation"
[afActive]="activeReportMotivation"
(afOnPrimaryClick)="closeMotivationDialog()"
(afOnInactive)="closeMotivationDialog()"
[afHeading]="'Motivering till beslut: ' + activeReportMotivation.type + ' ' + activeReportMotivation.status.toLowerCase()"
afHeadingLevel="h2"
afPrimaryButtonText="Stäng"
>
<h3 class="reports-list__sub-heading">{{deltagareName}}</h3>
<p>Genomförandereferens: <strong>{{activeReportMotivation.genomforandeReferens}}</strong></p>
<p>{{activeReportMotivation.motivation}}</p>
</digi-ng-dialog>

View File

@@ -1,6 +1,11 @@
@import 'variables/gutters'; @import 'variables/gutters';
.reports-list { .reports-list {
&__sub-heading {
margin-top: 0;
font-size: var(--digi--typography--font-size--h2--desktop) !important;
font-weight: var(--digi--typography--font-weight) !important;
}
&__pagination { &__pagination {
display: block; display: block;
margin-top: var(--digi--layout--gutter); margin-top: var(--digi--layout--gutter);

View File

@@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from
import { ReportType } from '@msfa-enums/report-type.enum'; import { ReportType } from '@msfa-enums/report-type.enum';
import { PaginationMeta } from '@msfa-models/pagination-meta.model'; import { PaginationMeta } from '@msfa-models/pagination-meta.model';
import { Report } from '@msfa-models/report.model'; import { Report } from '@msfa-models/report.model';
import { BehaviorSubject } from 'rxjs';
@Component({ @Component({
selector: 'msfa-reports-list', selector: 'msfa-reports-list',
@@ -12,7 +13,9 @@ import { Report } from '@msfa-models/report.model';
export class ReportsListComponent { export class ReportsListComponent {
@Input() reports: Report[]; @Input() reports: Report[];
@Input() paginationMeta: PaginationMeta; @Input() paginationMeta: PaginationMeta;
@Input() deltagareName?: string;
@Output() paginated = new EventEmitter<number>(); @Output() paginated = new EventEmitter<number>();
private _activeReportMotivation$ = new BehaviorSubject<Report | null>(null);
columnHeaders: { label: string; key: keyof Report }[] = [ columnHeaders: { label: string; key: keyof Report }[] = [
{ {
@@ -27,8 +30,16 @@ export class ReportsListComponent {
label: 'Status', label: 'Status',
key: 'status', key: 'status',
}, },
{
label: 'Motivering',
key: 'motivation',
},
]; ];
get activeReportMotivation(): Report {
return this._activeReportMotivation$.getValue();
}
get currentPage(): number { get currentPage(): number {
return this.paginationMeta?.page; return this.paginationMeta?.page;
} }
@@ -75,4 +86,12 @@ export class ReportsListComponent {
emitNewPage(page: number): void { emitNewPage(page: number): void {
this.paginated.emit(page); this.paginated.emit(page);
} }
openMotivationDialog(report: Report): void {
this._activeReportMotivation$.next(report);
}
closeMotivationDialog(): void {
this._activeReportMotivation$.next(null);
}
} }

View File

@@ -1,13 +1,15 @@
import { DigiNgDialogModule } from '@af/digi-ng/_dialog/dialog';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { LocalDatePipeModule } from '@msfa-shared/pipes/local-date/local-date.module'; import { LocalDatePipeModule } from '@msfa-shared/pipes/local-date/local-date.module';
import { UiIconModule } from '@ui/icon/icon.module';
import { ReportsListComponent } from './reports-list.component'; import { ReportsListComponent } from './reports-list.component';
@NgModule({ @NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ReportsListComponent], declarations: [ReportsListComponent],
imports: [CommonModule, RouterModule, LocalDatePipeModule], imports: [CommonModule, RouterModule, LocalDatePipeModule, DigiNgDialogModule, UiIconModule],
exports: [ReportsListComponent], exports: [ReportsListComponent],
}) })
export class ReportsListModule {} export class ReportsListModule {}

View File

@@ -44,6 +44,7 @@
<h3>Inskickade rapporter</h3> <h3>Inskickade rapporter</h3>
<msfa-reports-list <msfa-reports-list
*ngIf="reportsData.data.length; else noReports" *ngIf="reportsData.data.length; else noReports"
[deltagareName]="deltagareName"
[reports]="reportsData.data" [reports]="reportsData.data"
[paginationMeta]="reportsData.meta" [paginationMeta]="reportsData.meta"
(paginated)="setNewPage($event)" (paginated)="setNewPage($event)"

View File

@@ -1,13 +1,13 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Feature } from '@msfa-enums/feature.enum'; import { Feature } from '@msfa-enums/feature.enum';
import { environment } from '@msfa-environment'; import { environment } from '@msfa-environment';
import { PaginationParams } from '@msfa-models/api/params.model'; import { PaginationParams } from '@msfa-models/api/params.model';
import { ReportsData } from '@msfa-models/report.model'; import { ReportsData } from '@msfa-models/report.model';
import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service'; import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service';
import { UiLinkButtonType } from '@ui/link-button/link-button-type.enum';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
import { map, shareReplay, switchMap } from 'rxjs/operators'; import { map, shareReplay, switchMap } from 'rxjs/operators';
import { UiLinkButtonType } from '@ui/link-button/link-button-type.enum';
@Component({ @Component({
selector: 'msfa-deltagare-tab-reports', selector: 'msfa-deltagare-tab-reports',
@@ -16,6 +16,7 @@ import { UiLinkButtonType } from '@ui/link-button/link-button-type.enum';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class DeltagareTabReportsComponent { export class DeltagareTabReportsComponent {
@Input() deltagareName: string;
UiLinkButtonType = UiLinkButtonType; UiLinkButtonType = UiLinkButtonType;
genomforandereferens$: Observable<number> = this.activatedRoute.params.pipe( genomforandereferens$: Observable<number> = this.activatedRoute.params.pipe(

View File

@@ -29,7 +29,10 @@
af-id="deltagare-card-reports" af-id="deltagare-card-reports"
*ngIf="reportingTabVisible" *ngIf="reportingTabVisible"
> >
<msfa-deltagare-tab-reports *ngIf="activeTab === '1'"></msfa-deltagare-tab-reports> <msfa-deltagare-tab-reports
*ngIf="activeTab === '1'"
[deltagareName]="contactInformation.fullName"
></msfa-deltagare-tab-reports>
</digi-navigation-tab> </digi-navigation-tab>
<digi-navigation-tab <digi-navigation-tab

View File

@@ -4,10 +4,10 @@ import { DeltagareAvrop } from '@msfa-models/avrop.model';
import { CustomError } from '@msfa-models/error/custom-error'; import { CustomError } from '@msfa-models/error/custom-error';
import { MainOccupation, Slutredovisning } from '@msfa-models/slutredovisning.model'; import { MainOccupation, Slutredovisning } from '@msfa-models/slutredovisning.model';
import { BehaviorSubject, Observable, of } from 'rxjs'; import { BehaviorSubject, Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { SlutredovisningFormData } from '../models/slutredovisning-form-data.model'; import { SlutredovisningFormData } from '../models/slutredovisning-form-data.model';
import { SlutredovisningFormService } from '../slutredovisning-form.service'; import { SlutredovisningFormService } from '../slutredovisning-form.service';
import { slutredovisningFormDataToSlutredovisningRequest } from '../utils/forms-to-slutredovisning-form-data'; import { slutredovisningFormDataToSlutredovisningRequest } from '../utils/forms-to-slutredovisning-form-data';
import { map } from 'rxjs/operators';
@Component({ @Component({
selector: 'msfa-slutredovisning-form-step3', selector: 'msfa-slutredovisning-form-step3',
@@ -24,7 +24,7 @@ export class SlutredovisningFormStep3Component implements OnInit {
submitError$ = new BehaviorSubject<CustomError>(null); submitError$ = new BehaviorSubject<CustomError>(null);
submittedDate$ = new BehaviorSubject<Date | null>(null); submittedDate$ = new BehaviorSubject<Date | null>(null);
slutredovisning$: Observable<Slutredovisning>; slutredovisning$: Observable<SlutredovisningFormData>;
goBack(): void { goBack(): void {
this.backClick.emit(); this.backClick.emit();

View File

@@ -37,7 +37,7 @@
</msfa-layout> </msfa-layout>
<ng-template #skeletonRef> <ng-template #skeletonRef>
<ui-skeleton [uiCount]="3" uiText="Laddar Gemensam planering"></ui-skeleton> <ui-skeleton [uiCount]="3" uiText="Laddar Periodisk redovisning"></ui-skeleton>
</ng-template> </ng-template>
<ng-template #loadingRef> <ng-template #loadingRef>

View File

@@ -1,13 +1,21 @@
<msfa-layout> <msfa-layout>
<msfa-report-layout *ngIf="avrop$ | async as avrop; else skeletonRef" reportTitle="Slutredovisning" [avrop]="avrop"> <msfa-report-layout *ngIf="avrop$ | async as avrop; else skeletonRef" reportTitle="Slutredovisning" [avrop]="avrop">
<div class="slutredovisning-view" *ngIf="slutredovisning$ | async as slutredovisning; else loadingRef">
<digi-notification-alert *ngIf="slutredovisning.motivation" af-variation="danger">
<p>{{slutredovisning.motivation}}</p>
</digi-notification-alert>
<msfa-slutredovisning-view-description-list <msfa-slutredovisning-view-description-list
[slutredovisning]="slutredovisning$ | async" [slutredovisning]="slutredovisning"
></msfa-slutredovisning-view-description-list> ></msfa-slutredovisning-view-description-list>
<footer class="slutredovisning-view__footer">
<ui-back-link uiRouterLink="../../">Tillbaka till deltagaren</ui-back-link>
</footer>
</div>
</msfa-report-layout> </msfa-report-layout>
</msfa-layout> </msfa-layout>
<ng-template #skeletonRef> <ng-template #skeletonRef>
<ui-skeleton [uiCount]="3" uiText="Laddar Gemensam planering"></ui-skeleton> <ui-skeleton [uiCount]="3" uiText="Laddar Slutredovisning"></ui-skeleton>
</ng-template> </ng-template>
<ng-template #loadingRef> <ng-template #loadingRef>

View File

@@ -1,28 +1,12 @@
@import 'mixins/list'; @import 'mixins/list';
@import 'variables/gutters'; @import 'variables/gutters';
.gemensam-planering-view { .slutredovisning-view {
max-width: var(--digi--typography--text--max-width); max-width: var(--digi--typography--text--max-width);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: $digi--layout--gutter--l; gap: $digi--layout--gutter--l;
&__activity-list {
@include msfa__reset-list;
margin-bottom: var(--digi--layout--gutter--s);
}
&__activity-item {
display: flex;
align-items: center;
gap: var(--digi--layout--gutter--s);
margin-top: var(--digi--layout--gutter--s);
}
&__activity-check {
color: var(--digi--ui--color--border--success);
}
&__footer { &__footer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -1,17 +1,34 @@
<div class="deltagare-list-handelser"> <digi-ng-dialog
<p>Genomförandereferens: <strong>{{deltagare?.genomforandeReferens}}</strong></p> *ngIf="deltagare"
[afActive]="deltagare"
(afOnPrimaryClick)="emitCloseDialog()"
(afOnSecondaryClick)="closeMotivation()"
(afOnInactive)="emitCloseDialog()"
[afHeading]="heading"
afHeadingLevel="h2"
afPrimaryButtonText="Stäng"
[afSecondaryButtonText]="activeHandelseMotivation ? 'Tillbaka till alla händelser' : null"
>
<div class="deltagare-list-handelser">
<h3 *ngIf="activeHandelseMotivation" class="deltagare-list-handelser__sub-heading">{{deltagare.fullName}}</h3>
<p>Genomförandereferens: <strong>{{deltagare.genomforandeReferens}}</strong></p>
<ng-container *ngIf="deltagareHandelserData$ | async as deltagareHandelserData; else loadingRef">
<ng-container *ngIf="activeHandelseMotivation; else handelseTableRef">
<p>{{activeHandelseMotivation.motivation}}</p>
</ng-container>
<digi-table af-size="s" *ngIf="deltagareHandelserData$ | async as deltagareHandelserData; else loadingRef"> <ng-template #handelseTableRef>
<ng-container *ngIf="deltagareHandelserData.data.length > 0; else noEvents"> <digi-table af-size="s" *ngIf="deltagareHandelserData.data.length > 0; else noEventsRef">
<table> <table>
<caption class="msfa__a11y-sr-only"> <caption class="msfa__a11y-sr-only">
Lista med alla händelser för {{deltagare?.fullName}} Lista med alla händelser för {{deltagare.fullName}}
</caption> </caption>
<thead> <thead>
<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">Effekt</th> <th scope="col" class="deltagare-list-handelser__heading-row">Effekt</th>
<th scope="col" class="deltagare-list-handelser__heading-row">Motivering</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -19,7 +36,11 @@
<td class="deltagare-list-handelser__table-cell"> <td class="deltagare-list-handelser__table-cell">
<digi-typography-time [afDateTime]="getHandelseDate(handelse, 'receivedDate')"></digi-typography-time> <digi-typography-time [afDateTime]="getHandelseDate(handelse, 'receivedDate')"></digi-typography-time>
</td> </td>
<td class="deltagare-list-handelser__table-cell" *ngIf="!handelse.isAvbrott; else isAvbrottCell"> <td
class="deltagare-list-handelser__table-cell"
[ngClass]="{'deltagare-list-handelser__table-cell--avbrott': handelse.isAvbrott}"
>
<ui-icon *ngIf="handelse.isAvbrott" [uiType]="IconType.WARNING" [uiSize]="IconSize.L"></ui-icon>
{{handelse.description}} {{handelse.description}}
</td> </td>
<td class="deltagare-list-handelser__table-cell"> <td class="deltagare-list-handelser__table-cell">
@@ -28,16 +49,21 @@
<digi-typography-time [afDateTime]="getHandelseDate(handelse)"></digi-typography-time> <digi-typography-time [afDateTime]="getHandelseDate(handelse)"></digi-typography-time>
</ng-container> </ng-container>
</td> </td>
<ng-template #isAvbrottCell> <td class="deltagare-list-handelser__table-cell">
<td class="deltagare-list-handelser__avbrott-cell"> <digi-button
<ui-icon [uiType]="IconType.WARNING" [uiSize]="IconSize.L"></ui-icon> *ngIf="handelse.motivation"
{{handelse.description}} af-variation="tertiary"
af-size="s"
(click)="openMotivation(handelse)"
>
<ui-icon slot="icon" uiType="info"></ui-icon>
Motivering till beslut
</digi-button>
</td> </td>
</ng-template>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</ng-container> </digi-table>
<ng-container *ngIf="deltagareHandelserData.meta as paginationMeta"> <ng-container *ngIf="deltagareHandelserData.meta as paginationMeta">
<digi-navigation-pagination <digi-navigation-pagination
*ngIf="paginationMeta?.totalPage > 1" *ngIf="paginationMeta?.totalPage > 1"
@@ -52,10 +78,12 @@
> >
</digi-navigation-pagination> </digi-navigation-pagination>
</ng-container> </ng-container>
</digi-table> </ng-template>
</div> </ng-container>
</div>
</digi-ng-dialog>
<ng-template #noEvents> <ng-template #noEventsRef>
<p>Inga händelser har inkommit.</p> <p>Inga händelser har inkommit.</p>
</ng-template> </ng-template>
<ng-template #loadingRef> <ng-template #loadingRef>

View File

@@ -1,16 +1,22 @@
@import 'variables/gutters'; @import 'variables/gutters';
.deltagare-list-handelser { .deltagare-list-handelser {
&__sub-heading {
margin-top: 0;
font-size: var(--digi--typography--font-size--h2--desktop) !important;
font-weight: var(--digi--typography--font-weight) !important;
}
&__heading-row { &__heading-row {
white-space: nowrap; white-space: nowrap;
} }
&__table-cell { &__table-cell {
white-space: nowrap; white-space: nowrap;
}
&__avbrott-cell { &--avbrott {
color: var(--digi--ui--color--danger); color: var(--digi--ui--color--danger);
} }
}
&__pagination { &__pagination {
display: block; display: block;

View File

@@ -1,11 +1,24 @@
import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit } from '@angular/core'; import {
import { UiIconType } from '@ui/icon/icon-type.enum'; ChangeDetectionStrategy,
import { DeltagareHandelse, DeltagareHandelseData } from '@msfa-models/deltagare-handelse.model'; Component,
EventEmitter,
Input,
OnChanges,
OnDestroy,
Output,
SimpleChanges,
} from '@angular/core';
import {
DeltagareHandelse,
DeltagareHandelseData,
DeltagareHandelseMotivation,
} from '@msfa-models/deltagare-handelse.model';
import { DeltagareCompact } from '@msfa-models/deltagare.model'; import { DeltagareCompact } from '@msfa-models/deltagare.model';
import { PaginationMeta } from '@msfa-models/pagination-meta.model'; import { PaginationMeta } from '@msfa-models/pagination-meta.model';
import { DeltagareHandelserService } from '@msfa-services/deltagare-handelser.service'; import { DeltagareHandelserService } from '@msfa-services/deltagare-handelser.service';
import { Observable } from 'rxjs';
import { UiIconSize } from '@ui/icon/icon-size.enum'; import { UiIconSize } from '@ui/icon/icon-size.enum';
import { UiIconType } from '@ui/icon/icon-type.enum';
import { BehaviorSubject, Observable } from 'rxjs';
@Component({ @Component({
selector: 'msfa-deltagare-list-handelser-dialog', selector: 'msfa-deltagare-list-handelser-dialog',
@@ -13,11 +26,13 @@ import { UiIconSize } from '@ui/icon/icon-size.enum';
styleUrls: ['./deltagare-list-handelser-dialog.component.scss'], styleUrls: ['./deltagare-list-handelser-dialog.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class DeltagareListHandelserDialogComponent implements OnInit, OnDestroy { export class DeltagareListHandelserDialogComponent implements OnChanges, OnDestroy {
@Input() deltagare: DeltagareCompact; @Input() deltagare: DeltagareCompact;
@Output() closeDialog = new EventEmitter<void>();
IconType = UiIconType; IconType = UiIconType;
IconSize = UiIconSize; IconSize = UiIconSize;
deltagareHandelserData$: Observable<DeltagareHandelseData>; deltagareHandelserData$: Observable<DeltagareHandelseData>;
private _activeHandelseMotivation$ = new BehaviorSubject<DeltagareHandelseMotivation>(null);
constructor(private deltagareHandelserService: DeltagareHandelserService) {} constructor(private deltagareHandelserService: DeltagareHandelserService) {}
@@ -25,13 +40,23 @@ export class DeltagareListHandelserDialogComponent implements OnInit, OnDestroy
this.deltagareHandelserService.resetParams(); this.deltagareHandelserService.resetParams();
} }
ngOnInit(): void { ngOnChanges(changes: SimpleChanges): void {
if (this.deltagare) { if (changes.deltagare && changes.deltagare.currentValue) {
this.deltagareHandelserService.setGenomforandeReferens$(this.deltagare.genomforandeReferens); this.deltagareHandelserService.setGenomforandeReferens$(this.deltagare.genomforandeReferens);
this.deltagareHandelserData$ = this.deltagareHandelserService.deltagareHandelserData$; this.deltagareHandelserData$ = this.deltagareHandelserService.deltagareHandelserData$;
} }
} }
get activeHandelseMotivation(): DeltagareHandelseMotivation {
return this._activeHandelseMotivation$.getValue();
}
get heading(): string {
return this.activeHandelseMotivation
? `Motivering till beslut: ${this.activeHandelseMotivation.title}`
: `Händelser för ${this.deltagare.fullName}`;
}
getHandelseDate(handelse: DeltagareHandelse, handelseDate?: string): Date { getHandelseDate(handelse: DeltagareHandelse, handelseDate?: string): Date {
return handelseDate === 'receivedDate' ? new Date(handelse.receivedDate) : new Date(handelse.effectDate); return handelseDate === 'receivedDate' ? new Date(handelse.receivedDate) : new Date(handelse.effectDate);
} }
@@ -48,4 +73,22 @@ export class DeltagareListHandelserDialogComponent implements OnInit, OnDestroy
setNewPage(page: number): void { setNewPage(page: number): void {
this.deltagareHandelserService.setPage(page); this.deltagareHandelserService.setPage(page);
} }
openMotivation(handelse: DeltagareHandelse): void {
this._activeHandelseMotivation$.next({
title: handelse.description,
motivation:
handelse.motivation ||
'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sed nemo magni in nihil dolores eum harum obcaecati, nam enim illo iusto aut expedita, animi, itaque voluptatibus. Nisi reprehenderit animi facilis!',
});
}
closeMotivation(): void {
this._activeHandelseMotivation$.next(null);
}
emitCloseDialog(): void {
this._activeHandelseMotivation$.next(null);
this.closeDialog.emit();
}
} }

View File

@@ -60,7 +60,7 @@
af-variation="tertiary" af-variation="tertiary"
af-size="s" af-size="s"
(click)="openHandelser(singleDeltagare)" (click)="openHandelser(singleDeltagare)"
aria-controls="deltagareHandelser" aria-controls="deltagare-handelser"
> >
<digi-icon-info-circle-reg class="deltagare-list__info-icon" slot="icon"></digi-icon-info-circle-reg> <digi-icon-info-circle-reg class="deltagare-list__info-icon" slot="icon"></digi-icon-info-circle-reg>
Visa händelser Visa händelser
@@ -85,7 +85,12 @@
</digi-navigation-pagination> </digi-navigation-pagination>
</div> </div>
<digi-ng-dialog <msfa-deltagare-list-handelser-dialog
id="deltagare-handelser"
[deltagare]="handelserDialogDeltagare$ | async"
(closeDialog)="closeHandelser()"
></msfa-deltagare-list-handelser-dialog>
<!-- <digi-ng-dialog
*ngIf="handelserDialogDeltagare$ | async as deltagare" *ngIf="handelserDialogDeltagare$ | async as deltagare"
[afActive]="handelserDialogIsOpen$ | async" [afActive]="handelserDialogIsOpen$ | async"
(afOnPrimaryClick)="closeHandelser()" (afOnPrimaryClick)="closeHandelser()"
@@ -96,4 +101,4 @@
id="deltagareHandelser" id="deltagareHandelser"
> >
<msfa-deltagare-list-handelser-dialog [deltagare]="deltagare"></msfa-deltagare-list-handelser-dialog> <msfa-deltagare-list-handelser-dialog [deltagare]="deltagare"></msfa-deltagare-list-handelser-dialog>
</digi-ng-dialog> </digi-ng-dialog> -->

View File

@@ -1,13 +1,13 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { ErrorSeverity } from '@msfa-enums/error-severity.enum'; import { ErrorSeverity } from '@msfa-enums/error-severity.enum';
import { UiIconType } from '@ui/icon/icon-type.enum';
import { SortOrder } from '@msfa-enums/sort-order.enum'; import { SortOrder } from '@msfa-enums/sort-order.enum';
import { DeltagareCompact } from '@msfa-models/deltagare.model'; import { DeltagareCompact } from '@msfa-models/deltagare.model';
import { PaginationMeta } from '@msfa-models/pagination-meta.model'; import { PaginationMeta } from '@msfa-models/pagination-meta.model';
import { Sort } from '@msfa-models/sort.model'; import { Sort } from '@msfa-models/sort.model';
import { UiIconSize } from '@ui/icon/icon-size.enum';
import { UiIconType } from '@ui/icon/icon-type.enum';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { UiIconSize } from '@ui/icon/icon-size.enum';
@Component({ @Component({
selector: 'msfa-deltagare-list-table', selector: 'msfa-deltagare-list-table',
@@ -24,7 +24,7 @@ export class DeltagareListTableComponent {
@Output() paginated = new EventEmitter<number>(); @Output() paginated = new EventEmitter<number>();
handelserDialogDeltagare$ = new BehaviorSubject<DeltagareCompact | null>(null); handelserDialogDeltagare$ = new BehaviorSubject<DeltagareCompact | null>(null);
handelserDialogIsOpen$ = this.handelserDialogDeltagare$.pipe(map(genomforandereferens => !!genomforandereferens)); handelserDialogIsOpen$ = this.handelserDialogDeltagare$.pipe(map(deltagare => !!deltagare));
IconType = UiIconType; IconType = UiIconType;
IconSize = UiIconSize; IconSize = UiIconSize;

View File

@@ -3,6 +3,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { LayoutModule } from '@msfa-shared/components/layout/layout.module'; import { LayoutModule } from '@msfa-shared/components/layout/layout.module';
import { UnauthorizedAlertModule } from '@msfa-shared/components/unauthorized-alert/unauthorized-alert.module'; import { UnauthorizedAlertModule } from '@msfa-shared/components/unauthorized-alert/unauthorized-alert.module';
import { UiIconModule } from '@ui/icon/icon.module';
import { UiLoaderModule } from '@ui/loader/loader.module'; import { UiLoaderModule } from '@ui/loader/loader.module';
import { UiSkeletonModule } from '@ui/skeleton/skeleton.module'; import { UiSkeletonModule } from '@ui/skeleton/skeleton.module';
import { DeltagareListTableModule } from './components/deltagare-list-table/deltagare-list-table.module'; import { DeltagareListTableModule } from './components/deltagare-list-table/deltagare-list-table.module';
@@ -24,6 +25,7 @@ import { DeltagareListComponent } from './deltagare-list.component';
UiSkeletonModule, UiSkeletonModule,
UnauthorizedAlertModule, UnauthorizedAlertModule,
UiLoaderModule, UiLoaderModule,
UiIconModule,
], ],
}) })
export class DeltagareListModule {} export class DeltagareListModule {}

View File

@@ -8,6 +8,7 @@ export interface ReportResponse {
inskickadDatum: string; inskickadDatum: string;
statusRapport: string; statusRapport: string;
ciamUserId: string; ciamUserId: string;
motivation: string;
} }
export interface ReportsDataResponse { export interface ReportsDataResponse {
data: ReportResponse[]; data: ReportResponse[];

View File

@@ -71,4 +71,6 @@ export interface SlutredovisningResponse {
progressDescription: string; progressDescription: string;
nextStepDescription: string; nextStepDescription: string;
otherInformation: string; otherInformation: string;
status?: string;
motivation?: string;
} }

View File

@@ -21,6 +21,7 @@ export interface DeltagareHandelse {
isAvbrott: boolean; isAvbrott: boolean;
effectDate: Date; effectDate: Date;
effectDescription: string; effectDescription: string;
motivation: string;
} }
export interface DeltagareHandelseData { export interface DeltagareHandelseData {
@@ -28,12 +29,18 @@ export interface DeltagareHandelseData {
meta: PaginationMeta; meta: PaginationMeta;
} }
export interface DeltagareHandelseMotivation {
title: string;
motivation: string;
}
interface DeltagareHandelseApiResponse { interface DeltagareHandelseApiResponse {
description: string; description: string;
receivedDate: Date; receivedDate: Date;
isAvbrott: boolean; isAvbrott: boolean;
tidpunkt: Date; tidpunkt: Date;
tidpunktDescription: string; tidpunktDescription: string;
motivation: string;
} }
export interface DeltagareHandelserApiResponse { export interface DeltagareHandelserApiResponse {
@@ -44,11 +51,11 @@ export interface DeltagareHandelserApiResponse {
export function mapDeltagareHandelseApiResponse( export function mapDeltagareHandelseApiResponse(
deltagareHandelseApiResponse: DeltagareHandelseApiResponse deltagareHandelseApiResponse: DeltagareHandelseApiResponse
): DeltagareHandelse { ): DeltagareHandelse {
const { description, receivedDate, isAvbrott } = deltagareHandelseApiResponse; const { description, receivedDate, isAvbrott, motivation } = deltagareHandelseApiResponse;
const effectDate = deltagareHandelseApiResponse.tidpunkt; const effectDate = deltagareHandelseApiResponse.tidpunkt;
const effectDescription = const effectDescription =
(GENOMFORANDEHANDELSE_EFFECT_MAP[deltagareHandelseApiResponse.tidpunktDescription] as string) ?? (GENOMFORANDEHANDELSE_EFFECT_MAP[deltagareHandelseApiResponse.tidpunktDescription] as string) ??
deltagareHandelseApiResponse.tidpunktDescription ?? deltagareHandelseApiResponse.tidpunktDescription ??
''; '';
return { description, receivedDate, isAvbrott, effectDate, effectDescription }; return { description, receivedDate, isAvbrott, effectDate, effectDescription, motivation };
} }

View File

@@ -1,6 +1,5 @@
import { ReportType } from '@msfa-enums/report-type.enum'; import { ReportType } from '@msfa-enums/report-type.enum';
import { ReportResponse } from './api/report.response.model'; import { ReportResponse } from './api/report.response.model';
import { Franvaro } from './franvaro.model';
import { PaginationMeta } from './pagination-meta.model'; import { PaginationMeta } from './pagination-meta.model';
export interface Report { export interface Report {
@@ -10,11 +9,7 @@ export interface Report {
date: Date; date: Date;
status: string; status: string;
ciamUserId: string; ciamUserId: string;
} motivation: string;
export interface ReportDetail {
genomforandeReferens: string;
franvaro?: Franvaro;
} }
export interface ReportsData { export interface ReportsData {
@@ -23,7 +18,7 @@ export interface ReportsData {
} }
export function mapResponseToReport(data: ReportResponse): Report { export function mapResponseToReport(data: ReportResponse): Report {
const { id, genomforandeReferens, typAvRapport, inskickadDatum, statusRapport, ciamUserId } = data; const { id, genomforandeReferens, typAvRapport, inskickadDatum, statusRapport, ciamUserId, motivation } = data;
return { return {
id, id,
genomforandeReferens, genomforandeReferens,
@@ -31,5 +26,6 @@ export function mapResponseToReport(data: ReportResponse): Report {
date: new Date(inskickadDatum), date: new Date(inskickadDatum),
status: statusRapport, status: statusRapport,
ciamUserId, ciamUserId,
motivation,
}; };
} }