This commit is contained in:
Bryce Covert
2020-04-27 09:30:30 -07:00
parent b89b4a86c5
commit 25f1cebe51
9 changed files with 196 additions and 127 deletions

View File

@@ -52,6 +52,7 @@
:yodlee-merchant :id :potential-payment-matches
:location :accounts :approval-status
:matched-rule])
(assoc :original-status (:approval-status which))
(assoc :potential-payment-matches (if (:matched-rule which)
nil
potential-payment-matches))
@@ -182,8 +183,11 @@
(let [change-event [::forms/change ::form]
{:keys [data] } @(re-frame/subscribe [::forms/form ::form])
locations @(re-frame/subscribe [::subs/locations-for-client (:id (:client data))])
{:keys [form field raw-field error-notification submit-button ]} transaction-form]
[form {:title "Hello" :edit-completed edit-completed}
{:keys [form field raw-field error-notification submit-button ]} transaction-form
is-admin? @(re-frame/subscribe [::subs/is-admin?])
should-disable-for-client? (and (not is-admin?)
(not= :requires-feedback (:original-status data)))]
[form {:title "Transaction" :edit-completed edit-completed}
(when (and @(re-frame/subscribe [::subs/is-admin?])
(get-in data [:yodlee-merchant]))
@@ -195,7 +199,7 @@
" - "
(get-in data [:yodlee-merchant :yodlee-id]))}]])
(when @(re-frame/subscribe [::subs/is-admin?])
(when is-admin?
[field "Matched Rule"
[:input.input {:type "text"
:field [:matched-rule :note]
@@ -209,16 +213,17 @@
:field [:description-original]
:disabled "disabled"}]]
(when (and (seq (:potential-transaction-rule-matches data))
(not (:matched-rule data))
(not (:payment data)))
(not (:payment data))
is-admin?)
[potential-transaction-rule-matches-box {:potential-transaction-rule-matches (:potential-transaction-rule-matches data)
:edit-completed edit-completed}])
(when (and (seq (:potential-payment-matches data))
(not (:payment data)))
(not (:payment data))
is-admin?)
[potential-payment-matches-box {:potential-payment-matches (:potential-payment-matches data)
:edit-completed edit-completed}])
@@ -231,14 +236,16 @@
:type "typeahead-entity"
:auto-focus true
:field [:vendor]
:disabled (boolean (:payment data))}]]
:disabled (or (boolean (:payment data))
should-disable-for-client?)}]]
[field nil
[expense-accounts-field
{:type "expense-accounts"
:field [:accounts]
:max (Math/abs (js/parseFloat (:amount data)))
:descriptor "credit account"
:disabled (boolean (:payment data))
:disabled (or (boolean (:payment data))
should-disable-for-client?)
:locations locations}]]
@@ -251,9 +258,11 @@
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]
[:excluded "Excluded from Ledger"]]}]]
[:excluded "Excluded from Ledger"]]
:disabled should-disable-for-client?}]]
[:hr]
[error-notification]
[submit-button "Save"]])])])
(when-not should-disable-for-client?
[submit-button "Save"])])])])