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:
@@ -53,7 +53,7 @@
|
||||
(com/data-grid-cell {:class class}
|
||||
(when (> (count (:missing-transactions row)) 0)
|
||||
[:div
|
||||
(com/button { :x-tooltip.on.click "{content: ()=>$refs.tooltip.innerHTML, theme: 'light', allowHTML: true}" }
|
||||
(com/button {:x-tooltip.on.click "{content: ()=>$refs.tooltip.innerHTML, theme: 'light', allowHTML: true}"}
|
||||
[:div.flex.gap-2.items-center
|
||||
(count (:missing-transactions row))
|
||||
[:div.w-4.h-4 svg/question]])
|
||||
@@ -67,13 +67,12 @@
|
||||
(com/data-grid-cell {}
|
||||
(format "$%,.2f" (:transaction/amount r))))))]]))))))])
|
||||
|
||||
|
||||
(defn reconciliation-card* [{:keys [request report]}]
|
||||
(com/content-card {:class "w-full" :id "reconciliation-report"}
|
||||
[:div {:class "flex flex-col px-8 py-8 space-y-3"}
|
||||
[:div
|
||||
[:h1.text-2xl.mb-3.font-bold "Bank Reconciliation Report"]
|
||||
|
||||
|
||||
[:form {:hx-get (bidi.bidi/path-for ssr-routes/only-routes :company-reconciliation-report-card)
|
||||
:hx-target "#reconciliation-report"
|
||||
:hx-swap "outerHTML"}
|
||||
@@ -88,7 +87,7 @@
|
||||
(com/date-input {:name (fc/field-name)
|
||||
:class "w-64"
|
||||
:value (some-> (fc/field-value)
|
||||
(atime/unparse-local atime/normal-date)) })]))
|
||||
(atime/unparse-local atime/normal-date))})]))
|
||||
(fc/with-field :end-date
|
||||
(com/validated-field {:label "End"
|
||||
:errors (fc/field-errors)}
|
||||
@@ -96,12 +95,11 @@
|
||||
(com/date-input {:name (fc/field-name)
|
||||
:class "w-64"
|
||||
:value (some-> (fc/field-value)
|
||||
(atime/unparse-local atime/normal-date)) })]))
|
||||
(atime/unparse-local atime/normal-date))})]))
|
||||
(com/button {:color :primary :class "self-center w-24"} "Run")])]
|
||||
(if report
|
||||
(if report
|
||||
(report* {:request request :report report})
|
||||
[:div "Please choose a time range to run the report"])
|
||||
]]))
|
||||
[:div "Please choose a time range to run the report"])]]))
|
||||
|
||||
(defn page [request]
|
||||
(base-page
|
||||
@@ -134,7 +132,7 @@
|
||||
url/map->query))
|
||||
|
||||
(defn get-report-data [start-date end-date client-ids]
|
||||
(let [client-codes (map first (dc/q '[:find ?cc :in $ [?c ...] :where [?c :client/code ?cc]] (dc/db conn ) client-ids))]
|
||||
(let [client-codes (map first (dc/q '[:find ?cc :in $ [?c ...] :where [?c :client/code ?cc]] (dc/db conn) client-ids))]
|
||||
(for [[ib ba c] (seq (apply get-intuit-bank-accounts (dc/db conn) client-codes))
|
||||
:let [raw-transactions (get-transactions (atime/unparse-local start-date atime/iso-date)
|
||||
(atime/unparse-local end-date atime/iso-date)
|
||||
@@ -169,11 +167,11 @@
|
||||
:requires-feedback-count (:transaction-approval-status/requires-feedback found-transactions 0)
|
||||
:missing-transactions missing-transactions})))
|
||||
|
||||
(defn card [{ {:keys [start-date end-date]} :query-params :as request}]
|
||||
(defn card [{{:keys [start-date end-date]} :query-params :as request}]
|
||||
(let [client-ids (extract-client-ids (:clients request)
|
||||
(:client-id request)
|
||||
(when (:client-code request)
|
||||
[:client/code (:client-code request)]))
|
||||
(:client-id request)
|
||||
(when (:client-code request)
|
||||
[:client/code (:client-code request)]))
|
||||
report (get-report-data start-date end-date client-ids)]
|
||||
(html-response
|
||||
(reconciliation-card* {:request request
|
||||
@@ -182,7 +180,7 @@
|
||||
|
||||
(def key->handler
|
||||
(apply-middleware-to-all-handlers
|
||||
{:company-reconciliation-report page
|
||||
{:company-reconciliation-report page
|
||||
:company-reconciliation-report-card card}
|
||||
(fn [h]
|
||||
(-> h
|
||||
@@ -191,4 +189,4 @@
|
||||
[:start-date {:optional true}
|
||||
[:maybe clj-date-schema]]
|
||||
[:end-date {:optional true}
|
||||
[:maybe clj-date-schema]] ])))))
|
||||
[:maybe clj-date-schema]]])))))
|
||||
Reference in New Issue
Block a user