fixes problems in the ui.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
:refer [wrap-admin wrap-client-redirect-unauthenticated wrap-secure]]
|
||||
[auto-ap.ssr.account :as account]
|
||||
[auto-ap.ssr.admin :as admin]
|
||||
[auto-ap.ssr.not-found :as not-found]
|
||||
[auto-ap.ssr.admin.accounts :as admin-accounts]
|
||||
[auto-ap.ssr.admin.background-jobs :as admin-jobs]
|
||||
[auto-ap.ssr.admin.clients :as admin-clients]
|
||||
@@ -55,6 +56,7 @@
|
||||
:bank-account-search (wrap-client-redirect-unauthenticated (wrap-secure company/bank-account-search))
|
||||
:account-search (wrap-client-redirect-unauthenticated (wrap-secure account/account-search))
|
||||
:bank-account-typeahead (wrap-client-redirect-unauthenticated (wrap-secure company/bank-account-typeahead))
|
||||
:not-found not-found/page
|
||||
|
||||
:company (wrap-client-redirect-unauthenticated (wrap-secure company/page))
|
||||
:company-plaid (wrap-client-redirect-unauthenticated (wrap-secure company-plaid/page))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[auto-ap.query-params :as query-params]
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-client-redirect-unauthenticated wrap-secure]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.hiccup-helper :as hh]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
@@ -86,6 +86,17 @@
|
||||
[:div.h-4.w-4 svg/x]]]]))
|
||||
"default sort"))
|
||||
|
||||
(defn create-break-table-fn [break-table grid-spec ]
|
||||
(let [last (atom nil)]
|
||||
(fn [request entity]
|
||||
(let [break-table-value (break-table request entity)]
|
||||
(when (not= break-table-value @last)
|
||||
(reset! last break-table-value)
|
||||
(com/data-grid-row {}
|
||||
(com/data-grid-cell {:colspan (cond-> (inc (count (:headers grid-spec)))
|
||||
(:check-boxes? grid-spec) inc)}
|
||||
[:span.font-bold.text-gray-600.text-lg break-table-value])))))))
|
||||
|
||||
(defn table* [grid-spec user {{:keys [start per-page flash-id sort]} :parsed-query-params :as request}]
|
||||
(alog/info ::TABLE-QP
|
||||
:qp (:query-params request)
|
||||
@@ -120,8 +131,14 @@
|
||||
[:div.w-3.h-3
|
||||
(com/link {"@click" "selected=[]; all_selected=false"}
|
||||
svg/x)]])]))
|
||||
:rows (for [entity entities]
|
||||
(row* grid-spec user entity {:flash? (= flash-id ((:id-fn grid-spec) entity)) :request request}))
|
||||
:rows
|
||||
(let [break-table-fn (some-> grid-spec :break-table ( create-break-table-fn grid-spec))]
|
||||
(for [entity entities
|
||||
row (if-let [break-table-row (break-table-fn request entity)]
|
||||
|
||||
[break-table-row (row* grid-spec user entity {:flash? (= flash-id ((:id-fn grid-spec) entity)) :request request})]
|
||||
[(row* grid-spec user entity {:flash? (= flash-id ((:id-fn grid-spec) entity)) :request request})])]
|
||||
row))
|
||||
:thead-params {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
(:route grid-spec))
|
||||
:hx-target (str "#" (:id grid-spec))
|
||||
|
||||
@@ -500,6 +500,9 @@
|
||||
"Invoices"))
|
||||
:entity-name "invoices"
|
||||
:route ::route/table
|
||||
:break-table (fn [request entity]
|
||||
(when (= (-> request :query-params :sort first :name) "Vendor")
|
||||
(-> entity :invoice/vendor :vendor/name)))
|
||||
:headers [{:key "client"
|
||||
:name "Client"
|
||||
:sort-key "client"
|
||||
|
||||
22
src/clj/auto_ap/ssr/not_found.clj
Normal file
22
src/clj/auto_ap/ssr/not_found.clj
Normal file
@@ -0,0 +1,22 @@
|
||||
(ns auto-ap.ssr.not-found
|
||||
(:require [auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.ui :refer [base-page]]))
|
||||
|
||||
|
||||
(defn page [{:keys [identity matched-route] :as request}]
|
||||
(base-page
|
||||
request
|
||||
(com/page { :request request
|
||||
:client (:client request)
|
||||
:clients (:clients request)
|
||||
:identity (:identity request)
|
||||
:app-params {}}
|
||||
#_(com/breadcrumbs {}
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:company)}
|
||||
"My Company"])
|
||||
[:div.flex.items-center.justify-center.flex-col
|
||||
|
||||
[:div.text-2xl.font-bold.text-gray-600 "Page not found"]
|
||||
[:p.text-gray-500 "Sorry, we can't find the page you're looking for. Try going " (com/link {:href "/"} "home") " and try again."]])
|
||||
"Not found"))
|
||||
Reference in New Issue
Block a user