Skip to content

Commit

Permalink
Merge branch 'main' into fix/estate-preregistered-heir
Browse files Browse the repository at this point in the history
  • Loading branch information
juni-haukur committed Oct 10, 2024
2 parents 0d50921 + eebf2ef commit 8c19e29
Show file tree
Hide file tree
Showing 53 changed files with 6,880 additions and 4,626 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { ServiceStatus } from '@island.is/judicial-system/types'

@ObjectType()
export class SubpoenaStatus {
@Field(() => ServiceStatus)
readonly serviceStatus!: ServiceStatus
@Field(() => ServiceStatus, { nullable: true })
readonly serviceStatus?: ServiceStatus

@Field(() => String, { nullable: true })
readonly servedBy?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class InternalCaseService {
}
}

private async upploadRequestPdfToCourt(
private async uploadRequestPdfToCourt(
theCase: Case,
user: TUser,
): Promise<boolean> {
Expand Down Expand Up @@ -758,7 +758,7 @@ export class InternalCaseService {
): Promise<DeliverResponse> {
await this.refreshFormatMessage()

return this.upploadRequestPdfToCourt(theCase, user).then((delivered) => ({
return this.uploadRequestPdfToCourt(theCase, user).then((delivered) => ({
delivered,
}))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ export class CourtService {
subtypes,
defendants,
prosecutor,
courtName,
})

return this.sendToRobot(
Expand Down Expand Up @@ -624,7 +625,7 @@ export class CourtService {
}))

const subject = `${courtName} - ${courtCaseNumber} - verjanda upplýsingar`
const content = JSON.stringify(defendantInfo)
const content = JSON.stringify({ defendants: defendantInfo, courtName })

return this.sendToRobot(
subject,
Expand Down Expand Up @@ -657,7 +658,7 @@ export class CourtService {
): Promise<unknown> {
try {
const subject = `${courtName} - ${courtCaseNumber} - úthlutun`
const content = JSON.stringify(assignedRole)
const content = JSON.stringify({ ...assignedRole, courtName })

return this.sendToRobot(
subject,
Expand Down Expand Up @@ -689,7 +690,11 @@ export class CourtService {
noticeText?: string,
): Promise<unknown> {
const subject = `${courtName} - ${courtCaseNumber} - afturköllun`
const content = JSON.stringify({ subject: noticeSubject, text: noticeText })
const content = JSON.stringify({
subject: noticeSubject,
text: noticeText,
courtName,
})

return this.sendToRobot(
subject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,23 +352,29 @@ export class PoliceService {
subpoenaId,
)

const serviceStatus = response.deliveredToLawyer
? ServiceStatus.DEFENDER
: response.prosecutedConfirmedSubpoenaThroughIslandis
? ServiceStatus.ELECTRONICALLY
: response.deliveredOnPaper || response.delivered === true
? ServiceStatus.IN_PERSON
: response.acknowledged === false && response.delivered === false
? ServiceStatus.FAILED
: // TODO: handle expired
undefined

if (serviceStatus === undefined) {
return subpoenaToUpdate
}

const updatedSubpoena = await this.subpoenaService.update(
subpoenaToUpdate,
{
comment: response.comment ?? undefined,
servedBy: response.servedBy ?? undefined,
defenderNationalId: response.defenderNationalId ?? undefined,
serviceDate: response.servedAt ?? undefined,
serviceStatus: response.deliveredToLawyer
? ServiceStatus.DEFENDER
: response.prosecutedConfirmedSubpoenaThroughIslandis
? ServiceStatus.ELECTRONICALLY
: response.deliveredOnPaper || response.delivered === true
? ServiceStatus.IN_PERSON
: response.acknowledged === false
? ServiceStatus.FAILED
: // TODO: handle expired
undefined,
serviceStatus,
} as UpdateSubpoenaDto,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsDate, IsEnum, IsOptional, IsString } from 'class-validator'
import { IsEnum, IsOptional, IsString } from 'class-validator'

import { ApiPropertyOptional } from '@nestjs/swagger'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import PoliceDemands from '@island.is/judicial-system-web/src/routes//Prosecutor/InvestigationCase/PoliceDemands/PoliceDemands'
import PoliceDemands from '@island.is/judicial-system-web/src/routes/Prosecutor/InvestigationCase/PoliceDemands/PoliceDemands'

export default PoliceDemands
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ export const strings = defineMessages({
},
serviceStatusUnknown: {
id: 'judicial.system.core:service_announcement.service_status_unknown',
defaultMessage: 'Birtingastaða óþekkt',
defaultMessage: 'Ákæra er í birtingarferli',
description: 'Notaður sem texti þegar ekki er vitað um stöðu birtingar.',
},
servedToDefender: {
id: 'judicial.system.core:service_announcement.served_to_defender',
defaultMessage: 'Birt fyrir verjanda - {lawyerName} {practice}',
description: 'Notaður sem texti þegar birti var verjanda.',
description: 'Notaður sem texti þegar birt var verjanda.',
},
servedToElectronically: {
id: 'judicial.system.core:service_announcement.served_electronically',
defaultMessage: 'Rafrænt pósthólf island.is - {date}',
description: 'Notaður sem texti þegar birti var í pósthólfi.',
description: 'Notaður sem texti þegar birt var í pósthólfi.',
},
subpoenaCreated: {
id: 'judicial.system.core:service_announcement.subpoena_created',
defaultMessage: 'Ákæra fór í birtingu {date}',
description: 'Notaður sem texti þegar birt var í pósthólfi.',
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from '@island.is/judicial-system-web/src/graphql/schema'

import { useGetLawyer, useSubpoena } from '../../utils/hooks'
import { SubpoenaStatusQuery } from '../../utils/hooks/useSubpoena/getSubpoenaStatus.generated'
import { strings } from './ServiceAnnouncement.strings'

const mapServiceStatusTitle = (
Expand Down Expand Up @@ -40,7 +39,11 @@ const mapServiceStatusMessages = (
switch (subpoena.serviceStatus) {
case ServiceStatus.DEFENDER:
return [
`${subpoena.servedBy} - ${formatDate(subpoena.serviceDate, 'Pp')}`,
`${subpoena.servedBy ? subpoena.servedBy : ''}${
subpoena.serviceDate
? ` - ${formatDate(subpoena.serviceDate, 'Pp')}`
: ''
}`,
formatMessage(strings.servedToDefender, {
lawyerName: lawyer?.name,
practice: lawyer?.practice,
Expand All @@ -49,19 +52,29 @@ const mapServiceStatusMessages = (
case ServiceStatus.ELECTRONICALLY:
return [
formatMessage(strings.servedToElectronically, {
date: formatDate(subpoena.serviceDate, 'Pp'),
date: subpoena.serviceDate
? formatDate(subpoena.serviceDate, 'Pp')
: '',
}),
]
case ServiceStatus.IN_PERSON:
case ServiceStatus.FAILED:
return [
`${subpoena.servedBy} - ${formatDate(subpoena.serviceDate, 'Pp')}`,
`${subpoena.servedBy ? subpoena.servedBy : ''}${
subpoena.serviceDate
? ` - ${formatDate(subpoena.serviceDate, 'Pp')}`
: ''
}`,
subpoena.comment,
]
case ServiceStatus.EXPIRED:
return [formatMessage(strings.serviceStatusExpiredMessage)]
default:
return []
return [
formatMessage(strings.subpoenaCreated, {
date: subpoena.created ? formatDate(subpoena.created, 'Pp') : '',
}),
]
}
}

Expand Down Expand Up @@ -100,7 +113,7 @@ const ServiceAnnouncement: FC<ServiceAnnouncementProps> = (props) => {

// Use data from RLS but fallback to local data
useEffect(() => {
if (subpoenaStatusError) {
if (subpoenaStatusError || localSubpoena.serviceStatus) {
setSubpoena(localSubpoena)
} else {
setSubpoena({
Expand All @@ -114,16 +127,18 @@ const ServiceAnnouncement: FC<ServiceAnnouncementProps> = (props) => {
}
}, [localSubpoena, subpoenaStatus, subpoenaStatusError])

return !defendantName ? null : !subpoena && !subpoenaStatusLoading ? (
return !subpoena && !subpoenaStatusLoading ? (
<Box marginBottom={2}>{renderError(formatMessage)}</Box>
) : subpoenaStatusLoading ? (
) : subpoenaStatusLoading && !localSubpoena.serviceStatus ? (
<Box display="flex" justifyContent="center" paddingY={5}>
<LoadingDots />
</Box>
) : (
<Box marginBottom={2}>
<AlertMessage
title={`${formatMessage(title)} - ${defendantName}`}
title={`${formatMessage(title)}${
defendantName && subpoena?.serviceStatus ? ` - ${defendantName}` : ''
}`}
message={
<Box>
{messages.map((msg) => (
Expand All @@ -134,8 +149,10 @@ const ServiceAnnouncement: FC<ServiceAnnouncementProps> = (props) => {
</Box>
}
type={
subpoena?.serviceStatus === ServiceStatus.FAILED ||
subpoena?.serviceStatus === ServiceStatus.EXPIRED
!subpoena?.serviceStatus
? 'info'
: subpoena?.serviceStatus === ServiceStatus.FAILED ||
subpoena?.serviceStatus === ServiceStatus.EXPIRED
? 'warning'
: 'success'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,16 @@ const Overview: FC = () => {
</Box>
<ProsecutorCaseInfo workingCase={workingCase} />
{workingCase.defendants?.map((defendant) =>
defendant.subpoenas?.map((subpoena) => (
<ServiceAnnouncement
key={`${subpoena.id}-${subpoena.created}`}
subpoena={subpoena}
defendantName={defendant.name}
/>
)),
defendant.subpoenas?.map(
(subpoena) =>
subpoena.subpoenaId && (
<ServiceAnnouncement
key={`${subpoena.id}-${subpoena.created}`}
subpoena={subpoena}
defendantName={defendant.name}
/>
),
),
)}
{workingCase.court &&
latestDate?.date &&
Expand Down
7 changes: 7 additions & 0 deletions apps/web/utils/richText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { IntlConfig, IntlProvider } from 'react-intl'
import {
FaqList,
type FaqListProps,
Image,
type ImageProps,
renderConnectedComponent,
richText,
SectionWithImage,
Expand Down Expand Up @@ -279,6 +281,11 @@ const defaultRenderComponent = {
variant={slice.variant as 'accordion' | 'card'}
/>
),
Image: (slice: ImageProps) => {
const thumbnailUrl = slice?.url ? slice.url + '?w=50' : ''
const url = slice?.url ? slice.url + '?w=800' : ''
return <Image {...slice} thumbnail={thumbnailUrl} url={url} />
},
}

export const webRichText = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsNumber } from 'class-validator'
import { IsString, IsOptional } from 'class-validator'
import { Field, InputType } from '@nestjs/graphql'

@InputType()
Expand Down
6 changes: 6 additions & 0 deletions libs/api/domains/work-machines/src/lib/models/category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ export class Category {
@Field(() => String, { nullable: true })
name?: string | null

@Field(() => String, { nullable: true })
nameEn?: string | null

@Field(() => String, { nullable: true })
subCategoryName?: string | null

@Field(() => String, { nullable: true })
subCategoryNameEn?: string | null

@Field(() => String, { nullable: true })
registrationNumberPrefix?: string | null
}
6 changes: 6 additions & 0 deletions libs/api/domains/work-machines/src/lib/models/subCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ export class SubCategory {
@Field(() => String, { nullable: true })
name?: string | null

@Field(() => String, { nullable: true })
nameEn?: string | null

@Field(() => String, { nullable: true })
parentCategoryName?: string | null

@Field(() => String, { nullable: true })
parentCategoryNameEn?: string | null

@Field(() => String, { nullable: true })
registrationNumberPrefix?: string | null
}
16 changes: 14 additions & 2 deletions libs/api/domains/work-machines/src/lib/models/techInfoItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class TechInfoItem {
@Field(() => String, { nullable: true })
label?: string | null

@Field(() => String, { nullable: true })
labelEn?: string | null

@Field(() => String, { nullable: true })
type?: string | null

Expand All @@ -17,6 +20,15 @@ export class TechInfoItem {
@Field(() => String, { nullable: true })
maxLength?: string | null

@Field(() => [String], { nullable: true })
values?: Array<string> | null
@Field(() => [TechInfoListItem], { nullable: true })
values?: Array<TechInfoListItem> | null
}

@ObjectType('WorkMachinesTechInfoListItem')
export class TechInfoListItem {
@Field(() => String, { nullable: true })
name?: string | null

@Field(() => String, { nullable: true })
nameEn?: string | null
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class WorkMachinesResolver {
}

@Scopes(ApiScope.vinnueftirlitid)
@Query(() => Category)
@Query(() => [Category])
@Audit()
async getMachineParentCategoryByTypeAndModel(
@CurrentUser() auth: User,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class WorkMachinesService {
async getMachineParentCategoriesTypeModelGet(
auth: User,
input: GetMachineParentCategoryByTypeAndModelInput,
): Promise<MachineParentCategoryDetailsDto> {
): Promise<MachineParentCategoryDetailsDto[]> {
return this.machineService.getMachineParentCategoriesTypeModel(auth, {
type: input.type,
model: input.model,
Expand Down
Loading

0 comments on commit 8c19e29

Please sign in to comment.