From 043e11090ece26ba510e65506a0759f178a1b40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Tue, 3 Dec 2024 11:38:58 +0000 Subject: [PATCH] Add modal when revoking send to prison admin --- .../web/messages/Core/index.ts | 5 ++++ .../BlueBoxWithDate.strings.ts | 16 ++++++++++++ .../BlueBoxWithIcon/BlueBoxWithDate.tsx | 26 ++++++++++++++++--- .../SendToPrisonAdmin.strings.ts | 2 +- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/apps/judicial-system/web/messages/Core/index.ts b/apps/judicial-system/web/messages/Core/index.ts index f783a0114759..efb61f12781d 100644 --- a/apps/judicial-system/web/messages/Core/index.ts +++ b/apps/judicial-system/web/messages/Core/index.ts @@ -209,6 +209,11 @@ export const core = defineMessages({ defaultMessage: 'Halda áfram', description: 'Notað fyrir "Halda áfram" takka í öllum flæðum.', }, + cancel: { + id: 'judicial.system.core:cancel', + defaultMessage: 'Hætta við', + description: 'Notað fyrir "Hætta við" takka í öllum flæðum.', + }, createCase: { id: 'judicial.system.core:create_case', defaultMessage: 'Stofna mál', diff --git a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts index a3f57cbebd4c..bfc6b85ca6e1 100644 --- a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts +++ b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts @@ -83,4 +83,20 @@ export const strings = defineMessages({ description: 'Notaður sem titill í svæði þar sem kærufrestur viðurlagaákvörðunar er tekinn fram', }, + revokeSendToPrisonAdminModalTitle: { + id: 'judicial.system.core:public_prosecutor.indictments.overview.revoke_send_to_prison_admin_modal_title', + defaultMessage: 'Afturkalla úr fullnustu', + description: 'Notaður sem titill í "Afturkalla úr fullnustu" modal glugga.', + }, + revokeSendToPrisonAdminModalText: { + id: 'judicial.system.core:public_prosecutor.indictments.overview.revoke_send_to_prison_admin_modal_text', + defaultMessage: + 'Mál {courtCaseNumber} verður afturkallað.\nÁkærði: {defendant}.', + description: 'Notaður sem texti í "Afturkalla úr fullnustu" modal glugga.', + }, + revoke: { + id: 'judicial.system.core:public_prosecutor.indictments.overview.revoke', + defaultMessage: 'Afturkalla', + description: 'Notaður sem texti fyrir aðgerðina að afturkalla mál', + }, }) diff --git a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx index 323fe5cf4469..cb7a7fa84130 100644 --- a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx +++ b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx @@ -15,7 +15,7 @@ import { import { PUBLIC_PROSECUTOR_STAFF_INDICTMENT_SEND_TO_PRISON_ADMIN_ROUTE } from '@island.is/judicial-system/consts' import { formatDate } from '@island.is/judicial-system/formatters' import { VERDICT_APPEAL_WINDOW_DAYS } from '@island.is/judicial-system/types' -import { errors } from '@island.is/judicial-system-web/messages' +import { core, errors } from '@island.is/judicial-system-web/messages' import { CaseIndictmentRulingDecision, @@ -29,12 +29,15 @@ import { getAppealExpirationInfo } from '../InfoCard/DefendantInfo/DefendantInfo import SectionHeading from '../SectionHeading/SectionHeading' import { strings } from './BlueBoxWithDate.strings' import * as styles from './BlueBoxWithIcon.css' +import Modal from '../Modal/Modal' interface Props { defendant: Defendant icon?: IconMapIcon } +type VisibleModal = 'REVOKE_SEND_TO_PRISON_ADMIN' + const BlueBoxWithDate: FC = (props) => { const { defendant, icon } = props const { formatMessage } = useIntl() @@ -47,7 +50,8 @@ const BlueBoxWithDate: FC = (props) => { }) const [triggerAnimation, setTriggerAnimation] = useState(false) const [triggerAnimation2, setTriggerAnimation2] = useState(false) - const { setAndSendDefendantToServer } = useDefendants() + const [modalVisible, setModalVisible] = useState() + const { setAndSendDefendantToServer, isUpdatingDefendant } = useDefendants() const { workingCase, setWorkingCase } = useContext(FormContext) const router = useRouter() @@ -111,6 +115,8 @@ const BlueBoxWithDate: FC = (props) => { }, setWorkingCase, ) + + setModalVisible(undefined) } const appealExpirationInfo = useMemo(() => { @@ -335,7 +341,7 @@ const BlueBoxWithDate: FC = (props) => { {defendant.isSentToPrisonAdmin ? ( )} + {modalVisible === 'REVOKE_SEND_TO_PRISON_ADMIN' && ( + setModalVisible(undefined)} + /> + )} ) } diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/SendToPrisonAdmin/SendToPrisonAdmin.strings.ts b/apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/SendToPrisonAdmin/SendToPrisonAdmin.strings.ts index 6a513f738833..44201a0341f3 100644 --- a/apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/SendToPrisonAdmin/SendToPrisonAdmin.strings.ts +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/SendToPrisonAdmin/SendToPrisonAdmin.strings.ts @@ -29,7 +29,7 @@ export const strings = defineMessages({ 'Notaður sem titill á tilkynningarglugga um að senda til fullnustu.', }, modalText: { - id: 'judicial.system.core:send_to_prison_admin.modal_text', + id: 'judicial.system.core:send_to_prison_admin.modal_text_v1', defaultMessage: 'Mál {courtCaseNumber} verður sent til Fangelsismálastofnunar til fullnustu.\nÁkærði: {defendant}.', description: