IO-1049 Unvoid RO.
This commit is contained in:
@@ -15966,6 +15966,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>unvoid</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>
|
||||
<name>viewchecklist</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -22709,6 +22730,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>unvoidnote</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>
|
||||
<name>vehicle_info</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -55,7 +55,11 @@ export function JobAdminMarkReexport({ bodyshop, job }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Button loading={loading} onClick={handleUpdate}>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!job.date_exported}
|
||||
onClick={handleUpdate}
|
||||
>
|
||||
{t("jobs.labels.markforreexport")}
|
||||
</Button>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import { gql, useMutation } from "@apollo/client";
|
||||
import { Button, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminUnvoid);
|
||||
|
||||
export function JobsAdminUnvoid({ bodyshop, job, currentUser }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updateJob] = useMutation(gql`
|
||||
mutation UNVOID_JOB($jobId: uuid!) {
|
||||
update_jobs_by_pk(pk_columns: {id: $jobId}, _set: {voided: false, status: "${
|
||||
bodyshop.md_ro_statuses.default_imported
|
||||
}"}) {
|
||||
id
|
||||
voided
|
||||
status
|
||||
}
|
||||
insert_notes(objects: {jobid: $jobId, audit: true, created_by: "${
|
||||
currentUser.email
|
||||
}", text: "${t("jobs.labels.unvoidnote", { email: currentUser.email })}"}) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`);
|
||||
|
||||
// const result = await voidJob({
|
||||
// variables: {
|
||||
// jobId: job.id,
|
||||
// job: {
|
||||
// status: bodyshop.md_ro_statuses.default_void,
|
||||
// voided: true,
|
||||
// },
|
||||
// note: [
|
||||
// {
|
||||
// jobid: job.id,
|
||||
// created_by: currentUser.email,
|
||||
// audit: true,
|
||||
// text: t("jobs.labels.voidnote", {
|
||||
// date: moment().format("MM/DD/yyy"),
|
||||
// time: moment().format("hh:mm a"),
|
||||
// }),
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// });
|
||||
|
||||
// if (!!!result.errors) {
|
||||
// notification["success"]({
|
||||
// message: t("jobs.successes.voided"),
|
||||
// });
|
||||
// //go back to jobs list.
|
||||
// history.push(`/manage/`);
|
||||
// } else {
|
||||
// notification["error"]({
|
||||
// message: t("jobs.errors.voiding", {
|
||||
// error: JSON.stringify(result.errors),
|
||||
// }),
|
||||
// });
|
||||
// }
|
||||
|
||||
const handleUpdate = async (values) => {
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: { jobId: job.id },
|
||||
});
|
||||
|
||||
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 (
|
||||
<Button loading={loading} disabled={!job.voided} onClick={handleUpdate}>
|
||||
{t("jobs.actions.unvoid")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import JobsAdminDatesChange from "../../components/jobs-admin-dates/jobs-admin-d
|
||||
import JobsAdminDeleteIntake from "../../components/jobs-admin-delete-intake/jobs-admin-delete-intake.component";
|
||||
import JobsAdminMarkReexport from "../../components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component";
|
||||
import JobAdminOwnerReassociate from "../../components/jobs-admin-owner-reassociate/jobs-admin-owner-reassociate.component";
|
||||
import JobsAdminUnvoid from "../../components/jobs-admin-unvoid/jobs-admin-unvoid.component";
|
||||
import JobAdminVehicleReassociate from "../../components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
@@ -88,6 +89,7 @@ export function JobsCloseContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
<ScoreboardAddButton job={data ? data.jobs_by_pk : {}} />
|
||||
<JobsAdminDeleteIntake job={data ? data.jobs_by_pk : {}} />
|
||||
<JobsAdminMarkReexport job={data ? data.jobs_by_pk : {}} />
|
||||
<JobsAdminUnvoid job={data ? data.jobs_by_pk : {}} />
|
||||
</Space>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
@@ -999,6 +999,7 @@
|
||||
"schedule": "Schedule",
|
||||
"sendcsi": "Send CSI",
|
||||
"sync": "Sync",
|
||||
"unvoid": "Unvoid Job",
|
||||
"viewchecklist": "View Checklists",
|
||||
"viewdetail": "View Details"
|
||||
},
|
||||
@@ -1343,6 +1344,7 @@
|
||||
"total_repairs": "Total Repairs",
|
||||
"total_sales": "Total Sales",
|
||||
"totals": "Totals",
|
||||
"unvoidnote": "This job was unvoided by {{email}}.",
|
||||
"vehicle_info": "Vehicle",
|
||||
"vehicleassociation": "Vehicle Association",
|
||||
"viewallocations": "View Allocations",
|
||||
|
||||
@@ -999,6 +999,7 @@
|
||||
"schedule": "Programar",
|
||||
"sendcsi": "",
|
||||
"sync": "",
|
||||
"unvoid": "",
|
||||
"viewchecklist": "",
|
||||
"viewdetail": ""
|
||||
},
|
||||
@@ -1343,6 +1344,7 @@
|
||||
"total_repairs": "",
|
||||
"total_sales": "",
|
||||
"totals": "",
|
||||
"unvoidnote": "",
|
||||
"vehicle_info": "Vehículo",
|
||||
"vehicleassociation": "",
|
||||
"viewallocations": "",
|
||||
|
||||
@@ -999,6 +999,7 @@
|
||||
"schedule": "Programme",
|
||||
"sendcsi": "",
|
||||
"sync": "",
|
||||
"unvoid": "",
|
||||
"viewchecklist": "",
|
||||
"viewdetail": ""
|
||||
},
|
||||
@@ -1343,6 +1344,7 @@
|
||||
"total_repairs": "",
|
||||
"total_sales": "",
|
||||
"totals": "",
|
||||
"unvoidnote": "",
|
||||
"vehicle_info": "Véhicule",
|
||||
"vehicleassociation": "",
|
||||
"viewallocations": "",
|
||||
|
||||
Reference in New Issue
Block a user