Started added direct linkage
This commit is contained in:
@@ -40,11 +40,16 @@
|
||||
"amount" ['[?e :payment/amount ?sort-amount]]
|
||||
"status" ['[?e :payment/status ?sort-status]]}
|
||||
args)
|
||||
(:exact-match-id args)
|
||||
(merge-query {:query {:in ['?e]
|
||||
:where []}
|
||||
:args [(:exact-match-id args)]})
|
||||
|
||||
(limited-clients (:id args))
|
||||
(merge-query {:query {:in ['[?xx ...]]
|
||||
:where ['[?e :payment/client ?xx]]}
|
||||
:args [(set (map :db/id (limited-clients (:id args))))]})
|
||||
|
||||
|
||||
(:client-id args)
|
||||
(merge-query {:query {:in ['?client-id]
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
:in ['$]
|
||||
:where ['[?e :invoice/client]]}
|
||||
:args [(d/db (d/connect uri))]}
|
||||
|
||||
|
||||
(:exact-match-id args)
|
||||
(merge-query {:query {:in ['?e]
|
||||
:where []}
|
||||
:args [(:exact-match-id args)]})
|
||||
(limited-clients (:id args))
|
||||
(merge-query {:query {:in ['[?xx ...]]
|
||||
:where ['[?e :invoice/client ?xx]]}
|
||||
|
||||
@@ -536,6 +536,7 @@
|
||||
|
||||
:invoice_page {:type '(list :invoice_page)
|
||||
:args {:import_status {:type 'String}
|
||||
:exact_match_id {:type :id}
|
||||
:date_range {:type :date_range}
|
||||
:due_range {:type :date_range}
|
||||
:status {:type :invoice_status}
|
||||
@@ -618,6 +619,7 @@
|
||||
:payment_page {:type '(list :payment_page)
|
||||
:args {:client_id {:type :id}
|
||||
:vendor_id {:type :id}
|
||||
:exact_match_id {:type :id}
|
||||
:date_range {:type :date_range}
|
||||
:amount_lte {:type :money}
|
||||
:amount_gte {:type :money}
|
||||
@@ -646,6 +648,8 @@
|
||||
:asc {:type 'Boolean}}}
|
||||
|
||||
:transaction_filters {:fields {:client_id {:type :id}
|
||||
:exact_match_id {:type :id}
|
||||
|
||||
:vendor_id {:type :id}
|
||||
:bank_account_id {:type :id}
|
||||
:account_id {:type :id}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
(defn query [params]
|
||||
{:venia/queries [[:invoice_page
|
||||
{
|
||||
:exact-match-id (some-> params :exact-match-id str)
|
||||
:start (:start params 0)
|
||||
:sort (:sort params)
|
||||
:per-page (:per-page params)
|
||||
@@ -96,7 +97,7 @@
|
||||
{:db db}))
|
||||
|
||||
(defn row [{:keys [invoice check-boxes selected-client overrides checkable? expense-event actions]}]
|
||||
(let [{:keys [client payments expense-accounts invoice-number date due total outstanding-balance id vendor] :as i} invoice
|
||||
(let [{:keys [client status payments expense-accounts invoice-number date due total outstanding-balance id vendor] :as i} invoice
|
||||
accounts-by-id @(re-frame/subscribe [::subs/accounts-by-id client])
|
||||
account->name #(:name (accounts-by-id (:id %)))]
|
||||
[grid/row {:class (:class i) :id id :checkable? checkable? :entity invoice}
|
||||
@@ -110,11 +111,13 @@
|
||||
[grid/cell {} (date->str date) ]
|
||||
[grid/cell {}
|
||||
(when due
|
||||
(let [due-in (days-until due)]
|
||||
(if (> due-in 0)
|
||||
[:span.has-text-success due-in " days"]
|
||||
[:span.has-text-danger due-in " days"])
|
||||
))]
|
||||
(if (#{":paid" :paid ":voided" :voided} status)
|
||||
nil
|
||||
(let [due-in (days-until due)]
|
||||
(if (> due-in 0)
|
||||
[:span.has-text-success due-in " days"]
|
||||
[:span.has-text-danger due-in " days"])
|
||||
)))]
|
||||
[grid/cell {} (str/join ", " (set (map :location expense-accounts)))]
|
||||
|
||||
[grid/cell {:class "has-text-right"} (nf total )]
|
||||
@@ -153,18 +156,24 @@
|
||||
^{:key (:id payment)}
|
||||
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :payments )
|
||||
"?"
|
||||
(url/map->query {:check-number-like (:check-number (:payment payment))}))
|
||||
(url/map->query {:exact-match-id (:id (: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) ) ")")]
|
||||
[:span.icon {:class [(when (= :cleared (:status (:payment payment)))
|
||||
"has-text-success")]}
|
||||
[:i.fa.fa-money]]
|
||||
|
||||
^{: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))))))]))]]
|
||||
(if (:check-number (:payment payment))
|
||||
(str "Check " (:check-number (:payment payment))
|
||||
" (" (gstring/format "$%.2f" (:amount payment) ) ")"
|
||||
(when (= :cleared (:status (:payment payment)))
|
||||
(str " - " (:post-date (:transaction (:payment payment))))))
|
||||
|
||||
(str "Debit (" (gstring/format "$%.2f" (:amount payment) ) ") "
|
||||
(when (= :cleared (:status (:payment payment)))
|
||||
(str " - " (:post-date (:transaction (:payment payment)))))
|
||||
(when (= :cleared (:status (:payment payment)))
|
||||
(str " - " (:post-date (:transaction (:payment payment))))))) ]))]]
|
||||
[:span {:style {:margin-right "1em"}}]])
|
||||
(when (and (get actions :edit)
|
||||
(not= ":voided" (:status i)))
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[auto-ap.views.components.switch-field :refer [switch-field]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-entity]]
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[auto-ap.views.utils :refer [active-when dispatch-value-change]]
|
||||
[auto-ap.views.utils :refer [active-when dispatch-event dispatch-value-change]]
|
||||
[bidi.bidi :as bidi]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
@@ -106,6 +106,13 @@
|
||||
[:div
|
||||
[invoice-number-filter params]]
|
||||
|
||||
(when-let [exact-match-id @(re-frame/subscribe [::data-page/filter data-page :exact-match-id])]
|
||||
[:div
|
||||
[:p.menu-label "Specific Invoice"]
|
||||
[:span.tag.is-medium exact-match-id " "
|
||||
[:button.delete.is-small {:on-click
|
||||
(dispatch-event [::data-page/filter-changed data-page :exact-match-id nil])}]]])
|
||||
|
||||
(when (= "admin" (:user/role user))
|
||||
[:<>
|
||||
[:p.menu-label "Admin only"]
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
:sort (:sort params)
|
||||
:client-id (:id @(re-frame/subscribe [::subs/client]))
|
||||
:vendor-id (:id (:vendor params))
|
||||
:exact-match-id (some-> (:exact-match-id params) str)
|
||||
:date-range (:date-range params)
|
||||
:amount-gte (:amount-gte (:amount-range params))
|
||||
:amount-lte (:amount-lte (:amount-range params))
|
||||
@@ -46,7 +47,7 @@
|
||||
[[:payments [:id :status :amount :type :check_number :s3_url
|
||||
[:bank-account [:name]]
|
||||
:date [:vendor [:name :id]] [:client [:name :id]]
|
||||
[:invoices [:invoice-id [:invoice [:invoice-number]]]]]]
|
||||
[:invoices [:invoice-id [:invoice [:invoice-number :id]]]]]]
|
||||
:total
|
||||
:start
|
||||
:end]]]}
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
(ns auto-ap.views.pages.payments.side-bar
|
||||
(:require [auto-ap.routes :as routes]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.utils :refer [active-when dispatch-value-change]]
|
||||
[auto-ap.views.components.vendor-filter :refer [vendor-filter]]
|
||||
(:require [auto-ap.subs :as subs]
|
||||
[auto-ap.views.components.date-range-filter :refer [date-range-filter]]
|
||||
[auto-ap.views.components.number-filter :refer [number-filter]]
|
||||
[auto-ap.views.components.bank-account-filter :refer [bank-account-filter]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-entity]]
|
||||
[bidi.bidi :as bidi]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.views.pages.data-page :as data-page]))
|
||||
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[auto-ap.views.utils :refer [dispatch-event dispatch-value-change]]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(defn side-bar [{:keys [data-page]}]
|
||||
(let [ap @(re-frame/subscribe [::subs/active-page])
|
||||
@@ -48,4 +43,11 @@
|
||||
[:div.field
|
||||
[:div.control [:input.input {:placeholder "SJ-12345"
|
||||
:value @(re-frame/subscribe [::data-page/filter data-page :invoice-number])
|
||||
:on-change (dispatch-value-change [::data-page/filter-changed data-page :invoice-number])} ]]]]]))
|
||||
:on-change (dispatch-value-change [::data-page/filter-changed data-page :invoice-number])} ]]]
|
||||
|
||||
(when-let [exact-match-id @(re-frame/subscribe [::data-page/filter data-page :exact-match-id])]
|
||||
[:div
|
||||
[:p.menu-label "Specific Payment"]
|
||||
[:span.tag.is-medium exact-match-id " "
|
||||
[:button.delete.is-small {:on-click
|
||||
(dispatch-event [::data-page/filter-changed data-page :exact-match-id nil])}]]])]]))
|
||||
|
||||
@@ -76,8 +76,9 @@
|
||||
^{:key (:invoice-number (:invoice invoice))}
|
||||
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :invoices )
|
||||
"?"
|
||||
(url/map->query {:invoice-number-like (str "\"" (:invoice-number (:invoice invoice)) "\"")}))
|
||||
:target "_new"} (str " " (:invoice-number (:invoice invoice)))])]])
|
||||
(url/map->query {:exact-match-id (:id (:invoice invoice))}))
|
||||
:target "_new"}
|
||||
(str " " (:invoice-number (:invoice invoice)))])]])
|
||||
[:span {:style {:margin-left "1em"}}]
|
||||
|
||||
(when (or (= :pending status)
|
||||
|
||||
Reference in New Issue
Block a user