Added email template tester IO-595.
This commit is contained in:
@@ -20,15 +20,17 @@ export default function EmailOverlayComponent({
|
|||||||
name="to"
|
name="to"
|
||||||
mode="tags"
|
mode="tags"
|
||||||
value={messageOptions.to}
|
value={messageOptions.to}
|
||||||
style={{ width: "100%" }}
|
//style={{ width: "100%" }}
|
||||||
onChange={handleToChange}
|
onChange={handleToChange}
|
||||||
tokenSeparators={[",", ";"]}
|
tokenSeparators={[",", ";"]}
|
||||||
/>
|
/>
|
||||||
CC:
|
CC:
|
||||||
<Input
|
<Select
|
||||||
value={messageOptions.cc}
|
value={messageOptions.cc}
|
||||||
|
mode="tags"
|
||||||
onChange={handleConfigChange}
|
onChange={handleConfigChange}
|
||||||
name="cc"
|
name="cc"
|
||||||
|
tokenSeparators={[",", ";"]}
|
||||||
/>
|
/>
|
||||||
Subject:
|
Subject:
|
||||||
<Input
|
<Input
|
||||||
@@ -36,6 +38,10 @@ export default function EmailOverlayComponent({
|
|||||||
onChange={handleConfigChange}
|
onChange={handleConfigChange}
|
||||||
name="subject"
|
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
|
<Editor
|
||||||
value={messageOptions.html}
|
value={messageOptions.html}
|
||||||
apiKey="f3s2mjsd77ya5qvqkee9vgh612cm6h41e85efqakn2d0kknk"
|
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 { connect } from "react-redux";
|
||||||
import { Route, Switch } from "react-router-dom";
|
import { Route, Switch } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import client from "../../utils/GraphQLClient";
|
|
||||||
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
||||||
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
||||||
import ConflictComponent from "../../components/conflict/conflict.component";
|
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 TestComponent from "../../components/_test/test.component";
|
||||||
import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries";
|
import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries";
|
||||||
import { selectInstanceConflict } from "../../redux/user/user.selectors";
|
import { selectInstanceConflict } from "../../redux/user/user.selectors";
|
||||||
|
import client from "../../utils/GraphQLClient";
|
||||||
import "./manage.page.styles.scss";
|
import "./manage.page.styles.scss";
|
||||||
|
|
||||||
const ManageRootPage = lazy(() =>
|
const ManageRootPage = lazy(() =>
|
||||||
@@ -132,6 +132,9 @@ const Help = lazy(() => import("../help/help.page"));
|
|||||||
const PartsQueue = lazy(() =>
|
const PartsQueue = lazy(() =>
|
||||||
import("../parts-queue/parts-queue.page.container")
|
import("../parts-queue/parts-queue.page.container")
|
||||||
);
|
);
|
||||||
|
const EmailTest = lazy(() =>
|
||||||
|
import("../../components/email-test/email-test-component")
|
||||||
|
);
|
||||||
|
|
||||||
const { Content, Header } = Layout;
|
const { Content, Header } = Layout;
|
||||||
|
|
||||||
@@ -362,6 +365,11 @@ export function Manage({ match, conflict }) {
|
|||||||
component={TimeTicketsAll}
|
component={TimeTicketsAll}
|
||||||
/>
|
/>
|
||||||
<Route exact path={`${match.path}/help`} component={Help} />
|
<Route exact path={`${match.path}/help`} component={Help} />
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path={`${match.path}/emailtest`}
|
||||||
|
component={EmailTest}
|
||||||
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)}
|
)}
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
|||||||
Reference in New Issue
Block a user