diff --git a/notes.txt b/notes.txt new file mode 100644 index 00000000..f448f9f3 --- /dev/null +++ b/notes.txt @@ -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 diff --git a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs index b6b0d01b..8a330edb 100644 --- a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs +++ b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs @@ -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 {}]) }))