Added the ability to import invoices again

This commit is contained in:
Bryce Covert
2019-02-11 20:48:43 -08:00
parent 085440bedd
commit 7c01a04ee8
13 changed files with 196 additions and 22 deletions

View File

@@ -27,7 +27,14 @@
[:span {:class "icon icon-accounting-invoice-mail" :style {:font-size "25px"}}]
[:span {:class "name"} "Paid Invoices"]]]]]
[:span {:class "name"} "Paid Invoices"]]]
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :import-invoices)
:class [(active-when ap = :import-invoices)]}
[:span {:class "icon icon-accounting-invoice-mail" :style {:font-size "25px"}}]
[:span {:class "name"} "Import Invoices"]]]]]
[:div
rest]
[:div {:class "compose has-text-centered"}

View File

@@ -8,6 +8,7 @@
[auto-ap.views.utils :refer [active-when active-when= login-url dispatch-event]]
[auto-ap.views.components.layouts :refer [side-bar-layout]]
[auto-ap.views.pages.unpaid-invoices :refer [unpaid-invoices-page]]
[auto-ap.views.pages.import-invoices :refer [import-invoices-page]]
[auto-ap.views.pages.paid-invoices :refer [paid-invoices-page]]
[auto-ap.views.pages.transactions :refer [transactions-page]]
[auto-ap.views.pages.login :refer [login-page]]
@@ -25,6 +26,10 @@
(defmethod page :unpaid-invoices [_]
(unpaid-invoices-page {:status "unpaid"}))
(defmethod page :import-invoices [_]
(import-invoices-page ))
(defmethod page :paid-invoices [_]
(unpaid-invoices-page {:status "paid"}))

View File

@@ -4,6 +4,8 @@
[auto-ap.events :as events]
[auto-ap.subs :as subs]
[auto-ap.entities.clients :as client]
[auto-ap.views.components.layouts :refer [side-bar-layout]]
[auto-ap.views.components.invoices.side-bar :refer [invoices-side-bar]]
[auto-ap.entities.vendors :as vendor]
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
[cljsjs.dropzone :as dropzone]
@@ -56,7 +58,7 @@
(assoc-in [:status :loading] true)
(assoc-in [::params] params))
:graphql {:token (-> cofx :db :user)
:query-obj (invoice-table/query (assoc params :imported false))
:query-obj (invoice-table/query (assoc params :import-status "pending"))
:on-success [::received]}}))
(re-frame/reg-event-db
@@ -88,7 +90,7 @@
:on-success on-success
}}))
(def import-invoices-page
(def import-invoices-content
(with-meta
(fn []
(let [invoice-page (re-frame/subscribe [::invoice-page])
@@ -129,3 +131,9 @@
"Reject all"]])]]))
{:component-will-mount (fn []
(re-frame/dispatch-sync [::invalidated]))}))
(defn import-invoices-page []
[side-bar-layout {:side-bar [invoices-side-bar {}]
:main [import-invoices-content ]}])

View File

@@ -80,7 +80,7 @@
(assoc-in [:status :loading] true)
(assoc-in [::params] params))
:graphql {:token (-> cofx :db :user)
:query-obj (invoice-table/query (-> params (assoc :imported true) (dissoc :invoice-number-like-current)) )
:query-obj (invoice-table/query (-> params (assoc :import-status "imported") (dissoc :invoice-number-like-current)) )
:on-success [::received]}}))
(re-frame/reg-event-db
::unmount-invoices