WIP for invoice list items on inovice enter
This commit is contained in:
@@ -3,13 +3,13 @@ import { Form, notification } from "antd";
|
||||
import { useMutation } from "react-apollo";
|
||||
import VehicleDetailFormComponent from "./vehicle-detail-form.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import moment from "moment";
|
||||
import { UPDATE_VEHICLE } from "../../graphql/vehicles.queries";
|
||||
|
||||
function VehicleDetailFormContainer({ vehicle, refetch }) {
|
||||
const { t } = useTranslation();
|
||||
const [updateVehicle] = useMutation(UPDATE_VEHICLE);
|
||||
const [form] = Form.useForm();
|
||||
const { resetFields } = form;
|
||||
|
||||
const handleFinish = values => {
|
||||
updateVehicle({
|
||||
@@ -19,14 +19,21 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
|
||||
message: t("vehicles.successes.save")
|
||||
});
|
||||
//TODO Better way to reset the field decorators?
|
||||
if (refetch) refetch().then();
|
||||
resetFields();
|
||||
if (refetch) refetch();
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Form onFinish={handleFinish} form={Form} autoComplete="off">
|
||||
<VehicleDetailFormComponent vehicle={vehicle} form={form} />
|
||||
<Form
|
||||
onFinish={handleFinish}
|
||||
form={form}
|
||||
autoComplete="off"
|
||||
initialValues={{
|
||||
...vehicle,
|
||||
v_prod_dt: vehicle.v_prod_dt ? moment(vehicle.v_prod_dt) : null
|
||||
}}
|
||||
>
|
||||
<VehicleDetailFormComponent />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user