Skip to content

Commit

Permalink
remove unneccessary filters
Browse files Browse the repository at this point in the history
  • Loading branch information
erinz2020 committed Jan 30, 2025
1 parent 4a1ad04 commit 90df0a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 89 deletions.
74 changes: 4 additions & 70 deletions frontend/src/components/filterFields/IndividualDateFilter.jsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,12 @@
import React, { useState, useEffect } from "react";
import React, { useState } from "react";
import { FormattedMessage } from "react-intl";
import Description from "../Form/Description";
import { FormLabel, FormGroup, FormControl } from "react-bootstrap";
import { FormGroup, FormControl } from "react-bootstrap";

export default function IndividualDateFilter({ onChange }) {
const [startDate, setStartDate] = useState("");
const [endDate, setEndDate] = useState("");
const [birthDate, setBirthDate] = useState("");
const [deathDate, setDeathDate] = useState("");

useEffect(() => {
updateQuery1("startDate", startDate);
}, [startDate]);
useEffect(() => {
updateQuery1("endDate", endDate);
}, [endDate]);

const updateQuery1 = () => {
if (startDate || endDate) {
const query = {
range: {
datematched: {},
},
};

if (startDate) {
query.range.datematched.gte = startDate + "T00:00:00Z";
}

if (endDate) {
query.range.datematched.lte = endDate + "T23:59:59Z";
}
onChange({
filterId: "datematched",
filterKey: "Date Matched",
clause: "filter",
query: query,
});
} else {
onChange(null, "date");
}
};

return (
<div>
<h4>
Expand Down Expand Up @@ -70,7 +35,7 @@ export default function IndividualDateFilter({ onChange }) {
gte: `${e.target.value}T00:00:00.000Z`,
lte: `${e.target.value}T23:59:59.000Z`,
},
}
},
},
});
}}
Expand All @@ -95,43 +60,12 @@ export default function IndividualDateFilter({ onChange }) {
gte: `${e.target.value}T00:00:00.000Z`,
lte: `${e.target.value}T23:59:59.000Z`,
},
}
},
},
});
}}
/>
</FormGroup>
{/* <FormLabel>
<FormattedMessage id="FILTER_DATE_MATCHED" />
</FormLabel>
<div className="d-flex flex-row w-100 mb-2">
<FormGroup className="w-50" style={{ marginRight: "10px" }}>
<p>
<FormattedMessage id="FILTER_FROM" defaultMessage="From" />
</p>
<FormControl
type="date"
value={startDate}
onChange={(e) => {
setStartDate(e.target.value);
updateQuery1();
}}
/>
</FormGroup>
<FormGroup className="w-50">
<p>
<FormattedMessage id="FILTER_TO" defaultMessage="To" />
</p>
<FormControl
type="date"
value={endDate}
onChange={(e) => {
setEndDate(e.target.value);
updateQuery1();
}}
/>
</FormGroup>
</div> */}
</>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ 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";
Expand Down Expand Up @@ -108,31 +107,13 @@ export default function ObservationAttributeFilter({ onChange, data }) {
filterKey={"Genus and Species"}
/>

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

<FormGroup className="mt-2">
<FormLabel>
<FormattedMessage id="FILTER_OBSERVATION_SEARCH" />
</FormLabel>

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

<FormGroupMultiSelect
isMulti={true}
Expand Down

0 comments on commit 90df0a4

Please sign in to comment.