From 47df0c0febf3671c721eeb021b0b8881bc738ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Fri, 4 Oct 2024 14:47:59 +0000 Subject: [PATCH] fix(service-portal): fix defender info and alert (#16275) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../domains/law-and-order/src/lib/law-and-order.service.ts | 2 +- .../src/components/DocumentLine/DocumentLineV3.tsx | 6 ++++-- .../law-and-order/src/screens/Subpoena/Subpoena.tsx | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/api/domains/law-and-order/src/lib/law-and-order.service.ts b/libs/api/domains/law-and-order/src/lib/law-and-order.service.ts index 3b38f29db9b1..964b2c2b4f9d 100644 --- a/libs/api/domains/law-and-order/src/lib/law-and-order.service.ts +++ b/libs/api/domains/law-and-order/src/lib/law-and-order.service.ts @@ -126,7 +126,7 @@ export class LawAndOrderService { const subpoena: SubpoenaResponse | undefined | null = await this.api.getSubpoena(id, user, locale) - const defenderChoice = subpoena?.defenderInfo.defenderChoice + const defenderChoice = subpoena?.defenderInfo?.defenderChoice const message = defenderChoice ? formatMessage( DefenseChoices[subpoena?.defenderInfo.defenderChoice].message, diff --git a/libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx b/libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx index bff0538f0760..394d1be3a6dd 100644 --- a/libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx +++ b/libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx @@ -106,6 +106,7 @@ export const DocumentLineV3: FC = ({ const displayPdf = ( content?: DocumentV2Content, actions?: Array, + alertMessageData?: DocumentV2Action, ) => { setActiveDocument({ document: { @@ -121,7 +122,7 @@ export const DocumentLineV3: FC = ({ img, categoryId: documentLine.categoryId ?? undefined, actions: actions, - alert: documentLine.alert ?? undefined, + alert: alertMessageData ?? undefined, }) window.scrollTo({ top: 0, @@ -155,8 +156,9 @@ export const DocumentLineV3: FC = ({ } else { const docContent = data?.documentV2?.content const actions = data?.documentV2?.actions ?? undefined + const alert = data?.documentV2?.alert ?? undefined if (docContent) { - displayPdf(docContent, actions) + displayPdf(docContent, actions, alert) setDocumentDisplayError(undefined) setLocalRead([...localRead, documentLine.id]) } else { diff --git a/libs/service-portal/law-and-order/src/screens/Subpoena/Subpoena.tsx b/libs/service-portal/law-and-order/src/screens/Subpoena/Subpoena.tsx index 605062c6166e..bbf546763e78 100644 --- a/libs/service-portal/law-and-order/src/screens/Subpoena/Subpoena.tsx +++ b/libs/service-portal/law-and-order/src/screens/Subpoena/Subpoena.tsx @@ -44,7 +44,6 @@ const Subpoena = () => { const subpoena = data?.lawAndOrderSubpoena const [defenderPopUp, setDefenderPopUp] = useState(false) - if ( subpoena?.data && (!isDefined(subpoena.data.hasBeenServed) || @@ -121,7 +120,7 @@ const Subpoena = () => { action: () => { setDefenderPopUp(true) }, - disabled: !subpoena.data.canEditDefenderChoice, + disabled: subpoena.data.canEditDefenderChoice === false, tooltip: subpoena.data.canEditDefenderChoice ? undefined : subpoena.data.courtContactInfo ?? '', @@ -138,7 +137,7 @@ const Subpoena = () => { {formatMessage(messages.subpoenaInfoText2)} - {!loading && !subpoena?.data.defenderChoice && ( + {!loading && subpoena.data.canEditDefenderChoice === null && ( )}