outstanding balance and addresses.

This commit is contained in:
Bryce Covert
2018-05-17 19:37:50 -07:00
parent 7b7275f7a4
commit e055a1e120
19 changed files with 351 additions and 98 deletions

View File

@@ -9,9 +9,7 @@
[cljs-time.format :as format]
[goog.string :as gstring]))
;; TODO show busy
;; TODO partial payments
;; TODO invoice status = paid when complete
;; TODO performance
;; TODO refactor graphql
@@ -21,7 +19,7 @@
{:venia/queries [[:invoice_page
(assoc params
:company-id (:id @(re-frame/subscribe [::subs/company])))
[[:invoices [:id :total :invoice-number :date [:vendor [:name :id]] [:company [:name :id]] [:checks [:amount [:check [:amount :s3_url :check_number ]]]]]]
[[:invoices [:id :total :outstanding-balance :invoice-number :date [:vendor [:name :id]] [:company [:name :id]] [:checks [:amount [:check [:amount :s3_url :check_number ]]]]]]
:total
:start
:end]]]})
@@ -46,44 +44,50 @@
[:thead
[:tr
(when check-boxes
[:th])
[:th {:style {"width" "20px"}}])
[sorted-column {:on-sort opc
:style {:width "23%" :cursor "pointer"}
:style {:width "33%" :cursor "pointer"}
:sort-key "vendor"
:sort-by sort-by
:asc asc}
"Vendor"]
[sorted-column {:on-sort opc
:style {:width "23%" :cursor "pointer"}
:style {:width "33%" :cursor "pointer"}
:sort-key "company"
:sort-by sort-by
:asc asc}
"Company"]
[sorted-column {:on-sort opc
:style {:width "16%" :cursor "pointer"}
:style {:width "33%" :cursor "pointer"}
:sort-key "invoice-number"
:sort-by sort-by
:asc asc}
"Invoice #"]
[sorted-column {:on-sort opc
:style {:width "14%" :cursor "pointer"}
:style {:width "8em" :cursor "pointer"}
:sort-key "date"
:sort-by sort-by
:asc asc}
"Date"]
[sorted-column {:on-sort opc
:style {:width "14%" :cursor "pointer"}
:style {:width "8em" :cursor "pointer"}
:sort-key "total"
:sort-by sort-by
:asc asc}
"Amount"]
[:th {:style {:width "10%"}} "" ]]]
[sorted-column {:on-sort opc
:style {:width "10em" :cursor "pointer"}
:sort-key "outstanding"
:sort-by sort-by
:asc asc}
"Outstanding"]
[:th {:style {:width "10em"}} "" ]]]
[:tbody
(if (:loading @status)
[:tr
[:td {:col-span 5}
[:i.fa.fa-spin.fa-spinner]]]
(for [{:keys [company checks invoice-number date total id vendor] :as i} (:invoices @invoice-page)]
(for [{:keys [company checks invoice-number date total outstanding-balance id vendor] :as i} (:invoices @invoice-page)]
^{:key id}
[:tr
(when check-boxes
@@ -99,6 +103,7 @@
[:td (date->str date) ]
[:td (gstring/format "$%.2f" total )]
[:td (gstring/format "$%.2f" outstanding-balance )]
[:td (for [check checks]
^{:key (:id check)}
[:a.tag {:href (:s3-url (:check check)) :target "_new"} [:i.fa.fa-money-check] [:span.icon [:i.fa.fa-money]] (str " " (:check-number (:check check)) " (" (gstring/format "$%.2f" (:amount check) ) ")")])]]))]]]))))