Merge branch 'master' of codecommit://integreat
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
(ns auto-ap.ssr.components.date-range
|
(ns auto-ap.ssr.components.date-range
|
||||||
(:require [auto-ap.ssr.components :as com]
|
(:require [auto-ap.ssr.components :as com]
|
||||||
|
[auto-ap.ssr.components.buttons :as but]
|
||||||
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
[clj-time.coerce :as c]
|
[clj-time.coerce :as c]
|
||||||
[clj-time.core :as t]
|
[clj-time.core :as t]
|
||||||
[clj-time.periodic :as per]))
|
[clj-time.periodic :as per]))
|
||||||
|
|
||||||
(defn date-range-field [{:keys [value id]}]
|
(defn date-range-field [{:keys [value id apply-button?]}]
|
||||||
[:div {:id id}
|
[:div {:id id}
|
||||||
(com/field {:label "Date Range"}
|
(com/field {:label "Date Range"}
|
||||||
[:div.space-y-4
|
[:div.space-y-4
|
||||||
@@ -21,11 +23,17 @@
|
|||||||
(atime/unparse-local atime/normal-date))
|
(atime/unparse-local atime/normal-date))
|
||||||
:placeholder "Date"
|
:placeholder "Date"
|
||||||
:size :small
|
:size :small
|
||||||
:class "shrink"})
|
:class "shrink date-filter-input"})
|
||||||
|
|
||||||
(com/date-input {:name "end-date"
|
(com/date-input {:name "end-date"
|
||||||
:value (some-> (:end value)
|
:value (some-> (:end value)
|
||||||
(atime/unparse-local atime/normal-date))
|
(atime/unparse-local atime/normal-date))
|
||||||
:placeholder "Date"
|
:placeholder "Date"
|
||||||
:size :small
|
:size :small
|
||||||
:class "shrink"})]])])
|
:class "shrink date-filter-input"})
|
||||||
|
(when apply-button?
|
||||||
|
(but/button- {:color :secondary
|
||||||
|
:size :small
|
||||||
|
:type "button"
|
||||||
|
"x-on:click" "$dispatch('datesApplied')"}
|
||||||
|
"Apply"))]])])
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
[auto-ap.ssr.invoice.common :refer [default-read]]
|
[auto-ap.ssr.invoice.common :refer [default-read]]
|
||||||
[auto-ap.ssr.invoice.import :as invoice-import]
|
[auto-ap.ssr.invoice.import :as invoice-import]
|
||||||
[auto-ap.ssr.invoice.new-invoice-wizard :as new-invoice-wizard :refer [location-select*]]
|
[auto-ap.ssr.invoice.new-invoice-wizard :as new-invoice-wizard :refer [location-select*]]
|
||||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
[auto-ap.ssr.components.date-range :as dr]
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.ssr.utils
|
[auto-ap.ssr.utils
|
||||||
:refer [apply-middleware-to-all-handlers assert-schema
|
:refer [apply-middleware-to-all-handlers assert-schema
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
[:div {:id "exact-match-id-tag"}]))
|
[:div {:id "exact-match-id-tag"}]))
|
||||||
|
|
||||||
(defn filters [request]
|
(defn filters [request]
|
||||||
[:form#invoice-filters {"hx-trigger" "change delay:500ms, keyup changed from:.hot-filter delay:1000ms"
|
[:form#invoice-filters {"hx-trigger" "datesApplied, change delay:500ms from:.filter-trigger, keyup changed from:.hot-filter delay:1000ms"
|
||||||
"hx-get" (bidi/path-for ssr-routes/only-routes
|
"hx-get" (bidi/path-for ssr-routes/only-routes
|
||||||
::route/table)
|
::route/table)
|
||||||
"hx-target" "#entity-table"
|
"hx-target" "#entity-table"
|
||||||
@@ -92,7 +92,8 @@
|
|||||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||||
:value (:vendor (:query-params request))
|
:value (:vendor (:query-params request))
|
||||||
:value-fn :db/id
|
:value-fn :db/id
|
||||||
:content-fn :vendor/name}))
|
:content-fn :vendor/name
|
||||||
|
:class "filter-trigger"}))
|
||||||
(com/field {:label "Account"}
|
(com/field {:label "Account"}
|
||||||
(com/typeahead {:name "account"
|
(com/typeahead {:name "account"
|
||||||
:id "account"
|
:id "account"
|
||||||
@@ -100,8 +101,12 @@
|
|||||||
:value (:account (:query-params request))
|
:value (:account (:query-params request))
|
||||||
:value-fn :db/id
|
:value-fn :db/id
|
||||||
:content-fn #(:account/name (d-accounts/clientize (dc/pull (dc/db conn) d-accounts/default-read (:db/id %))
|
:content-fn #(:account/name (d-accounts/clientize (dc/pull (dc/db conn) d-accounts/default-read (:db/id %))
|
||||||
(:db/id (:client request))))}))
|
(:db/id (:client request))))
|
||||||
(date-range-field* request)
|
:class "filter-trigger"}))
|
||||||
|
(dr/date-range-field {:value {:start (:start-date (:query-params request))
|
||||||
|
:end (:end-date (:query-params request))}
|
||||||
|
:id "date-range"
|
||||||
|
:apply-button? true})
|
||||||
(com/field {:label "Check #"}
|
(com/field {:label "Check #"}
|
||||||
(com/text-input {:name "check-number"
|
(com/text-input {:name "check-number"
|
||||||
:id "check-number"
|
:id "check-number"
|
||||||
@@ -486,7 +491,10 @@
|
|||||||
:fetch-page fetch-page
|
:fetch-page fetch-page
|
||||||
:oob-render
|
:oob-render
|
||||||
(fn [request]
|
(fn [request]
|
||||||
[(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)
|
[(assoc-in (dr/date-range-field {:value {:start (:start-date (:query-params request))
|
||||||
|
:end (:end-date (:query-params request))}
|
||||||
|
:id "date-range"
|
||||||
|
:apply-button? true}) [1 :hx-swap-oob] true)
|
||||||
(assoc-in (exact-match-id* request) [1 :hx-swap-oob] true)])
|
(assoc-in (exact-match-id* request) [1 :hx-swap-oob] true)])
|
||||||
:query-schema query-schema
|
:query-schema query-schema
|
||||||
:parse-query-params (fn [p]
|
:parse-query-params (fn [p]
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
data (into []
|
data (into []
|
||||||
(for [client-id client-ids
|
(for [client-id client-ids
|
||||||
d date
|
d date
|
||||||
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id (coerce/to-date (time/plus d (time/days 1))))
|
[client-id account-id location debits credits balance count] (iol-ion.query/detailed-account-snapshot (dc/db conn) client-id (coerce/to-date d))
|
||||||
:let [account ((or (lookup-account client-id) {}) account-id)]]
|
:let [account ((or (lookup-account client-id) {}) account-id)]]
|
||||||
{:client-id client-id
|
{:client-id client-id
|
||||||
:account-id account-id
|
:account-id account-id
|
||||||
|
|||||||
Reference in New Issue
Block a user