Skip to content

Commit

Permalink
implement front end options to resend invoice and/or tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
mbpictures committed Dec 25, 2023
1 parent 8f3fda8 commit 80a3c35
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/components/admin/OrderInformationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ export const OrderPaymentInformationDetails = ({order, onMarkAsPayed}) => {
}
};

const handleResendEmail = async () => {
try {
await axios.post("/api/admin/order/resend", { orderId: order.id, invoice: true });
enqueueSnackbar("Confirmation email sent!", { variant: "success" });
} catch (e) {
enqueueSnackbar("Error: " + (e?.response?.data ?? e.message), {
variant: "error"
});
}
}

return (
<>
<Typography>
Expand All @@ -74,6 +85,9 @@ export const OrderPaymentInformationDetails = ({order, onMarkAsPayed}) => {
Mark as payed
</SaveButton>
)}
<SaveButton action={handleResendEmail}>
Resend Confirmation E-Mail
</SaveButton>
<Divider />
<Typography>
Detailed information (in case of payment errors
Expand Down Expand Up @@ -102,6 +116,18 @@ export const OrderDeliveryInformationDetails = ({order, onMarkAsShipped, categor
}
};

const handleResendTickets = async () => {
try {
await axios.post("/api/admin/order/resend", { orderId: order.id, tickets: true });
enqueueSnackbar("Download Tickets sent!", { variant: "success" });
onMarkAsShipped();
} catch (e) {
enqueueSnackbar("Error: " + (e?.response?.data ?? e.message), {
variant: "error"
});
}
}

const getShippingAddress = () => {
const shipping = JSON.parse(order.shipping);
if (shipping.data === "mock" || shipping.data === null || !shipping.data.differentAddress) return order.user;
Expand Down Expand Up @@ -137,6 +163,9 @@ export const OrderDeliveryInformationDetails = ({order, onMarkAsShipped, categor
Mark as shipped
</Button>
)}
<SaveButton action={handleResendTickets}>
Resend download tickets
</SaveButton>
<Divider />
<Typography>
Detailed information
Expand Down

0 comments on commit 80a3c35

Please sign in to comment.