Added conversion logic for ROs. Blanket translations for files.
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
Avatar,
|
||||
Layout
|
||||
} from "antd";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { UPDATE_JOB, CONVERT_JOB_TO_RO } from "../../graphql/jobs.queries";
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -36,6 +36,7 @@ const formItemLayout = {
|
||||
function JobTombstone({ job, ...otherProps }) {
|
||||
const [jobContext, setJobContext] = useState(job);
|
||||
const [mutationUpdateJob] = useMutation(UPDATE_JOB);
|
||||
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!job) {
|
||||
@@ -95,11 +96,31 @@ function JobTombstone({ job, ...otherProps }) {
|
||||
}
|
||||
tags={<Tag color='blue'>{jobContext?.job_status?.name}</Tag>}
|
||||
extra={[
|
||||
<Form.Item key='1'>
|
||||
<Button type='primary' htmlType='submit'>
|
||||
{t("general.labels.save")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
<Button
|
||||
key='convert'
|
||||
type='dashed'
|
||||
disabled={!jobContext.converted}
|
||||
onClick={() => {
|
||||
mutationConvertJob({
|
||||
variables: { jobId: jobContext.id }
|
||||
}).then(r => {
|
||||
console.log("r", r);
|
||||
setJobContext({
|
||||
...jobContext,
|
||||
converted: true,
|
||||
ro_number: r.data.update_jobs.returning[0].ro_number
|
||||
});
|
||||
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.converted")
|
||||
});
|
||||
});
|
||||
}}>
|
||||
{t("jobs.labels.convert")}
|
||||
</Button>,
|
||||
<Button type='primary' key='submit' htmlType='submit'>
|
||||
{t("general.labels.save")}
|
||||
</Button>
|
||||
]}>
|
||||
<Descriptions size='small' column={5}>
|
||||
<Descriptions.Item label={t("jobs.fields.vehicle")}>
|
||||
|
||||
Reference in New Issue
Block a user