|
|
@@ -15,6 +15,7 @@ import CardActions from "@mui/material/CardActions"; |
|
|
|
import Button from "@mui/material/Button"; |
|
|
|
import RestartAlt from "@mui/icons-material/RestartAlt"; |
|
|
|
import Search from "@mui/icons-material/Search"; |
|
|
|
import FileDownload from '@mui/icons-material/FileDownload'; |
|
|
|
import dayjs from "dayjs"; |
|
|
|
import "dayjs/locale/zh-hk"; |
|
|
|
import { DatePicker } from "@mui/x-date-pickers/DatePicker"; |
|
|
@@ -58,12 +59,14 @@ interface Props<T extends string> { |
|
|
|
criteria: Criterion<T>[]; |
|
|
|
onSearch: (inputs: Record<T, string>) => void; |
|
|
|
onReset?: () => void; |
|
|
|
formType?: String, |
|
|
|
} |
|
|
|
|
|
|
|
function SearchBox<T extends string>({ |
|
|
|
criteria, |
|
|
|
onSearch, |
|
|
|
onReset, |
|
|
|
formType, |
|
|
|
}: Props<T>) { |
|
|
|
const { t } = useTranslation("common"); |
|
|
|
const defaultInputs = useMemo( |
|
|
@@ -223,22 +226,22 @@ function SearchBox<T extends string>({ |
|
|
|
); |
|
|
|
})} |
|
|
|
</Grid> |
|
|
|
<CardActions sx={{ justifyContent: "flex-end" }}> |
|
|
|
<Button |
|
|
|
variant="text" |
|
|
|
startIcon={<RestartAlt />} |
|
|
|
onClick={handleReset} |
|
|
|
> |
|
|
|
{t("Reset")} |
|
|
|
</Button> |
|
|
|
<Button |
|
|
|
variant="outlined" |
|
|
|
startIcon={<Search />} |
|
|
|
onClick={handleSearch} |
|
|
|
> |
|
|
|
{t("Search")} |
|
|
|
</Button> |
|
|
|
</CardActions> |
|
|
|
<CardActions sx={{ justifyContent: "flex-end" }}> |
|
|
|
<Button |
|
|
|
variant="text" |
|
|
|
startIcon={<RestartAlt />} |
|
|
|
onClick={handleReset} |
|
|
|
> |
|
|
|
{t("Reset")} |
|
|
|
</Button> |
|
|
|
<Button |
|
|
|
variant="outlined" |
|
|
|
startIcon={(formType === "download" && <FileDownload />) || <Search />} |
|
|
|
onClick={handleSearch} |
|
|
|
> |
|
|
|
{(formType === "download" && t("Download")) || t("Search")} |
|
|
|
</Button> |
|
|
|
</CardActions> |
|
|
|
</CardContent> |
|
|
|
</Card> |
|
|
|
); |
|
|
|