converted payments over

This commit is contained in:
Bryce Covert
2020-08-18 08:09:40 -07:00
parent 0c93e84cd2
commit 44dab34240
6 changed files with 84 additions and 209 deletions

View File

@@ -1,12 +1,10 @@
(ns auto-ap.views.pages.unpaid-invoices
(:require [auto-ap.entities.invoice :as invoice]
(:require [auto-ap.effects.forward :as forward]
[auto-ap.events :as events]
[auto-ap.forms :as forms]
[auto-ap.status :as status]
[auto-ap.subs :as subs]
[auto-ap.utils :refer [by merge-by replace-if]]
[auto-ap.views.components.dropdown :refer [drop-down]]
[auto-ap.effects.forward :as forward]
[auto-ap.views.components.expense-accounts-dialog
:as
expense-accounts-dialog]
@@ -19,15 +17,15 @@
[auto-ap.views.components.layouts
:refer
[appearing-side-bar side-bar-layout]]
[auto-ap.views.components.modal :as modal :refer [modal]]
[auto-ap.views.components.modal :as modal]
[auto-ap.views.pages.data-page :as data-page]
[auto-ap.views.pages.invoices.advanced-print-checks :as advanced-print-checks]
[auto-ap.views.pages.invoices.handwritten-checks :as handwritten-checks]
[auto-ap.views.pages.invoices.common :refer [invoice-read does-amount-exceed-outstanding?]]
[auto-ap.views.pages.invoices.advanced-print-checks
:as
advanced-print-checks]
[auto-ap.views.pages.invoices.common :refer [invoice-read]]
[auto-ap.views.pages.invoices.form :as form]
[auto-ap.views.utils
:refer
[date-picker dispatch-event horizontal-field with-user]]
[auto-ap.views.pages.invoices.handwritten-checks :as handwritten-checks]
[auto-ap.views.utils :refer [dispatch-event with-user]]
[clojure.set :as set]
[clojure.string :as str]
[goog.string :as gstring]
@@ -46,14 +44,12 @@
(let [result (set/rename-keys (first (:invoice-page result))
{:invoices :data})]
[::data-page/received :invoices result]))
:on-error [::events/page-failed]}}))
[::data-page/received :invoices result]))}}))
(re-frame/reg-event-fx
::unmounted
(fn [{:keys [db]} _]
{:db (dissoc db ::table/table-params ::side-bar/filters ::side-bar/settled-filters ::last-params)
:dispatch [::data-page/dispose :invoices]
{:dispatch [::data-page/dispose :invoices]
::forward/dispose [{:id ::updated}
{:id ::checks-printed}]
::track/dispose [{:id ::params}]}))
@@ -61,7 +57,6 @@
(re-frame/reg-event-fx
::mounted
(fn [{:keys [db]} _]
(println "MOUNTING")
{::track/register [{:id ::params
:subscription [::data-page/params :invoices]
:event-fn (fn [params]
@@ -136,11 +131,11 @@
checked-invoices (vals @(re-frame/subscribe [::data-page/checked :invoices]))]
[:div
[:div.is-pulled-right
[:div.buttons
[:div.buttons
[:button.button.is-success {:on-click (dispatch-event [::new-invoice-clicked])} "New Invoice"]
(when current-client
[drop-down {:header [:button.button.is-success {:aria-haspopup true
:on-click (dispatch-event [::events/toggle-menu ::print-checks ])
:on-click (dispatch-event [::events/toggle-menu ::print-checks ])
:disabled (if (and (seq checked-invoices))
""
"disabled")
@@ -148,7 +143,7 @@
:class (status/class-for @(re-frame/subscribe [::status/single ::print-checks]))}
"Pay "
(when (> (count checked-invoices ))
(str
(str
(count checked-invoices)
" invoices "
"(" (->> checked-invoices
@@ -160,7 +155,7 @@
[:span.icon.is-small [:i.fa.fa-angle-down {:aria-hidden "true"}]]]
:id ::print-checks
:is-right? true}
[:div
[:div
(list
(for [{:keys [id number name type]} (->> (:bank-accounts current-client) (filter :visible) (sort-by :sort-order))]
(if (= :cash type)