Browse Source

updated some invoice button logic that was incorrect and updated the input styles

cli-archive
nic 1 year ago
parent
commit
dce55183d2
  1. 4
      apps/web/main.go
  2. 4
      internal/handlers/web/invoices.go
  3. 2
      static/css/styles.css
  4. 2
      templates/partials/invoice_search.html

4
apps/web/main.go

@ -40,8 +40,8 @@ func main() {
protected.HandleFunc("/jobs", web.JobsHandler).Methods("GET")
protected.HandleFunc("/invoices", web.InvoicesHandler).Methods("GET", "POST")
protected.HandleFunc("/ok-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/fail-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/pending-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/failed-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/pending_accounting-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/processed-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/void-invoice/{id}", web.UpdateInvoiceStatusHandler).Methods("PUT")
protected.HandleFunc("/admin", web.AdminHandler).Methods("GET")

4
internal/handlers/web/invoices.go

@ -22,7 +22,7 @@ type StatusButton struct {
var statusButtons = []StatusButton{
{"draft", "Draft Invoice", "success-button", "Are you sure you want to draft this invoice?"},
{"ok", "Ok Invoice", "success-button", "Are you sure you want to mark this invoice as OK?"},
{"fail", "Fail Invoice", "caution-button", "Are you sure you want to fail this invoice?"},
{"failed", "Fail Invoice", "caution-button", "Are you sure you want to fail this invoice?"},
{"pending_accounting", "Pending Invoice", "caution-button", "Are you sure you want to mark this invoice as pending?"},
{"processed", "Process Invoice", "warning-button", "Are you sure you want to process this invoice?"},
{"void", "Void Invoice", "warning-button", "Are you sure you want to void this invoice?"},
@ -186,7 +186,7 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) {
// Validate the status
validStatuses := map[string]bool{
"draft": true,
"fail": true,
"failed": true,
"ok": true,
"pending_accounting": true,
"processed": true,

2
static/css/styles.css

@ -206,7 +206,7 @@ html {
}
.card-input {
width: 100%;
width: 95%;
/* Adjust size as needed */
padding: 0.25rem 0.5rem;
/* Smaller padding */

2
templates/partials/invoice_search.html

@ -3,7 +3,7 @@
<div class="content">
<h3 class="submenu-header">Search Invoice</h3>
<div id="search-container">
<input type="text" name="search" placeholder="Enter invoice number or id" hx-get="/invoices"
<input class="card-input" type="text" name="search" placeholder="Enter invoice number or id" hx-get="/invoices"
hx-trigger="keyup changed delay:500ms" hx-target="#invoice-search-results" hx-indicator="#loading-indicator" />
<div id="loading-indicator" class="htmx-indicator">

Loading…
Cancel
Save