From 7b94815a2b76f48d981cf73578b09956a9868607 Mon Sep 17 00:00:00 2001 From: Eusebio Date: Thu, 8 May 2025 12:20:16 +0200 Subject: [PATCH 1/5] Add basic setup validation --- apps/tax/screens/Tax/steps/StepThree.tsx | 86 +++++++++++++----------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/apps/tax/screens/Tax/steps/StepThree.tsx b/apps/tax/screens/Tax/steps/StepThree.tsx index 320c863b..b0579a3f 100644 --- a/apps/tax/screens/Tax/steps/StepThree.tsx +++ b/apps/tax/screens/Tax/steps/StepThree.tsx @@ -1,3 +1,5 @@ +import { Controller, useForm } from 'react-hook-form' + import { Box, Button, @@ -8,6 +10,7 @@ import { Input, Text, } from '@island.is/island-ui/core' +import { InputController } from '@island.is/shared/form-fields' import Buttons from '../Buttons' @@ -16,7 +19,19 @@ type StepThreeProps = { onBackward: () => void } +interface InputState { + employerName: string + salary: number +} + const StepThree = ({ onForward, onBackward }: StepThreeProps) => { + const { control, handleSubmit, formState } = useForm() + + const onSubmit = (inputState: InputState) => { + onForward() + console.log(inputState) + } + return ( { Launatekjur og starfstengdar greiðslur - - Nafn launagreiðanda - + Nafn launagreiðanda + + - - - - Laun - - - - ) diff --git a/apps/tax/screens/Tax/steps/StepFour.tsx b/apps/tax/screens/Tax/steps/StepFour.tsx index 4752d394..37261726 100644 --- a/apps/tax/screens/Tax/steps/StepFour.tsx +++ b/apps/tax/screens/Tax/steps/StepFour.tsx @@ -1,12 +1,15 @@ +import { useForm } from 'react-hook-form' + import { Box, Button, GridColumn, GridContainer, GridRow, - Input, Text, } from '@island.is/island-ui/core' +import { InputController } from '@island.is/shared/form-fields' +import { REQUIRED_ERROR_MESSAGE } from '@island.is/tax/constants' import Buttons from '../Buttons' @@ -15,7 +18,20 @@ type StepFourProps = { onBackward: () => void } +interface InputState { + assetNumber: string + propertyLocation: string + propertyValue: string +} + const StepFour = ({ onForward, onBackward }: StepFourProps) => { + const { control, handleSubmit, formState } = useForm() + + const onSubmit = (inputState: InputState) => { + onForward() + console.log(inputState) + } + return ( { - - - + ) } diff --git a/apps/tax/screens/Tax/steps/StepSix.tsx b/apps/tax/screens/Tax/steps/StepSix.tsx index 41a081e6..f52c4156 100644 --- a/apps/tax/screens/Tax/steps/StepSix.tsx +++ b/apps/tax/screens/Tax/steps/StepSix.tsx @@ -540,13 +540,13 @@ const StepSix = ({ onForward, onBackward }: StepSixProps) => { - + - + ) } diff --git a/apps/tax/screens/Tax/steps/StepThree.tsx b/apps/tax/screens/Tax/steps/StepThree.tsx index b0579a3f..e20ce5d8 100644 --- a/apps/tax/screens/Tax/steps/StepThree.tsx +++ b/apps/tax/screens/Tax/steps/StepThree.tsx @@ -1,4 +1,4 @@ -import { Controller, useForm } from 'react-hook-form' +import { useForm } from 'react-hook-form' import { Box, @@ -11,6 +11,7 @@ import { Text, } from '@island.is/island-ui/core' import { InputController } from '@island.is/shared/form-fields' +import { REQUIRED_ERROR_MESSAGE } from '@island.is/tax/constants' import Buttons from '../Buttons' @@ -63,7 +64,7 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { rules={{ required: { value: true, - message: 'Áskilið reitur', + message: REQUIRED_ERROR_MESSAGE, }, }} /> @@ -78,7 +79,7 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { id="salary" control={control} backgroundColor="blue" - maxLength={4} + maxLength={20} required={true} name="salary" placeholder="9.360.000 kr." @@ -89,7 +90,7 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { rules={{ required: { value: true, - message: 'Áskilið reitur', + message: REQUIRED_ERROR_MESSAGE, }, }} /> From 3056d84a3444e2047c6f150c4d500c8a1d6484b6 Mon Sep 17 00:00:00 2001 From: Hossein Rashno Date: Thu, 8 May 2025 14:19:39 +0200 Subject: [PATCH 3/5] Connect Login, step 1 and 2 with backend --- apps/tax/pages/login/index.tsx | 45 +++++++++++++-------- apps/tax/screens/Tax/steps/StepThree.tsx | 51 ++++++++++++++++++++---- apps/tax/screens/Tax/steps/StepTwo.tsx | 38 +++++++++++++----- 3 files changed, 101 insertions(+), 33 deletions(-) diff --git a/apps/tax/pages/login/index.tsx b/apps/tax/pages/login/index.tsx index dadb236d..58307804 100644 --- a/apps/tax/pages/login/index.tsx +++ b/apps/tax/pages/login/index.tsx @@ -1,24 +1,35 @@ -import React from 'react' +import React, {useState} from 'react' import router from 'next/router' +import { + useLazyQuery, +} from "@apollo/client"; import { Box, Button, Input, Link, Logo, Text } from '@island.is/island-ui/core' import { formWrapper } from '@island.is/tax/screens/Tax/login/Login.css' -export async function getServerSideProps() { - const taxData = { - country: 'test', - vatRate: 10, - description: 'test', - } +import {GetUserByPhoneQuery} from '../../graphql/schema' +import { withApollo } from "../../graphql/withApollo"; +import { + GET_USER_BY_PHONE_QUERY, +} from "../../screens/queries"; + +const Login = () => { + const [phone, setPhone] = useState(''); - return { - props: { - taxInfo: taxData, - }, + const [fetchUser] = useLazyQuery(GET_USER_BY_PHONE_QUERY); + + const onLogin = async () => { + const result = await fetchUser({ + variables: { + phone, + }, + }); + if (result.data) { + localStorage.setItem('session_token', result.data.userByPhone.id); + void router.push('tax'); + } } -} -const Login = ({ loginInfo }) => { return ( { name="" size="sm" placeholder="000-0000" - type="number" + type="tel" + value={phone} + onChange={(e) => setPhone(e.target.value)} /> @@ -113,4 +126,4 @@ const Login = ({ loginInfo }) => { ) } -export default Login +export default withApollo(Login); diff --git a/apps/tax/screens/Tax/steps/StepThree.tsx b/apps/tax/screens/Tax/steps/StepThree.tsx index b0579a3f..dc636003 100644 --- a/apps/tax/screens/Tax/steps/StepThree.tsx +++ b/apps/tax/screens/Tax/steps/StepThree.tsx @@ -1,4 +1,6 @@ -import { Controller, useForm } from 'react-hook-form' +import { useEffect, useMemo } from 'react' +import { useForm } from 'react-hook-form' +import { useQuery, useMutation } from '@apollo/client' import { Box, @@ -12,6 +14,9 @@ import { } from '@island.is/island-ui/core' import { InputController } from '@island.is/shared/form-fields' +import {GetUserQuery} from '../../../graphql/schema' +import { withApollo } from "../../../graphql/withApollo"; +import { CREATE_INCOME_MUTATION, GET_USER_QUERY, UPDATE_INCOME_MUTATION } from '../../queries' import Buttons from '../Buttons' type StepThreeProps = { @@ -24,12 +29,42 @@ interface InputState { salary: number } +const formatter = new Intl.NumberFormat('is-IS', { + style: 'decimal', + minimumFractionDigits: 0, + maximumFractionDigits: 0 +}); + const StepThree = ({ onForward, onBackward }: StepThreeProps) => { - const { control, handleSubmit, formState } = useForm() + const { control, handleSubmit, formState, setValue, watch } = useForm(); + const [createIncome] = useMutation(CREATE_INCOME_MUTATION); + const [updateIncome] = useMutation(UPDATE_INCOME_MUTATION); + const { data } = useQuery(GET_USER_QUERY, { + variables: { + // Getting user id from local storage demo purpose + id: Number(localStorage.getItem('session_token')), + }, + }); + + const assetData = useMemo(() => data?.user.taxReturns?.[0]?.incomes?.[0], [data?.user.taxReturns]); + + useEffect(() => { + if (assetData) { + setValue('employerName', assetData.source) + setValue('salary', assetData.amount) + } + }, [assetData, data?.user.taxReturns, setValue]); + + const salary = watch('salary'); - const onSubmit = (inputState: InputState) => { - onForward() - console.log(inputState) + const onSubmit = async (inputState: InputState) => { + if (assetData) { + await updateIncome({ variables: { income: {id: Number(assetData.id), source: inputState.employerName, amount: Number(inputState.salary), type: 'salary' }}}); + onForward(); + } else { + await createIncome({ variables: { income: {taxReturnId: data?.user.taxReturns?.[0].id, source: inputState.employerName, amount: Number(inputState.salary), type: 'salary' }}}); + onForward(); + } } return ( @@ -52,7 +87,7 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { id="employerName" control={control} backgroundColor="blue" - maxLength={20} + maxLength={200} required={true} name="employerName" placeholder="Norðurljós Software ehf" @@ -122,7 +157,7 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { backgroundColor="white" maxLength={4} name="Input" - placeholder="10.260.000 kr." + placeholder={formatter.format(salary ?? 0) + ' kr.'} rows={0} size="xs" type="number" @@ -135,4 +170,4 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { ) } -export default StepThree +export default withApollo(StepThree) diff --git a/apps/tax/screens/Tax/steps/StepTwo.tsx b/apps/tax/screens/Tax/steps/StepTwo.tsx index d2a8fc46..bf684c7f 100644 --- a/apps/tax/screens/Tax/steps/StepTwo.tsx +++ b/apps/tax/screens/Tax/steps/StepTwo.tsx @@ -1,3 +1,5 @@ +import { useQuery} from '@apollo/client' + import { AlertMessage, Box, @@ -10,6 +12,9 @@ import { } from '@island.is/island-ui/core' import { fieldWrapper } from '@island.is/tax/screens/Tax/steps/StepTwo.css' +import {GetUserQuery} from '../../../graphql/schema' +import { withApollo } from "../../../graphql/withApollo"; +import { GET_USER_QUERY } from "../../queries"; import Buttons from '../Buttons' type StepTwoProps = { @@ -18,6 +23,13 @@ type StepTwoProps = { } const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { + const { data } = useQuery(GET_USER_QUERY, { + variables: { + // Getting user id from local storage demo purpose + id: Number(localStorage.getItem('session_token')), + }, + }); + return ( { backgroundColor="white" label="Fullt nafn" name="" - placeholder="Jökull Þórðarson" + value={data?.user.firstName + ' ' + data?.user.lastName} size="sm" type="text" + disabled={true} /> @@ -53,9 +66,10 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { backgroundColor="white" label="Kennitala" name="" - placeholder="120389-4569" + value={data?.user.ssn} size="sm" - type="number" + type="text" + disabled={true} /> @@ -64,9 +78,10 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { backgroundColor="white" label="Heimili" name="" - placeholder="Bláfjallagata 12" + value={data?.user.streetAndHouseNumber ?? ""} size="sm" type="text" + disabled={true} /> @@ -76,9 +91,10 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { backgroundColor="white" label="Póstnúmer" name="" - placeholder="105" + value={data?.user.postalCode ?? 0} size="sm" type="number" + disabled={true} /> @@ -87,9 +103,10 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { backgroundColor="white" label="Sveitarfélag" name="" - placeholder="Reykjavík" + value={data?.user.city ?? ""} size="sm" type="text" + disabled={true} /> @@ -99,9 +116,11 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { backgroundColor="white" label="Netfang " name="" - placeholder="jokull.thordarson@email.is" + value={data?.user.email ?? ""} size="sm" type="email" + autoComplete="off" + disabled={true} /> @@ -110,9 +129,10 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { backgroundColor="white" label="Símanúmer" name="" - placeholder="+354 772-8391" + value={data?.user.phone ?? ""} size="sm" type="tel" + disabled={true} /> @@ -129,4 +149,4 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { ) } -export default StepTwo +export default withApollo(StepTwo); From 3ffbbc9d9e9bc36b3a6428fd9244ff6e346888f6 Mon Sep 17 00:00:00 2001 From: Hossein Rashno Date: Thu, 8 May 2025 14:54:33 +0200 Subject: [PATCH 4/5] Connect step 3 and 4 --- apps/tax/pages/login/index.tsx | 19 ++++++--- apps/tax/screens/Tax/steps/StepFour.tsx | 50 ++++++++++++++++++++---- apps/tax/screens/Tax/steps/StepThree.tsx | 18 ++++----- apps/tax/screens/Tax/steps/StepTwo.tsx | 14 +++++-- 4 files changed, 76 insertions(+), 25 deletions(-) diff --git a/apps/tax/pages/login/index.tsx b/apps/tax/pages/login/index.tsx index 916c74a9..6339f330 100644 --- a/apps/tax/pages/login/index.tsx +++ b/apps/tax/pages/login/index.tsx @@ -15,6 +15,7 @@ import { const Login = () => { const [phone, setPhone] = useState(''); + const [isError, setIsError] = useState(false); const [fetchUser] = useLazyQuery(GET_USER_BY_PHONE_QUERY); @@ -27,6 +28,8 @@ const Login = () => { if (result.data) { localStorage.setItem('session_token', result.data.userByPhone.id); void router.push('tax'); + } else { + setIsError(true); } } @@ -63,12 +66,16 @@ const Login = () => { á mínar síður Ísland.is - - - + { + isError && ( + + + + ) + } void @@ -26,12 +31,43 @@ interface InputState { propertyValue: string } +const formatter = new Intl.NumberFormat('is-IS', { + style: 'decimal', + minimumFractionDigits: 0, + maximumFractionDigits: 0 +}); + const StepFour = ({ onForward, onBackward }: StepFourProps) => { - const { control, handleSubmit, formState } = useForm() + const { control, handleSubmit, formState, setValue, watch } = useForm(); + const [createAsset] = useMutation(CREATE_ASSET_MUTATION); + const [updateAsset] = useMutation(UPDATE_ASSET_MUTATION); + const { data } = useQuery(GET_USER_QUERY, { + variables: { + // Getting user id from local storage demo purpose + id: Number(localStorage.getItem('session_token')), + }, + }); + + const assetData = useMemo(() => data?.user.taxReturns?.[0]?.assets?.[0], [data?.user.taxReturns]); + + useEffect(() => { + if (assetData) { + setValue('assetNumber', assetData.assetId ?? '') + setValue('propertyLocation', assetData.address ?? '') + setValue('propertyValue', assetData.value? assetData.value.toString() : '') + } + }, [assetData, setValue]); - const onSubmit = (inputState: InputState) => { - onForward() - console.log(inputState) + const propertyValue = watch('propertyValue'); + + const onSubmit = async (inputState: InputState) => { + if (assetData) { + await updateAsset({ variables: { asset: {id: Number(assetData.id), assetId: inputState.assetNumber, address: inputState.propertyLocation, value: Number(inputState.propertyValue) }}}); + onForward(); + } else { + await createAsset({ variables: { asset: {taxReturnId: data?.user.taxReturns?.[0].id, assetId: inputState.assetNumber, address: inputState.propertyLocation, value: Number(inputState.propertyValue) }}}); + onForward(); + } } return ( @@ -153,10 +189,10 @@ const StepFour = ({ onForward, onBackward }: StepFourProps) => { backgroundColor="white" maxLength={4} name="Input" - placeholder="10.260.000 kr." + value={formatter.format(propertyValue? Number(propertyValue):0) + ' kr.'} rows={0} size="xs" - type="number" + type="text" /> @@ -169,4 +205,4 @@ const StepFour = ({ onForward, onBackward }: StepFourProps) => { ) } -export default StepFour +export default withApollo(StepFour) diff --git a/apps/tax/screens/Tax/steps/StepThree.tsx b/apps/tax/screens/Tax/steps/StepThree.tsx index b3fda89d..5c6cafbf 100644 --- a/apps/tax/screens/Tax/steps/StepThree.tsx +++ b/apps/tax/screens/Tax/steps/StepThree.tsx @@ -47,20 +47,20 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { }, }); - const assetData = useMemo(() => data?.user.taxReturns?.[0]?.incomes?.[0], [data?.user.taxReturns]); + const incomeData = useMemo(() => data?.user.taxReturns?.[0]?.incomes?.[0], [data?.user.taxReturns]); useEffect(() => { - if (assetData) { - setValue('employerName', assetData.source) - setValue('salary', assetData.amount) + if (incomeData) { + setValue('employerName', incomeData.source) + setValue('salary', incomeData.amount) } - }, [assetData, data?.user.taxReturns, setValue]); + }, [incomeData, data?.user.taxReturns, setValue]); const salary = watch('salary'); const onSubmit = async (inputState: InputState) => { - if (assetData) { - await updateIncome({ variables: { income: {id: Number(assetData.id), source: inputState.employerName, amount: Number(inputState.salary), type: 'salary' }}}); + if (incomeData) { + await updateIncome({ variables: { income: {id: Number(incomeData.id), source: inputState.employerName, amount: Number(inputState.salary), type: 'salary' }}}); onForward(); } else { await createIncome({ variables: { income: {taxReturnId: data?.user.taxReturns?.[0].id, source: inputState.employerName, amount: Number(inputState.salary), type: 'salary' }}}); @@ -158,10 +158,10 @@ const StepThree = ({ onForward, onBackward }: StepThreeProps) => { backgroundColor="white" maxLength={4} name="Input" - placeholder={formatter.format(salary ?? 0) + ' kr.'} + value={formatter.format(salary ?? 0) + ' kr.'} rows={0} size="xs" - type="number" + type="text" /> diff --git a/apps/tax/screens/Tax/steps/StepTwo.tsx b/apps/tax/screens/Tax/steps/StepTwo.tsx index 0bf5cd48..eac2b084 100644 --- a/apps/tax/screens/Tax/steps/StepTwo.tsx +++ b/apps/tax/screens/Tax/steps/StepTwo.tsx @@ -1,4 +1,4 @@ -import { useQuery} from '@apollo/client' +import { useQuery, useMutation } from '@apollo/client' import { AlertMessage, @@ -13,7 +13,7 @@ import { fieldWrapper } from '@island.is/tax/screens/Tax/steps/StepTwo.css' import {GetUserQuery} from '../../../graphql/schema' import { withApollo } from "../../../graphql/withApollo"; -import { GET_USER_QUERY } from "../../queries"; +import { CREATE_TAX_RETURN_MUTATION, GET_USER_QUERY } from '../../queries' import Buttons from '../Buttons' type StepTwoProps = { @@ -22,6 +22,7 @@ type StepTwoProps = { } const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { + const [createTaxReturn] = useMutation(CREATE_TAX_RETURN_MUTATION); const { data } = useQuery(GET_USER_QUERY, { variables: { // Getting user id from local storage demo purpose @@ -29,6 +30,13 @@ const StepTwo = ({ onForward, onBackward }: StepTwoProps) => { }, }); + const onNext = async () => { + if (!data?.user.taxReturns || data.user.taxReturns.length === 0) { + await createTaxReturn({ variables: { taxReturn: {userId: Number(data?.user.id), year: 2025, status: 'draft' }}}); + } + onForward(); + } + return ( { message="Ef netfang og símanúmer er ekki rétt hér að ofan þá verður að breyta þeim upplýsingum á mínum síðum Ísland.is" /> - + ) } From ee25aa0dd2360d906628bcee74dee204b7667deb Mon Sep 17 00:00:00 2001 From: Eusebio Date: Thu, 8 May 2025 15:08:43 +0200 Subject: [PATCH 5/5] Add front validation --- apps/services/auth/ids-api/src/openapi.yaml | 4 +- .../src/openapi.yaml | 4 +- .../personal-representative/src/openapi.yaml | 10 +- .../endorsements/api/src/openapi.yaml | 4 +- .../user-notification/src/openapi.yaml | 4 +- apps/tax/pages/tax/index.tsx | 8 +- apps/tax/screens/Tax/steps/StepFive.tsx | 163 +++++++++++++++--- apps/tax/screens/Tax/steps/StepFour.tsx | 8 +- apps/tax/screens/Tax/steps/StepThree.tsx | 2 +- apps/tax/screens/Tax/steps/index.ts | 9 + 10 files changed, 167 insertions(+), 49 deletions(-) create mode 100644 apps/tax/screens/Tax/steps/index.ts diff --git a/apps/services/auth/ids-api/src/openapi.yaml b/apps/services/auth/ids-api/src/openapi.yaml index 0a8601fd..46709742 100644 --- a/apps/services/auth/ids-api/src/openapi.yaml +++ b/apps/services/auth/ids-api/src/openapi.yaml @@ -2360,7 +2360,7 @@ components: expiration: format: date-time type: string - example: 2025-05-08T09:53:30.554Z + example: 2025-05-09T07:13:23.068Z consumedTime: format: date-time type: string @@ -2413,7 +2413,7 @@ components: expiration: format: date-time type: string - example: 2025-05-08T09:53:30.612Z + example: 2025-05-09T07:13:23.125Z consumedTime: type: object data: diff --git a/apps/services/auth/personal-representative-public/src/openapi.yaml b/apps/services/auth/personal-representative-public/src/openapi.yaml index 7c3cd31b..bacb62c8 100644 --- a/apps/services/auth/personal-representative-public/src/openapi.yaml +++ b/apps/services/auth/personal-representative-public/src/openapi.yaml @@ -343,11 +343,11 @@ components: validFrom: format: date-time type: string - example: 2025-05-06T09:53:25.263Z + example: 2025-05-07T07:13:17.918Z validTo: format: date-time type: string - example: 2025-05-08T09:53:25.263Z + example: 2025-05-09T07:13:17.918Z required: - code - description diff --git a/apps/services/auth/personal-representative/src/openapi.yaml b/apps/services/auth/personal-representative/src/openapi.yaml index 7825b91e..3e068eb9 100644 --- a/apps/services/auth/personal-representative/src/openapi.yaml +++ b/apps/services/auth/personal-representative/src/openapi.yaml @@ -1032,11 +1032,11 @@ components: validFrom: format: date-time type: string - example: 2025-05-06T09:53:29.098Z + example: 2025-05-07T07:13:21.877Z validTo: format: date-time type: string - example: 2025-05-08T09:53:29.098Z + example: 2025-05-09T07:13:21.877Z required: - code - description @@ -1135,7 +1135,7 @@ components: validTo: format: date-time type: string - example: 2025-05-08T09:53:29.087Z + example: 2025-05-09T07:13:21.867Z rights: example: >- [{code:"health", description:"health descr", validFrom:"xx.yy.zzzz", @@ -1222,7 +1222,7 @@ components: validTo: format: date-time type: string - example: 2025-05-08T09:53:29.090Z + example: 2025-05-09T07:13:21.869Z rightCodes: example: '["health", "finance"]' description: >- @@ -1254,7 +1254,7 @@ components: validTo: format: date-time type: string - example: 2025-05-08T09:53:29.096Z + example: 2025-05-09T07:13:21.874Z required: - code - name diff --git a/apps/services/endorsements/api/src/openapi.yaml b/apps/services/endorsements/api/src/openapi.yaml index 147fdace..20888e00 100644 --- a/apps/services/endorsements/api/src/openapi.yaml +++ b/apps/services/endorsements/api/src/openapi.yaml @@ -1054,11 +1054,11 @@ components: openedDate: format: date-time type: string - default: 2025-05-07T09:51:13.496Z + default: 2025-05-08T07:11:05.497Z closedDate: format: date-time type: string - default: 2025-06-07T09:51:13.496Z + default: 2025-06-08T07:11:05.497Z adminLock: type: boolean default: false diff --git a/apps/services/user-notification/src/openapi.yaml b/apps/services/user-notification/src/openapi.yaml index b9abb16e..3a6d0981 100644 --- a/apps/services/user-notification/src/openapi.yaml +++ b/apps/services/user-notification/src/openapi.yaml @@ -806,11 +806,11 @@ components: created: format: date-time type: string - example: '2025-05-07T09:51:06.931Z' + example: '2025-05-08T07:10:59.050Z' updated: format: date-time type: string - example: '2025-05-07T09:51:06.931Z' + example: '2025-05-08T07:10:59.050Z' read: type: boolean example: false diff --git a/apps/tax/pages/tax/index.tsx b/apps/tax/pages/tax/index.tsx index 70fdd8c1..513d3f27 100644 --- a/apps/tax/pages/tax/index.tsx +++ b/apps/tax/pages/tax/index.tsx @@ -2,13 +2,7 @@ import React, { useState } from 'react' import { Box, FormStepperV2, Section } from '@island.is/island-ui/core' import FormStepsLayout from '@island.is/tax/screens/Layouts/FormStepsLayout' -import StepFive from '@island.is/tax/screens/Tax/steps/StepFive' -import StepFour from '@island.is/tax/screens/Tax/steps/StepFour' -import StepOne from '@island.is/tax/screens/Tax/steps/StepOne' -import StepSeven from '@island.is/tax/screens/Tax/steps/StepSeven' -import StepSix from '@island.is/tax/screens/Tax/steps/StepSix' -import StepThree from '@island.is/tax/screens/Tax/steps/StepThree' -import StepTwo from '@island.is/tax/screens/Tax/steps/StepTwo' +import { StepFive, StepFour, StepOne, StepSeven, StepSix, StepThree, StepTwo } from '@island.is/tax/screens/Tax/steps' const steps = [ { title: 'Gagnaöflun', index: 0 }, diff --git a/apps/tax/screens/Tax/steps/StepFive.tsx b/apps/tax/screens/Tax/steps/StepFive.tsx index b46d1c06..9244cf1e 100644 --- a/apps/tax/screens/Tax/steps/StepFive.tsx +++ b/apps/tax/screens/Tax/steps/StepFive.tsx @@ -1,12 +1,16 @@ +import { useForm } from 'react-hook-form' + import { AlertMessage, Box, + DatePicker, GridColumn, GridContainer, GridRow, - Input, Text, } from '@island.is/island-ui/core' +import { InputController } from '@island.is/shared/form-fields' +import { REQUIRED_ERROR_MESSAGE } from '@island.is/tax/constants' import Buttons from '../Buttons' @@ -15,7 +19,25 @@ type StepFiveProps = { onBackward: () => void } +interface InputState { + residentialLocation: string + loanNumber: string + borrowingDate: Date + loanTerm: number + lenderId: string + lenderName: string + totalPaymentsYear: number + nominalValue: number + interest: number + debt: number +} + const StepFive = ({ onForward, onBackward }: StepFiveProps) => { + const { control, handleSubmit, formState } = useForm() + + const onSubmit = (inputState: InputState) => { + onForward() + } return ( { - { - { - - { - { - { - { - { - { - { - + ) } diff --git a/apps/tax/screens/Tax/steps/StepFour.tsx b/apps/tax/screens/Tax/steps/StepFour.tsx index 073da6ca..02a9d9c3 100644 --- a/apps/tax/screens/Tax/steps/StepFour.tsx +++ b/apps/tax/screens/Tax/steps/StepFour.tsx @@ -1,5 +1,6 @@ +import { useEffect, useMemo } from 'react' import { useForm } from 'react-hook-form' -import { useQuery, useMutation } from '@apollo/client' +import { useMutation,useQuery } from '@apollo/client' import { Box, @@ -18,7 +19,6 @@ import {GetUserQuery} from '../../../graphql/schema' import { withApollo } from "../../../graphql/withApollo"; import { CREATE_ASSET_MUTATION, GET_USER_QUERY, UPDATE_ASSET_MUTATION } from '../../queries' import Buttons from '../Buttons' -import { useEffect, useMemo } from 'react' type StepFourProps = { onForward: () => void @@ -131,7 +131,7 @@ const StepFour = ({ onForward, onBackward }: StepFourProps) => { rows={0} size="xs" type="text" - error={formState.errors['assetNumber']?.message} + error={formState.errors['propertyLocation']?.message} rules={{ required: { value: true, @@ -154,7 +154,7 @@ const StepFour = ({ onForward, onBackward }: StepFourProps) => { rows={0} size="xs" type="number" - error={formState.errors['assetNumber']?.message} + error={formState.errors['propertyValue']?.message} rules={{ required: { value: true, diff --git a/apps/tax/screens/Tax/steps/StepThree.tsx b/apps/tax/screens/Tax/steps/StepThree.tsx index 5c6cafbf..6b706c11 100644 --- a/apps/tax/screens/Tax/steps/StepThree.tsx +++ b/apps/tax/screens/Tax/steps/StepThree.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo } from 'react' import { useForm } from 'react-hook-form' -import { useQuery, useMutation } from '@apollo/client' +import { useMutation,useQuery } from '@apollo/client' import { Box, diff --git a/apps/tax/screens/Tax/steps/index.ts b/apps/tax/screens/Tax/steps/index.ts new file mode 100644 index 00000000..01f0471d --- /dev/null +++ b/apps/tax/screens/Tax/steps/index.ts @@ -0,0 +1,9 @@ +import StepOne from "./StepOne"; +import StepTwo from "./StepTwo"; +import StepThree from "./StepThree"; +import StepFour from "./StepFour"; +import StepFive from "./StepFive"; +import StepSix from "./StepSix"; +import StepSeven from "./StepSeven"; + +export {StepOne, StepTwo, StepThree, StepFour, StepFive, StepSix, StepSeven} \ No newline at end of file