Added dates to render template & email test IO-636
This commit is contained in:
@@ -6,6 +6,8 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
|
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||||
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -24,7 +26,9 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
|
|||||||
{
|
{
|
||||||
name: values.key,
|
name: values.key,
|
||||||
variables: {
|
variables: {
|
||||||
id: values.id,
|
...(values.id ? { id: values.id } : {}),
|
||||||
|
...(values.start ? { start: values.start } : {}),
|
||||||
|
...(values.end ? { end: values.end } : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -49,48 +53,49 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
|
|||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Form.Item
|
<LayoutFormRow>
|
||||||
name="to"
|
<Form.Item
|
||||||
label="Recipients"
|
name="to"
|
||||||
rules={[
|
label="Recipients"
|
||||||
{
|
rules={[
|
||||||
type: "array",
|
{
|
||||||
},
|
type: "array",
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
>
|
||||||
</Form.Item>
|
<Select mode="tags" tokenSeparators={[",", ";"]} />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
name="key"
|
<Form.Item
|
||||||
label="Template Key"
|
name="key"
|
||||||
rules={[
|
label="Template Key"
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
message: t("general.validation.required"),
|
required: true,
|
||||||
},
|
message: t("general.validation.required"),
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<Input />
|
>
|
||||||
</Form.Item>
|
<Input />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
name="id"
|
<Form.Item name="id" label="Record ID">
|
||||||
label="Record ID"
|
<Input />
|
||||||
rules={[
|
</Form.Item>
|
||||||
{
|
<Form.Item
|
||||||
required: true,
|
name="email"
|
||||||
message: t("general.validation.required"),
|
label="Generate as email?"
|
||||||
},
|
valuePropName="checked"
|
||||||
]}
|
>
|
||||||
>
|
<Switch />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
</LayoutFormRow>
|
||||||
<Form.Item
|
<LayoutFormRow>
|
||||||
name="email"
|
<Form.Item name="start" label="Start Date">
|
||||||
label="Generate as email?"
|
<DateTimePicker />
|
||||||
valuePropName="checked"
|
</Form.Item>
|
||||||
>
|
<Form.Item name="end" label="End Date">
|
||||||
<Switch />
|
<DateTimePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
</Form>
|
</Form>
|
||||||
<Button onClick={() => form.submit()}>Execute</Button>
|
<Button onClick={() => form.submit()}>Execute</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,14 +13,6 @@ export default async function RenderTemplate(
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
renderAsHtml = false
|
renderAsHtml = false
|
||||||
) {
|
) {
|
||||||
//Template Object
|
|
||||||
// {
|
|
||||||
// name: TemplateList().parts_order.key,
|
|
||||||
// variables: {
|
|
||||||
// id: insertResult.data.insert_parts_orders.returning[0].id,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
//Query assets that match the template name. Must be in format <<templateName>>.query
|
//Query assets that match the template name. Must be in format <<templateName>>.query
|
||||||
|
|
||||||
jsreport.headers["Authorization"] =
|
jsreport.headers["Authorization"] =
|
||||||
@@ -67,6 +59,7 @@ export default async function RenderTemplate(
|
|||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
...contextData,
|
...contextData,
|
||||||
|
...templateObject.variables,
|
||||||
headerpath: `/${bodyshop.imexshopid}/header.html`,
|
headerpath: `/${bodyshop.imexshopid}/header.html`,
|
||||||
bodyshop: bodyshop,
|
bodyshop: bodyshop,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user