(ns auto-ap.views.components.number-filter
  (:require
   [re-frame.core :as re-frame]
   [auto-ap.forms.builder :as form-builder]
   [auto-ap.views.components :as com]))

(defn number-filter [{:keys [value on-change-event]}]
  [form-builder/virtual-builder {:value     (or value {})
                                 :on-change (fn [v]
                                              (re-frame/dispatch (conj on-change-event v)))}
   
   [:div.columns  {:style {:width "80%"}}
    [:div.column 
     [:div.control 
      [form-builder/raw-field-v2 {:field :amount-gte}
       [com/money-input {:placeholder ">="}]]]]
    [:div.column
     [:div.control 
      [form-builder/raw-field-v2 {:field :amount-lte}
       [com/money-input {:placeholder "<="}]]]]
    [:div.column]]]
  )
