Added manual job stage transitions IO-427
This commit is contained in:
@@ -12813,6 +12813,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>removefromproduction</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>schedule</name>
|
<name>schedule</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ export function JobChecklistForm({
|
|||||||
scheduled_completion: job && job.scheduled_completion,
|
scheduled_completion: job && job.scheduled_completion,
|
||||||
scheduled_delivery: job && job.scheduled_delivery,
|
scheduled_delivery: job && job.scheduled_delivery,
|
||||||
}),
|
}),
|
||||||
|
...(type === "deliver" && {
|
||||||
|
removeFromProduction: true,
|
||||||
|
actual_completion: job && job.actual_completion,
|
||||||
|
}),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("checklist.labels.checklist")}
|
{t("checklist.labels.checklist")}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export function JobsChangeStatus({ job, bodyshop, jobRO }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [availableStatuses, setAvailableStatuses] = useState([]);
|
const [availableStatuses, setAvailableStatuses] = useState([]);
|
||||||
|
const [otherStages, setOtherStages] = useState([]);
|
||||||
const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS);
|
const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS);
|
||||||
const updateJobStatus = (status) => {
|
const updateJobStatus = (status) => {
|
||||||
mutationUpdateJobstatus({
|
mutationUpdateJobstatus({
|
||||||
@@ -34,26 +35,41 @@ export function JobsChangeStatus({ job, bodyshop, jobRO }) {
|
|||||||
notification["error"]({ message: t("jobs.errors.saving") });
|
notification["error"]({ message: t("jobs.errors.saving") });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//Figure out what scenario were in, populate accodingly
|
//Figure out what scenario were in, populate accodingly
|
||||||
if (job && bodyshop) {
|
if (job && bodyshop) {
|
||||||
if (bodyshop.md_ro_statuses.pre_production_statuses.includes(job.status))
|
if (
|
||||||
|
bodyshop.md_ro_statuses.pre_production_statuses.includes(job.status)
|
||||||
|
) {
|
||||||
setAvailableStatuses(bodyshop.md_ro_statuses.pre_production_statuses);
|
setAvailableStatuses(bodyshop.md_ro_statuses.pre_production_statuses);
|
||||||
else if (bodyshop.md_ro_statuses.production_statuses.includes(job.status))
|
if (bodyshop.md_ro_statuses.production_statuses[0])
|
||||||
|
setOtherStages([bodyshop.md_ro_statuses.production_statuses[0]]);
|
||||||
|
} else if (
|
||||||
|
bodyshop.md_ro_statuses.production_statuses.includes(job.status)
|
||||||
|
) {
|
||||||
setAvailableStatuses(bodyshop.md_ro_statuses.production_statuses);
|
setAvailableStatuses(bodyshop.md_ro_statuses.production_statuses);
|
||||||
else if (
|
setOtherStages([
|
||||||
|
bodyshop.md_ro_statuses.default_imported,
|
||||||
|
bodyshop.md_ro_statuses.default_delivered,
|
||||||
|
]);
|
||||||
|
} else if (
|
||||||
bodyshop.md_ro_statuses.post_production_statuses.includes(job.status)
|
bodyshop.md_ro_statuses.post_production_statuses.includes(job.status)
|
||||||
)
|
) {
|
||||||
setAvailableStatuses(bodyshop.md_ro_statuses.post_production_statuses);
|
setAvailableStatuses(bodyshop.md_ro_statuses.post_production_statuses);
|
||||||
else {
|
if (bodyshop.md_ro_statuses.production_statuses[0])
|
||||||
|
setOtherStages([bodyshop.md_ro_statuses.production_statuses[0]]);
|
||||||
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
"Status didn't match any restrictions. Allowing all status changes."
|
"Status didn't match any restrictions. Allowing all status changes."
|
||||||
);
|
);
|
||||||
setAvailableStatuses(bodyshop.statuses);
|
setAvailableStatuses(bodyshop.md_ro_statuses.statuses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [job, setAvailableStatuses, bodyshop]);
|
}, [job, setAvailableStatuses, bodyshop]);
|
||||||
|
|
||||||
|
console.log("availableStatuses", availableStatuses);
|
||||||
|
console.log("otherStages", otherStages);
|
||||||
const statusmenu = (
|
const statusmenu = (
|
||||||
<Menu
|
<Menu
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -63,6 +79,10 @@ export function JobsChangeStatus({ job, bodyshop, jobRO }) {
|
|||||||
{availableStatuses.map((item) => (
|
{availableStatuses.map((item) => (
|
||||||
<Menu.Item key={item}>{item}</Menu.Item>
|
<Menu.Item key={item}>{item}</Menu.Item>
|
||||||
))}
|
))}
|
||||||
|
<Menu.Divider />
|
||||||
|
{otherStages.map((item, idx) => (
|
||||||
|
<Menu.Item key={item}>{item}</Menu.Item>
|
||||||
|
))}
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
|||||||
export default function AddToProduction(
|
export default function AddToProduction(
|
||||||
apolloClient,
|
apolloClient,
|
||||||
jobId,
|
jobId,
|
||||||
completionCallback
|
completionCallback,
|
||||||
|
remove = false
|
||||||
) {
|
) {
|
||||||
logImEXEvent("job_add_to_production");
|
logImEXEvent("job_add_to_production");
|
||||||
|
|
||||||
@@ -14,17 +15,17 @@ export default function AddToProduction(
|
|||||||
apolloClient
|
apolloClient
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: UPDATE_JOB,
|
mutation: UPDATE_JOB,
|
||||||
variables: { jobId: jobId, job: { inproduction: true } },
|
variables: { jobId: jobId, job: { inproduction: !remove } },
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: i18n.t("jobs.successes.addedtoproduction"),
|
message: i18n.t("jobs.successes.save"),
|
||||||
});
|
});
|
||||||
if (completionCallback) completionCallback();
|
if (completionCallback) completionCallback();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
notification["errors"]({
|
notification["errors"]({
|
||||||
message: i18n.t("jobs.errors.addingtoproduction", {
|
message: i18n.t("jobs.errors.saving", {
|
||||||
error: JSON.stringify(error),
|
error: JSON.stringify(error),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -128,13 +128,24 @@ export function JobsDetailHeaderActions({
|
|||||||
{t("menus.jobsactions.newcccontract")}
|
{t("menus.jobsactions.newcccontract")}
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
{job.inproduction ? (
|
||||||
key="addtoproduction"
|
<Menu.Item
|
||||||
disabled={!!!job.converted || !!job.inproduction || jobRO}
|
key="addtoproduction"
|
||||||
onClick={() => AddToProduction(client, job.id, refetch)}
|
disabled={!!!job.converted || jobRO}
|
||||||
>
|
onClick={() => AddToProduction(client, job.id, refetch, true)}
|
||||||
{t("jobs.actions.addtoproduction")}
|
>
|
||||||
</Menu.Item>
|
{t("jobs.actions.removefromproduction")}
|
||||||
|
</Menu.Item>
|
||||||
|
) : (
|
||||||
|
<Menu.Item
|
||||||
|
key="addtoproduction"
|
||||||
|
disabled={!!!job.converted || !!job.inproduction || jobRO}
|
||||||
|
onClick={() => AddToProduction(client, job.id, refetch)}
|
||||||
|
>
|
||||||
|
{t("jobs.actions.addtoproduction")}
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
|
|
||||||
<Menu.Item key="duplicatejob">
|
<Menu.Item key="duplicatejob">
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={t("jobs.labels.duplicateconfirm")}
|
title={t("jobs.labels.duplicateconfirm")}
|
||||||
|
|||||||
@@ -833,6 +833,7 @@
|
|||||||
"printCenter": "Print Center",
|
"printCenter": "Print Center",
|
||||||
"recalculate": "Recalculate",
|
"recalculate": "Recalculate",
|
||||||
"reconcile": "Reconcile",
|
"reconcile": "Reconcile",
|
||||||
|
"removefromproduction": "Remove from Production",
|
||||||
"schedule": "Schedule",
|
"schedule": "Schedule",
|
||||||
"sendcsi": "Send CSI",
|
"sendcsi": "Send CSI",
|
||||||
"viewdetail": "View Details"
|
"viewdetail": "View Details"
|
||||||
|
|||||||
@@ -833,6 +833,7 @@
|
|||||||
"printCenter": "Centro de impresión",
|
"printCenter": "Centro de impresión",
|
||||||
"recalculate": "",
|
"recalculate": "",
|
||||||
"reconcile": "",
|
"reconcile": "",
|
||||||
|
"removefromproduction": "",
|
||||||
"schedule": "Programar",
|
"schedule": "Programar",
|
||||||
"sendcsi": "",
|
"sendcsi": "",
|
||||||
"viewdetail": ""
|
"viewdetail": ""
|
||||||
|
|||||||
@@ -833,6 +833,7 @@
|
|||||||
"printCenter": "Centre d'impression",
|
"printCenter": "Centre d'impression",
|
||||||
"recalculate": "",
|
"recalculate": "",
|
||||||
"reconcile": "",
|
"reconcile": "",
|
||||||
|
"removefromproduction": "",
|
||||||
"schedule": "Programme",
|
"schedule": "Programme",
|
||||||
"sendcsi": "",
|
"sendcsi": "",
|
||||||
"viewdetail": ""
|
"viewdetail": ""
|
||||||
|
|||||||
Reference in New Issue
Block a user