standardized clients.

This commit is contained in:
Bryce Covert
2020-08-04 11:55:20 -07:00
parent f1dab06330
commit e1ffeda851
8 changed files with 799 additions and 636 deletions

View File

@@ -106,59 +106,58 @@
opc (fn [p]
(re-frame/dispatch [::params-changed p]))
states @(re-frame/subscribe [::status/multi ::run])]
[:div
[grid/grid {:on-params-change opc
:params @(re-frame/subscribe [::table-params])
:status status
:column-count 6}
[grid/controls {:start start :end end :count count :total total}]
[grid/table {:fullwidth true }
[grid/header
[grid/row {}
[grid/sortable-header-cell {:sort-key "client"
:sort-name "Client"}
"Client"]
[grid/grid {:on-params-change opc
:params @(re-frame/subscribe [::table-params])
:status status
:column-count 6}
[grid/controls {:start start :end end :count count :total total}]
[grid/table {:fullwidth true }
[grid/header
[grid/row {}
[grid/sortable-header-cell {:sort-key "client"
:sort-name "Client"}
"Client"]
[grid/sortable-header-cell {:sort-key "bank-account"
:sort-name "Bank Account"}
"Bank Account"]
[grid/sortable-header-cell {:sort-key "bank-account"
:sort-name "Bank Account"}
"Bank Account"]
[grid/sortable-header-cell {:sort-key "description"
:sort-name "Description"}
"Description"]
[grid/sortable-header-cell {:sort-key "description"
:sort-name "Description"}
"Description"]
[grid/header-cell {:style {:width "12em"}} "Amount"]
[grid/header-cell {:style {:width "12em"}} "Amount"]
[grid/sortable-header-cell {:sort-key "note"
:sort-name "Note"}
"Note"]
[grid/sortable-header-cell {:sort-key "note"
:sort-name "Note"}
"Note"]
[grid/header-cell {:style {:width (action-cell-width 3)}}]]]
[grid/body
(for [{:keys [client bank-account description amount-lte amount-gte note id] :as r} transaction-rules]
^{:key id}
[grid/row {:class (:class r)}
[grid/cell {} (:name client)]
[grid/cell {} (:name bank-account)]
[grid/cell {} description]
[grid/cell {:class "has-text-right"}
(cond (and amount-gte amount-lte)
(str (->$ amount-gte) " - " (->$ amount-lte))
[grid/header-cell {:style {:width (action-cell-width 3)}}]]]
[grid/body
(for [{:keys [client bank-account description amount-lte amount-gte note id] :as r} transaction-rules]
^{:key id}
[grid/row {:class (:class r)}
[grid/cell {} (:name client)]
[grid/cell {} (:name bank-account)]
[grid/cell {} description]
[grid/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
"")]
[grid/cell {} note]
[grid/cell {}
[:div.buttons
[buttons/fa-icon {:event [::run-clicked r] :icon :fa-play :class (status/class-for (get states (:id r)))}]
[buttons/sl-icon {:event [::request-delete r] :icon :icon-bin-2}]
[buttons/fa-icon {:event [::form/editing r] :icon :fa-pencil}]]]])]]]]))
:else
"")]
[grid/cell {} note]
[grid/cell {}
[:div.buttons
[buttons/fa-icon {:event [::run-clicked r] :icon :fa-play :class (status/class-for (get states (:id r)))}]
[buttons/sl-icon {:event [::request-delete r] :icon :icon-bin-2}]
[buttons/fa-icon {:event [::form/editing r] :icon :fa-pencil}]]]])]]]))
(defn table [params]
(r/create-class {:component-will-unmount (dispatch-event [::unmounted])