From 9976d834763d8cf180b2023b34bbe5e2856526bc Mon Sep 17 00:00:00 2001 From: unakb Date: Wed, 18 Sep 2024 13:43:51 +0000 Subject: [PATCH 1/3] fix(j-s): Text and handling of modal on subpoena screen --- .../Indictments/Subpoena/Subpoena.strings.ts | 21 ++++++-- .../Court/Indictments/Subpoena/Subpoena.tsx | 48 +++++++++++-------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.strings.ts b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.strings.ts index aad2a9c99133..8c8c4c2c47e3 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.strings.ts +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.strings.ts @@ -20,17 +20,28 @@ export const subpoena = defineMessages({ 'Notaður sem texti í áfram takka á Fyrirkall skrefi í dómaraflæði í ákærum.', }, modalTitle: { - id: 'judicial.system.core:subpoena.modal_title_v2', - defaultMessage: - 'Viltu senda sækjanda {courtDateHasChanged, select, true {nýtt } other {}}boð í þingfestingu?', + id: 'judicial.system.core:subpoena.modal_title_v3', + defaultMessage: 'Viltu senda fyrirkall?', description: 'Notaður sem titill í modal glugga á Fyrirkallsskjá í ákærum.', }, + modalText: { + id: 'judicial.system.core:subpoena.modal_message', + defaultMessage: + 'Ákæra og fyrirkall verða send til ákæranda.\nÁkærða verður birt ákæran og fyrirkallið rafrænt á island.is', + description: 'Notað sem skilaboð í modal glugga á Fyrirkallsskjá í ákærum', + }, modalPrimaryButtonText: { - id: 'judicial.system.core:subpoena.modal_primary_button_text', - defaultMessage: 'Senda boð', + id: 'judicial.system.core:subpoena.modal_primary_button_text_v2', + defaultMessage: 'Já, senda núna', description: 'Notaður sem texti í staðfesta takka í modal glugga á Fyrirkallsskjá í ákærum.', }, + modalSecondaryButtonText: { + id: 'judicial.system.core:subpoena.modal_secondary_button_text', + defaultMessage: 'Hætta við', + description: + 'Notaður sem texti í hætta takka í modal glugga á Fyrirkallsskjá í ákærum.', + }, subpoenaTypeTitle: { id: 'judicial.system.core:subpoena.subpoena_type_title', defaultMessage: 'Tegund fyrirkalls', diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx index d90022cc8596..5921702615b8 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx @@ -69,30 +69,34 @@ const Subpoena: FC = () => { }) } - const allDataSentToServer = await Promise.all(promises) + const shouldSendNotification = + !hasSentNotification( + NotificationType.COURT_DATE, + workingCase.notifications, + ).hasSent && !courtDateHasChanged + if (shouldSendNotification) { + promises.push( + sendNotification(workingCase.id, NotificationType.COURT_DATE), + ) + } + + const allDataSentToServer = await Promise.all(promises) if (!allDataSentToServer.every((result) => result)) { return } - if ( - hasSentNotification( - NotificationType.COURT_DATE, - workingCase.notifications, - ).hasSent && - !courtDateHasChanged - ) { - router.push(`${destination}/${workingCase.id}`) - } else { - setNavigateTo(destination) - } + router.push(`${destination}/${workingCase.id}`) }, [ isArraignmentDone, sendCourtDateToServer, - workingCase, + workingCase.defendants, + workingCase.notifications, + workingCase.id, courtDateHasChanged, updateDefendant, + sendNotification, ], ) @@ -165,7 +169,11 @@ const Subpoena: FC = () => { previousUrl={`${constants.INDICTMENTS_RECEPTION_AND_ASSIGNMENT_ROUTE}/${workingCase.id}`} nextIsLoading={isLoadingWorkingCase} onNextButtonClick={() => { - handleNavigationTo(constants.INDICTMENTS_DEFENDER_ROUTE) + if (isArraignmentDone) { + router.push( + `${constants.INDICTMENTS_DEFENDER_ROUTE}/${workingCase.id}`, + ) + } else setNavigateTo(constants.INDICTMENTS_DEFENDER_ROUTE) }} nextButtonText={ isArraignmentDone @@ -177,18 +185,16 @@ const Subpoena: FC = () => { {navigateTo !== undefined && ( { - sendNotification(workingCase.id, NotificationType.COURT_DATE) - router.push(`${navigateTo}/${workingCase.id}`) + handleNavigationTo(constants.INDICTMENTS_DEFENDER_ROUTE) }} onSecondaryButtonClick={() => { - router.push(`${navigateTo}/${workingCase.id}`) + setNavigateTo(undefined) }} primaryButtonText={formatMessage(strings.modalPrimaryButtonText)} - secondaryButtonText={formatMessage(core.continue)} + secondaryButtonText={formatMessage(strings.modalSecondaryButtonText)} isPrimaryButtonLoading={false} /> )} From 1628b747da1e6de0e6ecb563ca6f9cfccd48aa20 Mon Sep 17 00:00:00 2001 From: unakb Date: Wed, 18 Sep 2024 13:46:44 +0000 Subject: [PATCH 2/3] Update Subpoena.tsx --- .../src/routes/Court/Indictments/Subpoena/Subpoena.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx index 5921702615b8..5e1acacf3a10 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx @@ -69,13 +69,13 @@ const Subpoena: FC = () => { }) } - const shouldSendNotification = + if ( !hasSentNotification( NotificationType.COURT_DATE, workingCase.notifications, - ).hasSent && !courtDateHasChanged - - if (shouldSendNotification) { + ).hasSent && + !courtDateHasChanged + ) { promises.push( sendNotification(workingCase.id, NotificationType.COURT_DATE), ) From 52b62404774770488a09e82cc9606e4704b3d048 Mon Sep 17 00:00:00 2001 From: unakb Date: Wed, 18 Sep 2024 14:19:11 +0000 Subject: [PATCH 3/3] Update Subpoena.tsx --- .../web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx index 5e1acacf3a10..53be6c8953c9 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Subpoena/Subpoena.tsx @@ -73,8 +73,8 @@ const Subpoena: FC = () => { !hasSentNotification( NotificationType.COURT_DATE, workingCase.notifications, - ).hasSent && - !courtDateHasChanged + ).hasSent || + courtDateHasChanged ) { promises.push( sendNotification(workingCase.id, NotificationType.COURT_DATE),