Added length of appointment to config + fixed appointments not showing in scheduling modal + added appointment confirmation template. BOD-141 BOD-149 BOD-148

This commit is contained in:
Patrick Fic
2020-06-03 16:17:39 -07:00
parent 47f858920b
commit e606401e76
29 changed files with 652 additions and 162 deletions

View File

@@ -8,20 +8,21 @@ export default function EmailOverlayComponent({
}) {
return (
<div>
To:
<Input
defaultValue={messageOptions.to}
value={messageOptions.to}
onChange={handleConfigChange}
name="to"
/>
CC
CC:
<Input
defaultValue={messageOptions.cc}
value={messageOptions.cc}
onChange={handleConfigChange}
name="cc"
/>
Subject
Subject:
<Input
defaultValue={messageOptions.subject}
value={messageOptions.subject}
onChange={handleConfigChange}
name="subject"
/>

View File

@@ -33,6 +33,7 @@ export function EmailOverlayContainer({
}) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const [sending, setSending] = useState(false);
const defaultEmailFrom = {
from: {
name: bodyshop.shopname || EmailSettings.fromNameDefault,
@@ -45,21 +46,19 @@ export function EmailOverlayContainer({
html: "",
});
const handleOk = () => {
//sendEmail(messageOptions);
axios
.post("/sendemail", messageOptions)
.then((response) => {
console.log(JSON.stringify(response));
notification["success"]({ message: t("emails.successes.sent") });
toggleEmailOverlayVisible();
})
.catch((error) => {
console.log(JSON.stringify(error));
notification["error"]({
message: t("emails.errors.notsent", { message: error.message }),
});
const handleOk = async () => {
setSending(true);
try {
const emailResponse = await axios.post("/sendemail", messageOptions);
notification["success"]({ message: t("emails.successes.sent") });
toggleEmailOverlayVisible();
} catch (error) {
console.log(JSON.stringify(error));
notification["error"]({
message: t("emails.errors.notsent", { message: error.message }),
});
}
setSending(false);
};
const handleConfigChange = (event) => {
@@ -72,6 +71,7 @@ export function EmailOverlayContainer({
const render = async () => {
setLoading(true);
console.log("emailConfig", emailConfig);
let html = await RenderTemplate(emailConfig.template, bodyshop);
setMessageOptions({
...emailConfig.messageOptions,
@@ -93,7 +93,9 @@ export function EmailOverlayContainer({
onOk={handleOk}
onCancel={() => {
toggleEmailOverlayVisible();
}}>
}}
okButtonProps={{ loading: sending }}
>
<LoadingSpinner loading={loading}>
<EmailOverlayComponent
handleConfigChange={handleConfigChange}
@@ -102,10 +104,10 @@ export function EmailOverlayContainer({
/>
<button
onClick={() => {
console.log(messageOptions.html);
navigator.clipboard.writeText(messageOptions.html);
}}>
Get HTML
}}
>
Copy HTML
</button>
</LoadingSpinner>
</Modal>