Skip to content

Commit

Permalink
Merge branch 'main' into feat/create-paper-delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 25, 2024
2 parents d060e2b + 6cc2dd6 commit c694048
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ const Subpoena: FC = () => {
} = useCourtArrangements(workingCase, setWorkingCase, 'arraignmentDate')
const { sendNotification } = useCase()

const isArraignmentDone = Boolean(workingCase.indictmentDecision)
const isArraignmentScheduled = Boolean(workingCase.arraignmentDate)

const handleNavigationTo = useCallback(
async (destination: keyof stepValidationsType) => {
if (isArraignmentDone) {
if (isArraignmentScheduled) {
router.push(`${destination}/${workingCase.id}`)
return
}
Expand Down Expand Up @@ -89,7 +89,7 @@ const Subpoena: FC = () => {
router.push(`${destination}/${workingCase.id}`)
},
[
isArraignmentDone,
isArraignmentScheduled,
sendCourtDateToServer,
workingCase.defendants,
workingCase.notifications,
Expand Down Expand Up @@ -134,8 +134,8 @@ const Subpoena: FC = () => {
handleCourtDateChange={handleCourtDateChange}
handleCourtRoomChange={handleCourtRoomChange}
courtDate={workingCase.arraignmentDate}
dateTimeDisabled={isArraignmentDone}
courtRoomDisabled={isArraignmentDone}
dateTimeDisabled={isArraignmentScheduled}
courtRoomDisabled={isArraignmentScheduled}
courtRoomRequired
/>
</Box>
Expand Down Expand Up @@ -169,14 +169,14 @@ const Subpoena: FC = () => {
previousUrl={`${constants.INDICTMENTS_RECEPTION_AND_ASSIGNMENT_ROUTE}/${workingCase.id}`}
nextIsLoading={isLoadingWorkingCase}
onNextButtonClick={() => {
if (isArraignmentDone) {
if (isArraignmentScheduled) {
router.push(
`${constants.INDICTMENTS_DEFENDER_ROUTE}/${workingCase.id}`,
)
} else setNavigateTo(constants.INDICTMENTS_DEFENDER_ROUTE)
}}
nextButtonText={
isArraignmentDone
isArraignmentScheduled
? undefined
: formatMessage(strings.nextButtonText)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ const UpdateSkilavottordVehicleInfoMutation = gql`

const Confirm: FC<React.PropsWithChildren<unknown>> = () => {
const [reloadFlag, setReloadFlag] = useState(false)
const [
vehicleReadyToDeregisteredQueryCompleted,
setVehicleReadyToDeregisteredQueryCompleted,
] = useState(false)

// Update reloadFlag to trigger the child component to reload
const triggerReload = () => {
Expand Down Expand Up @@ -134,6 +138,11 @@ const Confirm: FC<React.PropsWithChildren<unknown>> = () => {
SkilavottordVehicleReadyToDeregisteredQuery,
{
variables: { permno: id },
onCompleted: (data) => {
if (data && data.skilavottordVehicleReadyToDeregistered) {
setVehicleReadyToDeregisteredQueryCompleted(true)
}
},
},
)

Expand All @@ -143,6 +152,7 @@ const Confirm: FC<React.PropsWithChildren<unknown>> = () => {
SkilavottordTrafficQuery,
{
variables: { permno: id },
skip: !vehicleReadyToDeregisteredQueryCompleted,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,23 +347,49 @@ export class SamgongustofaService {
)

if (result.status === 200) {
// Get the latest registered traffic data
const traffic = Object.values(result.data).reduce(
(prev: Traffic, current: Traffic) =>
new Date(prev.useDate) > new Date(current.useDate) ? prev : current,
{} as Traffic,
) as Traffic

logger.info(
`car-recycling: Got traffic data for ${getShortPermno(permno)}`,
{
outInStatus: traffic.outInStatus,
useStatus: traffic.useStatus,
useStatusName: traffic.useStatusName,
},
if (result.data.length) {
// Get the latest registered traffic data
const traffic = Object.values(result.data).reduce(
(prev: Traffic, current: Traffic) =>
new Date(prev.useDate) > new Date(current.useDate)
? prev
: current,
{} as Traffic,
) as Traffic

logger.info(
`car-recycling: Got traffic data for ${getShortPermno(permno)}`,
{
permno: getShortPermno(traffic.permno),
outInStatus: traffic.outInStatus,
useStatus: traffic.useStatus,
useStatusName: traffic.useStatusName,
},
)

//
if (!traffic.outInStatus) {
logger.warn(
`car-recycling: No traffic data being returned for ${getShortPermno(
permno,
)}`,
{ dataFromServer: result.data },
)
}

return traffic
}

logger.warn(
`car-recycling: No traffic data found for ${getShortPermno(permno)}`,
)

return traffic
return {
permno,
outInStatus: '',
useStatus: '',
useStatusName: '',
} as Traffic
}

throw new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,7 @@ export const BenefitsOfDigitalProcessesCalculator = ({
) as string)
}
description={formatMessage(t.results.c02)}
icon={
<Icon icon="homeWithCar" color="blue400" size="large" />
}
icon={<Icon icon="leaf" color="blue400" size="large" />}
/>
</GridColumn>
</GridRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const t = {
id: 'web.digitalIceland.benefitsOfDigitalProcesses:processDurationInMinutes.description',
defaultMessage:
'Áætluð lengd afgreiðslu. Biðtími þjónustuþega er ekki meðtalinn.',
description: 'Placeholder á "Lengd afgreiðslu í mínútum"',
description: 'Lýsing á "Lengd afgreiðslu í mínútum"',
},
}),
visitCountToCompleteProcess: defineMessages({
Expand Down Expand Up @@ -116,7 +116,7 @@ export const t = {
},
institutionGainDescription: {
id: 'web.digitalIceland.benefitsOfDigitalProcesses:results.institutionGainDescription',
defaultMessage: 'árlegur fjárhagslegurstofnunar',
defaultMessage: 'árlegur fjárhagslegur ávinningur stofnunar',
description: 'Lýsing á "ávinning stofnana" niðurstöðu',
},
staffFreeToDoOtherThings: {
Expand Down
10 changes: 9 additions & 1 deletion libs/cms/src/lib/cms.contentful.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,19 @@ export class CmsContentfulService {
)
}

async getOrganization(slug: string, lang: string): Promise<Organization> {
async getOrganization(
slug: string,
lang: string,
): Promise<Organization | null> {
if (!slug) {
return null
}

const params = {
['content_type']: 'organization',
include: 10,
'fields.slug': slug,
limit: 1,
}

const result = await this.contentfulRepository
Expand Down
3 changes: 3 additions & 0 deletions libs/island-ui/core/src/lib/IconRC/iconMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export type Icon =
| 'swapVertical'
| 'thumbsUp'
| 'thumbsDown'
| 'leaf'

export default {
filled: {
Expand Down Expand Up @@ -183,6 +184,7 @@ export default {
swapVertical: 'SwapVertical',
thumbsUp: 'ThumbsUp',
thumbsDown: 'ThumbsDown',
leaf: 'Leaf',
},
outline: {
archive: 'ArchiveOutline',
Expand Down Expand Up @@ -275,5 +277,6 @@ export default {
swapVertical: 'SwapVertical',
thumbsUp: 'ThumbsUpOutline',
thumbsDown: 'ThumbsDownOutline',
leaf: 'LeafOutline',
},
}
22 changes: 22 additions & 0 deletions libs/island-ui/core/src/lib/IconRC/icons/Leaf.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react'
import type { SvgProps as SVGRProps } from '../types'

const Leaf = ({
title,
titleId,
...props
}: React.SVGProps<SVGSVGElement> & SVGRProps) => {
return (
<svg
className="leaf_svg__ionicon"
viewBox="0 0 512 512"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path d="M161.35 242a16 16 0 0122.62-.68c73.63 69.36 147.51 111.56 234.45 133.07 11.73-32 12.77-67.22 2.64-101.58-13.44-45.59-44.74-85.31-90.49-114.86-40.84-26.38-81.66-33.25-121.15-39.89-49.82-8.38-96.88-16.3-141.79-63.85-5-5.26-11.81-7.37-18.32-5.66-7.44 2-12.43 7.88-14.82 17.6-5.6 22.75-2 86.51 13.75 153.82 25.29 108.14 65.65 162.86 95.06 189.73 38 34.69 87.62 53.9 136.93 53.9a186 186 0 0027.77-2.04c41.71-6.32 76.43-27.27 96-57.75-89.49-23.28-165.94-67.55-242-139.16a16 16 0 01-.65-22.65zM467.43 384.19c-16.83-2.59-33.13-5.84-49-9.77a157.71 157.71 0 01-12.13 25.68c-.73 1.25-1.5 2.49-2.29 3.71a584.21 584.21 0 0058.56 12 16 16 0 104.87-31.62z" />
</svg>
)
}

export default Leaf
29 changes: 29 additions & 0 deletions libs/island-ui/core/src/lib/IconRC/icons/LeafOutline.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as React from 'react'
import type { SvgProps as SVGRProps } from '../types'

const LeafOutline = ({
title,
titleId,
...props
}: React.SVGProps<SVGSVGElement> & SVGRProps) => {
return (
<svg
className="leaf_svg__ionicon"
viewBox="0 0 512 512"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path
d="M321.89 171.42C233 114 141 155.22 56 65.22c-19.8-21-8.3 235.5 98.1 332.7 77.79 71 197.9 63.08 238.4-5.92s18.28-163.17-70.61-220.58zM173 253c86 81 175 129 292 147"
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="32"
/>
</svg>
)
}

export default LeafOutline

0 comments on commit c694048

Please sign in to comment.