General gendoc function & reprint parts orders IO-411

This commit is contained in:
Patrick Fic
2021-01-14 16:40:16 -08:00
parent ffbe670499
commit 5a6991dad6
7 changed files with 146 additions and 117 deletions

View File

@@ -9,18 +9,16 @@ import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {
INSERT_NEW_PAYMENT,
UPDATE_PAYMENT
UPDATE_PAYMENT,
} from "../../graphql/payments.queries";
import { setEmailOptions } from "../../redux/email/email.actions";
import { toggleModalVisible } from "../../redux/modals/modals.actions";
import { selectPayment } from "../../redux/modals/modals.selectors";
import {
selectBodyshop,
selectCurrentUser
selectCurrentUser,
} from "../../redux/user/user.selectors";
import RenderTemplate, {
displayTemplateInWindow
} from "../../utils/RenderTemplate";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants";
import PaymentForm from "../payment-form/payment-form.component";
@@ -121,32 +119,19 @@ function BillEnterModalContainer({
notification["error"]({ message: t("payments.errors.payment") });
}
if (sendby === "email") {
setEmailOptions({
messageOptions: {
// to: [appData.email],
replyTo: bodyshop.email,
GenerateDocument(
{
name: TemplateList().payment_receipt.key,
variables: {
id: newPayment.data.insert_payments.returning[0].id,
},
template: {
name: TemplateList().payment_receipt.key,
variables: {
id: newPayment.data.insert_payments.returning[0].id,
},
},
});
} else {
displayTemplateInWindow(
await RenderTemplate(
{
name: TemplateList().payment_receipt.key,
variables: {
id: newPayment.data.insert_payments.returning[0].id,
},
},
bodyshop
)
);
}
},
{
// to: [appData.email],
replyTo: bodyshop.email,
},
sendby === "email" ? "e" : "p"
);
} else {
const updatedPayment = await updatePayment({
variables: {