ssr sales
This commit is contained in:
@@ -12,13 +12,19 @@
|
||||
[unilog.context :as lc]
|
||||
[com.brunobonacci.mulog :as mu]))
|
||||
|
||||
(defn row* [gridspec user entity {:keys [flash? delete-after-settle?] :as options}]
|
||||
(let [cells (mapv (fn [header]
|
||||
(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))
|
||||
(defn row* [gridspec user entity {:keys [flash? delete-after-settle? params] :as options}]
|
||||
(let [cells (->> gridspec
|
||||
:headers
|
||||
(filter (fn [h]
|
||||
(if (and (:hide? h)
|
||||
((:hide? h) params))
|
||||
nil
|
||||
h)))
|
||||
(mapv (fn [header]
|
||||
(com/data-grid-cell {:class (if-let [show-starting (:show-starting header)]
|
||||
(format "hidden %s:table-cell" show-starting)
|
||||
(:class header))}
|
||||
((:render header) entity)))))
|
||||
cells (conj cells (com/data-grid-right-stack-cell {}
|
||||
(into [:form
|
||||
[:input {:type :hidden :name "id" :value ((:id-fn gridspec) entity)}]]
|
||||
@@ -73,7 +79,7 @@
|
||||
(sort-by-list sort)]
|
||||
:action-buttons ((:action-buttons grid-spec) user params)
|
||||
:rows (for [entity entities]
|
||||
(row* grid-spec user entity {:flash? (= flash-id ((:id-fn grid-spec) entity))}))
|
||||
(row* grid-spec user entity {:flash? (= flash-id ((:id-fn grid-spec) entity)) :params params}))
|
||||
:thead-params {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
(:route grid-spec))
|
||||
:hx-target (str "#" (:id grid-spec))
|
||||
@@ -81,25 +87,35 @@
|
||||
:hx-vals "js:{\"toggle-sort\": event.detail.key || \"\"}"}
|
||||
:headers
|
||||
(conj
|
||||
(mapv
|
||||
(fn [h]
|
||||
(if (:sort-key h)
|
||||
(com/data-grid-sort-header {:class (if-let [show-starting (:show-starting h)]
|
||||
(->> grid-spec
|
||||
:headers
|
||||
(map
|
||||
(fn [h]
|
||||
(cond
|
||||
(and (:hide? h)
|
||||
((:hide? h) params))
|
||||
nil
|
||||
|
||||
(:sort-key h)
|
||||
(com/data-grid-sort-header {:class (if-let [show-starting (:show-starting h)]
|
||||
(format "hidden %s:table-cell" show-starting)
|
||||
(:class h))
|
||||
:sort-key (:sort-key h)}
|
||||
|
||||
[:div.flex.gap-4.items-center
|
||||
(:name h)
|
||||
[:div.h-6.w-6.text-gray-400.dark:text-gray-500 (sort-icon sort (:sort-key h))]])
|
||||
|
||||
:else
|
||||
(com/data-grid-header {:class (if-let [show-starting (:show-starting h)]
|
||||
(format "hidden %s:table-cell" show-starting)
|
||||
(:class h))
|
||||
:sort-key (:sort-key h)}
|
||||
(:name h))
|
||||
|
||||
[:div.flex.gap-4.items-center
|
||||
(:name h)
|
||||
[:div.h-6.w-6.text-gray-400.dark:text-gray-500 (sort-icon sort (:sort-key h))]])
|
||||
(com/data-grid-header {:class (if-let [show-starting (:show-starting h)]
|
||||
(format "hidden %s:table-cell" show-starting)
|
||||
(:class h))
|
||||
:sort-key (:sort-key h)}
|
||||
(:name h))
|
||||
|
||||
))
|
||||
(:headers grid-spec))
|
||||
)))
|
||||
(filter identity)
|
||||
(into []))
|
||||
(com/data-grid-header {}))})))
|
||||
|
||||
|
||||
@@ -146,7 +162,7 @@
|
||||
|
||||
(defn params->query-string [q]
|
||||
(-> q
|
||||
(dissoc :client :session)
|
||||
(dissoc :client :session :client-selection :clients)
|
||||
(update :sort sort->query)
|
||||
(url/map->query)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user