This commit is contained in:
2021-11-05 16:51:42 -07:00
parent f20751a9b4
commit 32eded1f9c

View File

@@ -336,117 +336,119 @@
should-disable-for-client? (and (not (or is-admin? is-power-user?))
(not= :requires-feedback (:original-status data)))
is-already-matched? (:payment data)]
(form-inline {:title "Transaction"}
[:<>
(with-meta
(form-inline {:title "Transaction"}
[:<>
(when (and @(re-frame/subscribe [::subs/is-admin?])
(get-in data [:yodlee-merchant]))
[:div.control
[:p.help "Merchant"]
[:input.input {:type "text"
:disabled true
:value (str (get-in data [:yodlee-merchant :name])
" - "
(get-in data [:yodlee-merchant :yodlee-id]))}]])
(when (and @(re-frame/subscribe [::subs/is-admin?])
(get-in data [:yodlee-merchant]))
[:div.control
[:p.help "Merchant"]
[:input.input {:type "text"
:disabled true
:value (str (get-in data [:yodlee-merchant :name])
" - "
(get-in data [:yodlee-merchant :yodlee-id]))}]])
(when is-admin?
(field "Matched Rule"
[:input.input {:type "text"
:field [:matched-rule :note]
:disabled "disabled"}]))
(field "Amount"
[:input.input {:type "text"
:field [:amount]
:disabled "disabled"}])
(field "Description"
[:input.input {:type "text"
:field [:description-original]
:disabled "disabled"}])
(when is-admin?
(field "Matched Rule"
[:input.input {:type "text"
:field [:matched-rule :note]
:disabled "disabled"}]))
(field "Amount"
[:input.input {:type "text"
:field [:amount]
:disabled "disabled"}])
(field "Description"
[:input.input {:type "text"
:field [:description-original]
:disabled "disabled"}])
(field "Date"
[:input.input {:type "text"
:field [:date]
:disabled "disabled"}])
(field "Date"
[:input.input {:type "text"
:field [:date]
:disabled "disabled"}])
(when (and (:payment data)
(or is-admin? is-power-user?))
[:p.notification.is-info.is-light>div.level>div.level-left
[:div.level-item "This transaction is linked to a payment "]
[:div.level-item [:button.button.is-warning {:on-click (dispatch-event [::unlink])} "Unlink"]]])
[tabs {:default-tab :details}
(when
(and (seq (:potential-transaction-rule-matches data))
(not (:matched-rule data))
is-admin?)
[tab {:title "Transaction Rule" :key :transaction-rule}
[potential-transaction-rule-matches-box {:potential-transaction-rule-matches (:potential-transaction-rule-matches data)}]])
(when
(and (seq (:potential-autopay-invoices-matches data))
(not is-already-matched?)
(or is-admin? is-power-user?))
[tab {:title "Autopay Invoices" :key :autopay-invoices}
[potential-autopay-invoices-matches-box {:potential-autopay-invoices-matches (:potential-autopay-invoices-matches data)}]])
(when (and (:payment data)
(or is-admin? is-power-user?))
[:p.notification.is-info.is-light>div.level>div.level-left
[:div.level-item "This transaction is linked to a payment "]
[:div.level-item [:button.button.is-warning {:on-click (dispatch-event [::unlink])} "Unlink"]]])
[tabs {:default-tab :details}
(when
(and (seq (:potential-transaction-rule-matches data))
(not (:matched-rule data))
is-admin?)
[tab {:title "Transaction Rule" :key :transaction-rule}
[potential-transaction-rule-matches-box {:potential-transaction-rule-matches (:potential-transaction-rule-matches data)}]])
(when
(and (seq (:potential-autopay-invoices-matches data))
(not is-already-matched?)
(or is-admin? is-power-user?))
[tab {:title "Autopay Invoices" :key :autopay-invoices}
[potential-autopay-invoices-matches-box {:potential-autopay-invoices-matches (:potential-autopay-invoices-matches data)}]])
(when
(and (seq (:potential-unpaid-invoices-matches data))
(not is-already-matched?)
(or is-admin? is-power-user?))
[tab {:title "Unpaid Invoices" :key :unpaid-invoices}
[potential-unpaid-invoices-matches-box {:potential-unpaid-invoices-matches (:potential-unpaid-invoices-matches data)}]])
(when
(and (seq (:potential-unpaid-invoices-matches data))
(not is-already-matched?)
(or is-admin? is-power-user?))
[tab {:title "Unpaid Invoices" :key :unpaid-invoices}
[potential-unpaid-invoices-matches-box {:potential-unpaid-invoices-matches (:potential-unpaid-invoices-matches data)}]])
(when
(and (seq (:potential-payment-matches data))
(not is-already-matched?)
(or is-admin? is-power-user?))
[tab {:title "Payment" :key :payment}
[potential-payment-matches-box {:potential-payment-matches (:potential-payment-matches data)}]])
(when
(and (seq (:potential-payment-matches data))
(not is-already-matched?)
(or is-admin? is-power-user?))
[tab {:title "Payment" :key :payment}
[potential-payment-matches-box {:potential-payment-matches (:potential-payment-matches data)}]])
[tab {:title "Details" :key :details}
[:div
(field "Vendor"
[typeahead-v3 {:entities-by-id @(re-frame/subscribe [::subs/vendors-by-id])
:entity-index @(re-frame/subscribe [::subs/searchable-vendors-index])
:entity->text :name
:type "typeahead-v3"
:auto-focus true
:field [:vendor]
:disabled (or (boolean (:payment data))
should-disable-for-client?)}])
(with-meta
(field nil
[expense-accounts-field
{:type "expense-accounts"
:field [:accounts]
:max (Math/abs (js/parseFloat (:amount data)))
:descriptor "credit account"
:disabled (or (boolean (:payment data))
should-disable-for-client?)
:locations locations}])
{:key (str (:id (:vendor data)))})
[tab {:title "Details" :key :details}
[:div
(field "Vendor"
[typeahead-v3 {:entities-by-id @(re-frame/subscribe [::subs/vendors-by-id])
:entity-index @(re-frame/subscribe [::subs/searchable-vendors-index])
:entity->text :name
:type "typeahead-v3"
:auto-focus true
:field [:vendor]
:disabled (or (boolean (:payment data))
should-disable-for-client?)}])
(with-meta
(field nil
[expense-accounts-field
{:type "expense-accounts"
:field [:accounts]
:max (Math/abs (js/parseFloat (:amount data)))
:descriptor "credit account"
:disabled (or (boolean (:payment data))
should-disable-for-client?)
:locations locations}])
{:key (str (:id (:vendor data)))})
(field "Approval Status"
[button-radio
{:type "button-radio"
:field [:approval-status]
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]
[:excluded "Excluded from Ledger"]]
:disabled should-disable-for-client?}])
(field "Approval Status"
[button-radio
{:type "button-radio"
:field [:approval-status]
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]
[:excluded "Excluded from Ledger"]]
:disabled should-disable-for-client?}])
(field "Forecasted-transaction"
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/forecasted-transactions-for-client (:id (:client data))])
:entity->text :identifier
:type "typeahead-v3"
:field [:forecast-match]}])
(error-notification)
(when-not should-disable-for-client?
(submit-button "Save"))]]]]))])
(field "Forecasted-transaction"
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/forecasted-transactions-for-client (:id (:client data))])
:entity->text :identifier
:type "typeahead-v3"
:field [:forecast-match]}])
(error-notification)
(when-not should-disable-for-client?
(submit-button "Save"))]]]])
{:key (:id data)}))])