Description filter
This commit is contained in:
@@ -59,6 +59,8 @@
|
|||||||
(merge-query {:query {:in ['?vendor-id]
|
(merge-query {:query {:in ['?vendor-id]
|
||||||
:where ['[?e :transaction/vendor ?vendor-id]]}
|
:where ['[?e :transaction/vendor ?vendor-id]]}
|
||||||
:args [(:vendor-id args)]})
|
:args [(:vendor-id args)]})
|
||||||
|
|
||||||
|
|
||||||
(:amount-gte args)
|
(:amount-gte args)
|
||||||
(merge-query {:query {:in ['?amount-gte]
|
(merge-query {:query {:in ['?amount-gte]
|
||||||
:where ['[?e :transaction/amount ?a]
|
:where ['[?e :transaction/amount ?a]
|
||||||
@@ -100,6 +102,12 @@
|
|||||||
'[?c :client/original-id ?original-id]]}
|
'[?c :client/original-id ?original-id]]}
|
||||||
:args [(:original-id args)]})
|
:args [(:original-id args)]})
|
||||||
|
|
||||||
|
(:description args)
|
||||||
|
(merge-query {:query {:in ['?description]
|
||||||
|
:where ['[?e :transaction/description-original ?do]
|
||||||
|
'[(.contains ?do ?description)]]}
|
||||||
|
:args [(:description args)]})
|
||||||
|
|
||||||
true
|
true
|
||||||
(merge-query {:query {:find ['?base-date '?e] :where ['[?e :transaction/id]
|
(merge-query {:query {:find ['?base-date '?e] :where ['[?e :transaction/id]
|
||||||
'[?e :transaction/date ?base-date]]}}))]
|
'[?e :transaction/date ?base-date]]}}))]
|
||||||
|
|||||||
@@ -401,6 +401,7 @@
|
|||||||
: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}
|
||||||
|
:description {:type 'String}
|
||||||
:start {:type 'Int}
|
:start {:type 'Int}
|
||||||
:sort_by {:type 'String}
|
:sort_by {:type 'String}
|
||||||
:asc {:type 'Boolean}
|
:asc {:type 'Boolean}
|
||||||
|
|||||||
43
src/cljs/auto_ap/views/components/number-filter
Normal file
43
src/cljs/auto_ap/views/components/number-filter
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
(ns auto-ap.views.components.number-filter
|
||||||
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[auto-ap.entities.invoice :as invoice]
|
||||||
|
[auto-ap.views.components.typeahead :refer [typeahead]]
|
||||||
|
[auto-ap.views.utils :refer [bind-field date-picker date->str local-now standard]]
|
||||||
|
[cljs-time.core :as t]
|
||||||
|
[re-frame.core :as re-frame]))
|
||||||
|
|
||||||
|
(defn dispatch-change [on-change-event start end]
|
||||||
|
(fn [_]
|
||||||
|
(re-frame/dispatch (into on-change-event [[:start] start]) )
|
||||||
|
(re-frame/dispatch (into on-change-event [[:end] end]))))
|
||||||
|
|
||||||
|
(defn number-filter [{:keys [value on-change-event]}]
|
||||||
|
[:div
|
||||||
|
[:div.field.has-addons
|
||||||
|
[:div.control
|
||||||
|
[bind-field
|
||||||
|
[date-picker {:class-name "input is-fullwidth"
|
||||||
|
:class "input"
|
||||||
|
:format-week-number (fn [] "")
|
||||||
|
:previous-month-button-label ""
|
||||||
|
:placeholder-text "Start"
|
||||||
|
:next-month-button-label ""
|
||||||
|
:next-month-label ""
|
||||||
|
:event on-change-event
|
||||||
|
:type "date"
|
||||||
|
:field [:start]
|
||||||
|
:subscription value}]]]
|
||||||
|
[:div.control
|
||||||
|
[bind-field
|
||||||
|
[date-picker {:class-name "input is-fullwidth"
|
||||||
|
:class "input"
|
||||||
|
:format-week-number (fn [] "")
|
||||||
|
:previous-month-button-label ""
|
||||||
|
:placeholder-text "End"
|
||||||
|
:next-month-button-label ""
|
||||||
|
:event on-change-event
|
||||||
|
:next-month-label ""
|
||||||
|
:type "date"
|
||||||
|
:field [:end]
|
||||||
|
:subscription value}]]]]])
|
||||||
62
src/cljs/auto_ap/views/components/number_filter.cljs
Normal file
62
src/cljs/auto_ap/views/components/number_filter.cljs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
(ns auto-ap.views.components.number-filter
|
||||||
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[auto-ap.entities.invoice :as invoice]
|
||||||
|
[auto-ap.views.components.typeahead :refer [typeahead]]
|
||||||
|
[auto-ap.views.utils :refer [bind-field date-picker date->str local-now standard]]
|
||||||
|
[cljs-time.core :as t]
|
||||||
|
[re-frame.core :as re-frame]))
|
||||||
|
|
||||||
|
(defn dispatch-change [on-change-event start end]
|
||||||
|
(fn [_]
|
||||||
|
(re-frame/dispatch (into on-change-event [[:start] start]) )
|
||||||
|
(re-frame/dispatch (into on-change-event [[:end] end]))))
|
||||||
|
|
||||||
|
(defn number-filter [{:keys [value on-change-event]}]
|
||||||
|
[:div.field
|
||||||
|
[:div.control
|
||||||
|
[:div.columns
|
||||||
|
[:div.column
|
||||||
|
[bind-field
|
||||||
|
[:input.input {:type "number"
|
||||||
|
:placeholder ">="
|
||||||
|
:field [:amount-gte]
|
||||||
|
:step "0.01"
|
||||||
|
:event on-change-event
|
||||||
|
:subscription value}]]]
|
||||||
|
[:div.column
|
||||||
|
[bind-field
|
||||||
|
[:input.input {:type "number"
|
||||||
|
:placeholder "<="
|
||||||
|
:field [:amount-lte]
|
||||||
|
:event on-change-event
|
||||||
|
:step "0.01"
|
||||||
|
:subscription value}]]]]]]
|
||||||
|
#_[:div
|
||||||
|
[:div.field.has-addons
|
||||||
|
[:div.control
|
||||||
|
[bind-field
|
||||||
|
[date-picker {:class-name "input is-fullwidth"
|
||||||
|
:class "input"
|
||||||
|
:format-week-number (fn [] "")
|
||||||
|
:previous-month-button-label ""
|
||||||
|
:placeholder-text "Start"
|
||||||
|
:next-month-button-label ""
|
||||||
|
:next-month-label ""
|
||||||
|
:event on-change-event
|
||||||
|
:type "date"
|
||||||
|
:field [:start]
|
||||||
|
:subscription value}]]]
|
||||||
|
[:div.control
|
||||||
|
[bind-field
|
||||||
|
[date-picker {:class-name "input is-fullwidth"
|
||||||
|
:class "input"
|
||||||
|
:format-week-number (fn [] "")
|
||||||
|
:previous-month-button-label ""
|
||||||
|
:placeholder-text "End"
|
||||||
|
:next-month-button-label ""
|
||||||
|
:event on-change-event
|
||||||
|
:next-month-label ""
|
||||||
|
:type "date"
|
||||||
|
:field [:end]
|
||||||
|
:subscription value}]]]]])
|
||||||
@@ -114,6 +114,24 @@
|
|||||||
{:dispatch [::params-change (::params updated)]
|
{:dispatch [::params-change (::params updated)]
|
||||||
:db updated})))
|
:db updated})))
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::description-settled
|
||||||
|
(fn [{:keys [db]} [_ description]]
|
||||||
|
(let [updated (-> db
|
||||||
|
(assoc-in [::params :description] description))]
|
||||||
|
{:dispatch [::params-change (::params updated)]
|
||||||
|
:db updated})))
|
||||||
|
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::description-changed
|
||||||
|
(fn [{:keys [db]} [_ description]]
|
||||||
|
{:dispatch-debounce
|
||||||
|
{:event [::description-settled description]
|
||||||
|
:time 500
|
||||||
|
:key ::description}
|
||||||
|
:db (assoc-in db [::transaction-page :description] description)}))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
::notification
|
::notification
|
||||||
(fn [db]
|
(fn [db]
|
||||||
@@ -207,6 +225,7 @@
|
|||||||
{:on-change-event [::change-selected-bank-account]
|
{:on-change-event [::change-selected-bank-account]
|
||||||
:value (:bank-acount-filter @(re-frame/subscribe [::transaction-page]))
|
:value (:bank-acount-filter @(re-frame/subscribe [::transaction-page]))
|
||||||
:bank-accounts @(re-frame/subscribe [::subs/bank-accounts])}]]
|
:bank-accounts @(re-frame/subscribe [::subs/bank-accounts])}]]
|
||||||
|
|
||||||
[:p.menu-label "Date Range"]
|
[:p.menu-label "Date Range"]
|
||||||
[:div
|
[:div
|
||||||
[date-range-filter
|
[date-range-filter
|
||||||
@@ -225,8 +244,15 @@
|
|||||||
:on-change #(re-frame/dispatch [::change-selected-vendor %])
|
:on-change #(re-frame/dispatch [::change-selected-vendor %])
|
||||||
:match->text :name
|
:match->text :name
|
||||||
:type "typeahead-entity"
|
:type "typeahead-entity"
|
||||||
:value (:vendor-filter @(re-frame/subscribe [::transaction-page]))}]
|
:value (:vendor-filter @(re-frame/subscribe [::transaction-page]))}]]
|
||||||
] ]
|
|
||||||
|
[:p.menu-label "Description"]
|
||||||
|
[:div
|
||||||
|
[:div.field
|
||||||
|
[:div.control [:input.input {:placeholder "CHECK 123 ABC"
|
||||||
|
:value (:description @(re-frame/subscribe [::transaction-page]))
|
||||||
|
:on-change (fn [e]
|
||||||
|
(re-frame/dispatch [::description-changed (.. e -target -value) ]))} ]]]]]
|
||||||
:main [(get main-content approval-status)]
|
:main [(get main-content approval-status)]
|
||||||
|
|
||||||
:bottom [:div
|
:bottom [:div
|
||||||
|
|||||||
Reference in New Issue
Block a user