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