Added some additional save indiactors BOD-134
This commit is contained in:
@@ -5,7 +5,7 @@ import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
export default function VehicleDetailFormComponent({ form }) {
|
||||
export default function VehicleDetailFormComponent({ form, loading }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
@@ -16,6 +16,7 @@ export default function VehicleDetailFormComponent({ form }) {
|
||||
type="primary"
|
||||
key="submit"
|
||||
htmlType="submit"
|
||||
loading={loading}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import { Form, notification } from "antd";
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import VehicleDetailFormComponent from "./vehicle-detail-form.component";
|
||||
@@ -10,8 +10,10 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
|
||||
const { t } = useTranslation();
|
||||
const [updateVehicle] = useMutation(UPDATE_VEHICLE);
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
setLoading(true);
|
||||
const result = await updateVehicle({
|
||||
variables: { vehId: vehicle.id, vehicle: values },
|
||||
});
|
||||
@@ -31,6 +33,7 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
|
||||
if (refetch) await refetch();
|
||||
form.resetFields();
|
||||
form.resetFields();
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -44,7 +47,7 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
|
||||
v_prod_dt: vehicle.v_prod_dt ? moment(vehicle.v_prod_dt) : null,
|
||||
}}
|
||||
>
|
||||
<VehicleDetailFormComponent form={form} />
|
||||
<VehicleDetailFormComponent form={form} loading={loading} />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user