From b7942bde0081977344a4c33de048ae1554d4ecf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0j=C3=B3n=20Gu=C3=B0j=C3=B3nsson?= Date: Tue, 25 Jun 2024 14:04:50 +0000 Subject: [PATCH] feat(j-s): Court Session type (#15338) * Adds court session type to scheduled indictments * Removes unused Contentful string --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../case-list/models/caseList.model.ts | 4 + .../app/modules/case/dto/updateCase.input.ts | 6 ++ .../src/app/modules/case/models/case.model.ts | 5 + .../migrations/20240623202256-update-case.js | 25 +++++ .../src/app/modules/case/case.service.ts | 7 +- .../app/modules/case/dto/updateCase.dto.ts | 6 ++ .../src/app/modules/case/guards/rolesRules.ts | 1 + .../case/interceptors/caseList.interceptor.ts | 1 + .../modules/case/limitedAccessCase.service.ts | 1 + .../src/app/modules/case/models/case.model.ts | 12 +++ .../src/components/FormProvider/case.graphql | 1 + .../FormProvider/limitedAccessCase.graphql | 1 + .../InfoCard/InfoCardCaseScheduled.tsx | 2 +- ...InfoCardCaseScheduledIndictment.strings.ts | 5 - .../InfoCardCaseScheduledIndictment.tsx | 11 ++- .../components/Table/CourtDate/CourtDate.tsx | 92 +++++++++++++----- .../Conclusion/Conclusion.strings.ts | 12 +++ .../Indictments/Conclusion/Conclusion.tsx | 93 ++++++++++++++++--- .../Court/Indictments/Overview/Overview.tsx | 1 + .../CasesInProgressTable.tsx | 18 ++-- .../components/DefenderCasesTable.string.ts | 10 -- .../Cases/components/DefenderCasesTable.tsx | 39 ++------ .../Defender/Cases/defenderCases.graphql | 1 + .../Indictments/Overview/Overview.tsx | 3 +- .../src/routes/Shared/Cases/ActiveCases.tsx | 35 ++----- .../web/src/routes/Shared/Cases/cases.graphql | 1 + .../IndictmentOverview/IndictmentOverview.tsx | 1 + .../judicial-system/web/src/utils/validate.ts | 4 +- libs/judicial-system/types/src/index.ts | 2 + libs/judicial-system/types/src/lib/case.ts | 24 +++++ 30 files changed, 303 insertions(+), 121 deletions(-) create mode 100644 apps/judicial-system/backend/migrations/20240623202256-update-case.js delete mode 100644 apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.string.ts 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 70941ae95dc9..c5445395a07f 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 @@ -8,6 +8,7 @@ import { CaseIndictmentRulingDecision, CaseState, CaseType, + CourtSessionType, IndictmentCaseReviewDecision, IndictmentDecision, } from '@island.is/judicial-system/types' @@ -128,4 +129,7 @@ export class CaseListEntry { @Field(() => CaseIndictmentRulingDecision, { nullable: true }) readonly indictmentRulingDecision?: CaseIndictmentRulingDecision + + @Field(() => CourtSessionType, { nullable: true }) + readonly courtSessionType?: CourtSessionType } diff --git a/apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts b/apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts index 95e833d4f400..3778d0bf56ec 100644 --- a/apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts +++ b/apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts @@ -24,6 +24,7 @@ import { CaseIndictmentRulingDecision, CaseLegalProvisions, CaseType, + CourtSessionType, IndictmentCaseReviewDecision, IndictmentDecision, RequestSharedWithDefender, @@ -495,4 +496,9 @@ export class UpdateCaseInput { @IsOptional() @Field(() => IndictmentDecision, { nullable: true }) readonly indictmentDecision?: IndictmentDecision + + @Allow() + @IsOptional() + @Field(() => CourtSessionType, { nullable: true }) + readonly courtSessionType?: CourtSessionType } diff --git a/apps/judicial-system/api/src/app/modules/case/models/case.model.ts b/apps/judicial-system/api/src/app/modules/case/models/case.model.ts index 57f588f648dd..ee1d7d858030 100644 --- a/apps/judicial-system/api/src/app/modules/case/models/case.model.ts +++ b/apps/judicial-system/api/src/app/modules/case/models/case.model.ts @@ -18,6 +18,7 @@ import { CaseState, CaseType, CourtDocument, + CourtSessionType, IndictmentCaseReviewDecision, IndictmentDecision, RequestSharedWithDefender, @@ -53,6 +54,7 @@ registerEnumType(IndictmentCaseReviewDecision, { name: 'IndictmentCaseReviewDecision', }) registerEnumType(IndictmentDecision, { name: 'IndictmentDecision' }) +registerEnumType(CourtSessionType, { name: 'CourtSessionType' }) @ObjectType() class DateLog { @@ -439,4 +441,7 @@ export class Case { @Field(() => IndictmentDecision, { nullable: true }) readonly indictmentDecision?: IndictmentDecision + + @Field(() => CourtSessionType, { nullable: true }) + readonly courtSessionType?: CourtSessionType } diff --git a/apps/judicial-system/backend/migrations/20240623202256-update-case.js b/apps/judicial-system/backend/migrations/20240623202256-update-case.js new file mode 100644 index 000000000000..c47e16ed770a --- /dev/null +++ b/apps/judicial-system/backend/migrations/20240623202256-update-case.js @@ -0,0 +1,25 @@ +'use strict' + +module.exports = { + async up(queryInterface, Sequelize) { + return queryInterface.sequelize.transaction((transaction) => + queryInterface.addColumn( + 'case', + 'court_session_type', + { + type: Sequelize.STRING, + allowNull: true, + }, + { transaction }, + ), + ) + }, + + async down(queryInterface) { + return queryInterface.sequelize.transaction((transaction) => + queryInterface.removeColumn('case', 'court_session_type', { + transaction, + }), + ) + }, +} diff --git a/apps/judicial-system/backend/src/app/modules/case/case.service.ts b/apps/judicial-system/backend/src/app/modules/case/case.service.ts index 9df63b21ac8c..1636cc0b118f 100644 --- a/apps/judicial-system/backend/src/app/modules/case/case.service.ts +++ b/apps/judicial-system/backend/src/app/modules/case/case.service.ts @@ -156,13 +156,17 @@ export interface UpdateCase | 'appealIsolationToDate' | 'indictmentRulingDecision' | 'indictmentReviewerId' + | 'indictmentReviewDecision' + | 'indictmentDecision' + | 'rulingSignatureDate' + | 'judgeId' + | 'courtSessionType' > { type?: CaseType state?: CaseState policeCaseNumbers?: string[] defendantWaivesRightToCounsel?: boolean rulingDate?: Date | null - rulingSignatureDate?: Date | null courtCaseNumber?: string | null courtRecordSignatoryId?: string | null courtRecordSignatureDate?: Date | null @@ -170,7 +174,6 @@ export interface UpdateCase arraignmentDate?: UpdateDateLog | null courtDate?: UpdateDateLog | null postponedIndefinitelyExplanation?: string | null - judgeId?: string | null indictmentReturnedExplanation?: string | null indictmentDeniedExplanation?: string | null indictmentHash?: string | null diff --git a/apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts b/apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts index f5cd707ef59d..8527a24d95da 100644 --- a/apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts +++ b/apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts @@ -27,6 +27,7 @@ import { CaseLegalProvisions, CaseType, CourtDocument, + CourtSessionType, IndictmentCaseReviewDecision, IndictmentDecision, RequestSharedWithDefender, @@ -502,4 +503,9 @@ export class UpdateCaseDto { @IsEnum(IndictmentDecision) @ApiPropertyOptional({ enum: IndictmentDecision }) readonly indictmentDecision?: IndictmentDecision + + @IsOptional() + @IsEnum(CourtSessionType) + @ApiPropertyOptional({ enum: CourtSessionType }) + readonly courtSessionType?: CourtSessionType } diff --git a/apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts b/apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts index 3abd70dd8a84..5857b0fa556e 100644 --- a/apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts +++ b/apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts @@ -92,6 +92,7 @@ const districtCourtFields: (keyof UpdateCaseDto)[] = [ 'postponedIndefinitelyExplanation', 'indictmentRulingDecision', 'indictmentDecision', + 'courtSessionType', ] const courtOfAppealsFields: (keyof UpdateCaseDto)[] = [ 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 b04d24c00123..7fa4cf67a5e0 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 @@ -64,6 +64,7 @@ export class CaseListInterceptor implements NestInterceptor { indictmentReviewDecision: theCase.indictmentReviewDecision, indictmentDecision: theCase.indictmentDecision, indictmentRulingDecision: theCase.indictmentRulingDecision, + courtSessionType: theCase.courtSessionType, } }), ), diff --git a/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts b/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts index 817a0e88e112..49911ac2c39d 100644 --- a/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts +++ b/apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts @@ -103,6 +103,7 @@ export const attributes: (keyof Case)[] = [ 'indictmentDecision', 'indictmentRulingDecision', 'indictmentHash', + 'courtSessionType', ] export interface LimitedAccessUpdateCase diff --git a/apps/judicial-system/backend/src/app/modules/case/models/case.model.ts b/apps/judicial-system/backend/src/app/modules/case/models/case.model.ts index aee4019b4263..50901392b33a 100644 --- a/apps/judicial-system/backend/src/app/modules/case/models/case.model.ts +++ b/apps/judicial-system/backend/src/app/modules/case/models/case.model.ts @@ -29,6 +29,7 @@ import { CaseState, CaseType, CourtDocument, + CourtSessionType, IndictmentCaseReviewDecision, IndictmentDecision, RequestSharedWithDefender, @@ -1033,4 +1034,15 @@ export class Case extends Model { @Column({ type: DataType.STRING, allowNull: true }) @ApiPropertyOptional({ type: String }) indictmentHash?: string + + /********** + * The court session type in indictment cases - example: MAIN_HEARING + **********/ + @Column({ + type: DataType.ENUM, + allowNull: true, + values: Object.values(CourtSessionType), + }) + @ApiPropertyOptional({ enum: CourtSessionType }) + courtSessionType?: CourtSessionType } diff --git a/apps/judicial-system/web/src/components/FormProvider/case.graphql b/apps/judicial-system/web/src/components/FormProvider/case.graphql index c446df331636..24e6811b3c8b 100644 --- a/apps/judicial-system/web/src/components/FormProvider/case.graphql +++ b/apps/judicial-system/web/src/components/FormProvider/case.graphql @@ -266,5 +266,6 @@ query Case($input: CaseQueryInput!) { indictmentVerdictAppealDeadline indictmentDecision indictmentReviewDecision + courtSessionType } } diff --git a/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql b/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql index 46b5da32fa26..a63bd030e550 100644 --- a/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql +++ b/apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql @@ -146,5 +146,6 @@ query LimitedAccessCase($input: CaseQueryInput!) { postponedIndefinitelyExplanation indictmentDecision indictmentRulingDecision + courtSessionType } } diff --git a/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduled.tsx b/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduled.tsx index b67ec99860c7..0b8d1de88752 100644 --- a/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduled.tsx +++ b/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduled.tsx @@ -12,7 +12,7 @@ interface Props { court: Institution courtDate: string courtRoom?: string | null - title?: string + title?: string | null } const InfoCardCaseScheduled: React.FC = (props) => { diff --git a/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.strings.ts b/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.strings.ts index 34791198c908..541902c907bb 100644 --- a/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.strings.ts +++ b/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.strings.ts @@ -7,11 +7,6 @@ export const strings = defineMessages({ description: 'Notaður sem titill á Frestað um ótilgreindan tíma upplýsingakorti.', }, - schedulingTitle: { - id: 'judicial.system.core:info_card_case_scheduled_indictment.scheduling_title', - defaultMessage: 'Aðalmeðferð', - description: 'Notaður sem titill á Aðalmeðferð upplýsingakorti.', - }, schedulingUntilVerdictTitle: { id: 'judicial.system.core:info_card_case_scheduled_indictment.scheduling_until_verdict_title', defaultMessage: 'Á dagskrá', diff --git a/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.tsx b/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.tsx index 8602ddd37b51..2b96db35c5b8 100644 --- a/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.tsx +++ b/apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.tsx @@ -2,8 +2,13 @@ import React from 'react' import { useIntl } from 'react-intl' import { Text } from '@island.is/island-ui/core' +import { courtSessionTypeNames } from '@island.is/judicial-system/types' +import { + CourtSessionType, + IndictmentDecision, + Institution, +} from '@island.is/judicial-system-web/src/graphql/schema' -import { IndictmentDecision, Institution } from '../../graphql/schema' import InfoCard from './InfoCard' import InfoCardCaseScheduled from './InfoCardCaseScheduled' import { strings } from './InfoCardCaseScheduledIndictment.strings' @@ -14,6 +19,7 @@ interface Props { courtDate: string courtRoom?: string | null postponedIndefinitelyExplanation?: string | null + courtSessionType?: CourtSessionType | null } const InfoCardCaseScheduledIndictment: React.FC = (props) => { @@ -23,6 +29,7 @@ const InfoCardCaseScheduledIndictment: React.FC = (props) => { courtDate, courtRoom, postponedIndefinitelyExplanation, + courtSessionType, } = props const { formatMessage } = useIntl() @@ -59,7 +66,7 @@ const InfoCardCaseScheduledIndictment: React.FC = (props) => { court={court} courtDate={courtDate} courtRoom={courtRoom} - title={formatMessage(strings.schedulingTitle)} + title={courtSessionType && courtSessionTypeNames[courtSessionType]} /> ) ) : ( diff --git a/apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx b/apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx index 9c3cd97e8edc..efd8bff9b4b3 100644 --- a/apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx +++ b/apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx @@ -6,40 +6,88 @@ import parseISO from 'date-fns/parseISO' import { Box, Text } from '@island.is/island-ui/core' import { capitalize } from '@island.is/judicial-system/formatters' +import { courtSessionTypeNames } from '@island.is/judicial-system/types' import { tables } from '@island.is/judicial-system-web/messages' +import { CourtSessionType } from '@island.is/judicial-system-web/src/graphql/schema' interface Props { courtDate?: string | null postponedIndefinitelyExplanation?: string | null + courtSessionType?: CourtSessionType | null } -const CourtDate: FC = (props) => { - const { courtDate, postponedIndefinitelyExplanation } = props +const PostponedCourtDate = () => { const { formatMessage } = useIntl() - if (!courtDate && !postponedIndefinitelyExplanation) { + return {formatMessage(tables.postponed)} +} + +const CourtDateWithCourtSessionType: FC<{ + courtDate: string + courtSessionType: CourtSessionType +}> = ({ courtDate, courtSessionType }) => { + return ( + <> + {courtSessionTypeNames[courtSessionType]} + + {capitalize( + format(parseISO(courtDate), 'EEEE', { + locale: localeIS, + }), + ).substring(0, 3)} + {'. '} + {capitalize( + format(parseISO(courtDate), 'dd.MM.y', { + locale: localeIS, + }), + ).replace('dagur', 'd.')}{' '} + kl. {format(parseISO(courtDate), 'kk:mm')} + + + ) +} + +const SimpleCourtDate: FC<{ courtDate: string }> = ({ courtDate }) => { + return ( + <> + + + {capitalize( + format(parseISO(courtDate), 'EEEE d. LLLL y', { + locale: localeIS, + }), + ).replace('dagur', 'd.')} + + + + kl. {format(parseISO(courtDate), 'kk:mm')} + + + ) +} + +const CourtDate: FC = ({ + courtDate, + postponedIndefinitelyExplanation, + courtSessionType, +}) => { + if (postponedIndefinitelyExplanation) { + return + } + + if (!courtDate) { return null } - return postponedIndefinitelyExplanation ? ( - {formatMessage(tables.postponed)} - ) : ( - courtDate && ( - <> - - - {capitalize( - format(parseISO(courtDate), 'EEEE d. LLLL y', { - locale: localeIS, - }), - ).replace('dagur', 'd.')} - - - - kl. {format(parseISO(courtDate), 'kk:mm')} - - + if (courtSessionType) { + return ( + ) - ) + } + + return } export default CourtDate diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.strings.ts b/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.strings.ts index 7fbaad1e55db..49ff2c06756a 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.strings.ts +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.strings.ts @@ -127,4 +127,16 @@ export const strings = defineMessages({ defaultMessage: 'Staðfesta', description: 'Notaður sem texti á halda áfram takka.', }, + courtSessionLabel: { + id: 'judicial.system.core:court.indictments.conclusion.court_session_label', + defaultMessage: 'Tegund þinghalds', + description: + 'Notaður sem titill á tegund þinghalds valkosti á Niðurstaða skrefi.', + }, + courtSessionPlaceholder: { + id: 'judicial.system.core:court.indictments.conclusion.court_session_placeholder', + defaultMessage: 'Veldu tegund þinghalds', + description: + 'Notaður sem skýritexti í tegund þinghalds valkosti á Niðurstaða skrefi.', + }, }) diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx b/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx index 20f10ee30c35..a11b33af4780 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useContext, useEffect, useState } from 'react' +import React, { FC, useCallback, useContext, useEffect, useState } from 'react' import { useIntl } from 'react-intl' import router from 'next/router' @@ -7,8 +7,10 @@ import { Input, InputFileUpload, RadioButton, + Select, } from '@island.is/island-ui/core' import * as constants from '@island.is/judicial-system/consts' +import { courtSessionTypeNames } from '@island.is/judicial-system/types' import { core, titles } from '@island.is/judicial-system-web/messages' import { BlueBox, @@ -26,6 +28,7 @@ import { import { CaseFileCategory, CaseIndictmentRulingDecision, + CourtSessionType, IndictmentDecision, } from '@island.is/judicial-system-web/src/graphql/schema' import { stepValidationsType } from '@island.is/judicial-system-web/src/utils/formHelper' @@ -39,20 +42,52 @@ import { import { strings } from './Conclusion.strings' -const Conclusion: React.FC = () => { +const courtSessionOptions = [ + { + label: courtSessionTypeNames[CourtSessionType.MAIN_HEARING], + value: CourtSessionType.MAIN_HEARING, + }, + { + label: courtSessionTypeNames[CourtSessionType.OTHER], + value: CourtSessionType.OTHER, + }, + { + label: courtSessionTypeNames[CourtSessionType.APPRAISER_SUMMONS], + value: CourtSessionType.APPRAISER_SUMMONS, + }, + { + label: courtSessionTypeNames[CourtSessionType.VERDICT], + value: CourtSessionType.VERDICT, + }, + { + label: courtSessionTypeNames[CourtSessionType.MAIN_HEARING_CONTINUATION], + value: CourtSessionType.MAIN_HEARING_CONTINUATION, + }, + { + label: courtSessionTypeNames[CourtSessionType.HEARING], + value: CourtSessionType.HEARING, + }, + { + label: courtSessionTypeNames[CourtSessionType.ORAL_ARGUMENTS], + value: CourtSessionType.ORAL_ARGUMENTS, + }, + { + label: courtSessionTypeNames[CourtSessionType.RULING], + value: CourtSessionType.RULING, + }, + { + label: courtSessionTypeNames[CourtSessionType.ARRAIGNMENT], + value: CourtSessionType.ARRAIGNMENT, + }, +] + +const Conclusion: FC = () => { const { formatMessage } = useIntl() const { workingCase, setWorkingCase, isLoadingWorkingCase, caseNotFound } = useContext(FormContext) - - const [selectedAction, setSelectedAction] = useState() - const [postponementReason, setPostponementReason] = useState() - const [selectedDecision, setSelectedDecision] = - useState() - + const { isUpdatingCase, setAndSendCaseToServer } = useCase() const { courtDate, handleCourtDateChange, handleCourtRoomChange } = useCourtArrangements(workingCase, setWorkingCase, 'courtDate') - const { isUpdatingCase, setAndSendCaseToServer } = useCase() - const { uploadFiles, allFilesDoneOrError, @@ -64,6 +99,13 @@ const Conclusion: React.FC = () => { workingCase.id, ) + const [selectedAction, setSelectedAction] = useState() + const [postponementReason, setPostponementReason] = useState() + const [selectedCourtSessionType, setSelectedCourtSessionType] = + useState() + const [selectedDecision, setSelectedDecision] = + useState() + const handleNavigationTo = useCallback( async (destination: keyof stepValidationsType) => { if (!selectedAction) { @@ -72,6 +114,7 @@ const Conclusion: React.FC = () => { const update: UpdateCase = { indictmentDecision: selectedAction, + courtSessionType: null, courtDate: null, postponedIndefinitelyExplanation: null, indictmentRulingDecision: null, @@ -83,6 +126,7 @@ const Conclusion: React.FC = () => { update.postponedIndefinitelyExplanation = postponementReason break case IndictmentDecision.SCHEDULING: + update.courtSessionType = selectedCourtSessionType if (courtDate?.date) { update.courtDate = { date: formatDateForServer(new Date(courtDate.date)), @@ -119,6 +163,7 @@ const Conclusion: React.FC = () => { courtDate?.location, postponementReason, selectedAction, + selectedCourtSessionType, selectedDecision, setAndSendCaseToServer, setWorkingCase, @@ -138,6 +183,12 @@ const Conclusion: React.FC = () => { } setSelectedAction(IndictmentDecision.SCHEDULING) break + case IndictmentDecision.SCHEDULING: + if (workingCase.courtSessionType) { + setSelectedCourtSessionType(workingCase.courtSessionType) + } + setSelectedAction(IndictmentDecision.SCHEDULING) + break case IndictmentDecision.COMPLETING: if (workingCase.indictmentRulingDecision) { setSelectedDecision(workingCase.indictmentRulingDecision) @@ -148,6 +199,7 @@ const Conclusion: React.FC = () => { setSelectedAction(IndictmentDecision.SCHEDULING) } }, [ + workingCase.courtSessionType, workingCase.indictmentDecision, workingCase.indictmentRulingDecision, workingCase.postponedIndefinitelyExplanation, @@ -163,7 +215,7 @@ const Conclusion: React.FC = () => { case IndictmentDecision.POSTPONING: return Boolean(postponementReason) case IndictmentDecision.SCHEDULING: - return Boolean(courtDate?.date) + return Boolean(selectedCourtSessionType && courtDate?.date) case IndictmentDecision.COMPLETING: switch (selectedDecision) { case CaseIndictmentRulingDecision.RULING: @@ -305,6 +357,25 @@ const Conclusion: React.FC = () => { + +