-
-
+
-
+
-
+
-
+
@@ -42,52 +44,56 @@ export default function OwnerDetailFormComponent({ form }) {
+ ]}
+ >
-
+
+ ]}
+ >
+ ]}
+ >
+ ]}
+ >
-
+
@@ -95,27 +101,30 @@ export default function OwnerDetailFormComponent({ form }) {
+ name="allow_text_message"
+ valuePropName="checked"
+ >
+ ]}
+ >
-
+
+ name="preferred_contact"
+ >
diff --git a/client/src/components/owner-detail-form/owner-detail-form.container.jsx b/client/src/components/owner-detail-form/owner-detail-form.container.jsx
index 00d1df689..5b601f7d2 100644
--- a/client/src/components/owner-detail-form/owner-detail-form.container.jsx
+++ b/client/src/components/owner-detail-form/owner-detail-form.container.jsx
@@ -1,5 +1,5 @@
import { Form, notification } from "antd";
-import React from "react";
+import React, { useState } from "react";
import { useMutation } from "@apollo/react-hooks";
import { useTranslation } from "react-i18next";
import { UPDATE_OWNER } from "../../graphql/owners.queries";
@@ -8,10 +8,11 @@ import OwnerDetailFormComponent from "./owner-detail-form.component";
function OwnerDetailFormContainer({ owner, refetch }) {
const { t } = useTranslation();
const [form] = Form.useForm();
-
+ const [loading, setLoading] = useState(false);
const [updateOwner] = useMutation(UPDATE_OWNER);
const handleFinish = async (values) => {
+ setLoading(true);
const result = await updateOwner({
variables: { ownerId: owner.id, owner: values },
});
@@ -32,6 +33,7 @@ function OwnerDetailFormContainer({ owner, refetch }) {
if (refetch) await refetch();
form.resetFields();
form.resetFields();
+ setLoading(false);
};
return (
@@ -42,7 +44,7 @@ function OwnerDetailFormContainer({ owner, refetch }) {
layout="vertical"
initialValues={owner}
>
-
+
);
}
diff --git a/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx b/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx
index 55a06d689..e5a9b9142 100644
--- a/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx
+++ b/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx
@@ -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")}
diff --git a/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx b/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx
index 7fbfb2eb5..0b18735da 100644
--- a/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx
+++ b/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx
@@ -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,
}}
>
-
+
);
}
diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js
index 78f0e6209..3d89ceb4e 100644
--- a/client/src/graphql/jobs.queries.js
+++ b/client/src/graphql/jobs.queries.js
@@ -231,6 +231,7 @@ export const GET_JOB_BY_PK = gql`
first_name
last_name
}
+ intakechecklist
csr
loss_desc
kmin
diff --git a/client/src/pages/contract-create/contract-create.page.component.jsx b/client/src/pages/contract-create/contract-create.page.component.jsx
index 3e8a41e35..cf1bf09fe 100644
--- a/client/src/pages/contract-create/contract-create.page.component.jsx
+++ b/client/src/pages/contract-create/contract-create.page.component.jsx
@@ -9,11 +9,14 @@ export default function ContractCreatePageComponent({
form,
selectedJobState,
selectedCarState,
+ loading,
}) {
const { t } = useTranslation();
return (
-
+
diff --git a/client/src/pages/contract-create/contract-create.page.container.jsx b/client/src/pages/contract-create/contract-create.page.container.jsx
index cd644fdb8..81ac0303b 100644
--- a/client/src/pages/contract-create/contract-create.page.container.jsx
+++ b/client/src/pages/contract-create/contract-create.page.container.jsx
@@ -23,6 +23,7 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
const { t } = useTranslation();
const history = useHistory();
const location = useLocation();
+ const [loading, setLoading] = useState(false);
const selectedCarState = useState(null);
const selectedJobState = useState(
(location.state && location.state.jobId) || null
@@ -31,6 +32,7 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
const handleFinish = (values) => {
if (!!selectedCarState[0] && !!selectedJobState[0]) {
+ setLoading(true);
insertContract({
variables: {
contract: {
@@ -61,6 +63,7 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
message: t("contracts.errors.selectjobandcar"),
});
}
+ setLoading(false);
};
useEffect(() => {
@@ -84,9 +87,11 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
form={form}
layout="vertical"
autoComplete="no"
+ initialValues={{ status: "contracts.status.new" }}
onFinish={handleFinish}
>
-
+
);
diff --git a/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx b/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx
index 30379ee15..98f6c5a2e 100644
--- a/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx
+++ b/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx
@@ -1,7 +1,7 @@
import { useMutation, useQuery } from "@apollo/react-hooks";
import { Form, notification } from "antd";
import moment from "moment";
-import React, { useEffect } from "react";
+import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { useParams } from "react-router-dom";
@@ -27,7 +27,7 @@ export function CourtesyCarDetailPageContainer({
const [insertCourtesyCar] = useMutation(UPDATE_CC);
const [form] = Form.useForm();
const { ccId } = useParams();
-
+ const [saveLoading, setSaveLoading] = useState(false);
const { loading, error, data } = useQuery(QUERY_CC_BY_PK, {
variables: { id: ccId },
});
@@ -63,18 +63,24 @@ export function CourtesyCarDetailPageContainer({
);
}, [t, data, error, loading, setBreadcrumbs, ccId, addRecentItem]);
- const handleFinish = (values) => {
- insertCourtesyCar({
+ const handleFinish = async (values) => {
+ setSaveLoading(true);
+
+ const result = await insertCourtesyCar({
variables: { cc: { ...values }, ccId: ccId },
- })
- .then((response) => {
- notification["success"]({ message: t("courtesycars.successes.saved") });
- })
- .catch((error) =>
- notification["error"]({
- message: t("courtesycars.errors.saving", { error: error }),
- })
- );
+ });
+
+ if (!!result.errors) {
+ notification["error"]({
+ message: t("courtesycars.errors.saving", { error: error }),
+ });
+ }
+
+ notification["success"]({
+ message: t("courtesycars.successes.saved"),
+ });
+
+ setSaveLoading(false);
};
useEffect(() => {
@@ -120,6 +126,7 @@ export function CourtesyCarDetailPageContainer({
diff --git a/client/src/utils/DateFormatter.jsx b/client/src/utils/DateFormatter.jsx
index 88bda7b04..cddd773dc 100644
--- a/client/src/utils/DateFormatter.jsx
+++ b/client/src/utils/DateFormatter.jsx
@@ -8,9 +8,10 @@ export function DateFormatter(props) {
{props.children}
) : null;
}
+
export function DateTimeFormatter(props) {
return props.children ? (
-
{props.children}
+
{props.children}
) : null;
}