Makes navigation a little bit better.

This commit is contained in:
Bryce
2024-03-20 14:48:44 -07:00
parent f6f6dcc865
commit 8af5713ba2
29 changed files with 280 additions and 227 deletions

File diff suppressed because one or more lines are too long

View File

@@ -192,10 +192,11 @@
(upload-xls request) (upload-xls request)
(base-page (base-page
request request
(com/page {:nav (com/admin-aside-nav) (com/page {:nav com/admin-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:client (:client request) :client (:client request)
:identity (:identity request) :identity (:identity request)
:request request
:app-params {:hx-get (bidi/path-for ssr-routes/only-routes :app-params {:hx-get (bidi/path-for ssr-routes/only-routes
:admin-ezcater-xls) :admin-ezcater-xls)
:hx-trigger "clientSelected from:body" :hx-trigger "clientSelected from:body"

View File

@@ -44,7 +44,7 @@
(defn page [request] (defn page [request]
(base-page (base-page
request request
(com/page {:nav (com/admin-aside-nav) (com/page {:nav com/admin-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:clients (:clients request) :clients (:clients request)
:client (:client request) :client (:client request)

View File

@@ -132,12 +132,12 @@
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp
(query-params/parse-key :code query-params/parse-long) (query-params/parse-key :code query-params/parse-long)
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:action-buttons (fn [_] :action-buttons (fn [_]
[(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes [(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes
:admin-account-new-dialog)) :admin-account-new-dialog))
@@ -145,8 +145,8 @@
"New Account")]) "New Account")])
:row-buttons (fn [_ entity] :row-buttons (fn [_ entity]
[(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes [(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes
:admin-account-edit-dialog :admin-account-edit-dialog
:db/id (:db/id entity)))} :db/id (:db/id entity)))}
svg/pencil)]) svg/pencil)])
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:admin)} :admin)}

View File

@@ -89,7 +89,7 @@
(def grid-page (def grid-page
(helper/build {:id "job-table" (helper/build {:id "job-table"
:id-fn :arn :id-fn :arn
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:fetch-page fetch-page :fetch-page fetch-page
:action-buttons (fn [request] :action-buttons (fn [request]
[(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes :admin-job-start-dialog)) [(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes :admin-job-start-dialog))
@@ -118,8 +118,8 @@
(when (and (:start-date e) (when (and (:start-date e)
(:end-date e)) (:end-date e))
(str (time/in-minutes (time/interval (str (time/in-minutes (time/interval
(:start-date e) (:start-date e)
(:end-date e))) " minutes")))} (:end-date e))) " minutes")))}
{:key "name" {:key "name"
:name "Name" :name "Name"
:render :name} :render :name}

View File

@@ -168,7 +168,7 @@
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (helper/default-parse-query-params grid-page) :parse-query-params (helper/default-parse-query-params grid-page)

View File

@@ -242,11 +242,12 @@
(defn page [{:keys [form-params form-errors] :as request}] (defn page [{:keys [form-params form-errors] :as request}]
(base-page (base-page
request request
(com/page {:nav (com/admin-aside-nav) (com/page {:nav com/admin-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:clients (:clients request) :clients (:clients request)
:client (:client request) :client (:client request)
:identity (:identity request)} :identity (:identity request)
:request request}
(com/breadcrumbs {} [:a {:href (bidi/path-for ssr-routes/only-routes ::route/page)} (com/breadcrumbs {} [:a {:href (bidi/path-for ssr-routes/only-routes ::route/page)}
"Admin"]) "Admin"])
[:div.flex.space-x-4 [:div.flex.space-x-4

View File

@@ -165,10 +165,11 @@
(let [entity-id (or (some-> query-params (get "entity-id") Long/parseLong) (let [entity-id (or (some-> query-params (get "entity-id") Long/parseLong)
(some-> route-params (get :entity-id) Long/parseLong))] (some-> route-params (get :entity-id) Long/parseLong))]
(base-page request (base-page request
(com/page {:nav (com/admin-aside-nav) (com/page {:nav com/admin-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:client (:client request) :client (:client request)
:identity (:identity request) :identity (:identity request)
:request request
:app-params {:hx-get (bidi/path-for ssr-routes/only-routes :app-params {:hx-get (bidi/path-for ssr-routes/only-routes
:admin-history) :admin-history)
:hx-trigger "clientSelected from:body" :hx-trigger "clientSelected from:body"

View File

@@ -124,7 +124,7 @@
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:id-fn :db/id :id-fn :db/id
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:fetch-page fetch-page :fetch-page fetch-page
:page-specific-nav filters :page-specific-nav filters
:row-buttons (fn [_ entity] :row-buttons (fn [_ entity]
@@ -138,7 +138,7 @@
:end (:end-date (:parsed-query-params request))} :end (:end-date (:parsed-query-params request))}
:id "date-range"}) [1 :hx-swap-oob] true)]) :id "date-range"}) [1 :hx-swap-oob] true)])
:parse-query-params (comp :parse-query-params (comp
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:admin)} :admin)}
"Admin"] "Admin"]

View File

@@ -176,7 +176,7 @@
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp

View File

@@ -136,7 +136,7 @@
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp

View File

@@ -130,7 +130,7 @@
(defn page [{:keys [identity matched-route] :as request}] (defn page [{:keys [identity matched-route] :as request}]
(base-page (base-page
request request
(com/page {:nav (com/company-aside-nav) (com/page {:nav com/company-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:client (:client request) :client (:client request)
:identity (:identity request) :identity (:identity request)

View File

@@ -90,7 +90,7 @@
(def grid-page (def grid-page
(helper/build (helper/build
{:id "entity-table" {:id "entity-table"
:nav (com/company-aside-nav) :nav com/company-aside-nav
:id-fn (comp :db/id second) :id-fn (comp :db/id second)
:fetch-page fetch-page :fetch-page fetch-page
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
@@ -126,46 +126,46 @@
(-> vendor :vendor/legal-entity-last-name)))]] (-> vendor :vendor/legal-entity-last-name)))]]
(when-let [t99-type (some-> vendor :vendor/legal-entity-1099-type :db/ident name)] (when-let [t99-type (some-> vendor :vendor/legal-entity-1099-type :db/ident name)]
(com/pill (com/pill
{:class "text-xs font-medium" {:class "text-xs font-medium"
:color :primary} :color :primary}
(str/capitalize t99-type)) (str/capitalize t99-type))
)])} )])}
{:key "tin" {:key "tin"
:name "TIN" :name "TIN"
:sort-key "tin" :sort-key "tin"
:show-starting "md" :show-starting "md"
:render (fn [[_ vendor]] :render (fn [[_ vendor]]
[:div.flex.gap-4 [:div.flex.gap-4
(when-let [tin (-> vendor :vendor/legal-entity-tin)] (when-let [tin (-> vendor :vendor/legal-entity-tin)]
[:span {:class "text-xs font-medium py-0.5 "} [:span {:class "text-xs font-medium py-0.5 "}
tin]) tin])
(when-let [tin-type (some-> vendor :vendor/legal-entity-tin-type :db/ident name)] (when-let [tin-type (some-> vendor :vendor/legal-entity-tin-type :db/ident name)]
(com/pill {:class "text-xs font-medium" (com/pill {:class "text-xs font-medium"
:color :yellow} :color :yellow}
(name tin-type)))] (name tin-type)))]
)} )}
{:key "address" {:key "address"
:name "Address" :name "Address"
:sort-key "address" :sort-key "address"
:show-starting "lg" :show-starting "lg"
:render (fn [[_ vendor]] :render (fn [[_ vendor]]
(if (-> vendor :vendor/address :address/street1) (if (-> vendor :vendor/address :address/street1)
[:div [:div
[:div (-> vendor :vendor/address :address/street1)] " " [:div (-> vendor :vendor/address :address/street1)] " "
[:div [:div
(-> vendor :vendor/address :address/street2)] " " (-> vendor :vendor/address :address/street2)] " "
[:div [:div
(-> vendor :vendor/address :address/city) " " (-> vendor :vendor/address :address/city) " "
(-> vendor :vendor/address :address/state) "," (-> vendor :vendor/address :address/state) ","
(-> vendor :vendor/address :address/zip)]] (-> vendor :vendor/address :address/zip)]]
[:p.text-sm.italic.text-gray-400 "No address"]))} [:p.text-sm.italic.text-gray-400 "No address"]))}
{:key "paid" {:key "paid"
:name "Paid" :name "Paid"
:sort-key "paid" :sort-key "paid"
:render (fn [[_ _ paid]] :render (fn [[_ _ paid]]
(com/pill {:class "text-xs font-medium" (com/pill {:class "text-xs font-medium"
:color :primary} :color :primary}
"Paid $" (Math/round paid)))}]})) "Paid $" (Math/round paid)))}]}))

View File

@@ -133,7 +133,7 @@
(def grid-page (def grid-page
(helper/build (helper/build
{:id "plaid-table" {:id "plaid-table"
:nav (com/company-aside-nav) :nav com/company-aside-nav
:fetch-page fetch-page :fetch-page fetch-page
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:company)} :company)}
@@ -181,9 +181,9 @@
:name "Accounts" :name "Accounts"
:show-starting "md" :show-starting "md"
:render (fn [e] :render (fn [e]
[:ul [:ul
(for [a (:plaid-item/accounts e)] (for [a (:plaid-item/accounts e)]
[:li (:plaid-account/name a) " - " (:plaid-account/number a)])])}]})) [:li (:plaid-account/name a) " - " (:plaid-account/number a)])])}]}))
(def page (helper/page-route grid-page)) (def page (helper/page-route grid-page))

