Skip to content

Commit

Permalink
Merge branch 'main' of github.com:island-is/island.is into j-s/postpo…
Browse files Browse the repository at this point in the history
…ne-client
  • Loading branch information
gudjong committed Apr 30, 2024
2 parents 14874c6 + 3121924 commit 1e9b089
Show file tree
Hide file tree
Showing 14 changed files with 306 additions and 272 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { style } from '@vanilla-extract/css'
import { themeUtils } from '@island.is/island-ui/theme'

import { theme, themeUtils } from '@island.is/island-ui/theme'

export const container = style({
background: 'linear-gradient(180deg, #E6F2FB 21.56%, #90D9E3 239.74%)',
Expand Down Expand Up @@ -42,3 +43,7 @@ export const bsiLogo = style({
export const bsiLogoMobile = style({
height: '40px',
})

export const marginLeft = style({
marginLeft: theme.spacing[2],
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import { ReactNode } from 'react'
import cn from 'classnames'
import { BLOCKS } from '@contentful/rich-text-types'

import { SliceType } from '@island.is/island-ui/contentful'
import {
Box,
GridColumn,
GridContainer,
GridRow,
Hyphen,
Text,
} from '@island.is/island-ui/core'
import { theme } from '@island.is/island-ui/theme'
import { FooterItem } from '@island.is/web/graphql/schema'
import { useNamespace } from '@island.is/web/hooks'
import { useWindowSize } from '@island.is/web/hooks/useViewport'
import { theme } from '@island.is/island-ui/theme'
import { SliceType } from '@island.is/island-ui/contentful'
import { webRichText } from '@island.is/web/utils/richText'
import { useNamespace } from '@island.is/web/hooks'

import * as styles from './FiskistofaFooter.css'

Expand All @@ -35,19 +34,19 @@ const FiskistofaFooter = ({

return (
<footer>
<Box className={styles.container}>
<div className={styles.container}>
<GridContainer className={styles.mainColumn}>
<GridColumn>
<GridRow>
<Box marginLeft={2}>
<div className={styles.marginLeft}>
<img
src={n(
'fiskistofaFooterLogo',
'https://images.ctfassets.net/8k0h54kbe6bj/2JSIJ4WbQ4Up84KQlMnIBb/34c1a74806884e456e3ab809a54d41f6/fiskistofa-footer-logo.png',
)}
alt="fiskistofa-logo"
/>
</Box>
</div>
</GridRow>
<GridRow marginTop={2} className={styles.linkRow}>
{footerItems.slice(0, 3).map((item, idx) => (
Expand Down Expand Up @@ -91,7 +90,7 @@ const FiskistofaFooter = ({
),
},
})}
<Box className={styles.iconContainer}>
<div className={styles.iconContainer}>
<img
src={n(
'fiskistofaGraenSkrefLogo',
Expand Down Expand Up @@ -121,13 +120,13 @@ const FiskistofaFooter = ({
[styles.bsiLogoMobile]: isMobile,
})}
/>
</Box>
</div>
</GridColumn>
)}
</GridRow>
</GridColumn>
</GridContainer>
</Box>
</div>
</footer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Header from './HeilbrigdisstofnunAusturlandsHeader'

export const HeilbrigdisstofnunAusturlandsFooter = dynamic(
() => import('./HeilbrigdisstofnunAusturlandsFooter'),
{ ssr: true },
{ ssr: false },
)

export const HeilbrigdisstofnunAusturlandsHeader = Header
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export const HeilbrigdisstofnunNordurlandsHeader = Header

export const HeilbrigdisstofnunNordurlandsFooter = dynamic(
() => import('./HeilbrigdisstofnunNordurlandsFooter'),
{ ssr: true },
{ ssr: false },
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export const HeilbrigdisstofnunSudurlandsHeader = Header

export const HeilbrigdisstofnunSudurlandsFooter = dynamic(
() => import('./HeilbrigdisstofnunSudurlandsFooter'),
{ ssr: true },
{ ssr: false },
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import dynamic from 'next/dynamic'
import Header from './HveHeader'

export const HveHeader = Header
export const HveFooter = dynamic(() => import('./HveFooter'), { ssr: true })
export const HveFooter = dynamic(() => import('./HveFooter'), { ssr: false })
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useEffect, useState } from 'react'

import { SliceType } from '@island.is/island-ui/contentful'
import {
Box,
Expand Down Expand Up @@ -25,7 +27,11 @@ const IcelandicNaturalDisasterInsuranceFooter = ({
}: IcelandicNaturalDisasterInsuranceFooterProps) => {
const n = useNamespace(namespace)
const { width } = useWindowSize()
const shouldWrap = width < theme.breakpoints.xl
const [shouldWrap, setShouldWrap] = useState(false)

useEffect(() => {
setShouldWrap(width < theme.breakpoints.xl)
}, [width])

return (
<footer className={styles.footer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import dynamic from 'next/dynamic'
import Header from './LandlaeknirHeader'

export const LandlaeknirFooter = dynamic(() => import('./LandlaeknirFooter'), {
ssr: true,
ssr: false,
})

export const LandlaeknirHeader = Header
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
import { Inject, Injectable } from '@nestjs/common'
import { S3 } from 'aws-sdk'
import format from 'date-fns/format'
import addDays from 'date-fns/addDays'
import format from 'date-fns/format'
import cloneDeep from 'lodash/cloneDeep'

import type { Attachment, Period } from '@island.is/clients/vmst'
import {
ParentalLeaveApi,
ApplicationInformationApi,
} from '@island.is/clients/vmst'
import type { Logger } from '@island.is/logging'
import { LOGGER_PROVIDER } from '@island.is/logging'
import { getValueViaPath } from '@island.is/application/core'
import {
ApplicationConfigurations,
Application,
ApplicationTypes,
YesOrNo,
} from '@island.is/application/types'
import {
getApplicationAnswers,
getAvailableRightsInDays,
getAvailablePersonalRightsInDays,
YES,
ADOPTION,
ChildInformation,
FileType,
NO,
StartDateOptions,
UnEmployedBenefitTypes,
PARENTAL_LEAVE,
OTHER_NO_CHILDREN_FOUND,
PARENTAL_GRANT,
PARENTAL_GRANT_STUDENTS,
getMultipleBirthsDays,
PARENTAL_LEAVE,
PERMANENT_FOSTER_CARE,
ParentalRelations,
SINGLE,
StartDateOptions,
States,
UnEmployedBenefitTypes,
YES,
calculatePeriodLength,
getAdditionalSingleParentRightsInDays,
getApplicationAnswers,
getApplicationExternalData,
getAvailablePersonalRightsInDays,
getAvailableRightsInDays,
getMultipleBirthsDays,
getUnApprovedEmployers,
ParentalRelations,
ChildInformation,
isParentWithoutBirthParent,
calculatePeriodLength,
PERMANENT_FOSTER_CARE,
OTHER_NO_CHILDREN_FOUND,
States,
ADOPTION,
} from '@island.is/application/templates/parental-leave'
import {
Application,
ApplicationConfigurations,
ApplicationTypes,
YesOrNo,
} from '@island.is/application/types'
import type { Attachment, Period } from '@island.is/clients/vmst'
import {
ApplicationInformationApi,
ParentalLeaveApi,
} from '@island.is/clients/vmst'
import type { Logger } from '@island.is/logging'
import { LOGGER_PROVIDER } from '@island.is/logging'

import { SharedTemplateApiService } from '../../shared'
import { NationalRegistryClientService } from '@island.is/clients/national-registry-v2'
import { ConfigService } from '@nestjs/config'
import {
BaseTemplateAPIModuleConfig,
TemplateApiModuleActionProps,
} from '../../../types'
import { BaseTemplateApiService } from '../../base-template-api.service'
import { SharedTemplateApiService } from '../../shared'
import { getConfigValue } from '../../shared/shared.utils'
import { ChildrenService } from './children/children.service'
import {
APPLICATION_ATTACHMENT_BUCKET,
SIX_MONTHS_IN_SECONDS_EXPIRES,
apiConstants,
df,
} from './constants'
import {
generateAssignOtherParentApplicationEmail,
generateAssignEmployerApplicationEmail,
generateOtherParentRejected,
generateEmployerRejected,
generateApplicationApprovedByEmployerEmail,
generateApplicationApprovedByEmployerToEmployerEmail,
generateAssignEmployerApplicationEmail,
generateAssignOtherParentApplicationEmail,
generateEmployerRejected,
generateOtherParentRejected,
} from './emailGenerators'
import {
getType,
checkIfPhoneNumberIsGSM,
getFromDate,
getRatio,
getRightsCode,
transformApplicationToParentalLeaveDTO,
} from './parental-leave.utils'
import {
generateAssignEmployerApplicationSms,
generateAssignOtherParentApplicationSms,
generateEmployerRejectedApplicationSms,
generateOtherParentRejectedApplicationSms,
} from './smsGenerators'
import {
transformApplicationToParentalLeaveDTO,
getRatio,
getRightsCode,
checkIfPhoneNumberIsGSM,
isParamsActionName,
checkActionName,
getFromDate,
} from './parental-leave.utils'
import {
APPLICATION_ATTACHMENT_BUCKET,
SIX_MONTHS_IN_SECONDS_EXPIRES,
apiConstants,
df,
} from './constants'
import { ConfigService } from '@nestjs/config'
import { getConfigValue } from '../../shared/shared.utils'
import { BaseTemplateApiService } from '../../base-template-api.service'
import { ChildrenService } from './children/children.service'
import { NationalRegistryClientService } from '@island.is/clients/national-registry-v2'

interface VMSTError {
type: string
Expand Down Expand Up @@ -1403,7 +1403,6 @@ export class ParentalLeaveService extends BaseTemplateApiService {
isSelfEmployed,
isReceivingUnemploymentBenefits,
applicationType,
previousState,
employerLastSixMonths,
employers,
} = getApplicationAnswers(application.answers)
Expand All @@ -1416,13 +1415,9 @@ export class ParentalLeaveService extends BaseTemplateApiService {
// }
const nationalRegistryId = application.applicant
const attachments = await this.getAttachments(application)
const type = getType(application)

try {
const actionNameFromParams =
previousState === States.RESIDENCE_GRANT_APPLICATION
? isParamsActionName(params)
: undefined

const periods = await this.createPeriodsDTO(
application,
nationalRegistryId,
Expand All @@ -1433,7 +1428,7 @@ export class ParentalLeaveService extends BaseTemplateApiService {
periods,
attachments,
false, // put false in testData as this is not dummy request
checkActionName(application, actionNameFromParams),
type,
)

const response =
Expand All @@ -1449,8 +1444,7 @@ export class ParentalLeaveService extends BaseTemplateApiService {
}

// If applicant is sending additional documents then don't need to send email
const { actionName } = getApplicationAnswers(application.answers)
if (actionName === 'document') {
if (type === FileType.DOCUMENT) {
return
}

Expand Down Expand Up @@ -1506,10 +1500,7 @@ export class ParentalLeaveService extends BaseTemplateApiService {
}
}

async validateApplication({
application,
params = undefined,
}: TemplateApiModuleActionProps) {
async validateApplication({ application }: TemplateApiModuleActionProps) {
const nationalRegistryId = application.applicant
const { previousState } = getApplicationAnswers(application.answers)
/* This is to avoid calling the api every time the user leaves the residenceGrantApplicationNoBirthDate state or residenceGrantApplication state */
Expand All @@ -1519,7 +1510,6 @@ export class ParentalLeaveService extends BaseTemplateApiService {
}
const attachments = await this.getAttachments(application)
try {
const actionNameFromParams = isParamsActionName(params)
const periods = await this.createPeriodsDTO(
application,
nationalRegistryId,
Expand All @@ -1530,7 +1520,7 @@ export class ParentalLeaveService extends BaseTemplateApiService {
periods,
attachments,
true,
checkActionName(application, actionNameFromParams),
getType(application),
)

// call SetParentalLeave API with testData: TRUE as this is a dummy request
Expand Down
Loading

0 comments on commit 1e9b089

Please sign in to comment.