-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #992 from WildMeOrg/all_filters_encounter_search
All filters encounter search
- Loading branch information
Showing
25 changed files
with
876 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
frontend/src/components/filterFields/IndividualDateFilter.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React, { useState } from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
import Description from "../Form/Description"; | ||
import { FormGroup, FormControl } from "react-bootstrap"; | ||
|
||
export default function IndividualDateFilter({ onChange }) { | ||
const [birthDate, setBirthDate] = useState(""); | ||
const [deathDate, setDeathDate] = useState(""); | ||
|
||
return ( | ||
<div> | ||
<h4> | ||
<FormattedMessage id="FILTER_DATE" /> | ||
</h4> | ||
<Description> | ||
<FormattedMessage id="FILTER_DATE_DESC" /> | ||
</Description> | ||
<> | ||
<FormGroup className="w-100" style={{ marginRight: "10px" }}> | ||
<p> | ||
<FormattedMessage id="FILTER_BIRTH" defaultMessage="Birth" /> | ||
</p> | ||
<FormControl | ||
type="date" | ||
value={birthDate} | ||
onChange={(e) => { | ||
setBirthDate(e.target.value); | ||
onChange({ | ||
filterId: "individualTimeOfBirth", | ||
filterKey: "Birth Date", | ||
clause: "filter", | ||
query: { | ||
range: { | ||
individualTimeOfBirth: { | ||
gte: `${e.target.value}T00:00:00.000Z`, | ||
lte: `${e.target.value}T23:59:59.000Z`, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}} | ||
/> | ||
</FormGroup> | ||
<FormGroup className="w-100" style={{ marginRight: "10px" }}> | ||
<p> | ||
<FormattedMessage id="FILTER_DEATH" defaultMessage="Death" /> | ||
</p> | ||
<FormControl | ||
type="date" | ||
value={deathDate} | ||
onChange={(e) => { | ||
setDeathDate(e.target.value); | ||
onChange({ | ||
filterId: "individualTimeOfDeath", | ||
filterKey: "Death Date", | ||
clause: "filter", | ||
query: { | ||
range: { | ||
individualTimeOfDeath: { | ||
gte: `${e.target.value}T00:00:00.000Z`, | ||
lte: `${e.target.value}T23:59:59.000Z`, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}} | ||
/> | ||
</FormGroup> | ||
</> | ||
</div> | ||
); | ||
} |
45 changes: 45 additions & 0 deletions
45
frontend/src/components/filterFields/IndividualEstimateFilter.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
import Description from "../Form/Description"; | ||
import FormGroupText from "../Form/FormGroupText"; | ||
|
||
export default function IndividualEstimateFilter({ onChange }) { | ||
return ( | ||
<div> | ||
<h4> | ||
<FormattedMessage id="FILTER_INDIVIDUAL_ESTIMATE" /> | ||
</h4> | ||
<Description> | ||
<FormattedMessage id="FILTER_INDIVIDUAL_ESTIMATE_DESC" /> | ||
</Description> | ||
|
||
<FormGroupText | ||
label="FILTER_BEST_ESTIMATE_INDIVIDUALS" | ||
noDesc={true} | ||
field={"occurrenceBestGroupSizeEstimate"} | ||
term={"match"} | ||
filterId={"occurrenceBestGroupSizeEstimate"} | ||
onChange={onChange} | ||
filterKey={"Best Estimate Individuals"} | ||
/> | ||
<FormGroupText | ||
label="FILTER_MINIMUM_ESTIMATE_INDIVIDUALS" | ||
noDesc={true} | ||
field={"occurrenceMinGroupSizeEstimate"} | ||
term={"match"} | ||
filterId={"occurrenceMinGroupSizeEstimate"} | ||
onChange={onChange} | ||
filterKey={"Minimum Estimate Individuals"} | ||
/> | ||
<FormGroupText | ||
label="FILTER_MAXIMUM_ESTIMATE_INDIVIDUALS" | ||
noDesc={true} | ||
field={"occurrenceMaxGroupSizeEstimate"} | ||
term={"match"} | ||
filterId={"occurrenceMaxGroupSizeEstimate"} | ||
onChange={onChange} | ||
filterKey={"Maximum Estimate Individuals"} | ||
/> | ||
</div> | ||
); | ||
} |
58 changes: 58 additions & 0 deletions
58
frontend/src/components/filterFields/IndividualsObservationAttributeFilter.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from "react"; | ||
import Description from "../Form/Description"; | ||
import { FormattedMessage } from "react-intl"; | ||
import FormGroupMultiSelect from "../Form/FormGroupMultiSelect"; | ||
|
||
export default function ObservationAttributeFilter({ onChange, data }) { | ||
const sexOptions = | ||
data?.sex?.map((item) => { | ||
return { | ||
value: item, | ||
label: item, | ||
}; | ||
}) || []; | ||
|
||
const genusAndSpeciesOptions = | ||
data?.siteTaxonomies?.map((item) => { | ||
return { | ||
value: item?.scientificName, | ||
label: item?.scientificName, | ||
}; | ||
}) || []; | ||
|
||
return ( | ||
<div | ||
style={{ | ||
overflow: "visible", | ||
}} | ||
> | ||
<h4> | ||
<FormattedMessage id="FILTER_OBSERVATION_ATTRIBUTE" /> | ||
</h4> | ||
<Description> | ||
<FormattedMessage id="FILTER_OBSERVATION_ATTRIBUTE_DESC" /> | ||
</Description> | ||
<FormGroupMultiSelect | ||
isMulti={true} | ||
noDesc={true} | ||
label="FILTER_INDIVIDUAL_SEX" | ||
options={sexOptions} | ||
onChange={onChange} | ||
field="individualSex" | ||
term="terms" | ||
filterKey="individualSex" | ||
/> | ||
<FormGroupMultiSelect | ||
isMulti={true} | ||
label="FILTER_INDIVIDUAL_TAXONOMY" | ||
noDesc={true} | ||
options={genusAndSpeciesOptions} | ||
onChange={onChange} | ||
field="individualTaxonomy" | ||
term="terms" | ||
filterId={"individualTaxonomy"} | ||
filterKey={"Individual Taxonomy"} | ||
/> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.