diff --git a/frontend/src/chicken_master/calendar.cljs b/frontend/src/chicken_master/calendar.cljs index 9f05630..7dc61d5 100644 --- a/frontend/src/chicken_master/calendar.cljs +++ b/frontend/src/chicken_master/calendar.cljs @@ -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 [] diff --git a/frontend/src/chicken_master/config.cljs b/frontend/src/chicken_master/config.cljs index dba4d4c..21fee24 100644 --- a/frontend/src/chicken_master/config.cljs +++ b/frontend/src/chicken_master/config.cljs @@ -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])) diff --git a/frontend/src/chicken_master/customers.cljs b/frontend/src/chicken_master/customers.cljs index 08c35a9..7c1abb4 100644 --- a/frontend/src/chicken_master/customers.cljs +++ b/frontend/src/chicken_master/customers.cljs @@ -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ąć?" diff --git a/frontend/src/chicken_master/products.cljs b/frontend/src/chicken_master/products.cljs index 12f9d89..c0159f7 100644 --- a/frontend/src/chicken_master/products.cljs +++ b/frontend/src/chicken_master/products.cljs @@ -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) diff --git a/frontend/test/chicken_master/calendar_test.cljs b/frontend/test/chicken_master/calendar_test.cljs index f505034..8e2f83c 100644 --- a/frontend/test/chicken_master/calendar_test.cljs +++ b/frontend/test/chicken_master/calendar_test.cljs @@ -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))))) diff --git a/frontend/test/chicken_master/products_test.cljs b/frontend/test/chicken_master/products_test.cljs index e8d1a62..c975f48 100644 --- a/frontend/test/chicken_master/products_test.cljs +++ b/frontend/test/chicken_master/products_test.cljs @@ -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}]]))))