Added email template tester IO-595.
This commit is contained in:
@@ -20,15 +20,17 @@ export default function EmailOverlayComponent({
|
||||
name="to"
|
||||
mode="tags"
|
||||
value={messageOptions.to}
|
||||
style={{ width: "100%" }}
|
||||
//style={{ width: "100%" }}
|
||||
onChange={handleToChange}
|
||||
tokenSeparators={[",", ";"]}
|
||||
/>
|
||||
CC:
|
||||
<Input
|
||||
<Select
|
||||
value={messageOptions.cc}
|
||||
mode="tags"
|
||||
onChange={handleConfigChange}
|
||||
name="cc"
|
||||
tokenSeparators={[",", ";"]}
|
||||
/>
|
||||
Subject:
|
||||
<Input
|
||||
@@ -36,6 +38,10 @@ export default function EmailOverlayComponent({
|
||||
onChange={handleConfigChange}
|
||||
name="subject"
|
||||
/>
|
||||
<div style={{ color: "red" }}>
|
||||
DEVELOPER NOTE: Any edits made in the editor below will not be sent or
|
||||
saved due to css inlining issues.
|
||||
</div>
|
||||
<Editor
|
||||
value={messageOptions.html}
|
||||
apiKey="f3s2mjsd77ya5qvqkee9vgh612cm6h41e85efqakn2d0kknk"
|
||||
|
||||
72
client/src/components/email-test/email-test-component.jsx
Normal file
72
client/src/components/email-test/email-test-component.jsx
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Button, Form, Input } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
||||
});
|
||||
|
||||
export function EmailTestComponent({ currentUser, setEmailOptions }) {
|
||||
const [form] = Form.useForm();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleFinish = (values) => {
|
||||
console.log("values", values);
|
||||
setEmailOptions({
|
||||
messageOptions: {
|
||||
to: currentUser.email || null,
|
||||
},
|
||||
template: {
|
||||
name: values.key,
|
||||
variables: {
|
||||
id: values.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Form
|
||||
onFinish={handleFinish}
|
||||
autoComplete={"off"}
|
||||
layout="vertical"
|
||||
form={form}
|
||||
>
|
||||
<Form.Item
|
||||
name="key"
|
||||
label="Template Key"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="id"
|
||||
label="Record ID"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<Button onClick={() => form.submit()}>Execute</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(EmailTestComponent);
|
||||
Reference in New Issue
Block a user