more reorg

This commit is contained in:
Bryce Covert
2019-01-24 19:10:07 -08:00
parent 5b10541c44
commit c2eb0c61e7
13 changed files with 258 additions and 237 deletions

View File

@@ -9,7 +9,7 @@
[auto-ap.entities.invoice :as invoice]
[auto-ap.entities.vendors :as vendor]
[bidi.bidi :as bidi]
[auto-ap.views.main :refer [side-bar-layout]]
[auto-ap.views.components.layouts :refer [side-bar-layout]]
[auto-ap.routes :as routes]
[auto-ap.views.components.expense-accounts-dialog :as expense-accounts-dialog]
[auto-ap.views.components.vendor-dialog :refer [vendor-dialog]]
@@ -681,30 +681,28 @@
updated))))
(defn vendor-filter []
(let [{:keys [vendor-filter]} @(re-frame/subscribe [::invoice-page])])
[:div.field
[:div.control
[bind-field
[typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/vendors]))
:type "typeahead"
:auto-focus true
:field [:vendor-id]
:text-field [:vendor-name]
:event [::change-selected-vendor]
:spec (s/nilable ::invoice/vendor-id)
:subscription vendor-filter}]]]])
(def unpaid-invoices-content
(with-meta
(fn [_]
(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 "Unpaid invoices"]
[:div.field.has-addons.is-extended
[:p.control [:a.button.is-static "Filter Vendor"]]
[:div.control {:style {:width "500px"}}
[bind-field
[typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/vendors]))
:type "typeahead"
:auto-focus true
:field [:vendor-id]
:text-field [:vendor-name]
:event [::change-selected-vendor]
:spec (s/nilable ::invoice/vendor-id)
:subscription vendor-filter}]]]]
[:div.is-pulled-right
[:button.button.is-danger {:on-click (dispatch-event [::new-invoice])} "New Invoice"]
@@ -779,7 +777,10 @@
{:component-will-mount #(re-frame/dispatch-sync [::params-change {}]) }))
(defn unpaid-invoices-page []
[side-bar-layout {:side-bar [invoices-side-bar]
[side-bar-layout {:side-bar [invoices-side-bar {}
[:div [:p.menu-label "Vendor"]
[vendor-filter]]
]
:main [unpaid-invoices-content]
:bottom [vendor-dialog {:vendor @(re-frame/subscribe [::subs/user-editing-vendor])
:save-event [::events/save-vendor]