column widths.

This commit is contained in:
Bryce Covert
2018-04-12 19:35:48 -07:00
parent 38d9c1a1d3
commit 78ced354de

View File

@@ -24,23 +24,22 @@
[:span.icon
[:i.fa.fa-sort]]))
(defn invoice-table [{:keys [id invoices status on-params-change]}]
(defn invoice-table [{:keys [id invoices status on-params-change vendors]}]
(let [state (reagent/atom {})]
(fn []
(let [{:keys [sort-by asc]} @state]
[:table {:class "table", :style {:width "100%"}}
[:table.table.is-fullwidth
[:thead
[:tr
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "vendor")))} "Vendor"
(sort-icon "vendor" sort-by asc)
]
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "company")))} "Company"
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "vendor"))) :style {:width "25%" :cursor "pointer"}} "Vendor"
(sort-icon "vendor" sort-by asc)]
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "company"))) :style {:width "25%" :cursor "pointer"}} "Company"
(sort-icon "company" sort-by asc)]
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "invoice-number")))} "Invoice #"
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "invoice-number"))) :style {:width "18%" :cursor "pointer"}} "Invoice #"
(sort-icon "invoice-number" sort-by asc)]
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "date")))} "Date"
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "date"))) :style {:width "16%" :cursor "pointer"}} "Date"
(sort-icon "date" sort-by asc)]
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "total")))} "Amount"
[:th {:on-click (fn [e] (on-params-change (swap! state toggle-sort-by "total"))) :style {:width "16%" :cursor "pointer"}} "Amount"
(sort-icon "total" sort-by asc)]]]
[:tbody
(if (:loading @status)