Tons of small fixes
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
(ns auto-ap.views.pages.payments.table
|
||||
(:require [auto-ap.subs :as subs]
|
||||
[auto-ap.routes :as routes]
|
||||
[cemerick.url :as url]
|
||||
[bidi.bidi :as bidi]
|
||||
[auto-ap.views.components.paginator :refer [paginator]]
|
||||
[auto-ap.views.components.sorter :refer [sorted-column]]
|
||||
[auto-ap.views.components.sort-by-list :refer [sort-by-list]]
|
||||
[auto-ap.views.utils :refer [date->str dispatch-event nf]]
|
||||
|
||||
[auto-ap.views.components.dropdown :refer [drop-down drop-down-contents]]
|
||||
[auto-ap.events :as events]
|
||||
[goog.string :as gstring]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
@@ -29,7 +35,7 @@
|
||||
selected-client :selected-client
|
||||
void-event :void-event
|
||||
}]
|
||||
(let [{:keys [client s3-url bank-account payments type check-number date amount id vendor status] :as check} check]
|
||||
(let [{:keys [client s3-url bank-account payments type check-number date amount id vendor status invoices] :as check} check]
|
||||
[:tr {:class (:class check)}
|
||||
(when-not selected-client
|
||||
[:td (:name client)])
|
||||
@@ -45,11 +51,31 @@
|
||||
[:td (date->str date) ]
|
||||
[:td.has-text-right (nf amount )]
|
||||
[:td status]
|
||||
[:td
|
||||
(when (or (= :pending status)
|
||||
(and (#{":cash" :cash ":debit" :debit} type)
|
||||
(not= :voided status)))
|
||||
[:button.button.is-warning.is-outlined {:on-click (dispatch-event (conj void-event check))} [:span [:span.icon [:i.fa.fa-minus-circle]]]])]]))
|
||||
[:td.expandable
|
||||
[:div.buttons
|
||||
(when (seq invoices)
|
||||
[drop-down {:id [::invoices id]
|
||||
:header [:button.button.badge {:data-badge (str (clojure.core/count invoices))
|
||||
:aria-haspopup true
|
||||
:tab-index "0"
|
||||
:on-click (dispatch-event [::events/toggle-menu [::invoices id]])
|
||||
} "Invoices"]}
|
||||
[:div {:style {:max-width "250px"
|
||||
:text-overflow "ellipsis"
|
||||
:white-space "nowrap"
|
||||
:overflow "hidden"}}
|
||||
(for [invoice invoices]
|
||||
^{:key (:invoice-number (:invoice invoice))}
|
||||
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :invoices )
|
||||
"?"
|
||||
(url/map->query {:invoice-number-like (:invoice-number (:invoice invoice))}))
|
||||
:target "_new"} (str " " (:invoice-number (:invoice invoice)))])]])
|
||||
[:span {:style {:margin-left "1em"}}]
|
||||
|
||||
(when (or (= :pending status)
|
||||
(and (#{":cash" :cash ":debit" :debit} type)
|
||||
(not= :voided status)))
|
||||
[:button.button.is-warning.is-outlined {:on-click (dispatch-event (conj void-event check))} [:span [:span.icon [:i.fa.fa-minus-circle]]]])]]]))
|
||||
|
||||
(defn table [{:keys [id payment-page status void-event]}]
|
||||
(let [{:keys [sort]} @(re-frame/subscribe [::table-params])
|
||||
@@ -117,7 +143,7 @@
|
||||
:sort-name "Status"
|
||||
:sort sort}
|
||||
"Status"]
|
||||
[:th {:style {:width "8em"}} "" ]]]
|
||||
[:th {:style {:width "15em"}} "" ]]]
|
||||
[:tbody
|
||||
(if (:loading @status)
|
||||
[:tr
|
||||
|
||||
Reference in New Issue
Block a user