From dea4ff29a430627f5e0416de14cc73187773c6c3 Mon Sep 17 00:00:00 2001 From: unakb Date: Mon, 13 May 2024 16:12:35 +0000 Subject: [PATCH 1/4] feat(j-s): Table for reviewed cases --- .../case-list/models/caseList.model.ts | 4 + .../case/interceptors/caseList.interceptor.ts | 1 + .../web/messages/Core/tables.ts | 5 + .../Cases/PublicProsecutorCases.tsx | 28 ++++- .../Tables/CasesReviewed.strings.ts | 33 ++++++ .../PublicProsecutor/Tables/CasesReviewed.tsx | 107 ++++++++++++++++++ .../web/src/routes/Shared/Cases/cases.graphql | 1 + 7 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts create mode 100644 apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx diff --git a/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts b/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts index 1fc6b6ca91c4..90126c83239b 100644 --- a/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts +++ b/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts @@ -7,6 +7,7 @@ import { CaseDecision, CaseState, CaseType, + IndictmentCaseReviewDecision, } from '@island.is/judicial-system/types' import { Defendant } from '../../defendant' @@ -108,6 +109,9 @@ export class CaseListEntry { @Field(() => User, { nullable: true }) readonly indictmentReviewer?: User + @Field(() => IndictmentCaseReviewDecision, { nullable: true }) + readonly indictmentReviewDecision?: IndictmentCaseReviewDecision + @Field({ nullable: true }) readonly indictmentAppealDeadline?: string } diff --git a/apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts b/apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts index 342481c390fc..af0efc03b223 100644 --- a/apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts +++ b/apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts @@ -57,6 +57,7 @@ export class CaseListInterceptor implements NestInterceptor { theCase.explanatoryComments, )?.comment, indictmentReviewer: theCase.indictmentReviewer, + indictmentReviewDecision: theCase.indictmentReviewDecision, } }), ), diff --git a/apps/judicial-system/web/messages/Core/tables.ts b/apps/judicial-system/web/messages/Core/tables.ts index 9ca2b85939ba..bdfb34a7bc4d 100644 --- a/apps/judicial-system/web/messages/Core/tables.ts +++ b/apps/judicial-system/web/messages/Core/tables.ts @@ -92,4 +92,9 @@ export const tables = defineMessages({ defaultMessage: 'Frestur', description: 'Notaður sem titill fyrir frestur dálk í lista yfir mál.', }, + reviewDecision: { + id: 'judicial.system.core:tables.review_decision', + defaultMessage: 'Tillaga', + description: 'Notaður sem titill fyrir tillögu dálk í lista yfir mál.', + }, }) diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Cases/PublicProsecutorCases.tsx b/apps/judicial-system/web/src/routes/PublicProsecutor/Cases/PublicProsecutorCases.tsx index 3eccdb4d71cf..30b105d27406 100644 --- a/apps/judicial-system/web/src/routes/PublicProsecutor/Cases/PublicProsecutorCases.tsx +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Cases/PublicProsecutorCases.tsx @@ -9,9 +9,11 @@ import { PageHeader, SharedPageLayout, } from '@island.is/judicial-system-web/src/components' +import { CaseListEntry } from '@island.is/judicial-system-web/src/graphql/schema' import { useCasesQuery } from '../../Shared/Cases/cases.generated' import CasesForReview from '../Tables/CasesForReview' +import CasesReviewComplete from '../Tables/CasesReviewed' import * as styles from '../../Shared/Cases/Cases.css' export const PublicProsecutorCases: React.FC = () => { @@ -24,8 +26,25 @@ export const PublicProsecutorCases: React.FC = () => { const resCases = data?.cases - const casesForReview = useMemo(() => { - return resCases?.filter((c) => c.state && isCompletedCase(c.state)) || [] + const { casesForReview, reviewedCases } = useMemo(() => { + return (resCases || []).reduce( + (acc, c) => { + if ( + c.state && + isCompletedCase(c.state) && + !c.indictmentReviewDecision + ) { + acc.casesForReview.push(c) + } else if (c.indictmentReviewDecision) { + acc.reviewedCases.push(c) + } + return acc + }, + { casesForReview: [], reviewedCases: [] } as { + casesForReview: CaseListEntry[] + reviewedCases: CaseListEntry[] + }, + ) }, [resCases]) return ( @@ -44,7 +63,10 @@ export const PublicProsecutorCases: React.FC = () => { /> ) : ( - + <> + + + )} ) diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts new file mode 100644 index 000000000000..a2461e331c11 --- /dev/null +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts @@ -0,0 +1,33 @@ +import { defineMessages } from 'react-intl' + +export const strings = defineMessages({ + title: { + id: 'judicial.system.core:public_prosecutor.tables.cases_reviewed.title', + defaultMessage: 'Yfirlesin mál', + description: 'Notaður sem titill á yfirlesin mál málalista', + }, + reviewTagAppealed: { + id: 'judicial.system.core:public_prosecutor.tables.cases_reviewed.review_tag_appealed', + defaultMessage: 'Áfrýjun', + description: + 'Notað sem texti á tagg fyrir "Áfrýjun" tillögu í yfirlesin mál málalista', + }, + reviewTagAccepted: { + id: 'judicial.system.core:public_prosecutor.tables.cases_reviewed.review_tag_completed', + defaultMessage: 'Unun', + description: + 'Notað sem texti á tagg fyrir "Unun" tillögu í yfirlesin mál málalista', + }, + infoContainerMessage: { + id: 'judicial.system.core:public_prosecutor.tables.cases_reviewed.info_container_message', + defaultMessage: 'Engin yfirlsin mál.', + description: + 'Notaður sem skilaboð í upplýsingaglugga ef engin yfirlesin mál eru til.', + }, + infoContainerTitle: { + id: 'judicial.system.core:public_prosecutor.tables.cases_reviewed.info_container_title', + defaultMessage: 'Engin mál', + description: + 'Notaður sem titill á upplýsingaglugga ef engin yfirlesin mál eru til.', + }, +}) diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx new file mode 100644 index 000000000000..7ad26e2c4ead --- /dev/null +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx @@ -0,0 +1,107 @@ +import React from 'react' +import { useIntl } from 'react-intl' +import { AnimatePresence } from 'framer-motion' + +import { Tag, Text } from '@island.is/island-ui/core' +import { capitalize, formatDate } from '@island.is/judicial-system/formatters' +import { core, tables } from '@island.is/judicial-system-web/messages' +import { SectionHeading } from '@island.is/judicial-system-web/src/components' +import { useContextMenu } from '@island.is/judicial-system-web/src/components/ContextMenu/ContextMenu' +import { + CourtCaseNumber, + DefendantInfo, +} from '@island.is/judicial-system-web/src/components/Table' +import Table, { + TableWrapper, +} from '@island.is/judicial-system-web/src/components/Table/Table' +import TableInfoContainer from '@island.is/judicial-system-web/src/components/Table/TableInfoContainer/TableInfoContainer' +import { + CaseListEntry, + IndictmentCaseReviewDecision, +} from '@island.is/judicial-system-web/src/graphql/schema' + +import { strings } from './CasesReviewed.strings' + +interface Props { + loading: boolean + cases: CaseListEntry[] +} + +const CasesReviewed: React.FC = ({ loading, cases }) => { + const { formatMessage } = useIntl() + const { openCaseInNewTabMenuItem } = useContextMenu() + + const decisionMapping = { + [IndictmentCaseReviewDecision.ACCEPT]: formatMessage( + strings.reviewTagAccepted, + ), + [IndictmentCaseReviewDecision.APPEAL]: formatMessage( + strings.reviewTagAppealed, + ), + } + + return ( + <> + + + + {cases.length > 0 ? ( + { + return [openCaseInNewTabMenuItem(row.id)] + }} + columns={[ + { + cell: (row) => ( + + ), + }, + { + cell: (row) => , + }, + { + cell: (row) => ( + + {row.indictmentReviewDecision && + decisionMapping[row.indictmentReviewDecision]} + + ), + }, + { + cell: (row: CaseListEntry) => ( + {row.indictmentReviewer?.name} + ), + }, + ]} + /> + ) : ( + + )} + + + + ) +} + +export default CasesReviewed diff --git a/apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql b/apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql index 9aa39a65cb21..1200c0033236 100644 --- a/apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql +++ b/apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql @@ -87,6 +87,7 @@ query Cases { id name } + indictmentReviewDecision indictmentAppealDeadline } } From d9fcc7025966e16bde2488cee93d67e19a5f3463 Mon Sep 17 00:00:00 2001 From: unakb Date: Mon, 13 May 2024 16:29:37 +0000 Subject: [PATCH 2/4] Update CasesReviewed.tsx --- .../web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx index 7ad26e2c4ead..6c3029eee4d2 100644 --- a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx @@ -3,7 +3,7 @@ import { useIntl } from 'react-intl' import { AnimatePresence } from 'framer-motion' import { Tag, Text } from '@island.is/island-ui/core' -import { capitalize, formatDate } from '@island.is/judicial-system/formatters' +import { capitalize } from '@island.is/judicial-system/formatters' import { core, tables } from '@island.is/judicial-system-web/messages' import { SectionHeading } from '@island.is/judicial-system-web/src/components' import { useContextMenu } from '@island.is/judicial-system-web/src/components/ContextMenu/ContextMenu' From 5954313fc27d1f7973b81277b418fc9e2af0ecda Mon Sep 17 00:00:00 2001 From: unakb Date: Tue, 14 May 2024 12:05:51 +0000 Subject: [PATCH 3/4] cleanup --- apps/judicial-system/web/messages/Core/tables.ts | 4 ++-- .../routes/PublicProsecutor/Tables/CasesReviewed.strings.ts | 2 +- .../web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/judicial-system/web/messages/Core/tables.ts b/apps/judicial-system/web/messages/Core/tables.ts index bdfb34a7bc4d..eb31f2865a5d 100644 --- a/apps/judicial-system/web/messages/Core/tables.ts +++ b/apps/judicial-system/web/messages/Core/tables.ts @@ -94,7 +94,7 @@ export const tables = defineMessages({ }, reviewDecision: { id: 'judicial.system.core:tables.review_decision', - defaultMessage: 'Tillaga', - description: 'Notaður sem titill fyrir tillögu dálk í lista yfir mál.', + defaultMessage: 'Ákvörðun', + description: 'Notaður sem titill fyrir ákvörðun dálk í lista yfir mál.', }, }) diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts index a2461e331c11..420994b1d6d5 100644 --- a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts @@ -20,7 +20,7 @@ export const strings = defineMessages({ }, infoContainerMessage: { id: 'judicial.system.core:public_prosecutor.tables.cases_reviewed.info_container_message', - defaultMessage: 'Engin yfirlsin mál.', + defaultMessage: 'Engin yfirlesin mál.', description: 'Notaður sem skilaboð í upplýsingaglugga ef engin yfirlesin mál eru til.', }, diff --git a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx index 6c3029eee4d2..2abfc0dc1b3c 100644 --- a/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx +++ b/apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { FC } from 'react' import { useIntl } from 'react-intl' import { AnimatePresence } from 'framer-motion' @@ -27,7 +27,7 @@ interface Props { cases: CaseListEntry[] } -const CasesReviewed: React.FC = ({ loading, cases }) => { +const CasesReviewed: FC = ({ loading, cases }) => { const { formatMessage } = useIntl() const { openCaseInNewTabMenuItem } = useContextMenu() From d9c4b761128c8a7dc7a72d743f3b352f11458c65 Mon Sep 17 00:00:00 2001 From: andes-it Date: Tue, 14 May 2024 12:24:44 +0000 Subject: [PATCH 4/4] chore: nx format:write update dirty files --- .../api/src/app/modules/case-list/models/caseList.model.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts b/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts index 01570212f725..c7e2d8a73f81 100644 --- a/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts +++ b/apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts @@ -112,7 +112,6 @@ export class CaseListEntry { @Field(() => IndictmentCaseReviewDecision, { nullable: true }) readonly indictmentReviewDecision?: IndictmentCaseReviewDecision - @Field(() => String, { nullable: true }) readonly indictmentAppealDeadline?: string }