View File

@@ -70,7 +70,7 @@
(def grid-page (def grid-page
(helper/build {:id "report-table" (helper/build {:id "report-table"
:nav (com/company-aside-nav) :nav com/company-aside-nav
:fetch-page fetch-page :fetch-page fetch-page
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:company)} :company)}

View File

@@ -122,7 +122,7 @@ fastlink.open({fastLinkURL: '%s',
(def grid-page (def grid-page
(helper/build (helper/build
{:id "yodlee-table" {:id "yodlee-table"
:nav (com/company-aside-nav) :nav com/company-aside-nav
:id-fn :db/id :id-fn :db/id
:fetch-page fetch-page :fetch-page fetch-page
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
@@ -136,19 +136,19 @@ fastlink.open({fastLinkURL: '%s',
:route :company-yodlee-table :route :company-yodlee-table
:action-buttons (fn [request] :action-buttons (fn [request]
[[:div.flex.flex-col.flex-shrink [[:div.flex.flex-col.flex-shrink
[:div.flex-shrink [:div.flex-shrink
(com/button {:color :primary (com/button {:color :primary
:on-click "openFastlink()" :on-click "openFastlink()"
:disabled (if (:client request) :disabled (if (:client request)
false false
true) true)
:hx-get (bidi/path-for ssr-routes/only-routes :hx-get (bidi/path-for ssr-routes/only-routes
:company-yodlee-fastlink-dialog) :company-yodlee-fastlink-dialog)
:hx-target "#modal-holder"} :hx-target "#modal-holder"}
(com/button-icon {} svg/refresh) (com/button-icon {} svg/refresh)
"Link new account")] "Link new account")]
(when-not (:client request) (when-not (:client request)
[:div.text-xs "Note: please select a specific customer to link a new account."])]]) [:div.text-xs "Note: please select a specific customer to link a new account."])]])
:row-buttons (fn [request _] :row-buttons (fn [request _]
[ [
(com/button {:hx-put (bidi/path-for ssr-routes/only-routes (com/button {:hx-put (bidi/path-for ssr-routes/only-routes
@@ -194,9 +194,9 @@ fastlink.open({fastLinkURL: '%s',
:name "Accounts" :name "Accounts"
:show-starting "md" :show-starting "md"
:render (fn [e] :render (fn [e]
[:ul [:ul
(for [a (:yodlee-provider-account/accounts e)] (for [a (:yodlee-provider-account/accounts e)]
[:li (:yodlee-account/name a) " - " (:yodlee-account/number a)])])}]})) [:li (:yodlee-account/name a) " - " (:yodlee-account/number a)])])}]}))
(def page (helper/page-route grid-page)) (def page (helper/page-route grid-page))
(def table (helper/table-route grid-page)) (def table (helper/table-route grid-page))

View File

@@ -1,12 +1,13 @@
(ns auto-ap.ssr.components.aside (ns auto-ap.ssr.components.aside
(:require [auto-ap.client-routes :as client-routes] (:require [auto-ap.client-routes :as client-routes]
[auto-ap.logging :as alog]
[auto-ap.routes.admin.clients :as ac-routes] [auto-ap.routes.admin.clients :as ac-routes]
[auto-ap.routes.admin.excel-invoices :as ei-routes] [auto-ap.routes.admin.excel-invoices :as ei-routes]
[auto-ap.routes.admin.import-batch :as ib-routes] [auto-ap.routes.admin.import-batch :as ib-routes]
[auto-ap.routes.admin.transaction-rules :as transaction-rules] [auto-ap.routes.admin.transaction-rules :as transaction-rules]
[auto-ap.routes.admin.vendors :as v-routes] [auto-ap.routes.admin.vendors :as v-routes]
[auto-ap.routes.payments :as payment-routes]
[auto-ap.routes.invoice :as invoice-route] [auto-ap.routes.invoice :as invoice-route]
[auto-ap.routes.payments :as payment-routes]
[auto-ap.ssr-routes :as ssr-routes] [auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.hiccup-helper :as hh] [auto-ap.ssr.hiccup-helper :as hh]
[auto-ap.ssr.hx :as hx] [auto-ap.ssr.hx :as hx]
@@ -19,30 +20,36 @@
[:a (-> params [:a (-> params
(dissoc :icon) (dissoc :icon)
(assoc :type "button") (assoc :type "button")
(update :class str " cursor-pointer flex items-center p-2 w-full text-xs text-gray-600 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700") (update :class (fn [c]
(cond-> (or c "cursor-pointer flex items-center p-2 w-full text-sm rounded-lg transition duration-75 group hover:bg-gray-100 dark:hover:bg-gray-700 select-none")
(:active? params) (hh/add-class "text-blue-600 font-extrabold dark:text-blue-100 bg-gray-100")
(not (:active? params)) (hh/add-class "text-gray-600 dark:text-white"))))
(assoc :hx-indicator "find .htmx-indicator") (assoc :hx-indicator "find .htmx-indicator")
(assoc :hx-boost "true") (assoc :hx-boost "true")
(assoc :hx-select "#app") (assoc :hx-select "#app")
(assoc :hx-target "#app") (assoc :hx-target "#app")
(assoc :hx-swap "innerHTML")) (assoc :hx-swap "innerHTML"))
(when (:icon params) (when (:icon params)
[:span {:class "flex-shrink-0 w-6 h-6 text-gray-400 transition duration-75 group-hover:text-blue-500 dark:text-gray-400 group-hover:scale-110 dark:group-hover:text-white mr-3"} [:span {:class "flex-shrink-0 w-6 h-6 text-gray-400 transition duration-75 group-hover:text-blue-500 dark:text-gray-400 group-hover:scale-110 dark:group-hover:text-white mr-3"}
(:icon params)]) (:icon params)])
(into [:span {:class "flex-1 text-left whitespace-nowrap text-gray-600 dark:text-white"}] children) (into [:span {:class "flex-1 text-left whitespace-nowrap"}] children)
(when (get params "@click") (when (get params "@click.prevent")
[:svg {:aria-hidden "true", :class "w-6 h-6", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"} [:svg {:aria-hidden "true", :class "w-6 h-6", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
[:path {:fill-rule "evenodd", :d "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", :clip-rule "evenodd"}]]) [:path {:fill-rule "evenodd", :d "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", :clip-rule "evenodd"}]])
[:div.htmx-indicator.flex.items-center [:div.htmx-indicator.flex.items-center
(svg/spinner-primary {:class "inline w-4 h-4 text-white"})]]]) (svg/spinner-primary {:class "inline w-4 h-4 text-white"})]]])
(defn sub-menu- [params & children] (defn sub-menu- [params & children]
[:ul (update params [:ul (cond-> (update params
:class (fnil hh/add-class "")"py-2 space-y-1.5") :class (fnil hh/add-class "") "space-y-1.5 max-h-0 transition transition-all overflow-hidden")
true (assoc ":class" (format "selected == '%s' ? 'py-0.5' : 'py-0'" (:selector params))
:x-ref "submenu"
":style" (format "selected == '%s' ? 'max-height: ' + $refs.submenu.scrollHeight + 'px' : ''" (:selector params))))
(for [c children] (for [c children]
[:li [:li
(update-in c [1 1 :class ] str " flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 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]} & children] (defn left-aside- [{:keys [nav page-specific]} & children]
[:aside {:id "left-nav", [:aside {:id "left-nav",
@@ -67,84 +74,113 @@
page-specific] page-specific]
)]]) )]])
(defn main-aside-nav- [] (defn main-aside-nav- [request]
[:ul {:class "space-y-1"} [:ul {:class "space-y-1"
:x-data (hx/json {:selected
(cond
(#{::invoice-route/page} (:matched-route request))
"invoices"
(#{:pos-sales :pos-expected-deposits :pos-tenders :pos-refunds :pos-cash-drawer-shifts} (:matched-route request))
"sales"
(#{::payment-routes/page} (:matched-route request))
"payments"
:else
nil)})}
[:li [:li
(menu-button- {:icon svg/pie (menu-button- {:icon svg/pie
:href "/"} :href "/"}
"Dashboard")] "Dashboard")]
[:li {:x-data (hx/json {:open false})}
(menu-button- {"@click" "open = !open"
:icon svg/accounting-invoice-mail}
"Invoices")
(sub-menu- (hx/alpine-appear {:x-show "open"})
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/page)
{:date-range "month"})}
"All")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/page)
{:date-range "month"})}
"Paid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/unpaid-page)
{:date-range "month"})}
"Unpaid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/voided-page)
{:date-range "month"})}
"Voided"))]
[:li {:x-data (hx/json {:open false})}
(menu-button- {:icon svg/receipt-register-1
"@click" "open = !open"}
"Sales")
(sub-menu- (hx/alpine-appear {:x-show "open"})
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-sales)
"?date-range=week")} "Sales")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-expected-deposits)
"?date-range=week")} "Expected Deposits")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-tenders)
"?date-range=week")} "Tenders")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes (menu-button- {"@click.prevent" "if (selected == 'invoices') {selected = null } else { selected = 'invoices'} "
:pos-refunds) :icon svg/accounting-invoice-mail}
"?date-range=week")} "Refunds") "Invoices")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes (sub-menu-
:pos-cash-drawer-shifts) {:selector "invoices"}
"?date-range=week")} "Cash drawer shifts") (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
#_(menu-button- {:href "Sales"} "Cash Shifts") ::invoice-route/page)
#_(menu-button- {:href "Sales"} "Tenders"))] {:date-range "month"})
[:li {:x-data (hx/json {:open false})} :active? (= ::invoice-route/page (:matched-route request))}
(menu-button- {"@click" "open = !open"
:icon svg/payments} "All")
"Payments") (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
(sub-menu- (hx/alpine-appear {:x-show "open"}) ::invoice-route/page)
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes {:date-range "month"})
::payment-routes/page) :active? (= ::invoice-route/page (:matched-route request))}
{ :date-range "month"})} "All") "Paid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::payment-routes/page) ::invoice-route/unpaid-page)
{:status "pending" {:date-range "month"})
:date-range "month"})} "Pending") :active? (= ::invoice-route/page (:matched-route request))}
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes "Unpaid")
::payment-routes/page) (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
{:status "cleared" ::invoice-route/voided-page)
:date-range "month"})} "Cleared") {:date-range "month"})
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes :active? (= ::invoice-route/page (:matched-route request))}
::payment-routes/page) "Voided"))
{:status "voided"
:date-range "month"})} "Voided"))] (menu-button- {:icon svg/receipt-register-1
"@click.prevent" "if (selected == 'sales') {selected = null } else { selected = 'sales'} "}
"Sales")
(sub-menu- {:selector "sales"}
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-sales)
"?date-range=week")
:active? (= :pos-sales (:matched-route request))} "Sales")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-expected-deposits)
"?date-range=week")
:active? (= :pos-expected-deposits (:matched-route request))}
"Expected Deposits")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-tenders)
"?date-range=week")
:active? (= :pos-tenders (:matched-route request))} "Tenders")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-refunds)
"?date-range=week")
:active? (= :pos-refunds (:matched-route request))} "Refunds")
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
:pos-cash-drawer-shifts)
"?date-range=week")
:active? (= :cash-drawer-shifts (:matched-route request))} "Cash drawer shifts"))
;; TODO make specific routes for categories
;; TODO auto-apen sub menus
(menu-button- {"@click.prevent" "if (selected == 'payments') {selected = null } else { selected = 'payments'} "
:icon svg/payments}
"Payments")
(sub-menu- {:selector "payments"}
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::payment-routes/page)
{:date-range "month"})
:active? (= ::payment-routes/page (:matched-route request))} "All")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::payment-routes/page)
{:status "pending"
:date-range "month"})
:active? (= ::payment-routes/page (:matched-route request))} "Pending")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::payment-routes/page)
{:status "cleared"
:date-range "month"})
:active? (= ::payment-routes/page (:matched-route request))} "Cleared")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::payment-routes/page)
{:status "voided"
:date-range "month"})
:active? (= ::payment-routes/page (:matched-route request))} "Voided"))
[:li {:x-data (hx/json {:open false})} [:li {:x-data (hx/json {:open false})}
(menu-button- {"@click" "open = !open" (menu-button- {"@click.prevent" "if (selected == 'transactions') {selected = null } else { selected = 'transactions'} "
:icon svg/bank} :icon svg/bank}
"Transactions") "Transactions")
(sub-menu- (hx/alpine-appear {:x-show "open"}) (sub-menu- {:selector "transactions"}
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:transactions)} "All") :transactions)} "All")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
@@ -155,26 +191,26 @@
:approved-transactions)} "Approved") :approved-transactions)} "Approved")
(menu-button- {:href (bidi/path-for ssr-routes/only-routes (menu-button- {:href (bidi/path-for ssr-routes/only-routes
:transaction-insights)} "Insights"))] :transaction-insights)} "Insights"))]
[:li {:x-data (hx/json {:open false})}
(menu-button- {"@click" "open = !open" (menu-button- {"@click.prevent" "if (selected == 'ledger') {selected = null } else { selected = 'ledger'} "
:icon svg/receipt} :icon svg/receipt}
"Ledger") "Ledger")
(sub-menu- (hx/alpine-appear {:x-show "open"}) (sub-menu- {:selector "ledger"}
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:ledger)} "Register") :ledger)} "Register")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:profit-and-loss)} "Profit & Loss") :profit-and-loss)} "Profit & Loss")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:profit-and-loss-detail)} "Profit & Loss Detail") :profit-and-loss-detail)} "Profit & Loss Detail")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:cash-flows)} "Cash Flows") :cash-flows)} "Cash Flows")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:balance-sheet)} "Balance Sheet") :balance-sheet)} "Balance Sheet")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:external-import-ledger)} "External Ledger Import"))]]) :external-import-ledger)} "External Ledger Import"))])
(defn company-aside-nav- [] (defn company-aside-nav- [_]
[:ul {:class "space-y-2" :hx-boost "true"} [:ul {:class "space-y-2" :hx-boost "true"}
[:li [:li
(menu-button- {:icon svg/vendors (menu-button- {:icon svg/vendors
@@ -204,40 +240,47 @@
"1099 Vendor Info" "1099 Vendor Info"
)]]) )]])
(defn admin-aside-nav- [] (defn admin-aside-nav- [{:keys [matched-route] :as request}]
[:ul {:class "space-y-2"} [:ul {:class "space-y-2" :x-data (hx/json {:selected "nil"})}
[:li [:li
(menu-button- {:icon svg/dashboard (menu-button- {:icon svg/dashboard
:active? (= :auto-ap.routes.admin/page matched-route)
:href (bidi/path-for ssr-routes/only-routes :auto-ap.routes.admin/page)} :href (bidi/path-for ssr-routes/only-routes :auto-ap.routes.admin/page)}
"Dashboard")] "Dashboard")]
[:li [:li
(menu-button- {:icon svg/restaurant (menu-button- {:icon svg/restaurant
:href (bidi/path-for ssr-routes/only-routes ::ac-routes/page) } :active? (= ::ac-routes/page matched-route)
:href (bidi/path-for ssr-routes/only-routes ::ac-routes/page)}
"Clients")] "Clients")]
[:li [:li
(menu-button- {:icon svg/vendors (menu-button- {:icon svg/vendors
:active? (= ::v-routes/page matched-route)
:href (bidi/path-for ssr-routes/only-routes :href (bidi/path-for ssr-routes/only-routes
::v-routes/page)} ::v-routes/page)}
"Vendors")] "Vendors")]
[:li [:li
(menu-button- {:icon svg/user (menu-button- {:icon svg/user
:active? (= :users matched-route)
:href (bidi/path-for ssr-routes/only-routes :href (bidi/path-for ssr-routes/only-routes
:users)} :users)}
"Users")] "Users")]
[:li [:li
(menu-button- {:icon svg/accounts (menu-button- {:icon svg/accounts
:active? (= :admin-accounts matched-route)
:href (bidi/path-for ssr-routes/only-routes :href (bidi/path-for ssr-routes/only-routes
:admin-accounts)} :admin-accounts)}
"Accounts")] "Accounts")]
[:li [:li
(menu-button- {:icon svg/cog (menu-button- {:icon svg/cog
:active? (= ::transaction-rules/page matched-route)
:href (bidi/path-for ssr-routes/only-routes ::transaction-rules/page)} :href (bidi/path-for ssr-routes/only-routes ::transaction-rules/page)}
"Rules")] "Rules")]
[:li [:li
(menu-button- {:icon svg/question (menu-button- {:icon svg/question
:active? (= :admin-rules matched-route)
:href (bidi/path-for ssr-routes/only-routes :href (bidi/path-for ssr-routes/only-routes
:admin-history) :admin-history)
:hx-boost "true"} :hx-boost "true"}
@@ -245,20 +288,24 @@
[:li [:li
(menu-button- {:icon svg/rabbit (menu-button- {:icon svg/rabbit
:active? (= :admin-jobs matched-route)
:href (bidi/path-for ssr-routes/only-routes :href (bidi/path-for ssr-routes/only-routes
:admin-jobs)} :admin-jobs)}
"Background Jobs")] "Background Jobs")]
[:li {:x-data (hx/json {:open false})}
(menu-button- {:icon svg/arrow-in
"@click" "open = !open"}
"Import")
(sub-menu- (hx/alpine-appear
{:x-show "open"}) (menu-button- {:icon svg/arrow-in
(menu-button- {:href (bidi/path-for ssr-routes/only-routes "@click.prevent" "if (selected == 'import') {selected = null } else { selected = 'import'} "}
::ei-routes/page)} "Excel Invoices") "Import")
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
::ib-routes/page)} "Import Batches") (sub-menu- {:selector "import"}
(menu-button- {:href (bidi/path-for ssr-routes/only-routes (menu-button- {:href (bidi/path-for ssr-routes/only-routes
:admin-ezcater-xls) ::ei-routes/page)
:hx-boost "true"} "EZCater XLS Import"))]]) :active? (= ::ei-routes/page matched-route)} "Excel Invoices")
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
::ib-routes/page)
:active? (= ::ib-routes/page matched-route)} "Import Batches")
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
:admin-ezcater-xls)
:active? (= :admin-ezcater-xls matched-route)
:hx-boost "true"} "EZCater XLS Import"))])

