IO-2316 Predefined Email address for CC field
This commit is contained in:
@@ -1,28 +1,28 @@
|
|||||||
import { UploadOutlined, UserAddOutlined } from "@ant-design/icons";
|
import { UploadOutlined, UserAddOutlined } from "@ant-design/icons";
|
||||||
import {
|
import {
|
||||||
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
|
Dropdown,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
|
Menu,
|
||||||
Select,
|
Select,
|
||||||
|
Space,
|
||||||
Tabs,
|
Tabs,
|
||||||
Upload,
|
Upload,
|
||||||
Space,
|
|
||||||
Menu,
|
|
||||||
Dropdown,
|
|
||||||
Button,
|
|
||||||
} from "antd";
|
} from "antd";
|
||||||
|
import _ from "lodash";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import EmailDocumentsComponent from "../email-documents/email-documents.component";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectEmailConfig } from "../../redux/email/email.selectors";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import { CreateExplorerLinkForJob } from "../../utils/localmedia";
|
import { CreateExplorerLinkForJob } from "../../utils/localmedia";
|
||||||
import { selectEmailConfig } from "../../redux/email/email.selectors";
|
import EmailDocumentsComponent from "../email-documents/email-documents.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -54,6 +54,15 @@ export function EmailOverlayComponent({
|
|||||||
]),
|
]),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const handle_CC_Click = ({ item, key, keyPath }) => {
|
||||||
|
const email = item.props.value;
|
||||||
|
form.setFieldsValue({
|
||||||
|
cc: _.uniq([
|
||||||
|
...(form.getFieldValue("cc") || ""),
|
||||||
|
...(typeof email === "string" ? [email] : email),
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
<div>
|
<div>
|
||||||
@@ -74,6 +83,25 @@ export function EmailOverlayComponent({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const menuCC = (
|
||||||
|
<div>
|
||||||
|
<Menu onClick={handle_CC_Click}>
|
||||||
|
{bodyshop.employees
|
||||||
|
.filter((e) => e.user_email)
|
||||||
|
.map((e, idx) => (
|
||||||
|
<Menu.Item value={e.user_email} key={idx}>
|
||||||
|
{`${e.first_name} ${e.last_name}`}
|
||||||
|
</Menu.Item>
|
||||||
|
))}
|
||||||
|
{bodyshop.md_to_emails.map((e, idx) => (
|
||||||
|
<Menu.Item value={e.emails} key={idx + "group"}>
|
||||||
|
{e.label}
|
||||||
|
</Menu.Item>
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -122,7 +150,23 @@ export function EmailOverlayComponent({
|
|||||||
>
|
>
|
||||||
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("emails.fields.cc")} name="cc">
|
<Form.Item
|
||||||
|
label={
|
||||||
|
<Space>
|
||||||
|
{t("emails.fields.cc")}
|
||||||
|
<Dropdown overlay={menuCC}>
|
||||||
|
<a
|
||||||
|
className="ant-dropdown-link"
|
||||||
|
href=" #"
|
||||||
|
onClick={(e) => e.preventDefault()}
|
||||||
|
>
|
||||||
|
<UserAddOutlined />
|
||||||
|
</a>
|
||||||
|
</Dropdown>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
name="cc"
|
||||||
|
>
|
||||||
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
Reference in New Issue
Block a user