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:
Gerhard Scheikl
2026-05-08 15:27:16 +02:00
parent a67fc0767e
commit edd72f2776
7 changed files with 49 additions and 2 deletions
@@ -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 &amp; reissue
</s-button>