Working on simplified table

This commit is contained in:
Bryce Covert
2020-08-02 08:50:58 -07:00
parent 13faead45b
commit 1503d6c036

View File

@@ -71,55 +71,53 @@
:params (re-frame/subscribe [::table-params]) :params (re-frame/subscribe [::table-params])
:status status :status status
:column-count 5})] :column-count 5})]
(fn [] (fn [{:keys [id rule-page on-params-change params status]}]
(let [] (let [{:keys [sort asc]} @params
(fn [{:keys [id rule-page on-params-change params status]}] {:keys [transaction-rules start end count total]} @rule-page
(let [{:keys [sort asc]} @params selected-client @(re-frame/subscribe [::subs/client])]
{:keys [transaction-rules start end count total]} @rule-page [grid-container {:start start :end end :count count :total total}
selected-client @(re-frame/subscribe [::subs/client])] [table {:fullwidth true }
[grid-container {:start start :end end :count count :total total} [table-header
[table {:fullwidth true } [table-row {}
[table-header [table-sortable-header-cell {:sort-key "client"
[table-row {} :sort-name "Client"}
[table-sortable-header-cell {:sort-key "client" "Client"]
:sort-name "Client"}
"Client"]
[table-sortable-header-cell {:sort-key "bank-account" [table-sortable-header-cell {:sort-key "bank-account"
:sort-name "Bank Account"} :sort-name "Bank Account"}
"Bank Account"] "Bank Account"]
[table-sortable-header-cell {:sort-key "description" [table-sortable-header-cell {:sort-key "description"
:sort-name "Description"} :sort-name "Description"}
"Description"] "Description"]
[table-header-cell {:style {:width "12em"}} "Amount"] [table-header-cell {:style {:width "12em"}} "Amount"]
[table-sortable-header-cell {:sort-key "note" [table-sortable-header-cell {:sort-key "note"
:sort-name "Note"} :sort-name "Note"}
"Note"] "Note"]
[table-header-cell {:style {:width "9em"}}]]] [table-header-cell {:style {:width "9em"}}]]]
[table-body [table-body
(for [{:keys [client bank-account description amount-lte amount-gte note id] :as r} transaction-rules] (for [{:keys [client bank-account description amount-lte amount-gte note id] :as r} transaction-rules]
^{:key id} ^{:key id}
[table-row {:class (:class r)} [table-row {:class (:class r)}
[table-cell {} (:name client)] [table-cell {} (:name client)]
[table-cell {} (:name bank-account)] [table-cell {} (:name bank-account)]
[table-cell {} description] [table-cell {} description]
[table-cell {:class "has-text-right"} [table-cell {:class "has-text-right"}
(cond (and amount-gte amount-lte) (cond (and amount-gte amount-lte)
(str (->$ amount-gte) " - " (->$ amount-lte)) (str (->$ amount-gte) " - " (->$ amount-lte))
amount-gte amount-gte
(str ">=" (->$ amount-gte)) (str ">=" (->$ amount-gte))
amount-lte amount-lte
(str "<=" (->$ amount-lte)) (str "<=" (->$ amount-lte))
:else :else
"")] "")]
[table-cell {} note] [table-cell {} note]
[table-cell {} [:div.buttons [table-cell {} [:div.buttons
[:a.button {:on-click (dispatch-event [::run-clicked r])} [:span.icon [:i.fa.fa-play]]] [:a.button {:on-click (dispatch-event [::run-clicked r])} [:span.icon [:i.fa.fa-play]]]
[:a.button {:on-click (dispatch-event [::form/editing r])} [:span.icon [:i.fa.fa-pencil]]]]]])]]])))))) [:a.button {:on-click (dispatch-event [::form/editing r])} [:span.icon [:i.fa.fa-pencil]]]]]])]]]))))