Redirect to the newly created invoice on add
It makes more sense to see the invoice once created than to return to the list of invoices and having to look for it.
This commit is contained in:
parent
c1a64dd51d
commit
c7ac82d6ea
|
@ -270,8 +270,8 @@ func HandleAddInvoice(w http.ResponseWriter, r *http.Request, _ httprouter.Param
|
||||||
mustRenderNewInvoiceForm(w, r, form)
|
mustRenderNewInvoiceForm(w, r, form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conn.MustExec(r.Context(), "select add_invoice($1, $2, $3, $4, $5, $6)", company.Id, form.Number, form.Date, form.Customer, form.Notes, NewInvoiceProductArray(form.Products))
|
slug := conn.MustGetText(r.Context(), "", "select add_invoice($1, $2, $3, $4, $5, $6)", company.Id, form.Number, form.Date, form.Customer, form.Notes, NewInvoiceProductArray(form.Products))
|
||||||
http.Redirect(w, r, companyURI(company, "/invoices"), http.StatusSeeOther)
|
http.Redirect(w, r, companyURI(company, "/invoices/"+slug), http.StatusSeeOther)
|
||||||
default:
|
default:
|
||||||
http.Error(w, gettext("Invalid action", locale), http.StatusBadRequest)
|
http.Error(w, gettext("Invalid action", locale), http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue