simplify sorting

This commit is contained in:
Bryce
2024-04-10 14:48:47 -07:00
parent 1493b03ba3
commit 65be50cf9f
7 changed files with 104 additions and 81 deletions

View File

@@ -7,6 +7,7 @@
[auto-ap.graphql.utils :refer [assert-can-see-client
exception->notification
extract-client-ids notify-if-locked]]
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
[auto-ap.logging :as alog]
[auto-ap.permissions :refer [can?]]
[auto-ap.routes.invoice :as invoice-route]
@@ -38,8 +39,8 @@
[malli.transform :as mt]))
(defn exact-match-id* [request]
(if (nat-int? (:exact-match-id (:parsed-query-params request)))
[:div {:x-data (hx/json {:exact_match (:exact-match-id (:parsed-query-params request))}) :id "exact-match-id-tag"}
(if (nat-int? (:exact-match-id (:query-params request)))
[:div {:x-data (hx/json {:exact_match (:exact-match-id (:query-params request))}) :id "exact-match-id-tag"}
(com/hidden {:name "exact-match-id"
"x-model" "exact_match"})
(com/pill {:color :primary}
@@ -68,7 +69,7 @@
:value (:vendor (:query-params request))
:value-fn :db/id
:content-fn :vendor/name}))
(date-range-field* request)
(date-range-field* (assoc request :parsed-query-params (:query-params request)))
(com/field {:label "Check #"}
(com/text-input {:name "check-number"
:id "check-number"
@@ -130,7 +131,7 @@
{:transaction/_payment [:db/id :transaction/date]}])
(defn fetch-ids [db {:keys [query-params route-params] :as request}]
(let [ valid-clients (extract-client-ids (:clients request)
(let [valid-clients (extract-client-ids (:clients request)
(:client request)
(:client-id query-params)
(when (:client-code query-params)
@@ -530,13 +531,13 @@
(def key->handler
(apply-middleware-to-all-handlers
{::route/cleared-page (-> (helper/page-route grid-page)
{::route/cleared-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :payment-status/cleared))
::route/pending-page (-> (helper/page-route grid-page)
::route/pending-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :payment-status/pending))
::route/voided-page (-> (helper/page-route grid-page)
::route/voided-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :payment-status/voided))
::route/all-page (-> (helper/page-route grid-page)
::route/all-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status nil))
::route/delete (-> delete
@@ -549,9 +550,10 @@
(wrap-admin))
::route/table (helper/table-route grid-page)}
::route/table (helper/table-route grid-page :parse-query-params? false)}
(fn [h]
(-> h
(wrap-copy-qp-pqp)
(wrap-apply-sort grid-page)
(wrap-merge-prior-hx)
(wrap-status-from-source)