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

@@ -70,6 +70,8 @@
percentage-size (if selected-client "%50%" "33%")
]
[:div
[paginator {:start start :end end :count count :total total
:on-change (fn [p ]
(on-params-change (merge @params p) ))}]
@@ -127,7 +129,7 @@
"Outstanding"]
[:th {
:style {:width "15em" :cursor "pointer"}
:style {:width "20rem" :cursor "pointer"}
}
@@ -160,62 +162,64 @@
[:td (gstring/format "$%.2f" total )]
[:td (gstring/format "$%.2f" outstanding-balance )]
[: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])
: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"}}]
(when (and on-edit-invoice (not= ":voided" (:status i)))
[:button.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)))
[:button.button.is-outlined {: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)))
[:button.button.is-outlined {:on-click (fn [] (on-unvoid-invoice i))} [:span [:span.icon [:i.fa.fa-undo]]]])
(when (seq payments)
[:div.buttons
(when (seq expense-accounts)
[:div.dropdown.is-right {:class (if (= id visible-checks)
"is-active"
"")}
[:div.dropdown-trigger
[:a.button.badge {:data-badge (str (clojure.core/count payments))
:aria-haspopup true
: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]
[: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])
: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"}}]
(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)
[:div.dropdown.is-right {:class (if (= id visible-checks)
"is-active"
"")}
[:div.dropdown-trigger
[:a.button.badge {:data-badge (str (clojure.core/count payments))
:aria-haspopup true
: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))
^{: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) ) ")")]
^{: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) ) ")")]
^{:key (:id payment)}
[:span.dropdown-item [:span.icon {:class [(when (= :cleared (:status (:payment payment)))
"has-text-success")]}
[:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ") "
(when (= :cleared (:status (:payment payment)))
(str " - " (:post-date (:transaction (:payment payment))))))]))]]])
^{:key (:id payment)}
[:span.dropdown-item [:span.icon {:class [(when (= :cleared (:status (:payment payment)))
"has-text-success")]}
[:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ") "
(when (= :cleared (:status (:payment payment)))
(str " - " (:post-date (:transaction (:payment payment))))))]))]]])]
]]))]]]))))