From c51007715080491982eda06ebe24035b99191e5d Mon Sep 17 00:00:00 2001 From: "MSI\\2Fi" Date: Fri, 30 Aug 2024 14:22:16 +0800 Subject: [PATCH] Hide create invoice button --- src/components/InvoiceSearch/CreateInvoiceModal.tsx | 5 +++-- src/components/InvoiceSearch/InvoiceTable.tsx | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/InvoiceSearch/CreateInvoiceModal.tsx b/src/components/InvoiceSearch/CreateInvoiceModal.tsx index d552d5f..45339a5 100644 --- a/src/components/InvoiceSearch/CreateInvoiceModal.tsx +++ b/src/components/InvoiceSearch/CreateInvoiceModal.tsx @@ -56,8 +56,9 @@ const CreateInvoiceModal: React.FC = ({isOpen, onClose}) => { diff --git a/src/components/InvoiceSearch/InvoiceTable.tsx b/src/components/InvoiceSearch/InvoiceTable.tsx index 8294e50..2fe3122 100644 --- a/src/components/InvoiceSearch/InvoiceTable.tsx +++ b/src/components/InvoiceSearch/InvoiceTable.tsx @@ -21,6 +21,7 @@ import { GridToolbarContainer } from "@mui/x-data-grid"; import { FooterPropsOverrides } from "@mui/x-data-grid"; import { th } from "@faker-js/faker"; import { GridRowIdGetter } from "@mui/x-data-grid"; +import { useFormContext } from "react-hook-form"; type InvoiceListError = { [field in keyof invoiceList]?: string; @@ -53,6 +54,8 @@ const InvoiceTable: React.FC = () => { const { t } = useTranslation() const [rowModesModel, setRowModesModel] = useState({}); const [selectedRow, setSelectedRow] = useState([]); + const { getValues, setValue, clearErrors, setError } = + useFormContext(); const apiRef = useGridApiRef(); const validateInvoiceEntry = ( @@ -176,7 +179,8 @@ const InvoiceTable: React.FC = () => { useEffect(() => { console.log(selectedRow) - }, [selectedRow]); + setValue("data", selectedRow) + }, [selectedRow, setValue]); const editCombinedColumns = useMemo( @@ -245,6 +249,7 @@ const footer = ( border: "1px solid", borderColor: "warning.main", }, + height: 400, width: '95%' }} disableColumnMenu editMode="row"