Adds uploaded by for invoices, fixes REEL Produce, adds Mani Produce
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
(def default-read '[:db/id
|
||||
:invoice/invoice-number
|
||||
:invoice/total
|
||||
{ :invoice/uploader [:user/name]}
|
||||
:invoice/outstanding-balance
|
||||
:invoice/source-url
|
||||
:invoice/location
|
||||
|
||||
@@ -489,8 +489,11 @@
|
||||
(and (= (count (:clients args)) 1)
|
||||
(= 1 (count (:client/locations (:client args))))))
|
||||
:render (fn [x] [:div.flex.items-center.gap-2 (-> x :invoice/client :client/name)
|
||||
(com/pill {:color :primary} (-> x :invoice/location))
|
||||
])}
|
||||
(com/pill {:color :primary} (-> x :invoice/location))])}
|
||||
{:key "uploader"
|
||||
:name "Uploaded by"
|
||||
:sort-key "uploader"
|
||||
:render #(-> % :invoice/uploader :user/name)}
|
||||
{:key "vendor"
|
||||
:name "Vendor"
|
||||
:sort-key "vendor"
|
||||
@@ -618,7 +621,7 @@
|
||||
(throw (ex-info (str "No vendor with the name " vendor-code " was found.")
|
||||
{:vendor-code vendor-code})))))
|
||||
|
||||
(defn import->invoice [{:keys [invoice-number source-url customer-identifier account-number total date vendor-code text full-text client-override vendor-search vendor-override location-override import-status]}]
|
||||
(defn import->invoice [{:keys [invoice-number source-url customer-identifier account-number total date vendor-code text full-text client-override vendor-search vendor-override location-override import-status]} user]
|
||||
(when-not total
|
||||
(throw (Exception. "Couldn't parse total from file.")))
|
||||
(when-not date
|
||||
@@ -646,6 +649,7 @@
|
||||
text
|
||||
full-text))]
|
||||
#:invoice {:db/id (random-tempid)
|
||||
:invoice/uploader (-> user :db/id)
|
||||
:invoice/client matching-client
|
||||
:invoice/client-identifier (or account-number customer-identifier)
|
||||
:invoice/vendor (:db/id matching-vendor)
|
||||
@@ -683,7 +687,7 @@
|
||||
(alog/info ::importing-uploaded :count (count imports)
|
||||
:bc (or user "NOO"))
|
||||
(let [potential-invoices (->> imports
|
||||
(map import->invoice)
|
||||
(map #(import->invoice % user))
|
||||
(map #(validate-invoice % user))
|
||||
admin-only-if-multiple-clients
|
||||
(mapv d-invoices/code-invoice)
|
||||
|
||||
Reference in New Issue
Block a user