diff --git a/web/src/features/election-event/components/Dashboard/Dashboard.tsx b/web/src/features/election-event/components/Dashboard/Dashboard.tsx index e6052dcab..6f5fe2544 100644 --- a/web/src/features/election-event/components/Dashboard/Dashboard.tsx +++ b/web/src/features/election-event/components/Dashboard/Dashboard.tsx @@ -34,6 +34,7 @@ export default function ElectionEventDashboard(): ReactElement { } const { data: electionEvent } = useElectionRoundDetails(currentElectionRoundId); + return ( } backButton={<>}> diff --git a/web/src/features/filtering/components/ActiveFilters.tsx b/web/src/features/filtering/components/ActiveFilters.tsx index deb88e5fb..cf0d0c12e 100644 --- a/web/src/features/filtering/components/ActiveFilters.tsx +++ b/web/src/features/filtering/components/ActiveFilters.tsx @@ -18,6 +18,18 @@ const FILTER_LABELS = new Map([ [FILTER_KEY.MonitoringObserverStatus, FILTER_LABEL.MonitoringObserverStatus], [FILTER_KEY.MonitoringObserverTags, FILTER_LABEL.MonitoringObserverTags], [FILTER_KEY.FormTypeFilter, FILTER_LABEL.FormTypeFilter], + [FILTER_KEY.HasFlaggedAnswers, FILTER_LABEL.HasFlaggedAnswers], + [FILTER_KEY.FollowUpStatus, FILTER_LABEL.FollowUpStatus], + [FILTER_KEY.HasNotes, FILTER_LABEL.HasNotes], + [FILTER_KEY.MediaFiles, FILTER_LABEL.MediaFiles], + [FILTER_KEY.QuestionsAnswered, FILTER_LABEL.QuestionsAnswered], + [FILTER_KEY.LocationL1, FILTER_LABEL.LocationL1], + [FILTER_KEY.LocationL2, FILTER_LABEL.LocationL2], + [FILTER_KEY.LocationL3, FILTER_LABEL.LocationL3], + [FILTER_KEY.LocationL4, FILTER_LABEL.LocationL4], + [FILTER_KEY.LocationL5, FILTER_LABEL.LocationL5], + [FILTER_KEY.FormSubmissionsMonitoringObserverTags, FILTER_LABEL.FormSubmissionsMonitoringObserverTags], + [FILTER_KEY.PollingStationNumber, FILTER_LABEL.PollingStationNumber], ]); const ActiveFilter: FC = ({ filterId, value, isArray }) => { diff --git a/web/src/features/filtering/components/SelectFilter.tsx b/web/src/features/filtering/components/SelectFilter.tsx index a4ad5a8ef..9f72bf7b6 100644 --- a/web/src/features/filtering/components/SelectFilter.tsx +++ b/web/src/features/filtering/components/SelectFilter.tsx @@ -42,8 +42,8 @@ interface BinarySelectFilterProps extends Omit {} export const BinarySelectFilter: FC = (props) => { const options: SelectFilterOption[] = [ - { value: 'Yes', label: 'Yes' }, - { value: 'No', label: 'No' }, + { value: 'true', label: 'Yes' }, + { value: 'false', label: 'No' }, ]; return ; diff --git a/web/src/features/filtering/filtering-enums.ts b/web/src/features/filtering/filtering-enums.ts index 87d6c19d3..cd13f64f9 100644 --- a/web/src/features/filtering/filtering-enums.ts +++ b/web/src/features/filtering/filtering-enums.ts @@ -4,6 +4,18 @@ export const enum FILTER_KEY { MonitoringObserverStatus = 'monitoringObserverStatus', MonitoringObserverTags = 'tags', FormTypeFilter = 'formTypeFilter', + HasFlaggedAnswers = 'hasFlaggedAnswers', + FollowUpStatus = 'followUpStatus', + HasNotes = 'hasNotes', + MediaFiles = 'hasAttachments', + QuestionsAnswered = 'questionsAnswered', + LocationL1 = 'level1Filter', + LocationL2 = 'level2Filter', + LocationL3 = 'level3Filter', + LocationL4 = 'level4Filter', + LocationL5 = 'level5Filter', + PollingStationNumber = 'pollingStationNumberFilter', + FormSubmissionsMonitoringObserverTags = 'tagsFilter', ViewBy = 'viewBy', } @@ -11,4 +23,16 @@ export const enum FILTER_LABEL { MonitoringObserverStatus = 'Observer status', MonitoringObserverTags = 'Tags', FormTypeFilter = 'Form type', + HasFlaggedAnswers = 'Flagged answers', + FollowUpStatus = 'Follow-up status', + HasNotes = 'Question notes', + QuestionsAnswered = 'Questions answered', + LocationL1 = 'Location - L1', + LocationL2 = 'Location - L2', + LocationL3 = 'Location - L3', + LocationL4 = 'Location - L4', + LocationL5 = 'Location - L5', + PollingStationNumber = 'Polling station number', + FormSubmissionsMonitoringObserverTags = 'Observer tags', + MediaFiles = 'Has attachments', } diff --git a/web/src/features/monitoring-observers/filtering/MonitoringObserverTagsSelect.tsx b/web/src/features/monitoring-observers/filtering/MonitoringObserverTagsSelect.tsx index cfa20f6be..1091b64db 100644 --- a/web/src/features/monitoring-observers/filtering/MonitoringObserverTagsSelect.tsx +++ b/web/src/features/monitoring-observers/filtering/MonitoringObserverTagsSelect.tsx @@ -4,20 +4,26 @@ import { FILTER_KEY } from '@/features/filtering/filtering-enums'; import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; import { useMonitoringObserversTags } from '@/hooks/tags-queries'; -import { FC, useEffect } from 'react'; +import { FC } from 'react'; + +interface MonitoringObserverTagsSelectProps { + isFilteringFormSubmissions?: boolean; +} + +export const MonitoringObserverTagsSelect: FC = ({ isFilteringFormSubmissions }) => { + const COMPONENT_FILTER_KEY = isFilteringFormSubmissions + ? FILTER_KEY.FormSubmissionsMonitoringObserverTags + : FILTER_KEY.MonitoringObserverTags; -export const MonitoringObserverTagsSelect: FC = () => { const currentElectionRoundId = useCurrentElectionRoundStore((s) => s.currentElectionRoundId); const { data: tags } = useMonitoringObserversTags(currentElectionRoundId); const { queryParams, navigateHandler } = useFilteringContainer(); - const currentTags = (queryParams as any)?.[FILTER_KEY.MonitoringObserverTags] ?? []; + const currentTags = (queryParams as any)?.[COMPONENT_FILTER_KEY] ?? []; const toggleTagsFilter = (tags: string[]) => { - return navigateHandler({ [FILTER_KEY.MonitoringObserverTags]: tags }); + return navigateHandler({ [COMPONENT_FILTER_KEY]: tags }); }; - useEffect(() => {}, [currentTags]); - return ( ({ label: tag, value: tag })) ?? []} diff --git a/web/src/features/responses/components/FormSubmissionsByEntryTable/FormSubmissionsByEntryTable.tsx b/web/src/features/responses/components/FormSubmissionsByEntryTable/FormSubmissionsByEntryTable.tsx index fa27ccd9b..c88d3859b 100644 --- a/web/src/features/responses/components/FormSubmissionsByEntryTable/FormSubmissionsByEntryTable.tsx +++ b/web/src/features/responses/components/FormSubmissionsByEntryTable/FormSubmissionsByEntryTable.tsx @@ -38,6 +38,7 @@ export function FormSubmissionsByEntryTable({ searchText }: FormSubmissionsByEnt ['questionsAnswered', debouncedSearch.questionsAnswered], ['hasNotes', debouncedSearch.hasNotes], ['hasAttachments', debouncedSearch.hasAttachments], + ['tagsFilter', debouncedSearch.tagsFilter], ].filter(([_, value]) => value); return Object.fromEntries(params) as FormSubmissionsSearchParams; diff --git a/web/src/features/responses/components/FormSubmissionsTab/FormSubmissionsTab.tsx b/web/src/features/responses/components/FormSubmissionsTab/FormSubmissionsTab.tsx index ec5525a54..b4216332e 100644 --- a/web/src/features/responses/components/FormSubmissionsTab/FormSubmissionsTab.tsx +++ b/web/src/features/responses/components/FormSubmissionsTab/FormSubmissionsTab.tsx @@ -25,6 +25,7 @@ import { FormSubmissionsAggregatedByFormTable } from '../FormSubmissionsAggregat import { FormSubmissionsByEntryTable } from '../FormSubmissionsByEntryTable/FormSubmissionsByEntryTable'; import { FunctionComponent } from '@/common/types'; +import { FormsFiltersByForm } from '../FormsFiltersByForm/FormsFiltersByForm'; const routeApi = getRouteApi('/responses/'); @@ -91,18 +92,16 @@ export default function FormSubmissionsTab(): FunctionComponent {
- {byFilter !== 'byForm' && ( - <> - - { - setIsFiltering((prev) => !prev); - }} - /> - - )} + <> + + { + setIsFiltering((prev) => !prev); + }} + /> +
@@ -110,11 +109,12 @@ export default function FormSubmissionsTab(): FunctionComponent { {isFiltering && ( -
+ <> {byFilter === 'byEntry' && } {byFilter === 'byObserver' && } -
+ {byFilter === 'byForm' && } + )} diff --git a/web/src/features/responses/components/FormsFiltersByEntry/FormsFiltersByEntry.tsx b/web/src/features/responses/components/FormsFiltersByEntry/FormsFiltersByEntry.tsx index e3f31c33b..825d94cbb 100644 --- a/web/src/features/responses/components/FormsFiltersByEntry/FormsFiltersByEntry.tsx +++ b/web/src/features/responses/components/FormsFiltersByEntry/FormsFiltersByEntry.tsx @@ -1,271 +1,25 @@ -import { useSetPrevSearch } from '@/common/prev-search-store'; -import { FollowUpStatus, FunctionComponent, QuestionsAnswered, ZFormType } from '@/common/types'; import { PollingStationsFilters } from '@/components/PollingStationsFilters/PollingStationsFilters'; -import { FilterBadge } from '@/components/ui/badge'; -import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; -import { mapFormType } from '@/lib/utils'; -import { Route } from '@/routes/responses'; -import { useNavigate } from '@tanstack/react-router'; -import { useCallback } from 'react'; -import type { FormSubmissionsSearchParams } from '../../models/search-params'; -import { mapFollowUpStatus, mapQuestionsAnswered } from '../../utils/helpers'; -import { ResetFiltersButton } from '../ResetFiltersButton/ResetFiltersButton'; - -export function FormsFiltersByEntry(): FunctionComponent { - const navigate = useNavigate({ from: '/responses/' }); - const search = Route.useSearch(); - const setPrevSearch = useSetPrevSearch(); - - const navigateHandler = useCallback( - (search: Record) => { - void navigate({ - // @ts-ignore - search: (prev) => { - const newSearch: Record = { - ...prev, - ...search, - }; - setPrevSearch(newSearch); - return newSearch; - }, - }); - }, - [navigate, setPrevSearch] - ); - - const onClearFilter = useCallback( - (filter: keyof FormSubmissionsSearchParams | (keyof FormSubmissionsSearchParams)[]) => () => { - const filters = Array.isArray(filter) - ? Object.fromEntries(filter.map((key) => [key, undefined])) - : { [filter]: undefined }; - navigateHandler(filters); - }, - [navigateHandler] - ); - - const isFiltered = Object.keys(search).some((key) => key !== 'tab' && key !== 'viewBy'); - +import { FilteringContainer } from '@/features/filtering/components/FilteringContainer'; +import { MonitoringObserverTagsSelect } from '@/features/monitoring-observers/filtering/MonitoringObserverTagsSelect'; +import { FC } from 'react'; +import { FormSubmissionsFlaggedAnswersSelect } from '../../filtering/FormSubmissionsFlaggedAnswersSelect'; +import { FormSubmissionsFollowUpSelect } from '../../filtering/FormSubmissionsFollowUpSelect'; +import { FormSubmissionsMediaFilesSelect } from '../../filtering/FormSubmissionsMediaFilesSelect'; +import { FormSubmissionsQuestionNotesSelect } from '../../filtering/FormSubmissionsQuestionNotesSelect'; +import { FormSubmissionsQuestiosAnsweredSelect } from '../../filtering/FormSubmissionsQuestionsAnsweredSelect'; +import { FormSubmissionsTypeSelect } from '../../filtering/FormSubmissionsTypeSelect'; + +export const FormsFiltersByEntry: FC = () => { return ( - <> - - - - - - - - - - - - - + + + + + + + + - - - - {isFiltered && ( -
- {search.formTypeFilter && ( - - )} - - {search.followUpStatus && ( - - )} - - {search.hasFlaggedAnswers && ( - - )} - - {search.level1Filter && ( - - )} - - {search.level2Filter && ( - - )} - - {search.level3Filter && ( - - )} - - {search.level4Filter && ( - - )} - - {search.level5Filter && ( - - )} - - {search.pollingStationNumberFilter && ( - - )} - - {search.questionsAnswered && ( - - )} - - {search.hasNotes && ( - - )} -
- )} - +
); -} +}; diff --git a/web/src/features/responses/components/FormsFiltersByForm/FormsFiltersByForm.tsx b/web/src/features/responses/components/FormsFiltersByForm/FormsFiltersByForm.tsx new file mode 100644 index 000000000..acca878be --- /dev/null +++ b/web/src/features/responses/components/FormsFiltersByForm/FormsFiltersByForm.tsx @@ -0,0 +1,15 @@ +import { FilteringContainer } from '@/features/filtering/components/FilteringContainer'; +import { FC } from 'react'; +import { FormSubmissionsFlaggedAnswersSelect } from '../../filtering/FormSubmissionsFlaggedAnswersSelect'; +import { FormSubmissionsMediaFilesSelect } from '../../filtering/FormSubmissionsMediaFilesSelect'; +import { FormSubmissionsQuestionNotesSelect } from '../../filtering/FormSubmissionsQuestionNotesSelect'; + +export const FormsFiltersByForm: FC = () => { + return ( + + + + + + ); +}; diff --git a/web/src/features/responses/components/FormsFiltersByObserver/FormsFiltersByObserver.tsx b/web/src/features/responses/components/FormsFiltersByObserver/FormsFiltersByObserver.tsx index cd5915ac9..199b5cdb1 100644 --- a/web/src/features/responses/components/FormsFiltersByObserver/FormsFiltersByObserver.tsx +++ b/web/src/features/responses/components/FormsFiltersByObserver/FormsFiltersByObserver.tsx @@ -1,115 +1,15 @@ -import { ChevronDownIcon } from '@heroicons/react/24/outline'; -import { useNavigate } from '@tanstack/react-router'; -import { useCallback } from 'react'; -import { FollowUpStatus, type FunctionComponent } from '@/common/types'; -import { FilterBadge } from '@/components/ui/badge'; -import { Button } from '@/components/ui/button'; -import { - DropdownMenu, - DropdownMenuCheckboxItem, - DropdownMenuContent, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; -import type { FormSubmissionsSearchParams } from '../../models/search-params'; -import { Route } from '@/routes/responses'; -import { useMonitoringObserversTags } from '@/hooks/tags-queries'; -import { ResetFiltersButton } from '../ResetFiltersButton/ResetFiltersButton'; -import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; -import { useCurrentElectionRoundStore } from '@/context/election-round.store'; - +import { type FunctionComponent } from '@/common/types'; +import { FilteringContainer } from '@/features/filtering/components/FilteringContainer'; +import { MonitoringObserverTagsSelect } from '@/features/monitoring-observers/filtering/MonitoringObserverTagsSelect'; +import { FormSubmissionsFlaggedAnswersSelect } from '../../filtering/FormSubmissionsFlaggedAnswersSelect'; +import { FormSubmissionsFollowUpSelect } from '../../filtering/FormSubmissionsFollowUpSelect'; export function FormsFiltersByObserver(): FunctionComponent { - const navigate = useNavigate({ from: '/responses/' }); - const search = Route.useSearch(); - const currentElectionRoundId = useCurrentElectionRoundStore(s => s.currentElectionRoundId); - - const { data: tags } = useMonitoringObserversTags(currentElectionRoundId); - - const onTagsFilterChange = useCallback( - (tag: string) => () => { - void navigate({ - // @ts-ignore - search: (prev: FormSubmissionsSearchParams) => { - const prevTagsFilter = prev.tagsFilter ?? []; - const newTags = prevTagsFilter.includes(tag) - ? prevTagsFilter.filter((t) => t !== tag) - : [...prevTagsFilter, tag]; - - return { ...prev, tagsFilter: newTags.length > 0 ? newTags : undefined }; - }, - }); - }, - [navigate] - ); - - const onFollowUpFilterChange = useCallback((followUpStatus: string) => { - void navigate({ - // @ts-ignore - search: (prev: FormSubmissionsSearchParams) => { - return { ...prev, followUpStatus: followUpStatus !== 'ALL' ? followUpStatus : undefined }; - }, - }); - }, - [navigate] - ); - - const isFiltered = Object.keys(search).some((key) => key !== 'tab' && key !== 'viewBy'); - return ( - <> - - - - - - - - - {tags?.map((tag) => ( - - {tag} - - ))} - - - - - - {isFiltered && ( -
- {search.followUpStatus && - onFollowUpFilterChange('ALL')} /> - } - {search.tagsFilter?.map((tag) => ( - - ))} -
- )} - + + + + + ); } diff --git a/web/src/features/responses/components/FormsTableByObserver/FormsTableByObserver.tsx b/web/src/features/responses/components/FormsTableByObserver/FormsTableByObserver.tsx index b1bff8137..adcd55101 100644 --- a/web/src/features/responses/components/FormsTableByObserver/FormsTableByObserver.tsx +++ b/web/src/features/responses/components/FormsTableByObserver/FormsTableByObserver.tsx @@ -1,14 +1,14 @@ -import { getRouteApi } from '@tanstack/react-router'; -import { useDebounce } from '@uidotdev/usehooks'; -import { useCallback, useMemo } from 'react'; import type { FunctionComponent } from '@/common/types'; import { CardContent } from '@/components/ui/card'; import { QueryParamsDataTable } from '@/components/ui/DataTable/QueryParamsDataTable'; +import { useCurrentElectionRoundStore } from '@/context/election-round.store'; +import { getRouteApi } from '@tanstack/react-router'; +import { useDebounce } from '@uidotdev/usehooks'; +import { useCallback, useMemo } from 'react'; import { useFormSubmissionsByObserver } from '../../hooks/form-submissions-queries'; import type { FormSubmissionsSearchParams } from '../../models/search-params'; import { useFormSubmissionsByObserverColumns } from '../../store/column-visibility'; import { formSubmissionsByObserverColumnDefs } from '../../utils/column-defs'; -import { useCurrentElectionRoundStore } from '@/context/election-round.store'; const routeApi = getRouteApi('/responses/'); @@ -20,7 +20,7 @@ export function FormsTableByObserver({ searchText }: FormsTableByObserverProps): const navigate = routeApi.useNavigate(); const search = routeApi.useSearch(); const debouncedSearch = useDebounce(search, 300); - const currentElectionRoundId = useCurrentElectionRoundStore(s => s.currentElectionRoundId); + const currentElectionRoundId = useCurrentElectionRoundStore((s) => s.currentElectionRoundId); const columnsVisibility = useFormSubmissionsByObserverColumns(); const queryParams = useMemo(() => { @@ -28,6 +28,7 @@ export function FormsTableByObserver({ searchText }: FormsTableByObserverProps): ['followUpStatus', debouncedSearch.followUpStatus], ['searchText', searchText], ['tagsFilter', debouncedSearch.tagsFilter], + ['hasFlaggedAnswers', debouncedSearch.hasFlaggedAnswers], ].filter(([_, value]) => value); return Object.fromEntries(params) as FormSubmissionsSearchParams; diff --git a/web/src/features/responses/filtering/FormSubmissionsFlaggedAnswersSelect.tsx b/web/src/features/responses/filtering/FormSubmissionsFlaggedAnswersSelect.tsx new file mode 100644 index 000000000..4007c4e36 --- /dev/null +++ b/web/src/features/responses/filtering/FormSubmissionsFlaggedAnswersSelect.tsx @@ -0,0 +1,20 @@ +import { BinarySelectFilter } from '@/features/filtering/components/SelectFilter'; +import { FILTER_KEY } from '@/features/filtering/filtering-enums'; +import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; +import { FC } from 'react'; + +export const FormSubmissionsFlaggedAnswersSelect: FC = () => { + const { queryParams, navigateHandler } = useFilteringContainer(); + + const onChange = (value: string) => { + navigateHandler({ [FILTER_KEY.HasFlaggedAnswers]: value }); + }; + + return ( + + ); +}; diff --git a/web/src/features/responses/filtering/FormSubmissionsFollowUpSelect.tsx b/web/src/features/responses/filtering/FormSubmissionsFollowUpSelect.tsx new file mode 100644 index 000000000..86a981e96 --- /dev/null +++ b/web/src/features/responses/filtering/FormSubmissionsFollowUpSelect.tsx @@ -0,0 +1,37 @@ +import { FollowUpStatus } from '@/common/types'; +import { SelectFilter, SelectFilterOption } from '@/features/filtering/components/SelectFilter'; +import { FILTER_KEY } from '@/features/filtering/filtering-enums'; +import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; +import { FC } from 'react'; + +export const FormSubmissionsFollowUpSelect: FC = () => { + const { queryParams, navigateHandler } = useFilteringContainer(); + + const onChange = (value: string) => { + navigateHandler({ [FILTER_KEY.FollowUpStatus]: value }); + }; + const options: SelectFilterOption[] = [ + { + value: FollowUpStatus.NotApplicable, + label: 'Not applicable', + }, + + { + value: FollowUpStatus.NeedsFollowUp, + label: 'Needs follow up', + }, + { + value: FollowUpStatus.Resolved, + label: 'Resolved', + }, + ]; + + return ( + + ); +}; diff --git a/web/src/features/responses/filtering/FormSubmissionsMediaFilesSelect.tsx b/web/src/features/responses/filtering/FormSubmissionsMediaFilesSelect.tsx new file mode 100644 index 000000000..7e1730429 --- /dev/null +++ b/web/src/features/responses/filtering/FormSubmissionsMediaFilesSelect.tsx @@ -0,0 +1,20 @@ +import { BinarySelectFilter } from '@/features/filtering/components/SelectFilter'; +import { FILTER_KEY } from '@/features/filtering/filtering-enums'; +import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; +import { FC } from 'react'; + +export const FormSubmissionsMediaFilesSelect: FC = () => { + const { queryParams, navigateHandler } = useFilteringContainer(); + + const onChange = (value: string) => { + navigateHandler({ [FILTER_KEY.MediaFiles]: value }); + }; + + return ( + + ); +}; diff --git a/web/src/features/responses/filtering/FormSubmissionsQuestionNotesSelect.tsx b/web/src/features/responses/filtering/FormSubmissionsQuestionNotesSelect.tsx new file mode 100644 index 000000000..1a29455a6 --- /dev/null +++ b/web/src/features/responses/filtering/FormSubmissionsQuestionNotesSelect.tsx @@ -0,0 +1,20 @@ +import { BinarySelectFilter } from '@/features/filtering/components/SelectFilter'; +import { FILTER_KEY } from '@/features/filtering/filtering-enums'; +import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; +import { FC } from 'react'; + +export const FormSubmissionsQuestionNotesSelect: FC = () => { + const { queryParams, navigateHandler } = useFilteringContainer(); + + const onChange = (value: string) => { + navigateHandler({ [FILTER_KEY.HasNotes]: value }); + }; + + return ( + + ); +}; diff --git a/web/src/features/responses/filtering/FormSubmissionsQuestionsAnsweredSelect.tsx b/web/src/features/responses/filtering/FormSubmissionsQuestionsAnsweredSelect.tsx new file mode 100644 index 000000000..67d38b56c --- /dev/null +++ b/web/src/features/responses/filtering/FormSubmissionsQuestionsAnsweredSelect.tsx @@ -0,0 +1,37 @@ +import { QuestionsAnswered } from '@/common/types'; +import { SelectFilter, SelectFilterOption } from '@/features/filtering/components/SelectFilter'; +import { FILTER_KEY } from '@/features/filtering/filtering-enums'; +import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; +import { FC } from 'react'; + +export const FormSubmissionsQuestiosAnsweredSelect: FC = () => { + const { queryParams, navigateHandler } = useFilteringContainer(); + + const onChange = (value: string) => { + navigateHandler({ [FILTER_KEY.QuestionsAnswered]: value }); + }; + const options: SelectFilterOption[] = [ + { + value: QuestionsAnswered.None, + label: QuestionsAnswered.None, + }, + + { + value: QuestionsAnswered.Some, + label: QuestionsAnswered.Some, + }, + { + value: QuestionsAnswered.All, + label: QuestionsAnswered.All, + }, + ]; + + return ( + + ); +}; diff --git a/web/src/features/responses/filtering/FormSubmissionsTypeSelect.tsx b/web/src/features/responses/filtering/FormSubmissionsTypeSelect.tsx new file mode 100644 index 000000000..dc9cf9bce --- /dev/null +++ b/web/src/features/responses/filtering/FormSubmissionsTypeSelect.tsx @@ -0,0 +1,49 @@ +import { ZFormType } from '@/common/types'; +import { SelectFilter, SelectFilterOption } from '@/features/filtering/components/SelectFilter'; +import { FILTER_KEY } from '@/features/filtering/filtering-enums'; +import { useFilteringContainer } from '@/features/filtering/hooks/useFilteringContainer'; +import { mapFormType } from '@/lib/utils'; +import { FC } from 'react'; + +export const FormSubmissionsTypeSelect: FC = () => { + const { queryParams, navigateHandler } = useFilteringContainer(); + + const onChange = (value: string) => { + navigateHandler({ [FILTER_KEY.FormTypeFilter]: value }); + }; + const options: SelectFilterOption[] = [ + { + value: ZFormType.Values.Opening, + label: mapFormType(ZFormType.Values.Opening), + }, + + { + value: ZFormType.Values.Voting, + label: mapFormType(ZFormType.Values.Voting), + }, + + { + value: ZFormType.Values.ClosingAndCounting, + label: mapFormType(ZFormType.Values.ClosingAndCounting), + }, + + { + value: ZFormType.Values.PSI, + label: mapFormType(ZFormType.Values.PSI), + }, + + { + value: ZFormType.Values.Other, + label: mapFormType(ZFormType.Values.Other), + }, + ]; + + return ( + + ); +}; diff --git a/web/src/features/responses/utils/column-defs.tsx b/web/src/features/responses/utils/column-defs.tsx index 3c2a47e39..d3d1907c2 100644 --- a/web/src/features/responses/utils/column-defs.tsx +++ b/web/src/features/responses/utils/column-defs.tsx @@ -52,14 +52,6 @@ export const formSubmissionsByEntryColumnDefs: ColumnDef , - accessorKey: 'formDefaultLanguage', - enableSorting: true, - enableGlobalFilter: true, - }, - { header: ({ column }) => , accessorKey: 'number', diff --git a/web/src/features/responses/utils/column-visibility-options.tsx b/web/src/features/responses/utils/column-visibility-options.tsx index a9b9854bb..263fbbbe9 100644 --- a/web/src/features/responses/utils/column-visibility-options.tsx +++ b/web/src/features/responses/utils/column-visibility-options.tsx @@ -72,7 +72,6 @@ const byEntryColumnVisibilityOptions: ColumnOption[] = [ { id: 'submissionId', label: 'Entry ID', enableHiding: true }, { id: 'timeSubmitted', label: 'Time submitted', enableHiding: true }, { id: 'formCode', label: 'Form code', enableHiding: true }, - { id: 'formDefaultLanguage', label: 'Language', enableHiding: true }, { id: 'formType', label: 'Form type', enableHiding: true }, { id: 'level1', label: 'Location - L1', enableHiding: true }, { id: 'level2', label: 'Location - L2', enableHiding: true }, diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 46f4ee841..69d24e434 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -105,7 +105,7 @@ "opening": "Opening", "voting": "Voting", "closingAndCounting": "Closing And Counting", - "psi": "Closing And Counting", + "psi": "PSI", "other": "Other", "citizenReporting": "Citizen reporting" }, @@ -183,12 +183,11 @@ "uploadedOn": "Uploaded on", "createdBy": "Created by" }, - "textGuide":"Text guide", - "urlGuide":"Url guide", - "documentGuide":"Attachment guide", + "textGuide": "Text guide", + "urlGuide": "Url guide", + "documentGuide": "Attachment guide", "buttonUploadCitizenGuide": "Upload citizen guide", "buttonUploadObserverGuide": "Upload observer guide" - }, "observerForms": { "tabTitle": "Observer Forms", @@ -229,4 +228,4 @@ "goToLastPage": "Go to last page" } } -} +} \ No newline at end of file