IO-1065 Add available jobs alert for closed jobs.
This commit is contained in:
@@ -20222,6 +20222,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>alreadyclosed</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>appointmentconfirmation</name>
|
<name>appointmentconfirmation</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -5,7 +5,16 @@ import {
|
|||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Card, Input, notification, Space, Table } from "antd";
|
import {
|
||||||
|
Alert,
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Input,
|
||||||
|
notification,
|
||||||
|
Space,
|
||||||
|
Table,
|
||||||
|
Tag,
|
||||||
|
} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -16,7 +25,23 @@ import {
|
|||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
export default function JobsAvailableComponent({
|
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(JobsAvailableComponent);
|
||||||
|
|
||||||
|
export function JobsAvailableComponent({
|
||||||
|
bodyshop,
|
||||||
loading,
|
loading,
|
||||||
data,
|
data,
|
||||||
refetch,
|
refetch,
|
||||||
@@ -58,11 +83,11 @@ export default function JobsAvailableComponent({
|
|||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
record.job ? (
|
record.job ? (
|
||||||
<Link to={`/manage/jobs/${record.job.id}`}>
|
<Link to={`/manage/jobs/${record.job.id}`}>
|
||||||
{(record.job && record.job_ro_number) || t("general.labels.na")}
|
{(record.job && record.job.ro_number) || t("general.labels.na")}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
{(record.job && record.job_ro_number) || t("general.labels.na")}
|
{(record.job && record.job.ro_number) || t("general.labels.na")}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -132,31 +157,47 @@ export default function JobsAvailableComponent({
|
|||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => {
|
||||||
<Space wrap>
|
const isClosed =
|
||||||
<Button
|
record.job &&
|
||||||
onClick={() => {
|
(record.job.status === bodyshop.md_ro_statuses.default_exported ||
|
||||||
deleteJob({ variables: { id: record.id } }).then((r) => {
|
record.job.status === bodyshop.md_ro_statuses.default_invoiced);
|
||||||
notification["success"]({
|
return (
|
||||||
message: t("jobs.successes.deleted"),
|
<Space wrap>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
deleteJob({ variables: { id: record.id } }).then((r) => {
|
||||||
|
notification["success"]({
|
||||||
|
message: t("jobs.successes.deleted"),
|
||||||
|
});
|
||||||
|
refetch();
|
||||||
});
|
});
|
||||||
refetch();
|
}}
|
||||||
});
|
>
|
||||||
}}
|
<DeleteFilled />
|
||||||
>
|
</Button>
|
||||||
<DeleteFilled />
|
{!isClosed && (
|
||||||
</Button>
|
<>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => addJobAsNew(record)}
|
onClick={() => addJobAsNew(record)}
|
||||||
disabled={record.issupplement}
|
disabled={record.issupplement}
|
||||||
>
|
>
|
||||||
<PlusCircleFilled />
|
<PlusCircleFilled />
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => addJobAsSupp(record)}>
|
<Button onClick={() => addJobAsSupp(record)}>
|
||||||
<DownloadOutlined />
|
<DownloadOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</>
|
||||||
),
|
)}
|
||||||
|
{isClosed && (
|
||||||
|
<Alert
|
||||||
|
type="error"
|
||||||
|
message={t("jobs.labels.alreadyclosed")}
|
||||||
|
></Alert>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const QUERY_AVAILABLE_JOBS = gql`
|
|||||||
job {
|
job {
|
||||||
id
|
id
|
||||||
ro_number
|
ro_number
|
||||||
|
status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1214,6 +1214,7 @@
|
|||||||
"adjustmentrate": "Adjustment Rate",
|
"adjustmentrate": "Adjustment Rate",
|
||||||
"adjustments": "Adjustments",
|
"adjustments": "Adjustments",
|
||||||
"allocations": "Allocations",
|
"allocations": "Allocations",
|
||||||
|
"alreadyclosed": "This job has already been closed.",
|
||||||
"appointmentconfirmation": "Send confirmation to customer?",
|
"appointmentconfirmation": "Send confirmation to customer?",
|
||||||
"associationwarning": "Any changes to associations will require updating the data from the new parent record to the job.",
|
"associationwarning": "Any changes to associations will require updating the data from the new parent record to the job.",
|
||||||
"audit": "Audit Trail",
|
"audit": "Audit Trail",
|
||||||
|
|||||||
@@ -1214,6 +1214,7 @@
|
|||||||
"adjustmentrate": "",
|
"adjustmentrate": "",
|
||||||
"adjustments": "",
|
"adjustments": "",
|
||||||
"allocations": "",
|
"allocations": "",
|
||||||
|
"alreadyclosed": "",
|
||||||
"appointmentconfirmation": "¿Enviar confirmación al cliente?",
|
"appointmentconfirmation": "¿Enviar confirmación al cliente?",
|
||||||
"associationwarning": "",
|
"associationwarning": "",
|
||||||
"audit": "",
|
"audit": "",
|
||||||
|
|||||||
@@ -1214,6 +1214,7 @@
|
|||||||
"adjustmentrate": "",
|
"adjustmentrate": "",
|
||||||
"adjustments": "",
|
"adjustments": "",
|
||||||
"allocations": "",
|
"allocations": "",
|
||||||
|
"alreadyclosed": "",
|
||||||
"appointmentconfirmation": "Envoyer une confirmation au client?",
|
"appointmentconfirmation": "Envoyer une confirmation au client?",
|
||||||
"associationwarning": "",
|
"associationwarning": "",
|
||||||
"audit": "",
|
"audit": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user