converted payments over

This commit is contained in:
Bryce Covert
2020-08-18 08:09:40 -07:00
parent 0c93e84cd2
commit 44dab34240
6 changed files with 84 additions and 209 deletions

View File

@@ -14,25 +14,9 @@
[re-frame.core :as re-frame]
[auto-ap.views.components.grid :as grid]
[auto-ap.views.components.buttons :as buttons]
[auto-ap.status :as status]))
[auto-ap.status :as status]
[auto-ap.views.pages.data-page :as data-page]))
(re-frame/reg-sub
::specific-table-params
(fn [db]
(::table-params db)))
(re-frame/reg-sub
::table-params
:<- [::specific-table-params]
:<- [::subs/query-params]
(fn [[specific-table-params query-params]]
(merge (select-keys query-params #{:start :sort}) specific-table-params)))
(re-frame/reg-event-fx
::params-changed
[(re-frame/path [::table-params])]
(fn [{table-params :db} [_ params :as z]]
{:db (merge table-params params)}))
(re-frame/reg-event-fx
::void-check
@@ -76,7 +60,7 @@
[grid/cell {} status]
[grid/button-cell {}
[:div.buttons
(when (seq invoices)
(when (and (seq invoices) (not= :voided status))
[drop-down {:id [::invoices id]
:header [:button.button.badge {:data-badge (str (clojure.core/count invoices))
:aria-haspopup true?
@@ -91,7 +75,7 @@
^{: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))}))
(url/map->query {:invoice-number-like (str "\"" (:invoice-number (:invoice invoice)) "\"")}))
:target "_new"} (str " " (:invoice-number (:invoice invoice)))])]])
[:span {:style {:margin-left "1em"}}]
@@ -101,15 +85,13 @@
[buttons/sl-icon {:event [::void-check check] :icon :icon-bin-2
:class (status/class-for (get states (:id check)))}])]]]))
(defn table [{:keys [id payment-page status]}]
(defn table [{:keys [data-page]}]
(let [selected-client @(re-frame/subscribe [::subs/client])
{:keys [data status]} @(re-frame/subscribe [::data-page/page data-page])
states @(re-frame/subscribe [::status/multi ::void])]
[grid/grid {:on-params-change (fn [e]
(re-frame/dispatch [::params-changed e]))
:params @(re-frame/subscribe [::table-params])
:status status
[grid/grid {:data-page data-page
:column-count (if selected-client 7 8)}
[grid/controls payment-page]
[grid/controls data]
[grid/table {:fullwidth true}
[grid/header {}
[grid/row {}
@@ -123,7 +105,7 @@
[grid/sortable-header-cell {:sort-key "status" :sort-name "Status" :style {:width "7em"}} "Status"]
[grid/header-cell {:style {:width "12em"}}]]]
[grid/body
(for [check (:payments payment-page)]
(for [check (:data data)]
^{:key (:id check)}
[row {:check check
:selected-client selected-client