Added parts Queue BOD-388

This commit is contained in:
Patrick Fic
2020-09-23 15:49:48 -07:00
parent 1a89d683d7
commit 3f446b7525
23 changed files with 2095 additions and 4 deletions

View File

@@ -0,0 +1,37 @@
import { Button, notification } from "antd";
import React, { useState } from "react";
import { useMutation } from "react-apollo";
import { UPDATE_JOB } from "../../graphql/jobs.queries";
import { useTranslation } from "react-i18next";
export default function JobRemoveFromPartsQueue({ jobId, refetch }) {
const [updateJob] = useMutation(UPDATE_JOB);
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const handleClick = async (e) => {
setLoading(true);
const result = await updateJob({
variables: { jobId: jobId, job: { queued_for_parts: false } },
});
if (!!!result.errors) {
notification["success"]({ message: t("jobs.successes.saved") });
if (refetch) refetch();
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
setLoading(false);
};
return (
<Button onClick={handleClick} loading={loading}>
{t("general.actions.remove")}
</Button>
);
}