balance sheet replacement almost ready.

This commit is contained in:
2024-10-11 08:55:43 -07:00
parent 15898a0428
commit d41837db83
2 changed files with 47 additions and 47 deletions

View File

@@ -1194,45 +1194,45 @@
(defn table [{:keys [table widths click-event]}]
(let [cell-count (cell-count table)]
[:div {:style {:height "70vh"
:overflow-y "auto"}}
(-> [:table {:class "w-full text-sm text-left text-gray-500 dark:text-gray-400"}
[:thead {:class "text-xs text-gray-800 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"}
(map
(fn [header-row header]
(into
[:tr {:class " border-b dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}]
(map
(fn [w header i]
(cell {:width w :click-event click-event
:other-style {:position "sticky"
:top (* header-row (+ 22 18))}} header))
widths
header
(range))))
(range)
(:header table))]]
(com/content-card {:class "inline-block overflow-hidden"}
[:div { :class "overflow-y-auto h-[70vh] m-4 inline-block"}
(-> [:table {:class "text-sm text-left text-gray-500 dark:text-gray-400"}
[:thead {:class "text-xs text-gray-800 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 font-bold"}
(map
(fn [header-row header]
(into
[:tr {:class " dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}]
(map
(fn [w header i]
(cell {:width w :click-event click-event
:other-style {:position "sticky"
:top (* header-row (+ 22 18))}} header))
widths
header
(range))))
(range)
(:header table))]]
(conj
(-> [:tbody {:style {}}]
(into
(for [[i row] (map vector (range) (:rows table))]
[:tr {:class " border-b dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}
(for [[i c] (map vector (range) (take cell-count
(reduce
(fn [[acc cnt] cur]
(if (>= (+ cnt (:colspan cur 1)) cell-count)
(reduced (conj acc cur))
[(conj acc cur) (+ cnt (:colspan cur 1))]))
[[] 0]
(concat row (repeat nil)))))]
(cell {:click-event click-event} c))]))
(conj [:tr (for [i (range cell-count)]
( cell {:click-event click-event} {:value " "}))])))
)]))
(conj
(-> [:tbody {:style {}}]
(into
(for [[i row] (map vector (range) (:rows table))]
[:tr {:class " dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}
(for [[i c] (map vector (range) (take cell-count
(reduce
(fn [[acc cnt] cur]
(if (>= (+ cnt (:colspan cur 1)) cell-count)
(reduced (conj acc cur))
[(conj acc cur) (+ cnt (:colspan cur 1))]))
[[] 0]
(concat row (repeat nil)))))]
(cell {:click-event click-event} c))]))
(conj [:tr (for [i (range cell-count)]
( cell {:click-event click-event} {:value " "}))])))
)])))
(defn concat-tables [tables]
(let [[first & rest] tables]
@@ -1293,18 +1293,18 @@
(html-response
[:div.text-2xl.font-bold.text-gray-600 (format "HELLO %d" client-count)
[:div.max-w-screen-2xl
(table {:widths (cond-> (into [30 ] (repeat 13 client-count))
(:include-comparison args) (into (repeat 13 (* 2 client-count))))
:click-event ::investigate-clicked
:table report} )]])))
(list
[:div.text-2xl.font-bold.text-gray-600 (str "Balance Sheet - " (str/join ", " (map :client/name clients))) ]
(table {:widths (cond-> (into [30 ] (repeat 13 client-count))
(:include-comparison args) (into (repeat 13 (* 2 client-count))))
:click-event ::investigate-clicked
:table report} )))))
(defn form [request]
(fc/start-form
(:form-params request)
(:form-errors request)
[:div
[:div.flex.flex-col.gap-4
[:form {:hx-get (bidi.bidi/path-for ssr-routes/only-routes ::route/run-balance-sheet)
:hx-target "#report"}
[:div.flex.gap-2
@@ -1320,7 +1320,7 @@
(com/inline-field {:label "Date"} (com/date-input {:placeholder "12/21/2020"
:name (fc/field-name)
:value (fc/field-value)})))
(com/button {:color :primary}
(com/button {:color :primary :class "w-16" }
"Run")]]
[:div#report]]))