more migrating onto v2

This commit is contained in:
2022-07-21 12:55:55 -07:00
parent 22a5f2a707
commit 1d0cdcaf88
6 changed files with 122 additions and 85 deletions

View File

@@ -10,7 +10,8 @@
[clojure.string :as str]
[goog.string :as gstring]
[re-frame.core :as re-frame]
[auto-ap.forms.builder :as form-builder]))
[auto-ap.forms.builder :as form-builder]
[auto-ap.views.components :as com]))
(re-frame/reg-event-fx
::try-save
@@ -28,6 +29,7 @@
%))
(reduce + 0))
does-add-up? (< (Math/abs (- expense-accounts-total (js/parseFloat total))) 0.001)]
(if (and does-add-up?
(every? :new-amount expense-accounts))
@@ -113,14 +115,12 @@
^{:key id}
[:tr
[:td.expandable [:div.control
[form-builder/raw-field
[form-builder/raw-field-v2 {:field [:expense-accounts id :account]}
[search-backed-typeahead {:search-query (fn [i]
[:search_account
{:query i
:client-id (:id client)}
[:name :id :location]])
:type "typeahead-v3"
:field [:expense-accounts id :account]}]]]]
[:name :id :location]])}]]]]
(when multi-location?
[:td
@@ -129,11 +129,10 @@
[:select {:disabled "disabled" :value forced-location} [:option {:value forced-location} forced-location]]]
[:div.select
[form-builder/raw-field
[:select {:type "select"
:field [:expense-accounts id :location]
:spec (set locations)}
(map (fn [l] ^{:key l} [:option {:value l} l]) locations)]]])])
[form-builder/raw-field-v2 {:field [:expense-accounts id :location]}
[com/select-field {:options (map (fn [l] [l l])
locations)
:allow-nil? true}]]])])
[:td
(str "$" (get-in expense-accounts [id :amount]))]
@@ -142,9 +141,8 @@
[:div.field.has-addons.is-extended
[:p.control [:a.button.is-static "$"]]
[:p.control
[form-builder/raw-field
[form-builder/raw-field-v2 {:field [:expense-accounts id :new-amount-temp]}
[:input.input {:type "number"
:field [:expense-accounts id :new-amount-temp]
:style {:text-align "right"}
:on-blur (dispatch-event [::forms/change ::form [:expense-accounts id :new-amount] (get-in expense-accounts [id :new-amount-temp])])
:on-key-down (fn [e ]

View File

@@ -13,7 +13,6 @@
(let [prop-value (if (seq prop-value)
prop-value
[])]
(println "PROP VALUE IS")
[form-builder/virtual-builder {:value prop-value
:schema schema
:on-change on-change}
@@ -69,7 +68,7 @@
(defn multi-field-v2 []
(into
(into
[:f> multi-field-v2-internal
(reagent/props (reagent/current-component))]
(reagent/children (reagent/current-component))))