making sysco and mama lus work.

This commit is contained in:
Bryce Covert
2020-04-11 09:26:59 -07:00
parent 6d10e4abb2
commit 19caf80bd8
6 changed files with 85 additions and 43 deletions

View File

@@ -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]