- the great reformat

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-06 18:20:58 -05:00
parent 30c530bcc4
commit e83badb454
912 changed files with 108516 additions and 107493 deletions

View File

@@ -1,63 +1,64 @@
import { useMutation } from "@apollo/client";
import { Button, Form, notification } from "antd";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { UPDATE_JOB } from "../../graphql/jobs.queries";
import {useMutation} from "@apollo/client";
import {Button, Form, notification} from "antd";
import React, {useEffect, useState} from "react";
import {useTranslation} from "react-i18next";
import {UPDATE_JOB} from "../../graphql/jobs.queries";
import VehicleSearchSelect from "../vehicle-search-select/vehicle-search-select.component";
export default function JobAdminOwnerReassociate({ job }) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const [updateJob] = useMutation(UPDATE_JOB);
const handleFinish = async (values) => {
setLoading(true);
const result = await updateJob({
variables: { jobId: job.id, job: { vehicleid: values.vehicleid } },
});
if (!!!result.errors) {
notification["success"]({ message: t("jobs.successes.save") });
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
setLoading(false);
//Get the owner details, populate it all back into the job.
};
export default function JobAdminOwnerReassociate({job}) {
const {t} = useTranslation();
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const [updateJob] = useMutation(UPDATE_JOB);
const handleFinish = async (values) => {
setLoading(true);
const result = await updateJob({
variables: {jobId: job.id, job: {vehicleid: values.vehicleid}},
});
useEffect(() => {
//form.resetFields();
}, [form, job]);
if (!!!result.errors) {
notification["success"]({message: t("jobs.successes.save")});
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
setLoading(false);
//Get the owner details, populate it all back into the job.
};
return (
<div>
<div>{t("jobs.labels.vehicleassociation")}</div>
<Form
onFinish={handleFinish}
autoComplete={"off"}
form={form}
initialValues={{ vehicleid: job.vehicleid }}
>
<Form.Item
name="vehicleid"
label={t("jobs.fields.vehicle")}
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<VehicleSearchSelect />
</Form.Item>
</Form>
<div>{t("jobs.labels.associationwarning")}</div>
<Button loading={loading} onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
</div>
);
useEffect(() => {
//form.resetFields();
}, [form, job]);
return (
<div>
<div>{t("jobs.labels.vehicleassociation")}</div>
<Form
onFinish={handleFinish}
autoComplete={"off"}
form={form}
initialValues={{vehicleid: job.vehicleid}}
>
<Form.Item
name="vehicleid"
label={t("jobs.fields.vehicle")}
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<VehicleSearchSelect/>
</Form.Item>
</Form>
<div>{t("jobs.labels.associationwarning")}</div>
<Button loading={loading} onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
</div>
);
}