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);
|
||||
@@ -6,7 +6,6 @@ import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Route, Switch } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import client from "../../utils/GraphQLClient";
|
||||
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
||||
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
||||
import ConflictComponent from "../../components/conflict/conflict.component";
|
||||
@@ -21,6 +20,7 @@ import PrintCenterModalContainer from "../../components/print-center-modal/print
|
||||
import TestComponent from "../../components/_test/test.component";
|
||||
import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries";
|
||||
import { selectInstanceConflict } from "../../redux/user/user.selectors";
|
||||
import client from "../../utils/GraphQLClient";
|
||||
import "./manage.page.styles.scss";
|
||||
|
||||
const ManageRootPage = lazy(() =>
|
||||
@@ -132,6 +132,9 @@ const Help = lazy(() => import("../help/help.page"));
|
||||
const PartsQueue = lazy(() =>
|
||||
import("../parts-queue/parts-queue.page.container")
|
||||
);
|
||||
const EmailTest = lazy(() =>
|
||||
import("../../components/email-test/email-test-component")
|
||||
);
|
||||
|
||||
const { Content, Header } = Layout;
|
||||
|
||||
@@ -362,6 +365,11 @@ export function Manage({ match, conflict }) {
|
||||
component={TimeTicketsAll}
|
||||
/>
|
||||
<Route exact path={`${match.path}/help`} component={Help} />
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/emailtest`}
|
||||
component={EmailTest}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
|
||||
Reference in New Issue
Block a user