updated models to cater for Content
This commit is contained in:
@@ -30,8 +30,8 @@ export class AvvikelseReportViewService {
|
|||||||
switchMap(([reasons, questions]) => {
|
switchMap(([reasons, questions]) => {
|
||||||
return this.handlingarApiService.fetchAvvikelseReport$(handlingId).pipe(
|
return this.handlingarApiService.fetchAvvikelseReport$(handlingId).pipe(
|
||||||
map(({ data }) => ({
|
map(({ data }) => ({
|
||||||
genomforandeReferens: data.genomforandeReferens,
|
genomforandeReferens: data.content.genomforandeReferens,
|
||||||
avvikelse: mapResponseToAvvikelse(data.avvikelseAlternativ, reasons, questions),
|
avvikelse: mapResponseToAvvikelse(data.content.avvikelseAlternativ, reasons, questions),
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ export class FranvaroReportViewService {
|
|||||||
switchMap(([reasons, otherReasons]) => {
|
switchMap(([reasons, otherReasons]) => {
|
||||||
return this.handlingarApiService.fetchFranvaroReport$(handlingId).pipe(
|
return this.handlingarApiService.fetchFranvaroReport$(handlingId).pipe(
|
||||||
map(({ data }) => ({
|
map(({ data }) => ({
|
||||||
genomforandeReferens: data.genomforandeReferens,
|
genomforandeReferens: data.content.genomforandeReferens,
|
||||||
franvaro: mapResponseToFranvaro(data.franvaro, reasons, otherReasons),
|
franvaro: mapResponseToFranvaro(data.content.franvaro, reasons, otherReasons, data.motivation, data.status),
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service';
|
|||||||
import { HandlingarApiService } from '@msfa-services/api/handlingar.api.service';
|
import { HandlingarApiService } from '@msfa-services/api/handlingar.api.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { mapSlutredovisningResponseToSlutredovisning, Slutredovisning } from '@msfa-models/slutredovisning.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SlutredovisningViewService {
|
export class SlutredovisningViewService {
|
||||||
@@ -14,7 +15,12 @@ export class SlutredovisningViewService {
|
|||||||
return this.deltagareApiService.fetchAvropInformation$(genomforandeReferens);
|
return this.deltagareApiService.fetchAvropInformation$(genomforandeReferens);
|
||||||
}
|
}
|
||||||
|
|
||||||
public fetchSlutredovisning$(handlingId: string): Observable<SlutredovisningResponse> {
|
public fetchSlutredovisning$(handlingId: string): Observable<Slutredovisning> {
|
||||||
return this.handlingarApiService.fetchSlutredovisning$(handlingId).pipe(map(({ data }) => data));
|
return this.handlingarApiService.fetchSlutredovisning$(handlingId).pipe(
|
||||||
|
map(({ data }) => data),
|
||||||
|
map((slutredovisningResponse: SlutredovisningResponse) =>
|
||||||
|
mapSlutredovisningResponseToSlutredovisning(slutredovisningResponse)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ export interface AvvikelseResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AvvikelseReportResponse {
|
export interface AvvikelseReportResponse {
|
||||||
genomforandeReferens: number;
|
content: {
|
||||||
avvikelseAlternativ: AvvikelseResponse;
|
genomforandeReferens: number;
|
||||||
|
avvikelseAlternativ: AvvikelseResponse;
|
||||||
|
};
|
||||||
|
status?: string;
|
||||||
|
motivering?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ export interface FranvaroResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface FranvaroReportResponse {
|
export interface FranvaroReportResponse {
|
||||||
genomforandeReferens: number;
|
content: {
|
||||||
franvaro: FranvaroResponse;
|
genomforandeReferens: number;
|
||||||
|
franvaro: FranvaroResponse;
|
||||||
|
};
|
||||||
|
motivation?: string;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ export interface GemensamPlaneringResponse {
|
|||||||
genomforandeReferens: string;
|
genomforandeReferens: string;
|
||||||
distans: boolean;
|
distans: boolean;
|
||||||
aktivitetsIds: number[];
|
aktivitetsIds: number[];
|
||||||
|
status?: string;
|
||||||
|
motivation?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum';
|
import { InformativRapportCategoryKey } from '@msfa-enums/informativ-rapport-category.enum';
|
||||||
|
|
||||||
export interface InformativRapportResponse {
|
export interface InformativRapportResponse {
|
||||||
genomforandeReferens: number;
|
content: {
|
||||||
category: InformativRapportCategoryKey;
|
genomforandeReferens: number;
|
||||||
comment: string;
|
category: InformativRapportCategoryKey;
|
||||||
|
comment: string;
|
||||||
|
};
|
||||||
|
motivation?: string;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,38 +6,13 @@ export interface PeriodiskRedovisningActivityResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface PeriodiskRedovisningResponse {
|
export interface PeriodiskRedovisningResponse {
|
||||||
genomforandeReferens: number;
|
content: {
|
||||||
period: string;
|
genomforandeReferens: number;
|
||||||
hasOfferedLanguageSupport: boolean;
|
period: string;
|
||||||
hasOfferedJob: boolean;
|
hasOfferedLanguageSupport: boolean;
|
||||||
activities: PeriodiskRedovisningActivityResponse[];
|
hasOfferedJob: boolean;
|
||||||
}
|
activities: PeriodiskRedovisningActivityResponse[];
|
||||||
|
|
||||||
export function mockOnePeriodiskRedovisningResponse(): PeriodiskRedovisningResponse {
|
|
||||||
return {
|
|
||||||
genomforandeReferens: 100003857,
|
|
||||||
hasOfferedJob: false,
|
|
||||||
hasOfferedLanguageSupport: true,
|
|
||||||
period: '2021-10',
|
|
||||||
activities: [
|
|
||||||
{
|
|
||||||
id: 24,
|
|
||||||
performedRemotely: false,
|
|
||||||
performedPhysically: true,
|
|
||||||
hours: 25,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 19,
|
|
||||||
performedRemotely: true,
|
|
||||||
performedPhysically: false,
|
|
||||||
hours: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 31,
|
|
||||||
performedRemotely: true,
|
|
||||||
performedPhysically: true,
|
|
||||||
hours: 2,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
status?: string;
|
||||||
|
motivation?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ export enum SignalResponseOmfattning {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SignalResponse {
|
export interface SignalResponse {
|
||||||
genomforandereferens: number;
|
content: {
|
||||||
type: SignalResponseType;
|
genomforandereferens: number;
|
||||||
omfattning: SignalResponseOmfattning;
|
type: SignalResponseType;
|
||||||
omfattningPercent: number;
|
omfattning: SignalResponseOmfattning;
|
||||||
startDate: string;
|
omfattningPercent: number;
|
||||||
|
startDate: string;
|
||||||
|
};
|
||||||
|
status?: string;
|
||||||
|
motivation?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,12 +65,14 @@ export type SlutredovisningResponseMainOccupationDetails =
|
|||||||
| SlutredovisningResponseMainOccupationStillUnemployed;
|
| SlutredovisningResponseMainOccupationStillUnemployed;
|
||||||
|
|
||||||
export interface SlutredovisningResponse {
|
export interface SlutredovisningResponse {
|
||||||
genomforandereferens: number;
|
content: {
|
||||||
mainOccupation: SlutredovisningResponseMainOccupationDetails;
|
genomforandereferens: number;
|
||||||
activities: { id: string; whatHasBeenDone: string; name: string }[];
|
mainOccupation: SlutredovisningResponseMainOccupationDetails;
|
||||||
progressDescription: string;
|
activities: { id: string; whatHasBeenDone: string; name: string }[];
|
||||||
nextStepDescription: string;
|
progressDescription: string;
|
||||||
otherInformation: string;
|
nextStepDescription: string;
|
||||||
|
otherInformation: string;
|
||||||
|
};
|
||||||
status?: string;
|
status?: string;
|
||||||
motivation?: string;
|
motivation?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ export interface Avvikelse {
|
|||||||
answer: string;
|
answer: string;
|
||||||
}[];
|
}[];
|
||||||
date: Date;
|
date: Date;
|
||||||
|
motivation?: string;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AvvikelseReport {
|
export interface AvvikelseReport {
|
||||||
@@ -19,7 +21,9 @@ export interface AvvikelseReport {
|
|||||||
export function mapResponseToAvvikelse(
|
export function mapResponseToAvvikelse(
|
||||||
data: AvvikelseResponse,
|
data: AvvikelseResponse,
|
||||||
reasons: AvvikelseReason[],
|
reasons: AvvikelseReason[],
|
||||||
questions: AvvikelseQuestion[]
|
questions: AvvikelseQuestion[],
|
||||||
|
motivation?: string,
|
||||||
|
status?: string
|
||||||
): Avvikelse {
|
): Avvikelse {
|
||||||
const { avvikelseOrsakskod, rapporteringsdatum, frageformular } = data;
|
const { avvikelseOrsakskod, rapporteringsdatum, frageformular } = data;
|
||||||
|
|
||||||
@@ -30,5 +34,7 @@ export function mapResponseToAvvikelse(
|
|||||||
answer: fraga.svar,
|
answer: fraga.svar,
|
||||||
})),
|
})),
|
||||||
date: new Date(rapporteringsdatum),
|
date: new Date(rapporteringsdatum),
|
||||||
|
motivation,
|
||||||
|
status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export interface Franvaro {
|
|||||||
expectedPresenceEndTime: string;
|
expectedPresenceEndTime: string;
|
||||||
otherKnownReason: string;
|
otherKnownReason: string;
|
||||||
knownReasonComment: string;
|
knownReasonComment: string;
|
||||||
|
motivation?: string;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FranvaroReport {
|
export interface FranvaroReport {
|
||||||
@@ -21,7 +23,9 @@ export interface FranvaroReport {
|
|||||||
export function mapResponseToFranvaro(
|
export function mapResponseToFranvaro(
|
||||||
data: FranvaroResponse,
|
data: FranvaroResponse,
|
||||||
reasons: FranvaroReason[],
|
reasons: FranvaroReason[],
|
||||||
otherKnownReasons: FranvaroReason[]
|
otherKnownReasons: FranvaroReason[],
|
||||||
|
motivation?: string,
|
||||||
|
status?: string
|
||||||
): Franvaro {
|
): Franvaro {
|
||||||
const { avvikelseOrsaksKod, datum, heldag, startTid, slutTid, alternativForKandaOrsaker, forvantadNarvaro } = data;
|
const { avvikelseOrsaksKod, datum, heldag, startTid, slutTid, alternativForKandaOrsaker, forvantadNarvaro } = data;
|
||||||
|
|
||||||
@@ -37,5 +41,7 @@ export function mapResponseToFranvaro(
|
|||||||
knownReasonComment: alternativForKandaOrsaker?.motivering || null,
|
knownReasonComment: alternativForKandaOrsaker?.motivering || null,
|
||||||
expectedPresenceStartTime: forvantadNarvaro.startTid,
|
expectedPresenceStartTime: forvantadNarvaro.startTid,
|
||||||
expectedPresenceEndTime: forvantadNarvaro.slutTid,
|
expectedPresenceEndTime: forvantadNarvaro.slutTid,
|
||||||
|
motivation,
|
||||||
|
status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ export interface GemensamPlaneringDetailed {
|
|||||||
genomforandeReferens: number;
|
genomforandeReferens: number;
|
||||||
distance: boolean;
|
distance: boolean;
|
||||||
activities: string[];
|
activities: string[];
|
||||||
|
status?: string;
|
||||||
|
motivation?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapGemensamPlaneringToGemensamPlaneringPostRequest(
|
export function mapGemensamPlaneringToGemensamPlaneringPostRequest(
|
||||||
@@ -30,11 +32,13 @@ export function mapResponseToGemensamPlaneringDetailed(
|
|||||||
data: GemensamPlaneringResponse,
|
data: GemensamPlaneringResponse,
|
||||||
activities: Activity[]
|
activities: Activity[]
|
||||||
): GemensamPlaneringDetailed {
|
): GemensamPlaneringDetailed {
|
||||||
const { genomforandeReferens, distans, aktivitetsIds } = data;
|
const { genomforandeReferens, distans, aktivitetsIds, status, motivation } = data;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
genomforandeReferens: +genomforandeReferens,
|
genomforandeReferens: +genomforandeReferens,
|
||||||
distance: distans,
|
distance: distans,
|
||||||
activities: aktivitetsIds.map(id => activities.find(activity => activity.id === id).name),
|
activities: aktivitetsIds.map(id => activities.find(activity => activity.id === id).name),
|
||||||
|
status,
|
||||||
|
motivation,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,18 @@ export interface InformativRapport {
|
|||||||
genomforandeReferens: number;
|
genomforandeReferens: number;
|
||||||
category: InformativRapportCategory;
|
category: InformativRapportCategory;
|
||||||
comment: string;
|
comment: string;
|
||||||
|
motivation?: string;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapResponseToInformativRapport(data: InformativRapportResponse): InformativRapport {
|
export function mapResponseToInformativRapport(data: InformativRapportResponse): InformativRapport {
|
||||||
const { genomforandeReferens, category, comment } = data;
|
const { genomforandeReferens, category, comment } = data.content;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
genomforandeReferens,
|
genomforandeReferens,
|
||||||
category: InformativRapportCategory[category] as InformativRapportCategory,
|
category: InformativRapportCategory[category] as InformativRapportCategory,
|
||||||
comment: comment,
|
comment: comment,
|
||||||
|
motivation: data.motivation,
|
||||||
|
status: data.status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,15 @@ export interface PeriodiskRedovisning {
|
|||||||
hasOfferedLanguageSupport: boolean;
|
hasOfferedLanguageSupport: boolean;
|
||||||
hasOfferedJob: boolean;
|
hasOfferedJob: boolean;
|
||||||
activities: PeriodiskRedovisningActivity[];
|
activities: PeriodiskRedovisningActivity[];
|
||||||
|
motivation?: string;
|
||||||
|
status?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapResponseToPeriodiskRedovisning(
|
export function mapResponseToPeriodiskRedovisning(
|
||||||
data: PeriodiskRedovisningResponse,
|
data: PeriodiskRedovisningResponse,
|
||||||
allActivities: Activity[]
|
allActivities: Activity[]
|
||||||
): PeriodiskRedovisning {
|
): PeriodiskRedovisning {
|
||||||
const { genomforandeReferens, period, hasOfferedLanguageSupport, hasOfferedJob, activities } = data;
|
const { genomforandeReferens, period, hasOfferedLanguageSupport, hasOfferedJob, activities } = data.content;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
genomforandeReferens,
|
genomforandeReferens,
|
||||||
@@ -35,5 +37,7 @@ export function mapResponseToPeriodiskRedovisning(
|
|||||||
performedPhysically,
|
performedPhysically,
|
||||||
hours,
|
hours,
|
||||||
})),
|
})),
|
||||||
|
motivation: data.motivation,
|
||||||
|
status: data.status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
import { SignalResponse } from './api/signal.response.model';
|
import { SignalResponse, SignalResponseOmfattning, SignalResponseType } from './api/signal.response.model';
|
||||||
|
|
||||||
export type Signal = SignalResponse;
|
export interface Signal {
|
||||||
|
genomforandereferens: number;
|
||||||
|
type: SignalResponseType;
|
||||||
|
omfattning: SignalResponseOmfattning;
|
||||||
|
omfattningPercent: number;
|
||||||
|
startDate: string;
|
||||||
|
status?: string;
|
||||||
|
motivation?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export function mapResponseToSignal(data: SignalResponse): Signal {
|
export function mapResponseToSignal(data: SignalResponse): Signal {
|
||||||
return data;
|
return { motivation: data.motivation, status: data.status, ...data.content };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { SlutredovisningResponse } from '@msfa-models/api/slutredovisning.response.model';
|
import {
|
||||||
|
SlutredovisningResponse,
|
||||||
|
SlutredovisningResponseMainOccupationDetails,
|
||||||
|
} from '@msfa-models/api/slutredovisning.response.model';
|
||||||
|
|
||||||
export enum MainOccupation {
|
export enum MainOccupation {
|
||||||
Work = 'work',
|
Work = 'work',
|
||||||
@@ -88,7 +91,26 @@ export function omfattningToString(omfattning: Omfattning): string | null {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Slutredovisning = SlutredovisningResponse;
|
export interface Slutredovisning {
|
||||||
|
genomforandereferens: number;
|
||||||
|
mainOccupation: SlutredovisningResponseMainOccupationDetails;
|
||||||
|
activities: { id: string; whatHasBeenDone: string; name: string }[];
|
||||||
|
progressDescription: string;
|
||||||
|
nextStepDescription: string;
|
||||||
|
otherInformation: string;
|
||||||
|
status?: string;
|
||||||
|
motivation?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mapSlutredovisningResponseToSlutredovisning(
|
||||||
|
slutredovisningResponse: SlutredovisningResponse
|
||||||
|
): Slutredovisning {
|
||||||
|
return {
|
||||||
|
...slutredovisningResponse.content,
|
||||||
|
status: slutredovisningResponse.status,
|
||||||
|
motivation: slutredovisningResponse.motivation,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function mainOccupationToString(mainOccupation: MainOccupation): string | null {
|
export function mainOccupationToString(mainOccupation: MainOccupation): string | null {
|
||||||
switch (mainOccupation) {
|
switch (mainOccupation) {
|
||||||
|
|||||||
Reference in New Issue
Block a user