From 721bbaea531644b1e0688f17a5eccefe2a9643f0 Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 30 May 2023 14:36:34 -0700 Subject: [PATCH] All of my company works spame way --- src/clj/auto_ap/datomic.clj | 8 +- src/clj/auto_ap/datomic/reports.clj | 1 - src/clj/auto_ap/routes/auth.clj | 1 + src/clj/auto_ap/ssr/company/company_1099.clj | 423 +++++++++---------- src/clj/auto_ap/ssr/components/navbar.clj | 10 +- src/clj/auto_ap/ssr/grid_page_helper.clj | 12 +- 6 files changed, 229 insertions(+), 226 deletions(-) diff --git a/src/clj/auto_ap/datomic.clj b/src/clj/auto_ap/datomic.clj index a072d147..dd2c4b8c 100644 --- a/src/clj/auto_ap/datomic.clj +++ b/src/clj/auto_ap/datomic.clj @@ -623,9 +623,13 @@ (range length)))] (sort comparator results ))) -(defn apply-pagination [args results] - (log/info (take 4 results)) +(defn apply-pagination-raw [args results] + {:entries (->> results + (drop (:start args 0)) + (take (:count args (or (:per-page args) default-pagination-size)))) + :count (count results)}) +(defn apply-pagination [args results] {:ids (->> results (drop (:start args 0)) (take (:count args (or (:per-page args) default-pagination-size))) diff --git a/src/clj/auto_ap/datomic/reports.clj b/src/clj/auto_ap/datomic/reports.clj index 777b4d87..66ce0cf2 100644 --- a/src/clj/auto_ap/datomic/reports.clj +++ b/src/clj/auto_ap/datomic/reports.clj @@ -59,7 +59,6 @@ (map :db/id (:report/client r)))))))) (defn get-graphql [args] - (clojure.pprint/pprint args) (let [db (dc/db conn) {ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)] diff --git a/src/clj/auto_ap/routes/auth.clj b/src/clj/auto_ap/routes/auth.clj index 45f07582..50698bf9 100644 --- a/src/clj/auto_ap/routes/auth.clj +++ b/src/clj/auto_ap/routes/auth.clj @@ -45,6 +45,7 @@ :user/name (:name profile)}) auth {:user (:name profile) :exp (time/plus (time/now) (time/days 30)) + :db/id (:db/id user) :user/clients (map (fn [c] (select-keys c [:client/code :db/id :client/locations])) (:user/clients user)) diff --git a/src/clj/auto_ap/ssr/company/company_1099.clj b/src/clj/auto_ap/ssr/company/company_1099.clj index 0e2c5583..8f8b6818 100644 --- a/src/clj/auto_ap/ssr/company/company_1099.clj +++ b/src/clj/auto_ap/ssr/company/company_1099.clj @@ -1,224 +1,229 @@ (ns auto-ap.ssr.company.company-1099 (:require - [auto-ap.datomic :refer [conn remove-nils]] - [auto-ap.graphql.utils :refer [is-admin?]] + [auto-ap.datomic :refer [apply-pagination-raw conn remove-nils]] + [auto-ap.graphql.utils :refer [assert-can-see-client is-admin?]] [auto-ap.ssr-routes :as ssr-routes] [auto-ap.ssr.components :as com] + [auto-ap.ssr.grid-page-helper :as helper] [auto-ap.ssr.svg :as svg] - [auto-ap.ssr.ui :refer [base-page]] - [auto-ap.ssr.utils :refer [html-response form-data->map path->name]] + [auto-ap.ssr.utils :refer [form-data->map html-response path->name]] [bidi.bidi :as bidi] + [cemerick.url :as url] [clojure.string :as str] [datomic.api :as dc] [iol-ion.query :refer [can-see-client?]])) +(def vendor-read '[:db/id + :vendor/name + {:vendor/legal-entity-1099-type [:db/ident]} + {:vendor/legal-entity-tin-type [:db/ident]} + {:vendor/address [:address/street1 + :address/city + :address/state + :address/zip]} + :vendor/legal-entity-tin + :vendor/legal-entity-name + :vendor/legal-entity-first-name + :vendor/legal-entity-middle-name + :vendor/legal-entity-last-name]) +(defn sum-for-client-vendor [client-id vendor-id] + (ffirst (dc/q '[:find + (sum ?a) + :with ?d + :in $ ?c ?v + :where + [?p :payment/client ?c] + [?p :payment/date ?d ] + [(>= ?d #inst "2022-01-01T08:00")] + [(< ?d #inst "2023-01-01T08:00")] + [?p :payment/type :payment-type/check] + [?p :payment/amount ?a] + [?p :payment/vendor ?v]] + (dc/db conn) + client-id + vendor-id))) -(defn get-1099-companies [user session] +(defn get-1099-companies [user {:keys [client-id] :as args}] (let [clients (->> (dc/q '[:find ?c - :in $ ?user - :where [?c :client/code] - [(iol-ion.query/can-see-client? ?user ?c)]] - (dc/db conn) user) + :in $ ?user + :where [?c :client/code] + [(iol-ion.query/can-see-client? ?user ?c)]] + (dc/db conn) user) (map first) set) results (cond - (and (some-> session :client :db/id) - (can-see-client? user - (some-> session :client :db/id))) + (and client-id + (can-see-client? user client-id)) (dc/q '[:find - (pull ?c [:client/code :db/id]) - (pull ?v [:db/id - :vendor/name - {:vendor/legal-entity-1099-type [:db/ident]} - {:vendor/legal-entity-tin-type [:db/ident]} - {:vendor/address [:address/street1 - :address/city - :address/state - :address/zip]} - :vendor/legal-entity-tin - :vendor/legal-entity-name - :vendor/legal-entity-first-name - :vendor/legal-entity-middle-name - :vendor/legal-entity-last-name]) - (sum ?a) - :with ?d - :in $ ?c - :where - [?p :payment/client ?c] - [?p :payment/date ?d ] - [(>= ?d #inst "2022-01-01T08:00")] - [(< ?d #inst "2023-01-01T08:00")] - [?p :payment/type :payment-type/check] - [?p :payment/amount ?a] - [?p :payment/vendor ?v]] - (dc/db conn) - (some-> session :client :db/id)) + (pull ?c [:client/code :db/id]) + (pull ?v vendor-read) + (sum ?a) + :with ?d + :in $ ?c vendor-read + :where + [?p :payment/client ?c] + [?p :payment/date ?d ] + [(>= ?d #inst "2022-01-01T08:00")] + [(< ?d #inst "2023-01-01T08:00")] + [?p :payment/type :payment-type/check] + [?p :payment/amount ?a] + [?p :payment/vendor ?v]] + (dc/db conn) + client-id + vendor-read) (is-admin? user) (dc/q '[:find - (pull ?c [:client/code :db/id]) - (pull ?v [:db/id - :vendor/name - {:vendor/legal-entity-1099-type [:db/ident]} - {:vendor/legal-entity-tin-type [:db/ident]} - {:vendor/address [:address/street1 - :address/city - :address/state - :address/zip]} - :vendor/legal-entity-tin - :vendor/legal-entity-name - :vendor/legal-entity-first-name - :vendor/legal-entity-middle-name - :vendor/legal-entity-last-name]) - (sum ?a) - :with ?d - :in $ - :where - [?p :payment/date ?d ] - [(>= ?d #inst "2022-01-01T08:00")] - [(< ?d #inst "2023-01-01T08:00")] - [?p :payment/type :payment-type/check] - [?p :payment/client ?c] - [?p :payment/amount ?a] - [?p :payment/vendor ?v]] - (dc/db conn)) + (pull ?c [:client/code :db/id]) + (pull ?v vendor-read) + (sum ?a) + :with ?d + :in $ vendor-read + :where + [?p :payment/date ?d ] + [(>= ?d #inst "2022-01-01T08:00")] + [(< ?d #inst "2023-01-01T08:00")] + [?p :payment/type :payment-type/check] + [?p :payment/client ?c] + [?p :payment/amount ?a] + [?p :payment/vendor ?v]] + (dc/db conn) + vendor-read) :else (dc/q '[:find - (pull ?c [:client/code :db/id]) - (pull ?v [:db/id - :vendor/name - {:vendor/legal-entity-1099-type [:db/ident]} - {:vendor/legal-entity-tin-type [:db/ident]} - {:vendor/address [:address/street1 - :address/city - :address/state - :address/zip]} - :vendor/legal-entity-tin - :vendor/legal-entity-name - :vendor/legal-entity-first-name - :vendor/legal-entity-middle-name - :vendor/legal-entity-last-name]) - (sum ?a) - :with ?d - :in $ [?c ...] - :where - [?p :payment/client ?c] - [?p :payment/date ?d ] - [(>= ?d #inst "2022-01-01T08:00")] - [(< ?d #inst "2023-01-01T08:00")] - [?p :payment/type :payment-type/check] - [?p :payment/amount ?a] - [?p :payment/vendor ?v]] - (dc/db conn) - clients))] - (->> results - (filter (fn [[_ _ a]] - (>= (or a 0.0) 600.0))) - (sort-by (fn [[client _ amount]] - [(:client/code client ) amount])) - (into [])))) + (pull ?c [:client/code :db/id]) + (pull ?v vendor-read) + (sum ?a) + :with ?d + :in $ [?c ...] vendor-read + :where + [?p :payment/client ?c] + [?p :payment/date ?d ] + [(>= ?d #inst "2022-01-01T08:00")] + [(< ?d #inst "2023-01-01T08:00")] + [?p :payment/type :payment-type/check] + [?p :payment/amount ?a] + [?p :payment/vendor ?v]] + (dc/db conn) + clients + vendor-read)) + all (->> results + (filter (fn [[_ _ a]] + (>= (or a 0.0) 600.0))) + (sort-by (fn [[client _ amount]] + [(:client/code client ) amount])) + (into [])) + paginated (apply-pagination-raw args all)] + [(:entries paginated) (:count paginated)])) -(defn row* [{:keys [client vendor amount flash?]}] - (com/data-grid-row - {:class (when flash? - "live-added")} - (com/data-grid-cell {} (:client/code client)) - (com/data-grid-cell - {} - [:div.flex.whitespace-nowrap.items-center.gap-4 - [:div [:div (:vendor/name vendor)] - [:div.text-sm.text-gray-400 - (or (-> vendor :vendor/legal-entity-name not-empty) - (str (-> vendor :vendor/legal-entity-first-name) " " - (-> vendor :vendor/legal-entity-middle-name) " " - (-> vendor :vendor/legal-entity-last-name)))]] - (when-let [t99-type (some-> vendor :vendor/legal-entity-1099-type :db/ident name)] - (com/pill - {:class "text-xs font-medium" - :color :primary} - (str/capitalize t99-type)) - )]) - (com/data-grid-cell - {:class "hidden md:table-cell"} - [:div.flex.gap-4 - (when-let [tin (-> vendor :vendor/legal-entity-tin)] - [:span {:class "text-xs font-medium py-0.5 "} - tin]) - (when-let [tin-type (some-> vendor :vendor/legal-entity-tin-type :db/ident name)] - (com/pill {:class "text-xs font-medium" - :color :yellow} - (name tin-type)))]) - (com/data-grid-cell - {:class "hidden lg:table-cell"} - (if (-> vendor :vendor/address :address/street1) - [:div - [:div (-> vendor :vendor/address :address/street1)] " " - [:div - (-> vendor :vendor/address :address/street2)] " " - [:div - (-> vendor :vendor/address :address/city) " " - (-> vendor :vendor/address :address/state) "," - (-> vendor :vendor/address :address/zip)]] - [:p.text-sm.italic.text-gray-400 "No address"])) - (com/data-grid-cell {} - (com/pill {:class "text-xs font-medium" - :color :primary} - "Paid $" (Math/round amount))) - (com/data-grid-right-stack-cell - {} - (com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes - :company-1099-vendor-dialog - :vendor-id (:db/id vendor)) - :hx-target "#modal-holder" - :hx-swap "outerHTML"} - svg/pencil)))) -(defn table* [{:keys [identity session query-params hx-query-params]} & {:keys [flash-id]}] - (let [start (or (some-> (or (get query-params "start") (get hx-query-params "start")) not-empty (Long/parseLong )) - 0) - per-page (or (some-> (or (get query-params "per-page") (get hx-query-params "per-page")) not-empty (Long/parseLong )) - 30) - companies (get-1099-companies identity session) - total (count companies) - companies (subvec companies (Math/min start total) (Math/min (+ start per-page) total))] - (com/data-grid-card {:id "vendor-table" - :title "1099 Vendor Info" - :entity-name "vendors" - :route :company-1099-vendor-table - :start start - :per-page per-page - :total total - :action-buttons [(com/button {:color :primary} - (com/button-icon {} svg/refresh) - "Add new product") - (com/button {:color :secondary} - (com/button-icon {} svg/refresh) - "Update stocks 1/250") - (com/icon-button {} - svg/upload)] - :rows (for [[client vendor amount] companies] - (row* {:client client - :vendor vendor - :amount amount - :flash? (= flash-id - (:db/id vendor))})) - :headers [(com/data-grid-header {} "Client") - (com/data-grid-header {} "Vendor Name") - (com/data-grid-header {:class "hidden md:table-cell"} "TIN") - (com/data-grid-header {:class "hidden lg:table-cell"} "Address") - (com/data-grid-header {}) - (com/data-grid-header {})]}))) +(def grid-page {:id "vendor-table" + :nav (com/company-aside-nav) + :id-fn (comp :db/id second) + :fetch-page (fn [user args] + (get-1099-companies user args) + #_(r/get-graphql (into args {:id user}))) + :breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes + :company)} + "My Company"] -(defn vendor-save [{:keys [form-params identity route-params] :as request}] - @(dc/transact conn [(remove-nils - (-> (form-data->map form-params) - (assoc :db/id (Long/parseLong (:vendor-id route-params))) - (update :vendor/legal-entity-1099-type #(some->> % not-empty (keyword "legal-entity-1099-type"))) - (update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))]) - (html-response - (table* request :flash-id (Long/parseLong (:vendor-id route-params))) - :headers {"hx-trigger" "closeModal"})) + [:a {:href (bidi/path-for ssr-routes/only-routes + :company-1099)} + "1099 Vendor Info"]] + :title "1099 Vendors" + :entity-name "Vendors" + :route :company-1099-vendor-table + :action-buttons (fn [user] + nil) + :row-buttons (fn [user e] + [(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes + :company-1099-vendor-dialog + :vendor-id (:db/id (second e))) + "?" + (url/map->query {:client-id (:db/id (first e))})) + :hx-target "#modal-holder" + :hx-swap "outerHTML"} + svg/pencil)]) + :headers [{:key "Client" + :name "Client" + :sort-key "client" + :render (comp :client/code first)} + {:key "vendor-name" + :name "Vendor Name" + :sort-key "vendor" + :render (fn [[_ vendor]] + [:div.flex.whitespace-nowrap.items-center.gap-4 + [:div [:div (:vendor/name vendor)] + [:div.text-sm.text-gray-400 + (or (-> vendor :vendor/legal-entity-name not-empty) + (str (-> vendor :vendor/legal-entity-first-name) " " + (-> vendor :vendor/legal-entity-middle-name) " " + (-> vendor :vendor/legal-entity-last-name)))]] + (when-let [t99-type (some-> vendor :vendor/legal-entity-1099-type :db/ident name)] + (com/pill + {:class "text-xs font-medium" + :color :primary} + (str/capitalize t99-type)) + )])} + {:key "tin" + :name "TIN" + :sort-key "tin" + :show-starting "md" + :render (fn [[_ vendor]] + [:div.flex.gap-4 + (when-let [tin (-> vendor :vendor/legal-entity-tin)] + [:span {:class "text-xs font-medium py-0.5 "} + tin]) + (when-let [tin-type (some-> vendor :vendor/legal-entity-tin-type :db/ident name)] + (com/pill {:class "text-xs font-medium" + :color :yellow} + (name tin-type)))] + )} + {:key "address" + :name "Address" + :sort-key "address" + :show-starting "lg" + :render (fn [[_ vendor]] + (if (-> vendor :vendor/address :address/street1) + [:div + [:div (-> vendor :vendor/address :address/street1)] " " + [:div + (-> vendor :vendor/address :address/street2)] " " + [:div + (-> vendor :vendor/address :address/city) " " + (-> vendor :vendor/address :address/state) "," + (-> vendor :vendor/address :address/zip)]] + [:p.text-sm.italic.text-gray-400 "No address"]))} + {:key "paid" + :name "Paid" + :sort-key "paid" + :render (fn [[_ _ paid]] + (com/pill {:class "text-xs font-medium" + :color :primary} + "Paid $" (Math/round paid)))}]}) + + + +(def table* (partial helper/table* grid-page)) +(def row* (partial helper/row* grid-page)) + +(defn vendor-save [{:keys [form-params identity route-params query-params] :as request}] + (let [client-id (Long/parseLong (get query-params "client-id")) + vendor-id (Long/parseLong (:vendor-id route-params))] + (assert-can-see-client identity client-id) + @(dc/transact conn [(remove-nils + (-> (form-data->map form-params) + (assoc :db/id (Long/parseLong (:vendor-id route-params))) + (update :vendor/legal-entity-1099-type #(some->> % not-empty (keyword "legal-entity-1099-type"))) + (update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))]) + (html-response + + (row* identity [(dc/pull (dc/db conn) [:db/id :client/code] client-id) + (dc/pull (dc/db conn) vendor-read vendor-id) + (sum-for-client-vendor client-id vendor-id) + ] {:flash? true}) + :headers {"hx-trigger" "closeModal"}))) (defn vendor-dialog [request] (let [vendor (dc/pull (dc/db conn) '[* {:vendor/legal-entity-1099-type [:db/ident] @@ -229,8 +234,10 @@ [:form {:hx-post (str (bidi/path-for ssr-routes/only-routes :company-1099-vendor-save :request-method :post - :vendor-id (Long/parseLong (:vendor-id (:params request))))) - :hx-target "#vendor-table" + :vendor-id (Long/parseLong (:vendor-id (:params request)))) + "?" + (url/map->query {:client-id (:client-id (:params request))})) + :hx-target (format "#vendor-table tr[data-id=\"%d\"]" (:db/id vendor)) :hx-swap "outerHTML swap:300ms"} [:fieldset {:class "hx-disable"} (com/modal-card @@ -238,6 +245,7 @@ [:div.flex [:div.p-2 "Vendor 1099 Info"] [:p.ml-2.rounded.bg-gray-200.p-2.dark:bg-gray-600 (:vendor/name vendor)]] [:div.space-y-6 [:div.grid.grid-cols-6.gap-4 + [:h4.text-xl.border-b.col-span-6 "Address"] [:div.col-span-6 (com/field {:label "Street 1"} @@ -312,20 +320,5 @@ "Save")]]] [:div])]])))) -(defn vendor-table [request] - (html-response (table* request) - :headers {"hx-push-url" (str "?start=" (get (:query-params request) "start"))})) - -(defn page [{:keys [identity matched-route] :as request}] - (base-page - request - (com/page {:nav (com/company-aside-nav) - :active-client (:client (:session request)) - :identity (:identity request)} - (com/breadcrumbs {} - [:a {:href (bidi/path-for ssr-routes/only-routes - :company)} "My Company"] - [:a {:href (bidi/path-for ssr-routes/only-routes - :company-1099)} "1099 Vendor Info"]) - (table* request)) - nil)) +(def vendor-table (partial helper/table grid-page)) +(def page (partial helper/page grid-page)) diff --git a/src/clj/auto_ap/ssr/components/navbar.clj b/src/clj/auto_ap/ssr/components/navbar.clj index 21024527..8085d9f2 100644 --- a/src/clj/auto_ap/ssr/components/navbar.clj +++ b/src/clj/auto_ap/ssr/components/navbar.clj @@ -1,5 +1,7 @@ (ns auto-ap.ssr.components.navbar (:require [auto-ap.ssr.components.buttons :refer [icon-button-]] + [datomic.api :as dc] + [auto-ap.datomic :refer [conn pull-attr]] [auto-ap.ssr.svg :as svg] [hiccup2.core :as hiccup] [bidi.bidi :as bidi] @@ -92,17 +94,17 @@ #_[:button {:id "theme-toggle", :data-tooltip-target "tooltip-toggle", :type "button", :class "text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5" } ] - [:div {:id "tooltip-toggle", :role "tooltip", :class "absolute z-10 inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm tooltip opacity-0 invisible", :style "position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate(2326px, 63px);", :data-popper-placement "bottom"} [:img {:src "https://flowbite.com/docs/images/people/profile-picture-5.jpg"}] + [:div {:id "tooltip-toggle", :role "tooltip", :class "absolute z-10 inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm tooltip opacity-0 invisible", :style "position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate(2326px, 63px);", :data-popper-placement "bottom"} [:img {:src (pull-attr (dc/db conn) :user/profile-image-url (:db/id identity))}] [:div {:class "tooltip-arrow", :data-popper-arrow "data-popper-arrow", :style "position: absolute; left: 0px; transform: translate(69px);"}]] [:div {:class "flex items-center ml-3"} [:div [:button {:type "button", :class "flex text-sm bg-gray-800 rounded-full focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600", :id "user-menu-button-2", :aria-expanded "false", :data-dropdown-toggle "dropdown-2"} [:span {:class "sr-only"} "Open user menu"] - [:img {:class "w-8 h-8 rounded-full", :src "https://flowbite.com/docs/images/people/profile-picture-5.jpg", :alt "user photo"}]]] + [:img {:class "w-8 h-8 rounded-full", :src (pull-attr (dc/db conn) :user/profile-image-url (:db/id identity)) :alt "user photo"}]]] [:div {:class "z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:bg-gray-700 dark:divide-gray-600", :id "dropdown-2", :style "position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate(2446px, 61px);", :data-popper-placement "bottom"} [:div {:class "px-4 py-3", :role "none"} - [:p {:class "text-sm text-gray-900 dark:text-white", :role "none"} "Neil Sims"] - [:p {:class "text-sm font-medium text-gray-900 truncate dark:text-gray-300", :role "none"} "neil.sims@flowbite.com"]] + [:p {:class "text-sm text-gray-900 dark:text-white", :role "none"} (:user/name identity)] + [:p {:class "text-sm font-medium text-gray-900 truncate dark:text-gray-300", :role "none"} (pull-attr (dc/db conn) :user/email (:db/id identity))]] [:ul {:class "py-1", :role "none"} [:li [:a {:href "#", :class "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-600 dark:hover:text-white", :role "menuitem"} "Dashboard"]] diff --git a/src/clj/auto_ap/ssr/grid_page_helper.clj b/src/clj/auto_ap/ssr/grid_page_helper.clj index 1c2c1d90..05df9a33 100644 --- a/src/clj/auto_ap/ssr/grid_page_helper.clj +++ b/src/clj/auto_ap/ssr/grid_page_helper.clj @@ -12,7 +12,9 @@ (defn row* [gridspec user entity {:keys [flash? delete-after-settle?] :as options}] (let [cells (mapv (fn [header] - (com/data-grid-cell {} + (com/data-grid-cell {:class (if-let [show-starting (:show-starting header)] + (format "hidden %s:table-cell" show-starting) + (:class header))} ((:render header) entity))) (:headers gridspec)) cells (conj cells (com/data-grid-right-stack-cell {} @@ -24,7 +26,8 @@ "live-added") "_" (hiccup/raw (when delete-after-settle? " on htmx:afterSettle wait 400ms then remove me")) - } + + :data-id ((:id-fn gridspec) entity)} cells))) (defn sort-icon [sort key] @@ -48,7 +51,7 @@ )) "default sort")) -(defn table* [grid-spec user {:keys [start per-page client flash-id sort]}] +(defn table* [grid-spec user {:keys [start per-page client flash-id sort request]}] (let [start (or start 0) per-page (or per-page 30) [entities total] ((:fetch-page grid-spec) @@ -56,7 +59,8 @@ {:start start :per-page per-page :client-id (:db/id client) - :sort sort})] + :sort sort + :request request})] (com/data-grid-card {:id (:id grid-spec) :title (:title grid-spec) :route (:route grid-spec)