a little ux

This commit is contained in:
Bryce Covert
2017-12-09 14:49:09 -08:00
parent 02a1ad0d47
commit e368b719ec
4 changed files with 35 additions and 22 deletions

View File

@@ -32,8 +32,7 @@
:paramName "file"
:url "/pdf-upload"
:previewsContainer "#dz-hidden"
:previewTemplate "<div class='dz-hidden-preview'></div>"
})))}))
:previewTemplate "<div class='dz-hidden-preview'></div>"})))}))
(defmulti active-page identity)
@@ -49,25 +48,29 @@
(defmethod active-page :unpaid-invoices []
[(with-meta
(fn []
(let [invoices (re-frame/subscribe [::subs/unpaid-invoices])]
(let [invoices (re-frame/subscribe [::subs/unpaid-invoices])
status (re-frame/subscribe [::subs/status])]
[:div {:class "inbox-messages"}
[:h1.title "Unpaid invoices"]
[:table {:class "table", :style {:width "100%"}}
[:thead
[:tr
[:th "Customer"]
[:th "Invoice #"]
[:th "Date"]
[:th "Amount"]]]
[:tbody (for [{:keys [customer-identifier invoice-number date total id] :as i} @invoices]
^{:key (str customer-identifier "-" invoice-number "-" date "-" total "-" id)}
[:tr
[:td customer-identifier]
[:td invoice-number]
[:td date]
[:td total]])]]]))
{:component-did-mount #(re-frame/dispatch [::events/view-unpaid-invoices]) })])
(if (:loading @status)
[:div {:class "inbox-messages"}
[:h1.title
[:i.fa.fa-spin.fa-spinner]]]
[:table {:class "table", :style {:width "100%"}}
[:thead
[:tr
[:th "Customer"]
[:th "Invoice #"]
[:th "Date"]
[:th "Amount"]]]
[:tbody (for [{:keys [customer-identifier invoice-number date total id] :as i} @invoices]
^{:key (str customer-identifier "-" invoice-number "-" date "-" total "-" id)}
[:tr
[:td customer-identifier]
[:td invoice-number]
[:td date]
[:td total]])]])]))
{:component-will-mount #(re-frame/dispatch-sync [::events/view-unpaid-invoices]) })])
(defmethod active-page :paid-invoices []
[:div {:class "inbox-messages"}
@@ -121,7 +124,7 @@
(re-frame/dispatch [::events/reject-invoices]))}
"Reject all"]
]]]))
{:component-did-mount (fn []
{:component-will-mount (fn []
(go
(->> (<! (http/get "/api/invoices/pending"))
:body