From eaad2b00123e9de4a1c3cb8f1b62049cff598f07 Mon Sep 17 00:00:00 2001 From: nic Date: Tue, 1 Oct 2024 12:55:06 -0400 Subject: [PATCH] updated button handling that broke with the button display update --- internal/handlers/web/invoices.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/handlers/web/invoices.go b/internal/handlers/web/invoices.go index f3ed3b6..b45b50e 100644 --- a/internal/handlers/web/invoices.go +++ b/internal/handlers/web/invoices.go @@ -170,7 +170,10 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) { return } invoiceID := parts[len(parts)-1] - status := parts[len(parts)-2] + statusPart := parts[len(parts)-2] + + // Extract the status from the statusPart + status := strings.TrimSuffix(statusPart, "-invoice") if invoiceID == "" { http.Error(w, "Invalid invoice ID", http.StatusBadRequest) @@ -179,6 +182,7 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) { // Validate the status validStatuses := map[string]bool{ + "draft": true, "fail": true, "ok": true, "pending": true,