Adds memo field
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -824,6 +824,11 @@
|
|||||||
:db/cardinality #:db{:ident :db.cardinality/one},
|
:db/cardinality #:db{:ident :db.cardinality/one},
|
||||||
:db/doc "The type of entity that created this entry",
|
:db/doc "The type of entity that created this entry",
|
||||||
:db/ident :journal-entry/source}
|
:db/ident :journal-entry/source}
|
||||||
|
{:db/valueType :db.type/string,
|
||||||
|
:db/cardinality :db.cardinality/one,
|
||||||
|
:db/doc "A user-entered description",
|
||||||
|
:db/ident :journal-entry/memo}
|
||||||
|
|
||||||
{:db/valueType #:db{:ident :db.type/ref},
|
{:db/valueType #:db{:ident :db.type/ref},
|
||||||
:db/cardinality #:db{:ident :db.cardinality/one},
|
:db/cardinality #:db{:ident :db.cardinality/one},
|
||||||
:db/doc "The client for the ledger",
|
:db/doc "The client for the ledger",
|
||||||
@@ -1283,6 +1288,10 @@
|
|||||||
:db/cardinality #:db{:ident :db.cardinality/one},
|
:db/cardinality #:db{:ident :db.cardinality/one},
|
||||||
:db/doc "Date that the transaction showed up",
|
:db/doc "Date that the transaction showed up",
|
||||||
:db/ident :transaction/date}
|
:db/ident :transaction/date}
|
||||||
|
{:db/valueType :db.type/string,
|
||||||
|
:db/cardinality :db.cardinality/one,
|
||||||
|
:db/doc "A user-entered description",
|
||||||
|
:db/ident :transaction/memo}
|
||||||
{:db/valueType #:db{:ident :db.type/instant},
|
{:db/valueType #:db{:ident :db.type/instant},
|
||||||
:db/cardinality #:db{:ident :db.cardinality/one},
|
:db/cardinality #:db{:ident :db.cardinality/one},
|
||||||
:db/doc "Date that the transaction posted",
|
:db/doc "Date that the transaction posted",
|
||||||
|
|||||||
@@ -359,7 +359,7 @@
|
|||||||
(when (nil? (:account_id trans-account))
|
(when (nil? (:account_id trans-account))
|
||||||
(throw (ex-info "Account is missing account" {:validation-error "Account is missing account"})))))
|
(throw (ex-info "Account is missing account" {:validation-error "Account is missing account"})))))
|
||||||
|
|
||||||
(defn edit-transaction [context {{:keys [id accounts vendor_id approval_status forecast_match]} :transaction} _]
|
(defn edit-transaction [context {{:keys [id accounts vendor_id approval_status memo forecast_match]} :transaction} _]
|
||||||
(let [existing-transaction (d-transactions/get-by-id id)
|
(let [existing-transaction (d-transactions/get-by-id id)
|
||||||
_ (assert-can-see-client (:id context) (:transaction/client existing-transaction) )
|
_ (assert-can-see-client (:id context) (:transaction/client existing-transaction) )
|
||||||
_ (assert-valid-expense-accounts accounts)
|
_ (assert-valid-expense-accounts accounts)
|
||||||
@@ -387,6 +387,7 @@
|
|||||||
|
|
||||||
(audit-transact (cond-> [[:upsert-transaction {:db/id id
|
(audit-transact (cond-> [[:upsert-transaction {:db/id id
|
||||||
:transaction/vendor vendor_id
|
:transaction/vendor vendor_id
|
||||||
|
:transaction/memo memo
|
||||||
:transaction/approval-status (some->> approval_status
|
:transaction/approval-status (some->> approval_status
|
||||||
name
|
name
|
||||||
snake->kebab
|
snake->kebab
|
||||||
@@ -571,6 +572,7 @@
|
|||||||
(def objects
|
(def objects
|
||||||
{:transaction {:fields {:id {:type :id}
|
{:transaction {:fields {:id {:type :id}
|
||||||
:amount {:type 'String}
|
:amount {:type 'String}
|
||||||
|
:memo {:type 'String}
|
||||||
:is_locked {:type 'Boolean}
|
:is_locked {:type 'Boolean}
|
||||||
:description_original {:type 'String}
|
:description_original {:type 'String}
|
||||||
:description_simple {:type 'String}
|
:description_simple {:type 'String}
|
||||||
@@ -674,6 +676,7 @@
|
|||||||
:unresolved {:type 'Boolean}}}
|
:unresolved {:type 'Boolean}}}
|
||||||
:edit_transaction
|
:edit_transaction
|
||||||
{:fields {:id {:type :id}
|
{:fields {:id {:type :id}
|
||||||
|
:memo {:type 'String}
|
||||||
:vendor_id {:type :id}
|
:vendor_id {:type :id}
|
||||||
:forecast_match {:type :id}
|
:forecast_match {:type :id}
|
||||||
:approval_status {:type :transaction_approval_status}
|
:approval_status {:type :transaction_approval_status}
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ args
|
|||||||
(def default-read
|
(def default-read
|
||||||
'[:journal-entry/amount
|
'[:journal-entry/amount
|
||||||
:journal-entry/alternate-description
|
:journal-entry/alternate-description
|
||||||
|
:journal-entry/memo
|
||||||
:journal-entry/source
|
:journal-entry/source
|
||||||
:journal-entry/external-id
|
:journal-entry/external-id
|
||||||
:db/id
|
:db/id
|
||||||
@@ -583,7 +584,10 @@ args
|
|||||||
:transactions)
|
:transactions)
|
||||||
{:exact-match-id (:db/id (:journal-entry/original-entity i))})
|
{:exact-match-id (:db/id (:journal-entry/original-entity i))})
|
||||||
:color :primary
|
:color :primary
|
||||||
:content (format "Transaction '%s'" (-> i :journal-entry/original-entity :transaction/description-original))}))))
|
:content (format "Transaction '%s'" (-> i :journal-entry/original-entity :transaction/description-original))})
|
||||||
|
(-> i :journal-entry/memo)
|
||||||
|
(conj {:color :secondary
|
||||||
|
:content (str "Memo: " (:journal-entry/memo i))}))))
|
||||||
:render-for #{:html}}]}))
|
:render-for #{:html}}]}))
|
||||||
|
|
||||||
(def row* (partial helper/row* grid-page))
|
(def row* (partial helper/row* grid-page))
|
||||||
@@ -17,16 +17,15 @@
|
|||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers check-allowance
|
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers check-allowance
|
||||||
check-location-belongs clj-date-schema entity-id
|
check-location-belongs clj-date-schema entity-id
|
||||||
html-response main-transformer modal-response
|
html-response modal-response money strip
|
||||||
money wrap-form-4xx-2 wrap-schema-enforce]]
|
wrap-form-4xx-2 wrap-schema-enforce]]
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
[clj-time.coerce :as coerce]
|
[clj-time.coerce :as coerce]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[iol-ion.query :refer [dollars=]]
|
[iol-ion.query :refer [dollars=]]
|
||||||
[iol-ion.utils :refer [remove-nils]]
|
[iol-ion.utils :refer [remove-nils]])
|
||||||
[malli.core :as m])
|
|
||||||
(:import
|
(:import
|
||||||
[java.util UUID]))
|
[java.util UUID]))
|
||||||
|
|
||||||
@@ -36,6 +35,7 @@
|
|||||||
[:db/id {:optional true} [:maybe entity-id]]
|
[:db/id {:optional true} [:maybe entity-id]]
|
||||||
[:journal-entry/client {:optional false} [:entity-map {:pull [:db/id :client/name :client/locations] }]]
|
[:journal-entry/client {:optional false} [:entity-map {:pull [:db/id :client/name :client/locations] }]]
|
||||||
[:journal-entry/date clj-date-schema]
|
[:journal-entry/date clj-date-schema]
|
||||||
|
[:journal-entry/memo {:optional true} [:maybe [ :string {:decode/string strip}]]]
|
||||||
[:journal-entry/vendor {:optional false :default nil}
|
[:journal-entry/vendor {:optional false :default nil}
|
||||||
[:entity-map {:pull [:db/id :vendor/name] }]]
|
[:entity-map {:pull [:db/id :vendor/name] }]]
|
||||||
[:journal-entry/amount {:min 0.01}
|
[:journal-entry/amount {:min 0.01}
|
||||||
@@ -245,6 +245,18 @@
|
|||||||
:class "w-24"
|
:class "w-24"
|
||||||
:error? (fc/field-errors)
|
:error? (fc/field-errors)
|
||||||
:placeholder "212.44"})]))
|
:placeholder "212.44"})]))
|
||||||
|
(fc/with-field :journal-entry/memo
|
||||||
|
[:div.w-96
|
||||||
|
(com/validated-field
|
||||||
|
{:label "Memo"
|
||||||
|
:errors (fc/field-errors)}
|
||||||
|
[:div.w-96
|
||||||
|
(com/text-input {:name (fc/field-name)
|
||||||
|
:error? (fc/error?)
|
||||||
|
:class "w-96"
|
||||||
|
:placeholder "A custom note"
|
||||||
|
:url (bidi/path-for ssr-routes/only-routes :company-search)
|
||||||
|
:value (fc/field-value) })])])
|
||||||
(fc/with-field :journal-entry/line-items
|
(fc/with-field :journal-entry/line-items
|
||||||
(com/validated-field
|
(com/validated-field
|
||||||
{:errors (fc/field-errors)}
|
{:errors (fc/field-errors)}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
(def transaction-read
|
(def transaction-read
|
||||||
[:id
|
[:id
|
||||||
:amount
|
:amount
|
||||||
|
:memo
|
||||||
:location
|
:location
|
||||||
:approval-status
|
:approval-status
|
||||||
:check-number
|
:check-number
|
||||||
|
|||||||
@@ -31,13 +31,14 @@
|
|||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
::submit-query
|
::submit-query
|
||||||
:<- [::forms/form ::form]
|
:<- [::forms/form ::form]
|
||||||
(fn [{{:keys [id vendor accounts approval-status forecast-match]} :data}]
|
(fn [{{:keys [id vendor accounts approval-status forecast-match memo ]} :data}]
|
||||||
{:venia/operation {:operation/type :mutation
|
{:venia/operation {:operation/type :mutation
|
||||||
:operation/name "EditTransaction"}
|
:operation/name "EditTransaction"}
|
||||||
:venia/queries [{:query/data
|
:venia/queries [{:query/data
|
||||||
[:edit-transaction
|
[:edit-transaction
|
||||||
{:transaction {:id id
|
{:transaction {:id id
|
||||||
:vendor-id (:id vendor)
|
:vendor-id (:id vendor)
|
||||||
|
:memo memo
|
||||||
:approval-status approval-status
|
:approval-status approval-status
|
||||||
:forecast-match (:id forecast-match)
|
:forecast-match (:id forecast-match)
|
||||||
:accounts (map
|
:accounts (map
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
(forms/start-form db ::form
|
(forms/start-form db ::form
|
||||||
(-> which
|
(-> which
|
||||||
(select-keys [:vendor :amount :payment :client :description-original
|
(select-keys [:vendor :amount :payment :client :description-original
|
||||||
|
:memo
|
||||||
:check-number
|
:check-number
|
||||||
:yodlee-merchant :id :potential-payment-matches
|
:yodlee-merchant :id :potential-payment-matches
|
||||||
:plaid-merchant
|
:plaid-merchant
|
||||||
@@ -375,6 +377,10 @@
|
|||||||
[date-picker {
|
[date-picker {
|
||||||
:disabled "disabled"}]]
|
:disabled "disabled"}]]
|
||||||
|
|
||||||
|
[form-builder/field-v2 {:field [:memo]}
|
||||||
|
"Memo"
|
||||||
|
[:input.input {:type "text"}]]
|
||||||
|
|
||||||
|
|
||||||
(when (and (:payment data)
|
(when (and (:payment data)
|
||||||
(or is-admin? is-power-user?))
|
(or is-admin? is-power-user?))
|
||||||
|
|||||||
Reference in New Issue
Block a user