added vendor filter
This commit is contained in:
19
src/cljs/auto_ap/views/components/vendor_filter.cljs
Normal file
19
src/cljs/auto_ap/views/components/vendor_filter.cljs
Normal file
@@ -0,0 +1,19 @@
|
||||
(ns auto-ap.views.components.vendor-filter
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[auto-ap.entities.invoice :as invoice]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead]]
|
||||
[auto-ap.views.utils :refer [bind-field]]))
|
||||
|
||||
(defn vendor-filter [{:keys [value on-change-event vendors]}]
|
||||
[:div.field
|
||||
[:div.control
|
||||
[bind-field
|
||||
[typeahead {:matches (map (fn [x] [(:id x) (:name x)]) vendors)
|
||||
:type "typeahead"
|
||||
:auto-focus true
|
||||
:field [:vendor-id]
|
||||
:text-field [:vendor-name]
|
||||
:event on-change-event
|
||||
:spec (s/nilable ::invoice/vendor-id)
|
||||
:subscription value}]]]])
|
||||
Reference in New Issue
Block a user