Merge pull request #185 in TEA/mina-sidor-fa-web from bugfix/TV-710 to develop

Squashed commit of the following:

commit 7fb5002893f6d53d9ebf18b133001f6314dbb20b
Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se>
Date:   Thu Oct 7 12:02:51 2021 +0200

    TV-710 changet method name, refactoring

commit 20b7efe145a300d7d6771514eb14acf2887b03cd
Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se>
Date:   Thu Oct 7 09:25:42 2021 +0200

    TV-710 use same date format
This commit is contained in:
Nicolas Fuentes Maturana
2021-10-08 16:03:22 +02:00
parent 41495a0f3b
commit fed98768a3
5 changed files with 47 additions and 21 deletions

View File

@@ -21,13 +21,21 @@
<dd>{{avrop.tjanst}}</dd>
<ng-container *ngIf="!isPeriodDate; else periodDateRef">
<dt>Startdatum</dt>
<dd>{{avrop.startDate | date:'longDate'}}</dd>
<dd>
<digi-typography-time [afDateTime]="avrop.startDate"></digi-typography-time>
</dd>
<dt>Slutdatum</dt>
<dd>{{avrop.endDate | date:'longDate'}}</dd>
<dd>
<digi-typography-time [afDateTime]="avrop.endDate"></digi-typography-time>
</dd>
</ng-container>
<ng-template #periodDateRef>
<dt>Avser period</dt>
<dd>{{avrop.startDate | date:'longDate'}} - {{avrop.endDate | date:'longDate'}}</dd>
<dd>
<digi-typography-time [afDateTime]="avrop.startDate"></digi-typography-time>
-
<digi-typography-time [afDateTime]="avrop.endDate"></digi-typography-time>
</dd>
</ng-template>
</dl>
</div>

View File

@@ -18,21 +18,26 @@
</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">
{{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>
</ng-template>
</tr>
<tr *ngFor="let handelse of deltagareHandelser;">
<td class="deltagare-list-handelser__table-cell">
<digi-typography-time [afDateTime]="getHandelseDate(handelse, 'receivedDate')"></digi-typography-time>
</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}}:
<digi-typography-time [afDateTime]="getHandelseDate(handelse)"></digi-typography-time>
</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>
</ng-template>
</tr>
</tbody>

View File

@@ -16,7 +16,7 @@ export class DeltagareListHandelserDialogComponent implements OnInit {
iconType = IconType;
deltagareHandelser$: Observable<DeltagareHandelse[]>;
constructor(private deltagareHandelserApiService: DeltagareHandelserApiService) {}
constructor(private deltagareHandelserApiService: DeltagareHandelserApiService) { }
ngOnInit(): void {
if (this.deltagare) {
@@ -25,4 +25,8 @@ export class DeltagareListHandelserDialogComponent implements OnInit {
);
}
}
getHandelseDate(handelse: DeltagareHandelse, handelseDate?: string): Date {
return handelseDate === 'receivedDate' ? new Date(handelse.receivedDate) : new Date(handelse.effectDate);
}
}

View File

@@ -40,9 +40,14 @@
</th>
<td>{{ singleDeltagare.tjanst }}</td>
<td>{{ singleDeltagare.utforandeVerksamhet }}</td>
<td>{{ singleDeltagare.startdatumAvrop | date }}</td>
<td>
{{ singleDeltagare.slutdatumAvrop | date }}
<digi-typography-time
[afDateTime]="getAvropDate(singleDeltagare, 'startdatumAvrop')"
></digi-typography-time>
</td>
<td>
<digi-typography-time [afDateTime]="getAvropDate(singleDeltagare)"></digi-typography-time>
<div class="deltagare-list__avbrott-alert" *ngIf="singleDeltagare.hasAvbrott">
<msfa-icon [icon]="iconType.WARNING" size="l"></msfa-icon>
Avbrott

View File

@@ -75,6 +75,10 @@ export class DeltagareListTableComponent {
return end < this.count ? end : this.count;
}
getAvropDate(deltagare: DeltagareCompact, avropDate?: string): Date {
return avropDate === 'startdatumAvrop' ? new Date(deltagare.startdatumAvrop) : new Date(deltagare.slutdatumAvrop)
}
handleSort(key: keyof DeltagareCompact): void {
this.sorted.emit(key);
}