Majority of Dropdown Overlay Menu refactors.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { DownCircleFilled } from "@ant-design/icons";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Dropdown, Menu, notification } from "antd";
|
||||
import { Button, Dropdown, notification } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -81,32 +81,28 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
}
|
||||
}, [job, setAvailableStatuses, bodyshop]);
|
||||
|
||||
const statusmenu = (
|
||||
<Menu
|
||||
onClick={(e) => {
|
||||
updateJobStatus(e.key);
|
||||
}}
|
||||
items={[
|
||||
...availableStatuses.map((item) => ({
|
||||
key: item,
|
||||
label: item,
|
||||
})),
|
||||
...(job.converted
|
||||
? [
|
||||
{ key: "divider", label: <hr />, disabled: true },
|
||||
...otherStages.map((item) => ({
|
||||
key: item,
|
||||
label: item,
|
||||
})),
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
);
|
||||
const statusMenu = {
|
||||
items: [
|
||||
...availableStatuses.map((item) => ({
|
||||
key: item,
|
||||
label: item,
|
||||
})),
|
||||
...(job.converted
|
||||
? [
|
||||
{ key: "divider", label: <hr />, disabled: true },
|
||||
...otherStages.map((item) => ({
|
||||
key: item,
|
||||
label: item,
|
||||
})),
|
||||
]
|
||||
: []),
|
||||
],
|
||||
onClick: (e) => updateJobStatus(e.key)
|
||||
}
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
menu={statusmenu}
|
||||
menu={statusMenu}
|
||||
trigger={["click"]}
|
||||
key="changestatus"
|
||||
disabled={jobRO || !job.converted}
|
||||
|
||||
Reference in New Issue
Block a user