Skip to content

Commit

Permalink
Merge branch 'main' into j-s/subpoena-files
Browse files Browse the repository at this point in the history
  • Loading branch information
unakb authored Oct 11, 2024
2 parents 9570017 + ca1cc4e commit fe896f3
Show file tree
Hide file tree
Showing 43 changed files with 212 additions and 165 deletions.
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 @@ -35,6 +35,7 @@ query LimitedAccessCase($input: CaseQueryInput!) {
defenderPhoneNumber
defenderChoice
verdictViewDate
verdictAppealDeadline
subpoenas {
id
created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,6 @@ const IndictmentCaseFilesList: FC<Props> = ({
<RenderFiles caseFiles={civilClaims} onOpenFile={onOpen} />
</Box>
)}
{uploadedCaseFiles && uploadedCaseFiles.length > 0 && (
<Box marginBottom={5}>
<Text variant="h4" as="h4" marginBottom={3}>
{formatMessage(strings.uploadedCaseFiles)}
</Text>
<CaseFileTable caseFiles={uploadedCaseFiles} onOpenFile={onOpen} />
</Box>
)}
{showSubpoenaPdf && (
<Box marginBottom={5}>
<Text variant="h4" as="h4" marginBottom={1}>
Expand All @@ -253,6 +245,14 @@ const IndictmentCaseFilesList: FC<Props> = ({
)}
</Box>
)}
{uploadedCaseFiles && uploadedCaseFiles.length > 0 && (
<Box marginBottom={5}>
<Text variant="h4" as="h4" marginBottom={3}>
{formatMessage(strings.uploadedCaseFiles)}
</Text>
<CaseFileTable caseFiles={uploadedCaseFiles} onOpenFile={onOpen} />
</Box>
)}
<AnimatePresence>
{fileNotFound && <FileNotFoundModal dismiss={dismissFileNotFound} />}
</AnimatePresence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const Conclusion: FC = () => {
courtDate: null,
postponedIndefinitelyExplanation: null,
indictmentRulingDecision: null,
mergeCaseId: null,
force: true,
}

Expand All @@ -137,11 +138,9 @@ const Conclusion: FC = () => {
break
case IndictmentDecision.COMPLETING:
update.indictmentRulingDecision = selectedDecision
update.mergeCaseId =
selectedDecision === CaseIndictmentRulingDecision.MERGE
? workingCase.mergeCase?.id
: null

if (selectedDecision === CaseIndictmentRulingDecision.MERGE) {
update.mergeCaseId = workingCase.mergeCase?.id
}
break
case IndictmentDecision.REDISTRIBUTING:
update.judgeId = null
Expand Down Expand Up @@ -400,101 +399,108 @@ const Conclusion: FC = () => {
</Box>
)}
{selectedAction === IndictmentDecision.COMPLETING && (
<Box marginBottom={5}>
<SectionHeading
title={formatMessage(strings.completingTitle)}
required
/>
<BlueBox>
<Box marginBottom={2}>
<RadioButton
id="decision-ruling"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.RULING
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.RULING)
}}
large
backgroundColor="white"
label={formatMessage(strings.ruling)}
/>
</Box>
<Box marginBottom={2}>
<>
<Box marginBottom={5}>
<SectionHeading
title={formatMessage(strings.completingTitle)}
required
/>
<BlueBox>
<Box marginBottom={2}>
<RadioButton
id="decision-ruling"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.RULING
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.RULING)
}}
large
backgroundColor="white"
label={formatMessage(strings.ruling)}
/>
</Box>
<Box marginBottom={2}>
<RadioButton
id="decision-fine"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.FINE
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.FINE)
}}
large
backgroundColor="white"
label={formatMessage(strings.fine)}
/>
</Box>
<Box marginBottom={2}>
<RadioButton
id="decision-dismissal"
name="decision"
checked={
selectedDecision ===
CaseIndictmentRulingDecision.DISMISSAL
}
onChange={() => {
setSelectedDecision(
CaseIndictmentRulingDecision.DISMISSAL,
)
}}
large
backgroundColor="white"
label={formatMessage(strings.dismissal)}
/>
</Box>
<Box marginBottom={2}>
<RadioButton
id="decision-merge"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.MERGE
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.MERGE)
}}
large
backgroundColor="white"
label={formatMessage(strings.merge)}
/>
</Box>
<RadioButton
id="decision-fine"
id="decision-cancellation"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.FINE
selectedDecision ===
CaseIndictmentRulingDecision.CANCELLATION
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.FINE)
setSelectedDecision(
CaseIndictmentRulingDecision.CANCELLATION,
)
}}
large
backgroundColor="white"
label={formatMessage(strings.fine)}
label={formatMessage(strings.cancellation)}
/>
</Box>
<Box marginBottom={2}>
<RadioButton
id="decision-dismissal"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.DISMISSAL
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.DISMISSAL)
}}
large
backgroundColor="white"
label={formatMessage(strings.dismissal)}
</BlueBox>
</Box>
{selectedDecision === CaseIndictmentRulingDecision.MERGE && (
<Box marginBottom={5}>
<SectionHeading
title={formatMessage(strings.connectedCaseNumbersTitle)}
required
/>
</Box>
<Box marginBottom={2}>
<RadioButton
id="decision-merge"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.MERGE
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.MERGE)
}}
large
backgroundColor="white"
label={formatMessage(strings.merge)}
<SelectConnectedCase
workingCase={workingCase}
setWorkingCase={setWorkingCase}
/>
</Box>
<RadioButton
id="decision-cancellation"
name="decision"
checked={
selectedDecision === CaseIndictmentRulingDecision.CANCELLATION
}
onChange={() => {
setSelectedDecision(CaseIndictmentRulingDecision.CANCELLATION)
}}
large
backgroundColor="white"
label={formatMessage(strings.cancellation)}
/>
</BlueBox>
</Box>
)}
</>
)}
{selectedDecision &&
selectedDecision === CaseIndictmentRulingDecision.MERGE && (
<Box marginBottom={5}>
<SectionHeading
title={formatMessage(strings.connectedCaseNumbersTitle)}
required
/>
<SelectConnectedCase
workingCase={workingCase}
setWorkingCase={setWorkingCase}
/>
</Box>
)}
{selectedAction && (
<Box
component="section"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,23 @@ const Subpoena: FC = () => {
return
}

const courtDateUpdated = await sendCourtDateToServer()
// If rescheduling after the court has met, then clear the current conclusion
const clearedConclusion =
isArraignmentScheduled && workingCase.indictmentDecision
? [
{
indictmentDecision: null,
courtSessionType: null,
courtDate: null,
postponedIndefinitelyExplanation: null,
indictmentRulingDecision: null,
mergeCaseId: null,
force: true,
},
]
: undefined

const courtDateUpdated = await sendCourtDateToServer(clearedConclusion)

if (!courtDateUpdated) {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
ShippedSummary,
TaskListType,
} from '@island.is/regulations/admin'
import { Kennitala, RegQueryName } from '@island.is/regulations'
import { Kennitala, MinistrySlug, RegQueryName } from '@island.is/regulations'
import * as kennitala from 'kennitala'
import { NationalRegistryV3ClientService } from '@island.is/clients/national-registry-v3'
import type { User } from '@island.is/auth-nest-tools'
Expand Down Expand Up @@ -255,13 +255,20 @@ export class DraftRegulationService {
): Promise<DraftRegulationModel> {
this.logger.debug('Creating a new DraftRegulation')

// If user is in delegation, use actor. Else use user.
let creatorNationalId = user?.nationalId
if (user?.actor) {
creatorNationalId = user.actor.nationalId
// If the user is in delegation from a valid ministry, add ministry to create?
}

const createData: Partial<DraftRegulationModel> = {
drafting_status: 'draft',
title: '',
text: '',
drafting_notes: '',
type: create.type,
authors: [user?.nationalId as Kennitala],
authors: [creatorNationalId as Kennitala],
}

return this.draftRegulationModel.create(createData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const OrganizationIslandFooter = () => {
})

const namespace = useMemo(
() => JSON.parse(data?.getNamespace?.fields ?? '{}'),
() => JSON.parse(data?.getNamespace?.fields || '{}'),
[data?.getNamespace?.fields],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const FiskistofaHeader: React.FC<React.PropsWithChildren<HeaderProps>> = ({
}) => {
const { linkResolver } = useLinkResolver()
const namespace = useMemo(
() => JSON.parse(organizationPage.organization?.namespace?.fields ?? '{}'),
() => JSON.parse(organizationPage.organization?.namespace?.fields || '{}'),
[organizationPage.organization?.namespace?.fields],
)
const n = useNamespace(namespace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const FjarsyslaRikisinsHeader = ({
}: HeaderProps) => {
const { linkResolver } = useLinkResolver()
const namespace = useMemo(
() => JSON.parse(organizationPage.organization?.namespace?.fields ?? '{}'),
() => JSON.parse(organizationPage.organization?.namespace?.fields || '{}'),
[organizationPage.organization?.namespace?.fields],
)
const n = useNamespace(namespace)
Expand Down
Loading

0 comments on commit fe896f3

Please sign in to comment.