added vendor filter

This commit is contained in:
Bryce Covert
2019-01-25 23:20:10 -08:00
parent 7aaf9bf035
commit e63d5d77e7
3 changed files with 33 additions and 35 deletions

View 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}]]]])