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..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 @@ -69,30 +69,34 @@ const Subpoena: FC = () => { }) } - const allDataSentToServer = await Promise.all(promises) - - if (!allDataSentToServer.every((result) => result)) { - return - } - if ( - hasSentNotification( + !hasSentNotification( NotificationType.COURT_DATE, workingCase.notifications, - ).hasSent && - !courtDateHasChanged + ).hasSent || + courtDateHasChanged ) { - router.push(`${destination}/${workingCase.id}`) - } else { - setNavigateTo(destination) + promises.push( + sendNotification(workingCase.id, NotificationType.COURT_DATE), + ) } + + const allDataSentToServer = await Promise.all(promises) + if (!allDataSentToServer.every((result) => result)) { + return + } + + 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} /> )}