ux improvements for erros.

This commit is contained in:
Bryce Covert
2019-02-20 11:39:19 -08:00
parent 91d9ea346d
commit 985b5339af
12 changed files with 134 additions and 56 deletions

View File

@@ -12,7 +12,7 @@
[auto-ap.views.components.typeahead :refer [typeahead]]
[auto-ap.views.components.paginator :refer [paginator]]
[auto-ap.events :as events]
[auto-ap.views.utils :refer [dispatch-event date->str bind-field]]
[auto-ap.views.utils :refer [dispatch-event date->str bind-field nf]]
[auto-ap.utils :refer [by]]
[auto-ap.views.pages.check :as check]
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
@@ -45,7 +45,8 @@
:total
:start
:end]]]}
:on-success [::received]}}))
:on-success [::received]
:on-error [::events/page-failed]}}))
(re-frame/reg-event-fx
::void-check
@@ -145,6 +146,7 @@
"Date"]
[sorted-column {:on-sort opc
:style {:width "8em" :cursor "pointer"}
:class "has-text-right"
:sort-key "amount"
:sort-by sort-by
:asc asc}
@@ -176,7 +178,7 @@
(= :debit type) "Debit"
:else check-number)]
[:td (date->str date) ]
[:td (gstring/format "$%.2f" amount )]
[:td.has-text-right (nf amount )]
[:td status]
[:td
(when (or (= :pending status)

View File

@@ -10,7 +10,7 @@
[auto-ap.views.components.layouts :refer [side-bar-layout]]
[auto-ap.views.components.bank-account-filter :refer [bank-account-filter]]
[auto-ap.events :as events]
[auto-ap.views.utils :refer [dispatch-event date->str bind-field]]
[auto-ap.views.utils :refer [dispatch-event date->str bind-field nf]]
[auto-ap.utils :refer [by]]
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
[auto-ap.subs :as subs]))
@@ -114,6 +114,7 @@
[sorted-column {:on-sort opc
:style {:width "8em" :cursor "pointer"}
:sort-key "amount"
:class "has-text-right"
:sort-by sort-by
:asc asc}
"Amount"]
@@ -142,7 +143,7 @@
[:td (:name client)])
[:td description-original]
[:td (date->str date) ]
[:td (gstring/format "$%.2f" amount )]
[:td.has-text-right (nf amount )]
[:td status]
[:td (:name bank-account )]
[:td (:yodlee-account-id bank-account )]

View File

@@ -79,7 +79,11 @@
(assoc-in [::params] params))
:graphql {:token (-> cofx :db :user)
:query-obj (invoice-table/query (-> params (assoc :import-status "imported") (dissoc :invoice-number-like-current)) )
:on-success [::received]}}))
:on-success [::received]
:on-error [::events/page-failed]}}))
(re-frame/reg-event-db
::unmount-invoices
(fn [db [_ data]]
@@ -805,15 +809,14 @@
(defn unpaid-invoices-content [{:keys [status]}]
(r/create-class {:display-name "unpaid-invoices-content"
:component-will-unmount (fn [this]
(re-frame/dispatch [::unmount-invoices])
)
(re-frame/dispatch [::unmount-invoices]))
:reagent-render (fn [{:keys [status]}]
(let [{:keys [checked print-checks-shown? print-checks-loading? advanced-print-shown? vendor-filter]} @(re-frame/subscribe [::invoice-page])
current-client @(re-frame/subscribe [::subs/client])
{check-results-shown? :shown? pdf-url :pdf-url} @(re-frame/subscribe [::check-results])]
[:div
[:h1.title (str (str/capitalize status) " invoices")]
(when (= status "unpaid")
[pay-button {:print-checks-shown? print-checks-shown? :checked-invoices checked :print-checks-loading? print-checks-loading?}])