-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(j-s): Civil claimant view for courts (#16171)
* fix(j-s): Civil claimant view for courts * feat(j-s): Judge can add and remove advocates * Update civilClaimant.controller.ts * Fixed key on Box
- Loading branch information
Showing
7 changed files
with
283 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/judicial-system/web/pages/domur/akaera/malflytjendur/[id].ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import HearingArrangements from '@island.is/judicial-system-web/src/routes/Court/Indictments/Defender/Defender' | ||
import Advocates from '@island.is/judicial-system-web/src/routes/Court/Indictments/Advocates/Advocates' | ||
|
||
export default HearingArrangements | ||
export default Advocates |
77 changes: 77 additions & 0 deletions
77
apps/judicial-system/web/src/routes/Court/Indictments/Advocates/Advocates.strings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { defineMessages } from 'react-intl' | ||
|
||
export const strings = defineMessages({ | ||
title: { | ||
id: 'judicial.system.core:court_indictments.advocates.title', | ||
defaultMessage: 'Verjandi', | ||
description: | ||
'Notaður sem titill á síðu á verjenda skrefi í dómaraflæði í ákærum.', | ||
}, | ||
alertBannerText: { | ||
id: 'judicial.system.core:court_indictments.advocates.alert_banner_text', | ||
defaultMessage: | ||
'Verjendur í sakamálum fá tilkynningu um skráningu í tölvupósti, aðgang að gögnum málsins og boð í þingfestingu.', | ||
description: | ||
'Notaður sem texti í alert banner á málflytjendurskjá í ákærum.', | ||
}, | ||
selectDefenderHeading: { | ||
id: 'judicial.system.core:court_indictments.advocates.select_defender_heading', | ||
defaultMessage: 'Verjandi', | ||
description: 'Notaður sem texti fyrir val á skipaðan verjanda í ákærum.', | ||
}, | ||
defendantWaivesRightToCounsel: { | ||
id: 'judicial.system.core:court_indictments.advocates.defendant_waives_right_to_counsel', | ||
defaultMessage: '{accused} óskar ekki eftir að sér sé skipaður verjandi', | ||
description: | ||
'Notaður sem texti fyrir takka þegar ákærðu óska ekki eftir verjanda í dómaraflæði í ákærum. ', | ||
}, | ||
civilClaimants: { | ||
id: 'judicial.system.core:court_indictments.advocates.civil_claimants', | ||
defaultMessage: 'Kröfuhafar', | ||
description: | ||
'Notaður sem titill á texta um kröfuhafa í dómaraflæði í ákærum.', | ||
}, | ||
shareFilesWithCivilClaimantAdvocate: { | ||
id: 'judicial.system.core:court_indictments.advocates.civil_claimant_share_files_with_advocate', | ||
defaultMessage: | ||
'Deila gögnum með {defenderIsLawyer, select, true {lögmanni} other {réttargæslumanni}} kröfuhafa', | ||
description: 'Notaður sem texti á deila kröfum með kröfuhafa takka.', | ||
}, | ||
shareFilesWithCivilClaimantAdvocateTooltip: { | ||
id: 'judicial.system.core:court_indictments.advocates.civil_claimant_share_files_with_advocate_tooltip', | ||
defaultMessage: | ||
'Ef hakað er í þennan reit fær {defenderIsLawyer, select, true {lögmaður} other {réttargæslumaður}} kröfuhafa aðgang að gögnum málsins', | ||
description: | ||
'Notaður sem texti í tooltip á deila kröfum með kröfuhafa takka.', | ||
}, | ||
lawyer: { | ||
id: 'judicial.system.core:court_indictments.advocates.lawyer', | ||
defaultMessage: 'Lögmaður', | ||
description: 'Notaður sem texti fyrir lögmann í dómaraflæði í ákærum.', | ||
}, | ||
legalRightsProtector: { | ||
id: 'judicial.system.core:court_indictments.advocates.legal_rights_protector', | ||
defaultMessage: 'Réttargæslumaður', | ||
description: | ||
'Notaður sem texti fyrir réttargæslumann í dómaraflæði í ákærum.', | ||
}, | ||
removeCivilClaimantAdvocate: { | ||
id: 'judicial.system.core:court_indictments.advocates.remove_civil_claimant_advocate', | ||
defaultMessage: | ||
'Fjarlægja {defenderIsLawyer, select, true {lögmann} other {réttargæslumann}}', | ||
description: | ||
'Notaður sem texti fyrir eyða kröfuhafa í dómaraflæði í ákærum.', | ||
}, | ||
addCivilClaimantAdvocate: { | ||
id: 'judicial.system.core:court_indictments.advocates.add_civil_claimant', | ||
defaultMessage: 'Bæta við lögmanni kröfuhafa', | ||
description: | ||
'Notaður sem texti fyrir bæta við kröfuhafa takka í dómaraflæði í ákærum.', | ||
}, | ||
noCivilClaimantAdvocate: { | ||
id: 'judicial.system.core:court_indictments.advocates.no_civil_claimant_advocate', | ||
defaultMessage: 'Enginn lögmaður skráður', | ||
description: | ||
'Notaður sem texti þegar enginn lögmaður er skráður í dómaraflæði í ákærum.', | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
...udicial-system/web/src/routes/Court/Indictments/Advocates/SelectCivilClaimantAdvocate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
import { FC, useContext } from 'react' | ||
import { useIntl } from 'react-intl' | ||
|
||
import { | ||
AlertMessage, | ||
Box, | ||
Button, | ||
Checkbox, | ||
RadioButton, | ||
Text, | ||
} from '@island.is/island-ui/core' | ||
import { | ||
BlueBox, | ||
FormContext, | ||
InputAdvocate, | ||
} from '@island.is/judicial-system-web/src/components' | ||
import { | ||
CivilClaimant, | ||
UpdateCivilClaimantInput, | ||
} from '@island.is/judicial-system-web/src/graphql/schema' | ||
import { useCivilClaimants } from '@island.is/judicial-system-web/src/utils/hooks' | ||
|
||
import { strings } from './Advocates.strings' | ||
|
||
interface Props { | ||
civilClaimant: CivilClaimant | ||
} | ||
|
||
const SelectCivilClaimantAdvocate: FC<Props> = ({ civilClaimant }) => { | ||
const { setAndSendCivilClaimantToServer } = useCivilClaimants() | ||
const { workingCase, setWorkingCase } = useContext(FormContext) | ||
|
||
const { formatMessage } = useIntl() | ||
|
||
const updateCivilClaimant = (update: UpdateCivilClaimantInput) => { | ||
setAndSendCivilClaimantToServer( | ||
{ | ||
...update, | ||
caseId: workingCase.id, | ||
civilClaimantId: civilClaimant.id, | ||
}, | ||
setWorkingCase, | ||
) | ||
} | ||
|
||
return ( | ||
<BlueBox> | ||
<Box marginBottom={2}> | ||
<Text variant="h4">{civilClaimant.name}</Text> | ||
</Box> | ||
{civilClaimant.hasSpokesperson ? ( | ||
<> | ||
<Box display="flex" marginY={2}> | ||
<Box width="half" marginRight={1}> | ||
<RadioButton | ||
name="civilClaimantAdvocateType" | ||
id={`civil_claimant_lawyer-${civilClaimant.id}`} | ||
label={formatMessage(strings.lawyer)} | ||
large | ||
backgroundColor="white" | ||
checked={civilClaimant.spokespersonIsLawyer === true} | ||
onChange={() => | ||
updateCivilClaimant({ | ||
spokespersonIsLawyer: true, | ||
} as UpdateCivilClaimantInput) | ||
} | ||
/> | ||
</Box> | ||
<Box width="half" marginLeft={1}> | ||
<RadioButton | ||
name="civilClaimantAdvocateType" | ||
id={`civil_claimant_legal_rights_protector-${civilClaimant.id}`} | ||
label={formatMessage(strings.legalRightsProtector)} | ||
large | ||
backgroundColor="white" | ||
checked={civilClaimant.spokespersonIsLawyer === false} | ||
onChange={() => | ||
updateCivilClaimant({ | ||
spokespersonIsLawyer: false, | ||
} as UpdateCivilClaimantInput) | ||
} | ||
/> | ||
</Box> | ||
</Box> | ||
<Box marginBottom={2}> | ||
<InputAdvocate | ||
clientId={civilClaimant.id} | ||
advocateType={ | ||
civilClaimant.spokespersonIsLawyer | ||
? 'defender' | ||
: 'legal_rights_protector' | ||
} | ||
disabled={ | ||
civilClaimant.spokespersonIsLawyer === null || | ||
civilClaimant.spokespersonIsLawyer === undefined | ||
} | ||
isCivilClaim={true} | ||
/> | ||
</Box> | ||
<Checkbox | ||
name={`shareFilesWithCivilClaimantAdvocate-${civilClaimant.id}`} | ||
label={formatMessage(strings.shareFilesWithCivilClaimantAdvocate, { | ||
defenderIsLawyer: civilClaimant.spokespersonIsLawyer, | ||
})} | ||
checked={Boolean(civilClaimant.caseFilesSharedWithSpokesperson)} | ||
disabled={ | ||
civilClaimant.spokespersonIsLawyer === null || | ||
civilClaimant.spokespersonIsLawyer === undefined | ||
} | ||
onChange={() => { | ||
updateCivilClaimant({ | ||
caseFilesSharedWithSpokesperson: | ||
!civilClaimant.caseFilesSharedWithSpokesperson, | ||
} as UpdateCivilClaimantInput) | ||
}} | ||
tooltip={formatMessage( | ||
strings.shareFilesWithCivilClaimantAdvocateTooltip, | ||
{ | ||
defenderIsLawyer: civilClaimant.spokespersonIsLawyer, | ||
}, | ||
)} | ||
backgroundColor="white" | ||
large | ||
filled | ||
/> | ||
</> | ||
) : ( | ||
<AlertMessage | ||
message={formatMessage(strings.noCivilClaimantAdvocate)} | ||
type="info" | ||
/> | ||
)} | ||
<Box display="flex" justifyContent="flexEnd" marginTop={2}> | ||
<Button | ||
variant="text" | ||
colorScheme={ | ||
civilClaimant.hasSpokesperson ? 'destructive' : 'default' | ||
} | ||
onClick={() => { | ||
updateCivilClaimant({ | ||
hasSpokesperson: !civilClaimant.hasSpokesperson, | ||
spokespersonEmail: null, | ||
spokespersonPhoneNumber: null, | ||
spokespersonName: null, | ||
spokespersonIsLawyer: null, | ||
spokespersonNationalId: null, | ||
caseFilesSharedWithSpokesperson: null, | ||
} as UpdateCivilClaimantInput) | ||
}} | ||
> | ||
{civilClaimant.hasSpokesperson | ||
? formatMessage(strings.removeCivilClaimantAdvocate, { | ||
defenderIsLawyer: civilClaimant.spokespersonIsLawyer, | ||
}) | ||
: formatMessage(strings.addCivilClaimantAdvocate)} | ||
</Button> | ||
</Box> | ||
</BlueBox> | ||
) | ||
} | ||
|
||
export default SelectCivilClaimantAdvocate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.