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(application-system): Fixing export error and input error in custom component #17046

Merged
merged 118 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
53e5f91
initial application creation
Ballioli Aug 7, 2024
d55cb7d
Continued work setting up application
Ballioli Aug 9, 2024
6f38470
Further work setting up work accident notification application
Ballioli Aug 12, 2024
11fd388
Work on company screen in application
Ballioli Aug 14, 2024
182580f
skeleton work for page steps
Ballioli Aug 16, 2024
720ae52
mock data and further work on steps
Ballioli Aug 26, 2024
3e3a32e
Further development of work accident notificaion application
Ballioli Sep 6, 2024
c6d57ef
Creating a new client for slysaskraning
Ballioli Sep 10, 2024
06396de
starting client setup, getting open-api from VER
Ballioli Sep 10, 2024
ce2a549
Setting up client for slysaskraning
Ballioli Sep 11, 2024
540d265
clientConfig testing removed
Ballioli Sep 11, 2024
2ccde07
further progress of work accident notification
Ballioli Sep 20, 2024
41fe5a0
fixing broken component to not push broken code
Ballioli Sep 20, 2024
051b632
Working on consistant data going back and forth in screens
Ballioli Sep 23, 2024
1d23114
MultiSelect states/answers setup, added most serious option. Missing …
Ballioli Sep 24, 2024
9baa16b
multiselect work
berglindoma13 Sep 24, 2024
9c6c01e
minor fixes, adding attributes to data schema
Ballioli Sep 25, 2024
737fbcd
adding attributes to dataschema, still incomplete in terms of refinin…
Ballioli Sep 26, 2024
b6d982b
dev readme, delete later
Ballioli Sep 27, 2024
007c1c4
merging main
sigruntg Oct 3, 2024
51ec6f0
fixing some messeges and adding seeder script
sigruntg Oct 4, 2024
634f9d3
Merge remote-tracking branch 'origin/main' into feature/aosh-work-acc…
sigruntg Oct 4, 2024
9680ea0
multiselect finished
berglindoma13 Oct 7, 2024
4f2c597
Merge branch 'feature/aosh-work-accident-notification' of https://git…
berglindoma13 Oct 7, 2024
eb9570c
dev readme, delete later v2
Ballioli Oct 10, 2024
af094fb
adding create account mockup and submitapplication
sigruntg Oct 10, 2024
f4b109a
some changes
sigruntg Oct 10, 2024
696476b
Working on multiselect screens in tilkynning vinnuslyss
Ballioli Oct 14, 2024
864b7ca
removing comments, logs and addding a useEffect to setValue to formco…
Ballioli Oct 14, 2024
5cf6008
adding 2 new screens (typeOfInjury and injuredBodyParts), minor fixes…
Ballioli Oct 15, 2024
c7e6703
changes to submitapplication
sigruntg Oct 16, 2024
5f13260
starting to index starfsmadur and orsakir screens to allow for multip…
Ballioli Oct 16, 2024
21f1897
indexing for multiple employees, data schema update, moving announcem…
Ballioli Oct 18, 2024
c3958b2
overview
sigruntg Oct 18, 2024
2345e05
conflict
sigruntg Oct 18, 2024
b18f6c0
adding indexing to ids otherwise we get graphql validation errors
Ballioli Oct 18, 2024
94dc11b
overview company
sigruntg Oct 18, 2024
9d0f292
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Oct 18, 2024
f91369a
commenting out atvinnugreinaflokkun, will remove once confirmed it sh…
Ballioli Oct 21, 2024
2f2358a
about accident
sigruntg Oct 21, 2024
4043702
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Oct 21, 2024
7bfb772
adding conditional radio field to verkkaup, fixing code for major and…
Ballioli Oct 22, 2024
de27fbe
adding add employees button
sigruntg Oct 22, 2024
7e4108a
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Oct 22, 2024
7b1582f
add employee button works
sigruntg Oct 23, 2024
69849f4
bunch of schema/required/validation added
Ballioli Oct 23, 2024
cf30c95
doesnotrequireanswer added
sigruntg Oct 23, 2024
e6b5e5a
fixing merge conflict
sigruntg Oct 23, 2024
d5a75ef
zod schema additions, required on component that should be required, …
Ballioli Oct 23, 2024
791942f
Fixing mount issue when going from employee 2 to employee 1 via back …
Ballioli Oct 23, 2024
44b5d7a
adding things to overview employees and few things to submit application
sigruntg Oct 24, 2024
be1e3f7
merge confic
sigruntg Oct 24, 2024
923bd35
forgot to save
sigruntg Oct 24, 2024
27ef79f
adding template name and institution
sigruntg Oct 24, 2024
40179fb
resolving conflicts
Ballioli Oct 25, 2024
3f7bff2
adding input values and some changes to submit app
sigruntg Oct 25, 2024
fcb19be
merginign
sigruntg Oct 25, 2024
d67f2b2
submit and conclusion
sigruntg Oct 28, 2024
8c76d8d
first commit of delete functionality, some todo cleanup
Ballioli Oct 28, 2024
02208fe
remove log
Ballioli Oct 28, 2024
4b4bac1
select checkbox design
sigruntg Oct 28, 2024
8983394
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Oct 28, 2024
24cb399
adding delete button to overview screen
Ballioli Oct 28, 2024
1dfa270
feature flag added, mobile styling fixed in overview, data schema min…
Ballioli Oct 29, 2024
c94f5a6
merge main, conflict
Ballioli Oct 29, 2024
9dc0a54
merge conflict
Ballioli Oct 29, 2024
e7b5157
fixing config module after recent main changes
Ballioli Oct 29, 2024
d8135a9
Chaning minor texts, adding README, deleting dev_readme
Ballioli Oct 29, 2024
f88e963
update messages
Ballioli Oct 29, 2024
8ef2cae
adding date check
sigruntg Oct 29, 2024
f2c93ba
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Oct 29, 2024
bb7045c
fixing submit
sigruntg Oct 30, 2024
8479bcf
merge conflict
Ballioli Oct 30, 2024
6056090
fixing minors things from PR suggestions etc.
Ballioli Oct 30, 2024
096092b
Using Locale type
Ballioli Oct 30, 2024
0c669f5
fixing spacing on Select inputs and adding a placeholder
Ballioli Oct 30, 2024
553c97a
placeholder and message changes
Ballioli Oct 30, 2024
d671eb8
fallback if individual for branch info
sigruntg Oct 31, 2024
5668837
fix conflict
sigruntg Oct 31, 2024
5f022ec
fixing errors
sigruntg Oct 31, 2024
6a1afaf
employee name in overview + placeholder for causeAndConsequences
Ballioli Oct 31, 2024
14a1ea2
removing default on Select
Ballioli Oct 31, 2024
6843d55
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Oct 31, 2024
a9d9bd4
fixing back button and conclusion navigation step view
sigruntg Oct 31, 2024
f1c690e
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Oct 31, 2024
1f7f3e2
Fixing for PR comment, mostly error message translations etc..
Ballioli Nov 1, 2024
b7bdff7
fixing null values in answers causing validation fails because missin…
Ballioli Nov 1, 2024
3864e04
fixing issues with multidropdown and answers
Ballioli Nov 1, 2024
c199496
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 1, 2024
fb0454f
Adding missing contentfulId to institutionMapper
Ballioli Nov 4, 2024
d4ab2d5
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 4, 2024
b1bb8f0
add requiredScope
Ballioli Nov 4, 2024
32edca7
import missing
Ballioli Nov 4, 2024
7af8557
adding pdf to final page
sigruntg Nov 4, 2024
d1a7626
minor fixes from PR review
Ballioli Nov 5, 2024
5744dde
fixing types
sigruntg Nov 5, 2024
13dcc54
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Nov 5, 2024
bca12fd
forgot one type
sigruntg Nov 5, 2024
a276f8a
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 5, 2024
0485b91
PR comment fixes
Ballioli Nov 5, 2024
77930bb
moved payload
sigruntg Nov 5, 2024
ac3b50d
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Nov 5, 2024
18ffab5
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 5, 2024
6299db3
adding type
sigruntg Nov 5, 2024
8f178cc
Merge branch 'feature/aosh-work-accident-notification' of github.com:…
sigruntg Nov 5, 2024
dc86494
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 6, 2024
36f7a31
Remove fake sections
Ballioli Nov 6, 2024
22397e9
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 6, 2024
33b2d10
removing title for pages that have no section
Ballioli Nov 6, 2024
0fe49b7
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 6, 2024
a8b0d41
Adding work accident client to infra/src/dsl and application-system/a…
Ballioli Nov 7, 2024
8b9a745
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 7, 2024
3933207
Adding to apps/api/infra and running yarn charts
Ballioli Nov 7, 2024
8fc429c
Merge branch 'main' into feature/aosh-work-accident-notification
Ballioli Nov 8, 2024
7f5f6ba
fetching main
Ballioli Nov 13, 2024
e695e13
Fixing issue where user could choose the same causesAndEffect options…
Ballioli Nov 27, 2024
38d03c2
Merge remote-tracking branch 'origin/main' into fix/aosh-export-warning
Ballioli Nov 27, 2024
f6daf7f
Merge branch 'main' into fix/aosh-export-warning
kodiakhq[bot] Nov 28, 2024
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
@@ -1,18 +1,12 @@
import { FieldBaseProps } from '@island.is/application/types'
import { FC, useEffect, useState } from 'react'
import {
Box,
Checkbox,
GridColumn,
GridRow,
Select,
} from '@island.is/island-ui/core'
import { FC, useState } from 'react'
import { Box, GridColumn, GridRow, Select } from '@island.is/island-ui/core'
import { getValueViaPath } from '@island.is/application/core'
import { Controller, useFormContext } from 'react-hook-form'
import { accident } from '../../lib/messages'
import { useLocale } from '@island.is/localization'
import { WorkingEnvironmentDto } from '@island.is/clients/work-accident-ver'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { WorkAccidentNotification } from '../..'