View File

@@ -6,7 +6,7 @@
[auto-ap.ssr.svg :as svg] [auto-ap.ssr.svg :as svg]
[auto-ap.ssr.hx :as hx])) [auto-ap.ssr.hx :as hx]))
(defn page- [{:keys [nav page-specific client clients client-selection identity app-params] :or {app-params {}}} & children] (defn page- [{:keys [nav page-specific client clients client-selection identity app-params request] :or {app-params {}} } & children]
[:div#app {"_" (hiccup/raw " [:div#app {"_" (hiccup/raw "
on notification from body put event.detail.value into #notification-details then add .htmx-added to #notification-holder then remove .hidden from #notification-holder then wait 30ms then remove .htmx-added from #notification-holder on notification from body put event.detail.value into #notification-details then add .htmx-added to #notification-holder then remove .hidden from #notification-holder then wait 30ms then remove .htmx-added from #notification-holder
on htmx:responseError put event.detail.xhr.response into #error-details then add .htmx-added to #error-holder then remove .hidden from #error-holder then wait 30ms then remove .htmx-added from #error-holder" on htmx:responseError put event.detail.xhr.response into #error-details then add .htmx-added to #error-holder then remove .hidden from #error-holder then wait 30ms then remove .htmx-added from #error-holder"
@@ -19,7 +19,8 @@
[:div#app-contents.flex.pt-16.overflow-hidden (assoc app-params [:div#app-contents.flex.pt-16.overflow-hidden (assoc app-params
:hx-disinherit "*" :hx-disinherit "*"
:x-init "leftNavShow = true") :x-init "leftNavShow = true")
(left-aside- {:nav nav (left-aside- {:nav (when nav
(nav request))
:page-specific page-specific}) :page-specific page-specific})
[:div#main-content {:class "relative w-full h-full overflow-y-auto px-4 bg-gray-100 dark:bg-gray-900 min-h-content lg:pl-64" [:div#main-content {:class "relative w-full h-full overflow-y-auto px-4 bg-gray-100 dark:bg-gray-900 min-h-content lg:pl-64"
":class" "leftNavShow ? 'lg:pl-64' : ''" ":class" "leftNavShow ? 'lg:pl-64' : ''"

View File

@@ -208,7 +208,6 @@
(defn table-route [grid-spec] (defn table-route [grid-spec]
(-> (fn table [{:keys [identity] :as request}] (-> (fn table [{:keys [identity] :as request}]
(alog/peek ::qp (pr-str (:query-params request)))
(let [unparse-query-params (or (:unparse-query grid-spec) (let [unparse-query-params (or (:unparse-query grid-spec)
default-unparse-query-params)] default-unparse-query-params)]
(html-response (table* (html-response (table*
@@ -249,7 +248,8 @@
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:clients (:clients request) :clients (:clients request)
:client (:client request) :client (:client request)
:identity (:identity request)} :identity (:identity request)
:request request}
(apply com/breadcrumbs {} (:breadcrumbs grid-spec)) (apply com/breadcrumbs {} (:breadcrumbs grid-spec))
[:div {:x-data (hx/json {:selected [] :all_selected false}) [:div {:x-data (hx/json {:selected [] :all_selected false})
"x-bind:hx-vals" "JSON.stringify({selected: $data.selected, 'all-selected': $data.all_selected})" "x-bind:hx-vals" "JSON.stringify({selected: $data.selected, 'all-selected': $data.all_selected})"
@@ -277,7 +277,9 @@
[:hide? {:optional true} [:=> [:cat entity-spec] :boolean]]])) [:hide? {:optional true} [:=> [:cat entity-spec] :boolean]]]))
(def grid-spec (m/schema [:map (def grid-spec (m/schema [:map
[:id :string] [:id :string]
[:nav vector?] [:nav [:=>
[:cat request-spec]
vector?]]
[:page-specific-nav [:page-specific-nav
{:optional true {:optional true
:default (fn [request])} :default (fn [request])}

View File

@@ -420,7 +420,7 @@ invoice_dropzone = new Dropzone(\"#invoice\", {
:method request-method) :method request-method)
(base-page (base-page
request request
(com/page {:nav (com/admin-aside-nav) (com/page {:nav com/admin-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:client (:client request) :client (:client request)
:identity (:identity request) :identity (:identity request)

View File

@@ -375,7 +375,7 @@
;; TODO fix parsing of query params ;; TODO fix parsing of query params
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:nav (com/main-aside-nav) :nav com/main-aside-nav
:check-boxes? true :check-boxes? true
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page

View File

@@ -278,7 +278,7 @@
;; TODO fix parsing of query params ;; TODO fix parsing of query params
(def grid-page (def grid-page
(helper/build {:id "entity-table" (helper/build {:id "entity-table"
:nav (com/main-aside-nav) :nav com/main-aside-nav
:check-boxes? true :check-boxes? true
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
@@ -364,16 +364,16 @@
:class "w-8" :class "w-8"
:render (fn [p] :render (fn [p]
(link-dropdown (concat (->> p :payment/invoices (map (fn [invoice] (link-dropdown (concat (->> p :payment/invoices (map (fn [invoice]
{:link (hu/url (bidi/path-for ssr-routes/only-routes {:link (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/page) ::invoice-route/page)
{:exact-match-id (:db/id invoice)}) {:exact-match-id (:db/id invoice)})
:content (str "Inv. " (:invoice/invoice-number invoice))}))) :content (str "Inv. " (:invoice/invoice-number invoice))})))
(some-> p :transaction/_payment ((fn [t] (some-> p :transaction/_payment ((fn [t]
[{:link (hu/url (bidi/path-for client-routes/routes [{:link (hu/url (bidi/path-for client-routes/routes
:transactions) :transactions)
{:exact-match-id (:db/id (first t))}) {:exact-match-id (:db/id (first t))})
:color :secondary :color :secondary
:content "Transaction"}]))))))}]})) :content "Transaction"}]))))))}]}))
(def row* (partial helper/row* grid-page)) (def row* (partial helper/row* grid-page))

View File

@@ -136,23 +136,23 @@
(def grid-page (def grid-page
(helper/build (helper/build
{:id "expected-deposit-table" {:id "expected-deposit-table"
:nav (com/main-aside-nav) :nav com/main-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp
(query-params/parse-key :total-gte query-params/parse-double) (query-params/parse-key :total-gte query-params/parse-double)
(query-params/parse-key :total-lte query-params/parse-double) (query-params/parse-key :total-lte query-params/parse-double)
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:oob-render :oob-render
(fn [request] (fn [request]
[(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)]) [(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)])
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:company)} :company)}
"POS"] "POS"]
[:a {:href (bidi/path-for ssr-routes/only-routes [:a {:href (bidi/path-for ssr-routes/only-routes
:pos-expected-deposits)} :pos-expected-deposits)}
"Expected deposits"]] "Expected deposits"]]
:title "Expected deposits" :title "Expected deposits"
:entity-name "Expected deposit" :entity-name "Expected deposit"
:route :pos-expected-deposit-table :route :pos-expected-deposit-table
@@ -170,7 +170,7 @@
:name "Client" :name "Client"
:sort-key "client" :sort-key "client"
:hide? (fn [args] :hide? (fn [args]
(= (count (:clients args)) 1)) (= (count (:clients args)) 1))
:render #(-> % :expected-deposit/client :client/code)} :render #(-> % :expected-deposit/client :client/code)}
{:key "date" {:key "date"
:name "Date" :name "Date"

View File

@@ -95,23 +95,23 @@
(def grid-page (def grid-page
(helper/build {:id "refund-table" (helper/build {:id "refund-table"
:nav (com/main-aside-nav) :nav com/main-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp
(query-params/parse-key :total-gte query-params/parse-double) (query-params/parse-key :total-gte query-params/parse-double)
(query-params/parse-key :total-lte query-params/parse-double) (query-params/parse-key :total-lte query-params/parse-double)
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:oob-render :oob-render
(fn [request] (fn [request]
[(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)]) [(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)])
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:company)} :company)}
"POS"] "POS"]
[:a {:href (bidi/path-for ssr-routes/only-routes [:a {:href (bidi/path-for ssr-routes/only-routes
:pos-refunds)} :pos-refunds)}
"Refunds"]] "Refunds"]]
:title "Refunds" :title "Refunds"
:entity-name "Refund" :entity-name "Refund"
:route :pos-refund-table :route :pos-refund-table
@@ -119,7 +119,7 @@
:name "Client" :name "Client"
:sort-key "client" :sort-key "client"
:hide? (fn [args] :hide? (fn [args]
(= (count (:clients args)) 1)) (= (count (:clients args)) 1))
:render #(-> % :sales-refund/client :client/code)} :render #(-> % :sales-refund/client :client/code)}
{:key "date" {:key "date"
:name "Date" :name "Date"

View File

@@ -169,14 +169,14 @@
(def grid-page (def grid-page
(helper/build (helper/build
{:id "sales-table" {:id "sales-table"
:nav (com/main-aside-nav) :nav com/main-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp
(query-params/parse-key :processor #(query-params/parse-keyword "ccp-processor" %)) (query-params/parse-key :processor #(query-params/parse-keyword "ccp-processor" %))
(query-params/parse-key :total-gte query-params/parse-double) (query-params/parse-key :total-gte query-params/parse-double)
(query-params/parse-key :total-lte query-params/parse-double) (query-params/parse-key :total-lte query-params/parse-double)
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:oob-render :oob-render
(fn [request] (fn [request]
[(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)]) [(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)])

View File

@@ -112,14 +112,14 @@
(def grid-page (def grid-page
(helper/build (helper/build
{:id "tender-table" {:id "tender-table"
:nav (com/main-aside-nav) :nav com/main-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp
(query-params/parse-key :processor #(query-params/parse-keyword "ccp-processor" %)) (query-params/parse-key :processor #(query-params/parse-keyword "ccp-processor" %))
(query-params/parse-key :total-gte query-params/parse-double) (query-params/parse-key :total-gte query-params/parse-double)
(query-params/parse-key :total-lte query-params/parse-double) (query-params/parse-key :total-lte query-params/parse-double)
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:oob-render :oob-render
(fn [request] (fn [request]
[(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)]) [(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)])

View File

@@ -317,7 +317,7 @@
(defn page [{:keys [identity matched-route session clients] :as request}] (defn page [{:keys [identity matched-route session clients] :as request}]
(base-page (base-page
request request
(com/page {:nav (com/main-aside-nav) (com/page {:nav com/main-aside-nav
:client-selection (:client-selection (:session request)) :client-selection (:client-selection (:session request))
:client (:client request) :client (:client request)
:identity (:identity request) :identity (:identity request)
@@ -325,7 +325,8 @@
:transaction-insights) :transaction-insights)
:hx-trigger "clientSelected from:body" :hx-trigger "clientSelected from:body"
:hx-select "#app-contents" :hx-select "#app-contents"
:hx-swap "outerHTML swap:300ms"}} :hx-swap "outerHTML swap:300ms"}
:request request}
(com/breadcrumbs {} (com/breadcrumbs {}
[:a {:href (bidi/path-for client-routes/routes [:a {:href (bidi/path-for client-routes/routes
:transactions)} :transactions)}

View File

@@ -45,7 +45,6 @@
[:script {:src "/js/htmx-disable.js"}] [:script {:src "/js/htmx-disable.js"}]
[:script {:type "text/javascript", :src "https://cdn.yodlee.com/fastlink/v4/initialize.js", :async "async"}]] [:script {:type "text/javascript", :src "https://cdn.yodlee.com/fastlink/v4/initialize.js", :async "async"}]]
[:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/css/datepicker.min.css"}] [:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/css/datepicker.min.css"}]
[:script {:type "text/javascript" :src "https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/js/datepicker-full.min.js"}] [:script {:type "text/javascript" :src "https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/js/datepicker-full.min.js"}]
[:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/choices.js@9.0.1/public/assets/styles/choices.min.css"}] [:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/choices.js@9.0.1/public/assets/styles/choices.min.css"}]

View File

@@ -205,20 +205,20 @@
(def grid-page (def grid-page
(helper/build {:id "user-table" (helper/build {:id "user-table"
:nav (com/admin-aside-nav) :nav com/admin-aside-nav
:page-specific-nav filters :page-specific-nav filters
:fetch-page fetch-page :fetch-page fetch-page
:parse-query-params (comp :parse-query-params (comp
(query-params/parse-key :role #(query-params/parse-keyword "user-role" %)) (query-params/parse-key :role #(query-params/parse-keyword "user-role" %))
(query-params/parse-key :client parse-client) (query-params/parse-key :client parse-client)
(helper/default-parse-query-params grid-page)) (helper/default-parse-query-params grid-page))
:row-buttons (fn [request entity] :row-buttons (fn [request entity]
[(com/button {:hx-post (str (bidi/path-for ssr-routes/only-routes [(com/button {:hx-post (str (bidi/path-for ssr-routes/only-routes
:user-impersonate)) :user-impersonate))
:hx-vals (format "{\"db/id\": \"%s\"}" (:db/id entity))} "Impersonate") :hx-vals (format "{\"db/id\": \"%s\"}" (:db/id entity))} "Impersonate")
(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes (com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes
:user-edit-dialog :user-edit-dialog
:db/id (:db/id entity)))} :db/id (:db/id entity)))}
svg/pencil)]) svg/pencil)])
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:admin)} :admin)}
@@ -238,7 +238,7 @@
(when-let [profile-image (:user/profile-image-url user) ] (when-let [profile-image (:user/profile-image-url user) ]
[:div.rounded-full.overflow-hidden.w-8.h-8.display-inline [:div.rounded-full.overflow-hidden.w-8.h-8.display-inline
[:img {:src profile-image }]]) [:img {:src profile-image }]])
[:span.inline-block ](:user/name user)])} [:span.inline-block ] (:user/name user)])}
{:key "email" {:key "email"
:name "Email" :name "Email"