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

fix: remove steps and add fields to others #14821

Merged
merged 10 commits into from
May 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -507,30 +507,10 @@ export const FormOverview: FC<
</Text>
<ReviewGroup
isLast
editAction={() => changeScreens('timePassedHindrance')}
editAction={() => changeScreens('sportsClubInfo.employee.field')}
isEditable={application.state === States.DRAFT}
>
<GridRow>
<GridColumn span={['9/12', '9/12', '9/12', '10/12']}>
<ValueLine
label={hindrances.carAccident.radioFieldTitle}
value={
answers.carAccidentHindrance === YES
? applicationMessages.general.yesOptionLabel
: applicationMessages.general.noOptionLabel
}
/>
</GridColumn>
<GridColumn span={['9/12', '9/12', '9/12', '10/12']}>
<ValueLine
label={hindrances.timePassedHindrance.radioFieldTitle}
value={
answers.timePassedHindrance === YES
? applicationMessages.general.yesOptionLabel
: applicationMessages.general.noOptionLabel
}
/>
</GridColumn>
{isProfessionalAthleteAccident(answers as FormValue) && (
<GridColumn span={['9/12', '9/12', '9/12', '10/12']}>
<ValueLine
Expand Down Expand Up @@ -606,6 +586,12 @@ export const FormOverview: FC<
value={answers.accidentDetails.descriptionOfAccident}
/>
</GridColumn>
<GridColumn span={['9/12', '9/12', '9/12', '10/12']}>
<ValueLine
label={accidentDetails.labels.symptoms}
value={answers.accidentDetails.accidentSymptoms}
/>
</GridColumn>
<GridColumn span="12/12">
<FileValueLine label={overview.labels.attachments} files={files} />
{missingDocuments.length !== 0 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
fatalAccident,
fatalAccidentAttachment,
fishingCompanyInfo,
hindrances,
injuredPersonInformation,
locationAndPurpose,
rescueSquadInfo,
Expand Down Expand Up @@ -48,6 +47,7 @@ import {
getAccidentTypeOptions,
hideLocationAndPurpose,
isAgricultureAccident,
isDateOlderThanAYear,
isFatalAccident,
isFishermanAccident,
isGeneralWorkplaceAccident,
Expand All @@ -57,74 +57,19 @@ import {
isProfessionalAthleteAccident,
isReportingOnBehalfOfEmployee,
isReportingOnBehalfOfInjured,
isReportingOnBehalfSelf,
isRepresentativeOfCompanyOrInstitute,
isRescueWorkAccident,
isStudiesAccident,
isWorkAccident,
} from '../../utils'
import { isHealthInsured } from '../../utils/isHealthInsured'
import { isSportAccidentAndEmployee } from '../../utils/isSportAccidentAndEmployee'

export const aboutTheAccidentSection = buildSection({
id: 'accidentType.section',
title: accidentType.general.sectionTitle,
children: [
buildSubSection({
id: 'hindrances',
title: hindrances.general.sectionTitle,
jonnigs marked this conversation as resolved.
Show resolved Hide resolved
children: [
buildMultiField({
id: 'timePassedHindrancesMultiField',
title: hindrances.timePassedHindrance.radioFieldTitle,
children: [
buildRadioField({
id: 'timePassedHindrance',
title: '',
options: [
{ value: YES, label: application.general.yesOptionLabel },
{ value: NO, label: application.general.noOptionLabel },
],
width: 'half',
largeButtons: true,
required: true,
}),
buildAlertMessageField({
id: 'timePassedHindranceFielAlertMessage',
title: hindrances.timePassedHindrance.errorTitle,
message: hindrances.timePassedHindrance.errorDescription,
alertType: 'info',
doesNotRequireAnswer: true,
condition: (formValue) => formValue.timePassedHindrance === YES,
}),
],
}),
buildMultiField({
id: 'carHindrancesMultiField',
title: hindrances.carAccident.radioFieldTitle,
children: [
buildRadioField({
title: '',
id: 'carAccidentHindrance',
options: [
{ value: YES, label: application.general.yesOptionLabel },
{ value: NO, label: application.general.noOptionLabel },
],
width: 'half',
largeButtons: true,
required: true,
}),
buildAlertMessageField({
id: 'carAccidentHindranceFielAlertMessage',
title: hindrances.carAccident.errorTitle,
message: hindrances.carAccident.errorDescription,
alertType: 'info',
doesNotRequireAnswer: true,
condition: (formValue) => formValue.carAccidentHindrance === YES,
}),
],
}),
],
}),

buildSubSection({
id: 'accidentType.section',
title: accidentType.general.subsectionTitle,
Expand Down Expand Up @@ -181,6 +126,23 @@ export const aboutTheAccidentSection = buildSection({
condition: (formValue) => isAgricultureAccident(formValue),
marginBottom: 5,
}),
buildDescriptionField({
id: 'accidentDetails.descriptionField',
space: 'containerGutter',
title: injuredPersonInformation.general.jobTitle,
description: injuredPersonInformation.general.jobTitleDescription,
width: 'full',
marginBottom: 2,
condition: (formValue) => isReportingOnBehalfSelf(formValue),
}),
buildTextField({
id: 'injuredPersonInformation.jobTitle',
title: injuredPersonInformation.labels.jobTitle,
backgroundColor: 'white',
width: 'full',
maxLength: 100,
condition: (formValue) => isReportingOnBehalfSelf(formValue),
}),
],
}),
],
Expand Down Expand Up @@ -242,6 +204,14 @@ export const aboutTheAccidentSection = buildSection({
},
],
}),
buildAlertMessageField({
id: 'attachments.injuryCertificate.alert',
title: application.labels.warningTitle,
message: application.labels.warningMessage,
alertType: 'info',
doesNotRequireAnswer: true,
condition: (formValue) => isSportAccidentAndEmployee(formValue),
}),
],
}),

