Streamlining invoices
This commit is contained in:
@@ -132,10 +132,10 @@
|
||||
[:div.buttons
|
||||
(when (seq expense-accounts)
|
||||
[drop-down {:id [::expense-accounts id ]
|
||||
:header [:a.button.badge {:data-badge (str (clojure.core/count expense-accounts))
|
||||
:aria-haspopup true
|
||||
:on-click (dispatch-event [::events/toggle-menu [::expense-accounts id]])
|
||||
:tab-index "0"} "Accounts"]}
|
||||
:header [buttons/sl-icon {:class "badge"
|
||||
:event [::events/toggle-menu [::expense-accounts id]]
|
||||
:data-badge (str (clojure.core/count expense-accounts))
|
||||
:icon "icon-navigation-menu"}]}
|
||||
[drop-down-contents
|
||||
[:div
|
||||
(for [e expense-accounts]
|
||||
@@ -147,6 +147,32 @@
|
||||
(when expense-event
|
||||
[:a.dropdown-item.is-primary {:on-click (dispatch-event (conj expense-event i))} "Change"])]]])
|
||||
[:span {:style {:margin-left "1em"}}]
|
||||
(when (seq payments)
|
||||
[:<>
|
||||
[drop-down {:id [::payments id]
|
||||
:header [buttons/sl-icon {:class "badge"
|
||||
:event [::events/toggle-menu [::payments id]]
|
||||
:data-badge (str (clojure.core/count payments))
|
||||
:icon "icon-accounting-bill"}]}
|
||||
[:div
|
||||
(for [payment payments]
|
||||
(if (:check-number (:payment payment))
|
||||
^{:key (:id payment)}
|
||||
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :payments )
|
||||
"?"
|
||||
(url/map->query {:check-number-like (:check-number (:payment payment))}))
|
||||
:target "_new"}
|
||||
[:i.fa.fa-money-check]
|
||||
[:span.icon [:i.fa.fa-money]]
|
||||
(str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ")")]
|
||||
|
||||
^{:key (:id payment)}
|
||||
[:span.dropdown-item [:span.icon {:class [(when (= :cleared (:status (:payment payment)))
|
||||
"has-text-success")]}
|
||||
[:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ") "
|
||||
(when (= :cleared (:status (:payment payment)))
|
||||
(str " - " (:post-date (:transaction (:payment payment))))))]))]]
|
||||
[:span {:style {:margin-right "1em"}}]])
|
||||
(when (not= ":voided" (:status i))
|
||||
[buttons/fa-icon {:icon "fa-pencil"
|
||||
:event [::form/editing i]}])
|
||||
@@ -155,37 +181,12 @@
|
||||
:event [::void-invoice i]}])
|
||||
(when (= ":voided" (:status i))
|
||||
[buttons/fa-icon {:icon "fa-undo"
|
||||
:event [::unvoid-invoice i]}])
|
||||
(when (seq payments)
|
||||
[drop-down {:id [::payments id]
|
||||
:header [:button.button.badge {:data-badge (str (clojure.core/count payments))
|
||||
:aria-haspopup true
|
||||
:tab-index "0"
|
||||
:on-click (dispatch-event [::events/toggle-menu [::payments id]])
|
||||
} "Payments"]}
|
||||
[:div
|
||||
(for [payment payments]
|
||||
(if (:check-number (:payment payment))
|
||||
^{:key (:id payment)}
|
||||
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :payments )
|
||||
"?"
|
||||
(url/map->query {:check-number-like (:check-number (:payment payment))}))
|
||||
:target "_new"}
|
||||
[:i.fa.fa-money-check]
|
||||
[:span.icon [:i.fa.fa-money]]
|
||||
(str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ")")]
|
||||
|
||||
^{:key (:id payment)}
|
||||
[:span.dropdown-item [:span.icon {:class [(when (= :cleared (:status (:payment payment)))
|
||||
"has-text-success")]}
|
||||
[:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ") "
|
||||
(when (= :cleared (:status (:payment payment)))
|
||||
(str " - " (:post-date (:transaction (:payment payment))))))]))]])]]]))
|
||||
:event [::unvoid-invoice i]}])]]]))
|
||||
|
||||
(defn invoice-table [{:keys [id invoice-page status vendors check-boxes checked on-check-changed expense-event overrides]}]
|
||||
(let [selected-client @(re-frame/subscribe [::subs/client])
|
||||
{:keys [sort]} @(re-frame/subscribe [::table-params])
|
||||
{:keys [invoices outstanding start end count total]} @invoice-page
|
||||
{:keys [invoices outstanding]} invoice-page
|
||||
selected-client @(re-frame/subscribe [::subs/client])
|
||||
is-loading? (= :loading status)
|
||||
is-sorted-by-vendor? (and (= "vendor" (:sort-key (first sort)))
|
||||
@@ -200,15 +201,15 @@
|
||||
[(update-in acc [(dec (clojure.core/count acc))] #(conj (or % []) invoice))
|
||||
(:id (:vendor invoice))]))
|
||||
[[] nil]
|
||||
(:invoices @invoice-page))
|
||||
[[(:invoices @invoice-page)]])]
|
||||
(:invoices invoice-page))
|
||||
[[(:invoices invoice-page)]])]
|
||||
[grid/grid {:on-params-change (fn [p]
|
||||
(re-frame/dispatch [::params-changed p]))
|
||||
:params @(re-frame/subscribe [::table-params])
|
||||
:status status
|
||||
;; TODO checkboxes
|
||||
:column-count (if selected-client 8 9)}
|
||||
[grid/controls @invoice-page
|
||||
[grid/controls invoice-page
|
||||
[:div.level-item
|
||||
"Outstanding " (nf outstanding)]]
|
||||
(for [invoices invoice-groups]
|
||||
@@ -232,7 +233,7 @@
|
||||
[grid/sortable-header-cell {:sort-key "total" :sort-name "Total" :style {:width "8em"} :class "has-text-right"} "Total"]
|
||||
|
||||
[grid/sortable-header-cell {:sort-key "outstanding-balance" :sort-name "Outstanding" :style {:width "10em"} :class "has-text-right"} "Outstanding"]
|
||||
[grid/header-cell {:style {:width "20rem" }}]
|
||||
[grid/header-cell {:style {:width "14rem" }}]
|
||||
]]
|
||||
|
||||
[grid/body
|
||||
|
||||
Reference in New Issue
Block a user