Delete non-converted job IO-589
This commit is contained in:
@@ -17399,6 +17399,27 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>deleteconfirm</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>difference</name>
|
<name>difference</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -18753,6 +18774,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>delete</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>deleted</name>
|
<name>deleted</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -19849,6 +19891,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>deletejob</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>duplicate</name>
|
<name>duplicate</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { DownCircleFilled } from "@ant-design/icons";
|
import { DownCircleFilled } from "@ant-design/icons";
|
||||||
import { useApolloClient } from "@apollo/react-hooks";
|
import { useApolloClient, useMutation } from "@apollo/react-hooks";
|
||||||
import { Button, Dropdown, Menu, Popconfirm } from "antd";
|
import { Button, Dropdown, Menu, notification, Popconfirm } from "antd";
|
||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link, useHistory } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { DELETE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AddToProduction from "./jobs-detail-header-actions.addtoproduction.util";
|
import AddToProduction from "./jobs-detail-header-actions.addtoproduction.util";
|
||||||
import JobsDetaiLheaderCsi from "./jobs-detail-header-actions.csi.component";
|
import JobsDetaiLheaderCsi from "./jobs-detail-header-actions.csi.component";
|
||||||
import DuplicateJob from "./jobs-detail-header-actions.duplicate.util";
|
import DuplicateJob from "./jobs-detail-header-actions.duplicate.util";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
@@ -43,7 +43,7 @@ export function JobsDetailHeaderActions({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const [deleteJob] = useMutation(DELETE_JOB);
|
||||||
const jobInProduction = useMemo(() => {
|
const jobInProduction = useMemo(() => {
|
||||||
return bodyshop.md_ro_statuses.production_statuses.includes(job.status);
|
return bodyshop.md_ro_statuses.production_statuses.includes(job.status);
|
||||||
}, [job, bodyshop.md_ro_statuses.production_statuses]);
|
}, [job, bodyshop.md_ro_statuses.production_statuses]);
|
||||||
@@ -252,6 +252,37 @@ export function JobsDetailHeaderActions({
|
|||||||
>
|
>
|
||||||
{t("jobs.labels.jobcosting")}
|
{t("jobs.labels.jobcosting")}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
{job && !job.converted && (
|
||||||
|
<Menu.Item>
|
||||||
|
<Popconfirm
|
||||||
|
title={t("jobs.labels.deleteconfirm")}
|
||||||
|
okText={t("general.labels.yes")}
|
||||||
|
cancelText={t("general.labels.no")}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
onConfirm={async () => {
|
||||||
|
//delete the job.
|
||||||
|
const result = await deleteJob({ variables: { id: job.id } });
|
||||||
|
|
||||||
|
if (!!!result.errors) {
|
||||||
|
notification["success"]({
|
||||||
|
message: t("jobs.successes.delete"),
|
||||||
|
});
|
||||||
|
//go back to jobs list.
|
||||||
|
history.push(`/manage/`);
|
||||||
|
} else {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("jobs.errors.deleted", {
|
||||||
|
error: JSON.stringify(result.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
getPopupContainer={(trigger) => trigger.parentNode}
|
||||||
|
>
|
||||||
|
{t("menus.jobsactions.deletejob")}
|
||||||
|
</Popconfirm>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1320,3 +1320,11 @@ export const QUERY_JOB_LBR_ADJUSTMENTS = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const DELETE_JOB = gql`
|
||||||
|
mutation DELETE_JOB($id: uuid!) {
|
||||||
|
delete_jobs_by_pk(id: $id) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1069,6 +1069,7 @@
|
|||||||
"waived": "Waived",
|
"waived": "Waived",
|
||||||
"yes": "Yes"
|
"yes": "Yes"
|
||||||
},
|
},
|
||||||
|
"deleteconfirm": "Are you sure you want to delete this job? This cannot be undone. ",
|
||||||
"difference": "Difference",
|
"difference": "Difference",
|
||||||
"documents": "Documents",
|
"documents": "Documents",
|
||||||
"documents-images": "Images",
|
"documents-images": "Images",
|
||||||
@@ -1137,6 +1138,7 @@
|
|||||||
"created": "Job created successfully. Click to view.",
|
"created": "Job created successfully. Click to view.",
|
||||||
"created_subtitle": "Estimate Number {{est_number}} has been created.",
|
"created_subtitle": "Estimate Number {{est_number}} has been created.",
|
||||||
"creatednoclick": "Job created successfully. ",
|
"creatednoclick": "Job created successfully. ",
|
||||||
|
"delete": "Job deleted successfully.",
|
||||||
"deleted": "Job deleted successfully.",
|
"deleted": "Job deleted successfully.",
|
||||||
"exported": "Job exported successfully. ",
|
"exported": "Job exported successfully. ",
|
||||||
"invoiced": "Job closed and invoiced successfully.",
|
"invoiced": "Job closed and invoiced successfully.",
|
||||||
@@ -1198,6 +1200,7 @@
|
|||||||
"jobsactions": {
|
"jobsactions": {
|
||||||
"admin": "Admin",
|
"admin": "Admin",
|
||||||
"closejob": "Close Job",
|
"closejob": "Close Job",
|
||||||
|
"deletejob": "Delete Job",
|
||||||
"duplicate": "Duplicate this Job",
|
"duplicate": "Duplicate this Job",
|
||||||
"duplicatenolines": "Duplicate this Job without Repair Data",
|
"duplicatenolines": "Duplicate this Job without Repair Data",
|
||||||
"newcccontract": "Create Courtesy Car Contract"
|
"newcccontract": "Create Courtesy Car Contract"
|
||||||
|
|||||||
@@ -1069,6 +1069,7 @@
|
|||||||
"waived": "",
|
"waived": "",
|
||||||
"yes": ""
|
"yes": ""
|
||||||
},
|
},
|
||||||
|
"deleteconfirm": "",
|
||||||
"difference": "",
|
"difference": "",
|
||||||
"documents": "documentos",
|
"documents": "documentos",
|
||||||
"documents-images": "",
|
"documents-images": "",
|
||||||
@@ -1137,6 +1138,7 @@
|
|||||||
"created": "Trabajo creado con éxito. Click para ver.",
|
"created": "Trabajo creado con éxito. Click para ver.",
|
||||||
"created_subtitle": "",
|
"created_subtitle": "",
|
||||||
"creatednoclick": "",
|
"creatednoclick": "",
|
||||||
|
"delete": "",
|
||||||
"deleted": "Trabajo eliminado con éxito.",
|
"deleted": "Trabajo eliminado con éxito.",
|
||||||
"exported": "",
|
"exported": "",
|
||||||
"invoiced": "",
|
"invoiced": "",
|
||||||
@@ -1198,6 +1200,7 @@
|
|||||||
"jobsactions": {
|
"jobsactions": {
|
||||||
"admin": "",
|
"admin": "",
|
||||||
"closejob": "",
|
"closejob": "",
|
||||||
|
"deletejob": "",
|
||||||
"duplicate": "",
|
"duplicate": "",
|
||||||
"duplicatenolines": "",
|
"duplicatenolines": "",
|
||||||
"newcccontract": ""
|
"newcccontract": ""
|
||||||
|
|||||||
@@ -1069,6 +1069,7 @@
|
|||||||
"waived": "",
|
"waived": "",
|
||||||
"yes": ""
|
"yes": ""
|
||||||
},
|
},
|
||||||
|
"deleteconfirm": "",
|
||||||
"difference": "",
|
"difference": "",
|
||||||
"documents": "Les documents",
|
"documents": "Les documents",
|
||||||
"documents-images": "",
|
"documents-images": "",
|
||||||
@@ -1137,6 +1138,7 @@
|
|||||||
"created": "Le travail a été créé avec succès. Clique pour voir.",
|
"created": "Le travail a été créé avec succès. Clique pour voir.",
|
||||||
"created_subtitle": "",
|
"created_subtitle": "",
|
||||||
"creatednoclick": "",
|
"creatednoclick": "",
|
||||||
|
"delete": "",
|
||||||
"deleted": "Le travail a bien été supprimé.",
|
"deleted": "Le travail a bien été supprimé.",
|
||||||
"exported": "",
|
"exported": "",
|
||||||
"invoiced": "",
|
"invoiced": "",
|
||||||
@@ -1198,6 +1200,7 @@
|
|||||||
"jobsactions": {
|
"jobsactions": {
|
||||||
"admin": "",
|
"admin": "",
|
||||||
"closejob": "",
|
"closejob": "",
|
||||||
|
"deletejob": "",
|
||||||
"duplicate": "",
|
"duplicate": "",
|
||||||
"duplicatenolines": "",
|
"duplicatenolines": "",
|
||||||
"newcccontract": ""
|
"newcccontract": ""
|
||||||
|
|||||||
Reference in New Issue
Block a user