made typeaheads less bad and turned off matching
This commit is contained in:
@@ -45,6 +45,12 @@
|
||||
(fn [{:keys [db]} [_ token]]
|
||||
(let [handler (:handler (bidi/match-route routes/routes (.. js/window -location -pathname)))]
|
||||
(cond
|
||||
(= :login handler)
|
||||
{:db (assoc db/default-db
|
||||
:active-page :login
|
||||
:last-client-id (.getItem js/localStorage "last-client-id")
|
||||
:user nil)}
|
||||
|
||||
(and (not= :login handler) (not token))
|
||||
{:redirect "/login"
|
||||
:db (assoc db/default-db
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns auto-ap.views.components.vendor-dialog
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[auto-ap.views.utils :refer [dispatch-event horizontal-field bind-field with-user with-is-admin? active-when]]
|
||||
[auto-ap.views.utils :refer [dispatch-event horizontal-field bind-field with-user with-is-admin? active-when account->match-text]]
|
||||
[auto-ap.views.components.address :refer [address-field]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-entity]]
|
||||
[auto-ap.views.components.dropdown :refer [drop-down drop-down-contents]]
|
||||
@@ -29,7 +29,7 @@
|
||||
::settled
|
||||
[(forms/in-form ::vendor-form)]
|
||||
(fn [{:keys [data] :as form} _]
|
||||
(let [vendors @(re-frame/subscribe [::subs/vendors])
|
||||
#_(let [vendors @(re-frame/subscribe [::subs/vendors])
|
||||
text (.toLowerCase (:name data ""))
|
||||
matching-vendor (when (> (count text) 5)
|
||||
(->> vendors
|
||||
@@ -306,7 +306,7 @@
|
||||
(fn [field client]
|
||||
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/accounts client])
|
||||
:match->text (fn [x ] (str (:numeric-code x) " - " (:name x)))
|
||||
:match->text account->match-text
|
||||
:field field
|
||||
:type "typeahead-entity"
|
||||
:event change-event
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
[auto-ap.views.components.switch-field :refer [switch-field]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-entity]]
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[auto-ap.views.utils :refer [active-when dispatch-event dispatch-value-change ->$]]
|
||||
[auto-ap.views.utils :refer [active-when dispatch-event dispatch-value-change ->$ account->match-text]]
|
||||
[bidi.bidi :as bidi]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
[:p.menu-label "Financial Account"]
|
||||
[:div
|
||||
[typeahead-entity {:matches accounts
|
||||
:match->text (fn [x ] (str (:numeric-code x) " - " (:name x)))
|
||||
:match->text account->match-text
|
||||
:include-keys [:name :id :numeric-code]
|
||||
:type "typeahead-entity"
|
||||
:on-change #(re-frame/dispatch [::data-page/filter-changed data-page :account %])
|
||||
|
||||
@@ -481,3 +481,6 @@
|
||||
(.select el)
|
||||
(js/document.execCommand "copy")
|
||||
(.removeChild js/document.body el)))
|
||||
|
||||
(defn account->match-text [x]
|
||||
(str (:numeric-code x) " - " (:name x)))
|
||||
|
||||
Reference in New Issue
Block a user