diff --git a/apps/native/app/src/graphql/queries/health.graphql b/apps/native/app/src/graphql/queries/health.graphql index b8b142fd36a5..15106fbfb6df 100644 --- a/apps/native/app/src/graphql/queries/health.graphql +++ b/apps/native/app/src/graphql/queries/health.graphql @@ -11,6 +11,20 @@ query GetHealthInsuranceOverview { } } +query GetMedicineData { + rightsPortalDrugPeriods { + id + dateFrom + dateTo + active + paidAmount + paymentStatus + numberOfBills + levelNumber + levelPercentage + } +} + query GetHealthCenter($input: RightsPortalHealthCenterHistoryInput) { rightsPortalHealthCenterRegistrationHistory(input: $input) { current { diff --git a/apps/native/app/src/messages/en.ts b/apps/native/app/src/messages/en.ts index d464d57dd503..e4f9b8d91e0e 100644 --- a/apps/native/app/src/messages/en.ts +++ b/apps/native/app/src/messages/en.ts @@ -629,4 +629,10 @@ export const en: TranslatedMessages = { 'health.overview.paymentDebt': 'Debt', 'health.overview.therapy': 'Therapy', 'health.overview.aidsAndNutrition': 'Aids and nutrition', + 'health.overview.medicinePurchase': 'Medicine purchase', + 'health.overview.period': 'Period', + 'health.overview.levelStatus': 'Medicine step', + 'health.overview.levelStatusValue': 'Level {level}, you pay {percentage}%', + 'health.overview.medicinePurchaseNoActivePeriodWarning': + 'A new payment period begins with the next medicine purchase', } diff --git a/apps/native/app/src/messages/is.ts b/apps/native/app/src/messages/is.ts index 90c51a4c2580..8feb23255970 100644 --- a/apps/native/app/src/messages/is.ts +++ b/apps/native/app/src/messages/is.ts @@ -629,4 +629,11 @@ export const is = { 'health.overview.paymentDebt': 'Skuld', 'health.overview.therapy': 'Þjálfun', 'health.overview.aidsAndNutrition': 'Hjálpartæki og næring', + 'health.overview.medicinePurchase': 'Lyfjakaup', + 'health.overview.period': 'Tímabil', + 'health.overview.levelStatus': 'Þrepastaða', + 'health.overview.levelStatusValue': + 'Greiðsluþrep {level}, þú greiðir {percentage}%', + 'health.overview.medicinePurchaseNoActivePeriodWarning': + 'Nýtt greiðslutímabil hefst við næstu lyfjakaup', } diff --git a/apps/native/app/src/screens/health/health-overview.tsx b/apps/native/app/src/screens/health/health-overview.tsx index 9d559b4dd035..39c22009c399 100644 --- a/apps/native/app/src/screens/health/health-overview.tsx +++ b/apps/native/app/src/screens/health/health-overview.tsx @@ -15,6 +15,7 @@ import styled, { useTheme } from 'styled-components' import { useGetHealthCenterQuery, useGetHealthInsuranceOverviewQuery, + useGetMedicineDataQuery, useGetPaymentOverviewQuery, useGetPaymentStatusQuery, } from '../../graphql/types/schema' @@ -93,6 +94,7 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({ const now = useMemo(() => new Date().toISOString(), []) + const medicinePurchaseRes = useGetMedicineDataQuery() const healthInsuranceRes = useGetHealthInsuranceOverviewQuery() const healthCenterRes = useGetHealthCenterQuery() const paymentStatusRes = useGetPaymentStatusQuery() @@ -108,10 +110,18 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({ }, }) + const medicinePurchaseData = + medicinePurchaseRes.data?.rightsPortalDrugPeriods?.[0] + const isMedicinePeriodActive = + medicinePurchaseData?.active || + (medicinePurchaseData?.dateTo && + new Date(medicinePurchaseData.dateTo) > new Date()) + useConnectivityIndicator({ componentId, refetching, queryResult: [ + medicinePurchaseRes, healthInsuranceRes, healthCenterRes, paymentStatusRes, @@ -124,6 +134,7 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({ try { const promises = [ + medicinePurchaseRes.refetch(), healthInsuranceRes.refetch(), healthCenterRes.refetch(), paymentStatusRes.refetch(), @@ -136,6 +147,7 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({ setRefetching(false) } }, [ + medicinePurchaseRes, healthInsuranceRes, healthCenterRes, paymentStatusRes, @@ -376,6 +388,65 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({ noBorder /> + + openBrowser( + `${origin}/minarsidur/heilsa/lyf/lyfjakaup`, + componentId, + ) + } + /> + + + + + + diff --git a/apps/native/app/src/ui/lib/input/input.tsx b/apps/native/app/src/ui/lib/input/input.tsx index da6f61c19420..19b526329285 100644 --- a/apps/native/app/src/ui/lib/input/input.tsx +++ b/apps/native/app/src/ui/lib/input/input.tsx @@ -6,6 +6,7 @@ import CopyIcon from '../../assets/icons/copy.png' import { dynamicColor } from '../../utils' import { Skeleton } from '../skeleton/skeleton' import { Typography } from '../typography/typography' +import { Label } from '@ui' const Host = styled.SafeAreaView<{ noBorder: boolean @@ -35,10 +36,15 @@ const Content = styled.View<{ isCompact: boolean }>` theme.spacing[isCompact ? 1 : 3]}px; ` -const Label = styled(Typography)` +const LabelText = styled(Typography)` margin-bottom: ${({ theme }) => theme.spacing[1]}px; ` +const WarningMessage = styled.View` + margin-top: ${({ theme }) => theme.spacing[2]}px; + flex-direction: row; +` + interface InputProps { label: string value?: string | null @@ -50,6 +56,7 @@ interface InputProps { isCompact?: boolean darkBorder?: boolean copy?: boolean + warningText?: string } export function Input({ @@ -63,6 +70,7 @@ export function Input({ isCompact = false, darkBorder = false, copy = false, + warningText = '', }: InputProps) { const tvalue = value !== undefined && typeof value === 'string' && value.trim() @@ -70,7 +78,7 @@ export function Input({ return ( - + {label} {loading || error ? ( ) : ( - - - {tvalue === '' || !value ? '-' : value} - - {copy && ( - Clipboard.setString(value ?? '')} - style={{ marginLeft: 4 }} + <> + + - - + {tvalue === '' || !value ? '-' : value} + + {copy && ( + Clipboard.setString(value ?? '')} + style={{ marginLeft: 4 }} + > + + + )} + + {warningText && ( + + + )} - + )}