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