Skip to content

Commit

Permalink
new filters
Browse files Browse the repository at this point in the history
  • Loading branch information
erinz2020 committed Jan 23, 2025
1 parent 2b678d1 commit ef3f372
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from "react";
import Description from "../Form/Description";
import { FormattedMessage } from "react-intl";
import FormGroupMultiSelect from "../Form/FormGroupMultiSelect";
import FormGroupText from "../Form/FormGroupText";
import DynamicInputs from "../Form/DynamicInputs";
import { FormLabel, FormGroup } from "react-bootstrap";
import FormMeasurements from "../Form/FormMeasurements";

export default function ObservationAttributeFilter({ onChange, data }) {

const measurementsOptions = data?.measurement || [];

return (
<div
style={{
overflow: "visible",
}}
>
<h4>
<FormattedMessage id="FILTER_OBSERVATION_ATTRIBUTE" />
</h4>
<Description>
<FormattedMessage id="FILTER_OBSERVATION_ATTRIBUTE_DESC" />
</Description>

<FormGroupText
label="FILTER_SIGHTING_ID"
noDesc={true}
onChange={onChange}
term="match"
field="occurrenceId"
filterId={"occurrenceId"}
filterKey={"Sighting ID"}
/>

<FormGroupText
label="FILTER_SIGHTING_COMMENTS"
noDesc={true}
onChange={onChange}
term="match"
field="sightingcomments"
filterId={"sightingcomments"}
filterKey={"Sighting Comments"}
/>

<FormGroupText
label="FILTER_VISIBILIY_INDEX"
noDesc={true}
onChange={onChange}
term="match"
field="visibilityIndex"
filterId={"visibilityIndex"}
filterKey={"Visibility Index"}
/>

<FormGroupText
label="FILTER_OBSERVATION_COMMENTS"
onChange={onChange}
term="match"
field="occurrenceRemarks"
filterId={"occurrenceRemarks"}
filterKey={"Observation Comments"}
/>

<FormGroup className="mt-2">
<FormLabel>
<FormattedMessage id="FILTER_MEASUREMENTS" />
</FormLabel>
<FormMeasurements
data={measurementsOptions}
onChange={onChange}
filterId={"measurements"}
field={"measurements"}
/>
</FormGroup>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ export default function ObservationAttributeFilter({ onChange, data }) {
filterKey={"Genus and Species"}
/>

<FormGroupText
{/* <FormGroupText
label="FILTER_SIGHTING_ID"
noDesc={true}
onChange={onChange}
term="match"
field="occurrenceId"
filterId={"occurrenceId"}
filterKey={"Sighting ID"}
/>
/> */}

<FormGroup className="mt-2">
<FormLabel>
Expand All @@ -125,14 +125,14 @@ export default function ObservationAttributeFilter({ onChange, data }) {

<DynamicInputs onChange={onChange} />
</FormGroup>
<FormGroupText
{/* <FormGroupText
label="FILTER_OBSERVATION_COMMENTS"
onChange={onChange}
term="match"
field="occurrenceRemarks"
filterId={"occurrenceRemarks"}
filterKey={"Observation Comments"}
/>
/> */}

<FormGroupMultiSelect
isMulti={true}
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/filterFields/SightingsLocationFilter.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import LocationFilterMap from "./LocationFilterMap";
import LocationFilterText from "./LocationFilterText";

export default function LocationFilter({ onChange, data }) {
return (
<div>
<LocationFilterMap onChange={onChange} data={data} />
<LocationFilterText onChange={onChange} />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from "react";
import Description from "../Form/Description";
import { FormattedMessage } from "react-intl";
import FormGroupMultiSelect from "../Form/FormGroupMultiSelect";
import FormGroupText from "../Form/FormGroupText";
import DynamicInputs from "../Form/DynamicInputs";
import { FormLabel, FormGroup } from "react-bootstrap";
import FormMeasurements from "../Form/FormMeasurements";

export default function ObservationAttributeFilter({ onChange, data }) {

const measurementsOptions = data?.measurement || [];

return (
<div
style={{
overflow: "visible",
}}
>
<h4>
<FormattedMessage id="FILTER_OBSERVATION_ATTRIBUTE" />
</h4>
<Description>
<FormattedMessage id="FILTER_OBSERVATION_ATTRIBUTE_DESC" />
</Description>

<FormGroupText
label="FILTER_SIGHTING_ID"
noDesc={true}
onChange={onChange}
term="match"
field="occurrenceId"
filterId={"occurrenceId"}
filterKey={"Sighting ID"}
/>

<FormGroupText
label="FILTER_SIGHTING_COMMENTS"
noDesc={true}
onChange={onChange}
term="match"
field="sightingcomments"
filterId={"sightingcomments"}
filterKey={"Sighting Comments"}
/>

<FormGroupText
label="FILTER_VISIBILIY_INDEX"
noDesc={true}
onChange={onChange}
term="match"
field="visibilityIndex"
filterId={"visibilityIndex"}
filterKey={"Visibility Index"}
/>

<FormGroupText
label="FILTER_OBSERVATION_COMMENTS"
onChange={onChange}
term="match"
field="occurrenceRemarks"
filterId={"occurrenceRemarks"}
filterKey={"Observation Comments"}
/>

<FormGroup className="mt-2">
<FormLabel>
<FormattedMessage id="FILTER_MEASUREMENTS" />
</FormLabel>
<FormMeasurements
data={measurementsOptions}
onChange={onChange}
filterId={"measurements"}
field={"measurements"}
/>
</FormGroup>
</div>
);
}
18 changes: 10 additions & 8 deletions frontend/src/models/encounters/useEncounterSearchSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ 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 SightingsObservationAttributeFilter from "../../components/filterFields/SightingsObservationAttributeFilter";
import BiologicalSamplesAndAnalysesFilter from "../../components/filterFields/BiologicalSamplesAndAnalysesFilter";
import SightingsLocationFilter from "../../components/filterFields/SightingsLocationFilter";
import IndividualsObservationAttributeFilter from "../../components/filterFields/IndividualsObservationAttributeFilter";

export default function useEncounterSearchSchemas() {
return [
Expand Down Expand Up @@ -63,9 +65,9 @@ export default function useEncounterSearchSchemas() {
labelId: "FILTER_SIGHTINGS",
},
{
id: "location",
id: "sightingslocation",
labelId: "FILTER_LOCATION",
FilterComponent: LocationFilter,
FilterComponent: SightingsLocationFilter,
},
{
id: "identity",
Expand All @@ -78,23 +80,23 @@ export default function useEncounterSearchSchemas() {
FilterComponent: SocialFilter,
},
{
id: "observation",
id: "sightingsobservation",
labelId: "FILTER_OBSERVATION_ATTRIBUTE",
FilterComponent: ObservationAttributeFilter,
FilterComponent: SightingsObservationAttributeFilter,
},
{
id: "Individuals",
labelId: "FILTER_INDIVIDUALS",
},
{
id: "date",
id: "individualsdate",
labelId: "FILTER_DATE",
FilterComponent: DateFilter,
},
{
id: "observation",
id: "individualsobservation",
labelId: "FILTER_OBSERVATION_ATTRIBUTE",
FilterComponent: ObservationAttributeFilter,
FilterComponent: IndividualsObservationAttributeFilter,
},
];
}

0 comments on commit ef3f372

Please sign in to comment.