Supports forcing vendor
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
valid-matches)]
|
||||
valid-matches))
|
||||
(defn typeahead-entity [{:keys [matches on-change field value class not-found-description
|
||||
disabled not-found-value auto-focus]}]
|
||||
disabled not-found-value auto-focus name]}]
|
||||
(let [text (r/atom (or (second (first (filter #(= (first %) value) matches))) ""))
|
||||
highlighted (r/atom nil)
|
||||
]
|
||||
@@ -153,6 +153,8 @@
|
||||
[:div.control
|
||||
[:div.tags.has-addons
|
||||
[:span.tag text]
|
||||
(when name
|
||||
[:input {:type "hidden" :name name :value (:id @highlighted)}])
|
||||
[:a.tag.is-delete {:on-click (fn []
|
||||
(select nil)
|
||||
(reset! text-atom nil)
|
||||
|
||||
@@ -7,16 +7,18 @@
|
||||
[auto-ap.entities.clients :as client]
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout]]
|
||||
[auto-ap.views.components.invoices.side-bar :refer [invoices-side-bar]]
|
||||
[auto-ap.views.utils :refer [dispatch-event]]
|
||||
[auto-ap.views.utils :refer [dispatch-event bind-field]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.entities.vendors :as vendor]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-entity]]
|
||||
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
|
||||
[cljsjs.dropzone :as dropzone]
|
||||
[cljs.reader :as edn]
|
||||
[clojure.string :as str]))
|
||||
(def dropzone
|
||||
(let [client (re-frame/subscribe [::subs/client])
|
||||
token (re-frame/subscribe [::subs/token])]
|
||||
token (re-frame/subscribe [::subs/token])
|
||||
vendor (reagent/atom nil)]
|
||||
(with-meta
|
||||
(fn []
|
||||
[:form.dz {:action "/api/invoices/upload"}
|
||||
@@ -25,6 +27,17 @@
|
||||
[:a.button.is-static "Force Location"]]
|
||||
[:p.control
|
||||
[:input.input {:name "location" :placeholder "SG" :size "4" :maxlength "2" :style {:display "inline"}}]]]
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
[:a.button.is-static "Force vendor"]]
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/vendors])
|
||||
:match->text :name
|
||||
:name "vendor"
|
||||
:type "typeahead"
|
||||
:on-change (fn [v]
|
||||
(reset! vendor v))
|
||||
:value @vendor}]
|
||||
]
|
||||
[:div.tile.notification
|
||||
|
||||
[:div.has-text-centered {:style {:padding "80px 0px" :width "100%"}}
|
||||
|
||||
Reference in New Issue
Block a user