diff --git a/iol_ion/src/iol_ion/tx/upsert_ledger.clj b/iol_ion/src/iol_ion/tx/upsert_ledger.clj index c8795d94..089ee390 100644 --- a/iol_ion/src/iol_ion/tx/upsert_ledger.clj +++ b/iol_ion/src/iol_ion/tx/upsert_ledger.clj @@ -37,7 +37,7 @@ (-> je :journal-entry/date)]) (defn upsert-ledger [db ledger-entry] - (assert (:journal-entry/date ledger-entry) "Must at least provide date when updating ledger") + (assert (:journal-entry/date ledger-entry) (format "Must at least provide date when updating ledger: %s" (pr-str ledger-entry))) (assert (:journal-entry/client ledger-entry) "Must at least provide client when updating ledger") ;; TODO these are not always true ;; (assert (every? :journal-entry-line/account (:journal-entry/line-items ledger-entry)) "must at least provide account when updating ledger") @@ -47,21 +47,20 @@ (when-let [external-id (:journal-entry/external-id ledger-entry)] (dc/pull db extant-read [:journal-entry/external-id external-id]))) extant-entry-exists? (:db/id extant-entry)] - - (cond-> - [[:upsert-entity (into (-> ledger-entry - (assoc :db/id (or - (:db/id ledger-entry) - (:db/id extant-entry) - (-random-tempid))) - (update :journal-entry/line-items - (fn [lis] - (mapv #(-> % - (assoc :journal-entry-line/dirty true) - (assoc :journal-entry-line/client+account+location+date - (calc-client+account+location+date ledger-entry %))) - lis)))) - )]] + + (cond-> + [[:upsert-entity (into (-> ledger-entry + (assoc :db/id (or + (:db/id ledger-entry) + (:db/id extant-entry) + (-random-tempid))) + (update :journal-entry/line-items + (fn [lis] + (mapv #(-> % + (assoc :journal-entry-line/dirty true) + (assoc :journal-entry-line/client+account+location+date + (calc-client+account+location+date ledger-entry %))) + lis)))))]] extant-entry-exists? (into (map (fn [li] {:journal-entry-line/dirty true :db/id li}) diff --git a/src/clj/auto_ap/graphql/checks.clj b/src/clj/auto_ap/graphql/checks.clj index 942c7561..cec85d3b 100644 --- a/src/clj/auto_ap/graphql/checks.clj +++ b/src/clj/auto_ap/graphql/checks.clj @@ -354,24 +354,24 @@ :payment/date (coerce/to-date (last (sort (map :invoice/date invoices)))) :payment/memo memo :payment/status :payment-status/cleared) - transaction {:db/id (str "transaction-" (:db/id vendor)) - :transaction/amount (- (:payment/amount base-payment)) - :transaction/payment (str (:db/id vendor)) - :transaction/client (:db/id client) - :transaction/status "POSTED" - :transaction/bank-account (:db/id bank-account) - :transaction/id #_{:clj-kondo/ignore [:unresolved-var]} (digest/sha-256 transaction-id) - :transaction/raw-id transaction-id - :transaction/vendor (:db/id vendor) - :transaction/description-original memo - :transaction/date (:payment/date payment) - :transaction/approval-status :transaction-approval-status/approved - :transaction/accounts [{:transaction-account/account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"])) - :transaction-account/location "A" - :transaction-account/amount (Math/abs (:payment/amount base-payment))}]}] + transaction [:upsert-transaction {:db/id (str "transaction-" (:db/id vendor)) + :transaction/amount (- (:payment/amount base-payment)) + :transaction/payment (str (:db/id vendor)) + :transaction/client (:db/id client) + :transaction/status "POSTED" + :transaction/bank-account (:db/id bank-account) + :transaction/id #_{:clj-kondo/ignore [:unresolved-var]} (digest/sha-256 transaction-id) + :transaction/raw-id transaction-id + :transaction/vendor (:db/id vendor) + :transaction/description-original memo + :transaction/date (:payment/date payment) + :transaction/approval-status :transaction-approval-status/approved + :transaction/accounts [{:transaction-account/account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"])) + :transaction-account/location "A" + :transaction-account/amount (Math/abs (:payment/amount base-payment))}]}]] (-> [] (conj payment) - (conj transaction) + (conj transaction) (into (invoice-payments invoices invoice-amounts))))) (defn validate-belonging [client-id invoices bank-account] diff --git a/src/cljs/auto_ap/views/components/grid.cljs b/src/cljs/auto_ap/views/components/grid.cljs index 8c272a32..04948b0a 100644 --- a/src/cljs/auto_ap/views/components/grid.cljs +++ b/src/cljs/auto_ap/views/components/grid.cljs @@ -138,6 +138,24 @@ [:div.level-item c]) children)) [:div.level-right action-buttons]]]))))])) +(defn bottom-paginator [{:keys [start end count total action-buttons]}] + (let [children (r/children (r/current-component))] + [:> Consumer {} + (fn [consume] + (let [{:strs [on-params-change params]} (js->clj consume)] + (r/as-element (into + [:div {:style {:margin-bottom "1rem"}} + [:div.level + (into + [:div.level-left + [:div.level-item + [paginator {:start start :end end :count count :total total + :per-page (:per-page params) + :on-change on-params-change}]] + [:div.level-item + [sort-by-list {:sort (:sort params) + :on-change on-params-change}]]])]]))))])) + (defn table [{:keys [fullwidth class style]}] (into diff --git a/src/cljs/auto_ap/views/components/invoice_table.cljs b/src/cljs/auto_ap/views/components/invoice_table.cljs index 69585bb3..db401501 100644 --- a/src/cljs/auto_ap/views/components/invoice_table.cljs +++ b/src/cljs/auto_ap/views/components/invoice_table.cljs @@ -284,10 +284,9 @@ [grid/sortable-header-cell {:sort-key "due" :sort-name "Due" :style {:width "8em"} :class "is-hidden-mobile"} "Due"] [grid/sortable-header-cell {:sort-key "location" :sort-name "Location" :style {:width "5em"}} "Loc"] [grid/sortable-header-cell {:sort-key "total" :sort-name "Total" :style {:width "8em"} :class "has-text-right"} "Total"] - + [grid/sortable-header-cell {:sort-key "outstanding-balance" :sort-name "Outstanding" :style {:width "10em"} :class "has-text-right"} "Outstanding"] - [grid/header-cell {:style {:width "14rem" }}] - ]] + [grid/header-cell {:style {:width "14rem"}}]]] [grid/body (for [{:keys [id] :as i} invoices] @@ -298,4 +297,5 @@ (checkable-fn i) true) :actions actions - :overrides overrides}])]])])) + :overrides overrides}])]]) + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/admin/accounts/table.cljs b/src/cljs/auto_ap/views/pages/admin/accounts/table.cljs index 42328cac..4ae1d38f 100644 --- a/src/cljs/auto_ap/views/pages/admin/accounts/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/accounts/table.cljs @@ -21,7 +21,7 @@ [grid/header-cell {} "Name"] [grid/header-cell {} "Type"] [grid/header-cell {} "Location"] - [grid/header-cell {:style {:width (action-cell-width 1)}} ]]] + [grid/header-cell {:style {:width (action-cell-width 1)}}]]] [grid/body (for [{:keys [id numeric-code name type location] :as account} (:data data)] ^{:key id} @@ -32,4 +32,5 @@ [grid/cell {} location] [grid/cell {} [buttons/fa-icon {:event [::account-form/editing account [::edit-completed]] - :icon "fa-pencil"}]]])]]]])) + :icon "fa-pencil"}]]])]] + [grid/bottom-paginator data]]])) diff --git a/src/cljs/auto_ap/views/pages/admin/clients/table.cljs b/src/cljs/auto_ap/views/pages/admin/clients/table.cljs index 3f60040d..d27a2d51 100644 --- a/src/cljs/auto_ap/views/pages/admin/clients/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/clients/table.cljs @@ -88,36 +88,36 @@ :column-count 5} [grid/controls data] [grid/table {:fullwidth true} - [grid/header + [grid/header [grid/row {} [grid/header-cell {} "Name"] [grid/header-cell {:style {:width "20em"}} "Code"] [grid/header-cell {} "Locations"] [grid/header-cell {} "Status"] [grid/header-cell {} "Email"] - [grid/header-cell {:style {:width (action-cell-width 2)}}]] - ] + [grid/header-cell {:style {:width (action-cell-width 2)}}]]] [grid/body (for [{:keys [id name email square-integration-status locked-until code locations bank-accounts]} (:data data)] - ^{:key (str name "-" id )} + ^{:key (str name "-" id)} [grid/row {:id id} [grid/cell {} name] [grid/cell {} code] [grid/cell {} (str/join ", " locations)] [grid/cell {:class "expandable"} [:div.tags - - [:div.tag (or (some-> locked-until date->str (#(str "Locked " %))) "Not locked")] - [integration-status-badge "Square" square-integration-status] - [:<> - (for [bank-account bank-accounts - :let [code (:code bank-account) - integration-status (:integration-status bank-account)] - :when (:id integration-status)] - ^{:key (:id integration-status)} - [integration-status-badge code integration-status])]]] + + [:div.tag (or (some-> locked-until date->str (#(str "Locked " %))) "Not locked")] + [integration-status-badge "Square" square-integration-status] + [:<> + (for [bank-account bank-accounts + :let [code (:code bank-account) + integration-status (:integration-status bank-account)] + :when (:id integration-status)] + ^{:key (:id integration-status)} + [integration-status-badge code integration-status])]]] [grid/cell {} email] [grid/cell {} [:div.buttons [buttons/fa-icon {:event [::setup-sales-queries id] :class (status/class-for (get states id)) :icon :fa-dollar}] [buttons/fa-icon {:href (bidi/path-for routes/routes :admin-specific-client :id id) - :icon :fa-pencil}]]]])]]])) + :icon :fa-pencil}]]]])]] + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/admin/import_batches/table.cljs b/src/cljs/auto_ap/views/pages/admin/import_batches/table.cljs index 86841e3b..6cd3416e 100644 --- a/src/cljs/auto_ap/views/pages/admin/import_batches/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/import_batches/table.cljs @@ -36,7 +36,7 @@ [grid/grid {:data-page data-page :column-count 6} [grid/controls data] - [grid/table {:fullwidth true } + [grid/table {:fullwidth true} [grid/header [grid/row {} [grid/sortable-header-cell {:sort-key "date" @@ -73,8 +73,8 @@ [buttons/fa-icon {:href (str (bidi/path-for routes/routes :transactions) "?" (url/map->query {:import-batch-id id})) - :icon "fa-external-link"}]] - ])]]])) + :icon "fa-external-link"}]]])]] + [grid/bottom-paginator data]])) (defn table [] (r/create-class {:component-will-unmount (dispatch-event [::unmounted]) diff --git a/src/cljs/auto_ap/views/pages/admin/jobs/table.cljs b/src/cljs/auto_ap/views/pages/admin/jobs/table.cljs index d0ae70c1..94408eeb 100644 --- a/src/cljs/auto_ap/views/pages/admin/jobs/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/jobs/table.cljs @@ -33,18 +33,18 @@ [grid/grid {:data-page data-page :column-count 6} [grid/controls data] - [grid/table {:fullwidth true } + [grid/table {:fullwidth true} [grid/header [grid/row {} - [grid/header-cell {} + [grid/header-cell {} "Start Date"] - [grid/header-cell + [grid/header-cell "End Date"] - [grid/header-cell + [grid/header-cell "Duration"] - [grid/header-cell + [grid/header-cell "Job Name"] [grid/header-cell {} @@ -61,10 +61,10 @@ (str (time/in-minutes (time/interval start-date end-date)) " minutes"))] [grid/cell {} name] [grid/cell {} status] - - [grid/button-cell {} - ] - ])]]])) + + [grid/button-cell {}]])]] + + [grid/bottom-paginator data]])) (defn table [] (r/create-class {:component-will-unmount (dispatch-event [::unmounted]) diff --git a/src/cljs/auto_ap/views/pages/admin/plaid/table.cljs b/src/cljs/auto_ap/views/pages/admin/plaid/table.cljs index 84170e08..9fd53e10 100644 --- a/src/cljs/auto_ap/views/pages/admin/plaid/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/plaid/table.cljs @@ -62,10 +62,10 @@ [grid/header-cell {:style {:width "12em"}} "Status"] [grid/header-cell {:style {:width "12em"}} "Last Updated"] [grid/header-cell {} "Accounts"] - [grid/header-cell {:style {:width (action-cell-width 1)}} ]]] + [grid/header-cell {:style {:width (action-cell-width 1)}}]]] [grid/body (for [{:keys [id name accounts status last-updated] :as c} (:data data)] - ^{:key (str name "-" id )} + ^{:key (str name "-" id)} [grid/row {:class (:class c) :id id} [grid/cell {} id] [grid/cell {} status] @@ -76,7 +76,8 @@ ^{:key (:id a)} [:li (:name a) [:div.tag (->$ (:balance a))]])]] [grid/cell {} - [:div.buttons + [:div.buttons (when is-admin? [buttons/fa-icon {:event [::delete-requested (:id c)] - :icon "fa-times"}])]]])]]])) + :icon "fa-times"}])]]])]] + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/admin/rules/table.cljs b/src/cljs/auto_ap/views/pages/admin/rules/table.cljs index a09ef48d..47d69f49 100644 --- a/src/cljs/auto_ap/views/pages/admin/rules/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/rules/table.cljs @@ -97,7 +97,7 @@ [grid/grid {:data-page data-page :column-count 6} [grid/controls data] - [grid/table {:fullwidth true } + [grid/table {:fullwidth true} [grid/header [grid/row {} [grid/sortable-header-cell {:sort-key "client" @@ -139,11 +139,12 @@ :else "")] [grid/cell {} note] - [grid/cell {} - [:div.buttons + [grid/cell {} + [:div.buttons [buttons/fa-icon {:event [::run-clicked r] :icon :fa-play :class (status/class-for (get states (:id r)))}] [buttons/sl-icon {:event [::request-delete r] :icon :icon-bin-2}] - [buttons/fa-icon {:event [::form/editing r] :icon :fa-pencil}]]]])]]])) + [buttons/fa-icon {:event [::form/editing r] :icon :fa-pencil}]]]])]] + [grid/bottom-paginator data]])) (defn table [] (r/create-class {:component-will-unmount (dispatch-event [::unmounted]) diff --git a/src/cljs/auto_ap/views/pages/admin/users/table.cljs b/src/cljs/auto_ap/views/pages/admin/users/table.cljs index d3733bbc..8a2788c7 100644 --- a/src/cljs/auto_ap/views/pages/admin/users/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/users/table.cljs @@ -32,23 +32,24 @@ [grid/header-cell {} "Email"] [grid/header-cell {} "Role"] [grid/header-cell {} "Clients"] - [grid/header-cell {:style {:width (action-cell-width 1)}} ]]] + [grid/header-cell {:style {:width (action-cell-width 1)}}]]] [grid/body (for [{:keys [id name role clients] :as c} (:data page)] - ^{:key (str name "-" id )} + ^{:key (str name "-" id)} [grid/row {:class (:class c) :id id} [grid/cell {} [:div.level [:div.level-left (when-let [url (:profile-image-url c)] - [:div.level-item + [:div.level-item [:figure.image.is-24x24 [:img.is-rounded {:src url - :referrer-policy= "no-referrer" }]]]) + :referrer-policy= "no-referrer"}]]]) [:div.level-item name]]]] [grid/cell {} (:email c)] [grid/cell {} role] [grid/cell {} (str/join ", " (map :name clients))] [grid/cell {} [buttons/fa-icon {:event [::form/editing c] - :icon "fa-pencil"}]]])]]])) + :icon "fa-pencil"}]]])]] + ])) diff --git a/src/cljs/auto_ap/views/pages/admin/vendors/table.cljs b/src/cljs/auto_ap/views/pages/admin/vendors/table.cljs index 78e2f05a..528ac3e9 100644 --- a/src/cljs/auto_ap/views/pages/admin/vendors/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/vendors/table.cljs @@ -25,11 +25,12 @@ [grid/row {:class (:class v) :id (:id v)} [grid/cell {} (:name v) (let [total-usage (reduce + 0 (map :count (:usage v)))] - (if (> total-usage 0 ) - [:div.mx-2.tag.is-info.is-light total-usage " usages, " (count (:usage v)) " clients" ] + (if (> total-usage 0) + [:div.mx-2.tag.is-info.is-light total-usage " usages, " (count (:usage v)) " clients"] [:div.mx-2.tag.is-warning.is-light "Unused"]))] [grid/cell {} (:email (:primary-contact v))] [grid/cell {} (-> v :default-account :name)] [grid/cell {} [buttons/fa-icon {:event [::vendor-dialog/started v] - :icon "fa-pencil"}]]])]]])) + :icon "fa-pencil"}]]])]] + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/company/yodlee2/table.cljs b/src/cljs/auto_ap/views/pages/company/yodlee2/table.cljs index 3e37b22e..e9a8ddab 100644 --- a/src/cljs/auto_ap/views/pages/company/yodlee2/table.cljs +++ b/src/cljs/auto_ap/views/pages/company/yodlee2/table.cljs @@ -105,10 +105,10 @@ [grid/header-cell {:style {:width "20em"}} "Detailed Status"] [grid/header-cell {:style {:width "12em"}} "Last Updated"] [grid/header-cell {} "Accounts"] - [grid/header-cell {:style {:width (action-cell-width 3)}} ]]] + [grid/header-cell {:style {:width (action-cell-width 3)}}]]] [grid/body (for [{:keys [id name accounts status detailed-status last-updated] :as c} (:data page)] - ^{:key (str name "-" id )} + ^{:key (str name "-" id)} [grid/row {:class (:class c) :id id} [grid/cell {} id] [grid/cell {} status] @@ -120,8 +120,8 @@ ^{:key (:id a)} [:li (:name a) " - " (:number a) [:div.tag (->$ (:available-balance a))]])]] [grid/cell {} - (when is-admin? - [:div.buttons + (when is-admin? + [:div.buttons [buttons/fa-icon {:event [::request-login-form (:id c) (:id (:client c))] :class (status/class-for (get login-statuses (:id c))) @@ -130,4 +130,5 @@ :class (status/class-for (get statuses (:id c))) :icon "fa-refresh"}] [buttons/fa-icon {:event [::delete-requested (:id c)] - :icon "fa-times"}]])]])]]])) + :icon "fa-times"}]])]])]] + ])) diff --git a/src/cljs/auto_ap/views/pages/ledger/table.cljs b/src/cljs/auto_ap/views/pages/ledger/table.cljs index ae47bb05..76973a2f 100644 --- a/src/cljs/auto_ap/views/pages/ledger/table.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/table.cljs @@ -100,7 +100,7 @@ :column-count (if selected-client 5 6)} [grid/controls (assoc data :action-buttons action-buttons)] [grid/table {:fullwidth true :class ["wrappable"]} - [grid/header + [grid/header [grid/row {} (when-not selected-client [grid/sortable-header-cell {:sort-key "client" :sort-name "Client"} "Client"]) @@ -116,5 +116,7 @@ ^{:key id} [ledger-row {:row i :selected-client selected-client - :bank-accounts-by-id bank-accounts-by-id}])]]])) + :bank-accounts-by-id bank-accounts-by-id}])]] + [grid/bottom-paginator data] + #_[grid/controls (assoc data :action-buttons action-buttons)]])) diff --git a/src/cljs/auto_ap/views/pages/payments/table.cljs b/src/cljs/auto_ap/views/pages/payments/table.cljs index eee0dd4d..ecde7005 100644 --- a/src/cljs/auto_ap/views/pages/payments/table.cljs +++ b/src/cljs/auto_ap/views/pages/payments/table.cljs @@ -129,4 +129,5 @@ ^{:key (:id check)} [row {:check check :selected-client selected-client - :states states}])]]])) + :states states}])]] + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/pos/expected_deposits/table.cljs b/src/cljs/auto_ap/views/pages/pos/expected_deposits/table.cljs index f6691a55..0144e6b6 100644 --- a/src/cljs/auto_ap/views/pages/pos/expected_deposits/table.cljs +++ b/src/cljs/auto_ap/views/pages/pos/expected_deposits/table.cljs @@ -79,10 +79,11 @@ [grid/sortable-header-cell {:sort-key "status" :sort-name "Status" :style {:width "8em"}} "Status"] [grid/sortable-header-cell {:sort-key "total" :sort-name "Total" :class "has-text-right" :style {:width "8em"}} "Total"] [grid/sortable-header-cell {:sort-key "fee" :sort-name "Fee" :class "has-text-right" :style {:width "7em"}} "Fee"] - + [grid/header-cell {:style {:width "4em"}}]]] [grid/body (for [sales-order (:data data)] ^{:key (:id sales-order)} [row {:sales-order sales-order - :selected-client selected-client}])]]])) + :selected-client selected-client}])]] + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/pos/table.cljs b/src/cljs/auto_ap/views/pages/pos/table.cljs index 597848ce..88e34eab 100644 --- a/src/cljs/auto_ap/views/pages/pos/table.cljs +++ b/src/cljs/auto_ap/views/pages/pos/table.cljs @@ -113,9 +113,8 @@ [grid/grid {:data-page data-page :column-count (if selected-client 7 8)} [grid/controls data - [:div.level-item - [:div.tag "Total: " (nf (:sales-order-total data))] - ] + [:div.level-item + [:div.tag "Total: " (nf (:sales-order-total data))]] [:div.level-item [:div.tag " Tax: " (nf (:sales-order-tax data))]]] [grid/table {:fullwidth true} @@ -136,4 +135,5 @@ (for [sales-order (:data data)] ^{:key (:id sales-order)} [row {:sales-order sales-order - :selected-client selected-client}])]]])) + :selected-client selected-client}])]] + [grid/bottom-paginator data]])) diff --git a/src/cljs/auto_ap/views/pages/reports/table.cljs b/src/cljs/auto_ap/views/pages/reports/table.cljs index 0095b3aa..3a12cc12 100644 --- a/src/cljs/auto_ap/views/pages/reports/table.cljs +++ b/src/cljs/auto_ap/views/pages/reports/table.cljs @@ -49,18 +49,18 @@ :column-count 3} [grid/controls data] [grid/table {:fullwidth true :class ["wrappable"]} - [grid/header + [grid/header [grid/row {} [grid/sortable-header-cell {:sort-key "name" :sort-name "Name"} "Name"] [grid/sortable-header-cell {:sort-key "creator" :sort-name "Created by"} "Created by"] [grid/sortable-header-cell {:sort-key "created" :sort-name "Created" :style {:width "8em"}} "Created"] - [grid/header-cell {:style {:width (action-cell-width (if - is-admin? + [grid/header-cell {:style {:width (action-cell-width (if + is-admin? 2 - 1))}}] - ]] + 1))}}]]] [grid/body (for [i (:data data)] ^{:key (:id i)} - [row {:row i :is-admin? is-admin? :data-page data-page}])]]]])) + [row {:row i :is-admin? is-admin? :data-page data-page}])]] + [grid/bottom-paginator data]]])) diff --git a/src/cljs/auto_ap/views/pages/transactions/bulk_updates.cljs b/src/cljs/auto_ap/views/pages/transactions/bulk_updates.cljs index 93559cfd..0e0eb1ed 100644 --- a/src/cljs/auto_ap/views/pages/transactions/bulk_updates.cljs +++ b/src/cljs/auto_ap/views/pages/transactions/bulk_updates.cljs @@ -153,5 +153,5 @@ :on-click (dispatch-event [::code-selected checked] )} :close-event [::status/completed ::code-selected]}] :db (-> db - (forms/start-form ::form {:accounts [] + (forms/start-form ::form {:accounts [{:amount-percentage 100.0 }] :client @(re-frame/subscribe [::subs/client (:client-id params)])}))}))) diff --git a/src/cljs/auto_ap/views/pages/transactions/table.cljs b/src/cljs/auto_ap/views/pages/transactions/table.cljs index 783c439e..4dd59416 100644 --- a/src/cljs/auto_ap/views/pages/transactions/table.cljs +++ b/src/cljs/auto_ap/views/pages/transactions/table.cljs @@ -84,34 +84,34 @@ [grid/sortable-header-cell {:sort-key "status" :sort-name "Status" :style {:width "7em"}} "Status"] [grid/header-cell {:style {:width (action-cell-width 3)}}]]] [grid/body - (for [{:keys [client vendor payment expected-deposit status bank-account description-original date amount id yodlee-merchant ] :as i} (:data data)] - ^{:key id} + (for [{:keys [client vendor payment expected-deposit status bank-account description-original date amount id yodlee-merchant] :as i} (:data data)] + ^{:key id} [grid/row {:class (:class i) :id id :entity i} (when-not selected-client [grid/cell {} (:name client)]) #_[:td description-original] [grid/cell {} - (:name bank-account )] + (:name bank-account)] [grid/cell {} (cond vendor - (:name vendor) - yodlee-merchant - [:i.has-text-grey (str "Merchant '" (:name yodlee-merchant) "'")] + (:name vendor) + yodlee-merchant + [:i.has-text-grey (str "Merchant '" (:name yodlee-merchant) "'")] - :else - [:i.has-text-grey (str description-original)])] - [grid/cell {} (date->str date) ] - [grid/cell {:class "has-text-right"} (nf amount )] + :else + [:i.has-text-grey (str description-original)])] + [grid/cell {} (date->str date)] + [grid/cell {:class "has-text-right"} (nf amount)] [grid/cell {} status] - [grid/button-cell {} - [:div.buttons - [drop-down {:id [::expense-accounts id ] + [grid/button-cell {} + [:div.buttons + [drop-down {:id [::expense-accounts id] :header [buttons/sl-icon {:aria-haspopup true :event [::events/toggle-menu [::expense-accounts id]] :tab-index "0" :icon "icon-saving-bank-1"}]} [drop-down-contents [:div - [:span.dropdown-item description-original ]]]] + [:span.dropdown-item description-original]]]] [buttons/fa-icon {:event [::intend-to-edit i] :class (status/class-for (get states id)) :icon "fa-pencil"}] @@ -123,26 +123,27 @@ :data-badge (str 1) :icon "fa-paperclip"}]} [drop-down-contents - [:div.dropdown-item + [:div.dropdown-item [:table.table.grid.compact - [:tbody - (when payment + [:tbody + (when payment [:tr [:td "Payment"] [:td (date->str (:date payment) pretty)] - [:td + [:td [buttons/fa-icon {:icon "fa-external-link" - :href (str (bidi/path-for routes/routes :payments ) + :href (str (bidi/path-for routes/routes :payments) "?" (url/map->query {:exact-match-id (:id payment)}))}]]]) - (when expected-deposit + (when expected-deposit [:tr [:td "Expected Deposit"] [:td (date->str (:date expected-deposit) pretty)] - [:td + [:td [buttons/fa-icon {:icon "fa-external-link" - :href (str (bidi/path-for routes/routes :expected-deposits ) + :href (str (bidi/path-for routes/routes :expected-deposits) "?" - (url/map->query {:exact-match-id (:id expected-deposit)}))}]]])]]]]])]]])]]])) + (url/map->query {:exact-match-id (:id expected-deposit)}))}]]])]]]]])]]])]] + [grid/bottom-paginator data]]))