You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
1.7 KiB

  1. //src\components\LateStartReportGen\LateStartReportGen.tsx
  2. "use client";
  3. import React, { useMemo, useState } from "react";
  4. import SearchBox, { Criterion } from "../../ReportSearchBox";
  5. import { useTranslation } from "react-i18next";
  6. import { LateStart } from "@/app/api/report";
  7. //import { DownloadReportButton } from './DownloadReportButton';
  8. import axios from 'axios';
  9. import { apiPath } from '../../../auth/utils';
  10. //import { GET_QC_CATEGORY_COMBO } from 'utils/ApiPathConst';
  11. interface Props {
  12. projects: LateStart[];
  13. }
  14. type SearchQuery = Partial<Omit<LateStart, "id">>;
  15. type SearchParamNames = keyof SearchQuery;
  16. const ProgressByClientSearch: React.FC<Props> = ({ projects }) => {
  17. const { t } = useTranslation("projects");
  18. // const [teamCombo, setteamCombo] = useState([]);
  19. // const getteamCombo = () => {
  20. // axios.get(`${apiPath}${GET_QC_CATEGORY_COMBO}`)
  21. // .then(response => {
  22. // setteamCombo(response.data.records)})
  23. // .catch(error => {
  24. // console.error('Error fetching data: ', error);
  25. // });
  26. // }
  27. const searchCriteria: Criterion<SearchParamNames>[] = useMemo(
  28. () => [
  29. { label: "Team", paramName: "team", type: "select", options: ["AAA", "BBB", "CCC"] },
  30. { label: "Client", paramName: "client", type: "select", options: ["Cust A", "Cust B", "Cust C"] },
  31. {
  32. label: "Remained Date From",
  33. label2: "Remained Date To",
  34. paramName: "targetEndDate",
  35. type: "dateRange",
  36. },
  37. ],
  38. [t],
  39. );
  40. return (
  41. <>
  42. <SearchBox
  43. criteria={searchCriteria}
  44. onSearch={(query) => {
  45. console.log(query);
  46. }}
  47. />
  48. {/* <DownloadReportButton /> */}
  49. </>
  50. );
  51. };
  52. export default ProgressByClientSearch;