not sure if this is a good idea.
This commit is contained in:
@@ -164,7 +164,21 @@
|
|||||||
visible-checks @(re-frame/subscribe [::visible-checks])
|
visible-checks @(re-frame/subscribe [::visible-checks])
|
||||||
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
||||||
selected-client @(re-frame/subscribe [::subs/client])
|
selected-client @(re-frame/subscribe [::subs/client])
|
||||||
percentage-size (if selected-client "%50%" "33%")]
|
percentage-size (if selected-client "%50%" "33%")
|
||||||
|
is-sorted-by-vendor? (seq (filter #(= "vendor" (:sort-key %)) sort))
|
||||||
|
_ (println is-sorted-by-vendor? sort)
|
||||||
|
[invoice-groups] (if is-sorted-by-vendor?
|
||||||
|
(reduce
|
||||||
|
(fn [[acc last-vendor] invoice]
|
||||||
|
(if (not= (:id (:vendor invoice))
|
||||||
|
last-vendor)
|
||||||
|
[(update-in acc [(clojure.core/count acc)] #(conj (or % []) invoice))
|
||||||
|
(:id (:vendor invoice))]
|
||||||
|
[(update-in acc [(dec (clojure.core/count acc))] #(conj (or % []) invoice))
|
||||||
|
(:id (:vendor invoice))]))
|
||||||
|
[[] nil]
|
||||||
|
(:invoices @invoice-page))
|
||||||
|
[[(:invoices @invoice-page)]])]
|
||||||
[:div
|
[:div
|
||||||
[:div.level
|
[:div.level
|
||||||
[:div.level-left
|
[:div.level-left
|
||||||
@@ -174,6 +188,9 @@
|
|||||||
[:div.level-item
|
[:div.level-item
|
||||||
[sort-by-list {:sort sort
|
[sort-by-list {:sort sort
|
||||||
:on-change opc}]]]]
|
:on-change opc}]]]]
|
||||||
|
(doall
|
||||||
|
(for [invoices invoice-groups]
|
||||||
|
^{:key (:id (first invoices))}
|
||||||
[:table.table.is-fullwidth
|
[:table.table.is-fullwidth
|
||||||
[:thead
|
[:thead
|
||||||
[:tr
|
[:tr
|
||||||
@@ -245,7 +262,7 @@
|
|||||||
[:td {:col-span 5}
|
[:td {:col-span 5}
|
||||||
[:i.fa.fa-spin.fa-spinner]]]
|
[:i.fa.fa-spin.fa-spinner]]]
|
||||||
|
|
||||||
(for [{:keys [client payments expense-accounts invoice-number date due total outstanding-balance id vendor] :as i} (:invoices @invoice-page)]
|
(for [{:keys [client payments expense-accounts invoice-number date due total outstanding-balance id vendor] :as i} invoices]
|
||||||
^{:key id}
|
^{:key id}
|
||||||
[row {:invoice i
|
[row {:invoice i
|
||||||
:check-boxes check-boxes
|
:check-boxes check-boxes
|
||||||
@@ -256,4 +273,4 @@
|
|||||||
:expense-event expense-event
|
:expense-event expense-event
|
||||||
:on-edit-invoice on-edit-invoice
|
:on-edit-invoice on-edit-invoice
|
||||||
:on-void-invoice on-void-invoice
|
:on-void-invoice on-void-invoice
|
||||||
:on-unvoid-invoice on-unvoid-invoice}]))]]]))
|
:on-unvoid-invoice on-unvoid-invoice}]))]]))]))
|
||||||
|
|||||||
Reference in New Issue
Block a user