Added ability to generat PDF on test email page.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { Button, Form, Input } from "antd";
|
||||
import { Button, Form, Input, Switch } 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";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -19,17 +20,16 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
|
||||
|
||||
const handleFinish = (values) => {
|
||||
console.log("values", values);
|
||||
setEmailOptions({
|
||||
messageOptions: {
|
||||
to: currentUser.email || null,
|
||||
},
|
||||
template: {
|
||||
GenerateDocument(
|
||||
{
|
||||
name: values.key,
|
||||
variables: {
|
||||
id: values.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
{},
|
||||
values.email ? "e" : "p"
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -64,6 +64,13 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="email"
|
||||
label="Generate as email?"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<Button onClick={() => form.submit()}>Execute</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user