Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(accident-notification): procure for accident notifications #16337

Merged
merged 18 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
IdentityApi,
NationalRegistryUserApi,
} from '@island.is/application/types'

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useLocale } from '@island.is/localization'
import { DatePickerController } from '@island.is/shared/form-fields'
import React, { FC, useCallback, useEffect, useState } from 'react'
import { Controller, useFormContext } from 'react-hook-form'
import { NO, YES } from '../../constants'
import { NO, YES } from '../../utils/constants'
import { useLazyIsHealthInsured } from '../../hooks/useLazyIsHealthInsured'
import { AccidentNotification } from '../../lib/dataSchema'
import { accidentDetails } from '../../lib/messages'
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import is from 'date-fns/locale/is'
import parseISO from 'date-fns/parseISO'
import kennitala from 'kennitala'
import React, { FC } from 'react'
import { States, YES } from '../../constants'
import { States, YES } from '../../utils/constants'
import { AccidentNotification } from '../../lib/dataSchema'
import {
accidentDetails,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export { AgreementDescription } from './AgreementDescription'
export { DateOfAccident } from './DateOfAccident'
export { FormOverview } from './FormOverview'
export { HiddenInformation } from './HiddenInformation'
export { ApplicationStatus } from './ApplicationStatus'
export { FormOverviewInReview } from './FormOverviewInReview'
export { ProxyDocument } from './ProxyDocument'
export { DescriptionWithLink } from './DescriptionWithLink'
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ import {
isRepresentativeOfCompanyOrInstitute,
} from '../../../utils'
import { AttachmentsEnum } from '../../../types'
import { FILE_SIZE_LIMIT, NO, UPLOAD_ACCEPT, YES } from '../../../constants'
import {
FILE_SIZE_LIMIT,
NO,
UPLOAD_ACCEPT,
YES,
} from '../../../utils/constants'

// Injury certificate and fatal accident section
export const attachmentsSubSection = buildSubSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
isRescueWorkAccident,
isStudiesAccident,
} from '../../../utils'
import { NO, YES } from '../../../constants'
import { NO, YES } from '../../../utils/constants'
import { isSportAccidentAndEmployee } from '../../../utils/isSportAccidentAndEmployee'
import {
AgricultureAccidentLocationEnum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
isGeneralWorkplaceAccident,
} from '../../../utils'
import { isSportAccidentAndEmployee } from '../../../utils/isSportAccidentAndEmployee'
import { NO, YES } from '../../../constants'
import { NO, YES } from '../../../utils/constants'

