Skip to content

Commit

Permalink
10409: Update custom case report to new selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Rogers committed Sep 23, 2024
1 parent cd05f0b commit 5dc7ace
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
8 changes: 4 additions & 4 deletions web-client/src/presenter/computeds/customCaseReportHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CASE_TYPES,
CHIEF_JUDGE,
CUSTOM_CASE_REPORT_PAGE_SIZE,
CaseType,
} from '@shared/business/entities/EntityConstants';
import { Case } from '@shared/business/entities/cases/Case';
import {
Expand All @@ -12,24 +13,23 @@ import {
import { ClientApplicationContext } from '@web-client/applicationContext';
import { FORMATS } from '@shared/business/utilities/DateHandler';
import { Get } from 'cerebral';
import { InputOption } from '@web-client/ustc-ui/Utils/types';
import { getTrialCitiesGroupedByState } from '@shared/business/utilities/trialSession/trialCitiesGroupedByState';
import { state } from '@web-client/presenter/app.cerebral';

export const customCaseReportHelper = (
get: Get,
applicationContext: ClientApplicationContext,
): {
caseStatuses: InputOption[];
caseTypes: InputOption[];
caseStatuses: { label: string; value: string }[];
caseTypes: { label: string; value: CaseType }[];
cases: (CaseInventory & {
inConsolidatedGroup: boolean;
consolidatedIconTooltipText: string;
shouldIndent: boolean;
isLeadCase: boolean;
})[];
clearFiltersIsDisabled: boolean;
judges: InputOption[];
judges: { label: string; value: string }[];
pageCount: number;
today: string;
trialCitiesByState: {
Expand Down
6 changes: 0 additions & 6 deletions web-client/src/ustc-ui/Utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import { GetCasesByStatusAndByJudgeResponse } from '@web-api/business/useCases/j
import { JudgeActivityReportFilters } from '@web-api/business/useCases/judgeActivityReport/getCountOfCaseDocumentsFiledByJudgesInteractor';
import { TrialSessionReturnType } from '@web-api/business/useCases/judgeActivityReport/getTrialSessionsForJudgeActivityReportInteractor';

export type InputOption<T = string> = {
label: string;
value?: T;
options?: InputOption[];
};

type JudgeActivityReportData = {
trialSessions: TrialSessionReturnType;
casesClosedByJudge: CasesClosedReturnType;
Expand Down
25 changes: 13 additions & 12 deletions web-client/src/views/CustomCaseReport/CustomCaseReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { BigHeader } from '../BigHeader';
import { Button } from '../../ustc-ui/Button/Button';
import { CaseInventory } from '@web-api/business/useCases/caseInventoryReport/getCustomCaseReportInteractor';
import { CaseLink } from '../../ustc-ui/CaseLink/CaseLink';
import { CaseType } from '@shared/business/entities/EntityConstants';
import { ConsolidatedCaseIcon } from '../../ustc-ui/Icon/ConsolidatedCaseIcon';
import { DateRangePickerComponent } from '../../ustc-ui/DateInput/DateRangePickerComponent';
import { ErrorNotification } from '../ErrorNotification';
import { Icon } from '../../ustc-ui/Icon/Icon';
import { Paginator } from '../../ustc-ui/Pagination/Paginator';
import { PillButton } from '@web-client/ustc-ui/Button/PillButton';
import { SelectSearch } from '../../ustc-ui/Select/SelectSearch';
import { SelectSearch2 } from '@web-client/ustc-ui/Select/SelectSearch2';
import { SuccessNotification } from '../SuccessNotification';
import { connect } from '@web-client/presenter/shared.cerebral';
import { focusPaginatorTop } from '@web-client/presenter/utilities/focusPaginatorTop';
Expand Down Expand Up @@ -247,13 +248,13 @@ export const CustomCaseReport = connect(
Case status{' '}
<span className="optional-light-text">(optional)</span>
</label>
<SelectSearch
<SelectSearch2
aria-labelledby="case-status-label"
id="case-status"
name="caseStatus"
options={customCaseReportHelper.caseStatuses}
placeholder="- Select one or more -"
value={'Select one or more'}
value={{ label: '- Select one or more -', value: '' }}
onChange={inputValue => {
if (inputValue) {
setCustomCaseReportFiltersSequence({
Expand All @@ -275,13 +276,16 @@ export const CustomCaseReport = connect(
Case types{' '}
<span className="optional-light-text">(optional)</span>
</label>
<SelectSearch
<SelectSearch2
aria-labelledby="case-type-label"
id="case-type"
name="eventCode"
options={customCaseReportHelper.caseTypes}
placeholder="- Select one or more -"
value="Select one or more"
value={{
label: '- Select one or more -',
value: '' as CaseType,
}}
onChange={inputValue => {
if (inputValue) {
setCustomCaseReportFiltersSequence({
Expand All @@ -304,13 +308,13 @@ export const CustomCaseReport = connect(
Assigned judge{' '}
<span className="optional-light-text">(optional)</span>
</label>
<SelectSearch
<SelectSearch2
aria-labelledby="judges-label"
id="judges"
name="judges"
options={customCaseReportHelper.judges}
placeholder="- Select one or more -"
value={'Select one or more'}
value={{ label: '- Select one or more -', value: '' }}
onChange={inputValue => {
if (inputValue) {
setCustomCaseReportFiltersSequence({
Expand All @@ -332,16 +336,13 @@ export const CustomCaseReport = connect(
Requested place of trial{' '}
<span className="optional-light-text">(optional)</span>
</label>
<SelectSearch
<SelectSearch2
aria-labelledby="requested-place-of-trial-label"
id="trial-location"
name="requestedPlaceOfTrial"
options={customCaseReportHelper.trialCitiesByState}
placeholder="- Select one or more -"
searchableOptions={
customCaseReportHelper.searchableTrialCities
}
value="Select one or more"
value={{ label: '- Select one or more -', value: '' }}
onChange={inputValue => {
if (inputValue) {
setCustomCaseReportFiltersSequence({
Expand Down

0 comments on commit 5dc7ace

Please sign in to comment.