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"
|
(html/input :notes "notka"
|
||||||
{:default (:notes @state)}))
|
{:default (:notes @state)}))
|
||||||
(when (:products fields)
|
(when (:products fields)
|
||||||
(prn "Asd")
|
|
||||||
[prod/products-edit (:products @state) :available-prods available-prods])]))))
|
[prod/products-edit (:products @state) :available-prods available-prods])]))))
|
||||||
|
|
||||||
(defn edit-order []
|
(defn edit-order []
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
(assoc db :settings settings))))
|
(assoc db :settings settings))))
|
||||||
|
|
||||||
(defn change-setting [key val]
|
(defn change-setting [key val]
|
||||||
(prn key val)
|
|
||||||
(set-item! :settings (assoc (get-setting :settings) key val))
|
(set-item! :settings (assoc (get-setting :settings) key val))
|
||||||
(re-frame/dispatch [::change-setting key val]))
|
(re-frame/dispatch [::change-setting key val]))
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
vals
|
vals
|
||||||
(group-by #(get-in % [:who :id])))]
|
(group-by #(get-in % [:who :id])))]
|
||||||
(for [{:keys [name id] :as who} @(re-frame/subscribe [::subs/available-customers])]
|
(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
|
[:summary [:span name [:button {:on-click #(re-frame/dispatch
|
||||||
[::event/confirm-action
|
[::event/confirm-action
|
||||||
"na pewno usunąć?"
|
"na pewno usunąć?"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
{:type :number
|
{:type :number
|
||||||
:default (round amount 3)
|
:default (round amount 3)
|
||||||
:step :any
|
:step :any
|
||||||
|
:on-focus #(set! (-> % .-target .-value) "")
|
||||||
:on-blur on-blur}))
|
:on-blur on-blur}))
|
||||||
|
|
||||||
(defn collect-products [raw-values]
|
(defn collect-products [raw-values]
|
||||||
@ -53,6 +54,7 @@
|
|||||||
(defn products-edit [state & {:keys [available-prods getter-fn]
|
(defn products-edit [state & {:keys [available-prods getter-fn]
|
||||||
:or {available-prods @(re-frame/subscribe [::subs/available-products])}}]
|
:or {available-prods @(re-frame/subscribe [::subs/available-products])}}]
|
||||||
(let [all-product-names (-> available-prods keys set)]
|
(let [all-product-names (-> available-prods keys set)]
|
||||||
|
(swap! state #(or % {}))
|
||||||
(fn []
|
(fn []
|
||||||
(let [available (remove (partial get @state) all-product-names)
|
(let [available (remove (partial get @state) all-product-names)
|
||||||
product-names (if (seq available)
|
product-names (if (seq available)
|
||||||
|
@ -69,4 +69,7 @@
|
|||||||
(is (nil? (sut/get-group-products customers "mark"))))
|
(is (nil? (sut/get-group-products customers "mark"))))
|
||||||
|
|
||||||
(testing "missing customers are handled"
|
(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 1) 1.2))
|
||||||
(is (= (sut/round 1.234567 2) 1.23))
|
(is (= (sut/round 1.234567 2) 1.23))
|
||||||
(is (= (sut/round 1.234567 3) 1.235))))
|
(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