// Workmachine information only applicable to generic workplace accidents
export const workMachineSubSection = buildSubSection({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { buildSection } from '@island.is/application/core'

import { applicantInformation } from '../../lib/messages'
import { applicantInformationMultiField } from '@island.is/application/ui-forms'

export const applicantInformationSection = buildSection({
id: 'informationAboutApplicantSection',
title: applicantInformation.general.title,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import { buildForm } from '@island.is/application/core'
import { Form, FormModes } from '@island.is/application/types'
import Logo from '../../assets/Logo'
import { application } from '../../lib/messages'

import { conclusionSection } from './conclusionSection'

import { overviewSection } from './overviewSection'
import { betaTestSection } from './betaTestSection'
import { applicantInformationSection } from './applicantInformationSection'
import { whoIsTheNotificationForSection } from './whoIsTheNotificationForSection'
import { externalDataSection } from './externalDataSection'
import { aboutTheAccidentSection } from './aboutTheAccidentSection'

export const AccidentNotificationForm: Form = buildForm({
Expand All @@ -18,8 +14,6 @@ export const AccidentNotificationForm: Form = buildForm({
logo: Logo,
mode: FormModes.DRAFT,
children: [
betaTestSection,
externalDataSection,
applicantInformationSection,
whoIsTheNotificationForSection,
aboutTheAccidentSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@island.is/application/core'
import { juridicalPerson } from '../../../lib/messages'
import { isReportingOnBehalfOfEmployee } from '../../../utils'
import { YES } from '../../../constants'
import { YES } from '../../../utils/constants'
jonnigs marked this conversation as resolved.
Show resolved Hide resolved

export const juridicalPersonCompanySubSection = buildSubSection({
id: 'juridicalPerson.company',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
buildSubSection,
} from '@island.is/application/core'
import { error, powerOfAttorney } from '../../../lib/messages'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../../constants'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../../utils/constants'
import { isUploadNow } from '../../../utils/isUploadNow'

export const powerOfAttorneyUploadSubSection = buildSubSection({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import { buildMultiField, buildRadioField } from '@island.is/application/core'
import { whoIsTheNotificationFor } from '../../../lib/messages'
import { WhoIsTheNotificationForEnum } from '../../../types'
import {
whoIsTheNotificationForOptions,
whoIsTheNotificationForProcureOptions,
} from '../../../utils/getWhoIstheNotificationForOptions'

export const whoIsTheNotificationForMultiField = buildMultiField({
id: 'whoIsTheNotificationFor',
title: whoIsTheNotificationFor.general.heading,
description: whoIsTheNotificationFor.general.description,
description: (application) => {
if (application.externalData.identity) {
return whoIsTheNotificationFor.general.procureDescription
}
return whoIsTheNotificationFor.general.description
},
jonnigs marked this conversation as resolved.
Show resolved Hide resolved
children: [
buildRadioField({
id: 'whoIsTheNotificationFor.answer',
title: '',
width: 'half',
options: [
{
value: WhoIsTheNotificationForEnum.ME,
label: whoIsTheNotificationFor.labels.me,
},
{
value: WhoIsTheNotificationForEnum.POWEROFATTORNEY,
label: whoIsTheNotificationFor.labels.powerOfAttorney,
},
{
value: WhoIsTheNotificationForEnum.JURIDICALPERSON,
label: whoIsTheNotificationFor.labels.juridicalPerson,
},
{
value: WhoIsTheNotificationForEnum.CHILDINCUSTODY,
label: whoIsTheNotificationFor.labels.childInCustody,
},
],
condition: (_answers, externalData) => !externalData.identity,
options: whoIsTheNotificationForOptions,
}),
jonnigs marked this conversation as resolved.
Show resolved Hide resolved
buildRadioField({
id: 'whoIsTheNotificationFor.answer',
title: '',
width: 'half',
condition: (_answers, externalData) => !!externalData.identity,
options: whoIsTheNotificationForProcureOptions,
}),
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
buildSubmitField,
} from '@island.is/application/core'
import { DefaultEvents, FormValue } from '@island.is/application/types'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../constants'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../utils/constants'
import { addDocuments, error } from '../../lib/messages'
import {
hasReceivedInjuryCertificate,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
buildDescriptionField,
buildMultiField,
buildSection,
} from '@island.is/application/core'
import { externalData } from '../../lib/messages'

export const dataHandlingSection = buildSection({
id: 'ExternalDataSection',
title: externalData.agreementDescription.listTitle,
children: [
buildMultiField({
title: externalData.agreementDescription.sectionTitle,
id: 'agreementDescriptionMultiField',
space: 2,
children: [
buildDescriptionField({
id: 'agreementDescriptionDescriptionField',
title: '',
description: externalData.agreementDescription.bullets,
}),
buildDescriptionField({
id: 'moreInformation',
title: '',
description: externalData.agreementDescription.moreInformation,
}),
],
}),
],
})
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import {
buildDataProviderItem,
buildExternalDataProvider,
buildSubSection,
buildSection,
buildSubmitField,
coreMessages,
} from '@island.is/application/core'
import { externalData } from '../../../lib/messages'
import { NationalRegistryUserApi } from '@island.is/application/types'
import { externalData } from '../../lib/messages'
import { NationalRegistryUserApi } from '../../dataProviders'

export const accidentNotificationSubSection = buildSubSection({
id: 'AccidentNotificationForm',
export const externalDataSection = buildSection({
id: 'ExternalDataRegularSection',
title: externalData.dataProvider.sectionTitle,
children: [
buildExternalDataProvider({
Expand All @@ -16,6 +18,19 @@ export const accidentNotificationSubSection = buildSubSection({
subTitle: externalData.dataProvider.subTitle,
description: '',
checkboxLabel: externalData.dataProvider.checkboxLabel,
submitField: buildSubmitField({
id: 'submit',
placement: 'footer',
title: '',
refetchApplicationAfterSubmit: true,
actions: [
{
event: 'SUBMIT',
name: coreMessages.buttonNext,
type: 'primary',
},
],
}),
dataProviders: [
buildDataProviderItem({
id: 'directoryOfLabor',
Expand Down
Loading
Loading