diff --git a/frontend/src/components/FilterPanel.jsx b/frontend/src/components/FilterPanel.jsx index 9e9d9df128..c6dacefab8 100644 --- a/frontend/src/components/FilterPanel.jsx +++ b/frontend/src/components/FilterPanel.jsx @@ -146,40 +146,48 @@ export default function FilterPanel({ }} > {safeSchemas.map((schema, index) => { - return ( -
{ - setClicked(schema.id); - handleClick(schema.id); - }} - > - - - {" "} - {" "} - -
- ); + onClick={() => { + setClicked(schema.id); + handleClick(schema.id); + }} + > + + + {" "} + {" "} + + + ); + } else { + return ( +
+ {schema.id} +
+ ); + } })}
- + {schema.FilterComponent ? ( + + ) : ( +
+

{schema.id}

+
+ )}
); })} diff --git a/frontend/src/components/filterFields/ApplyQueryFilter.jsx b/frontend/src/components/filterFields/ApplyQueryFilter.jsx index 5dc0ad97f7..2b4e9b0f0a 100644 --- a/frontend/src/components/filterFields/ApplyQueryFilter.jsx +++ b/frontend/src/components/filterFields/ApplyQueryFilter.jsx @@ -10,9 +10,9 @@ export default function ApplyQueryFilter() { const [queryId, setQueryId] = React.useState(""); return (
-

+

-

+ {/* */} diff --git a/frontend/src/components/filterFields/BiologicalSamplesAndAnalysesFilter.jsx b/frontend/src/components/filterFields/BiologicalSamplesAndAnalysesFilter.jsx index a22516bbd2..65056c2c27 100644 --- a/frontend/src/components/filterFields/BiologicalSamplesAndAnalysesFilter.jsx +++ b/frontend/src/components/filterFields/BiologicalSamplesAndAnalysesFilter.jsx @@ -111,9 +111,9 @@ export default function BiologicalSamplesAndAnalysesFilter({ onChange, data }) { return (
-

+

-

+ diff --git a/frontend/src/components/filterFields/DateFilter.jsx b/frontend/src/components/filterFields/DateFilter.jsx index b2c0e7f18c..2015f48950 100644 --- a/frontend/src/components/filterFields/DateFilter.jsx +++ b/frontend/src/components/filterFields/DateFilter.jsx @@ -86,9 +86,9 @@ export default function DateFilter({ onChange, data }) { return (
-

+

-

+ diff --git a/frontend/src/components/filterFields/IdentityFilter.jsx b/frontend/src/components/filterFields/IdentityFilter.jsx index ac8b06d15d..c5c1deefad 100644 --- a/frontend/src/components/filterFields/IdentityFilter.jsx +++ b/frontend/src/components/filterFields/IdentityFilter.jsx @@ -15,9 +15,9 @@ export default function IdentityFilter({ onChange }) { return (
-

+

-

+ diff --git a/frontend/src/components/filterFields/ImageLabelFilter.jsx b/frontend/src/components/filterFields/ImageLabelFilter.jsx index c8e5983f99..4b122faa99 100644 --- a/frontend/src/components/filterFields/ImageLabelFilter.jsx +++ b/frontend/src/components/filterFields/ImageLabelFilter.jsx @@ -58,9 +58,9 @@ export default function ImageLabelFilter({ data, onChange }) { return (
-

+

-

+ diff --git a/frontend/src/components/filterFields/LocationFilterMap.jsx b/frontend/src/components/filterFields/LocationFilterMap.jsx index da5df4151b..5f0d398e0f 100644 --- a/frontend/src/components/filterFields/LocationFilterMap.jsx +++ b/frontend/src/components/filterFields/LocationFilterMap.jsx @@ -74,9 +74,9 @@ export default function LocationFilterMap({ onChange, data }) { return (
-

+

-

+ diff --git a/frontend/src/components/filterFields/MetadataFilter.jsx b/frontend/src/components/filterFields/MetadataFilter.jsx index 541e902b31..06205c557d 100644 --- a/frontend/src/components/filterFields/MetadataFilter.jsx +++ b/frontend/src/components/filterFields/MetadataFilter.jsx @@ -1,52 +1,54 @@ - import React from "react"; import Description from "../Form/Description"; import { FormattedMessage } from "react-intl"; import FormGroupMultiSelect from "../Form/FormGroupMultiSelect"; import FormGroupText from "../Form/FormGroupText"; - export default function MetadataFilter({ data, onChange, setFormFilters, - formFilters + formFilters, }) { - const encounterStatusOptions = data?.encounterState?.map((item) => { - return { - value: item, - label: item - }; - } - ) || []; + const encounterStatusOptions = + data?.encounterState?.map((item) => { + return { + value: item, + label: item, + }; + }) || []; - const organizationOptions = Object.entries(data?.organizations || {})?.map((item) => { - return { - value: item[0], - label: item[1] - }; - } - ) || []; + const organizationOptions = + Object.entries(data?.organizations || {})?.map((item) => { + return { + value: item[0], + label: item[1], + }; + }) || []; - const projectOptions = Object.entries(data?.projectsForUser || {})?.map((item) => { - return { - value: item[0], - label: item[1] - }; - } - ) || []; + const projectOptions = + Object.entries(data?.projectsForUser || {})?.map((item) => { + return { + value: item[0], + label: item[1], + }; + }) || []; - const assignedUserOptions = (data?.users?.filter(item => item.username).map((item) => { - return { - value: item.username, - label: item.username - }; - })) || []; - + const assignedUserOptions = + data?.users + ?.filter((item) => item.username) + .map((item) => { + return { + value: item.username, + label: item.username, + }; + }) || []; return (
-

+

+ +

@@ -109,7 +111,5 @@ export default function MetadataFilter({ filterKey={"Assigned User"} />
- - ); -} \ No newline at end of file +} diff --git a/frontend/src/components/filterFields/ObservationAttributeFilter.jsx b/frontend/src/components/filterFields/ObservationAttributeFilter.jsx index ad852cd2c1..51b3b13c5b 100644 --- a/frontend/src/components/filterFields/ObservationAttributeFilter.jsx +++ b/frontend/src/components/filterFields/ObservationAttributeFilter.jsx @@ -58,9 +58,9 @@ export default function ObservationAttributeFilter({ onChange, data }) { overflow: "visible", }} > -

+

-

+ diff --git a/frontend/src/components/filterFields/SocialFilter.jsx b/frontend/src/components/filterFields/SocialFilter.jsx index 9bfc8db1a0..83922db9ea 100644 --- a/frontend/src/components/filterFields/SocialFilter.jsx +++ b/frontend/src/components/filterFields/SocialFilter.jsx @@ -26,9 +26,9 @@ export default function SocialFilter({ data, onChange }) { return (
-

+

-

+ diff --git a/frontend/src/components/filterFields/TagsFilter.jsx b/frontend/src/components/filterFields/TagsFilter.jsx index 7b0279b426..dfcd19531e 100644 --- a/frontend/src/components/filterFields/TagsFilter.jsx +++ b/frontend/src/components/filterFields/TagsFilter.jsx @@ -16,9 +16,9 @@ export default function TagsFilter({ data, onChange }) { const intl = useIntl(); return (
-

+

-

+ diff --git a/frontend/src/models/encounters/useEncounterSearchSchemas.js b/frontend/src/models/encounters/useEncounterSearchSchemas.js index 49aadec782..1984ea5831 100644 --- a/frontend/src/models/encounters/useEncounterSearchSchemas.js +++ b/frontend/src/models/encounters/useEncounterSearchSchemas.js @@ -1,70 +1,100 @@ -import LocationFilter from '../../components/filterFields/LocationFilter'; -import DateFilter from '../../components/filterFields/DateFilter'; -import ObservationAttributeFilter from '../../components/filterFields/ObservationAttributeFilter'; -import ImageLabelFilter from '../../components/filterFields/ImageLabelFilter'; -import IdentityFilter from '../../components/filterFields/IdentityFilter'; -import TagsFilter from '../../components/filterFields/TagsFilter'; -import SocialFilter from '../../components/filterFields/SocialFilter'; -import MetadataFilter from '../../components/filterFields/MetadataFilter'; -import ApplyQueryFilter from '../../components/filterFields/ApplyQueryFilter'; +import LocationFilter from "../../components/filterFields/LocationFilter"; +import DateFilter from "../../components/filterFields/DateFilter"; +import ObservationAttributeFilter from "../../components/filterFields/ObservationAttributeFilter"; +import ImageLabelFilter from "../../components/filterFields/ImageLabelFilter"; +import IdentityFilter from "../../components/filterFields/IdentityFilter"; +import TagsFilter from "../../components/filterFields/TagsFilter"; +import SocialFilter from "../../components/filterFields/SocialFilter"; +import MetadataFilter from "../../components/filterFields/MetadataFilter"; +import ApplyQueryFilter from "../../components/filterFields/ApplyQueryFilter"; -import BiologicalSamplesAndAnalysesFilter from '../../components/filterFields/BiologicalSamplesAndAnalysesFilter'; +import BiologicalSamplesAndAnalysesFilter from "../../components/filterFields/BiologicalSamplesAndAnalysesFilter"; export default function useEncounterSearchSchemas() { - - return [ - { - id: 'location', - labelId: 'FILTER_LOCATION', + id: "Encounters", + labelId: "FILTER_ENCOUNTER", + }, + { + id: "location", + labelId: "FILTER_LOCATION", FilterComponent: LocationFilter, }, { - id: 'date', - labelId: 'FILTER_DATE', + id: "date", + labelId: "FILTER_DATE", FilterComponent: DateFilter, }, { - id: 'observation', - labelId: 'FILTER_OBSERVATION_ATTRIBUTE', + id: "observation", + labelId: "FILTER_OBSERVATION_ATTRIBUTE", FilterComponent: ObservationAttributeFilter, }, { - id: 'imageLabel', - labelId: 'FILTER_IMAGE_LABEL', + id: "imageLabel", + labelId: "FILTER_IMAGE_LABEL", FilterComponent: ImageLabelFilter, }, + { - id: 'identity', - labelId: 'FILTER_IDENTITY', - FilterComponent: IdentityFilter, - }, - { - id: 'tags', - labelId: 'FILTER_TAGS', + id: "tags", + labelId: "FILTER_TAGS", FilterComponent: TagsFilter, }, { - id: 'biologicalSample', - labelId: 'FILTER_BIOLOGICAL_SAMPLE', + id: "biologicalSample", + labelId: "FILTER_BIOLOGICAL_SAMPLE", FilterComponent: BiologicalSamplesAndAnalysesFilter, }, + + { + id: "metadata", + labelId: "FILTER_METADATA", + FilterComponent: MetadataFilter, + }, + { + id: "applySearchId", + labelId: "APPLY_SEARCH_ID", + FilterComponent: ApplyQueryFilter, + }, + { + id: "Sightings", + labelId: "FILTER_SIGHTINGS", + }, + { + id: "location", + labelId: "FILTER_LOCATION", + FilterComponent: LocationFilter, + }, { - id: 'social', - labelId: 'FILTER_SOCIAL', + id: "identity", + labelId: "FILTER_IDENTITY", + FilterComponent: IdentityFilter, + }, + { + id: "social", + labelId: "FILTER_SOCIAL", FilterComponent: SocialFilter, }, { - id: 'metadata', - labelId: 'FILTER_METADATA', - FilterComponent: MetadataFilter, + id: "observation", + labelId: "FILTER_OBSERVATION_ATTRIBUTE", + FilterComponent: ObservationAttributeFilter, }, { - id: 'applySearchId', - labelId: 'APPLY_SEARCH_ID', - FilterComponent: ApplyQueryFilter, + id: "Individuals", + labelId: "FILTER_INDIVIDUALS", + }, + { + id: "date", + labelId: "FILTER_DATE", + FilterComponent: DateFilter, + }, + { + id: "observation", + labelId: "FILTER_OBSERVATION_ATTRIBUTE", + FilterComponent: ObservationAttributeFilter, }, - ]; }