feat(invoice): add Send invoice email action
Adds a Send button to the order action extension and a corresponding "send" op to /api/orders/:orderId/invoice. Generates the invoice on demand if missing, then sends via the configured SMTP.
This commit is contained in:
@@ -13,7 +13,7 @@ function Extension() {
|
||||
const orderGid: string | undefined = data?.selected?.[0]?.id;
|
||||
const orderId = orderGid ? orderGid.split("/").pop() : undefined;
|
||||
|
||||
async function trigger(action: "generate" | "cancel_reissue") {
|
||||
async function trigger(action: "generate" | "cancel_reissue" | "send") {
|
||||
if (!orderId) {
|
||||
setError("No order selected");
|
||||
return;
|
||||
@@ -47,6 +47,9 @@ function Extension() {
|
||||
<s-button slot="primary-action" onClick={() => trigger("generate")} disabled={busy}>
|
||||
Generate / regenerate
|
||||
</s-button>
|
||||
<s-button slot="secondary-actions" onClick={() => trigger("send")} disabled={busy}>
|
||||
Send invoice email
|
||||
</s-button>
|
||||
<s-button slot="secondary-actions" tone="critical" onClick={() => trigger("cancel_reissue")} disabled={busy}>
|
||||
Cancel & reissue
|
||||
</s-button>
|
||||
|
||||
Reference in New Issue
Block a user