diff --git a/libs/feature-flags/src/lib/features.ts b/libs/feature-flags/src/lib/features.ts index fc77efa64398..5cc65a03a541 100644 --- a/libs/feature-flags/src/lib/features.ts +++ b/libs/feature-flags/src/lib/features.ts @@ -60,6 +60,9 @@ export enum Features { //New License service fetch enabled licensesV2 = 'isLicensesV2Enabled', + //Is social administration payment plan 2025 enabled? + isServicePortalPaymentPlan2025Enabled = 'isServicePortalPaymentPlan2025Enabled', + //Possible universities isUniversityOfAkureyriEnabled = 'isUniversityOfAkureyriEnabled', isAgriculturalUniversityOfIcelandEnabled = 'isAgriculturalUniversityOfIcelandEnabled', diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts index 3cbf39c1838d..f90f69b54bab 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts +++ b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts @@ -122,4 +122,9 @@ export const m = defineMessages({ id: 'sp.social-insurance-maintenance:income-plan-link-text', defaultMessage: 'Hvað er tekjuáætlun?', }, + incomePlanTemporarilyUnavailable: { + id: 'sp.social-insurance-maintenance:income-plan-temporarily-unavailable', + defaultMessage: + 'Bráðabirgðatekjuáætlun 2025 verður tilbúin seinni part desember', + }, }) 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 1197a088e110..7777a757b3bf 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 @@ -37,38 +37,6 @@ const parseSubtext = ( } } -const parseTag = ( - tag: SocialInsuranceIncomePlanStatus, - formatMessage: FormatMessage, -) => { - switch (tag) { - case SocialInsuranceIncomePlanStatus.ACCEPTED: - return { - label: formatMessage(coreMessages.processed), - variant: 'mint' as const, - outlined: false, - } - case SocialInsuranceIncomePlanStatus.IN_PROGRESS: - return { - label: formatMessage(coreMessages.inProgress), - variant: 'purple' as const, - outlined: false, - } - case SocialInsuranceIncomePlanStatus.CANCELLED: - return { - label: formatMessage(coreMessages.rejected), - variant: 'red' as const, - outlined: false, - } - default: - return { - label: formatMessage(coreMessages.unknown), - variant: 'red' as const, - outlined: false, - } - } -} - const IncomePlan = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx index 3f5b207c349d..51878ab260c9 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx @@ -1,5 +1,4 @@ import { - Box, Inline, Stack, Button, @@ -10,32 +9,75 @@ import { import { useLocale, useNamespaces } from '@island.is/localization' import { EmptyTable, - FootNote, - IntroHeader, + IntroWrapper, LinkButton, amountFormat, m as coreMessages, } from '@island.is/portals/my-pages/core' import { m } from '../../lib/messages' -import { useGetIncomePlanDetailQuery } from './IncomePlanDetail.generated' +import { + useGetIncomePlanDetailLazyQuery, + useGetIncomePlanDetailQuery, +} from './IncomePlanDetail.generated' import { Problem } from '@island.is/react-spa/shared' +import { useEffect, useState } from 'react' +import { useFeatureFlagClient } from '@island.is/react/feature-flags' const IncomePlanDetail = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() - const { data, loading, error } = useGetIncomePlanDetailQuery() - return ( - - { + const isFlagEnabled = async () => { + const ffEnabled = await featureFlagClient.getValue( + `isServicePortalPaymentPlan2025Enabled`, + false, + ) + if (ffEnabled) { + setDisplayPaymentPlan(ffEnabled as boolean) + } + } + isFlagEnabled() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + + useEffect(() => { + if (displayPaymentPlan) { + query() + } + }, [displayPaymentPlan]) + + if (!displayPaymentPlan) { + return ( + + > + + + ) + } + return ( + {error && !loading ? ( ) : !error && !loading && !data?.socialInsuranceIncomePlan ? ( @@ -117,10 +159,7 @@ const IncomePlanDetail = () => { )} )} - - - - + ) }