Uploading invoices now attaches the file.

This commit is contained in:
2022-01-12 20:53:12 -08:00
parent 4d6b3b1e2e
commit 30bbf51011
7 changed files with 260 additions and 198 deletions

View File

@@ -45,7 +45,7 @@
:unpaid-invoices :unpaid
:paid-invoices :paid
:voided-invoices :voided)}
[[:invoices [:id :total :outstanding-balance :invoice-number :date :due :status :client-identifier :scheduled-payment
[[:invoices [:id :total :outstanding-balance :invoice-number :date :due :status :client-identifier :scheduled-payment :source-url
[:vendor [:name :id]]
[:expense_accounts [:amount :id :location
[:account [:id ]]]]
@@ -113,7 +113,7 @@
{:db db}))
(defn row [{:keys [invoice check-boxes selected-client overrides checkable? expense-event actions]}]
(let [{:keys [client status payments expense-accounts invoice-number date due total outstanding-balance id vendor] :as i} invoice
(let [{:keys [client status payments expense-accounts invoice-number date due total outstanding-balance id vendor source-url] :as i} invoice
accounts-by-id @(re-frame/subscribe [::subs/accounts-by-id client])
unautopay-states @(re-frame/subscribe [::status/multi ::unautopay])
account->name #(:name (accounts-by-id (:id %)))]
@@ -165,13 +165,16 @@
[:a.dropdown-item.is-primary {:on-click (dispatch-event [::expense-accounts-dialog/show i])} "Change"]])]]])
[:span {:style {:margin-left "1em"}}]
(when (seq payments)
(when (or (seq payments)
source-url
)
[:<>
[drop-down {:id [::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))
:data-badge (str (cond-> (clojure.core/count payments)
source-url inc))
:icon "fa-paperclip"}]}
[drop-down-contents
[:div.dropdown-item
@@ -181,8 +184,7 @@
^{:key (:id invoice-payment)}
[:tr
[:td
"Payment"
]
"Payment"]
[:td (gstring/format "$%.2f" (:amount invoice-payment) )]
[:td
(when (= :cleared (:status (:payment invoice-payment)))
@@ -193,8 +195,17 @@
[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))}))}]]])]]]]]
(url/map->query {:exact-match-id (:id (:payment invoice-payment))}))}]]])
(when source-url
[:tr
[:td
"File"]
[:td {:colspan 4}
[buttons/fa-icon {:icon "fa-external-link"
:href source-url}]]])]]]]]
[:span {:style {:margin-right "1em"}}]])
(when (and (get actions :edit)
(not= ":voided" (:status i)))
[buttons/fa-icon {:icon "fa-pencil"