tons of bug fixes.
This commit is contained in:
@@ -222,119 +222,120 @@
|
||||
(defn form [{:keys [can-change-amount?] :as params}]
|
||||
[layouts/side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])}
|
||||
(let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::form])
|
||||
{:keys [form field raw-field error-notification submit-button ]} rule-form
|
||||
{:keys [form-inline field raw-field error-notification submit-button ]} rule-form
|
||||
default-note @(re-frame/subscribe [::default-note])
|
||||
exists? (:id data)]
|
||||
^{:key id}
|
||||
[form (assoc params :title "New Transaction Rule")
|
||||
|
||||
(form-inline (assoc params :title "New Transaction Rule")
|
||||
[:<>
|
||||
|
||||
|
||||
[field "Client"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
|
||||
:auto-focus true
|
||||
:match->text :name
|
||||
:type "typeahead-entity"
|
||||
:field [:client]
|
||||
:spec ::entity/client}]]
|
||||
(field "Client"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
|
||||
:auto-focus true
|
||||
:match->text :name
|
||||
:type "typeahead-entity"
|
||||
:field [:client]
|
||||
:spec ::entity/client}])
|
||||
|
||||
[field "Bank account"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/real-bank-accounts-for-client (:client data)])
|
||||
:match->text :name
|
||||
:type "typeahead-entity"
|
||||
:field [:bank-account]
|
||||
:spec ::entity/bank-account}]]
|
||||
(field "Bank account"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/real-bank-accounts-for-client (:client data)])
|
||||
:match->text :name
|
||||
:type "typeahead-entity"
|
||||
:field [:bank-account]
|
||||
:spec ::entity/bank-account}])
|
||||
|
||||
[field "Yodlee Merchant"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/yodlee-merchants])
|
||||
:match->text #(do (println %) (str (:name %) " - " (:yodlee-id %)))
|
||||
:type "typeahead-entity"
|
||||
:field [:yodlee-merchant]}]]
|
||||
(field "Yodlee Merchant"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/yodlee-merchants])
|
||||
:match->text #(str (:name %) " - " (:yodlee-id %))
|
||||
:type "typeahead-entity"
|
||||
:field [:yodlee-merchant]}])
|
||||
|
||||
[field [:span "Description (" [:a {:href "https://regex101.com" :target "_new"} "regex tester"] ")" ]
|
||||
[:input.input {:type "text"
|
||||
:field [:description]
|
||||
:spec ::entity/description}]]
|
||||
(field [:span "Description (" [:a {:href "https://regex101.com" :target "_new"} "regex tester"] ")" ]
|
||||
[:input.input {:type "text"
|
||||
:field [:description]
|
||||
:spec ::entity/description}])
|
||||
|
||||
[:div.field
|
||||
[:p.help "Amount"]
|
||||
[:div.control
|
||||
[:div.columns
|
||||
[:div.column
|
||||
[raw-field
|
||||
[:input.input {:type "number"
|
||||
:placeholder ">="
|
||||
:field [:amount-gte]
|
||||
:spec ::entity/amount-gte
|
||||
:step "0.01"}]]]
|
||||
[:div.column
|
||||
[raw-field
|
||||
[:input.input {:type "number"
|
||||
:placeholder "<="
|
||||
:field [:amount-lte]
|
||||
:spec ::entity/amount-lte
|
||||
:step "0.01"}]]]]]]
|
||||
[:div.field
|
||||
[:p.help "Amount"]
|
||||
[:div.control
|
||||
[:div.columns
|
||||
[:div.column
|
||||
(raw-field
|
||||
[:input.input {:type "number"
|
||||
:placeholder ">="
|
||||
:field [:amount-gte]
|
||||
:spec ::entity/amount-gte
|
||||
:step "0.01"}])]
|
||||
[:div.column
|
||||
(raw-field
|
||||
[:input.input {:type "number"
|
||||
:placeholder "<="
|
||||
:field [:amount-lte]
|
||||
: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"}]]]]]]
|
||||
[: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"}])]]]]
|
||||
|
||||
|
||||
|
||||
|
||||
[:h2.title.is-4 "Outcomes"]
|
||||
[:h2.title.is-4 "Outcomes"]
|
||||
|
||||
[field "Assign Vendor"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/all-vendors])
|
||||
:match->text :name
|
||||
:type "typeahead-entity"
|
||||
:field [:vendor]
|
||||
:spec ::entity/vendor}]]
|
||||
(field "Assign Vendor"
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/all-vendors])
|
||||
:match->text :name
|
||||
:type "typeahead-entity"
|
||||
:field [:vendor]
|
||||
:spec ::entity/vendor}])
|
||||
|
||||
[field nil
|
||||
[expense-accounts-field {:type "expense-accounts"
|
||||
:descriptor "account asssignment"
|
||||
:percentage-only? true
|
||||
:client (:client data)
|
||||
:locations (into ["Shared"] @(re-frame/subscribe [::subs/locations-for-client-or-bank-account (:id (:client data)) (:id (:bank-account data))]))
|
||||
:max 100
|
||||
:field [:accounts]}]]
|
||||
(field nil
|
||||
[expense-accounts-field {:type "expense-accounts"
|
||||
:descriptor "account asssignment"
|
||||
:percentage-only? true
|
||||
:client (:client data)
|
||||
:locations (into ["Shared"] @(re-frame/subscribe [::subs/locations-for-client-or-bank-account (:id (:client data)) (:id (:bank-account data))]))
|
||||
:max 100
|
||||
:field [:accounts]}])
|
||||
|
||||
[field "Approval Status"
|
||||
[button-radio
|
||||
{:type "button-radio"
|
||||
:field [:transaction-approval-status]
|
||||
:options [[:unapproved "Unapproved"]
|
||||
[:requires-feedback "Client Review"]
|
||||
[:approved "Approved"]
|
||||
[:excluded "Excluded from Ledger"]]}]]
|
||||
(field "Approval Status"
|
||||
[button-radio
|
||||
{:type "button-radio"
|
||||
:field [:transaction-approval-status]
|
||||
:options [[:unapproved "Unapproved"]
|
||||
[:requires-feedback "Client Review"]
|
||||
[:approved "Approved"]
|
||||
[:excluded "Excluded from Ledger"]]}])
|
||||
|
||||
[field "Note"
|
||||
[:input.input {:type "text"
|
||||
:field [:note]
|
||||
:placeholder default-note
|
||||
:spec (s/nilable ::entity/note)}]]
|
||||
(field "Note"
|
||||
[:input.input {:type "text"
|
||||
:field [:note]
|
||||
:placeholder default-note
|
||||
:spec (s/nilable ::entity/note)}])
|
||||
|
||||
[:div.is-divider]
|
||||
[error-notification]
|
||||
[:div.is-divider]
|
||||
(error-notification)
|
||||
|
||||
[:div.columns
|
||||
[:div.column
|
||||
[:a.button.is-medium.is-fullwidth.is-outlined {:on-click (dispatch-event [::test-clicked])} "Test Rule"]]
|
||||
[:div.column
|
||||
[submit-button "Save"]]]])])
|
||||
[:div.columns
|
||||
[:div.column
|
||||
[:a.button.is-medium.is-fullwidth.is-outlined {:on-click (dispatch-event [::test-clicked])} "Test Rule"]]
|
||||
[:div.column
|
||||
(submit-button "Save")]]]))])
|
||||
|
||||
@@ -118,7 +118,10 @@
|
||||
(re-frame/reg-event-fx
|
||||
::authenticated
|
||||
(fn [{:keys [db]} [_ authentication]]
|
||||
{:dispatch [::mounted]}))
|
||||
{:db (-> db
|
||||
(assoc-in [::yodlee :authentication] authentication)
|
||||
(assoc-in [::yodlee :loading?] false))}
|
||||
))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::save-error
|
||||
|
||||
Reference in New Issue
Block a user