adding day of month.

This commit is contained in:
Bryce Covert
2019-05-09 23:32:43 -07:00
parent 0520e2f0f8
commit 16a3b14844
8 changed files with 95 additions and 21 deletions

View File

@@ -37,6 +37,8 @@
:description
:amount-lte
:amount-gte
:dom-lte
:dom-gte
:note])
(assoc :client-id (:id (:client data)))
(assoc :bank-account-id (:id (:bank-account data))))}
@@ -54,6 +56,8 @@
:description
:amount-lte
:amount-gte
:dom-lte
:dom-gte
:note])
(assoc :client-id (:id (:client data)))
(assoc :bank-account-id (:id (:bank-account data))))}
@@ -80,8 +84,7 @@
:bank-account nil
:note nil
:amount-lte nil
:amount-gte nil
)))))
:amount-gte nil)))))
(re-frame/reg-event-db
::editing
@@ -156,14 +159,13 @@
accounts-by-id @(re-frame/subscribe [::subs/accounts-for-client-by-id])]
^{:key id}
[form (assoc params :title "New Transaction Rule")
(when-not @(re-frame/subscribe [::subs/client])
[field "Client"
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
:match->text :name
:type "typeahead-entity"
:auto-focus (if @(re-frame/subscribe [::subs/client]) false true)
:field [:client]
:spec ::entity/client}]])
[field "Client"
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
:match->text :name
:type "typeahead-entity"
:auto-focus (if @(re-frame/subscribe [::subs/client]) false true)
:field [:client]
:spec ::entity/client}]]
[field "Bank account"
[typeahead-entity {:matches @(re-frame/subscribe [::subs/real-bank-accounts-for-client (:client data)])
@@ -197,6 +199,27 @@
:spec ::entity/amount-lte
:step "0.01"}]]]]]]
[:div.field
[:p.help "Day of Month"]
[:div.control
[:div.columns
[:div.column
[raw-field
[:input.input {:type "number"
:placeholder ">="
:field [:dom-gte]
:spec ::entity/dom-gte
:precision 0
:step "1"}]]]
[:div.column
[raw-field
[:input.input {:type "number"
:placeholder "<="
:field [:dom-lte]
:spec ::entity/dom-lte
:precision 0
:step "1"}]]]]]]
[field "Note"
[:input.input {:type "text"
:field [:note]

View File

@@ -41,14 +41,15 @@
:asc asc}
"Description"]
[sorted-column {:on-sort opc
#_[sorted-column {:on-sort opc
:style {:width "8em" :cursor "pointer"}
:class "has-text-right"
:sort-key "amount-gte"
:sort-by sort-by
:asc asc}
">="]
[sorted-column {:on-sort opc
"Amount"]
[:th.has-text-right {:style {:width "12em"}} "Amount"]
#_[sorted-column {:on-sort opc
:class "has-text-right"
:style {:width "8em" :cursor "pointer"}
:sort-key "amount-lte"
@@ -75,8 +76,18 @@
[:td (:name client)]
[:td (:name bank-account)]
[:td description]
[:td.has-text-right (some-> amount-gte ->$) ]
[:td.has-text-right (some-> amount-lte ->$)]
[:td.has-text-right
(cond (and amount-gte amount-lte)
(str (->$ amount-gte) " - " (->$ amount-lte))
amount-gte
(str ">=" (->$ amount-gte))
amount-lte
(str "<=" (->$ amount-lte))
:else
"")]
[:td note]
[:td
[:a.button {:on-click (dispatch-event [::form/editing r])} [:span.icon [:i.fa.fa-pencil]]]]]))]]]))))

View File

@@ -201,8 +201,13 @@
(re-frame/dispatch (-> event
(conj field)
(conj (let [val (.. e -target -value)]
(if (and val (not (str/blank? val)))
(cond (and val (not (str/blank? val)))
(js/parseFloat val)
(str/blank? val )
nil
:else
val))))))
:value (get-in subscription field)