simple search fixes
This commit is contained in:
@@ -123,7 +123,7 @@
|
|||||||
|
|
||||||
(defn location_id->client-location [location]
|
(defn location_id->client-location [location]
|
||||||
({"2RVBYER6QSV7W" ["NGAK" "MH"]
|
({"2RVBYER6QSV7W" ["NGAK" "MH"]
|
||||||
#_#_#_#_#_#_#_#_#_#_#_#_"8JT71V8XGYAT3" ["NGKG" "NB"]
|
"8JT71V8XGYAT3" ["NGKG" "NB"]
|
||||||
"SCX0Y8CTGM1S0" ["NGE1" "UC"]
|
"SCX0Y8CTGM1S0" ["NGE1" "UC"]
|
||||||
"FNH5VRT890WK8" ["NGMJ" "SC"]
|
"FNH5VRT890WK8" ["NGMJ" "SC"]
|
||||||
"AMQ0NPA8FGDEF" ["NGPG" "SZ"]
|
"AMQ0NPA8FGDEF" ["NGPG" "SZ"]
|
||||||
|
|||||||
@@ -201,7 +201,10 @@
|
|||||||
:<- [::client]
|
:<- [::client]
|
||||||
:<- [::all-vendors]
|
:<- [::all-vendors]
|
||||||
(fn [[is-admin client all-vendors]]
|
(fn [[is-admin client all-vendors]]
|
||||||
(cond client
|
(cond is-admin
|
||||||
|
all-vendors
|
||||||
|
|
||||||
|
client
|
||||||
(filter (fn [{:keys [hidden usage name] :as vendor}]
|
(filter (fn [{:keys [hidden usage name] :as vendor}]
|
||||||
(or (not hidden)
|
(or (not hidden)
|
||||||
(-> (first (filter #(= (:client-id %)
|
(-> (first (filter #(= (:client-id %)
|
||||||
@@ -211,8 +214,6 @@
|
|||||||
(> 0))))
|
(> 0))))
|
||||||
all-vendors)
|
all-vendors)
|
||||||
|
|
||||||
is-admin
|
|
||||||
all-vendors
|
|
||||||
|
|
||||||
:else
|
:else
|
||||||
|
|
||||||
@@ -224,10 +225,11 @@
|
|||||||
:<- [::searchable-vendors]
|
:<- [::searchable-vendors]
|
||||||
(fn [searchable-vendors]
|
(fn [searchable-vendors]
|
||||||
(doto (MiniSearch. #js {:fields #js ["name" "content"]
|
(doto (MiniSearch. #js {:fields #js ["name" "content"]
|
||||||
:storeFields #js ["id" "name" "content"]})
|
:storeFields #js ["id" "name" "content" "usage"]})
|
||||||
(.addAll (clj->js (map (fn [v] {:id (:id v)
|
(.addAll (clj->js (map (fn [v] {:id (:id v)
|
||||||
:name (:name v)
|
:name (:name v)
|
||||||
:content (:name v)})
|
:content (:name v)
|
||||||
|
:usage (:usage v)})
|
||||||
searchable-vendors))))))
|
searchable-vendors))))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
@@ -235,10 +237,11 @@
|
|||||||
:<- [::all-vendors]
|
:<- [::all-vendors]
|
||||||
(fn [all-vendors]
|
(fn [all-vendors]
|
||||||
(doto (MiniSearch. #js {:fields #js ["name" "content"]
|
(doto (MiniSearch. #js {:fields #js ["name" "content"]
|
||||||
:storeFields #js ["id" "name" "content"]})
|
:storeFields #js ["id" "name" "content" "usage"]})
|
||||||
(.addAll (clj->js (map (fn [v] {:id (:id v)
|
(.addAll (clj->js (map (fn [v] {:id (:id v)
|
||||||
:name (:name v)
|
:name (:name v)
|
||||||
:content (:name v)})
|
:content (:name v)
|
||||||
|
:usage (:usage v)})
|
||||||
all-vendors))))))
|
all-vendors))))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
[:<>
|
[:<>
|
||||||
(field "Form Vendor (will be deleted)"
|
(field "Form Vendor (will be deleted)"
|
||||||
[typeahead-v3 {:entities-by-id @(re-frame/subscribe [::subs/vendors-by-id])
|
[typeahead-v3 {:entities-by-id @(re-frame/subscribe [::subs/vendors-by-id])
|
||||||
:entity-index @(re-frame/subscribe [::subs/searchable-vendors-index])
|
:entity-index @(re-frame/subscribe [::subs/all-vendors-index])
|
||||||
:type "typeahead-v3"
|
:type "typeahead-v3"
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:entity->text (fn [x]
|
:entity->text (fn [x]
|
||||||
|
|||||||
Reference in New Issue
Block a user