Expand Down Expand Up @@ -293,7 +263,9 @@ export const aboutTheAccidentSection = buildSection({
id: 'accidentLocation.generalWorkAccident',
title: accidentLocation.general.heading,
description: accidentLocation.general.description,
condition: (formValue) => isGeneralWorkplaceAccident(formValue),
condition: (formValue) =>
isGeneralWorkplaceAccident(formValue) ||
isSportAccidentAndEmployee(formValue),
children: [
buildRadioField({
id: 'accidentLocation.answer',
Expand Down Expand Up @@ -405,7 +377,9 @@ export const aboutTheAccidentSection = buildSection({
id: 'accidentLocation.professionalAthleteAccident',
title: accidentLocation.general.heading,
description: accidentLocation.general.description,
condition: (formValue) => isProfessionalAthleteAccident(formValue),
condition: (formValue) =>
isProfessionalAthleteAccident(formValue) &&
!isSportAccidentAndEmployee(formValue),
children: [
buildRadioField({
id: 'accidentLocation.answer',
Expand Down Expand Up @@ -518,7 +492,8 @@ export const aboutTheAccidentSection = buildSection({
title: workMachine.general.sectionTitle,
condition: (formValue) =>
isGeneralWorkplaceAccident(formValue) ||
isAgricultureAccident(formValue),
isAgricultureAccident(formValue) ||
isSportAccidentAndEmployee(formValue),
children: [
buildMultiField({
id: 'workMachine',
Expand Down Expand Up @@ -582,6 +557,15 @@ export const aboutTheAccidentSection = buildSection({
width: 'half',
format: '##:##',
}),
buildAlertMessageField({
id: 'accidentDetails.moreThanAYearAlertMessage',
title: accidentDetails.general.moreThanAYearAlertTitle,
message: accidentDetails.general.moreThanAYearAlertMessage,
width: 'full',
alertType: 'warning',
condition: (formValue) => isDateOlderThanAYear(formValue),
marginBottom: 0,
}),
buildAlertMessageField({
id: 'accidentDetails.notHealthInsuredAlertMessage',
title: accidentDetails.general.insuranceAlertTitle,
Expand All @@ -601,6 +585,37 @@ export const aboutTheAccidentSection = buildSection({
variant: 'textarea',
maxLength: 2000,
}),
buildTextField({
id: 'accidentDetails.accidentSymptoms',
title: accidentDetails.labels.symptoms,
placeholder: accidentDetails.placeholder.symptoms,
backgroundColor: 'blue',
required: true,
rows: 10,
variant: 'textarea',
maxLength: 2000,
}),
buildDescriptionField({
id: 'accidentDetails.descriptionField',
space: 'containerGutter',
titleVariant: 'h5',
title: accidentDetails.labels.doctorVisit,
width: 'full',
}),
buildCustomField({
id: 'accidentDetails.dateOfDoctorVisit',
title: accidentDetails.labels.date,
component: 'DateOfAccident',
width: 'half',
}),
buildTextField({
id: 'accidentDetails.timeOfDoctorVisit',
title: accidentDetails.labels.time,
placeholder: accidentDetails.placeholder.doctorVisitTime,
backgroundColor: 'blue',
width: 'half',
format: '##:##',
}),
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
buildAlertMessageField,
buildCheckboxField,
buildCustomField,
buildDescriptionField,
buildFileUploadField,
buildMultiField,
buildRadioField,
Expand Down Expand Up @@ -110,6 +111,21 @@ export const whoIsTheNotificationForSection = buildSection({
width: 'half',
variant: 'tel',
}),
buildDescriptionField({
id: 'accidentDetails.descriptionField',
space: 'containerGutter',
title: injuredPersonInformation.general.jobTitle,
description: injuredPersonInformation.general.jobTitleDescription,
width: 'full',
marginBottom: 2,
}),
buildTextField({
id: 'injuredPersonInformation.jobTitle',
title: injuredPersonInformation.labels.jobTitle,
backgroundColor: 'white',
width: 'full',
maxLength: 100,
}),
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export const AccidentNotificationSchema = z.object({
descriptionOfAccident: z.string().refine((x) => x.trim().length > 0, {
params: error.invalidValue,
}),
accidentSymptoms: z.string().refine((x) => x.trim().length > 0, {
params: error.invalidValue,
}),
}),
isRepresentativeOfCompanyOrInstitue: z.array(z.string()).optional(),
fishingShipInfo: z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ export const accidentDetails = {
description:
'According to electronic information from the Director of Internal Revenue, you do not appear to have filled in the appropriate field on your tax return and are therefore not insured against household related accidents during the period in which the accident took place.',
},
moreThanAYearAlertTitle: {
id: 'an.application:accidentDetails.general.moreThanAYearAlertTitle',
defaultMessage: 'Athugið',
description: 'Alert',
},
moreThanAYearAlertMessage: {
id: 'an.application:accidentDetails.general.moreThanAYearAlertMessage',
defaultMessage:
'Öll slys skal að jafnaði tilkynna innan eins árs, en heimilt er að veita undanþágu frá þeirri reglu, að ákveðnum forsendum uppfylltum.',
description:
'The accident took place more than a year ago. It is necessary to contact the Insurance Fund for further instructions.',
},
}),
labels: defineMessages({
date: {
Expand All @@ -43,6 +55,16 @@ export const accidentDetails = {
defaultMessage: 'Ýtarleg lýsing á slysi',
description: 'Description of accident',
},
symptoms: {
id: 'an.application:accidentDetails.labels.symptoms',
defaultMessage: 'Lýsing á einkennum og afleiðingum slyss',
description: 'Accident symptoms',
},
doctorVisit: {
id: 'an.application:accidentDetails.labels.doctorVisit',
defaultMessage: 'Hvenær leitaðir þú fyrst til læknis?',
description: 'When did you first visit a doctor after the accident?',
},
}),
placeholder: defineMessages({
date: {
Expand All @@ -61,5 +83,15 @@ export const accidentDetails = {
description:
'Write here the outline, cause and circumstances of the accident',
},
symptoms: {
id: 'an.application:accidentDetails.placeholder.symptoms',
defaultMessage: 'Skrifaðu hér einkenni og afleiðingar slyssins',
description: 'Write here the symptoms and consequences of the accident',
},
doctorVisitTime: {
id: 'an.application:accidentDetails.placeholder.doctorVisit',
defaultMessage: 'Sláðu inn tíma heimsóknar',
description: 'Enter the time of the visit',
},
}),
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const application = {
general: defineMessages({
name: {
id: 'an.application:general.name',
defaultMessage: 'Slysatilkynning til Sjúkratryggingar Íslands ',
defaultMessage: 'Slysatilkynning til Sjúkratrygginga Íslands ',
description: 'Accident notification to Sjúkratryggingar Íslands',
},
institutionName: {
Expand All @@ -30,4 +30,17 @@ export const application = {
description: 'Delivery of data',
},
}),
labels: defineMessages({
warningTitle: {
id: 'an.application:application.warningTitle',
defaultMessage: 'Athugið',
description: 'Warning',
},
warningMessage: {
id: 'an.application:application.warningDescription',
defaultMessage:
'Ef hinn slasaði þiggur greiðslur frá íþróttafélaginu þá er málið meðhöndlað sem vinnuslys.',
description: 'Warning description',
},
}),
}
Loading
Loading