Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(j-s): Text and handling of modal on subpoena screen #16057

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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?',
unakb marked this conversation as resolved.
Show resolved Hide resolved
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',
unakb marked this conversation as resolved.
Show resolved Hide resolved
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
)

Expand Down Expand Up @@ -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
Expand All @@ -177,18 +185,16 @@ const Subpoena: FC = () => {
</FormContentContainer>
{navigateTo !== undefined && (
<Modal
title={formatMessage(strings.modalTitle, {
courtDateHasChanged,
})}
title={formatMessage(strings.modalTitle)}
text={formatMessage(strings.modalText)}
onPrimaryButtonClick={() => {
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}
/>
)}
Expand Down