Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission filter bugs fixed #1793

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions forms-flow-web/src/components/Application/ApplicationFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const ApplicationFilter = ({
(state) => state.applications.applicationStatus
);
const { t } = useTranslation();

const [isSearchParamEntered, setSearchParamEntered] = useState(false);

const handleClick = (e) => {
if (createSearchNode?.current?.contains(e.target)) {
return;
Expand All @@ -46,10 +49,19 @@ const ApplicationFilter = ({
}, []);

const handleChange = (key, value) => {
setSearchParams((prevParams) => ({
...prevParams,
[key]: value,
}));
setSearchParams((prevParams) => {
const updatedParams = {
...prevParams,
[key]: value,
};

const isAnyParamEntered = Object.values(updatedParams).some(
(param) => param !== '' && param !== null
);

setSearchParamEntered(isAnyParamEntered);
return updatedParams;
});
};

const clearAllFilters = () => {
Expand All @@ -69,9 +81,9 @@ const ApplicationFilter = ({
})
);
setFilterParams({ id: "",
applicationName: "",
applicationStatus: "",
modified: null,});
applicationName: "",
applicationStatus: "",
modified: null,});
closeFilterModal();
};

Expand All @@ -90,7 +102,7 @@ const ApplicationFilter = ({
return selectOptions;
};


return (
<div
className="Filter-listview "
Expand All @@ -101,7 +113,7 @@ const ApplicationFilter = ({
<div className="m-4 px-2">
<Row className="mt-2">
<Col>
<label htmlFor="idInput">{t("Id")}</label>
<label htmlFor="idInput">{t("Id")}</label>
<input
id="idInput"
className="form-control"
Expand All @@ -111,7 +123,7 @@ const ApplicationFilter = ({
/>
</Col>
<Col>
<label htmlFor="applicationNameInput">{t("Form Title")}</label>
<label htmlFor="applicationNameInput">{t("Form Title")}</label>
<input
id="applicationNameInput"
className="form-control"
Expand All @@ -126,14 +138,14 @@ const ApplicationFilter = ({
<div className="m-4 px-2">
<Row className="mt-2">
<Col>
<label htmlFor="applicationStatus">{t("Status")}</label>
<label htmlFor="applicationStatus">{t("Status")}</label>
<select
id="applicationStatus"
value={searchParams.applicationStatus}
onChange={(e) => handleChange("applicationStatus", e.target.value)}
className="form-control p-1"
>
<option value=""></option>
<option value="">{t("Select a status")}</option>
{getApplicationStatusOptions(applicationStatusOptions).map(
(option) => (
<option key={option.value} value={option.value}>
Expand Down Expand Up @@ -167,7 +179,7 @@ const ApplicationFilter = ({
</Row>
</div>
<hr className="mx-4" />
<Row className="m-3 filter-cancel-btn-container ">
<Row className="m-3 filter-cancel-btn-container ">
<Col className="px-0 text-left">
<button
className="btn btn-link text-danger"
Expand All @@ -183,7 +195,11 @@ const ApplicationFilter = ({
>
{t("Cancel")}
</button>
<button className="btn btn-dark" onClick={applyFilters}>
<button
className="btn btn-dark"
onClick={applyFilters}
disabled={!isSearchParamEntered}
>
{t("Show results")}
</button>
</Col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ export default function CreateNewFilterDrawer({
<div className="m-2">
<h5 className="font-weight-bold ">
<Translation>{(t) => t("Task Attributes")}</Translation>{" "}
<i title={t("This section is aimed to set select task attributes that will be visible in the task list view.")} className="fa fa-info-circle"></i>
<i title={t("This section is aimed to set select task attributes that will be visible in the task list view")} className="fa fa-info-circle"></i>
</h5>
<input
readOnly
Expand Down
Loading