From 9169357a9ff32bb0aabe8b22553b660f97432c40 Mon Sep 17 00:00:00 2001 From: Hana Worku Date: Tue, 24 Oct 2023 10:46:37 -0500 Subject: [PATCH] Get basic filters working --- .../RateReviewsDashboard/RateReviewsDashboard.tsx | 7 +++++-- .../RateReviewsDashboard/RateReviewsTable.tsx | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsDashboard.tsx b/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsDashboard.tsx index 2fb0028afe..44db43b6c7 100644 --- a/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsDashboard.tsx +++ b/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsDashboard.tsx @@ -10,6 +10,7 @@ import { RateInDashboardType, RateReviewsTable } from './RateReviewsTable' import { useLDClient } from 'launchdarkly-react-client-sdk' import { featureFlags } from '../../../common-code/featureFlags' import { ErrorFailedRequestPage } from '../../Errors/ErrorFailedRequestPage' +import { RateTypeRecord } from '../../../constants/healthPlanPackages' const RateReviewsDashboard = (): React.ReactElement => { const { loggedInUser } = useAuth() @@ -66,6 +67,7 @@ const RateReviewsDashboard = (): React.ReactElement => { rate.id } formData: ${JSON.stringify(displayRateFormData)})}` ) + return } if (!lastUpdated) { @@ -78,7 +80,6 @@ const RateReviewsDashboard = (): React.ReactElement => { const programs = rate.state.programs const missingField = 'Missing field' - reviewRows.push({ id: rate.id, name: displayRateFormData.rateCertificationName || missingField, @@ -92,7 +93,9 @@ const RateReviewsDashboard = (): React.ReactElement => { rateDateEnd: displayRateFormData.rateDateEnd, status: rate.status, updatedAt: lastUpdated, - rateType: displayRateFormData.rateType || 'NEW', + rateType: displayRateFormData.rateType + ? RateTypeRecord[displayRateFormData.rateType] + : missingField, stateName: rate.state.name, contractRevisions: currentRevision.contractRevisions, }) diff --git a/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsTable.tsx b/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsTable.tsx index a4d403b2ab..96057753e8 100644 --- a/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsTable.tsx +++ b/services/app-web/src/pages/CMSDashboard/RateReviewsDashboard/RateReviewsTable.tsx @@ -17,7 +17,6 @@ import { HealthPlanPackageStatus, Program, RelatedContractRevisions, - RateType, } from '../../../gen/gqlClient' import styles from '../../../components/HealthPlanPackageTable/HealthPlanPackageTable.module.scss' import { Table, Tag, Link } from '@trussworks/react-uswds' @@ -31,7 +30,6 @@ import { FilterOptionType, } from '../../../components/FilterAccordion' import { pluralize } from '../../../common-code/formatters' -import { RateTypeRecord } from '../../../constants/healthPlanPackages' declare module '@tanstack/table-core' { // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -47,7 +45,7 @@ export type RateInDashboardType = { updatedAt: Date status: HealthPlanPackageStatus programs: Program[] - rateType: RateType + rateType: string rateDateStart: Date rateDateEnd: Date stateName: string @@ -128,9 +126,11 @@ const getSelectedFiltersFromUrl = ( }) } }) + const filterValues = valuesFromUrl .filter((item) => item.id === id) .map((item) => ({ value: item.value, label: item.value })) + return filterValues as FilterOptionType[] } @@ -213,7 +213,7 @@ export const RateReviewsTable = ({ columnHelper.accessor('rateType', { id: 'rateType', header: 'Rate type', - cell: (info) => {RateTypeRecord[info.getValue()]}, + cell: (info) => {info.getValue()}, meta: { dataTestID: 'rate-type', }, @@ -276,6 +276,9 @@ export const RateReviewsTable = ({ a['updatedAt'] > b['updatedAt'] ? -1 : 1 ), columns: tableColumns, + state: { + columnFilters, + }, getCoreRowModel: getCoreRowModel(), onColumnFiltersChange: setColumnFilters, getFacetedUniqueValues: getFacetedUniqueValues(),