merged.
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
(re-frame/reg-event-fx
|
||||
::toggle-expense-accounts
|
||||
(fn [{:keys [db] } [_ invoice-id]]
|
||||
(println "toggling")
|
||||
{:db
|
||||
(update-in db [::visible-expense-accounts] (fn [i] (if (= i invoice-id) nil invoice-id) ))}))
|
||||
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
[:div
|
||||
[:div [:p.menu-label "Type"]
|
||||
[:ul.menu-list
|
||||
[:li.menu-item
|
||||
[:a.item {:href (bidi/path-for routes/routes :invoices)
|
||||
:class [(active-when ap = :invoices)]}
|
||||
[:span {:class "icon icon-accounting-invoice-mail" :style {:font-size "25px"}}]
|
||||
[:span {:class "name"} "All Invoices"]]]
|
||||
[:li.menu-item
|
||||
[:a.item {:href (bidi/path-for routes/routes :unpaid-invoices)
|
||||
:class [(active-when ap = :unpaid-invoices)]}
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
(defmethod page :voided-invoices [_]
|
||||
(unpaid-invoices-page {:status "voided"}))
|
||||
|
||||
(defmethod page :invoices [_]
|
||||
(unpaid-invoices-page {}))
|
||||
|
||||
(defmethod page :checks [_]
|
||||
(checks-page))
|
||||
|
||||
@@ -11,14 +11,21 @@
|
||||
[auto-ap.entities.vendors :as vendor]
|
||||
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
|
||||
[cljsjs.dropzone :as dropzone]
|
||||
[cljs.reader :as edn]))
|
||||
[cljs.reader :as edn]
|
||||
[clojure.string :as str]))
|
||||
(def dropzone
|
||||
(let [client (re-frame/subscribe [::subs/client])
|
||||
token (re-frame/subscribe [::subs/token])]
|
||||
(with-meta
|
||||
(fn []
|
||||
[:form.dz {:action "/api/invoices/upload"}
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
[:a.button.is-static "Force Location"]]
|
||||
[:p.control
|
||||
[:input.input {:name "location" :placeholder "SG" :size "4" :maxlength "2" :style {:display "inline"}}]]]
|
||||
[:div.tile.notification
|
||||
|
||||
[:div.has-text-centered {:style {:padding "80px 0px" :width "100%"}}
|
||||
[:span
|
||||
[:span {:class "icon"}
|
||||
@@ -30,7 +37,7 @@
|
||||
(.on (js-this) "success" (fn [_ files]
|
||||
(re-frame/dispatch [::invalidated])))
|
||||
(.on (js-this) "error" (fn [_ error]
|
||||
(re-frame/dispatch [::errored error]))))
|
||||
(re-frame/dispatch [::errored error]))))
|
||||
:paramName "file"
|
||||
:headers {"Authorization" (str "Token " @token)}
|
||||
:url (str "/api/invoices/upload"
|
||||
@@ -39,6 +46,7 @@
|
||||
:previewsContainer "#dz-hidden"
|
||||
:previewTemplate "<div class='dz-hidden-preview'></div>"})))})))
|
||||
|
||||
|
||||
(re-frame/reg-sub
|
||||
::invoice-page
|
||||
(fn [db]
|
||||
@@ -171,6 +179,7 @@
|
||||
error (re-frame/subscribe [::error])]
|
||||
[:div
|
||||
[:h1.title "Upload invoices"]
|
||||
|
||||
[dropzone]
|
||||
|
||||
|
||||
@@ -191,9 +200,7 @@
|
||||
:invoice-page invoice-page
|
||||
:overrides {:client (fn [row]
|
||||
[:p (:name (:client row))
|
||||
[:p [:i.is-size-7 (:client-identifier row)]]]
|
||||
|
||||
)}
|
||||
[:p [:i.is-size-7 (:client-identifier row)]]])}
|
||||
:check-boxes true
|
||||
:checked (:checked @invoice-page)
|
||||
:on-check-changed (fn [which invoice]
|
||||
|
||||
@@ -666,7 +666,7 @@
|
||||
[:div [:em "Your payment was created."]]
|
||||
]))))
|
||||
|
||||
(defn unpaid-invoices-content [{:keys [status]}]
|
||||
(defn unpaid-invoices-content [{:keys [status] :as params}]
|
||||
(r/create-class {:display-name "unpaid-invoices-content"
|
||||
:component-will-unmount (fn [this]
|
||||
(re-frame/dispatch [::unmount-invoices]))
|
||||
@@ -674,7 +674,7 @@
|
||||
(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])]
|
||||
[:div
|
||||
[:h1.title (str (str/capitalize status) " invoices")]
|
||||
[:h1.title (str (str/capitalize (or status "all")) " invoices")]
|
||||
|
||||
(when (= status "unpaid")
|
||||
[pay-button {:print-checks-shown? print-checks-shown? :checked-invoices checked :print-checks-loading? print-checks-loading?}])
|
||||
@@ -704,9 +704,9 @@
|
||||
|
||||
|
||||
]))
|
||||
:component-will-mount #(re-frame/dispatch-sync [::params-change {:status status}]) }))
|
||||
:component-will-mount #(re-frame/dispatch-sync [::params-change params]) }))
|
||||
|
||||
(defn unpaid-invoices-page [{:keys [status]}]
|
||||
(defn unpaid-invoices-page [params]
|
||||
(let [{invoice-bar-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])]
|
||||
[side-bar-layout {:side-bar [invoices-side-bar {}
|
||||
^{:key "extra-filter"}
|
||||
@@ -723,9 +723,8 @@
|
||||
[:p.menu-label "Invoice #"]
|
||||
[:div
|
||||
[invoice-number-filter]]]]
|
||||
:main [unpaid-invoices-content {:status status}]
|
||||
:main [unpaid-invoices-content params]
|
||||
:bottom [:div
|
||||
|
||||
[check-results-dialog]
|
||||
[print-checks-modal]
|
||||
[handwrite-checks-modal]
|
||||
|
||||
Reference in New Issue
Block a user