Skip to content

Commit

Permalink
Merge branch 'main' into chore/web-remove-unused-electronig-registrat…
Browse files Browse the repository at this point in the history
…ion-statistic-component
  • Loading branch information
RunarVestmann committed Jan 6, 2025
2 parents 6f3f1f8 + ab163c2 commit 7272c3e
Show file tree
Hide file tree
Showing 96 changed files with 1,323 additions and 1,003 deletions.
46 changes: 40 additions & 6 deletions apps/contentful-apps/pages/sidebars/preview-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EntryProps, KeyValueMap } from 'contentful-management'
import { CMAClient, SidebarExtensionSDK } from '@contentful/app-sdk'
import { Button, Text } from '@contentful/f36-components'
import { useCMA, useSDK } from '@contentful/react-apps-toolkit'

import {
CONTENTFUL_ENVIRONMENT,
CONTENTFUL_SPACE,
Expand Down Expand Up @@ -40,12 +41,30 @@ const previewLinkHandler = {
) => {
const organizationPageId =
entry.fields.organizationPage?.[DEFAULT_LOCALE]?.sys?.id
const organizationPage = await cma.entry.get({
entryId: organizationPageId,
environmentId: CONTENTFUL_ENVIRONMENT,
spaceId: CONTENTFUL_SPACE,
})
return `${DEV_WEB_BASE_URL}/s/${organizationPage?.fields?.slug?.[DEFAULT_LOCALE]}/${entry.fields.slug[DEFAULT_LOCALE]}`
const [organizationPage, organizationParentSubpageResponse] =
await Promise.all([
cma.entry.get({
entryId: organizationPageId,
environmentId: CONTENTFUL_ENVIRONMENT,
spaceId: CONTENTFUL_SPACE,
}),
cma.entry.getMany({
query: {
content_type: 'organizationParentSubpage',
include: 1,
links_to_entry: entry.sys.id,
'sys.archivedAt[exists]': false,
},
}),
])

const orgPageSlug = organizationPage?.fields?.slug?.[DEFAULT_LOCALE]
const slug = entry.fields.slug[DEFAULT_LOCALE]

if (!organizationParentSubpageResponse?.items?.length) {
return `${DEV_WEB_BASE_URL}/s/${orgPageSlug}/${slug}`
}
return `${DEV_WEB_BASE_URL}/s/${orgPageSlug}/${organizationParentSubpageResponse.items[0].fields.slug[DEFAULT_LOCALE]}/${slug}`
},
anchorPage: (entry: EntryProps<KeyValueMap>) => {
const middlePart =
Expand All @@ -64,6 +83,21 @@ const previewLinkHandler = {
manual: (entry: EntryProps<KeyValueMap>) => {
return `${DEV_WEB_BASE_URL}/handbaekur/${entry.fields.slug[DEFAULT_LOCALE]}`
},
organizationParentSubpage: async (
entry: EntryProps<KeyValueMap>,
cma: CMAClient,
) => {
const organizationPageId =
entry.fields.organizationPage?.[DEFAULT_LOCALE]?.sys?.id
const organizationPage = await cma.entry.get({
entryId: organizationPageId,
environmentId: CONTENTFUL_ENVIRONMENT,
spaceId: CONTENTFUL_SPACE,
})
const orgPageSlug = organizationPage?.fields?.slug?.[DEFAULT_LOCALE]

return `${DEV_WEB_BASE_URL}/s/${orgPageSlug}/${entry.fields.slug[DEFAULT_LOCALE]}`
},
}

const PreviewLinkSidebar = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export class LimitedAccessCaseController {
private readonly limitedAccessCaseService: LimitedAccessCaseService,
private readonly eventService: EventService,
private readonly pdfService: PdfService,
private readonly defendantService: DefendantService,
@Inject(LOGGER_PROVIDER) private readonly logger: Logger,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ export const include: Includeable[] = [
},
separate: true,
},
{ model: Institution, as: 'court' },
{ model: User, as: 'judge' },
{ model: Institution, as: 'prosecutorsOffice' },
],
separate: true,
},
Expand Down
8 changes: 5 additions & 3 deletions apps/judicial-system/web/messages/Core/commentsInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const commentsInput = {
import { defineMessages } from 'react-intl'

export const commentsInput = defineMessages({
heading: {
id: 'judicial.system.core:comments_input.heading',
defaultMessage: 'Athugasemdir vegna málsmeðferðar',
Expand All @@ -8,7 +10,7 @@ export const commentsInput = {
tooltip: {
id: 'judicial.system.core:comments_input.tooltip',
defaultMessage:
'Hér er hægt að skrá athugasemdir til dómara og dómritara um hagnýt atriði sem tengjast fyrirtökunni eða málsmeðferðinni, og eru ekki hluti af sjálfri kröfunni.',
'Hér er hægt að skrá athugasemdir til dómara og dómritara um hagnýt atriði sem tengjast fyrirtökunni eða málsmeðferðinni.',
description:
'Notaður sem upplýsingatexti í upplýsingasvæði við "athugasemdir vegna málsmeðferðar" titlinn í öllum málategundum',
},
Expand All @@ -25,4 +27,4 @@ export const commentsInput = {
description:
'Notaður sem skýritexti í textaboxi fyrir "athugasemdir vegna málsmeðferðar" í öllum málategundum.',
},
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -99,33 +99,5 @@ export const rcReportForm = {
'Notaður sem skýritexti í textaboxi fyrir "lagarök" á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.',
},
}),
comments: defineMessages({
heading: {
id: 'judicial.system.restriction_cases:report_form.comments.heading',
defaultMessage: 'Athugasemdir vegna málsmeðferðar',
description:
'Notaður sem titill fyrir "athugasemdir vegna málsmeðferðar" hlutann á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.',
},
tooltip: {
id: 'judicial.system.restriction_cases:report_form.comments.tooltip',
defaultMessage:
'Hér er hægt að skrá athugasemdir til dómara og dómritara um hagnýt atriði sem tengjast fyrirtökunni eða málsmeðferðinni, og eru ekki hluti af sjálfri kröfunni.',
description:
'Notaður sem upplýsingatexti í upplýsingasvæði við "athugasemdir vegna málsmeðferðar" titlinn á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.',
},
label: {
id: 'judicial.system.restriction_cases:report_form.comments.label',
defaultMessage: 'Athugasemdir',
description:
'Notaður sem titill í textaboxi fyrir "athugasemdir vegna málsmeðferðar" á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.',
},
placeholder: {
id: 'judicial.system.restriction_cases:report_form.comments.placeholder',
defaultMessage:
'Er eitthvað sem þú vilt koma á framfæri við dómstólinn varðandi fyrirtökuna eða málsmeðferðina?',
description:
'Notaður sem skýritexti í textaboxi fyrir "athugasemdir vegna málsmeðferðar" á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.',
},
}),
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,9 @@ export const strings = defineMessages({
defaultMessage: 'Afturkalla',
description: 'Notaður sem texti fyrir aðgerðina að afturkalla mál',
},
revokeAppeal: {
id: 'judicial.system.core:blue_box_with_date.revoke_appeal',
defaultMessage: 'Afturkalla áfrýjun',
description: 'Notaður sem texti fyrir aðgerðina að afturkalla áfrýjun',
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ const BlueBoxWithDate: FC<Props> = (props) => {
const serviceRequired =
defendant.serviceRequirement === ServiceRequirement.REQUIRED

const shouldHideDatePickers = Boolean(
defendant.verdictAppealDate ||
defendant.isVerdictAppealDeadlineExpired ||
defendant.isSentToPrisonAdmin ||
isFine,
)

const handleDateChange = (
date: Date | undefined,
valid: boolean,
Expand Down Expand Up @@ -119,6 +126,17 @@ const BlueBoxWithDate: FC<Props> = (props) => {
setModalVisible(undefined)
}

const handleRevokeAppeal = () => {
setAndSendDefendantToServer(
{
caseId: workingCase.id,
defendantId: defendant.id,
verdictAppealDate: null,
},
setWorkingCase,
)
}

const appealExpirationInfo = useMemo(() => {
const deadline =
defendant.verdictAppealDeadline ||
Expand Down Expand Up @@ -198,26 +216,27 @@ const BlueBoxWithDate: FC<Props> = (props) => {
serviceRequired,
])

const datePickerVariants = {
dpHidden: { opacity: 0, y: 15, marginTop: '16px' },
dpVisible: { opacity: 1, y: 0 },
dpExit: {
const verdictViewDateVariants = {
hidden: { opacity: 0, y: 15, marginTop: '16px' },
visible: { opacity: 1, y: 0 },
exit: {
opacity: 0,
y: 15,
},
}

const datePicker2Variants = {
dpHidden: { opacity: 0, y: 15, marginTop: '16px' },
dpVisible: {
const appealDateVariants = {
hidden: { opacity: 0, y: 15, marginTop: '16px' },
visible: {
opacity: 1,
y: 0,
height: 'auto',
transition: { delay: triggerAnimation ? 0 : 0.4 },
},
dpExit: {
exit: {
opacity: 0,
height: 0,
marginTop: 0,
transition: { opacity: { duration: 0.2 } },
},
}
Expand Down Expand Up @@ -246,13 +265,18 @@ const BlueBoxWithDate: FC<Props> = (props) => {
<motion.div
key={index}
initial={{
marginTop: index === 0 ? 0 : '16px',
marginTop: 0,
opacity: 0,
y: 20,
height: triggerAnimation2 ? 0 : 'auto',
}}
animate={{ opacity: 1, y: 0, height: 'auto' }}
exit={{ opacity: 0, y: 20 }}
animate={{
opacity: 1,
y: 0,
height: 'auto',
marginTop: index === 0 ? 0 : '16px',
}}
exit={{ opacity: 0, y: 20, height: 0 }}
transition={{
delay: index < 4 ? index * 0.2 : 0,
duration: 0.3,
Expand All @@ -264,15 +288,14 @@ const BlueBoxWithDate: FC<Props> = (props) => {
))}
</AnimatePresence>
<AnimatePresence mode="wait">
{defendant.verdictAppealDate ||
defendant.isVerdictAppealDeadlineExpired ||
isFine ? null : !serviceRequired || defendant.verdictViewDate ? (
{shouldHideDatePickers ? null : !serviceRequired ||
defendant.verdictViewDate ? (
<motion.div
key="defendantAppealDate"
variants={datePicker2Variants}
initial="dpHidden"
animate="dpVisible"
exit="dpExit"
variants={appealDateVariants}
initial="hidden"
animate="visible"
exit="exit"
>
<Box className={styles.dataContainer}>
<DateTime
Expand Down Expand Up @@ -302,10 +325,10 @@ const BlueBoxWithDate: FC<Props> = (props) => {
) : (
<motion.div
key="defendantVerdictViewDate"
variants={datePickerVariants}
variants={verdictViewDateVariants}
initial={false}
animate="dpVisible"
exit="dpExit"
animate="visible"
exit="exit"
transition={{ duration: 0.2, ease: 'easeInOut', delay: 0.4 }}
>
<Box className={styles.dataContainer}>
Expand Down Expand Up @@ -338,7 +361,16 @@ const BlueBoxWithDate: FC<Props> = (props) => {
</AnimatePresence>
</Box>
<Box display="flex" justifyContent="flexEnd" marginTop={1}>
{defendant.isSentToPrisonAdmin ? (
{defendant.verdictAppealDate ? (
<Button
variant="text"
onClick={handleRevokeAppeal}
size="small"
colorScheme="destructive"
>
{formatMessage(strings.revokeAppeal)}
</Button>
) : defendant.isSentToPrisonAdmin ? (
<Button
variant="text"
onClick={() => setModalVisible('REVOKE_SEND_TO_PRISON_ADMIN')}
Expand Down
31 changes: 19 additions & 12 deletions apps/judicial-system/web/src/components/CaseInfo/CaseInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface Props {
workingCase: Case
}

export const Defendants: FC<Props> = ({ workingCase }) => {
const Defendants: FC<Props> = ({ workingCase }) => {
const { defendants, type } = workingCase
const { formatMessage } = useIntl()

Expand All @@ -82,12 +82,16 @@ export const Defendants: FC<Props> = ({ workingCase }) => {
)
}

export const Prosecutor: FC<Props> = ({ workingCase }) => {
const Prosecutor: FC<Props> = ({ workingCase }) => {
const { formatMessage } = useIntl()
if (!workingCase.prosecutorsOffice?.name) {
return null
}

return (
<Entry
label={formatMessage(core.prosecutor)}
value={workingCase.prosecutorsOffice?.name ?? ''}
value={workingCase.prosecutorsOffice.name}
/>
)
}
Expand All @@ -112,6 +116,17 @@ export const ProsecutorCaseInfo: FC<Props & { hideCourt?: boolean }> = ({
)
}

export const ProsecutorAndDefendantsEntries: FC<Props> = ({
workingCase,
}: {
workingCase: Case
}) => (
<>
<Prosecutor workingCase={workingCase} />
<Defendants workingCase={workingCase} />
</>
)

export const CourtCaseInfo: FC<Props> = ({ workingCase }) => {
const { formatMessage } = useIntl()

Expand All @@ -136,15 +151,7 @@ export const CourtCaseInfo: FC<Props> = ({ workingCase }) => {
</Text>
</Box>
) : (
<>
{workingCase.prosecutorsOffice?.name && (
<Entry
label={formatMessage(core.prosecutor)}
value={workingCase.prosecutorsOffice.name}
/>
)}
<Defendants workingCase={workingCase} />
</>
<ProsecutorAndDefendantsEntries workingCase={workingCase} />
)}
</Box>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@ query LimitedAccessCase($input: CaseQueryInput!) {
}
policeCaseNumbers
indictmentSubtypes
court {
id
name
}
judge {
id
name
}
prosecutorsOffice {
id
name
}
}
hasCivilClaims
civilClaimants {
Expand Down
Loading

0 comments on commit 7272c3e

Please sign in to comment.