import { AppBreadcrumb, AppContent } from "@repo/rdx-ui/components"; import { Button } from "@repo/shadcn-ui/components"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import { useCreateCustomerInvoiceMutation } from "../../hooks"; import { MODULE_NAME } from "../../manifest"; import { CustomerInvoiceEditForm } from "./customer-invoice-edit-form"; export const CustomerInvoiceCreate = () => { const { t } = useTranslation(MODULE_NAME); const navigate = useNavigate(); const { mutate, isPending, isError, error } = useCreateCustomerInvoiceMutation(); const handleSubmit = (data: any) => { // Handle form submission logic here console.log("Form submitted with data:", data); mutate(data); // Navigate to the list page after submission navigate("/customer-invoices/list"); }; if (isError) { console.error("Error creating customer invoice:", error); // Optionally, you can show an error message to the user } // Render the component // You can also handle loading state if needed // For example, you can disable the submit button while the mutation is in progress // const isLoading = useCreateCustomerInvoiceMutation().isLoading; // Return the JSX for the component // You can customize the form and its fields as needed // For example, you can use a form library like react-hook-form or Formik to handle form state and validation // Here, we are using a simple form with a submit button // Note: Make sure to replace the form fields with your actual invoice fields // and handle validation as needed. // This is just a basic example to demonstrate the structure of the component. // If you are using a form library, you can pass the handleSubmit function to the form's onSubmit prop // and use the form library's methods to handle form state and validation. // Example of a simple form submission handler // You can replace this with your actual form handling logic // const handleSubmit = (event: React.FormEvent) => { // event.preventDefault(); // const formData = new FormData(event.currentTarget); return ( <>

{t("pages.create.title")}

{t("pages.create.description")}

); }; /* return ( <>

{t('customerInvoices.list.title' />

{t('CustomerInvoices.list.subtitle' />

{CustomerInvoiceStatuses.map((s) => ( {s.label} ))}
{CustomerInvoiceStatuses.map((s) => ( ))}
); }; */