Vendor autopay re-instated.

This commit is contained in:
Bryce Covert
2020-11-16 19:28:04 -08:00
parent be1d5997b9
commit e53ee46b3c
4 changed files with 23 additions and 2 deletions

View File

@@ -141,10 +141,13 @@
::editing
(fn [db [_ which]]
(let [accounts-by-id @(re-frame/subscribe [::subs/accounts-by-id (:client which)])
vendor (get @(re-frame/subscribe [::subs/vendors-by-id]) (:id (:vendor which)))
edit-invoice (update which :date #(date->str % standard))
edit-invoice (update edit-invoice :due #(date->str % standard))
edit-invoice (update edit-invoice :scheduled-payment #(date->str % standard))
edit-invoice (assoc edit-invoice :original edit-invoice)
edit-invoice (assoc edit-invoice :vendor-autopay? (boolean ((set (map :id (:automatically-paid-when-due vendor)))
(:id (:client which)))))
locations @(re-frame/subscribe [::subs/locations-for-client (:id (:client which))])
]
(-> db
@@ -153,6 +156,8 @@
:status (:status edit-invoice)
:date (:date edit-invoice)
:due (:due edit-invoice)
:vendor-autopay? (boolean ((set (map :id (:automatically-paid-when-due vendor)))
(:id (:client which))))
:scheduled-payment (:scheduled-payment edit-invoice)
:invoice-number (:invoice-number edit-invoice)
:total (:total edit-invoice)