outstanding balance and addresses.

This commit is contained in:
Bryce Covert
2018-05-17 19:37:50 -07:00
parent 7b7275f7a4
commit e055a1e120
19 changed files with 351 additions and 98 deletions

View File

@@ -57,7 +57,9 @@
(fn [{:keys [db]} [_ bank-account-id]]
(let [invoice-amounts (by :id :total (get-in db [::invoice-page :invoices]))]
{
:db (assoc-in db [::invoice-page :print-checks-shown?] false )
:db (-> db
(assoc-in [::invoice-page :print-checks-shown?] false )
(assoc-in [::invoice-page :print-checks-loading?] true ))
:graphql
{:token (-> db :user)
@@ -71,7 +73,7 @@
(get-in db [::invoice-page :checked]))
:bank_account_id bank-account-id
:company_id (:company db)}
[[:invoices [:id [:checks [:amount [:check [:amount :s3_url :check_number ]]]]]]
[[:invoices [:id :outstanding-balance [:checks [:amount [:check [:amount :s3_url :check_number ]]]]]]
:pdf_url]]]}
:on-success [::checks-created]}})))
@@ -88,7 +90,8 @@
(map (fn [i]
(merge i (invoices-by-id (:id i))))
invoices)))
(assoc-in [::invoice-page :checked] nil))})))
(assoc-in [::invoice-page :checked] nil)
(assoc-in [::invoice-page :print-checks-loading?] false))})))
(re-frame/reg-event-fx
::invalidated
@@ -98,7 +101,7 @@
(def unpaid-invoices-page
(with-meta
(fn []
(let [{:keys [checked print-checks-shown?]} @(re-frame/subscribe [::invoice-page])
(let [{:keys [checked print-checks-shown? print-checks-loading?]} @(re-frame/subscribe [::invoice-page])
current-company @(re-frame/subscribe [::subs/company])]
[:div
[:h1.title "Unpaid invoices"]
@@ -108,12 +111,17 @@
"is-active"
"")}
[:div.dropdown-trigger
[:button.button {:aria-haspopup true
:on-click (dispatch-event [::print-checks-clicked ])
:disabled (if (seq checked)
""
"disabled")
} "Print checks "
[:button.button.is-success {:aria-haspopup true
:on-click (dispatch-event [::print-checks-clicked ])
:disabled (if (seq checked)
""
"disabled")
:class (if print-checks-loading?
"is-loading"
"")
}
"Print checks "
[:span.icon.is-small [:i.fa.fa-angle-down {:aria-hidden "true"}]]]]
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content