improved table.

This commit is contained in:
BC
2019-02-19 09:30:26 -08:00
parent 5435b6a317
commit 76f460c52c
2 changed files with 60 additions and 56 deletions

View File

@@ -319,8 +319,8 @@ nav.navbar .navbar-item.is-active {
background-color:#F5F5F5; background-color:#F5F5F5;
} }
.table { table-layout: fixed } .table { table-layout: fixed }
.table td {text-overflow: ellipsis; overflow: hidden; white-space: nowrap; padding: 9px; } .table td {text-overflow: ellipsis; overflow: hidden; white-space: nowrap; padding: 9px; height: 60px; vertical-align: middle; }
.table td.expandable {text-overflow: ellipsis; overflow: visible; white-space: nowrap; padding: 9px; } .table td.expandable {text-overflow: ellipsis; overflow: visible; white-space: nowrap; padding: 9px; height: 60px; vertical-align: middle; }
.table td.no-border { border: none; } .table td.no-border { border: none; }
.typeahead { .typeahead {

View File

@@ -70,6 +70,8 @@
percentage-size (if selected-client "%50%" "33%") percentage-size (if selected-client "%50%" "33%")
] ]
[:div [:div
[paginator {:start start :end end :count count :total total [paginator {:start start :end end :count count :total total
:on-change (fn [p ] :on-change (fn [p ]
(on-params-change (merge @params p) ))}] (on-params-change (merge @params p) ))}]
@@ -127,7 +129,7 @@
"Outstanding"] "Outstanding"]
[:th { [:th {
:style {:width "15em" :cursor "pointer"} :style {:width "20rem" :cursor "pointer"}
} }
@@ -160,62 +162,64 @@
[:td (gstring/format "$%.2f" total )] [:td (gstring/format "$%.2f" total )]
[:td (gstring/format "$%.2f" outstanding-balance )] [:td (gstring/format "$%.2f" outstanding-balance )]
[:td.expandable [:td.expandable
(when (seq expense-accounts)
[:div.dropdown.is-right {:class (if (= id visible-expense-accounts)
"is-active"
"")}
[:div.dropdown-trigger
[:a.button.badge {:data-badge (str (clojure.core/count expense-accounts))
:aria-haspopup true
:tab-index "0"
:on-blur (delayed-dispatch [::toggle-expense-accounts id]) [:div.buttons
:on-focus (dispatch-event [::toggle-expense-accounts id]) (when (seq expense-accounts)
} "Accounts"]]
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content
(for [e expense-accounts]
^{:key (:id e)}
[:span.dropdown-item (:name (:expense-account e)) " " (gstring/format "$%.2f" (:amount e) ) ])
[:hr.dropdown-divider] [:div.dropdown.is-right {:class (if (= id visible-expense-accounts)
"is-active"
"")}
[:div.dropdown-trigger
[:a.button.badge {:data-badge (str (clojure.core/count expense-accounts))
:aria-haspopup true
:tab-index "0"
(when expense-event :on-blur (delayed-dispatch [::toggle-expense-accounts id])
[:a.dropdown-item.is-primary {:on-click (dispatch-event (conj expense-event i))} "Change"])]]]) :on-focus (dispatch-event [::toggle-expense-accounts id])
} "Accounts"]]
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content
(for [e expense-accounts]
^{:key (:id e)}
[:span.dropdown-item (:name (:expense-account e)) " " (gstring/format "$%.2f" (:amount e) ) ])
[:hr.dropdown-divider]
(when expense-event
[:a.dropdown-item.is-primary {:on-click (dispatch-event (conj expense-event i))} "Change"])]]])
[:span {:style {:margin-left "1em"}}] [:span {:style {:margin-left "1em"}}]
(when (and on-edit-invoice (not= ":voided" (:status i)))
[:a.button {:on-click (fn [] (on-edit-invoice i))} [:span.icon [:i.fa.fa-pencil]]])
(when (and on-void-invoice (= (:outstanding-balance i) (:total i)) (not= ":voided" (:status i)))
[:a.button {:on-click (fn [] (on-void-invoice i))} [:span.icon [:span.icon-bin-2 {:style {:font-weight "400"}}]]])
(when (and on-unvoid-invoice (= ":voided" (:status i)))
[:a {:on-click (fn [] (on-unvoid-invoice i))} [:span [:span.icon [:i.fa.fa-undo]]]])
(when (seq payments)
(when (and on-edit-invoice (not= ":voided" (:status i))) [:div.dropdown.is-right {:class (if (= id visible-checks)
[:button.button {:on-click (fn [] (on-edit-invoice i))} [:span.icon [:i.fa.fa-pencil]]]) "is-active"
(when (and on-void-invoice (= (:outstanding-balance i) (:total i)) (not= ":voided" (:status i))) "")}
[:button.button.is-outlined {:on-click (fn [] (on-void-invoice i))} [:span.icon [:span.icon-bin-2 {:style {:font-weight "400"}}]]]) [:div.dropdown-trigger
(when (and on-unvoid-invoice (= ":voided" (:status i))) [:a.button.badge {:data-badge (str (clojure.core/count payments))
[:button.button.is-outlined {:on-click (fn [] (on-unvoid-invoice i))} [:span [:span.icon [:i.fa.fa-undo]]]]) :aria-haspopup true
(when (seq payments) :tab-index "0"
[:div.dropdown.is-right {:class (if (= id visible-checks) :on-blur (delayed-dispatch [::toggle-checks id])
"is-active" :on-focus (dispatch-event [::toggle-checks id])
"")} } "Checks"]]
[:div.dropdown-trigger [:div.dropdown-menu {:role "menu"}
[:a.button.badge {:data-badge (str (clojure.core/count payments)) [:div.dropdown-content
:aria-haspopup true (for [payment payments]
:tab-index "0"
:on-blur (delayed-dispatch [::toggle-checks id])
:on-focus (dispatch-event [::toggle-checks id])
} "Checks"]]
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content
(for [payment payments]
(if (:s3-url (:payment payment)) (if (:s3-url (:payment payment))
^{:key (:id payment)} ^{:key (:id payment)}
[:a.dropdown-item {:href (:s3-url (:payment payment)) :target "_new"} [:i.fa.fa-money-check] [:span.icon [:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ")")] [:a.dropdown-item {:href (:s3-url (:payment payment)) :target "_new"} [:i.fa.fa-money-check] [:span.icon [:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ")")]
^{:key (:id payment)} ^{:key (:id payment)}
[:span.dropdown-item [:span.icon {:class [(when (= :cleared (:status (:payment payment))) [:span.dropdown-item [:span.icon {:class [(when (= :cleared (:status (:payment payment)))
"has-text-success")]} "has-text-success")]}
[:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ") " [:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ") "
(when (= :cleared (:status (:payment payment))) (when (= :cleared (:status (:payment payment)))
(str " - " (:post-date (:transaction (:payment payment))))))]))]]]) (str " - " (:post-date (:transaction (:payment payment))))))]))]]])]
]]))]]])))) ]]))]]]))))