mirror of
https://github.com/mruwnik/chicken-master.git
synced 2025-06-08 21:34:43 +02:00
clear inputs on click
This commit is contained in:
parent
4ddfa94318
commit
864d42949c
@ -72,7 +72,6 @@
|
||||
(html/input :notes "notka"
|
||||
{:default (:notes @state)}))
|
||||
(when (:products fields)
|
||||
(prn "Asd")
|
||||
[prod/products-edit (:products @state) :available-prods available-prods])]))))
|
||||
|
||||
(defn edit-order []
|
||||
|
@ -50,7 +50,6 @@
|
||||
(assoc db :settings settings))))
|
||||
|
||||
(defn change-setting [key val]
|
||||
(prn key val)
|
||||
(set-item! :settings (assoc (get-setting :settings) key val))
|
||||
(re-frame/dispatch [::change-setting key val]))
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
vals
|
||||
(group-by #(get-in % [:who :id])))]
|
||||
(for [{:keys [name id] :as who} @(re-frame/subscribe [::subs/available-customers])]
|
||||
[:details {:open true :class "client" :key (gensym)}
|
||||
[:details {:class "client" :key (gensym)}
|
||||
[:summary [:span name [:button {:on-click #(re-frame/dispatch
|
||||
[::event/confirm-action
|
||||
"na pewno usunąć?"
|
||||
|
@ -19,6 +19,7 @@
|
||||
{:type :number
|
||||
:default (round amount 3)
|
||||
:step :any
|
||||
:on-focus #(set! (-> % .-target .-value) "")
|
||||
:on-blur on-blur}))
|
||||
|
||||
(defn collect-products [raw-values]
|
||||
@ -53,6 +54,7 @@
|
||||
(defn products-edit [state & {:keys [available-prods getter-fn]
|
||||
:or {available-prods @(re-frame/subscribe [::subs/available-products])}}]
|
||||
(let [all-product-names (-> available-prods keys set)]
|
||||
(swap! state #(or % {}))
|
||||
(fn []
|
||||
(let [available (remove (partial get @state) all-product-names)
|
||||
product-names (if (seq available)
|
||||
|
@ -69,4 +69,7 @@
|
||||
(is (nil? (sut/get-group-products customers "mark"))))
|
||||
|
||||
(testing "missing customers are handled"
|
||||
(is (nil? (sut/get-group-products customers "bla bla bla")))))
|
||||
(is (nil? (sut/get-group-products customers "bla bla bla"))))
|
||||
|
||||
(testing "nil customers are handled"
|
||||
(is (nil? (sut/get-group-products customers nil)))))
|
||||
|
@ -27,15 +27,3 @@
|
||||
(is (= (sut/round 1.234567 1) 1.2))
|
||||
(is (= (sut/round 1.234567 2) 1.23))
|
||||
(is (= (sut/round 1.234567 3) 1.235))))
|
||||
|
||||
(deftest test-number-input
|
||||
(testing "proper format"
|
||||
(is (= (sut/number-input :id :label 12 nil)
|
||||
[:div {:class :input-item}
|
||||
[:label {:for :id} :label]
|
||||
[:input {:type :number :step :any :on-blur nil :defaultValue 12 :name :id :id :id}]])))
|
||||
(testing "numbers get rounded"
|
||||
(is (= (sut/number-input :id :label 12.123456789 nil)
|
||||
[:div {:class :input-item}
|
||||
[:label {:for :id} :label]
|
||||
[:input {:type :number :step :any :on-blur nil :defaultValue 12.123 :name :id :id :id}]]))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user