diff --git a/pkg/invoices.go b/pkg/invoices.go index 343ae74..a3a630d 100644 --- a/pkg/invoices.go +++ b/pkg/invoices.go @@ -175,7 +175,7 @@ func newInvoiceFilterForm(ctx context.Context, conn *Conn, locale *Locale, compa InvoiceNumber: &InputField{ Name: "number", Label: pgettext("input", "Invoice Number", locale), - Type: "text", + Type: "search", }, FromDate: &InputField{ Name: "from_date", diff --git a/web/static/numerus.css b/web/static/numerus.css index 0854af1..a519101 100644 --- a/web/static/numerus.css +++ b/web/static/numerus.css @@ -314,7 +314,7 @@ main { margin-top: 2rem; } -input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], select, textarea { +input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], select, textarea { background-color: var(--numerus--background-color); border: 1px solid var(--numerus--color--black); border-radius: 0; diff --git a/web/static/numerus.js b/web/static/numerus.js index a607763..3aea63b 100644 --- a/web/static/numerus.js +++ b/web/static/numerus.js @@ -347,7 +347,11 @@ class Tags extends HTMLDivElement { } rebuild() { - this.input.value = this.tags.join(','); + const newValue = this.tags.join(','); + if (newValue !== this.input.value) { + this.input.value = newValue; + this.input.dispatchEvent(new Event('change', {bubbles: true})); + } this.tagList.querySelectorAll('.tag').forEach((tag) => tag.remove()); if (this.tags.length === 0) { this.search.setAttribute('placeholder', this.label.textContent); @@ -421,7 +425,7 @@ htmx.onLoad((target) => { } }) -htmx.on('htmx:configRequest', function(e) { +htmx.on('htmx:configRequest', function (e) { const element = e.detail.elt; if (element && element.nodeName === 'FORM') { let submitter = e.detail.triggeringEvent.submitter; diff --git a/web/template/invoices/index.gohtml b/web/template/invoices/index.gohtml index c3fa9c5..001c85a 100644 --- a/web/template/invoices/index.gohtml +++ b/web/template/invoices/index.gohtml @@ -27,7 +27,7 @@ {{ define "content" }} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.InvoicesIndexPage*/ -}}
-
+ {{ with .Filters }} {{ template "select-field" .Customer }} {{ template "select-field" .InvoiceStatus }}