it's now possible to link across each entity type

This commit is contained in:
Bryce Covert
2021-01-24 09:45:13 -08:00
parent 88b0dcde3b
commit 10785b9c85
13 changed files with 161 additions and 105 deletions

View File

@@ -9,7 +9,7 @@
[auto-ap.views.components.grid :as grid]
[auto-ap.views.pages.invoices.form :as form]
[auto-ap.views.pages.invoices.common :refer [invoice-read]]
[auto-ap.views.utils :refer [date->str dispatch-event nf days-until]]
[auto-ap.views.utils :refer [date->str dispatch-event dispatch-event-with-propagation nf days-until]]
[bidi.bidi :as bidi]
[cemerick.url :as url]
[cljs-time.core :as t]
@@ -126,6 +126,7 @@
[:div.buttons
(when (seq expense-accounts)
[drop-down {:id [::expense-accounts id ]
:is-right? true
:header [buttons/sl-icon {:class "badge"
:event [::events/toggle-menu [::expense-accounts id]]
:data-badge (str (clojure.core/count expense-accounts))
@@ -146,33 +147,32 @@
(when (seq payments)
[:<>
[drop-down {:id [::payments id]
:header [buttons/sl-icon {:class "badge"
:event [::events/toggle-menu [::payments id]]
:is-right? true
:header [buttons/fa-icon {:class "badge"
:on-click (dispatch-event-with-propagation [::events/toggle-menu [::payments id]])
:data-badge (str (clojure.core/count payments))
:icon "icon-accounting-bill"}]}
[:div
(for [payment payments]
^{:key (:id payment)}
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :payments )
"?"
(url/map->query {:exact-match-id (:id (:payment payment))}))
:target "_new"}
[:i.fa.fa-money-check]
[:span.icon {:class [(when (= :cleared (:status (:payment payment)))
"has-text-success")]}
[:i.fa.fa-money]]
(if (:check-number (:payment payment))
(str "Check " (:check-number (:payment payment))
" (" (gstring/format "$%.2f" (:amount payment) ) ")"
(when (= :cleared (:status (:payment payment)))
(str " - " (:post-date (:transaction (:payment payment))))))
(str "Debit (" (gstring/format "$%.2f" (:amount payment) ) ") "
(when (= :cleared (:status (:payment payment)))
(str " - " (:post-date (:transaction (:payment payment)))))
(when (= :cleared (:status (:payment payment)))
(str " - " (:post-date (:transaction (:payment payment))))))) ])]]
:icon "fa-paperclip"}]}
[drop-down-contents
[:div.dropdown-item
[:table.table.grid.compact
[:tbody
(for [invoice-payment payments]
^{:key (:id invoice-payment)}
[:tr
[:td
"Payment"
]
[:td (gstring/format "$%.2f" (:amount invoice-payment) )]
[:td
(when (= :cleared (:status (:payment invoice-payment)))
(str "cleared")
)]
[:td (:post-date (:transaction (:payment invoice-payment)))]
[:td
[buttons/fa-icon {:icon "fa-external-link"
:href (str (bidi/path-for routes/routes :payments )
"?"
(url/map->query {:exact-match-id (:id (:payment invoice-payment))}))}]]])]]]]]
[:span {:style {:margin-right "1em"}}]])
(when (and (get actions :edit)
(not= ":voided" (:status i)))