several fixes.

This commit is contained in:
Bryce Covert
2019-04-24 21:29:38 -07:00
parent b5ca106260
commit 452e663049
12 changed files with 82 additions and 49 deletions

View File

@@ -78,8 +78,6 @@
[paginator {:start start :end end :count count :total total
:on-change (fn [p ]
(on-params-change (merge @params p) ))}]
"Showing " (inc start) "-" end "/" total
[:table.table.is-fullwidth
[:thead
[:tr

View File

@@ -51,4 +51,5 @@
[:ul.pagination-list
extended-first-page-button
(apply list (subvec all-buttons first-page-button last-page-button))
extended-last-page-button]]))
extended-last-page-button
"Showing " (Math/min (inc start) total) "-" end "/" total]]))

View File

@@ -136,8 +136,6 @@
[paginator {:start start :end end :count count :total total
:on-change (fn [p ]
(on-params-change (merge @params p)))}]
"Showing " (inc start) "-" end "/" total
[:table.table.is-fullwidth
[:thead
[:tr

View File

@@ -33,7 +33,6 @@
(re-frame/reg-event-fx
::params-change
(fn [cofx [_ params]]
{:db (-> (:db cofx)
(assoc-in [:status :loading] true)
(assoc-in [::params] params))

View File

@@ -134,6 +134,8 @@
[:comparable-balance-sheet-accounts [:name :amount :account-type :id :numeric-code :location]]]]]}
:on-success [::received]}}))
(re-frame/reg-event-fx
::date-picked
(fn [cofx [_ f date]]
@@ -149,26 +151,17 @@
:to-date to
:selected selected)]}))
(re-frame/reg-event-fx
::investigate-clicked
(fn [{:keys [db] } [_ location from-numeric-code to-numeric-code which]]
::ledger-params-changed
(fn [{:keys [db]} [_ params]]
{:db (assoc db
::ledger-list-active? true
::ledger-list-loading true)
::ledger-list-loading true
::ledger-params params)
:graphql {:token (-> db :user)
:query-obj {:venia/queries [[:ledger-page
{:client-id (:id @(re-frame/subscribe [::subs/client]))
:from-numeric-code from-numeric-code
:to-numeric-code to-numeric-code
:location location
:from-date (if (= :current which)
(:from-date (::params db))
(date->str (t/minus (str->date (:from-date (::params db)) standard) (t/years 1))
standard))
:to-date (if (= :current which)
(:to-date (::params db))
(date->str (t/minus (str->date (:to-date (::params db)) standard) (t/years 1))
standard))}
params
[[:journal-entries [:id
:source
:amount
@@ -185,6 +178,28 @@
:end]]]}
:on-success [::ledger-list-received]}}))
(re-frame/reg-event-fx
::investigate-clicked
(fn [{:keys [db] } [_ location from-numeric-code to-numeric-code which]]
{:db (assoc db
::ledger-list-active? true
::ledger-list-loading true)
:dispatch [::ledger-params-changed (assoc (::ledger-params db)
:client-id (:id @(re-frame/subscribe [::subs/client]))
:from-numeric-code from-numeric-code
:to-numeric-code to-numeric-code
:location location
:from-date (if (= :current which)
(:from-date (::params db))
(date->str (t/minus (str->date (:from-date (::params db)) standard) (t/years 1))
standard))
:to-date (if (= :current which)
(:to-date (::params db))
(date->str (t/minus (str->date (:to-date (::params db)) standard) (t/years 1))
standard)))]}))
(def groupings
{:expense [["1100 Cash and Bank Accounts" 1100 1199]
@@ -408,10 +423,13 @@
[:div [:a.delete.is-pulled-right {:on-click (dispatch-event [::ledger-list-closing])}]
[:div
[:h1.title "Ledger entries"]
[table {:ledger-page ledger-page
[table {:id :ledger
:ledger-page ledger-page
:status? false
:status (re-frame/subscribe [::ledger-list-loading])
:params (re-frame/subscribe [::ledger-params])} ]]]))
:params (re-frame/subscribe [::ledger-params])
:on-params-change (fn [params]
(re-frame/dispatch [::ledger-params-changed params]))}]]]))
(defn profit-and-loss-page []
(let [ledger-list-active? @(re-frame/subscribe [::ledger-list-active?])]

View File

@@ -19,7 +19,7 @@
[paginator {:start start :end end :count count :total total
:on-change (fn [p ]
(on-params-change (merge @params p)))}]
"Showing " (inc start) "-" end "/" total
[:table.table.is-fullwidth.compact
[:thead
@@ -34,7 +34,7 @@
[sorted-column {:on-sort opc
:style {:width percentage-size :cursor "pointer"}
:sort-key "description-original"
:sort-key "vendor"
:sort-by sort-by
:asc asc}
"Vendor"]
@@ -48,11 +48,8 @@
:sort-by sort-by
:asc asc}
"Date"]
[sorted-column {:on-sort opc
:style {:width percentage-size :cursor "pointer"}
:sort-key "account"
:sort-by sort-by
:asc asc}
[:th
{:style {:width percentage-size }}
"Account"]
[sorted-column {:on-sort opc
:style {:width "8em" :cursor "pointer"}

View File

@@ -41,7 +41,6 @@
[paginator {:start start :end end :count count :total total
:on-change (fn [p ]
(on-params-change (merge @params p)))}]
"Showing " (inc start) "-" end "/" total
[:table.table.is-fullwidth
[:thead