diff --git a/src/cljs/auto_ap/views/components.cljs b/src/cljs/auto_ap/views/components.cljs index c61bcd5c..95b93d8c 100644 --- a/src/cljs/auto_ap/views/components.cljs +++ b/src/cljs/auto_ap/views/components.cljs @@ -2,6 +2,7 @@ (:require [reagent.core :as r] [clojure.string :as str] [auto-ap.views.components.multi :as multi] + [auto-ap.views.components.money-field :as money] [auto-ap.views.components.number :as number])) @@ -38,3 +39,5 @@ (def multi-field-v2 multi/multi-field-v2) (def number-input number/number-input) + +(def money-input money/field) diff --git a/src/cljs/auto_ap/views/components/money_field.cljs b/src/cljs/auto_ap/views/components/money_field.cljs index 5b34c01d..b3079671 100644 --- a/src/cljs/auto_ap/views/components/money_field.cljs +++ b/src/cljs/auto_ap/views/components/money_field.cljs @@ -72,3 +72,6 @@ (defn money-field [] [:f> -money-field (r/props (r/current-component))]) + +(defn field [] + [:f> -money-field (r/props (r/current-component))]) diff --git a/src/cljs/auto_ap/views/pages/admin/clients/form.cljs b/src/cljs/auto_ap/views/pages/admin/clients/form.cljs index d26e0e2f..ad97d69f 100644 --- a/src/cljs/auto_ap/views/pages/admin/clients/form.cljs +++ b/src/cljs/auto_ap/views/pages/admin/clients/form.cljs @@ -618,56 +618,34 @@ [form-builder/section {:title "Cash Flow"} [:label.label (str "Week A (" next-week-a ")")] [left-stack - [form-builder/field + [form-builder/field-v2 {:field :week-a-credits} "Regular Credits" - [:input.input {:type "number" - :style {:width "10em"} - :placeholder "500.00" - :field [:week-a-credits] - :step "0.01"}]] - [form-builder/field + [com/money-input]] + [form-builder/field-v2 {:field :week-a-debits} "Regular Debits" - [:input.input {:type "number" - :style {:width "10em"} - :placeholder "150.00" - :field [:week-a-debits] - :step "0.01"}]]] + [com/money-input]]] [:label.label (str "Week B (" next-week-b ")")] [left-stack - [form-builder/field "Regular Credits" - [:input.input {:type "number" - :style {:width "10em"} - :placeholder "1000.00" - :field [:week-b-credits] - :step "0.01"}]] - [form-builder/field "Regular Debits" - [:input.input {:type "number" - :style {:width "10em"} - :placeholder "250.00" - :field [:week-b-debits] - :step "0.01"}]]] - [:div.field - [:label.label "Forecasted transactions"] + [form-builder/field-v2 {:field :week-b-credits} + "Regular Credits" + [com/money-input]] + [form-builder/field-v2 {:field :week-b-debits} + "Regular Debits" + [com/money-input]]] - [:div.control - [form-builder/raw-field - [multi-field {:type "multi-field" - :field :forecasted-transactions - :template [[:input.input {:type "text" - :placeholder "Identifier" - :style {:width "10em"} - :field [ :identifier]}] - [:input.input {:type "number" - :style {:width "8em"} - :placeholder "DOM" - :step "1" - :field [:day-of-month]}] - [:input.input {:type "number" - :placeholder "250.00" - :class "has-text-right" - :style {:width "7em"} - :field [:amount] - :step "0.01"}]]}]]]]])) + [form-builder/field-v2 {:field :forecasted-transactions} + "Forecasted transactions" + + [com/multi-field-v2 {:template [[form-builder/raw-field-v2 {:field :identifier} + [:input.input {:type "text" + :placeholder "Identifier" + :style {:width "10em"}}]] + [form-builder/raw-field-v2 {:field :day-of-month} + [com/number-input {:placeholder "DOM"}]] + [form-builder/raw-field-v2 {:field :amount + :placeholder "AMT"} + [com/money-input]]] + :key-fn :id}]]])) (defn square-section [] (let [{new-client :data} @(re-frame/subscribe [::forms/form ::form])]