adds unresolved only

This commit is contained in:
2026-05-20 20:45:39 -07:00
parent e8979738ab
commit b42e2a6a44
2 changed files with 33 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
(:require (:require
[auto-ap.datomic :refer [add-sorter-fields apply-pagination apply-sort-4 [auto-ap.datomic :refer [add-sorter-fields apply-pagination apply-sort-4
conn merge-query observable-query pull-many]] conn merge-query observable-query pull-many]]
[auto-ap.graphql.utils :refer [extract-client-ids]] [auto-ap.graphql.utils :refer [extract-client-ids is-admin?]]
[auto-ap.routes.invoice :as invoice-routes] [auto-ap.routes.invoice :as invoice-routes]
[auto-ap.routes.ledger :as ledger-routes] [auto-ap.routes.ledger :as ledger-routes]
[auto-ap.routes.payments :as payment-routes] [auto-ap.routes.payments :as payment-routes]
@@ -33,6 +33,11 @@
[:amount-lte {:optional true} [:maybe :double]] [:amount-lte {:optional true} [:maybe :double]]
[:client-id {:optional true} [:maybe entity-id]] [:client-id {:optional true} [:maybe entity-id]]
[:import-batch-id {:optional true} [:maybe entity-id]] [:import-batch-id {:optional true} [:maybe entity-id]]
[:unresolved {:optional true}
[:maybe [:boolean {:decode/string {:enter #(cond (= % "on") true
(= % "") false
:else
(boolean %))}}]]]
[:description {:optional true} [:maybe [:string {:decode/string strip}]]] [:description {:optional true} [:maybe [:string {:decode/string strip}]]]
[:vendor {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :vendor/name]}]]] [:vendor {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :vendor/name]}]]]
[:bank-account {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :bank-account/numeric-code]}]]] [:bank-account {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :bank-account/numeric-code]}]]]
@@ -154,6 +159,13 @@
:where ['[?import-batch-id :import-batch/entry ?e]]} :where ['[?import-batch-id :import-batch/entry ?e]]}
:args [(:import-batch-id args)]}) :args [(:import-batch-id args)]})
(:unresolved args)
(merge-query {:query {:where ['[?e :transaction/date]
'(or-join [?e]
(not [?e :transaction/accounts])
(and [?e :transaction/accounts ?tas]
(not [?tas :transaction-account/account]))) ]}})
(:status route-params) (:status route-params)
(merge-query {:query {:in ['?status] (merge-query {:query {:in ['?status]
:where ['[?e :transaction/approval-status ?status]]} :where ['[?e :transaction/approval-status ?status]]}
@@ -273,6 +285,13 @@
:value (:amount-lte (:query-params request)) :value (:amount-lte (:query-params request))
:placeholder "9999.34" :placeholder "9999.34"
:size :small})]) :size :small})])
(when (is-admin? (:identity request))
[:div.mt-4 {:x-data (hx/json {:unresolvedOnly (:unresolved (:query-params request))})}
(com/hidden {:name "unresolved"
":value" "unresolvedOnly ? 'on' : ''"})
(com/checkbox {:value (:unresolved (:query-params request))
:x-model "unresolvedOnly"}
"Unresolved only")])
(exact-match-id* request)]]) (exact-match-id* request)]])