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:
2026-05-21 14:45:19 -07:00
parent 8bd0cee1b1
commit ba87805d4c
210 changed files with 8694 additions and 9627 deletions

View File

@@ -55,8 +55,8 @@
":style" (format "selected == '%s' ? 'max-height: ' + $el.scrollHeight + 'px' : ''" (:selector params))))
(for [c children]
[:li
(update-in c [1 1 :class ] (fn [c]
(hh/add-class (or c "") " flex items-center p-2 pl-11 w-full text-base font-normal rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700")))])])
(update-in c [1 1 :class] (fn [c]
(hh/add-class (or c "") " flex items-center p-2 pl-11 w-full text-base font-normal rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700")))])])
(defn left-aside- [{:keys [nav page-specific]} & _]
[:aside {:id "left-nav",
@@ -83,7 +83,6 @@
[:div {:class "overflow-y-auto py-5 px-3 h-full bg-gray-50 border-r border-gray-200 dark:bg-gray-800 dark:border-gray-700"}
nav
(when page-specific
[:div {:class " pt-5 mt-5 space-y-2 border-t border-gray-200 dark:border-gray-700"}
page-specific])]])
@@ -94,7 +93,7 @@
"invoices"
(#{:pos-sales :pos-expected-deposits :pos-tenders :pos-refunds :pos-cash-drawer-shifts ::ss-routes/page} (:matched-route request))
"sales"
"sales"
(#{::payment-routes/all-page ::payment-routes/pending-page ::payment-routes/cleared-page ::payment-routes/voided-page} (:matched-route request))
"payments"
(#{::transaction-routes/page ::transaction-routes/approved-page ::transaction-routes/unapproved-page ::transaction-routes/requires-feedback-page :transaction-insights} (:matched-route request))
@@ -108,7 +107,7 @@
[:li
(menu-button- {:icon svg/pie
:href (bidi/path-for ssr-routes/only-routes
:href (bidi/path-for ssr-routes/only-routes
::dashboard/page)}
"Dashboard")]
@@ -147,7 +146,6 @@
:hx-boost "true"}
"Voided")
(when (can? (:identity request)
{:subject :invoice
:activity :import})
@@ -156,7 +154,6 @@
:active? (= ::invoice-route/import-page (:matched-route request))
:hx-boost "true"} "Import"))
#_(when (can? (:identity request)
{:subject :invoice
:activity :import})
@@ -168,7 +165,6 @@
"Glimpse"
(tags/pill- {:color :secondary} "Beta")]))
(when (can? (:identity request)
{:subject :ar-invoice
:activity :read})
@@ -213,12 +209,12 @@
:hx-boost "true"}
"Refunds")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-cash-drawer-shifts)
"?date-range=week")
:active? (= :pos-cash-drawer-shifts (:matched-route request))
:hx-boost "true"}
"Cash drawer shifts")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-cash-drawer-shifts)
"?date-range=week")
:active? (= :pos-cash-drawer-shifts (:matched-route request))
:hx-boost "true"}
"Cash drawer shifts")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
::ss-routes/page)
"?date-range=week")
@@ -288,7 +284,6 @@
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
:transaction-insights)} "Insights")))]
(when (can? (:identity request)
{:subject :ledger-page})
(list
@@ -314,7 +309,7 @@
[:div.flex.gap-2
"External Register"
(tags/pill- {:color :secondary} "WIP")]))
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::ledger-routes/profit-and-loss))
:active? (= ::ledger-routes/profit-and-loss (:matched-route request))
@@ -322,7 +317,7 @@
[:div.flex.gap-2
"Profit and loss"
(tags/pill- {:color :secondary} "WIP")])
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::ledger-routes/cash-flows))
:active? (= ::ledger-routes/cash-flows (:matched-route request))
@@ -330,7 +325,7 @@
[:div.flex.gap-2
"Cash flows"
(tags/pill- {:color :secondary} "WIP")])
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::ledger-routes/balance-sheet))
:active? (= ::ledger-routes/balance-sheet (:matched-route request))
@@ -338,8 +333,7 @@
[:div.flex.gap-2
"Balance Sheet"
(tags/pill- {:color :secondary} "WIP")])
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::ledger-routes/external-import-page)
{:date-range "month"})
@@ -349,7 +343,6 @@
"External Import"
(tags/pill- {:color :secondary} "WIP")]))))]))
(defn company-aside-nav- [request]
[:ul {:class "space-y-2" :hx-boost "true"}
[:li
@@ -465,7 +458,6 @@
:hx-boost true}
"Background Jobs")]
(menu-button- {:icon svg/arrow-in
"@click.prevent" "if (selected == 'import') {selected = null } else { selected = 'import'} "}
"Import")