advanced printing.

This commit is contained in:
Bryce Covert
2018-05-22 19:26:38 -07:00
parent 120206d9b2
commit 2c42146a3d
2 changed files with 26 additions and 2 deletions

7
notes.txt Normal file
View File

@@ -0,0 +1,7 @@
1) Aligning checks
2) popup blocker -- disable
3) Splitting accounts
4) Permissions per location
5) List of payments
6) add payment
7) add invoice

View File

@@ -21,6 +21,10 @@
(fn [db]
(-> db ::advanced-print-checks)))
(re-frame/reg-sub
::check-results
(fn [db]
(-> db ::check-results)))
(re-frame/reg-sub
::params
@@ -76,6 +80,11 @@
(fn [db _]
(assoc-in db [::advanced-print-checks :shown?] false )))
(re-frame/reg-event-db
::close-check-results
(fn [db _]
(assoc-in db [::check-results :shown?] false )))
(re-frame/reg-event-db
::edit-payment-bank-account
(fn [db [_ f v]]
@@ -147,7 +156,7 @@
(fn [{:keys [db]} [_ data]]
(let [{{:keys [pdf-url invoices]} :print-checks} data
invoices-by-id (by :id invoices) ]
{:new-window pdf-url
{
:db (-> db
(update-in [::invoice-page :invoices]
(fn [invoices]
@@ -158,6 +167,8 @@
(assoc-in [::invoice-page :print-checks-loading?] false)
(assoc-in [::advanced-print-checks :printing?] false)
(assoc-in [::advanced-print-checks :shown?] false)
(assoc-in [::check-results :shown?] true)
(assoc-in [::check-results :pdf-url] pdf-url)
)})))
(re-frame/reg-event-fx
@@ -217,7 +228,8 @@
(with-meta
(fn []
(let [{:keys [checked print-checks-shown? print-checks-loading? advanced-print-shown?]} @(re-frame/subscribe [::invoice-page])
current-company @(re-frame/subscribe [::subs/company])]
current-company @(re-frame/subscribe [::subs/company])
{check-results-shown? :shown? pdf-url :pdf-url} @(re-frame/subscribe [::check-results])]
[:div
[:h1.title "Unpaid invoices"]
[:div.is-pulled-right
@@ -256,5 +268,10 @@
(re-frame/dispatch [::toggle-check which]))}]
[modal-dialog]
(when check-results-shown?
[modal
{:title "Your checks are ready!"
:hide-event [::close-check-results]}
[:div "Click " [:a {:href pdf-url :target "_new"} "here"] " to print them."]])
]))
{:component-will-mount #(re-frame/dispatch-sync [::params-change {}]) }))