From b602f3217d0b65fa7fc140292817633957047493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Tue, 19 Nov 2024 14:02:43 +0000 Subject: [PATCH 1/3] feat: ini --- .../src/lib/socialInsurance.service.ts | 3 ++ .../src/lib/dto/incomePlan.dto.ts | 34 +++++++++++++++++++ .../src/screens/IncomePlan/IncomePlan.tsx | 30 ++++++---------- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts b/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts index 98dfe04d5166..c042be559111 100644 --- a/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts +++ b/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts @@ -130,8 +130,11 @@ export class SocialInsuranceService { } async getIncomePlan(user: User): Promise { + this.logger.debug('bingbong') const data = await this.socialInsuranceApi.getLatestIncomePlan(user) + this.logger.debug('data', data) + if (!data?.registrationDate || !data?.status || !data.incomeTypeLines) { this.logger.info('Income plan incomplete, returning', { category: LOG_CATEGORY, diff --git a/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts b/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts index 29ca0965d84f..f830e4d5300f 100644 --- a/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts +++ b/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts @@ -12,6 +12,7 @@ export interface IncomePlanDto { incomeTypeLines?: Array } +/* export const mapIncomePlanDto = ( data: TrWebCommonsExternalPortalsApiModelsIncomePlanIncomePlanDto, ): IncomePlanDto | undefined => ({ @@ -20,4 +21,37 @@ export const mapIncomePlanDto = ( status: data.status as IncomePlanStatus, origin: data.origin ?? undefined, incomeTypeLines: data.incomeTypeLines ?? undefined, +}) */ + +export const mapIncomePlanDto = ( + data: TrWebCommonsExternalPortalsApiModelsIncomePlanIncomePlanDto, +): IncomePlanDto | undefined => ({ + year: 1993, + registrationDate: new Date(), + status: 'InProgress', + origin: 'islandis', + incomeTypeLines: [ + { + incomeCategoryNumber: 1, + incomeCategoryName: 'ben', + incomeCategoryCode: '8', + incomeTypeNumber: 1, + incomeTypeName: 'bong', + incomeTypeCode: '8', + amountJan: 1, + amountFeb: 2, + amountMar: 3, + amountApr: 4, + amountMay: 5, + amountJun: 6, + amountJul: 7, + amountAug: 8, + amountSep: 9, + amountNov: 11, + amountDec: 12, + amountOct: 10, + totalSum: 78, + currency: 'ISK', + }, + ], }) diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx index ce10804ddf32..b4f589579896 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx @@ -9,6 +9,7 @@ import { CardLoader, FootNote, IntroHeader, + IntroWrapper, LinkButton, m as coreMessages, formatDate, @@ -75,16 +76,14 @@ const IncomePlan = () => { const { data, loading, error } = useGetIncomePlanQuery() return ( - - - + {error && !loading ? ( ) : loading ? ( @@ -149,14 +148,6 @@ const IncomePlan = () => { url: SocialInsuranceMaintenancePaths.SocialInsuranceMaintenanceIncomePlanDetail, variant: 'text', }} - tag={ - data?.socialInsuranceIncomePlan?.status - ? parseTag( - data.socialInsuranceIncomePlan?.status, - formatMessage, - ) - : undefined - } /> ) : ( { )} )} - - + ) } From 6dcbe9ddcecf35535d095bf23954fd2882925674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Thu, 21 Nov 2024 16:41:29 +0000 Subject: [PATCH 2/3] fix: switch link --- .../social-insurance/src/lib/socialInsurance.service.ts | 3 --- .../src/screens/IncomePlan/IncomePlan.tsx | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts b/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts index c042be559111..98dfe04d5166 100644 --- a/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts +++ b/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts @@ -130,11 +130,8 @@ export class SocialInsuranceService { } async getIncomePlan(user: User): Promise { - this.logger.debug('bingbong') const data = await this.socialInsuranceApi.getLatestIncomePlan(user) - this.logger.debug('data', data) - if (!data?.registrationDate || !data?.status || !data.incomeTypeLines) { this.logger.info('Income plan incomplete, returning', { category: LOG_CATEGORY, diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx index b4f589579896..1197a088e110 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlan/IncomePlan.tsx @@ -145,7 +145,13 @@ const IncomePlan = () => { heading={formatMessage(coreMessages.incomePlan)} cta={{ label: formatMessage(m.viewIncomePlan), - url: SocialInsuranceMaintenancePaths.SocialInsuranceMaintenanceIncomePlanDetail, + url: + data.socialInsuranceIncomePlan.status === + SocialInsuranceIncomePlanStatus.IN_PROGRESS + ? `${document.location.origin}/${formatMessage( + m.incomePlanModifyLink, + )}` + : SocialInsuranceMaintenancePaths.SocialInsuranceMaintenanceIncomePlanDetail, variant: 'text', }} /> From 2c9c975e7a366797c7b1bc3023bd49b98be8ed9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Fri, 22 Nov 2024 15:45:40 +0000 Subject: [PATCH 3/3] chore: remove mocks --- .../src/lib/dto/incomePlan.dto.ts | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts b/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts index f830e4d5300f..29ca0965d84f 100644 --- a/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts +++ b/libs/clients/social-insurance-administration/src/lib/dto/incomePlan.dto.ts @@ -12,7 +12,6 @@ export interface IncomePlanDto { incomeTypeLines?: Array } -/* export const mapIncomePlanDto = ( data: TrWebCommonsExternalPortalsApiModelsIncomePlanIncomePlanDto, ): IncomePlanDto | undefined => ({ @@ -21,37 +20,4 @@ export const mapIncomePlanDto = ( status: data.status as IncomePlanStatus, origin: data.origin ?? undefined, incomeTypeLines: data.incomeTypeLines ?? undefined, -}) */ - -export const mapIncomePlanDto = ( - data: TrWebCommonsExternalPortalsApiModelsIncomePlanIncomePlanDto, -): IncomePlanDto | undefined => ({ - year: 1993, - registrationDate: new Date(), - status: 'InProgress', - origin: 'islandis', - incomeTypeLines: [ - { - incomeCategoryNumber: 1, - incomeCategoryName: 'ben', - incomeCategoryCode: '8', - incomeTypeNumber: 1, - incomeTypeName: 'bong', - incomeTypeCode: '8', - amountJan: 1, - amountFeb: 2, - amountMar: 3, - amountApr: 4, - amountMay: 5, - amountJun: 6, - amountJul: 7, - amountAug: 8, - amountSep: 9, - amountNov: 11, - amountDec: 12, - amountOct: 10, - totalSum: 78, - currency: 'ISK', - }, - ], })