Makes dropdown rerender the page
This commit is contained in:
@@ -16,12 +16,12 @@
|
|||||||
(:vendor/legal-entity-tin vendor)
|
(:vendor/legal-entity-tin vendor)
|
||||||
(:vendor/legal-entity-tin-type vendor))))
|
(:vendor/legal-entity-tin-type vendor))))
|
||||||
|
|
||||||
(defn get-1099-companies [user]
|
(defn get-1099-companies [user session]
|
||||||
(let [clients (->> (d/q '[:find ?c
|
(let [clients (->> (d/q '[:find ?c
|
||||||
:in $ ?user
|
:in $ ?user ?c
|
||||||
:where [?c :client/code]
|
:where [?c :client/code]
|
||||||
[(auto-ap.graphql.utils/can-see-client? ?user ?c)]]
|
[(auto-ap.graphql.utils/can-see-client? ?user ?c)]]
|
||||||
(d/db conn) user)
|
(d/db conn) user (some-> session :client :db/id))
|
||||||
(map first)
|
(map first)
|
||||||
set)]
|
set)]
|
||||||
(->> (if (is-admin? user)
|
(->> (if (is-admin? user)
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
:vendor/legal-entity-last-name])
|
:vendor/legal-entity-last-name])
|
||||||
(sum ?a)
|
(sum ?a)
|
||||||
:with ?d
|
:with ?d
|
||||||
:in $
|
:in $ ?c
|
||||||
:where
|
:where
|
||||||
[?p :payment/date ?d ]
|
[?p :payment/date ?d ]
|
||||||
[(>= ?d #inst "2022-01-01T08:00")]
|
[(>= ?d #inst "2022-01-01T08:00")]
|
||||||
@@ -51,7 +51,8 @@
|
|||||||
[?p :payment/client ?c]
|
[?p :payment/client ?c]
|
||||||
[?p :payment/amount ?a]
|
[?p :payment/amount ?a]
|
||||||
[?p :payment/vendor ?v]]
|
[?p :payment/vendor ?v]]
|
||||||
(d/db conn))
|
(d/db conn)
|
||||||
|
(some-> session :client :db/id))
|
||||||
(d/q '[:find
|
(d/q '[:find
|
||||||
(pull ?c [:client/code :db/id])
|
(pull ?c [:client/code :db/id])
|
||||||
(pull ?v [:db/id
|
(pull ?v [:db/id
|
||||||
@@ -99,8 +100,13 @@
|
|||||||
footer]]
|
footer]]
|
||||||
[:button.modal-close.is-large {"_" (hiccup/raw "on click remove <#modal-holder div/>")}]])
|
[:button.modal-close.is-large {"_" (hiccup/raw "on click remove <#modal-holder div/>")}]])
|
||||||
|
|
||||||
(defn table [{:keys [identity]} & {:keys [flash-id]}]
|
(defn table [{:keys [identity session]} & {:keys [flash-id]}]
|
||||||
[:table#vendor-table.table.grid.compact.is-fullwidth
|
|
||||||
|
[:table#vendor-table.table.grid.compact.is-fullwidth {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||||
|
:company-1099-vendor-table
|
||||||
|
:request-method :get)
|
||||||
|
:hx-trigger "clientSelected from:body"
|
||||||
|
:hx-swap "outerHTML"}
|
||||||
[:thead
|
[:thead
|
||||||
[:tr
|
[:tr
|
||||||
[:th {:style {:width "5em"}}"Client"]
|
[:th {:style {:width "5em"}}"Client"]
|
||||||
@@ -113,7 +119,7 @@
|
|||||||
[:th {:style {:width "10em"}}]
|
[:th {:style {:width "10em"}}]
|
||||||
]]
|
]]
|
||||||
[:tbody
|
[:tbody
|
||||||
(for [[client vendor amount] (get-1099-companies identity)]
|
(for [[client vendor amount] (get-1099-companies identity session)]
|
||||||
[:tr (when (= flash-id
|
[:tr (when (= flash-id
|
||||||
(:db/id vendor))
|
(:db/id vendor))
|
||||||
{:class "live-added"})
|
{:class "live-added"})
|
||||||
@@ -313,7 +319,7 @@
|
|||||||
[:div#vendor-table {:hx-get (bidi/path-for ssr-routes/only-routes
|
[:div#vendor-table {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||||
:company-1099-vendor-table
|
:company-1099-vendor-table
|
||||||
:request-method :get)
|
:request-method :get)
|
||||||
:hx-trigger "load"
|
:hx-trigger "load, clientSelected from:body"
|
||||||
:hx-swap "outerHTML"}
|
:hx-swap "outerHTML"}
|
||||||
[:div.container
|
[:div.container
|
||||||
[:div.column.is-4.is-offset-4.has-text-centered
|
[:div.column.is-4.is-offset-4.has-text-centered
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ document.getElementById(\"company-search-value\").dispatchEvent(new Event('chang
|
|||||||
"_" (hiccup/raw
|
"_" (hiccup/raw
|
||||||
"on click
|
"on click
|
||||||
toggle .is-active on <#company-dropdown />
|
toggle .is-active on <#company-dropdown />
|
||||||
then focus() on next <#company-dropdown input/>
|
|
||||||
end
|
end
|
||||||
")
|
")
|
||||||
}
|
}
|
||||||
@@ -100,4 +99,6 @@ document.getElementById(\"company-search-value\").dispatchEvent(new Event('chang
|
|||||||
(html-response
|
(html-response
|
||||||
(dropdown (assoc request :session new-session)))
|
(dropdown (assoc request :session new-session)))
|
||||||
:session
|
:session
|
||||||
new-session)))
|
new-session
|
||||||
|
:headers
|
||||||
|
{"hx-trigger" "clientSelected"})))
|
||||||
|
|||||||
Reference in New Issue
Block a user