type Option = {
value: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UPDATE_APPLICATION } from '@island.is/application/graphql'
import { FieldBaseProps } from '@island.is/application/types'
import { getValueViaPath } from '@island.is/application/core'
import { useFormContext } from 'react-hook-form'
import { MAX_EMPLOYEES } from '../../shared/constants'

export const AddEmployee: FC<React.PropsWithChildren<FieldBaseProps>> = ({
application,
Expand Down Expand Up @@ -58,6 +59,9 @@ export const AddEmployee: FC<React.PropsWithChildren<FieldBaseProps>> = ({
{formatMessage(overview.labels.addEmployeeDescription)}
</Text>
<Button
disabled={
employeeAmount && employeeAmount > MAX_EMPLOYEES ? true : false
}
Ballioli marked this conversation as resolved.
Show resolved Hide resolved
variant="ghost"
icon="add"
fluid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { FieldBaseProps } from '@island.is/application/types'
import { FC } from 'react'
import { causeAndConsequences } from '../../lib/messages'
import { Option } from '../Components/types'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { CausesAndEffects } from '../Components/CausesAndEffects'
import { WorkAccidentNotification } from '../..'

export type OptionAndKey = {
option: Option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
import { getErrorViaPath, getValueViaPath } from '@island.is/application/core'
import { Controller, useFormContext } from 'react-hook-form'
import { WorkplaceHealthAndSafetyDto } from '@island.is/clients/work-accident-ver'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { useLocale } from '@island.is/localization'
import { information } from '../../lib/messages/information'
import { WorkAccidentNotification } from '../..'

export const CheckboxFieldCustom: FC<
React.PropsWithChildren<FieldBaseProps>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FieldBaseProps } from '@island.is/application/types'
import { FC } from 'react'
import { causeAndConsequences } from '../../lib/messages'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { CausesAndEffects } from '../Components/CausesAndEffects'
import { WorkAccidentNotification } from '../..'

interface CircumstanceProps {
field: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const CausesAndEffects: FC<
errors,
answerId,
setBeforeSubmitCallback,
majorGroupLength,
} = props
const { setValue } = useFormContext()
const { formatMessage } = useLocale()
Expand All @@ -68,9 +69,14 @@ export const CausesAndEffects: FC<

const onChange = (answers: OptionWithKey) => {
const options: Option[] = []
const uniqueOptions = new Set<string>()

for (const key in answers) {
answers[key].forEach((option) => {
options.push(option)
if (!uniqueOptions.has(option.value)) {
uniqueOptions.add(option.value)
options.push(option)
}
})
}

Expand Down Expand Up @@ -111,7 +117,7 @@ export const CausesAndEffects: FC<
causeAndConsequences.shared.searchPlaceholder,
)}
onChange={(value) => {
const code = value?.value.substring(0, 1)
const code = value?.value.substring(0, majorGroupLength)
const activity: Option = {
value: value?.value || '',
label: value?.label || '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,23 @@ export const MultiSelectDropdownController: FC<

useEffect(() => {
if (!pickedValue || !pickedValue.key || !pickedValue.option) return

setAnswers((currentValue) => ({
...currentValue,
[pickedValue.key]: [
...(currentValue[pickedValue.key] || []),
pickedValue.option,
],
[pickedValue.key]: currentValue[pickedValue.key]?.some(
(option) => option.value === pickedValue.option.value,
)
? currentValue[pickedValue.key]
: [...(currentValue[pickedValue.key] || []), pickedValue.option],
}))

setValue(answerId, {
...answers,
[pickedValue.key]: [
...(answers[pickedValue.key] || []),
pickedValue.option,
],
[pickedValue.key]: answers[pickedValue.key]?.some(
(option) => option.value === pickedValue.option.value,
)
? answers[pickedValue.key]
: [...(answers[pickedValue.key] || []), pickedValue.option],
})
Ballioli marked this conversation as resolved.
Show resolved Hide resolved
Ballioli marked this conversation as resolved.
Show resolved Hide resolved
}, [pickedValue])

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { FieldBaseProps } from '@island.is/application/types'
import { Button } from '@island.is/island-ui/core'
import { FC } from 'react'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { useMutation } from '@apollo/client'
import { UPDATE_APPLICATION } from '@island.is/application/graphql'
import { useLocale } from '@island.is/localization'
import { shared } from '../../lib/messages'
import { WorkAccidentNotification } from '../..'

interface DeleteEmployeeProps {
index: number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FieldBaseProps } from '@island.is/application/types'
import { FC } from 'react'
import { causeAndConsequences } from '../../lib/messages'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { CausesAndEffects } from '../Components/CausesAndEffects'
import { WorkAccidentNotification } from '../..'

interface DeviationProps {
field: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box, ErrorMessage } from '@island.is/island-ui/core'
import { useFormContext } from 'react-hook-form'
import { employee } from '../../lib/messages'
import { useLocale } from '@island.is/localization'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { WorkAccidentNotification } from '../..'
import { dateIsWithin36Hours, formatDate } from '../../utils'
import { getValueViaPath } from '@island.is/application/core'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FieldBaseProps } from '@island.is/application/types'
import { FC } from 'react'
import { causeAndConsequences } from '../../lib/messages'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { CausesAndEffects } from '../Components/CausesAndEffects'
import { getValueViaPath } from '@island.is/application/core'
import { WorkAccidentNotification } from '../..'

interface InjuredBodyPartsProps {
field: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useLocale } from '@island.is/localization'
import { employee } from '../../lib/messages'
import { Controller, useFormContext } from 'react-hook-form'
import { VictimsOccupationDto } from '@island.is/clients/work-accident-ver'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { WorkAccidentNotification } from '../..'

export type Options = {
label: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import { useLocale } from '@island.is/localization'
import { overview } from '../../lib/messages'
import { ReviewGroup } from '../Components/ReviewGroup'
import { KeyValueFormField } from '@island.is/application/ui-fields'
import { EmployeeType, WorkAccidentNotification } from '../../lib/dataSchema'
import { EmployeeType } from '../../lib/dataSchema'
import { getEmployeeInformationForOverview } from '../../utils/getEmployeeInformationForOverview'
import { getCauseAndConsequencesForOverview } from '../../utils/getCauseAndConsequencesForOverview'
import { DeleteEmployee } from '../DeleteEmployee'
import { WorkAccidentNotification } from '../..'

type EmployeeAccordionItemType = {
employee: EmployeeType
Expand All @@ -23,7 +24,7 @@ type EmployeeAccordionItemType = {
export const EmployeeAccordionItem: FC<
React.PropsWithChildren<FieldBaseProps & EmployeeAccordionItemType>
> = ({ ...props }) => {
const { application, field, employee, onClick, index } = props
const { application, employee, onClick, index } = props
const { formatMessage } = useLocale()
const answers = application.answers as WorkAccidentNotification

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FieldBaseProps } from '@island.is/application/types'
import { FC } from 'react'
import { causeAndConsequences } from '../../lib/messages'
import { WorkAccidentNotification } from '../../lib/dataSchema'
import { CausesAndEffects } from '../Components/CausesAndEffects'
import { WorkAccidentNotification } from '../..'

interface TypeOfInjuryProps {
field: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { typeOfInjurySection } from './typeOfInjury'
import { injuredBodyPartsSection } from './injuredBodyParts'
import { deviationSection } from './deviation'
import { FormValue } from '@island.is/application/types'
import { WorkAccidentNotification } from '../../../lib/dataSchema'
import { WorkAccidentNotification } from '../../..'

export const causeAndConsequencesSection = (index: number) =>
buildSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { buildSection } from '@island.is/application/core'
import { sections } from '../../../lib/messages/sections'
import { employeeSubSection } from './employee'
import { FormValue } from '@island.is/application/types'
import { WorkAccidentNotification } from '../../../lib/dataSchema'
import { WorkAccidentNotification } from '../../..'

export const employeeSection = (index: number) =>
buildSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import { EmployeeAndAccidentInformationSection } from '../RepeatableSection'
import { overviewSection } from './OverviewSection'
import { announcementSection } from './AnnouncementSection'
import { conclusionSection } from './ConclusionSection'
import { MAX_EMPLOYEES } from '../../shared/constants'

const buildRepeatableSections = (): Section[] => {
const sections = [...Array(20)].map((_key, index) => {
const sections = [...Array(MAX_EMPLOYEES)].map((_key, index) => {
return EmployeeAndAccidentInformationSection(index)
})
return sections.flat()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import template from './lib/WorkAccidentNotificationTemplate'
import { WorkAccidentNotificationAnswers } from './lib/dataSchema'

export const getFields = () => import('./fields/')

export { WorkAccidentNotification } from './lib/dataSchema'

export type WorkAccidentNotification = WorkAccidentNotificationAnswers
export default template
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const WorkAccidentNotificationAnswersSchema = z.object({
employeeAmount: z.number().min(1),
})

export type WorkAccidentNotification = z.TypeOf<
export type WorkAccidentNotificationAnswers = z.TypeOf<
typeof WorkAccidentNotificationAnswersSchema
>
export type BasicCompanyType = z.TypeOf<typeof basicCompanySchema>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export enum ApiActions {
export const EMPLOYMENT_STATUS = {
TEMP_AGENCY: '4', // starfsmannaleiga
} as const

export const MAX_EMPLOYEES = 20