makes expected deposit linking work.
This commit is contained in:
@@ -1,18 +1,22 @@
|
|||||||
(ns auto-ap.datomic.expected-deposit
|
(ns auto-ap.datomic.expected-deposit
|
||||||
(:require [auto-ap.datomic :refer [add-sorter-fields apply-pagination apply-sort-3 merge-query conn]]
|
(:require [auto-ap.datomic :refer [add-sorter-fields apply-pagination apply-sort-3 merge-query conn]]
|
||||||
[auto-ap.graphql.utils :refer [limited-clients]]
|
[auto-ap.graphql.utils :refer [limited-clients]]
|
||||||
[auto-ap.utils :refer [dollars=]]
|
|
||||||
[clj-time.coerce :as c]
|
[clj-time.coerce :as c]
|
||||||
[datomic.api :as d]
|
[datomic.api :as d]))
|
||||||
[clojure.tools.logging :as log]))
|
|
||||||
|
|
||||||
|
|
||||||
(defn <-datomic [result]
|
(defn <-datomic [result]
|
||||||
(-> result
|
(let [transaction (first (:transaction/_expected-deposit result))
|
||||||
(update :expected-deposit/date c/from-date)))
|
transaction (when transaction
|
||||||
|
(update transaction :transaction/date c/from-date))]
|
||||||
|
(cond-> result
|
||||||
|
true (update :expected-deposit/date c/from-date)
|
||||||
|
transaction (assoc :transaction transaction))))
|
||||||
|
|
||||||
(def default-read '[*
|
(def default-read '[*
|
||||||
{:expected-deposit/client [:client/name :db/id :client/code]}])
|
{:expected-deposit/client [:client/name :db/id :client/code]
|
||||||
|
:expected-deposit/status [:db/ident]
|
||||||
|
:transaction/_expected-deposit [:transaction/date :db/id]}])
|
||||||
|
|
||||||
(defn raw-graphql-ids [db args]
|
(defn raw-graphql-ids [db args]
|
||||||
(let [query (cond-> {:query {:find []
|
(let [query (cond-> {:query {:find []
|
||||||
@@ -87,7 +91,7 @@
|
|||||||
true (apply-sort-3 args)
|
true (apply-sort-3 args)
|
||||||
true (apply-pagination args))))
|
true (apply-pagination args))))
|
||||||
|
|
||||||
(defn graphql-results [ids db args]
|
(defn graphql-results [ids db _]
|
||||||
(let [results (->> (d/pull-many db default-read ids)
|
(let [results (->> (d/pull-many db default-read ids)
|
||||||
(group-by :db/id))
|
(group-by :db/id))
|
||||||
payments (->> ids
|
payments (->> ids
|
||||||
@@ -97,7 +101,6 @@
|
|||||||
payments))
|
payments))
|
||||||
|
|
||||||
(defn get-graphql [args]
|
(defn get-graphql [args]
|
||||||
(log/info "ARGS" args)
|
|
||||||
(let [db (d/db conn)
|
(let [db (d/db conn)
|
||||||
{ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)]
|
{ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
(ns auto-ap.datomic.migrate.sales
|
(ns auto-ap.datomic.migrate.sales
|
||||||
(:require [datomic.api :as d]
|
(:require [datomic.api :as d]))
|
||||||
[auto-ap.datomic :refer [uri]]))
|
|
||||||
|
(defn backfill-status [conn]
|
||||||
|
(let [db (d/db conn)
|
||||||
|
pendings (->>
|
||||||
|
(d/q '[:find [?ed ...]
|
||||||
|
:where [?ed :expected-deposit/date]
|
||||||
|
(not [_ :transaction/expected-deposit ?ed])
|
||||||
|
(not [?ed :expected-deposit/status])]
|
||||||
|
db)
|
||||||
|
(map (fn [ed]
|
||||||
|
{:db/id ed
|
||||||
|
:expected-deposit/status :expected-deposit-status/pending})))
|
||||||
|
cleared (->>
|
||||||
|
(d/q '[:find [?ed ...]
|
||||||
|
:where [?ed :expected-deposit/date]
|
||||||
|
[_ :transaction/expected-deposit ?ed]
|
||||||
|
(not [?ed :expected-deposit/status])]
|
||||||
|
db)
|
||||||
|
(map (fn [ed]
|
||||||
|
{:db/id ed
|
||||||
|
:expected-deposit/status :expected-deposit-status/cleared})))]
|
||||||
|
[(into pendings cleared)]))
|
||||||
|
|
||||||
(def norms-map {:add-orders {:txes [[{:db/ident :sales-order/external-id
|
(def norms-map {:add-orders {:txes [[{:db/ident :sales-order/external-id
|
||||||
:db/doc "The client for the sale"
|
:db/doc "The client for the sale"
|
||||||
@@ -206,6 +227,7 @@
|
|||||||
:db/doc "If this transaction is a deposit, the deposit that we anticipated"
|
:db/doc "If this transaction is a deposit, the deposit that we anticipated"
|
||||||
:db/valueType :db.type/ref
|
:db/valueType :db.type/ref
|
||||||
:db/cardinality :db.cardinality/one}]]}
|
:db/cardinality :db.cardinality/one}]]}
|
||||||
|
|
||||||
:add-vendor-for-sales-stuff {:txes [[{:db/ident :expected-deposit/vendor
|
:add-vendor-for-sales-stuff {:txes [[{:db/ident :expected-deposit/vendor
|
||||||
:db/doc "Which vendor is this deposit for? CCP Square?"
|
:db/doc "Which vendor is this deposit for? CCP Square?"
|
||||||
:db/valueType :db.type/ref
|
:db/valueType :db.type/ref
|
||||||
@@ -218,6 +240,12 @@
|
|||||||
:db/doc "Which vendor is this refund for? CCP Square?"
|
:db/doc "Which vendor is this refund for? CCP Square?"
|
||||||
:db/valueType :db.type/ref
|
:db/valueType :db.type/ref
|
||||||
:db/cardinality :db.cardinality/one}]]}
|
:db/cardinality :db.cardinality/one}]]}
|
||||||
|
:backfill-status {:txes-fn `backfill-status
|
||||||
|
:requires [:add-expected-deposit-status
|
||||||
|
:add-expected-deposits
|
||||||
|
:add-sales-date
|
||||||
|
:add-vendor-for-sales-stuff
|
||||||
|
:add-orders]}
|
||||||
:add-refund-type {:txes [[{:db/ident :sales-refund/type
|
:add-refund-type {:txes [[{:db/ident :sales-refund/type
|
||||||
:db/doc "The type of refund"
|
:db/doc "The type of refund"
|
||||||
:db/valueType :db.type/string
|
:db/valueType :db.type/string
|
||||||
|
|||||||
@@ -302,14 +302,7 @@
|
|||||||
:charges {:type '(list :charge)}
|
:charges {:type '(list :charge)}
|
||||||
:line_items {:type '(list :order_line_item)}}}
|
:line_items {:type '(list :order_line_item)}}}
|
||||||
|
|
||||||
:expected_deposit
|
|
||||||
{:fields {:id {:type :id}
|
|
||||||
:location {:type 'String}
|
|
||||||
:external_id {:type 'String}
|
|
||||||
:total {:type :money}
|
|
||||||
:fee {:type :money}
|
|
||||||
:client {:type :client}
|
|
||||||
:date {:type 'String}}}
|
|
||||||
|
|
||||||
:check {:fields {:id {:type :id}
|
:check {:fields {:id {:type :id}
|
||||||
:type {:type 'String}
|
:type {:type 'String}
|
||||||
@@ -470,11 +463,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
:expected_deposit_page {:fields {:expected_deposits {:type '(list :expected_deposit)}
|
|
||||||
:count {:type 'Int}
|
|
||||||
:total {:type 'Int}
|
|
||||||
:start {:type 'Int}
|
|
||||||
:end {:type 'Int}}}
|
|
||||||
|
|
||||||
:reminder_page {:fields {:reminders {:type '(list :reminder)}
|
:reminder_page {:fields {:reminders {:type '(list :reminder)}
|
||||||
:count {:type 'Int}
|
:count {:type 'Int}
|
||||||
@@ -596,10 +585,7 @@
|
|||||||
:statuses {:type '(list String)}}
|
:statuses {:type '(list String)}}
|
||||||
:resolve :get-all-payments}
|
:resolve :get-all-payments}
|
||||||
|
|
||||||
:all_expected_deposits {:type '(list :expected_deposit)
|
|
||||||
:args {:client_id {:type :id}
|
|
||||||
:client_code {:type 'String}}
|
|
||||||
:resolve :get-all-expected-deposits}
|
|
||||||
|
|
||||||
:all_sales_orders {:type '(list :sales_order)
|
:all_sales_orders {:type '(list :sales_order)
|
||||||
:args {:client_id {:type :id}
|
:args {:client_id {:type :id}
|
||||||
@@ -646,17 +632,7 @@
|
|||||||
|
|
||||||
:resolve :get-sales-order-page}
|
:resolve :get-sales-order-page}
|
||||||
|
|
||||||
:expected_deposit_page {:type :expected_deposit_page
|
|
||||||
:args {:client_id {:type :id}
|
|
||||||
:exact_match_id {:type :id}
|
|
||||||
:date_range {:type :date_range}
|
|
||||||
:total_lte {:type :money}
|
|
||||||
:total_gte {:type :money}
|
|
||||||
:start {:type 'Int}
|
|
||||||
:per_page {:type 'Int}
|
|
||||||
:sort {:type '(list :sort_item)}}
|
|
||||||
|
|
||||||
:resolve :get-expected-deposit-page}
|
|
||||||
|
|
||||||
:payment_page {:type '(list :payment_page)
|
:payment_page {:type '(list :payment_page)
|
||||||
:args {:client_id {:type :id}
|
:args {:client_id {:type :id}
|
||||||
@@ -903,9 +879,6 @@
|
|||||||
{:enum-value :cash}
|
{:enum-value :cash}
|
||||||
{:enum-value :debit}]}
|
{:enum-value :debit}]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:processor {:values [{:enum-value :na}
|
:processor {:values [{:enum-value :na}
|
||||||
{:enum-value :doordash}
|
{:enum-value :doordash}
|
||||||
{:enum-value :uber_eats}
|
{:enum-value :uber_eats}
|
||||||
@@ -1257,8 +1230,6 @@
|
|||||||
:get-all-invoices gq-invoices/get-all-invoices
|
:get-all-invoices gq-invoices/get-all-invoices
|
||||||
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
|
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
|
||||||
:get-all-payments get-all-payments
|
:get-all-payments get-all-payments
|
||||||
:get-all-expected-deposits gq-expected-deposit/get-all-expected-deposits
|
|
||||||
:get-expected-deposit-page gq-expected-deposit/get-expected-deposit-page
|
|
||||||
:get-all-sales-orders get-all-sales-orders
|
:get-all-sales-orders get-all-sales-orders
|
||||||
:get-payment-page gq-checks/get-payment-page
|
:get-payment-page gq-checks/get-payment-page
|
||||||
:get-potential-payments gq-checks/get-potential-payments
|
:get-potential-payments gq-checks/get-potential-payments
|
||||||
@@ -1304,6 +1275,7 @@
|
|||||||
gq-plaid/attach
|
gq-plaid/attach
|
||||||
gq-import-batches/attach
|
gq-import-batches/attach
|
||||||
gq-transactions/attach
|
gq-transactions/attach
|
||||||
|
gq-expected-deposit/attach
|
||||||
schema/compile))
|
schema/compile))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
(ns auto-ap.graphql.expected-deposit
|
(ns auto-ap.graphql.expected-deposit
|
||||||
(:require [auto-ap.datomic.expected-deposit :as d-expected-deposit]
|
(:require
|
||||||
|
[auto-ap.datomic.expected-deposit :as d-expected-deposit]
|
||||||
[auto-ap.graphql.utils
|
[auto-ap.graphql.utils
|
||||||
:refer
|
:refer [->graphql <-graphql assert-admin ident->enum-f result->page]]
|
||||||
[->graphql <-graphql assert-admin result->page]]))
|
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
|
||||||
|
[clojure.tools.logging :as log]))
|
||||||
|
|
||||||
|
(def status->graphql (ident->enum-f :expected-deposit/status))
|
||||||
|
|
||||||
(defn get-expected-deposit [context args value]
|
(defn get-expected-deposit [context args value]
|
||||||
(let [args (assoc args :id (:id context))
|
(let [args (assoc args :id (:id context))
|
||||||
@@ -12,10 +16,63 @@
|
|||||||
(defn get-all-expected-deposits [context args value]
|
(defn get-all-expected-deposits [context args value]
|
||||||
(assert-admin (:id context))
|
(assert-admin (:id context))
|
||||||
(map
|
(map
|
||||||
->graphql
|
(comp ->graphql status->graphql)
|
||||||
(first (d-expected-deposit/get-graphql (assoc (<-graphql args) :count Integer/MAX_VALUE)))))
|
(first (d-expected-deposit/get-graphql (assoc (<-graphql args) :count Integer/MAX_VALUE)))))
|
||||||
|
|
||||||
(defn get-expected-deposit-page [context args value]
|
(defn get-expected-deposit-page [context args value]
|
||||||
(let [args (assoc args :id (:id context))
|
(let [args (assoc args :id (:id context))
|
||||||
[expected-deposits expected-deposit-count] (d-expected-deposit/get-graphql (<-graphql args))]
|
[expected-deposits expected-deposit-count] (d-expected-deposit/get-graphql (<-graphql args))
|
||||||
|
_ (log/info expected-deposits)
|
||||||
|
expected-deposits (map status->graphql expected-deposits)]
|
||||||
|
|
||||||
(result->page expected-deposits expected-deposit-count :expected_deposits args)))
|
(result->page expected-deposits expected-deposit-count :expected_deposits args)))
|
||||||
|
|
||||||
|
(def objects
|
||||||
|
{:expected_deposit {:fields {:id {:type :id}
|
||||||
|
:location {:type 'String}
|
||||||
|
:external_id {:type 'String}
|
||||||
|
:total {:type :money}
|
||||||
|
:transaction {:type :transaction}
|
||||||
|
:status {:type :expected_deposit_status}
|
||||||
|
:fee {:type :money}
|
||||||
|
:client {:type :client}
|
||||||
|
:date {:type 'String}}}
|
||||||
|
|
||||||
|
:expected_deposit_page {:fields {:expected_deposits {:type '(list :expected_deposit)}
|
||||||
|
:count {:type 'Int}
|
||||||
|
:total {:type 'Int}
|
||||||
|
:start {:type 'Int}
|
||||||
|
:end {:type 'Int}}}})
|
||||||
|
|
||||||
|
(def queries
|
||||||
|
{:expected_deposit_page {:type :expected_deposit_page
|
||||||
|
:args {:client_id {:type :id}
|
||||||
|
:exact_match_id {:type :id}
|
||||||
|
:date_range {:type :date_range}
|
||||||
|
:total_lte {:type :money}
|
||||||
|
:total_gte {:type :money}
|
||||||
|
:start {:type 'Int}
|
||||||
|
:per_page {:type 'Int}
|
||||||
|
:sort {:type '(list :sort_item)}}
|
||||||
|
|
||||||
|
:resolve :get-expected-deposit-page}
|
||||||
|
:all_expected_deposits {:type '(list :expected_deposit)
|
||||||
|
:args {:client_id {:type :id}
|
||||||
|
:client_code {:type 'String}}
|
||||||
|
:resolve :get-all-expected-deposits}})
|
||||||
|
|
||||||
|
(def enums
|
||||||
|
{:expected_deposit_status {:values [{:enum-value :cleared}
|
||||||
|
{:enum-value :pending}]}})
|
||||||
|
|
||||||
|
(def resolvers
|
||||||
|
{:get-all-expected-deposits get-all-expected-deposits
|
||||||
|
:get-expected-deposit-page get-expected-deposit-page})
|
||||||
|
|
||||||
|
(defn attach [schema]
|
||||||
|
(->
|
||||||
|
(merge-with merge schema
|
||||||
|
{:objects objects
|
||||||
|
:queries queries
|
||||||
|
:enums enums})
|
||||||
|
(attach-resolvers resolvers)))
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
(defn find-expected-deposit [client-id amount date]
|
(defn find-expected-deposit [client-id amount date]
|
||||||
(when date
|
(when date
|
||||||
(-> (d/q
|
(-> (d/q
|
||||||
'[:find ?ed
|
'[:find [(pull ?ed [:db/id {:expected-deposit/vendor [:db/id]}]) ...]
|
||||||
:in $ ?c ?a ?d-start
|
:in $ ?c ?a ?d-start
|
||||||
:where
|
:where
|
||||||
[?ed :expected-deposit/client ?c]
|
[?ed :expected-deposit/client ?c]
|
||||||
@@ -161,15 +161,10 @@
|
|||||||
[(auto-ap.utils/dollars= ?a2 ?a)]
|
[(auto-ap.utils/dollars= ?a2 ?a)]
|
||||||
]
|
]
|
||||||
(d/db conn) client-id amount (coerce/to-date (t/plus date (t/days -10))))
|
(d/db conn) client-id amount (coerce/to-date (t/plus date (t/days -10))))
|
||||||
first
|
|
||||||
first)))
|
first)))
|
||||||
|
|
||||||
|
|
||||||
(defn categorize-transaction [transaction bank-account existing]
|
(defn categorize-transaction [transaction bank-account existing]
|
||||||
(let [bank-account-id (:db/id bank-account)
|
|
||||||
client (:client/_bank-accounts bank-account)
|
|
||||||
client-id (:db/id client)
|
|
||||||
valid-locations (or (:bank-account/locations bank-account) (:client/locations client))]
|
|
||||||
(cond (= :transaction-approval-status/suppressed (existing (:transaction/id transaction)))
|
(cond (= :transaction-approval-status/suppressed (existing (:transaction/id transaction)))
|
||||||
:suppressed
|
:suppressed
|
||||||
|
|
||||||
@@ -194,7 +189,7 @@
|
|||||||
:not-ready
|
:not-ready
|
||||||
|
|
||||||
:else
|
:else
|
||||||
:import)))
|
:import))
|
||||||
|
|
||||||
(defn maybe-assoc-check-number [transaction]
|
(defn maybe-assoc-check-number [transaction]
|
||||||
(if-let [check-number (or (:transaction/check-number transaction)
|
(if-let [check-number (or (:transaction/check-number transaction)
|
||||||
@@ -224,13 +219,13 @@
|
|||||||
(when (>= amount 0.0)
|
(when (>= amount 0.0)
|
||||||
(when-let [expected-deposit (find-expected-deposit client amount (coerce/to-date-time date))]
|
(when-let [expected-deposit (find-expected-deposit client amount (coerce/to-date-time date))]
|
||||||
(assoc transaction
|
(assoc transaction
|
||||||
:transaction/expected-deposit {:db/id expected-deposit
|
:transaction/expected-deposit {:db/id (:db/id expected-deposit)
|
||||||
:expected-deposit/status :expected-deposit-status/cleared}
|
:expected-deposit/status :expected-deposit-status/cleared}
|
||||||
:transaction/accounts [{:transaction-account/account :account/ccp
|
:transaction/accounts [{:transaction-account/account :account/ccp
|
||||||
:transaction-account/amount amount
|
:transaction-account/amount amount
|
||||||
:transaction-account/location "A"}]
|
:transaction-account/location "A"}]
|
||||||
:transaction/approval-status :transaction-approval-status/approved
|
:transaction/approval-status :transaction-approval-status/approved
|
||||||
:transaction/vendor (:expected-deposit/vendor expected-deposit)
|
:transaction/vendor (:db/id (:expected-deposit/vendor expected-deposit))
|
||||||
))))
|
))))
|
||||||
|
|
||||||
(defn maybe-code [{:transaction/keys [client amount] :as transaction} apply-rules valid-locations]
|
(defn maybe-code [{:transaction/keys [client amount] :as transaction} apply-rules valid-locations]
|
||||||
|
|||||||
@@ -336,6 +336,7 @@
|
|||||||
(->> (for [settlement (settlements client location-id)]
|
(->> (for [settlement (settlements client location-id)]
|
||||||
#:expected-deposit {:external-id (str "square/settlement/" (:id settlement))
|
#:expected-deposit {:external-id (str "square/settlement/" (:id settlement))
|
||||||
:vendor :vendor/ccp-square
|
:vendor :vendor/ccp-square
|
||||||
|
:status :expected-deposit-status/pending
|
||||||
:total (amount->money (:total_money settlement))
|
:total (amount->money (:total_money settlement))
|
||||||
:client [:client/code client]
|
:client [:client/code client]
|
||||||
:location (get-in env [:square-config client :location])
|
:location (get-in env [:square-config client :location])
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
:total-lte (:amount-lte (:total-range params))
|
:total-lte (:amount-lte (:total-range params))
|
||||||
:date-range (:date-range params)
|
:date-range (:date-range params)
|
||||||
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||||
[[:expected-deposits [:id :total :fee :location :date
|
[[:expected-deposits [:id :total :fee :location :date :status
|
||||||
|
[:transaction [:id :date]]
|
||||||
[:client [:name :id]]]]
|
[:client [:name :id]]]]
|
||||||
:total
|
:total
|
||||||
:start
|
:start
|
||||||
|
|||||||
@@ -1,27 +1,57 @@
|
|||||||
|
|
||||||
(ns auto-ap.views.pages.pos.expected-deposits.table
|
(ns auto-ap.views.pages.pos.expected-deposits.table
|
||||||
(:require [auto-ap.subs :as subs]
|
(:require
|
||||||
[auto-ap.views.components.buttons :as buttons] [auto-ap.views.components.grid :as grid]
|
[auto-ap.events :as events]
|
||||||
|
[auto-ap.subs :as subs]
|
||||||
|
[auto-ap.views.components.buttons :as buttons]
|
||||||
|
[auto-ap.views.components.grid :as grid]
|
||||||
[auto-ap.views.pages.data-page :as data-page]
|
[auto-ap.views.pages.data-page :as data-page]
|
||||||
[auto-ap.views.pages.pos.form :as form]
|
[auto-ap.views.pages.pos.form :as form]
|
||||||
[auto-ap.views.utils :refer [date->str nf]]
|
[auto-ap.views.utils :refer [date->str nf dispatch-event-with-propagation pretty str->date standard]]
|
||||||
[clojure.string :as str]
|
[auto-ap.views.components.dropdown
|
||||||
[re-frame.core :as re-frame]))
|
:refer
|
||||||
|
[drop-down drop-down-contents]]
|
||||||
|
|
||||||
|
[bidi.bidi :as bidi]
|
||||||
|
[cemerick.url :as url]
|
||||||
|
[re-frame.core :as re-frame]
|
||||||
|
[auto-ap.routes :as routes]))
|
||||||
|
|
||||||
(defn row [{sales-order :sales-order
|
(defn row [{sales-order :sales-order
|
||||||
selected-client :selected-client}]
|
selected-client :selected-client}]
|
||||||
(let [{:keys [client location date total fee id]} sales-order]
|
(let [{:keys [client transaction status location date total fee id]} sales-order]
|
||||||
[grid/row {:class (:class sales-order) :id id}
|
[grid/row {:class (:class sales-order) :id id}
|
||||||
(when-not selected-client
|
(when-not selected-client
|
||||||
[grid/cell {} (:name client)])
|
[grid/cell {} (:name client)])
|
||||||
[grid/cell location ]
|
[grid/cell location ]
|
||||||
[grid/cell {} (date->str date) ]
|
[grid/cell {} (date->str date) ]
|
||||||
|
[grid/cell {} status ]
|
||||||
[grid/cell {:class "has-text-right"} (nf total )]
|
[grid/cell {:class "has-text-right"} (nf total )]
|
||||||
[grid/cell {:class "has-text-right"} (nf fee )]
|
[grid/cell {:class "has-text-right"} (nf fee )]
|
||||||
|
|
||||||
[grid/button-cell {}
|
[grid/button-cell {}
|
||||||
[:div.buttons
|
[:div.buttons
|
||||||
[buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]]]]))
|
[buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]]
|
||||||
|
(when transaction
|
||||||
|
[drop-down {:id [::links id]
|
||||||
|
:is-right? true
|
||||||
|
:header [buttons/fa-icon {:class "badge"
|
||||||
|
:on-click (dispatch-event-with-propagation [::events/toggle-menu [::links id]])
|
||||||
|
:data-badge (str 1)
|
||||||
|
:icon "fa-paperclip"}]}
|
||||||
|
[drop-down-contents
|
||||||
|
[:div.dropdown-item
|
||||||
|
[:table.table.grid.compact
|
||||||
|
[:tbody
|
||||||
|
(when transaction
|
||||||
|
[:tr
|
||||||
|
[:td
|
||||||
|
"Transaction"]
|
||||||
|
[:td (some-> transaction :date (date->str pretty))]
|
||||||
|
[:td
|
||||||
|
[buttons/fa-icon {:icon "fa-external-link"
|
||||||
|
:href (str (bidi/path-for routes/routes :transactions )
|
||||||
|
"?"
|
||||||
|
(url/map->query {:exact-match-id (:id transaction)}))}]]])]]]]])]]))
|
||||||
|
|
||||||
(defn table [{:keys [data-page]}]
|
(defn table [{:keys [data-page]}]
|
||||||
(let [selected-client @(re-frame/subscribe [::subs/client])
|
(let [selected-client @(re-frame/subscribe [::subs/client])
|
||||||
@@ -36,6 +66,7 @@
|
|||||||
[grid/sortable-header-cell {:sort-key "client" :sort-name "Client"} "Client"])
|
[grid/sortable-header-cell {:sort-key "client" :sort-name "Client"} "Client"])
|
||||||
[grid/sortable-header-cell {:sort-key "location" :sort-name "Location" :style {:width "7em"}} "Location"]
|
[grid/sortable-header-cell {:sort-key "location" :sort-name "Location" :style {:width "7em"}} "Location"]
|
||||||
[grid/sortable-header-cell {:sort-key "date" :sort-name "Date" :style {:width "8em"}} "Date"]
|
[grid/sortable-header-cell {:sort-key "date" :sort-name "Date" :style {:width "8em"}} "Date"]
|
||||||
|
[grid/sortable-header-cell {:sort-key "status" :sort-name "Status" :style {:width "8em"}} "Status"]
|
||||||
[grid/sortable-header-cell {:sort-key "total" :sort-name "Total" :class "has-text-right" :style {:width "8em"}} "Total"]
|
[grid/sortable-header-cell {:sort-key "total" :sort-name "Total" :class "has-text-right" :style {:width "8em"}} "Total"]
|
||||||
[grid/sortable-header-cell {:sort-key "fee" :sort-name "Fee" :class "has-text-right" :style {:width "7em"}} "Fee"]
|
[grid/sortable-header-cell {:sort-key "fee" :sort-name "Fee" :class "has-text-right" :style {:width "7em"}} "Fee"]
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
(d/entity (d/db conn) bank-account-id)
|
(d/entity (d/db conn) bank-account-id)
|
||||||
noop-rule)]
|
noop-rule)]
|
||||||
(t/is (= expected-deposit-id
|
(t/is (= expected-deposit-id
|
||||||
(sut/find-expected-deposit client-id 100.0 (clj-time.coerce/to-date-time #inst "2021-07-03T00:00:00-08:00"))))
|
(:db/id (sut/find-expected-deposit client-id 100.0 (clj-time.coerce/to-date-time #inst "2021-07-03T00:00:00-08:00")))))
|
||||||
|
|
||||||
(t/is (= {:db/id expected-deposit-id
|
(t/is (= {:db/id expected-deposit-id
|
||||||
:expected-deposit/status :expected-deposit-status/cleared}
|
:expected-deposit/status :expected-deposit-status/cleared}
|
||||||
|
|||||||
Reference in New Issue
Block a user