Add vendor pre-population for bulk code and individual edit forms
- Add vendor-changed HTMX handlers for both bulk code and individual edit - Pre-populate default account at 100% when vendor is selected and no accounts exist - Fix render-accounts-section to render from step-params correctly - Change bulk code vendor-changed from hx-get to hx-post to include form data - Add routes for vendor-changed endpoints - Update e2e tests to cover vendor pre-population - Run lein cljfmt fix across codebase
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
[:maybe clj-date-schema]]
|
||||
[:end-date {:optional true}
|
||||
[:maybe clj-date-schema]]
|
||||
[:client {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :client/name]}]]] ]
|
||||
[:client {:optional true :default nil} [:maybe [:entity-map {:pull [:db/id :client/name]}]]]]
|
||||
default-grid-fields-schema)]))
|
||||
|
||||
(defn filters [params]
|
||||
@@ -36,7 +36,7 @@
|
||||
"hx-indicator" "#cash-drawer-shift-table"
|
||||
#_#_:hx-disabled-elt "find fieldset"}
|
||||
|
||||
[:fieldset.space-y-6
|
||||
[:fieldset.space-y-6
|
||||
(date-range-field* params)
|
||||
(total-field* params)]])
|
||||
|
||||
@@ -52,15 +52,14 @@
|
||||
:where '[[(iol-ion.query/scan-cash-drawer-shifts $ ?clients ?start-date ?end-date) [[?e _ ?sort-default] ...]]]}
|
||||
:args [db [(:trimmed-clients request)
|
||||
(some-> (:start-date query-params) c/to-date)
|
||||
(some-> (:end-date query-params) c/to-date )]]}
|
||||
(some-> (:end-date query-params) c/to-date)]]}
|
||||
(:sort query-params) (add-sorter-fields {"client" ['[?e :cash-drawer-shift/client ?c]
|
||||
'[?c :client/name ?sort-client]]
|
||||
"date" ['[?e :cash-drawer-shift/date ?sort-date]]
|
||||
"paid-in" ['[?e :cash-drawer-shift/paid-in ?sort-paid-in]]
|
||||
"paid-out" ['[?e :cash-drawer-shift/paid-out ?sort-paid-out]]
|
||||
"expected-cash" ['[?e :cash-drawer-shift/expected-cash ?sort-expected-cash]]
|
||||
"opened-cash" ['[?e :cash-drawer-shift/opened-cash ?sort-opened-cash]]
|
||||
}
|
||||
"opened-cash" ['[?e :cash-drawer-shift/opened-cash ?sort-opened-cash]]}
|
||||
query-params)
|
||||
|
||||
(:exact-match-id query-params)
|
||||
@@ -71,7 +70,7 @@
|
||||
true
|
||||
(merge-query {:query {:find ['?sort-default '?e]
|
||||
:where ['[?e :cash-drawer-shift/date ?sort-default]]}}))]
|
||||
|
||||
|
||||
(cond->> (query2 query)
|
||||
true (apply-sort-3 query-params)
|
||||
true (apply-pagination query-params))))
|
||||
@@ -80,8 +79,8 @@
|
||||
(let [results (->> (pull-many db default-read ids)
|
||||
(group-by :db/id))
|
||||
cash-drawer-shifts (->> ids
|
||||
(map results)
|
||||
(map first))]
|
||||
(map results)
|
||||
(map first))]
|
||||
cash-drawer-shifts))
|
||||
|
||||
(defn fetch-page [request]
|
||||
@@ -109,7 +108,7 @@
|
||||
"Cash Drawer Shifts"]]
|
||||
:title "Cash drawer shifts"
|
||||
:entity-name "Cash drawer shift"
|
||||
:query-schema query-schema
|
||||
:query-schema query-schema
|
||||
:route :pos-cash-drawer-shift-table
|
||||
:headers [{:key "client"
|
||||
:name "Client"
|
||||
@@ -138,12 +137,11 @@
|
||||
:sort-key "opened-cash"
|
||||
:render #(some->> % :cash-drawer-shift/opened-cash (format "$%.2f"))}]}))
|
||||
|
||||
|
||||
(def row* (partial helper/row* grid-page))
|
||||
(def table* (partial helper/table* grid-page))
|
||||
|
||||
(def key->handler
|
||||
(apply-middleware-to-all-handlers
|
||||
(apply-middleware-to-all-handlers
|
||||
{:pos-cash-drawer-shifts (helper/page-route grid-page)
|
||||
:pos-cash-drawer-shift-table (helper/table-route grid-page)}
|
||||
(fn [h]
|
||||
|
||||
Reference in New Issue
Block a user