IO-1049 Unvoid RO.
This commit is contained in:
@@ -15966,6 +15966,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</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>
|
<concept_node>
|
||||||
<name>viewchecklist</name>
|
<name>viewchecklist</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -22709,6 +22730,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</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>
|
<concept_node>
|
||||||
<name>vehicle_info</name>
|
<name>vehicle_info</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -55,7 +55,11 @@ export function JobAdminMarkReexport({ bodyshop, job }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button loading={loading} onClick={handleUpdate}>
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
disabled={!job.date_exported}
|
||||||
|
onClick={handleUpdate}
|
||||||
|
>
|
||||||
{t("jobs.labels.markforreexport")}
|
{t("jobs.labels.markforreexport")}
|
||||||
</Button>
|
</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 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 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 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 JobAdminVehicleReassociate from "../../components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component";
|
||||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||||
import NotFound from "../../components/not-found/not-found.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 : {}} />
|
<ScoreboardAddButton job={data ? data.jobs_by_pk : {}} />
|
||||||
<JobsAdminDeleteIntake job={data ? data.jobs_by_pk : {}} />
|
<JobsAdminDeleteIntake job={data ? data.jobs_by_pk : {}} />
|
||||||
<JobsAdminMarkReexport job={data ? data.jobs_by_pk : {}} />
|
<JobsAdminMarkReexport job={data ? data.jobs_by_pk : {}} />
|
||||||
|
<JobsAdminUnvoid job={data ? data.jobs_by_pk : {}} />
|
||||||
</Space>
|
</Space>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -999,6 +999,7 @@
|
|||||||
"schedule": "Schedule",
|
"schedule": "Schedule",
|
||||||
"sendcsi": "Send CSI",
|
"sendcsi": "Send CSI",
|
||||||
"sync": "Sync",
|
"sync": "Sync",
|
||||||
|
"unvoid": "Unvoid Job",
|
||||||
"viewchecklist": "View Checklists",
|
"viewchecklist": "View Checklists",
|
||||||
"viewdetail": "View Details"
|
"viewdetail": "View Details"
|
||||||
},
|
},
|
||||||
@@ -1343,6 +1344,7 @@
|
|||||||
"total_repairs": "Total Repairs",
|
"total_repairs": "Total Repairs",
|
||||||
"total_sales": "Total Sales",
|
"total_sales": "Total Sales",
|
||||||
"totals": "Totals",
|
"totals": "Totals",
|
||||||
|
"unvoidnote": "This job was unvoided by {{email}}.",
|
||||||
"vehicle_info": "Vehicle",
|
"vehicle_info": "Vehicle",
|
||||||
"vehicleassociation": "Vehicle Association",
|
"vehicleassociation": "Vehicle Association",
|
||||||
"viewallocations": "View Allocations",
|
"viewallocations": "View Allocations",
|
||||||
|
|||||||
@@ -999,6 +999,7 @@
|
|||||||
"schedule": "Programar",
|
"schedule": "Programar",
|
||||||
"sendcsi": "",
|
"sendcsi": "",
|
||||||
"sync": "",
|
"sync": "",
|
||||||
|
"unvoid": "",
|
||||||
"viewchecklist": "",
|
"viewchecklist": "",
|
||||||
"viewdetail": ""
|
"viewdetail": ""
|
||||||
},
|
},
|
||||||
@@ -1343,6 +1344,7 @@
|
|||||||
"total_repairs": "",
|
"total_repairs": "",
|
||||||
"total_sales": "",
|
"total_sales": "",
|
||||||
"totals": "",
|
"totals": "",
|
||||||
|
"unvoidnote": "",
|
||||||
"vehicle_info": "Vehículo",
|
"vehicle_info": "Vehículo",
|
||||||
"vehicleassociation": "",
|
"vehicleassociation": "",
|
||||||
"viewallocations": "",
|
"viewallocations": "",
|
||||||
|
|||||||
@@ -999,6 +999,7 @@
|
|||||||
"schedule": "Programme",
|
"schedule": "Programme",
|
||||||
"sendcsi": "",
|
"sendcsi": "",
|
||||||
"sync": "",
|
"sync": "",
|
||||||
|
"unvoid": "",
|
||||||
"viewchecklist": "",
|
"viewchecklist": "",
|
||||||
"viewdetail": ""
|
"viewdetail": ""
|
||||||
},
|
},
|
||||||
@@ -1343,6 +1344,7 @@
|
|||||||
"total_repairs": "",
|
"total_repairs": "",
|
||||||
"total_sales": "",
|
"total_sales": "",
|
||||||
"totals": "",
|
"totals": "",
|
||||||
|
"unvoidnote": "",
|
||||||
"vehicle_info": "Véhicule",
|
"vehicle_info": "Véhicule",
|
||||||
"vehicleassociation": "",
|
"vehicleassociation": "",
|
||||||
"viewallocations": "",
|
"viewallocations": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user